-
Notifications
You must be signed in to change notification settings - Fork 186
/
drupalgap.min.js
3 lines (3 loc) · 64.5 KB
/
drupalgap.min.js
1
2
3
function core_rest_pre_process(e,t){dg.spinnerShow()}function core_rest_post_process(e){dg.spinnerHide()}function core_pre_process_route_change(e,t){dg.clearBuckets()}function system_pre_process_route_change(e,t){if("undefined"!=typeof t){var r=dg.blocksLoad();for(var o in r)if(r.hasOwnProperty(o)){var n=r[o],i=n.getRegion();i&&i.getHiddenBlocks().length==i.getBlocks().length&&dg.removeBodyClass("no-"+i.get("id"))}}}var dg={activeTheme:null,blocks:null,regions:null,spinner:0,themes:{},_title:"",_continued:!1,_postRenderMax:128,_libraries:{},_messages:[]},drupalgap=dg;dg.settings={mode:"web-app",front:null,blocks:{}},dg.start=function(){dg.isCompiled()?document.addEventListener("deviceready",dg.deviceready,!1):dg.deviceready()},dg.deviceready=function(){dg.bootstrap(),jDrupal.moduleInvokeAll("deviceready").then(function(){jDrupal.moduleImplements("deviceready")||dg._continued||jDrupal.connect().then(dg.continue,function(){console.log("deviceready connect failed",arguments)})})},dg.bootstrap=function(){dg.router.config({});var e=jDrupal.modulesLoad(),t=[];for(var r in e)if(e.hasOwnProperty(r)){var o=dg.getModuleRoutes(r);if(o)for(var n in o)if(o.hasOwnProperty(n)){var i=o[n];i.key=n,dg.router.add(i);var d=dg.router.hasBaseRoute(i);if(d){var u=dg.router.getBaseRoute(i);u?dg.router.saveAsChildRoute(i,u):t.push(i)}}}var a=t.length;if(a)for(var s=0;s<a;s++){var i=t[s],u=dg.router.getBaseRoute(i);u&&dg.router.saveAsChildRoute(i,u)}dg.config("front")||dg.config("front","dg"),dg.themeLoad().then(function(){dg.blocksLoad(),jDrupal.moduleInvokeAll("init").then(function(){dg.router.add(function(){}).listen()})})},dg.continue=function(){dg._continued=!0,dg.router.check(dg.router.getPath())},dg.spinnerShow=function(){dg.spinner++},dg.spinnerHide=function(){dg.spinner--},dg.isArray=function(e){return jDrupal.isArray(e)},dg.isEmpty=function(e){return jDrupal.isEmpty(e)},dg.isInt=function(e){return jDrupal.isInt(e)},dg.salt=function(){var e=dg.pepper();return dg.isInt(e[0])?dg.salt():e},dg.pepper=function(){return jDrupal.userPassword.apply(this,arguments)},dg.currentUser=function(){return jDrupal.currentUser()},dg.userPassword=function(){return console.log("dg.userPassword() is deprecated, use dg.salt() instead."),dg.salt.apply(this,arguments)},dg.Block=function(e,t,r,o){for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);for(var i in o)o.hasOwnProperty(i)&&(this[i]=o[i]);this._id||(this._id=t),this._module||(this._module=e),this._format||(this._format="div"),this._before||(this._before=""),this._prefix||(this._prefix=""),this._suffix||(this._suffix=""),this._after||(this._after=""),this._routes||(this._routes=[]),dg.setRenderElementDefaults(this),this._attributes.id||(this._attributes.id=dg.cleanCssIdentifier(t))},dg.Block.prototype.get=function(e){var t="_"+e;return"undefined"!=typeof this[t]?this[t]:null},dg.Block.prototype.set=function(e,t){var r="_"+e;this[r]=t},dg.Block.prototype.getRegion=function(){return dg.regions?dg.regions[this.get("region")]:null},dg.Block.prototype.buildWrapper=function(){var e=this;return new Promise(function(t,r){e.build().then(function(r){dg.setRenderElementDefaults(r),jDrupal.moduleInvokeAll("block_view_alter",r,e).then(function(){e.set("content",r),t(e)})})})},dg.Block.prototype.render=function(){var e=dg.cleanCssIdentifier(this.get("id")),t=dg.qs("#"+e),r=dg.render(this.get("content"));t?t.innerHTML=r:setTimeout(function(e){var t=dg.qs("#"+e);t&&(t.innerHTML=r)},1,e)},dg.Block.prototype.build=function(){return new Promise(function(e,t){e("")})},dg.Block.prototype.getVisibility=function(){var e=this,t=dg.currentUser();return new Promise(function(r,o){var n=!0,i=function(){r({visible:n,block:e})},d=e.get("access");if(d)return n=d.call(),void i();var u=e.get("roles");if(u){n=!1;for(var a=0;a<u.length&&!(n=t.hasRole(u[a].target_id)?u[a].visible:!u[a].visible);a++);}var s=e.get("routes");if(s.length){n=!1;for(var l=dg.getRoute(),a=0;a<s.length;a++)if(l.key==s[a].key)if(s[a].target_id){if(t.hasRole(s[a].target_id)&&(n=s[a].visible))break}else if(n=s[a].visible)break}i()})},dg.blocksLoad=function(){if(!dg.blocks){dg.blocks={};var e={},t=dg.config("theme").name,r=dg.settings.blocks[t],o=0;for(var n in r)if(r.hasOwnProperty(n)){var i=0;for(var d in r[n])if(r[n].hasOwnProperty(d)){var u=r[n][d];u._region=n,u._weight="undefined"!=typeof u._weight?u._weight:i,i=u._weight+1,e[d]=u,o++}}0==o&&console.log(dg.t("No blocks for @theme in settings.js",{"@theme":t}));var a=jDrupal.modulesLoad();for(var s in a)if(a.hasOwnProperty(s)&&a[s].blocks){var l=a[s].blocks();if(l)for(u in l)if(l.hasOwnProperty(u)&&e[u]){var g=l[u];if(dg.blocks[u]){var c='WARNING - The "'+u+'" block provided by the "'+dg.blocks[u].get("module")+'" module has been overwritten by the "'+s+'" module.';console.log(c)}dg.blocks[u]=new dg.Block(s,u,g,e[u])}}}return dg.blocks},dg.blockLoad=function(e){return dg.blocks[e]?dg.blocks[e]:null},dg.blockRefresh=function(e){"main"==e?dg.router.execute(function(t){dg.blockSetContent(e,t)}):dg.blockSetContent(e)},dg.blockSetContent=function(e,t){var r=dg.blockLoad(e);r.buildWrapper().then(function(e){t&&e.set("content",t),r.render()})},dg.getBlockFromDom=function(e){return document.querySelector("#"+dg.cleanCssIdentifier(e))},dg.config=function(e,t){return"undefined"!=typeof t?void(dg.settings[e]=t):"undefined"!=typeof dg.settings[e]?dg.settings[e]:null},dg.getMode=function(){return this.config("mode")},dg.setMode=function(e){this.config("mode",e)},dg.isCompiled=function(){return dg.inArray(dg.getMode(),["phonegap","cordova"])},dg.platform=function(){return dg.isCompiled()?device.platform.toLowerCase():"web"},dg.hasConnection=function(){return!dg.isCompiled()||navigator.connection.type!=Connection.NONE},dg.getRoute=function(){return dg.router.load(dg.getPath())},dg.getPath=function(){var e=dg.router.getPath();return""==e&&(e=dg.getFrontPagePath()),e},dg.getUrl=function(){return window.location.href},dg.getFrontPagePath=function(){var e=dg.config("front");return null==e&&(e="dg"),e},dg.arg=function(e,t){t||(t=dg.getPath());var r=t.split("/");return"undefined"==typeof e||null===e?r:"undefined"!=typeof r[e]?r[e]:null},dg.error=function(e,t,r,o){r&&console.log(r);var n=dg.router.loadRoute("system."+t);return n?(dg.setTitle(n.defaults._title),void n.defaults._controller().then(function(e){dg.blockSetContent("main",e)})):(console.log(t,arguments),void dg.alert(r))},dg.isFrontPage=function(){return dg.getFrontPagePath()==dg.getPath()||""==dg.getPath()},dg.getTitle=function(){return dg._title},dg.isObject=function(e){return"object"==typeof e},dg.isString=function(e){return"string"==typeof e},dg.isUndefined=function(e){return"undefined"==typeof e},dg.isProperty=function(e,t){return t.hasOwnProperty(e)&&"_"==e.charAt(0)},dg.removeFromArray=function(e,t){for(var r=t.length-1;r>=0;r--)if(t[r]===e){t.splice(r,1);break}},dg.setTitle=function(e,t,r){"undefined"==typeof t&&(t=!0),"undefined"==typeof r&&(r=!0),e=e?e:"","object"==typeof e&&(e=e._title?e._title:""),dg._title=e,t&&dg.setDocumentTitle(e),r&&dg.setPageTitle(e)},dg.getDocumentTitle=function(){return document.title},dg.setDocumentTitle=function(e){e=e?e:dg.config("title"),document.title=dg.theme("document_title",{_title:dg.t(e)})},dg.setPageTitle=function(e){var t=document.getElementById("title");t&&(t.innerHTML="string"==typeof e?dg.theme("title",{_title:e}):dg.render(e))},dg.attrs=function(e){var t=e._attributes;return t?dg.attributes(t):""},dg.attributes=function(e){var t="";if(e)for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];Array.isArray(o)&&o.length?t+=r+'="'+o.join(" ")+'" ':null===o?t+=" "+r+" ":""!=o?t+=r+'="'+o+'" ':"class"!=r&&(t+=r+" ")}return t},dg.attributesInit=function(e){var t=e._attributes?e._attributes:{};t.class?"string"==typeof t.class&&(t.class=[t.class]):t.class=[],e._attributes=t},dg.setVar=function(e,t){window.localStorage.setItem(e,JSON.stringify(t))},dg.getVar=function(e,t){var r=JSON.parse(window.localStorage.getItem(e));return null===r&&"undefined"!=typeof t?(dg.setVar(e,t),t):r},dg.deleteVar=function(e){return window.localStorage.removeItem(e)},dg.applyToConstructor=function(e,t){var r=[null].concat(t),o=e.bind.apply(e,r);return new o},dg.cleanCssIdentifier=function(e){return e.replace(/_/g,"-").toLowerCase()},dg.getCamelCase=function(e){return e.replace(/[-_]([a-z])/g,function(e){return e[1].toUpperCase()})},dg.extend=function(e,t){for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];jDrupal.isEmpty(o)||(e[r]=o)}return e},dg.killCamelCase=function(e,t){return t||(t="-"),jDrupal.lcfirst(e).replace(/([A-Z])/g,t+"$1").toLowerCase()},dg.hop=function(e,t){return e.hasOwnProperty(t)},dg.inArray=function(e,t){return jDrupal.inArray(e,t)},dg.imagePath=function(e){var t=dg.restPath()+e;return t.indexOf("public://")!=-1?t=t.replace("public://",dg.config("files").publicPath+"/"):t.indexOf("private://")!=-1&&(t=t.replace("private://",dg.config("files").privatePath+"/")),t},dg.elementAttributesInit=function(e){dg.attributesInit(e)},dg.b=function(e,t){return t||(t={}),t._value||(t._value=e),dg.theme("button",t)},dg.l=function(e,t,r){return r||(r={}),r._text||(r._text=e),r._path||(r._path=t),dg.theme("link",r)},dg.bl=function(e,t,r){return this.l.apply(this,arguments)},dg.removeElement=function(e){var t=dg.qs("#"+e);t&&t.parentElement.removeChild(t)},dg.t=function(e,t,r){if(t)for(var o in t)t.hasOwnProperty(o)&&(e=e.replace(o,t[o]));return e},dg.formatPlural=function(e,t,r){return 1==parseInt(e)?t:r},dg.Node=function(e){return new jDrupal.Node(e)},dg.entityController=function(e){var t={};return t.entity={_theme:"bucket",_grab:function(){var t=dg.router.getActiveRoute(),r=t.defaults._entity_type,o=dg.getCamelCase(r)+"Load";return new Promise(function(r,n){dg[o](e).then(function(e){t.defaults._handler(e,r,n)})})}},t},dg.forms={},dg.theme_form=function(e){var t="dg.theme_form - ",r="";e._id||(r="missing _id");var o=e._id,n=window[o];if(n||(r="form id not found: "+o),""!=r)return console.log(t+r),"";var i=dg.killCamelCase(o,"-");e._attributes.id="form-wrapper-"+i,e._node&&(e._attributes.id+="-"+e._node.nid);var d=e._attributes.id;return dg.render({_markup:"<div "+dg.attrs(e)+"></div>",_postRender:[function(){var r=dg.addForm(o,dg.applyToConstructor(n));r.getForm(e).then(function(e){var o=r.form,n=dg.qs("#"+d);return n?(n.innerHTML=e,dg.formHasActions(o)&&dg.formAttachSubmissionHandler(o._attributes.id),void dg.runPostRenders()):void console.log(t+"form wrapper missing: "+d)})}]})},dg.formDomIdFromId=function(e){return dg.killCamelCase(e,"-").toLowerCase()},dg.Form=function(e){this.id=e,this.form={_attributes:{id:dg.formDomIdFromId(e),class:[]},_validate:[e+".validateForm"],_submit:[e+".submitForm"],_after_build:[]},this.form_state=new dg.FormStateInterface(this),this.elements={}},dg.Form.prototype.get=function(e){return"undefined"!=typeof this[e]?this[e]:null},dg.Form.prototype.getFormId=function(){return this.get("id")},dg.Form.prototype.getFormDomId=function(){return this.form._attributes.id},dg.Form.prototype.getForm=function(){var e=this,t=arguments;return new Promise(function(r,o){var n=function(){e.form._attributes["data-id"]=e.id;for(var t in e.form)if(dg.isFormElement(t,e.form)){var o=e.form[t];if("actions"==o._type){dg.setFormElementDefaults(t,o);for(var n in o)dg.isFormElement(n,o)&&dg.setFormElementDefaults(n,o[n])}else dg.setFormElementDefaults(t,o)}var i=jDrupal.moduleInvokeAll("form_alter",e.form,e.getFormState(),e.getFormId()),d=function(){for(var t in e.form)if(dg.isFormElement(t,e.form)){var o=e.form[t];switch(o._type||(o._type="markup"),o._widgetType||(o._widgetType="FormElement"),o._widgetType){case"FieldWidget":case"FormWidget":var n=e.form._entity.get(t),i=0,d=new dg.modules[o._module][o._widgetType][o._type](e.form._entityType,e.form._bundle,t,o,n,i);if(e.elements[t]=d,d.form(n,i,o,e.form,e.form_state),"hidden"==o._type){e.form[t]=o;continue}var u={};o._title&&(u.label={_theme:"form_element_label",_title:o._title}),u.element=o;var a={_theme:"container",_children:u,_weight:o._weight};e.form[t]=a;break;case"FormElement":default:var s=o._widgetType;if(o._type){var l=jDrupal.ucfirst(dg.getCamelCase(o._type))+"Element";dg[l]&&(s=l)}var g=new dg[s](t,o,e);if(e.elements[t]=g,jDrupal.inArray(o._type,["hidden","markup"]))continue;var c=o._attributes,m=!!c.placeholder,f=!!o._description,p=f?c.id+"-description":null;f&&(o._attributes["aria-describedby"]=p);var u={_attributes:{class:[]}};o._title&&!m&&("checkbox"==o._type||(u.label={_theme:"form_element_label",_title:o._title,_attributes:{class:[],for:o._attributes.id}})),u.element=g,o._description&&(u.description={_theme:"description",_description:o._description,_attributes:{id:p}});var a={_theme:"container",_children:u,_attributes:{class:[]},_weight:o._weight};e.form[t]=a}}for(var h=[],_=0;_<e.form._after_build.length;_++){var v=e.form._after_build[_].split("."),y=v[0],b=v[1];dg.modules[y]&&dg.modules[y][b]&&h.push(dg.modules[y][b].apply(e,[e.form,e.getFormState()]))}Promise.all(h).then(function(){r("<form "+dg.attributes(e.form._attributes)+">"+dg.render(e.form)+"</form>")})};i?i.then(d):d()};if(t.length){for(var i=[e.form,e.form_state],d=0;d<t.length;d++)i.push(t[d]);e.buildForm.apply(this,i).then(n)}else e.buildForm(e.form,e.form_state).then(n)})},dg.Form.prototype.getFormState=function(){return this.form_state},dg.Form.prototype.buildForm=function(e,t,r){return new Promise(function(e,t){e()})},dg.Form.prototype.validateForm=function(e){return new Promise(function(e,t){e()})},dg.Form.prototype.submitForm=function(e,t,r){return new Promise(function(e,t){e()})},dg.Form.prototype.submit=function(){return this._submission()},dg.Form.prototype._submission=function(){var e=this;return e.disableSubmitButton(),new Promise(function(t,r){var o=e.getFormState();o.setFormState().then(function(){o.clearErrors(),e._validateForm().then(function(){return o.hasAnyErrors()?(e.enableSubmitButton(),o.displayErrors(),void r()):void e._submitForm(e,o).then(function(){var r=dg._GET("destination")?dg._GET("destination"):null;!r&&e.form._action&&(r=e.form._action),r&&dg.goto(r),t()}).catch(function(){e.enableSubmitButton()})})})})},dg.Form.prototype._validateForm=function(){var e=this,t=e.getFormState(),r=function(e){t.setErrorByName(e,dg.t("The @name field is required.",{"@name":e}))};for(var o in e.form)if(dg.isFormElement(o,e.form)){var n=e.form[o];if(n._theme&&"container"==n._theme){if("function"!=typeof n._children.element.get)continue;n._children.element.get("element")._required&&!n._children.element.validateValue(t.getValue(o))&&r(o)}else"undefined"!=typeof n._required&&n._required&&jDrupal.isEmpty(t.getValue(o))&&(console.log("_validateForm - we should be invoking validateValue here if possible"),r(o))}for(var i=[],d=0;d<e.form._validate.length;d++){var u=e.form._validate[d].split("."),a=u[0],s=u[1];a!=this.getFormId()||"validateForm"!=s?window[a]&&window[a][s]&&i.push(window[a][s].apply(e,[e.form,e.getFormState()])):i.push(this[s].apply(e,[e.form,e.getFormState()]))}return Promise.all(i)},dg.Form.prototype._submitForm=function(){for(var e=this,t=[],r=0;r<e.form._submit.length;r++){var o=e.form._submit[r].split("."),n=o[0],i=o[1];n!=this.getFormId()||"submitForm"!=i?dg.modules[n]&&dg.modules[n][i]&&t.push(dg.modules[n][i].apply(e,[e.form,e.getFormState()])):t.push(this[i].apply(e,[e.form,e.getFormState()]))}return Promise.all(t)},dg.Form.prototype.getSubmitButtonSelector=function(){return"#"+this.getFormDomId()+" #"+dg.formSubmitButtonId(this)},dg.Form.prototype.getSubmitButton=function(){return dg.qs(this.getSubmitButtonSelector())},dg.Form.prototype.enableSubmitButton=function(){var e=this.getSubmitButton();e&&(e.disabled=!1)},dg.Form.prototype.disableSubmitButton=function(){var e=this.getSubmitButton();e&&(dg.qs(e).disabled=!0)},dg.formSubmitButtonId=function(e){if(e.elements&&e.elements.actions){var t=e.elements.actions.element;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if(o&&dg.isFormElement(r,t)&&"submit"==o._type)return o._attributes.id}}return null},dg.createForm=function(e,t){return t.prototype=new dg.Form(e),t.constructor=t,window[e]=t,t},dg.addForm=function(e,t){return dg.forms[e]=t,dg.forms[e]},dg.formExists=function(e){return jDrupal.functionExists(e)},dg.loadForm=function(e){return dg.forms[e]?dg.forms[e]:null},dg.loadForms=function(){return dg.forms},dg.removeForm=function(e){delete dg.forms[e]},dg.removeForms=function(){dg.forms={}},dg.deleteForm=function(e){var t=dg.loadForm(e).form,r=t._attributes.id,o=dg.qs("#form-wrapper-"+r),n=o.parentNode;n.removeChild(o),dg.removeForm(e)},dg.getFormState=function(e){return dg.loadForm(e).getFormState()},dg.getFormStateValues=function(e){return dg.getFormState(e).getValues()},dg.getFormStateValue=function(e,t){return dg.getFormState(e).getValue(t)},dg.formHasActions=function(e){var t=!1;for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];if(o&&o._theme&&"container"==o._theme&&o._children){for(var n in o._children)if(o._children.hasOwnProperty(n)){var i=o._children[n];if("actions"==i.name){t=!0;break}}if(t)break}}return t},dg.formAttachSubmissionHandler=function(e){function t(e){e.preventDefault&&e.preventDefault();var t=r.getAttribute("data-id"),o=dg.loadForm(t);return o.submit().then(function(){},function(){}),!1}var r=dg.qs("#"+e);return!!r&&(r.attachEvent?r.attachEvent("submit",t):r.addEventListener("submit",t),!0)},dg.loadFormFromInterface=function(e){return dg.loadForm(jDrupal.ucfirst(dg.getCamelCase(e._attributes.id)))},dg.isFormElement=function(e,t){return"object"==typeof t&&t.hasOwnProperty(e)&&"_"!=e.charAt(0)},dg.isFormProperty=function(e,t){return t.hasOwnProperty(e)&&"_"==e.charAt(0)},dg.setFormElementDefaults=function(e,t){var r=t._attributes?t._attributes:{};r.id||(r.id=dg.formElementDomIdFromName(e)),r.name||(r.name=e),r.class||(r.class=[]),!r.value&&t._value&&(r.value=t._value),"undefined"!=typeof t._default_value&&(r.value=t._default_value),t._widgetType||(t._widgetType="FormElement"),t._title_placeholder&&(r.placeholder=t._title),t._attributes=r},dg.formElementDomIdFromName=function(e){return"edit-"+e.toLowerCase().replace(/_/g,"-")},dg.configForm=function(e){e._submit.push("system.configFormSubmit")},dg.FormElement=function(e,t,r){arguments.length&&dg.FormElementPrepare(this,arguments)},dg.FormElementPrepare=function(e,t){dg._formElementPrepare(e,t)},dg._formElementPrepare=function(e,t){var r=t[1];r&&"undefined"!=typeof r._default_value&&"undefined"==typeof r._attributes.value&&(r._attributes.value=r._default_value),e.name=t[0],e.element=r,e.form=t[2]},dg.FormElement.prototype.id=function(){return this.element?this.element._attributes.id:null},dg.FormElement.prototype.getForm=function(){return this.form},dg.FormElement.prototype.getFormDomId=function(){return this.getForm().getFormDomId()},dg.FormElement.prototype.get=function(e){return this[e],this[e]},dg.FormElement.prototype.getQuerySelector=function(){return"#"+this.getFormDomId()+" #"+this.id()},dg.FormElement.prototype.getElement=function(e){return this.get("element")[e],this.get("element")[e]},dg.FormElement.prototype.getDomElement=function(){return document.querySelector(this.getQuerySelector())},dg.FormElement.prototype.validateValue=function(e){return!jDrupal.isEmpty(e)},dg.FormElement.prototype.valueCallback=function(){var e=this;return new Promise(function(t,r){var o=null,n=e.getDomElement();n&&(o=n.value),t({name:e.get("name"),value:o})})},dg.theme_form_element_label=function(e){return"<label "+dg.attributes(e._attributes)+">"+e._title+"</label>"},dg.theme_actions=function(e){var t="";for(prop in e)dg.isFormElement(prop,e)&&(t+=dg.render(e[prop]));return t},dg.theme_checkbox=function(e){e._attributes.type="checkbox",e._attributes.id||(e._attributes.id="checkbox-"+dg.salt()),e._default_value&&(e._attributes.checked="checked");var t=e._label;t||(t={}),dg.elementAttributesInit(t),t._title||(t._title=e._title);var r=t._attributes;r.for||(r.for=e._attributes.id);var t=dg.theme("label",t),o=e._prefix?e._prefix:"",n=e._suffix?e._suffix:"";return o+"<input "+dg.attributes(e._attributes)+" />"+t+n},dg.theme_checkboxes=function(e){var t="";for(var r in e._options)if(e._options.hasOwnProperty(r)){var o=e._options[r],n="object"!=typeof o?{_title:jDrupal.isEmpty(o)?r:o}:o;n._attributes||(n._attributes={}),"undefined"==typeof n._attributes.value&&(n._attributes.value=r),e._default_value&&e._default_value[r]&&(n._default_value=e._default_value[r]),t+=dg.theme("checkbox",n)+"<br />"}return"<div "+dg.attributes(e._attributes)+">"+t+"</div>"},dg.theme_description=function(e){return"<small "+dg.attrs(e)+">"+e._description+"</small>"},dg.theme_email=function(e){return e._attributes.type="email","<input "+dg.attributes(e._attributes)+"/>"},dg.theme_hidden=function(e){return e._attributes.type="hidden","<input "+dg.attributes(e._attributes)+" />"},dg.theme_label=function(e){return" <label "+dg.attrs(e)+">"+e._title+"</label>"},dg.theme_number=function(e){return e._attributes.type="number","<input "+dg.attributes(e._attributes)+"/>"},dg.theme_password=function(e){return e._attributes.type="password","<input "+dg.attributes(e._attributes)+" />"},dg.theme_radio=function(e){e._attributes.type="radio";var t=e._title?e._title:null,r=e._title_attributes?e._title_attributes:{};r.for||(r.for=e._attributes.id);var o="<input "+dg.attributes(e._attributes)+"/>";return t&&(o+="<label "+dg.attributes(r)+">"+t+"</label>"),o},dg.theme_radios=function(e){var t="";for(var r in e._options)if(e._options.hasOwnProperty(r)){var o=e._options[r],n={_title:jDrupal.isEmpty(o)?r:o,_attributes:{value:r,name:e._attributes.name}};e._default_value==r&&(n._attributes.checked="checked"),t+="<div>"+dg.theme("radio",n)+"</div>"}return"<div "+dg.attributes(e._attributes)+">"+t+"</div>"},dg.theme_select=function(e){var t="";if(e._options)for(var r in e._options)if(e._options.hasOwnProperty(r)){var o=e._options[r];if("object"==typeof o)"undefined"!=typeof e._value&&e._value==r&&(o._attributes.selected=""),t+=dg.render(o);else{var n="";"undefined"!=typeof e._value&&e._value==r&&(n=" selected "),t+='<option value="'+r+'" '+n+">"+o+"</option>"}}return"<select "+dg.attributes(e._attributes)+">"+t+"</select>"},dg.theme_submit=function(e){return e._attributes.type="submit",!e._attributes.value&&e._value&&(e._attributes.value=e._value),"<input "+dg.attributes(e._attributes)+"/>"},dg.theme_textarea=function(e){var t=e._value?e._value:"";return"<textarea "+dg.attributes(e._attributes)+">"+t+"</textarea>"},dg.theme_textfield=function(e){return e._attributes.type="text","<input "+dg.attributes(e._attributes)+"/>"},dg.FormStateInterface=function(e){this.form=e,this.values={},this.errors={}},dg.FormStateInterface.prototype.get=function(e){return"undefined"!=typeof this[e]?this[e]:null},dg.FormStateInterface.prototype.set=function(e,t){this[e]=t},dg.FormStateInterface.prototype.setFormState=function(){var e=this,t=e.get("form"),r=[];for(var o in t.elements)t.elements.hasOwnProperty(o)&&"actions"!=o&&"markup"!=t.elements[o].element._type&&r.push(t.elements[o].valueCallback());return Promise.all(r).then(function(t){for(var r=0;r<t.length;r++)e.setValue(t[r].name,t[r].value)})},dg.FormStateInterface.prototype.setErrorByName=function(e,t){this.errors[e]=t},dg.FormStateInterface.prototype.getErrors=function(){return this.errors},dg.FormStateInterface.prototype.hasAnyErrors=function(){var e=!1,t=this.getErrors();for(error in t)if(t.hasOwnProperty(error)){e=!0;break}return e},dg.FormStateInterface.prototype.getErrorMessages=function(){var e=this.getErrors(),t=[];for(error in e)e.hasOwnProperty(error)&&t.push(e[error]);return t.length?t:null},dg.FormStateInterface.prototype.displayErrors=function(){var e=this.getErrorMessages();if(e){e.forEach(function(e){dg.setMessage(e,"error")}),dg.blockRefresh("messages");var t=dg.getBlockFromDom("messages");t&&t.scrollIntoView(!1)}},dg.FormStateInterface.prototype.clearErrors=function(){this.errors={}},dg.FormStateInterface.prototype.getValue=function(e,t){return"undefined"!=typeof this.get("values")[e]?this.get("values")[e]:t},dg.FormStateInterface.prototype.setValue=function(e,t){this.values[e]=t},dg.FormStateInterface.prototype.getValues=function(){return this.get("values")},dg.FormStateInterface.prototype.setValues=function(e){this.values=e},dg.FormWidget=function(e,t,r,o,n,i){},dg.FormWidget.prototype=new dg.FormElement,dg.FormWidget.prototype.constructor=dg.FormWidget,dg.FormWidgetPrepare=function(e,t){e.widgetType="FormWidget",e.entityType=t[0],e.bundle=t[1],e.fieldName=t[2],e.name=e.fieldName,e.element=t[3],e.items=t[4],e.delta=t[5],e.fieldFormMode=e.element._fieldFormMode},dg.FormWidget.prototype.valueCallback=function(){var e=this;return new Promise(function(t,r){var o=null,n=document.getElementById(e.id());n&&(o=n.value),t({name:e.get("name"),value:[{value:o}]})})},dg.CheckboxElement=function(e,t,r){dg.FormElementPrepare(this,arguments)},dg.CheckboxElement.prototype=new dg.FormElement,dg.CheckboxElement.prototype.constructor=dg.CheckboxElement,dg.CheckboxElement.prototype.valueCallback=function(){var e=this;return new Promise(function(t,r){var o=null,n=document.getElementById(e.id());n&&(o=n.checked),t({name:e.get("name"),value:o?1:0})})},dg.CheckboxesElement=function(e,t,r){dg.FormElementPrepare(this,arguments)},dg.CheckboxesElement.prototype=new dg.FormElement,dg.CheckboxesElement.prototype.constructor=dg.CheckboxesElement,dg.CheckboxesElement.prototype.valueCallback=function(){var e=this;return new Promise(function(t,r){var o=null,n=document.querySelectorAll("#"+e.id()+' input[type="checkbox"]');if(n.length){o={};for(var i=0;i<n.length;i++){var d=n[i].value;null!==d&&(o[d]=n[i].checked?1:0)}}t({name:e.get("name"),value:o})})},dg.RadioElement=function(e,t,r){dg.FormElementPrepare(this,arguments)},dg.RadioElement.prototype=new dg.FormElement,dg.RadioElement.prototype.constructor=dg.RadioElement,dg.RadioElement.prototype.valueCallback=function(){var e=this;return new Promise(function(t,r){var o=null,n=document.getElementById(e.id());n&&(o=n.checked),t({name:e.get("name"),value:o?1:0})})},dg.RadiosElement=function(e,t,r){dg.FormElementPrepare(this,arguments)},dg.RadiosElement.prototype=new dg.FormElement,dg.RadiosElement.prototype.constructor=dg.RadiosElement,dg.RadiosElement.prototype.valueCallback=function(){var e=this;return new Promise(function(t,r){var o=null,n=document.querySelectorAll("#"+e.id()+' input[type="radio"]');if(n.length){o={};for(var i=0;i<n.length;i++){var d=n[i].value;null!==d&&(o[d]=n[i].checked?1:0)}}t({name:e.get("name"),value:o})})},dg.FieldDefinitionInterface=function(e,t,r){this.entityType=e,this.bundle=t,this.fieldName=r,this.fieldDefinition="user"==e?dg.fieldDefinitions[e][r]:dg.fieldDefinitions[e][t][r]},dg.FieldDefinitionInterface.prototype.get=function(e){return this.fieldDefinition[e],this.fieldDefinition[e]},dg.FieldDefinitionInterface.prototype.getLabel=function(){return this.get("label")},dg.FieldFormMode=function(e){this.fieldFormMode=e},dg.FieldFormMode.prototype.getWeight=function(){return this.fieldFormMode.weight},dg.FieldFormatter=function(){},dg.FieldFormatterPrepare=function(e,t){e._fieldDefinition=t[0],e._settings=t[1],e._label=t[2],e._viewMode=t[3],e._thirdPartySettings=t[4]},dg.FieldFormatter.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++)o[n]={_markup:r[n].value};return o},dg.FieldItemListInterface=function(e){this._items=e},dg.FieldItemListInterface.prototype.getItems=function(){return this._items},dg.FieldWidget=function(e,t,r,o,n,i){},dg.FieldWidget.prototype=new dg.FormElement,dg.FieldWidget.prototype.constructor=dg.FieldWidget,dg.FieldWidgetPrepare=function(e,t){e.widgetType="FieldWidget",e.entityType=t[0],e.bundle=t[1],e.fieldName=t[2],e.name=e.fieldName,e.element=t[3],e.items=t[4],e.delta=t[5],e.fieldDefinition=new dg.FieldDefinitionInterface(e.entityType,e.bundle,e.fieldName),e.fieldFormMode=e.element._fieldFormMode},dg.FieldWidget.prototype.getSetting=function(e){return this.settings[e],this.settings[e]},dg.FieldWidget.prototype.setSetting=function(e,t){this.settings[property]=t},dg.FieldWidget.prototype.getSettings=function(){return this.settings},dg.FieldWidget.prototype.setSettings=function(e){this.settings=e},dg.FieldWidget.prototype.valueCallback=function(){var e=this;return new Promise(function(t,r){var o=null,n=document.getElementById(e.id());n&&(o=n.value),t({name:e.get("name"),value:[{value:o}]})})},dg.hasClass=function(e,t){return e.classList.contains(t)},dg.addClass=function(e,t){dg.hasClass(e,t)||e.classList.add(t)},dg.removeClass=function(e,t){dg.hasClass(e,t)&&e.classList.remove(t)},dg.getBody=function(){return document.getElementsByTagName("BODY")[0]},dg.addBodyClass=function(e){dg.addClass(dg.getBody(),e)};dg.removeBodyClass=function(e){dg.removeClass(dg.getBody(),e)};dg.addAttrs=function(e,t){if(t._attributes){e=dg.qs(e);for(var r in t._attributes)if(t._attributes.hasOwnProperty(r)){var o=t._attributes[r];e.setAttribute(r,dg.isArray(o)?o.join(" "):o)}}},dg.el=function(e){return console.log("DEPRECATED: dg.el(), use dg:qs() instead"),dg.qs(e)},dg.qs=function(e){return dg.isString(e)&&(e=document.querySelector(e)),e},dg.qsa=function(e){return document.querySelectorAll(e)},dg.show=function(e){dg.qs(e).style.display="block"},dg.hide=function(e){dg.qs(e).style.display="none"},dg.isVisible=function(e){return!dg.inArray(dg.qs(e).style.display,["none",""])},dg.addJs=function(e){dg.addToHead("js",e)},dg.addCss=function(e){dg.addToHead("css",e)},dg.addToHead=function(e,t){var r=document.getElementsByTagName("head")[0],o={js:"script",css:"link"},n={js:"text/javascript",css:"stylesheet"},i=document.createElement(o[e]),d=t._attributes;for(var u in d)d.hasOwnProperty(u)&&(i[u]=d[u]);switch(e){case"js":i.type||(i.type=n[e]);break;case"css":i.rel||(i.rel=n[e])}r.appendChild(i)},dg.goto=function(e,t){e+=dg.extractQueryString(t),dg.router.navigate(e)},dg.reload=function(){location.reload()},dg.getDestination=function(){return{destination:dg.getDestinationPath()}},dg.getDestinationPath=function(){return dg.arg().join("/")},dg.getQueryString=function(e){e||(e=dg.getUrl());var t=e.indexOf("?");return t!=-1?e.substr(t,e.length-t+1):null},dg.extractQueryString=function(e){if(e&&e._query){var t=e._query,r=[];for(var o in t)t.hasOwnProperty(o)&&r.push(o+"="+t[o]);if(r.length)return"?"+r.join("&")}return""},dg.removeQueryString=function(e){var t=e.indexOf("?");return t!=-1?e.substr(0,t):e},dg.getUrlParameter=function(e){var t=new URLSearchParams(dg.getQueryString());return t.get(e)},dg.setUrlParameter=function(e,t){if(history.pushState){var r=dg._removeUrlParameter(window.location.href,e),o=r.indexOf("?")!==-1?"&":"?",n=r+o+e+"="+t;t||(n=r),window.history.replaceState({path:n},"",n)}},dg._removeUrlParameter=function(e,t){var r=e.split("?");if(r.length>=2){for(var o=encodeURIComponent(t)+"=",n=r[1].split(/[&;]/g),i=n.length;i-- >0;)n[i].lastIndexOf(o,0)!==-1&&n.splice(i,1);return r[0]+(n.length>0?"?"+n.join("&"):"")}return e},dg.hasAttachments=function(e){return!!e._attached},dg.addAttachments=function(e){var t=function(e,t){return new Promise(function(r,o){var n=t.length,i=0,d=0,u=function(){var o=t[d];if(dg.libraryLoaded(e,o))return i++,d++,void r();var a=dg.getModuleLibrary(e,o),s=a.js?a.js.length:0,l=(a.css?a.css.length:0,0),g=0,c=function(){var t=a.js[g];t._attributes.onload=function(){if(l++,g++,l<s)c();else{i++,d++;var t=dg.getLibraries();t[e]||(t[e]={}),t[e][o]||(t[e][o]={}),jDrupal.moduleInvokeAll("library_onload",e,o),i<n?u():r()}},dg.addJs(t)};l<s&&c()};u()})},r=[],o=e._attached;for(var n in o)if(o.hasOwnProperty(n)){var i=o[n];jDrupal.isArray(i)&&r.push(t(n,i))}return Promise.all(r);var r,o,n,i},dg.libraryLoad=function(e,t){return new Promise(function(r,o){if(dg.libraryLoaded(e,t))return console.log("library already added!",e,t),void r();console.log("library not yet added",e,t);for(var n=dg.getModuleLibrary(e,t),i=["js","css"],d=i.length,u=null,a=0,s=0,l=0;l<d;l++)u=i[l],n[u]&&(s+=n[u].length);for(var l=0;l<d;l++)if(u=i[l],n[u]){a=n[u].length;
for(var g=0;g<a;g++){var c=n[u][g];c._attributes.onload=function(){if(s--,console.log("done loading asset, assets left: "+s),!s){var o=dg.getLibraries();o[e]||(o[e]={}),o[e][t]||(o[e][t]={}),jDrupal.moduleInvokeAll("library_onload",e,t),r()}},console.log("loading asset",c),console.log("LOADING: "+e+"/"+t),"js"==u?dg.addJs(c):dg.addCss(c)}}})},dg.libraryLoaded=function(e,t){var r=dg._libraries;return!(!r[e]||!r[e][t])},dg.getLibraries=function(){return dg._libraries},dg.getModuleLibraries=function(e){return dg.invoke(e,"libraries")},dg.getModuleLibrary=function(e,t){var r=dg.getModuleLibraries(e);return r[t]},dg.getModuleRoutes=function(e){return dg.invoke(e,"routing")},dg.setMessage=function(e,t){if(jDrupal.isArray(e))for(var r in e)e.hasOwnProperty(r)&&0!=r.indexOf("_")&&e[r]._message&&""!=e[r]._message&&(e[r]._type||(e[r]._type="status"),dg.setMessage(e[r]._message,e[r]._type));else t||(t="status"),dg._messages.push({_message:e,_type:t,_theme:"message"})},dg.getMessageCount=function(){return dg._messages.length},dg.getMessages=function(){return dg._messages},dg.getMessage=function(){return dg.getMessageCount()?dg._messages.pop():null},dg.clearMessages=function(){dg._messages=[]},dg.showMessage=function(e,t){console.log("showing"),dg.setMessage(e,t),dg.showMessages()},dg.showMessages=function(){dg.blockRefresh("messages")},dg.modules=jDrupal.modules,dg.Module=function(){},dg.Module.prototype=new jDrupal.Module,dg.Module.prototype.constructor=dg.Module,dg.Module.prototype.routing=function(){return null},dg.createModule=function(e){var t=!!window[e];if(t)return window[e];var r=new dg.Module;return window[e]=r,dg.modules[e]=r,r},dg.invoke=function(e,t){var r=jDrupal.moduleLoad(e);return r&&r[t]?r[t]():null},dg.Region=function(e,t){this._id=e;for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);this._attributes||(this._attributes={}),this._attributes.id||(this._attributes.id=e),this._format||(this._format="div"),this._before||(this._before=""),this._prefix||(this._prefix=""),this._suffix||(this._suffix=""),this._after||(this._after=""),this._hidden_blocks=[]},dg.Region.prototype.get=function(e){var t="_"+e;return"undefined"!=typeof this[t]?this[t]:null},dg.Region.prototype.set=function(e,t){var r="_"+property;this[r]=t},dg.loadRegions=function(){},dg.Region.prototype.getBlocks=function(){var e=dg.blocksLoad(),t={};for(var r in e)e.hasOwnProperty(r)&&e[r].get("region")==this.get("id")&&(t[e[r].get("weight")]=r);var o=[];for(var n in t)t.hasOwnProperty(n)&&o.push(t[n]);return o},dg.Region.prototype.getHiddenBlocks=function(){return this.get("hidden_blocks")},dg.Region.prototype.blockIsHidden=function(e){return jDrupal.inArray(e,this.getHiddenBlocks())},dg.Region.prototype.addHiddenBlock=function(e){this.blockIsHidden(e)||this.getHiddenBlocks().push(e)},dg._postRender=[],dg.appRender=function(e){dg.themeLoad().then(function(t){dg.regions={};var r=t.getRegions(),o="",n=(t.getRegionCount(),function(t){for(var r in dg.regions)if(dg.regions.hasOwnProperty(r)){var n=dg.regions[r],i=n.getBlocks();if(i.length){var d=n.get("format");o+=n.get("before")+"<"+d+" "+dg.attributes(n.get("attributes"))+">"+n.get("prefix");for(var u=0;u<i.length;u++){var a=t[i[u]],s=a.get("format");o+=a.get("before")+"<"+s+" "+dg.attributes(a.get("attributes"))+"></"+s+">"+a.get("after")}o+=n.get("suffix")+"</"+d+">"+n.get("after")}}o+=dg.render(e),document.getElementById("dg-app").innerHTML=o,window.scrollTo(0,0);var l=dg.blocksLoad(),g=[],c=function(e){var t=e.getRegion();if(t.getBlocks().length==t.getHiddenBlocks().length){var r=t.get("id");dg.removeElement(dg.cleanCssIdentifier(r)),dg.addBodyClass("no-"+r)}if(g.splice(g.indexOf(e.get("id")),1),0==g.length){dg.runPostRenders();var o=dg.loadForms();for(var n in o)o.hasOwnProperty(n)&&dg.formAttachSubmissionHandler(o[n].getFormDomId())}};for(r in l)l.hasOwnProperty(r)&&(g.push(r),l[r].getVisibility().then(function(e){if(e.visible)e.block.buildWrapper().then(function(e){e.render(),c(e)});else{var t=e.block,r=t.get("id"),o=dg.regions[t.get("region")];o.addHiddenBlock(r),dg.removeElement(dg.cleanCssIdentifier(r)),c(e.block)}}))}),i=function(){var e={};for(var t in dg.regions)if(dg.regions.hasOwnProperty(t))for(var r=dg.regions[t].getBlocks(),o=0;o<r.length;o++)e[r[o]]=dg.blockLoad(r[o]);jDrupal.moduleInvokeAll("blocks_build_alter",e).then(n(e))};for(var d in r)if(r.hasOwnProperty(d)){var u=new dg.Region(d,r[d]);dg.setRenderElementDefaults(u),dg.regions[d]=u}jDrupal.moduleInvokeAll("regions_build_alter",dg.regions).then(i)})},dg.renderProperties=function(){return["_prefix","_suffix","_preRender","_postRender"]},dg.render=function(e,t){var r=typeof e;if(!e)return"";if("string"===r)return e;var o="";if("object"===r){var n=dg.hasAttachments(e);if(n){var i=dg.salt(),d="lib-"+i,u=e._format?e._format:"div";return dg.render({_markup:"<"+u+' id="'+d+'"></'+u+">",_postRender:[function(){dg.addAttachments(e).then(function(){var t=document.getElementById(d);e._attached.onload&&setTimeout(e._attached.onload,1),delete e._attached,t.outerHTML=dg.render(e,!0)})}]},!0)}e.markup&&(console.log('Use "_markup" instead of "markup" in:',e),e._markup=e.markup);var a=e._prefix?e._prefix:"",s=e._suffix?e._suffix:"";if(dg.isObject(a)&&(a=dg.render(a)),dg.isObject(s)&&(s=dg.render(s)),dg.isUndefined(e._postRender)&&(e._postRender=[]),e._markup)return dg.prepPostRenders(e),t&&setTimeout(dg.runPostRenders,1),a+e._markup+s;var l=!!e._theme,g=!!e._type;if(l||g){var c=a+dg.theme(l?e._theme:e._type,e)+s;return dg.prepPostRenders(e),c}var m=null,f={},p=0;o+=a;for(var h in e)if(e.hasOwnProperty(h)&&!jDrupal.inArray(h,dg.renderProperties())){var _=e[h],v=typeof _;if("object"===v&&null!==_)m="undefined"!=typeof _._weight?_._weight:0,dg.isUndefined(f[m])&&(f[m]=[]),f[m].push(dg.render(_)),p++;else if("array"===v)for(var y=0;y<_.length;y++)o+=dg.render(_[y]);else if("string"===v){if("object"===r&&e.role&&"form"===e.role||"_action"===h||""===_)continue;var b=e.constructor.name;b&&"Array"!==b&&(m=0,dg.isUndefined(f[m])&&(f[m]=[]),f[0].push(_),p++)}}if(p)for(m in f)if(f.hasOwnProperty(m))for(var y=0;y<f[m].length;y++)o+=f[m][y];o+=s}else if("array"===r)for(var y=0;y<e.length;y++)o+=dg.render(e[y]);return setTimeout(dg.runPostRenders,1),o},dg.prepPostRenders=function(e){if(e._postRender.length)for(var t=0;t<e._postRender.length;t++)dg._postRender.push(e._postRender[t])},dg.postRenderCount=function(){return dg._postRender.length},dg.runPostRenders=function(e,t){dg.isUndefined(e)&&(e=!1),dg.isUndefined(t)&&(t=1);var r=function(){var e=dg.postRenderCount();if(e){for(var t=0;t<e;t++){if(e>dg._postRenderMax){console.log("dg._postRenderMax reached: "+dg._postRenderMax),dg._postRender=[];break}dg._postRender[t]()}dg._postRender=[]}};e?setTimeout(r,t):r()},dg.token=function(){return jDrupal.token()},dg.restPath=function(){return jDrupal.restPath()},dg.path=function(){return jDrupal.path()},dg.commentLoad=function(){return jDrupal.commentLoad.apply(jDrupal,arguments)},dg.nodeLoad=function(){return jDrupal.nodeLoad.apply(jDrupal,arguments)},dg.userLoad=function(){return jDrupal.userLoad.apply(jDrupal,arguments)},dg.viewsLoad=function(){return jDrupal.viewsLoad.apply(jDrupal,arguments)},dg.router={_activeRoute:null,_stack:[],routes:[],mode:null,root:"/",config:function(e){return this.mode=e&&e.mode&&"history"==e.mode&&history.pushState?"history":"hash",this.root=e&&e.root?"/"+this.clearSlashes(e.root)+"/":"/",this},getPath:function(){var e="";if("history"===this.mode)e=this.clearSlashes(decodeURI(location.pathname+location.search)),e=e.replace(/\?(.*)$/,""),e="/"!=this.root?e.replace(this.root,""):e;else{var t=window.location.href.match(/#(.*)$/);e=t?t[1]:""}return dg.removeQueryString(this.clearSlashes(e))},getFragment:function(){return console.log("WARNING: getFragment() is deprecated, use getPath() instead."),this.getPath()},prepFragment:function(e){var t=e||this.getPath();return this.root+t},clearSlashes:function(e){return e.toString().replace(/\/$/,"").replace(/^\//,"")},add:function(e){return this.routes.push(e),this},remove:function(e){for(var t,r=0;r<this.routes.length,t=this.routes[r];r++)if(t.path.toString()===e.toString())return this.routes.splice(r,1),this;return this},flush:function(){return this.routes=[],this.mode=null,this.root="/",this},getStack:function(){return dg.router._stack},stackPush:function(e,t){dg.router.getStack().push({key:e.key,path:t})},stackPop:function(){var e=dg.router.getStack();return e.length?e.pop():null},check:function(e,t){var r=this;return""==e&&(e=dg.getFrontPagePath()),jDrupal.moduleInvokeAll("pre_process_route_change",e,t).then(function(o){if(o&&o.length)for(var n=0;n<o.length;n++){var i=o[n];if(i&&i!=dg.getPath())return void r.navigate(i)}var d=r.load(e);return d?(dg.removeForms(),d.defaults||(d=r.load(dg.getFrontPagePath())),r.meetsRequirements(d)||(d=r.load("403")),void(d.defaults&&(dg.setTitle(d.defaults._title),dg.setDocumentTitle(d.defaults._title),dg.router.execute(function(e){var r=dg.getPath();dg.router.setActiveRoute(d),dg.router.stackPush(d,r),dg.content=e,dg.appRender(),jDrupal.moduleInvokeAll("post_process_route_change",d,r,t)},d,e)))):void console.log("dg.router.check() - 404",e)}),this},execute:function(e,t,r){t||(t=dg.getRoute()),r||(r=dg.getPath());var o=dg.router.matches(r).match;if(t.defaults._form){var n=t.defaults._form;o.length>1?(o.shift(),dg.addForm(n,dg.applyToConstructor(window[n],o)).getForm().then(e)):dg.addForm(n,new window[n]).getForm().then(e)}else{var i=null;o.length>1?(o.shift(),i=t.defaults._controller.apply(null,o)):i=t.defaults._controller(),jDrupal.isPromise(i)?i.then(e):e(i)}},listen:function(){var e=this,t=e.getPath(),r=function(){if(t!==e.getPath()){var r=t;t=e.getPath(),e.check(t,r)}};return clearInterval(this.interval),this.interval=setInterval(r,50),this},load:function(e){var t=this.matches(e);return t?this.routes[t.i]:null},matches:function(e){for(var t=dg.removeQueryString(this.prepFragment(e)),r=0;r<this.routes.length;r++)if(this.routes[r]){var o=this.routes[r].path;if(!o||(t.match(/\//g)||[]).length==(o.match(/\//g)||[]).length){var n=t.match(o);if(n)return{match:n,i:r}}}return null},navigate:function(e){if(e=e?e:"","history"===this.mode){var t=this.root+this.clearSlashes(e);history.pushState(null,null,t)}else dg.getPath()==e?dg.reload():window.location.href=window.location.href.replace(/#(.*)$/,"")+"#"+e;return this},getRoutes:function(){return this.routes},getActiveRoute:function(){return this._activeRoute},setActiveRoute:function(e){this._activeRoute=e},meetsRequirements:function(e){if(e||(e=this.getActiveRoute()),e.requirements){var t=e.requirements;if(t._role)return dg.hasRole(t._role);if(t._custom_access)return t._custom_access()}return!0},resolvePath:function(e){for(var t=dg.router.clearSlashes(dg.router.getRoutePath(e)),r="(.*)",o=t.indexOf(r),n=o!=-1;n;){for(var i=0,d=0;d<o;d++)"/"==t.charAt(d)&&i++;t=t.replace(r,dg.arg(i)),o=t.indexOf(r),n=o!=-1}return t},getRouteIndex:function(e){for(var t=this.getRoutes(),r=0;r<t.length;r++)if(t[r].key==e)return r;return-1},loadRoute:function(e){var t=this.getRouteIndex(e);return t!=-1?this.getRoutes()[t]:null},saveRoute:function(e,t){var r=this.getRouteIndex(e);r!=-1?this.getRoutes()[r]=t:this.getRoutes().push(t)},deleteRoute:function(e){var t=dg.router.getRouteIndex(e);t!=-1&&this.getRoutes().splice(t,1)},hasBaseRoute:function(e){return e||(e=this.getActiveRoute()),!!e.defaults._base_route},getBaseRoute:function(e){return e||(e=this.getActiveRoute()),this.hasBaseRoute(e)?dg.router.loadRoute(e.defaults._base_route):null},hasChildRoutes:function(e){return e||(e=this.getActiveRoute()),!!e.defaults._child_routes},initChildRoutes:function(e){e.defaults._child_routes=[]},getChildRoutes:function(e){return e||(e=this.getActiveRoute()),this.hasChildRoutes(e)?e.defaults._child_routes:null},addChildRoute:function(e,t){this.getChildRoutes(e).push(t)},saveAsChildRoute:function(e,t){"string"==typeof e&&(e=dg.router.loadRoute(e)),"string"==typeof t&&(t=dg.router.loadRoute(t)),e&&t&&(e.defaults._base_route||(e.defaults._base_route=t.key),dg.router.hasChildRoutes(t)||dg.router.initChildRoutes(t),dg.router.addChildRoute(t,e.key),dg.router.saveRoute(t.key,t))},getRouteKey:function(e){return e||(e=this.getActiveRoute()),e.key},getRoutePath:function(e){return e||(e=this.getActiveRoute()),e.path},getRouteTitle:function(e){return e||(e=this.getActiveRoute()),e.defaults._title}},dg._GET=function(e,t){var r=t?t:window.location.href,o=new RegExp("[?&]"+e+"=([^&#]*)","i"),n=o.exec(r);return n?n[1]:null},dg._themeRegistry={},dg.getThemeRegistry=function(){return dg._themeRegistry},dg.themeHookRegistered=function(e){return"undefined"!=typeof dg.getThemeRegistry()[e]},dg.registerThemeHook=function(e,t){dg.getThemeRegistry()[e]=t},dg.getThemeHook=function(e){return dg.getThemeRegistry()[e]},dg.createTheme=function(e,t){dg.themes[e]=t,dg.themes[e].prototype=new dg.Theme,dg.themes[e].prototype.constructor=dg.themes[e]},dg.Theme=function(){this.regions=null},dg.Theme.prototype.get=function(e){return"undefined"!=typeof this[e]?this[e]:null},dg.Theme.prototype.getRegions=function(){return this.get("regions")},dg.Theme.prototype.getRegionCount=function(){var e=0,t=this.get("regions");for(var r in t)t.hasOwnProperty(r)&&e++;return e},dg.themeLoad=function(){return new Promise(function(e,t){if(!dg.activeTheme){var r=dg.config("theme");if(!r)return void console.log("No theme config found in settings.js file");var o=jDrupal.ucfirst(dg.getCamelCase(r.name));if(!dg.themes[o]){var n="Failed to load theme ("+o+") - did you include its .js file in index.html?";return void t(n)}dg.activeTheme=new dg.themes[o],dg.modules[name]=new dg.Module}e(dg.activeTheme)})},dg.theme=function(e,t){if(t){if(t._markup)return t._markup}else t={};var r="",o="theme_"+e;if(!dg[o]){var n=null;arguments.callee.caller&&(n=arguments.callee.caller.name);var i="WARNING: dg."+o+"() does not exist.";return n&&(i+=" Called by: "+n+"()."),console.log(i),r}dg.setRenderElementDefaults(t);var d=null;if(dg.themeHookRegistered(e))d=dg.getThemeHook(e);else{var u=jDrupal.moduleImplements(e);u&&(d=u[0],"user"===d&&"password"===e&&(d=null)),dg.registerThemeHook(e,d)}var a=null;d?(o=d+"_"+e,a=window[o]):a=dg[o];var s=a.call(null,t);return s instanceof Promise?(s.then(function(e){dg.qs("#"+e.variables._attributes.id).innerHTML=dg.render(e.content)}),"<div "+dg.attributes(t._attributes)+"></div>"):s},dg.setRenderElementDefaults=function(e){if("object"==typeof e){"undefined"==typeof e._attributes&&(e._attributes={}),"undefined"==typeof e._attributes.class&&(e._attributes.class=[]);for(var t in e)e.hasOwnProperty(t)&&!dg.isProperty(t,e)&&"object"==typeof e[t]&&dg.setRenderElementDefaults(e[t])}},dg.hasRole=function(e){return jDrupal.currentUser().hasRole(e)},dg.isAdmin=function(){return dg.hasRole("administrator")},dg.theme_view=function(e){return e._attributes.id||(e._attributes.id="view-"+dg.userPassword()),new Promise(function(t){jDrupal.viewsLoad(e._path).then(function(r){var o="",n=e._format?e._format:"div",i=e._format_attributes?e._format_attributes:null;if(e._title&&(o+="object"==typeof e._title?dg.render(e._title):"<h2>"+e._title+"</h2>"),o+="<"+n+" "+dg.attributes(i)+">",r.results.length>0){for(var d=0;d<r.results.length;d++){var u="",a="";switch(n){case"ul":case"ol":u="<li>",a="</li>";break;case"table":u="<tr>",a="</tr>"}o+=u+e._row_callback(r.results[d])+a}var s=e._contentPrefix?e._contentPrefix:"",l=e._contentSuffix?e._contentSuffix:"";"object"==typeof s&&(s=dg.render(s)),"object"==typeof l&&(l=dg.render(l)),o=s+o+l}else e._empty&&(o+="object"==typeof e._empty?dg.render(e._empty):'<div class="view-empty">'+e._empty+"</div>");o+="</"+n+">",t({variables:e,content:o})})})},dg.modules.admin=new dg.Module,dg.modules.admin.blocks=function(){var e={};return e.admin_menu={build:function(){return new Promise(function(e,t){var r={};r.menu={_theme:"item_list",_title:"Administer",_items:[dg.l(dg.t("Content"),"node/add")]},e(r)})}},e},dg.modules.core=new dg.Module,dg.modules.core=new dg.Module,dg.modules.core.FieldFormatter={},dg.modules.core.FieldFormatter.entity_reference_label=function(){dg.FieldFormatterPrepare(this,arguments)},dg.modules.core.FieldFormatter.entity_reference_label.prototype=new dg.FieldFormatter,dg.modules.core.FieldFormatter.entity_reference_label.prototype.constructor=dg.modules.core.FieldFormatter.entity_reference_label,dg.modules.core.FieldFormatter.entity_reference_label.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++)o[n]={_theme:"entity_reference_label",_item:r[n]};return o},dg.modules.core.FieldFormatter.number_decimal=function(){dg.FieldFormatterPrepare(this,arguments)},dg.modules.core.FieldFormatter.number_decimal.prototype=new dg.FieldFormatter,dg.modules.core.FieldFormatter.number_decimal.prototype.constructor=dg.modules.core.FieldFormatter.number_decimal,dg.modules.core.FieldFormatter.number_decimal.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++)o[n]={_theme:"number_decimal",_item:r[n]};return o},dg.modules.core.FieldFormatter.number_float=function(){dg.FieldFormatterPrepare(this,arguments)},dg.modules.core.FieldFormatter.number_float.prototype=new dg.FieldFormatter,dg.modules.core.FieldFormatter.number_float.prototype.constructor=dg.modules.core.FieldFormatter.number_float,dg.modules.core.FieldFormatter.number_float.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++)o[n]={_theme:"number_float",_item:r[n]};return o},dg.modules.core.FieldFormatter.number_integer=function(){dg.FieldFormatterPrepare(this,arguments)},dg.modules.core.FieldFormatter.number_integer.prototype=new dg.FieldFormatter,dg.modules.core.FieldFormatter.number_integer.prototype.constructor=dg.modules.core.FieldFormatter.number_integer,dg.modules.core.FieldFormatter.number_integer.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++)o[n]={_theme:"number_integer",_item:r[n]};return o},dg.modules.core.FieldFormatter.string=function(){dg.FieldFormatterPrepare(this,arguments)},dg.modules.core.FieldFormatter.string.prototype=new dg.FieldFormatter,dg.modules.core.FieldFormatter.string.prototype.constructor=dg.modules.core.FieldFormatter.string,dg.modules.core.FieldFormatter.string.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++)o[n]={_theme:"string",_item:r[n]};return o},dg.modules.core.FieldWidget={},dg.modules.core.FieldWidget.decimal=function(e,t,r,o,n,i){dg.FieldWidgetPrepare(this,arguments)},dg.modules.core.FieldWidget.decimal.prototype=new dg.FieldWidget,dg.modules.core.FieldWidget.decimal.prototype.constructor=dg.modules.core.FieldWidget.decimal,dg.modules.core.FieldWidget.decimal.prototype.form=function(e,t,r,o,n){r._type="number",r._title=this.fieldDefinition.getLabel(),r._title_placeholder=!0,r._widgetType="FieldWidget",r._module="core",r._attributes.step="any",e&&"undefined"!==e[t]&&(r._value=e[t].value,r._attributes.value=r._value)},dg.modules.core.FieldWidget.float=function(e,t,r,o,n,i){dg.FieldWidgetPrepare(this,arguments)},dg.modules.core.FieldWidget.float.prototype=new dg.FieldWidget,dg.modules.core.FieldWidget.float.prototype.constructor=dg.modules.core.FieldWidget.float,dg.modules.core.FieldWidget.float.prototype.form=function(e,t,r,o,n){r._type="number",r._title=this.fieldDefinition.getLabel(),r._title_placeholder=!0,r._widgetType="FieldWidget",r._module="core",r._attributes.step="any",e&&"undefined"!==e[t]&&(r._value=e[t].value,r._attributes.value=r._value)},dg.modules.core.FieldWidget.integer=function(e,t,r,o,n,i){dg.FieldWidgetPrepare(this,arguments)},dg.modules.core.FieldWidget.integer.prototype=new dg.FieldWidget,dg.modules.core.FieldWidget.integer.prototype.constructor=dg.modules.core.FieldWidget.integer,dg.modules.core.FieldWidget.integer.prototype.form=function(e,t,r,o,n){r._type="number",r._title=this.fieldDefinition.getLabel(),r._title_placeholder=!0,r._widgetType="FieldWidget",r._module="core",e&&"undefined"!==e[t]&&(r._value=e[t].value,r._attributes.value=r._value)},dg.modules.core.FieldWidget.string=function(e,t,r,o,n,i){dg.FieldWidgetPrepare(this,arguments)},dg.modules.core.FieldWidget.string.prototype=new dg.FieldWidget,dg.modules.core.FieldWidget.string.prototype.constructor=dg.modules.core.FieldWidget.string,dg.modules.core.FieldWidget.string.prototype.form=function(e,t,r,o,n){r._type="textfield",r._title=this.fieldDefinition.getLabel(),r._title_placeholder=!0,r._widgetType="FieldWidget",r._module="core",e&&"undefined"!==e[t]&&(r._value=e[t].value,r._attributes.value=r._value)},dg.modules.core.FormWidget={},dg.modules.core.FormWidget.string_textfield=function(e,t,r,o,n,i){dg.FormWidgetPrepare(this,arguments)},dg.modules.core.FormWidget.string_textfield.prototype=new dg.FormWidget,dg.modules.core.FormWidget.string_textfield.prototype.constructor=dg.modules.core.FormWidget.string_textfield,dg.modules.core.FormWidget.string_textfield.prototype.form=function(e,t,r,o,n){r._type="textfield",r._title=this.fieldName,r._title_placeholder=!0,r._widgetType="FormWidget",r._module="core",e&&"undefined"!==e[t]&&(r._value=e[t].value,r._attributes.value=r._value)},dg.modules.core.FormWidget.bundle=function(e,t,r,o,n,i){dg.FormWidgetPrepare(this,arguments)},dg.modules.core.FormWidget.bundle.prototype=new dg.FormWidget,dg.modules.core.FormWidget.bundle.prototype.constructor=dg.modules.core.FormWidget.bundle,dg.modules.core.FormWidget.bundle.prototype.form=function(e,t,r,o,n){r._type="hidden",e&&"undefined"!==e[t]&&(r._value=e[t].value,r._attributes.value=r._value)},dg.modules.core.FormWidget.bundle.prototype.valueCallback=function(e,t,r){var o=new(dg[jDrupal.ucfirst(this.get("entityType"))])(null);return{name:o.getEntityKey("bundle"),value:[{target_id:this.get("bundle")}]}},dg.modules.core.FormWidget.entityID=function(e,t,r,o,n,i){dg.FormWidgetPrepare(this,arguments)},dg.modules.core.FormWidget.entityID.prototype=new dg.FormWidget,dg.modules.core.FormWidget.entityID.prototype.constructor=dg.modules.core.FormWidget.entityID,dg.modules.core.FormWidget.entityID.prototype.form=function(e,t,r,o,n){r._type="hidden",e&&"undefined"!==e[t]&&(r._value=e[t].value,r._attributes.value=r._value)},dg.theme_entity_reference_label=function(e){var t=e._item;return dg.l(t.target_id,t.url.replace(dg.path(),""))},dg.theme_string=function(e){return e._item.value},dg.theme_number_decimal=function(e){return e._item.value},dg.theme_number_float=function(e){return e._item.value},dg.theme_number_integer=function(e){return e._item.value},dg.modules.image=new dg.Module,dg.modules.image.FieldFormatter={},dg.modules.image.FieldFormatter.image=function(){dg.FieldFormatterPrepare(this,arguments)},dg.modules.image.FieldFormatter.image.prototype=new dg.FieldFormatter,dg.modules.image.FieldFormatter.image.prototype.constructor=dg.modules.image.FieldFormatter.image,dg.modules.image.FieldFormatter.image.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++){var i=r[n];o[n]={_theme:"image",_path:i.url,_attributes:{alt:i.alt,title:i.title,width:i.width,height:i.height}}}return o},dg.modules.system=new dg.Module,dg.modules.system.routing=function(){var e={};return e["system.dashboard"]={path:"/dg",defaults:{_title:"Getting started",_controller:function(){return new Promise(function(e,t){var r={},o=dg.currentUser(),n="Welcome to DrupalGap, ";n+=o.isAuthenticated()?o.getAccountName()+"!":dg.l("click here","http://docs.drupalgap.org/8")+" to view the documentation.",r.welcome={_markup:"<p>"+n+"</p>"},r.header={_markup:"<h2>"+dg.t("Resources")+"</h2>"},r.resources={_theme:"item_list",_items:[dg.l(dg.t("Hello World"),"http://docs.drupalgap.org/8/Hello_World"),dg.l(dg.t("Create a Module"),"http://docs.drupalgap.org/8/Modules/Create_a_Custom_Module")]},e(r)})}}},e["system.403"]={path:"/403",defaults:{_title:"403 - Access denied",_controller:function(){return new Promise(function(e,t){var r={msg:{_theme:"message",_type:"warning",_message:dg.t("You do not have access to this page.")}};e(r)})}}},e["system.404"]={path:"/404",defaults:{_title:"404 - Page not found",_controller:function(){return new Promise(function(e,t){e(dg.t("Sorry, that page was not found."))})}}},e},dg.modules.system.blocks=function(){var e={};return e.logo={build:function(){return new Promise(function(e,t){e(dg.config("logo"))})}},e.main={build:function(){return new Promise(function(e,t){e(dg.content)})}},e.main_menu={build:function(){return new Promise(function(e,t){var r={},o=[dg.l(dg.t("Home"),"")];r.menu={_theme:"item_list",_items:o},e(r)})}},e.primary_local_tasks=dg.modules.system.blockPrimaryLocalTasks(),e.powered_by={build:function(){return new Promise(function(e,t){var r={};r.list={_theme:"item_list",_title:dg.t("Powered by"),_items:[dg.l("DrupalGap","http://drupalgap.org"),dg.l("Drupal","http://drupal.org")]},e(r)})}},e.title={build:function(){return new Promise(function(e,t){var r=dg.getTitle();if("string"==typeof r){var o={_theme:"title",_title:dg.t(r)};e(o)}else e(r)})}},e.messages={build:function(){return new Promise(function(e,t){if(!dg.getMessageCount())return void e();for(var r={},o=dg.getMessages(),n=0;n<o.length;n++)r["msg"+n]=o[n];dg.clearMessages(),e(r)})}},e},dg.modules.system.configFormSubmit=function(e,t){for(var r in e)dg.isFormElement(r,e)&&"actions"!=r&&dg.setVar(r,t.getValue(r))},dg.modules.system.blockPrimaryLocalTasks=function(){return{build:function(){var e=this;return new Promise(function(t,r){var o={},n=e.getItems();n&&(o.local_tasks={_theme:"item_list",_items:n}),t(o)})},getItems:function(){var e=dg.router.getActiveRoute(),t=[],r=null,o=null,n=null;if(dg.router.hasBaseRoute(e)){var i=dg.router.getBaseRoute(e);r=dg.router.getChildRoutes(i),o=dg.router.getRouteTitle(i),n=dg.router.resolvePath(i)}else dg.router.hasChildRoutes(e)&&(r=dg.router.getChildRoutes(e),o=dg.router.getRouteTitle(e),n=dg.router.resolvePath(e));if(r){t.push({_theme:"list_item",_text:{_theme:"link",_text:o,_path:n,_key:dg.router.getRouteKey(i),_attributes:{class:[]}},_attributes:{class:[]}});for(var d=0;d<r.length;d++){var u=dg.router.loadRoute(r[d]);u&&dg.router.meetsRequirements(u)&&t.push({_theme:"list_item",_text:{_theme:"link",_text:dg.router.getRouteTitle(u),_path:dg.router.resolvePath(u),_key:dg.router.getRouteKey(u),_attributes:{class:[]}},_attributes:{class:[]}})}}return t.length?t:null}}},dg.modules.text=new dg.Module,dg.modules.text=new dg.Module,dg.modules.text.FieldFormatter={},dg.modules.text.FieldFormatter.text_default=function(){dg.FieldFormatterPrepare(this,arguments)},dg.modules.text.FieldFormatter.text_default.prototype=new dg.FieldFormatter,dg.modules.text.FieldFormatter.text_default.prototype.constructor=dg.modules.text.FieldFormatter.text_default,dg.modules.text.FieldFormatter.text_default.prototype.viewElements=function(e,t){var r=e.getItems(),o={};if(0==r.length)return o;for(var n=0;n<r.length;n++)o[n]={_markup:r[n].value};return o},dg.modules.text.FieldWidget={},dg.modules.text.FieldWidget.text_with_summary=function(e,t,r,o,n,i){dg.FieldWidgetPrepare(this,arguments)},dg.modules.text.FieldWidget.text_with_summary.prototype=new dg.FieldWidget,dg.modules.text.FieldWidget.text_with_summary.prototype.constructor=dg.modules.text.FieldWidget.text_with_summary,dg.modules.text.FieldWidget.text_with_summary.prototype.form=function(e,t,r,o,n){r._type="textarea",r._title=this.fieldDefinition.getLabel(),r._title_placeholder=!0,r._widgetType="FieldWidget",r._module="text",e&&"undefined"!==e[t]&&(r._value=e[t].value)},dg.modules.user=new dg.Module,dg.modules.user.routing=function(){var e={};return e["user.login"]={path:"/user/login",defaults:{_form:"UserLoginForm",_title:"Log in"}},e["user.logout"]={path:"/user/logout",defaults:{_title:"Log out",_controller:function(){return new Promise(function(e,t){e("Logging out..."),jDrupal.userLogout().then(function(){dg.goto(dg.getFrontPagePath())})})}}},e},dg.modules.user.blocks=function(){var e={};return e.user_login={build:function(){return new Promise(function(e,t){var r=dg.currentUser().isAuthenticated();if(!r&&"user/login"!=dg.getPath()){var o=dg.addForm("UserLoginForm",dg.applyToConstructor(UserLoginForm));o.get("form")._action=dg.getPath(),o.getForm().then(e)}})}},e.user_menu={build:function(){return new Promise(function(e,t){var r=[];r=dg.currentUser().isAuthenticated()?[dg.l(dg.t("My account"),"user/"+dg.currentUser().id()),dg.l(dg.t("Logout"),"user/logout")]:[dg.l(dg.t("Login"),"user/login"),dg.l(dg.t("Register"),"user/register")];var o={};o.menu={_theme:"item_list",_items:r},e(o)})}},e};var UserLoginForm=function(){this.buildForm=function(e,t){return new Promise(function(t,r){e._action||(e._action=dg.getFrontPagePath()),e.name={_type:"textfield",_title:"Username",_required:!0,_title_placeholder:!0},e.pass={_type:"password",_title:"Password",_required:!0,_title_placeholder:!0},e.actions={_type:"actions",submit:{_type:"submit",_value:"Log in",_button_type:"primary"}},t(e)})},this.submitForm=function(e,t){return new Promise(function(r,o){jDrupal.userLogin(t.getValue("name"),t.getValue("pass")).then(function(){dg.isFrontPage()?dg.router.check(dg.getFrontPagePath()):dg.getPath()==e._action&&dg.router.check(e._action),r()},function(e){var t=dg.qs("#edit-pass");t.value="",t.focus();var r=JSON.parse(e.responseText).message;dg.alert?dg.alert(r):console.log(r),o()})})}};UserLoginForm.prototype=new dg.Form("UserLoginForm"),UserLoginForm.constructor=UserLoginForm,dg.theme_bucket=function(e){if(e._grab||e._fill){e._format||(e._format="div");var t=e._format;e._attributes.id||(e._attributes.id=t+"-"+dg.salt());var r=e._attributes.id,o=new dg.Bucket(r,e);dg.setBucket(r,o);var n={},i=e._prefix?dg.render(e._prefix):"",d=e._suffix?dg.render(e._suffix):"";return n.bucket={_markup:i+"<"+t+" "+dg.attrs(e)+"></"+t+">"+d,_postRender:[function(){o.render()}]},dg.render(n)}},dg._buckets={},dg.Bucket=function(e,t){this._id=e,this._vars=t,this.id=function(){return this._id},this.element=function(){return dg.qs("#"+this.id())},this.getVars=function(){return this._vars},this.refresh=function(){this.render()},this.render=function(){var e=this,t=this.getVars(),r=null;t._grab?r=t._grab():t._fill&&(r=new Promise(t._fill)),r.then(function(t){e.element().innerHTML=dg.render(t),dg.postRenderCount()&&dg.runPostRenders()})}},dg.getBuckets=function(){return dg._buckets},dg.getBucket=function(e){return dg._buckets[e]?dg._buckets[e]:null},dg.setBucket=function(e,t){dg._buckets[e]=t},dg.clearBuckets=function(){dg._buckets={}},dg.theme_button=function(e){return e._value||(e._value=""),e._attributes.type||(e._attributes.type="button"),"<button "+dg.attributes(e._attributes)+">"+e._value+"</button>"},dg.theme_container=function(e){return"<div "+dg.attrs(e)+">"+dg.render(e._children)+"</div>"},dg.theme_document_title=function(e){return e._title+" | "+dg.config("title")},dg.theme_image_style=function(e){return e._path=dg.imageStyleUrl(e._style_name,e._path),dg.theme_image(e)},dg.imageStyleUrl=function(e,t){var r="public://",o=t.indexOf(r)!=-1,n=jDrupal.sitePath(),i=jDrupal.basePath();if(o){var d="sites/default/files/styles/"+e+"/public/",u=i+d;return(dg.isCompiled()?n+u:u)+t.replace(r,"")}return n+i+t},dg.theme_image=function(e){e._attributes.src=e._attributes.src?e._attributes.src:e._path;var t=e._attributes.src;return(t&&t.indexOf("public://")!=-1||t.indexOf("private://")!=-1)&&(e._attributes.src=dg.imagePath(t)),e._alt&&(e._attributes.alt=e._alt),e._title&&(e._attributes.title=e._title),"<img "+dg.attributes(e._attributes)+"/>"},dg.theme_item_list=function(e){var t="",r=e._type?e._type:"ul",o=e._h?e._h:3;if(e._title&&(t+="object"==typeof e._title?dg.render(e._title):"<h"+o+">"+e._title+"</h"+o+">"),e._items_prefix&&(t+=e._items_prefix),t+="<"+r+" "+dg.attributes(e._attributes)+">",e._items&&e._items.length>0){var n=e._itemType?e._itemType:"li";for(var i in e._items)e._items.hasOwnProperty(i)&&(t+=dg.theme("list_item",{
_item:e._items[i],_itemType:n,_i:i,_total:e._items.length}))}return t+="</"+r+">",e._items_suffix&&(t+=e._items_suffix),t},dg.theme_link=function(e){var t=e._text?e._text:"",r=e._path;""==r&&(r=dg.getFrontPagePath());var o=e._attributes;if("undefined"==typeof o.href&&r){var n=r;r.indexOf("http://")!=-1||r.indexOf("https://")!=-1||(n=0==r.indexOf("/")?r:"#"+r),r!=dg.getPath()||dg.inArray("active",o.class)||o.class.push("active"),n+=dg.extractQueryString(e),o.href=n}return e._inAppBrowser&&dg.isCompiled()&&dg_iab.init(e),"<a "+dg.attributes(o)+">"+t+"</a>"},dg.theme_list_item=function(e){var t=e._item,r=e._itemType?e._itemType:"li",o=e._i;if("object"==typeof t){if(dg.setRenderElementDefaults(t),0==o?t._attributes.class.push("first"):o==t._total-1&&t._attributes.class.push("last"),t._theme&&"list_item"!=t._theme)return dg.theme(t._theme,t);var n=t._text?t._text:"";return"<"+r+" "+dg.attributes(t._attributes)+">"+dg.render(n)+"</"+r+">"}var i={};return 0==o?i.class=["first"]:o==t._total-1&&(i.class=["last"]),"<"+r+" "+dg.attributes(i)+">"+t+"</"+r+">"},dg.theme_message=function(e){var t=e._format?e._format:"div",r=e._type?e._type:null,o=e._attributes.class,n="messages";return dg.inArray(n,o)||o.push(n),r&&!dg.inArray(r,o)&&o.push(r),"<"+t+" "+dg.attrs(e)+">"+e._message+"</"+t+">"},dg.theme_table=function(e){var t="<table "+dg.attrs(e)+">";if(e._header){t+="<thead><tr>";for(var r=0;r<e._header.length;r++){var o=e._header[r];t+=dg.isObject(o)?"<th "+dg.attrs(o)+' scope="col">'+o._text+"</th>":'<th scope="col">'+o+"</th>"}t+="</tr></thead>"}if(e._rows){t+="<tbody>";for(var r=0;r<e._rows.length;r++){var n=e._rows[r];if(dg.isObject(n)){t+="<tr "+dg.attrs(n)+">";for(var i=0;i<n._cols.length;i++){var d=n._cols[i];t+="<td>"+d+"</td>"}t+="</tr>"}else if(dg.isArray(n)){t+="<tr>";for(var i=0;i<n.length;i++){var d=n[i];t+="<td>"+d+"</td>"}t+="</tr>"}}t+="</tbody>"}return t+="</table>"},dg.theme_title=function(e){return"<h1 "+dg.attrs(e)+">"+e._title+"</h1>"};