@seanox/aspect-js
Version:
full stack JavaScript framework for SPAs incl. reactivity rendering, mvc / mvvm, models, expression language, datasource, routing, paths, unit test and some more
1 lines • 56.2 kB
JavaScript
(()=>{"use strict";if(void 0!==window.compliant)throw new Error("JavaScript incompatibility detected for: compliant");window.compliant=(context,payload)=>{if(null==context)return payload;if("undefined"!==new Function("return typeof "+context)())throw new Error("JavaScript incompatibility detected for: "+context);return context.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/)&&(context=`window["${context}"]`),eval(context+" = payload")},compliant("Namespace",{get PATTERN_NAMESPACE_SEPARATOR(){return/\./},get PATTERN_NAMESPACE_LEVEL_START(){return/^[_a-z\$][\w\$]*$/i},get PATTERN_NAMESPACE_LEVEL(){return/^[\w\$]+$/},use(...e){if(e.length<=0)return window;_filter(...e);let i=e.length,a=null;return 0<e.length&&"object"==typeof e[0]&&(a=e.shift()),i-=e.length,(e=e.join(".")).split(Namespace.PATTERN_NAMESPACE_SEPARATOR).forEach((e,t,o)=>{var r=0===t&&null===a?Namespace.PATTERN_NAMESPACE_LEVEL_START:Namespace.PATTERN_NAMESPACE_LEVEL;if(!e.match(r))throw new Error("Invalid namespace at level "+(t+1)+(e&&e.trim()?": "+e.trim():""));if(0===t&&null===a){if(void 0!==(a=_populate(a,e))&&!(a instanceof Element))return;a=window}var r=_populate(a,e),n=typeof r;if("undefined"!=n&&"object"!=n)throw new TypeError(`Invalid namespace type at level ${t+1+i}: `+n);(null==r||r instanceof Element)&&(t<o.length-1&&o[t+1].match(/^\d+$/)?a[e]=[]:a[e]={}),a=_populate(a,e)}),a},create(...e){if(e.length<2)throw new Error("Invalid namespace for creation: Namespace and/or value is missing");var t=e.pop(),o=(e=_filter(...e)).pop(),e=Namespace.use(...e);return null===e?null:(e[o]=t,_populate(e,o))},lookup(...t){if(t.length<=0)return window;_filter(...t);var o=t.length;let r=null;0<t.length&&"object"==typeof t[0]&&(r=t.shift()),o-=t.length,t=(t=t.join(".")).split(Namespace.PATTERN_NAMESPACE_SEPARATOR);for(let e=0;e<t.length;e++){var n=t[e],i=e+o===0?Namespace.PATTERN_NAMESPACE_LEVEL_START:Namespace.PATTERN_NAMESPACE_LEVEL;if(!n.match(i))throw new Error("Invalid namespace at level "+(e+1+o)+(n&&n.trim()?": "+n.trim():""));if(0===e&&null===r){if(void 0!==(r=_populate(r,n)))continue;r=window}if(null==(r=_populate(r,n)))return r;if(r instanceof Element)return}return r},exists(...e){return!(e.length<1)&&Object.usable(Namespace.lookup(...e))}});const _filter=(...e)=>{const o=[];return e.forEach((e,t)=>{if(0===t&&"object"!=typeof e&&"string"!=typeof e)throw new TypeError(`Invalid namespace at level ${t+1}: `+typeof e);if(0===t&&null===e)throw new TypeError(`Invalid namespace at level ${t+1}: null`);if(0<t&&"string"!=typeof e&&"number"!=typeof e)throw new TypeError(`Invalid namespace at level ${t+1}: `+typeof e);e="string"==typeof e?e.split(Namespace.PATTERN_NAMESPACE_SEPARATOR):[e],o.push(...e)}),o},_populate=(namespace,level)=>{if(namespace&&namespace!==window)return namespace[level];try{return eval(`typeof ${level} !== "undefined" ? ${level} : undefined`)}catch(error){if(error instanceof ReferenceError&&namespace===window)return window[level];throw error}},_appendChild=Element.prototype.appendChild,_offset=(Element.prototype.appendChild=function(t,e){if(e&&(this.innerHTML=""),t instanceof Node||!(Array.isArray(t)||t instanceof NodeList||Symbol&&Symbol.iterator&&t&&(t[Symbol.iterator],1)))return _appendChild.call(this,t);t=Array.from(t);for(let e=0;e<t.length;e++)_appendChild.call(this,t[e]);return t},compliant("Math.unique",t=>{(t=t||16)<0&&(t=16);let o="";for(let e=0;e<t;e++){var r=Math.floor(Math.random()*Math.floor(26));Math.floor(Math.random()*Math.floor(26))%2==0?o+=String(r%10):o+=String.fromCharCode(65+r)}return o}),compliant("Math.serial",()=>_serial.toString()),-9466848e5),_serial={timing:Date.now()+_offset,number:0,toString(){var e=Date.now()+_offset,e=(this.number=this.timing===e?this.number+1:0,this.timing=e,this.timing.toString(36)),t=this.number.toString(36);return(e.length.toString(36)+e+t.length.toString(36)+t).toUpperCase()}};compliant("RegExp.quote",e=>Object.usable(e)?String(e).replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&"):null),compliant("String.prototype.capitalize",function(){return this.length<=0?this:this.charAt(0).toUpperCase()+this.slice(1)}),compliant("String.prototype.uncapitalize",function(){return this.length<=0?this:this.charAt(0).toLowerCase()+this.slice(1)}),compliant("String.prototype.encodeHex",function(){let o="";for(let t=0;t<this.length;t++){let e=Number(this.charCodeAt(t)).toString(16).toUpperCase();for(;e.length<2;)e="0"+e;o+=e}return"0x"+o}),compliant("String.prototype.decodeHex",function(){let t=this,o=(t.match(/^0x/)&&(t=t.substring(2)),"");for(let e=0;e<t.length;e+=2)o+=String.fromCharCode(parseInt(t.substring(e,2),16));return o}),compliant("String.prototype.encodeBase64",function(){try{return btoa(encodeURIComponent(this).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode("0x"+t)))}catch(e){throw new Error("Malformed character sequence")}}),compliant("String.prototype.decodeBase64",function(){try{return decodeURIComponent(atob(this).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))}catch(e){throw new Error("Malformed character sequence")}}),compliant("String.prototype.encodeHtml",function(){var e=document.createElement("div");return e.textContent=this,e.innerHTML}),compliant("String.prototype.hashCode",function(){let t=0,o=0;for(let e=0;e<this.length;e++){var r=31*t+this.charCodeAt(e);t=Number.isSafeInteger(r)?r:(o++,Number.MAX_SAFE_INTEGER-t+this.charCodeAt(e))}return t=((t=(t=Math.abs(t).toString(36)).length.toString(36)+t)+o.toString(36)).toUpperCase()}),compliant("String.prototype.unescape",function(){let text=this.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/^(["'])/,"$1").replace(/([^\\])((?:\\{2})*)(?=["'])/g,"$1$2\\");return eval(`"${text}"`)}),compliant("window.serial"),Object.defineProperty(window,"serial",{value:Math.serial()}),compliant("window.location.contextPath"),Object.defineProperty(window.location,"contextPath",{value:(e=>e.substring(0,e.lastIndexOf("/"))+"/")(window.location.pathname||"/")}),compliant("window.location.combine",(...e)=>"/"+e.join("/").replace(/[\/\\]+/g,"/").replace(/(^\/+)|(\/+$)/g,""))})(),(()=>{"use strict";const s=window.location.combine(window.location.contextPath,"/data"),c=/^(?:([a-z]+):\/+)(\/((\w+)|(\w+(\-+\w+)+)))+$/,p=/^\s*text\s*\/\s*javascript\s*$/i,i=/(^\w+$)|(^((\w+\-+(?=\w))+)\w*$)/,l=(compliant("DataSource",{get locale(){return DataSource.locales?DataSource.locales.selection:null},localize(e){if(!DataSource.data||!DataSource.locales)throw new Error("Locale not available");if("string"!=typeof e)throw new TypeError("Invalid locale: "+typeof e);if(!(e=(e||"").trim().toLowerCase())||!DataSource.locales.includes(e))throw new Error("Locale not available");DataSource.locales.selection=e},transform(e,t,o){if("string"==typeof e&&e.match(c)&&(e=DataSource.fetch(e)),"string"==typeof t&&t.match(c)&&(t=DataSource.fetch(t)),!(e instanceof XMLDocument))throw new TypeError("Invalid xml document");if(!(t instanceof XMLDocument))throw new TypeError("Invalid xml stylesheet");var r,n,i=new XSLTProcessor;if(i.importStylesheet(t),o&&"object"==typeof o)for([r,n]of"function"!=typeof o[Symbol.iterator]?Object.entries(o):o)"function"!=typeof o[r]&&i.setParameter(null,r,n);let a=e.evaluate("string(/*/@escape)",e,null,XPathResult.ANY_TYPE,null).stringValue;a=!!a.match(/^yes|on|true|1$/i);t=i.transformToDocument(e.clone());let s=t.querySelectorAll(a?"*":"*[escape]");s.forEach(e=>{var t;(a||(e.getAttribute("escape")||"on").match(/^yes|on|true|1$/i))&&(t=e.innerHTML).indexOf("<")<0&&t.indexOf(">")<0&&(e.innerHTML=e.textContent),e.removeAttribute("escape")}),(s=t.querySelectorAll("script[type],script:not([type])")).forEach(e=>{e.hasAttribute("type")&&!(e.getAttribute("type")||"").match(p)||e.setAttribute("type","composite/javascript")}),s=t.childNodes,t.body?s=t.body.childNodes:t.firstChild&&t.firstChild.nodeName.match(/^transformiix\b/i)&&(s=t.firstChild.childNodes);var l=document.createDocumentFragment();s=Array.from(s);for(let e=0;e<s.length;e++)l.appendChild(s[e]);return l},fetch(e,t,o){if("string"!=typeof e||!e.match(c))throw new Error("Invalid locator: "+String(e));var r=e.match(c)[1],n=e.match(c)[2];if(1===arguments.length){let e=s+"/"+DataSource.locale+"/"+n+"."+r;n=(e=e.replace(/\/+/g,"/")).hashCode();if(l.hasOwnProperty(n))return l[n];var i=new XMLHttpRequest;if(i.overrideMimeType("application/xslt+xml"),i.open("GET",e,!1),i.send(),200!==i.status)throw new Error(`HTTP status ${i.status} for `+i.responseURL);return e=i.responseXML,(l[n]=e).clone()}if(!r.match(/^xml$/)&&t)throw new Error("Transformation is not supported for this locator");i=DataSource.fetch(e);if(!t)return i.clone();let a=e.replace(/(^((\w+\-+(?=\w))+)\w*)|(^\w+)/,"xslt");if("boolean"==typeof t||"string"==typeof(a=t)&&a.match(c))return DataSource.transform(i,DataSource.fetch(a),o);throw new Error("Invalid style: "+String(a))},collect(...e){if(e.length<=0)return null;let t=[],o="collection";if(2===e.length&&"string"==typeof e[0]&&Array.isArray(e[1])){if(!e[0].match(i))throw new TypeError("Invalid collector");o=e[0],t=Array.from(e[1])}else t=1===e.length&&Array.isArray(e[0])?t.concat(e[0]):Array.from(e);let r=o.hashCode()+":"+t.join().hashCode();if(t.forEach(e=>r+=":"+String(e).hashCode()),l.hasOwnProperty(r))return l[r].clone();const n=document.implementation.createDocument(null,o,null);return t.forEach(e=>{if("string"!=typeof e)throw new TypeError("Invalid collection entry");n.documentElement.appendChild(DataSource.fetch(e).documentElement.cloneNode(!0))}),(l[r]=n).clone()}}),compliant("XMLDocument.prototype.clone",function(){var e=this.implementation.createDocument(null,null);return e.appendChild(e.importNode(this.documentElement,!0)),e}),{});Object.defineProperty(DataSource,"cache",{value:{}}),Object.defineProperty(DataSource,"locales",{value:[],enumerable:!0});let o=[];if([navigator.language].concat(navigator.languages||[]).forEach(e=>{e=e.toLowerCase().trim(),o.push(e),e=e.replace(/-.*$/,""),o.includes(e)||o.push(e)}),o.length<=0)throw new Error("Locale not available");var r=new XMLHttpRequest;if(r.overrideMimeType("text/plain"),r.open("GET",s+"/locales.xml",!1),r.send(),Object.defineProperty(DataSource,"data",{value:200===r.status?(new DOMParser).parseFromString(r.responseText,"text/xml"):null}),!DataSource.data&&404!==r.status)throw new Error("Locale not available");if(DataSource.data){r=DataSource.data;let t=r.evaluate("/locales/*[@default]",r,null,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null);for(let e=t.iterateNext();e;e=t.iterateNext()){var n=e.nodeName.toLowerCase();DataSource.locales.includes(n)||DataSource.locales.push(n)}for(let e=(t=r.evaluate("/locales/*",r,null,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null)).iterateNext();e;e=t.iterateNext()){var a=e.nodeName.toLowerCase();DataSource.locales.includes(a)||DataSource.locales.push(a)}if(DataSource.locales.length<=0)throw new Error("Locale not available");o.push(DataSource.locales[0]),o=o.filter(e=>DataSource.locales.includes(e)),DataSource.locales.selection=(o.length?o:DataSource.locales)[0]}})(),(()=>{compliant("Scripting",{eval(n){if("string"!=typeof n)throw new TypeError("Invalid data type");let i,o;for(let r=0;r<n.length;r++){let e=n.charAt(r);if(!(r>=n.length)||i){if(o<0){if("?"===e){o=1;var t="_tolerate(()=>";n=n.substring(0,r)+t+n.substring(r+1),r+=t.length;continue}e.match(/\s/)||(o=0)}if("\\"===e)r++;else if(i)(i===n.substring(r,r+i.length)||"\n"===i&&"\r"===e)&&(i=null);else switch(e){case"/":"/"===(e=n.charAt(r+1))&&(i="\n"),"*"===e&&(i="*/");continue;case"(":0<o?o++:o=-1;continue;case")":if(o<=0)continue;if(0<--o)continue;n=n.substring(0,r)+")"+n.substring(r),r+=")".length;continue;case"'":case'"':case"`":i=e;continue;case"#":let t=n.substring(r-1,r+10);var a=t.match(/(^|\W)(#(?:import|export|module|use))\s/);if(a){let o=a[2];for(let e=r+o.length;e<=n.length;e++)if((t=n.charAt(e)).match(/[;\r\n]/)||!(e<n.length)){let t=n.substring(r+o.length,e).trim();switch(o){case"#import":if(!t.match(/^(\w+(\/\w+)*)(\s+(\w+(\/\w+)*))*$/))throw new Error(("Invalid macro: #import "+t).trim());var s=t.split(/\s+/).map(e=>'"'+e+'"');o="_import(...["+s.join(",")+"])";break;case"#export":const l=[],i=/^([_a-z]\w*)(?:@((?:[_a-z]\w*)(?:\.[_a-z]\w*)*))?$/i;t.split(/\s+/).forEach(e=>{e=e.match(i);if(!e)throw new Error(("Invalid macro: #export "+t).trim());t=[e[1],'"'+e[1]+'"'],e[2]&&t.push('"'+e[2]+'"'),l.push("["+t.join(",")+"]")}),o="_export(...["+l.join(",")+"])";break;case"#module":o=(o=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").trim())&&"console.debug(`Module: "+o+"`)";break;case"#use":if(!t.match(/^([_a-z]\w*)(\.[_a-z]\w*)*(\s+([_a-z]\w*)(\.[_a-z]\w*)*)*$/i))throw new Error(("Invalid macro: #use "+t).trim());s=t.split(/\s+/).map(e=>'"'+e+'"');o="_use(...["+s.join(",")+"])"}n=n.substring(0,r-1)+(a[1]||"")+o+n.substring(e),r+=o.length;break}}continue;default:continue}}}return this.run(n)},run(script){if("string"!=typeof script)throw new TypeError("Invalid data type");if(script.trim())with(Composite.render.context)return eval(script)}});const _import=(...e)=>{e.forEach(e=>Composite.load(Composite.MODULES+"/"+e+".js",!0))},_export=(...e)=>{e.forEach(e=>{let t=window;(e[2]?e[2].split(/\./):[]).forEach(e=>{void 0===t[e]&&(t[e]={}),t=t[e]});var o=t[e[1]];if(!(void 0===o||o instanceof Element||o instanceof HTMLCollection))throw new Error("Context for export is already in use: "+e[1]+(e[2]?"@"+e[2]:""));t[e[1]]=e[0]})},_use=(...e)=>{e.forEach(e=>Namespace.use(e))},_tolerate=e=>{try{return e.call(window)}catch(e){return!1}}})(),(()=>{"use strict";compliant("Expression",{eval(...e){let t;1<e.length?t=String(e[1]):0<e.length&&(t=String(e[0]));let o,r=(o=1<e.length&&e[0]?String(e[0]):o)?n.get(o):null;r=r||c(i,t),o&&n.set(o,r);try{return Scripting.run(r)}catch(e){return console.error(e.message+"\n\t"+r),new Error(e.message+" in "+r)}}});const n=new Map,i=0,a=["and","&&","or","||","not","!","eq","==","eeq","===","ne","!=","nee","!==","lt","<","gt",">","le","<=","ge",">=","empty","!","div","/","mod","%"],s=new RegExp("(^|[^\\w\\.])("+a.filter((e,t)=>t%2==0).join("|")+")(?=[^\\w\\.]|$)","ig"),l=(e,o)=>e.replace(/[\t\r](\d+)\n/g,(e,t)=>o[t]),c=(e,t,o=[])=>{switch(e){case i:let e=t=t.replace(/[\r\n]/g," ").trim();if(!(e=(e=e.replace(/\{\{(.*?)\}\}/g,(e,t)=>c(3,t,o))).replace(/((?:[^\n]+$)|(?:[^\n]+(?=\r)))/g,(e,t)=>c(2,t,o))).match(/^(\r(\d+)\n)*$/))throw Error("Error in the expression structure\n\t"+t);const r=!t.startsWith("{{")||!t.endsWith("}}")||t.substring(2).includes("{{")||t.substring(0,t.length-2).includes("}}");return e=(e=(e=(e=(e=(e=(e=e.replace(/(?:\r(\d+)\n)/g,(e,t)=>r?"\r("+o[t]+")\n":"\r"+o[t]+"\n")).replace(/\r\\u0022\n/g,'\\"')).replace(/\r\\u0027\n/g,"\\'")).replace(/\r\\u0060\n/g,"\\`")).replace(/(\n\r)+/g," + ")).replace(/(^\r)|(\n$)/g,"")).replace(/[\r\n]+/g," ");case 2:t='"'+t+'"';case 1:return o.push(t),"\r"+(o.length-1)+"\n";case 3:if(!(t=t.trim()))return"";if((t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/(^|[^\\])((?:\\{2})*)(\\\")/g,"$1$2\r\\u0022\n")).replace(/(^|[^\\])((?:\\{2})*)(\\\')/g,"$1$2\r\\u0027\n")).replace(/(^|[^\\])((?:\\{2})*)(\\\`)/g,"$1$2\r\\u0060\n")).replace(/((['\"\`])[.\s\S]*?\2)/g,(e,t)=>c(1,t,o))).replace(/\t+/g," ")).replace(s,(e,t,o)=>t+a[a.indexOf(o.toLowerCase())+1])).replace(/(^|[^\w\.])(true|false|null|undefined|new|instanceof|typeof)(?=[^\w\.]|$)/gi,(e,t="",o="")=>t+o.toLowerCase())).replace(/#\[([^\[\]]*)\]/g,(e,t)=>(t=t.replace(/\/{2}([.\s\S]*?)\/{2}/g,'"+($1)+"'),o.push(l('document.getElementById("'+t+'")',o)),"\r"+(o.length-1)+"\n"))).replace(/#([_a-z]\w*)/gi,(e,t)=>(o.push(l('document.getElementById("'+t+'")',o)),"\r"+(o.length-1)+"\n"))).match(/\(\s*\?/))for(let e=-1;e<o.length;)e=o.length,t=t.replace(/(\([^\(\)]*\))/g,e=>(e=e.replace(/^\( *\?+ *([.\s\S]*?) *\)$/,(e,t)=>"_tolerate(()=>("+t+"))"),o.push(l(e,o)),"\t"+(o.length-1)+"\n"));return t=t.replace(/ {2,}/g," "),o.push(l(t,o)),"\r"+(o.length-1)+"\n";default:throw new Error("Unexpected script type")}}})(),(()=>{"use strict";const e=[],O=[],P=[],U=(compliant("Composite",{get MODULES(){return window.location.combine(window.location.contextPath,"/modules")},get ATTRIBUTE_COMPOSITE(){return"composite"},get ATTRIBUTE_CONDITION(){return"condition"},get ATTRIBUTE_EVENTS(){return"events"},get ATTRIBUTE_ID(){return"id"},get ATTRIBUTE_IMPORT(){return"import"},get ATTRIBUTE_INTERVAL(){return"interval"},get ATTRIBUTE_ITERATE(){return"iterate"},get ATTRIBUTE_MESSAGE(){return"message"},get ATTRIBUTE_NAME(){return"name"},get ATTRIBUTE_OUTPUT(){return"output"},get ATTRIBUTE_RENDER(){return"render"},get ATTRIBUTE_RELEASE(){return"release"},get ATTRIBUTE_TEXT(){return"text"},get ATTRIBUTE_TYPE(){return"type"},get ATTRIBUTE_VALIDATE(){return"validate"},get ATTRIBUTE_VALUE(){return"value"},get PATTERN_ATTRIBUTE_ACCEPT(){return/^(composite|condition|events|id|import|interval|iterate|message|output|release|render|validate)$/i},get PATTERN_ATTRIBUTE_STATIC(){return/^(composite|id)$/i},get PATTERN_EXPRESSION_CONTAINS(){return/\{\{(.|\r|\n)*?\}\}/g},get PATTERN_EXPRESSION_CONDITION(){return/^\s*\{\{\s*(([^}]|(}(?!})))*?)\s*\}\}\s*$/i},get PATTERN_EXPRESSION_VARIABLE(){return/^\s*\{\{\s*((?:(?:_*[a-z])|(?:_\w*))\w*)\s*:\s*(([^}]|(}(?!})))*?)\s*\}\}\s*$/i},get PATTERN_ELEMENT_IGNORE(){return/script|style/i},get PATTERN_SCRIPT(){return/script/i},get PATTERN_COMPOSITE_SCRIPT(){return/^composite\/javascript$/i},get PATTERN_COMPOSITE_ID(){return/^([_a-z]\w*)(?:@([_a-z]\w*(?::[_a-z]\w*)*))?$/i},get PATTERN_ELEMENT_ID(){return/^([_a-z]\w*)(?::(\w+(?::\w+)*))?(?:#(\w+))?(?:@([_a-z]\w*(?::[_a-z]\w*)*))?$/i},get PATTERN_CUSTOMIZE_SCOPE(){return/[_a-z]([\w-]*\w)?$/i},get PATTERN_DATASOURCE_URL(){return/^\s*xml:\s*(\/\S+)\s*(?:\s*(?:xslt|xsl):\s*(\/\S+))*$/i},get PATTERN_EVENT(){return/^([A-Z][a-z]+)+$/},get EVENT_RENDER_START(){return"RenderStart"},get EVENT_RENDER_NEXT(){return"RenderNext"},get EVENT_RENDER_END(){return"RenderEnd"},get EVENT_MOUNT_START(){return"MountStart"},get EVENT_MOUNT_NEXT(){return"MountNext"},get EVENT_MOUNT_END(){return"MountEnd"},get EVENT_MODULE_LOAD(){return"ModuleLoad"},get EVENT_MODULE_DOCK(){return"ModuleDock"},get EVENT_MODULE_READY(){return"ModuleReady"},get EVENT_MODULE_UNDOCK(){return"ModuleUndock"},get EVENT_HTTP_START(){return"HttpStart"},get EVENT_HTTP_PROGRESS(){return"HttpProgress"},get EVENT_HTTP_RECEIVE(){return"HttpReceive"},get EVENT_HTTP_LOAD(){return"HttpLoad"},get EVENT_HTTP_ABORT(){return"HttpAbort"},get EVENT_HTTP_TIMEOUT(){return"HttpTimeout"},get EVENT_HTTP_ERROR(){return"HttpError"},get EVENT_HTTP_END(){return"HttpEnd"},get EVENT_ERROR(){return"Error"},get EVENTS(){return"abort after|print animation|end animation|iteration animation|start before|print before|unload blur can|play can|play|through change click context|menu copy cut dbl|click drag drag|end drag|enter drag|leave drag|over drag|start drop duration|change ended error focus focus|in focus|out hash|change input invalid key|down key|press key|up load loaded|data loaded|meta|data load|start message mouse|down mouse|enter mouse|leave mouse|move mouse|over mouse|out mouse|up mouse|wheel offline online open page|hide page|show paste pause play playing popstate progress rate|change resize reset scroll search seeked seeking select show stalled storage submit suspend time|update toggle touch|cancel touch|end touch|move touch|start transition|end unload volume|change waiting wheel"},get PATTERN_EVENT_FUNCTIONS(){return e=Composite.EVENTS.replace(/(?:\||\b)(\w)/g,(e,t)=>t.toUpperCase()),new RegExp("^on("+e.replace(/\s+/g,"|")+")");var e},get PATTERN_EVENT_NAMES(){return Composite.EVENTS.replace(/(?:\||\b)(\w)/g,(e,t)=>t.toUpperCase()).split(/\s+/)},get PATTERN_EVENT_FILTER(){return Composite.EVENTS.replace(/(?:\||\b)(\w)/g,(e,t)=>t.toUpperCase()).toLowerCase().split(/\s+/)},lock(e,t){if(e.queue=e.queue||[],void 0===e.lock||!1===e.lock)if(e.lock={ticks:1,selector:t,queue:[],share(){return this.ticks++,this},release(){if(this.ticks--,!(0<this.ticks)){if(e===Composite.render){let e=this.selector;e instanceof Node&&e.nodeType===Node.TEXT_NODE&&(o=e.ordinal(),(o=j[o]||{}).condition)&&o.condition.element&&o.condition.marker===this.selector&&(e=o.condition.element);let t=[];"string"==typeof e?(o=document.querySelectorAll(e),Array.from(o).forEach(e=>{t.includes(e)||t.push(e);e=e.querySelectorAll("*");Array.from(e).forEach(e=>{t.includes(e)||t.push(e)})})):e instanceof Element&&(t=e.querySelectorAll("*"),t=[e].concat(Array.from(t))),t.forEach(e=>Composite.mount(e)),Composite.fire(Composite.EVENT_RENDER_END,this.selector)}else{if(e!==Composite.mount)throw new Error("Invalid context: "+e);Composite.fire(Composite.EVENT_MOUNT_END,this.selector)}var o=e.queue.shift();o&&Composite.asynchron(e,o),e.lock=!1}}},e===Composite.render)Composite.fire(Composite.EVENT_RENDER_START,t);else{if(e!==Composite.mount)throw new Error("Invalid context: "+e);Composite.fire(Composite.EVENT_MOUNT_START,t)}else if(e===Composite.render)Composite.fire(Composite.EVENT_RENDER_NEXT,t);else{if(e!==Composite.mount)throw new Error("Invalid context: "+e);Composite.fire(Composite.EVENT_MOUNT_NEXT,t)}return e.lock},listen(e,t){if("string"!=typeof e)throw new TypeError("Invalid event: "+typeof e);if("function"!=typeof t&&null!=t)throw new TypeError("Invalid callback: "+typeof t);if(!e.match(Composite.PATTERN_EVENT))throw new Error("Invalid event"+(e.trim()?": "+e:""));e=e.toLowerCase(),r.has(e)&&Array.isArray(r.get(e))||r.set(e,[]),r.get(e).push(t)},fire(e,...t){var o;e=(e||"").trim(),r.size<=0||!e||(o=r.get(e.toLowerCase()),Array.isArray(o)&&(t=[e,...t],o.forEach(e=>e(...t))))},asynchron(e,...t){window.setTimeout((e,...t)=>{e(...t)},0,e,...t)},lookup(e){if(null==e)return null;if("string"==typeof e){var t=document.querySelectorAll(e.trim());if(t.length<=0)return null;if(1<t.length)throw new Error("Selector is not unique");return Composite.lookup(t[0])}return e instanceof Element?(null!==(t=V(e))&&delete t.target,t):null},validate(r,n){if((arguments.length<2||!1!==n)&&(n=!0),"string"==typeof r){if(!(r=r.trim()))return;let o=Array.from(document.querySelectorAll(r));return o.forEach((e,t)=>{o[t]=Composite.validate(e,n),void 0===o[t]?o[t]=0:o[t]=!0===o[t]?1:2}),(o=o.join("")).match(/^1+$/)?!0:!o.match(/2/)&&void 0}if(r instanceof Element){var o=r.ordinal(),i=j[o];let t=!0;"function"==typeof r.setCustomValidity&&r.setCustomValidity(""),"function"==typeof r.checkValidity&&(t=r.checkValidity());var a,s=V(r);if(s instanceof Object){let e;r instanceof Element&&(r.tagName.match(/^input$/i)&&r.type.match(/^radio|checkbox/i)?e=r.checked:r.tagName.match(/^select/i)&&"selectedIndex"in r?e=r.options[r.selectedIndex].value:Composite.ATTRIBUTE_VALUE in r&&(e=r[Composite.ATTRIBUTE_VALUE])),i.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALIDATE)&&!0===t&&!0!==n&&"function"==typeof s.model[Composite.ATTRIBUTE_VALIDATE]&&(a=s.model[Composite.ATTRIBUTE_VALIDATE],t=void 0!==e?a.call(s.model,r,e):a.call(s.model,r))}if("function"==typeof r.setCustomValidity&&(!0===t&&Object.usable(i.message)&&Object.usable(i.message.attribute)&&r.removeAttribute(i.message.attribute),!0!==t)){let e;"string"!=typeof(e="string"==typeof t&&t.trim()?t.trim():e)&&((e=i.attributes.hasOwnProperty(Composite.ATTRIBUTE_MESSAGE)?String(i.attributes[Composite.ATTRIBUTE_MESSAGE]||""):e)||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e=String(Expression.eval(o+":"+Composite.ATTRIBUTE_MESSAGE,e))),Object.usable(e)&&((a=e.match(/^@([_a-z](?:[\w-]*\w)?):\s*(.*?)\s*$/i))?(s=a[1],(i.statics||{}).hasOwnProperty(s.toLowerCase())||Composite.PATTERN_ATTRIBUTE_STATIC.test(s)||(i.message={attribute:s},r.setAttribute(s,a[2])),r.setCustomValidity(a[2])):(r.setCustomValidity(e),"function"==typeof r.reportValidity&&r.reportValidity()))}if(void 0!==t)return t}},mount(t,o){if(Composite.mount.queue=Composite.mount.queue||[],Composite.mount.lock&&Composite.mount.lock!==o)Composite.mount.queue.includes(t)||Composite.mount.queue.push(t);else{o=Composite.lock(Composite.mount,t);try{if("string"==typeof t)return(t=t.trim())?void document.querySelectorAll(t).forEach(e=>Composite.mount(e,o.share())):void 0;if(t instanceof Element&&!Composite.mount.queue.includes(t)&&!t.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)&&(Composite.mount.stack=Composite.mount.stack||[],!Composite.mount.stack.includes(t))){var e=t.ordinal(),r=j[e];if(r instanceof Object){var n=r.attributes[Composite.ATTRIBUTE_ID];let o=r.attributes.hasOwnProperty(Composite.ATTRIBUTE_EVENTS)?r.attributes[Composite.ATTRIBUTE_EVENTS]:"";o=(o=(o=String(o||"")).toLowerCase().split(/\s+/)).filter((e,t,o)=>Composite.PATTERN_EVENT_FILTER.includes(e)&&o.indexOf(e)===t);var i=V(t);if(i instanceof Object&&n){let t=i.model;for(var a in t=void 0!==i.target?"object"==typeof i.target?i.target:null:t)"function"==typeof t[a]&&a.match(Composite.PATTERN_EVENT_FUNCTIONS)&&(a=a.substring(2).toLowerCase(),o.includes(a)||o.push(a));let e=t?Object.getPrototypeOf(t):null;for(;e;)Object.getOwnPropertyNames(e).forEach(e=>{"function"==typeof t[e]&&e.match(Composite.PATTERN_EVENT_FUNCTIONS)&&(e=e.substring(2).toLowerCase(),o.includes(e)||o.push(e))}),e=Object.getPrototypeOf(e)}if(Composite.mount.stack.push(t),o.forEach(e=>{t.addEventListener(e.toLowerCase(),r=>{var n=r.currentTarget,t=n.ordinal(),i=j[t],a=r.type.toLowerCase();if(Composite.PATTERN_EVENT_FILTER.includes(a)){a=Composite.PATTERN_EVENT_FILTER.indexOf(a),a=Composite.PATTERN_EVENT_NAMES[a];let o;var s=Composite.validate(n,!1),l=V(n);if(l instanceof Object){let t;if(n instanceof Element&&(n.tagName.match(/^input$/i)&&n.type.match(/^radio|checkbox/i)?t=n.checked:n.tagName.match(/^select/i)&&"selectedIndex"in n?t=n.options[n.selectedIndex].value:Composite.ATTRIBUTE_VALUE in n&&(t=n[Composite.ATTRIBUTE_VALUE])),"optional"===String(i.attributes[Composite.ATTRIBUTE_VALIDATE]).toLowerCase()||!0===s){n=e=>{var t=typeof e;return void 0!==e&&("object"==t&&null===e||"boolean"==t||"number"==t||"string"==t)};n(l.target)?l.target=t:"object"==typeof l.target?n(l.target[Composite.ATTRIBUTE_VALUE])&&(l.target[Composite.ATTRIBUTE_VALUE]=t):void 0===l.target&&n(l.model[Composite.ATTRIBUTE_VALUE])&&(l.model[Composite.ATTRIBUTE_VALUE]=t);let e=l.model;(e=void 0!==l.target?l.target&&"object"==typeof l.target?l.target:null:e)&&"function"==typeof e["on"+a]&&(o=e["on"+a].call(e,r))}}let e=i.attributes.hasOwnProperty(Composite.ATTRIBUTE_EVENTS)?i.attributes[Composite.ATTRIBUTE_EVENTS]:"";if((e=(e=String(e||"")).toLowerCase().split(/\s+/)).includes(a.toLowerCase())){let e=i.attributes.hasOwnProperty(Composite.ATTRIBUTE_RENDER)?i.attributes[Composite.ATTRIBUTE_RENDER]:"";((e=String(e||""))||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e=Expression.eval(t+":"+Composite.ATTRIBUTE_RENDER,e)),Composite.render(e)}return l instanceof Object&&((void 0!==o&&!o||void 0!==s&&!0!==s)&&r.preventDefault(),void 0!==o)?o:void 0}})}),i&&i.target&&n){let e=i.target;void 0!==(e=i.target instanceof Object?Composite.ATTRIBUTE_VALUE in i.target?i.target.value:void 0:e)&&(t.tagName.match(/^input$/i)&&t.type.match(/^radio|checkbox/i)?t.checked=e:Composite.ATTRIBUTE_VALUE in t&&(t[Composite.ATTRIBUTE_VALUE]=e))}}}}finally{o.release()}}},customize(...e){let t;if("string"==typeof(t=0<e.length?e[0]:t)&&1<e.length&&"string"==typeof e[1]&&t.match(/^@ATTRIBUTES-STATICS$/i)){const r=[];(e[1]||"").trim().split(/\s+/).forEach(e=>{e=e.toLowerCase(),U.has(e)||e.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||(U.add(e),r.push(e))});const n=t=>{if(t instanceof Element){var e=t.ordinal();const o=j[e];o&&(r.forEach(e=>{o.statics=o.statics||{},o.statics.hasOwnProperty[e]&&void 0!==o.statics[e]||(t.hasAttribute(e)?o.statics[e]=t.getAttribute(e):o.statics[e]=null)}),Array.from(t.childNodes).forEach(e=>n(e)))}};void n(document.body)}else if("function"==typeof t&&1===e.length)M.add(t);else{if("string"!=typeof t)throw new TypeError("Invalid scope: "+typeof t);var o,e=1<e.length?e[1]:null;if("function"!=typeof e&&null!=e)throw new TypeError("Invalid callback: "+typeof e);if((t=t.trim()).length<=0)throw new Error("Invalid scope");t.match(Composite.PATTERN_CUSTOMIZE_SCOPE)?null===e?L.delete(t.toLowerCase()):L.set(t.toLowerCase(),e):(o=t.toLowerCase().hashCode(),null===e?D.delete(o):D.set(o,{selector:t,callback:e}))}},render(i,a){if(Composite.render.queue=Composite.render.queue||[],i||!(Composite.render.queue.length<=0))if(Composite.render.lock&&Composite.render.lock!==a)Composite.render.queue.includes(i)||Composite.render.queue.push(i),Composite.asynchron(Composite.render);else{if((i=i||Composite.render.queue[0])instanceof Element&&!j[i.ordinal()]){P.push(...O);let e=i.getAttribute(Composite.ATTRIBUTE_ID)||"";e.match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e=Expression.eval(i.ordinal()+":"+Composite.ATTRIBUTE_ID,e),i.setAttribute(Composite.ATTRIBUTE_ID,e)),P.length=0}a=Composite.lock(Composite.render,i);const r=i;try{if("string"==typeof i)return(i=i.trim())?void document.querySelectorAll(i).forEach(e=>Composite.render(e,a.share())):void 0;if(i instanceof Node){let r=i.ordinal(),n=j[r];P.length=0,n&&n.context?P.push(...n.context):P.push(...O);var e,t,o,s,l,c,p,u,T,m=L.get(i.nodeName.toLowerCase());if(!m||!1!==m(i)){if(i.parentNode)for(var[E,d]of D){var h=i.parentNode.querySelectorAll(d.selector);if(Array.from(h).includes(i)&&!1===d.callback(i))return}if(!n){const b=(e,t)=>!(!e||!e.parentNode)&&(t.test(e.parentNode.nodeName)||b(e.parentNode,t));if(b(i,Composite.PATTERN_ELEMENT_IGNORE))return;if(M.forEach(e=>e.call(null,i)),n={serial:r,element:i,attributes:{},context:[...P]},j[r]=n,i instanceof Element&&i.attributes){if(Array.from(i.attributes).forEach(e=>{((e={name:e.name.toLowerCase(),value:(e.value||"").trim()}).value.match(Composite.PATTERN_EXPRESSION_CONTAINS)||e.name.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||U.has(e.name))&&(!e.name.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||U.has(e.name)||e.name===Composite.ATTRIBUTE_RELEASE||i.removeAttribute(e.name),n.attributes[e.name]=e.value,e.value.match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||e.name===Composite.ATTRIBUTE_ID||e.name===Composite.ATTRIBUTE_EVENTS||U.has(e.name))&&(e.value=Expression.eval(i.ordinal()+":"+e.name,e.value)),!e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)&&e.name!==Composite.ATTRIBUTE_ID&&e.name!==Composite.ATTRIBUTE_EVENTS||(n.attributes[e.name]=e.value),n.statics=n.statics||{},U.has(e.name)&&(n.statics[e.name]=e.value),e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||e.name===Composite.ATTRIBUTE_ID||e.name===Composite.ATTRIBUTE_EVENTS||U.has(e.name))&&i.setAttribute(e.name,e.value)}),n.attributes.hasOwnProperty(Composite.ATTRIBUTE_CONDITION)){var f,A,g,C=(n.attributes[Composite.ATTRIBUTE_CONDITION]||"").trim();if(C.match(Composite.PATTERN_EXPRESSION_CONDITION))return f=document.createTextNode(""),A=i.cloneNode(!0),g=n.attributes,n={serial:f.ordinal(),element:f,attributes:g,context:[...P],condition:{expression:C,template:A,marker:f,element:null,attributes:g,complete:!1,share:null}},j[n.serial]=n,delete j[r],i.parentNode.replaceChild(f,i),void Composite.render(f,a.share());throw new Error("Invalid condition"+(C?": "+C:""))}n.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&Composite.include(i)}}if(!n.hasOwnProperty("condition")||n.condition.share!==a.ordinal()){if(n.hasOwnProperty("condition")&&Math.abs(n.condition.share||0)!==a.ordinal())return n.condition.share=-a.ordinal(),e=n.condition,t=Expression.eval(r+":"+Composite.ATTRIBUTE_CONDITION,e.expression),i.nodeValue=t instanceof Error?t:"",!0!==t?(e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.element=null,void(e.share=a.ordinal())):(e.element||(e.element=e.template.cloneNode(!0),o=e.element,s=Object.assign({},e.attributes),j[o.ordinal()]={serial:o.ordinal(),element:o,attributes:s,condition:e,context:[...P]},s.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&Composite.include(o),i.parentNode.insertBefore(o,i)),void Composite.render(e.element,a.share()));if(n.hasOwnProperty("condition")&&n.condition.share!==-a.ordinal()&&(n.condition.share=a.ordinal()),i.nodeType===Node.TEXT_NODE){if(void 0===n.render&&""===i.textContent)return;if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_TEXT))return;if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALUE))return void n.render();let e=i.textContent;if(e.match(Composite.PATTERN_EXPRESSION_CONTAINS)){if((e=e.replace(Composite.PATTERN_EXPRESSION_CONTAINS,e=>{var t,o,r;return e.substring(2,e.length-2).trim()?(o={serial:t=(o=document.createTextNode("")).ordinal(),element:o,attributes:{},value:null,context:[...P],render(){let e="";var t,o;this.attributes.hasOwnProperty(Composite.ATTRIBUTE_NAME)?(t=String(this.attributes[Composite.ATTRIBUTE_NAME]||"").trim(),o=String(this.attributes[Composite.ATTRIBUTE_VALUE]||"").trim(),window[t]=Expression.eval(this.serial+":"+Composite.ATTRIBUTE_VALUE,o)):(e=String(this.attributes[Composite.ATTRIBUTE_VALUE]||""),e=Expression.eval(this.serial+":"+Composite.ATTRIBUTE_VALUE,e)),this.value=e,this.element.textContent=void 0!==e?e:""}},(r=e.match(Composite.PATTERN_EXPRESSION_VARIABLE))?(o.attributes[Composite.ATTRIBUTE_NAME]=r[1],o.attributes[Composite.ATTRIBUTE_VALUE]="{{"+r[2]+"}}"):o.attributes[Composite.ATTRIBUTE_VALUE]=e,j[t]=o,"{{"+t+"}}"):""})).match(Composite.PATTERN_EXPRESSION_CONTAINS))return(l=e.split(/(\{\{\d+\}\})/)).forEach((e,t,o)=>{var r,n;e.match(/^\{\{\d+\}\}$/)?(n=parseInt(e.substring(2,e.length-2).trim()),n=j[n],Composite.fire(Composite.EVENT_RENDER_NEXT,n.element),n.render(),o[t]=n.element):(n={serial:r=(n=document.createTextNode(e)).ordinal(),element:n,attributes:{},context:[...P]},Composite.fire(Composite.EVENT_RENDER_NEXT,n.element),n.element.textContent=e,n.attributes[Composite.ATTRIBUTE_TEXT]=e,j[r]=n,o[t]=n.element)}),null===i.parentNode?void 0:(l.forEach(e=>i.parentNode.insertBefore(e,i)),void i.parentNode.removeChild(i));i.nodeValue=e}void(n.attributes[Composite.ATTRIBUTE_TEXT]=e)}else if(i instanceof Element){if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&(p=((c=x(i)).namespace||[]).concat(c.model).join("."),B.has(p)||(B.add(p),(p=Object.lookup(p))&&"function"==typeof p.dock&&(u=V(i),Composite.fire(Composite.EVENT_MODULE_DOCK,u),p.dock.call(p),Composite.fire(Composite.EVENT_MODULE_READY,u)))),n.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT)){i.innerHTML="";let t=n.attributes[Composite.ATTRIBUTE_IMPORT];if(t=(t||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)?Expression.eval(r+":"+Composite.ATTRIBUTE_IMPORT,String(t)):t)if(t instanceof Element||t instanceof NodeList)i.appendChild(t,!0),delete n.attributes[Composite.ATTRIBUTE_IMPORT];else if(String(t).match(Composite.PATTERN_DATASOURCE_URL)){let e=String(t).match(Composite.PATTERN_DATASOURCE_URL);e[2]=DataSource.fetch("xslt://"+(e[2]||e[1])),e[1]=DataSource.fetch("xml://"+e[1]),e=DataSource.transform(e[1],e[2]),i.appendChild(e,!0);var _=i.ordinal();delete j[_].attributes[Composite.ATTRIBUTE_IMPORT]}else void 0!==$[t]?(i.innerHTML=$[t],T=i.ordinal(),delete j[T].attributes[Composite.ATTRIBUTE_IMPORT]):Composite.asynchron((e,t,o)=>{try{var r=new XMLHttpRequest;if(r.overrideMimeType("text/plain"),r.open("GET",o,!1),r.send(),200!==r.status)throw new Error(`HTTP status ${r.status} for `+r.responseURL);var n=r.responseText.trim(),i=($[r.responseURL]=n,e.innerHTML=n,e.ordinal());delete j[i].attributes[Composite.ATTRIBUTE_IMPORT]}catch(e){throw Composite.fire(Composite.EVENT_HTTP_ERROR,e),e}finally{t.release()}},i,a.share(),t);else delete n.attributes[Composite.ATTRIBUTE_IMPORT]}if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)){i.innerHTML="";let t=n.attributes[Composite.ATTRIBUTE_OUTPUT];if((t||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(t=Expression.eval(r+":"+Composite.ATTRIBUTE_OUTPUT,String(t))),String(t).match(Composite.PATTERN_DATASOURCE_URL)){let e=String(t).match(Composite.PATTERN_DATASOURCE_URL);e[2]=DataSource.fetch("xslt://"+(e[2]||e[1])),e[1]=DataSource.fetch("xml://"+e[1]),e=DataSource.transform(e[1],e[2]),i.appendChild(e,!0)}else t instanceof Node?i.appendChild(t.cloneNode(!0),!0):t instanceof NodeList?Array.from(t).forEach((e,t)=>i.appendChild(e.cloneNode(!0),0===t)):i.innerHTML=String(t)}let e=String(n.attributes[Composite.ATTRIBUTE_INTERVAL]||"").trim();if(e&&!n.interval){var R=r+":"+Composite.ATTRIBUTE_INTERVAL;if(!(e=String(Expression.eval(R,e))).match(/^\d*$/))throw new Error("Invalid interval: "+e);e=Number.parseInt(e),n.interval=window.setInterval(()=>{document.body.contains(i)?Composite.render(i):(window.clearInterval(n.interval),delete n.interval)},e)}if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_ITERATE)){if(!n.iterate){var N=String(n.attributes[Composite.ATTRIBUTE_ITERATE]||"").trim(),w=N.match(Composite.PATTERN_EXPRESSION_VARIABLE);if(!w)throw new Error("Invalid iterate"+(N?": "+N:""));n.iterate={name:w[1].trim(),expression:"{{"+w[2].trim()+"}}"},n.template=i.cloneNode(!0),i.innerHTML=""}var y=r+":"+Composite.ATTRIBUTE_ITERATE;let e=Expression.eval(y,n.iterate.expression);if(e instanceof Error)throw e;if(e){if(e instanceof XPathResult){for(var I={entry:null,array:[],iterate:e};I.entry=I.iterate.iterateNext();)I.array.push(I.entry);e=I.array}else e=Array.from(e);i.innerHTML="",e.forEach((e,t,o)=>{var r={};Object.defineProperty(r,"item",{enumerable:!0,value:e}),Object.defineProperty(r,"index",{enumerable:!0,value:t}),Object.defineProperty(r,"data",{enumerable:!0,value:o}),O.push({[n.iterate.name]:r}),Array.from(n.template.cloneNode(!0).childNodes).forEach(e=>{i.appendChild(e),Composite.render(e,a.share())}),O.pop()})}}if(!i.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)){var v=[];for(const S in n.attributes)n.attributes.hasOwnProperty(S)&&v.push(S);Composite.ATTRIBUTE_VALUE in i&&n.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALUE)&&!v.includes(Composite.ATTRIBUTE_VALUE)&&v.push(Composite.ATTRIBUTE_VALUE),v.forEach(t=>{if(!t.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||t.match(Composite.PATTERN_ATTRIBUTE_STATIC)){let e=String(n.attributes[t]||"");var o;e.match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(o=r+":"+t,void 0!==(e=Expression.eval(o,e))?(e=(e=String(e).encodeHtml()).replace(/"/g,"""),t.toLowerCase()===Composite.ATTRIBUTE_VALUE&&Composite.ATTRIBUTE_VALUE in i&&(i.value=e),t.startsWith("@")&&(i.removeAttribute(t),t=t.replace(/^@+/,"")),i.setAttribute(t,e)):i.removeAttribute(t),i[t]=e)}})}if(i.nodeName.match(Composite.PATTERN_SCRIPT))if((i.getAttribute(Composite.ATTRIBUTE_TYPE)||"").trim().match(Composite.PATTERN_COMPOSITE_SCRIPT))try{Scripting.eval(i.textContent)}catch(e){throw new Error("Composite JavaScript",e)}!i.childNodes||i.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)||n.attributes.hasOwnProperty(Composite.ATTRIBUTE_ITERATE)||Array.from(i.childNodes).forEach(e=>{i.contains(e)&&Composite.render(e,a.share())}),i.hasAttribute(Composite.ATTRIBUTE_RELEASE)&&i.removeAttribute(Composite.ATTRIBUTE_RELEASE)}}}}}catch(e){console.error(e),Composite.fire(Composite.EVENT_ERROR,e),r instanceof Element&&(r.innerText="Error: "+(e.message.match(/(\{\{|\}\})/)?"Invalid expression":e.message))}finally{P.length=0,Composite.render.queue=Composite.render.queue.filter(e=>e!==r),a.release()}}},load(t,e){if(!(t=(t||"").trim()).match(/\.(js|css|html)(\?.*)?$/i))throw new Error("Resource not supported"+(t?": "+t:""));if(o=t,(r=document.createElement("a")).href=o,!(t=r.pathname.replace(/\/{2,}/g,"/")).startsWith(Composite.MODULES+"/"))throw new Error("Resource not supported: "+t);if(!(t in $&&t.match(/\.(js|css)(\?.*)?$/i)||t in $&&void 0===$[t])){if(!(t in $)){$[t]=void 0;var o=new XMLHttpRequest;if(o.overrideMimeType("text/plain"),o.open("GET",t,!1),o.send(),404===o.status&&!e)return;if(200!==o.status)throw new Error(`HTTP status ${o.status} for `+o.responseURL);$[t]=o.responseText.trim()}var r=$[t];if(t.match(/\.js(\?.*)?$/i))try{Scripting.eval(r)}catch(e){throw console.error(t,e.name+": "+e.message),e}else if(t.match(/\.css(\?.*)?$/i)){e=document.querySelector("html head");if(!e)throw new Error("No head element found");o=document.createElement("style");o.setAttribute("type","text/css"),o.textContent=r,e.appendChild(o)}else if(t.match(/\.html(\?.*)?$/i))return r}},include(...e){if(e.length<=0||1===e.length&&!(e[0]instanceof Element)&&"string"!=typeof e[0])throw new TypeError("Invalid composite for include");let t=e=1===e.length&&e[0]instanceof Element?e[0]:e,o=null;if(e instanceof Element){if(!e.hasAttribute(Composite.ATTRIBUTE_ID))throw new Error("Unknown composite without id");if(!(o=j[e.ordinal()]))throw new Error("Unknown composite");var r=x(e);r.namespace||(r.namespace=[]),r.namespace.push(r.model),t=r.namespace}var r=Composite.MODULES+"/"+t.join("/"),n=Object.lookup(t.join("."));t=t.join("/"),void 0===$[r+".composite"]&&Composite.fire(Composite.EVENT_MODULE_LOAD,e,t),$[r+".composite"]=null,(void 0===n||n instanceof Element||n instanceof HTMLCollection||"common"===t)&&this.load(r+".js"),"common"===t&&this.load(r+".css"),e instanceof Element&&!e.innerHTML.trim()&&this.load(r+".css"),e instanceof Element&&!e.innerHTML.trim()&&!o.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT)&&!o.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)&&void 0!==(n=this.load(r+".html"))&&(i(e),e instanceof Element)&&(e.innerHTML=n)}}),Object.defineProperty(Composite.render,"context",{get:()=>{const o=Array.from(e);return P.forEach(t=>{Object.keys(t).forEach(e=>{o[e]=t[e]})}),o},configurable:!1,enumerable:!0}),new Set),L=new Map,D=new Map,M=new Set,r=new Map,B=new Set,i=e=>{for(var t=(e instanceof Element&&e.id||"").trim(),o=t.toLowerCase();o&&e instanceof Element;)if((e=e.parentNode)instanceof Element&&e.hasAttribute(Composite.ATTRIBUTE_COMPOSITE)&&e.hasAttribute(Composite.ATTRIBUTE_ID)&&(e.id||"").toLowerCase().trim()===o)throw new Error("Recursion detected for composite: "+t)},x=e=>{if(!(e instanceof Element))return null;let t=(e.getAttribute(Composite.ATTRIBUTE_ID)||"").trim();if(e.hasAttribute(Composite.ATTRIBUTE_COMPOSITE)){var o=t.match(Composite.PATTERN_COMPOSITE_ID);if(o)return o[2]?{namespace:o[2].split(/:+/),model:o[1]}:{model:o[1]};throw new Error("Invalid composite id"+(t?": "+t:""))}o=x(e.parentNode);if(!e.hasAttribute(Composite.ATTRIBUTE_ID))return o;if(t.match(Composite.PATTERN_ELEMENT_ID))return e={namespace:[],model:null,route:[],target:null},o&&(o.namespace?o.namespace.push(o.model):o.namespace=[o.model],e.namespace=o.namespace,o.route?e.route.push(...o.route):e.route.push(o.model)),(t=t.match(Composite.PATTERN_ELEMENT_ID))[4]&&(e.namespace=t[4].split(/:/),e.route=[e.namespace[e.namespace.length-1]]),e.route.push(t[1]),t[2]&&e.route.push(...t[2].split(/:/)),t[3]&&(e.unique=t[3]),e.target=e.route[e.route.length-1],e.model=e.namespace.pop(),e.namespace.length<=0&&delete e.namespace,e.model?e:null;throw new Error("Invalid element id"+(t?": "+t:""))},V=e=>{var t,o,e=x(e);return e&&(t=Namespace.lookup(...e.namespace||[]),o=Object.lookup(t||window,e.model))?void 0===e.target?{meta:e,namespace:t,model:o}:(e={meta:e,namespace:t,model:o,get target(){return Object.lookup(this.namespace,...this.meta.route||[])},set target(e){let t=[this.meta.model];var o=(t=this.meta.route?this.meta.route:t).pop();Object.lookup(this.namespace,...t)[o]=e}}).model&&void 0!==e.target?e:null:null},$={},j=[];Object.defineProperty(Composite.render,"meta",{value:j});let t=0;compliant("Object.prototype.serial"),compliant("Object.prototype.ordinal",function(){return void 0===this.serial&&Object.defineProperty(this,"serial",{value:++t}),this.serial}),compliant("Object.use",(...e)=>Namespace.use.apply(null,e)),compliant("Object.lookup",(...e)=>Namespace.lookup.apply(null,e)),compliant("Object.exists",(...e)=>Namespace.exists.apply(null,e)),compliant("Object.usable",e=>null!=e);const o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(...e){var t=(e=null)=>{if(e){if("loadstart"===e.type)e=[Composite.EVENT_HTTP_START,e];else if("progress"===e.type)e=[Composite.EVENT_HTTP_PROGRESS,e];else if("readystatechange"===e.type)e=[Composite.EVENT_HTTP_RECEIVE,e];else if("load"===e.type)e=[Composite.EVENT_HTTP_LOAD,e];else if("abort"===e.type)e=[Composite.EVENT_HTTP_ABORT,e];else if("error"===e.type)e=[Composite.EVENT_HTTP_ERROR,e];else if("timeout"===e.type)e=[Composite.EVENT_HTTP_TIMEOUT,e];else{if("loadend"!==e.type)return;e=[Composite.EVENT_HTTP_END,e]}Composite.fire(...e)}};this.status===XMLHttpRequest.UNSENT&&(this.addEventListener("loadstart",t),this.addEventListener("progress",t),this.addEventListener("readystatechange",t),this.addEventListener("load",t),this.addEventListener("abort",t),this.addEventListener("error",t),this.addEventListener("timeout",t),this.addEventListener("loadend",t)),o.call(this,...e)},window.addEventListener("error",e=>Composite.fire(Composite.EVENT_ERROR,e)),window.addEventListener("load",()=>{var e;document.querySelector("html")&&(document.querySelector("html head")||document.querySelector("html").appendChild(document.createElement("head")),(e=document.createElement("style")).setAttribute("type","text/css"),e.innerHTML="*[release] {display:none!important;}",document.querySelector("html head").appendChild(e)),Composite.include("common");const r=e=>{e.childNodes&&Array.from(e.childNodes).forEach(e=>r(e));var t,o=e.ordinal(),o=j[o];o&&o.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&(o=V(e))&&o.meta&&o.meta.model&&o.model&&(t=(o.meta.namespace||[]).concat(o.meta.model).join("."),B.has(t))&&(B.delete(t),"function"==typeof o.model.undock)&&(o.model.undock.call(o.model),Composite.fire(Composite.EVENT_MODULE_UNDOCK,o)),delete j[e.ordinal()]};new MutationObserver(e=>{e.forEach(e=>{var t,o;"attributes"===e.type&&(t=e.attributeName).match(/^(autofocus|disabled|hidden|multiple|readonly|required)$/i)&&("false"===(o=String(e.target.getAttribute(t)))&&e.target.removeAttribute(t),"true"===o)&&e.target.setAttribute(t,t),j.length&&(o=e.target.ordinal(),t=j[o],"characterData"===e.type&&e.target.nodeType===Node.TEXT_NODE?t&&t.hasOwnProperty(Composite.ATTRIBUTE_VALUE)&&(o=void 0===t.value?"":String(t.value))!==e.target.textContent&&(e.target.textContent=o):(t&&"attributes"===e.type&&((o=(e.attributeName||"").toLowerCase().trim()).match(Composite.PATTERN_ATTRIBUTE_ACCEPT)&&!o.match(Composite.PATTERN_ATTRIBUTE_STATIC)?e.target.hasAttribute(o)&&e.target.removeAttribute(o):o.match(Composite.PATTERN_ATTRIBUTE_STATIC)?t.attributes.hasOwnProperty(o)?e.target.hasAttribute(o)&&t.attributes[o]===e.target.getAttribute(o)||e.target.setAttribute(o,t.attributes[o]):e.target.hasAttribute(o)&&e.target.removeAttribute(o):U.has(o)&&(t.statics=t.statics||{},t.statics.hasOwnProperty(o)?e.target.hasAttribute(o)&&t.statics[o]===e.target.getAttribute(o)||e.target.setAttribute(o,t.statics[o]):e.target.hasAttribute(o)&&e.target.removeAttribute(o))),(e.addedNodes||[]).forEach(e=>{(e instanceof Element||e instanceof Node&&e.nodeType===Node.TEXT_NODE)&&!j[e.ordinal()]&&document.body.contains(e)&&Composite.render(e)}),(e.removedNodes||[]).forEach(e=>r(e))))})}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,characterData:!0}),Composite.render(document.body)})})(),(()=>{"use strict";compliant("messages",{}),compliant("Messages",{});const n=[DataSource.data],t=DataSource.localize,i=e=>{var t=new Map,o="/locales/"+DataSource.locale+"/label",r=e.evaluate(o,e,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(let e=r.iterateNext();e;e=r.iterateNext()){var n,i=(e.getAttribute("key")||"").trim();t.has(i)||(n=((e.getAttribute("value")||"").trim()||(e.textContent||"").trim()).unescape(),t.set(i,n))}new Map([...t.entries()].sort()).forEach((e,t)=>{var o,r=t.match(/^(?:((?:\w+\.)*\w+)\.)*(\w+)$/);r&&(o="messages"+(r[1]?"."+r[1]:""),Namespace.exists(o,r[2])||Object.defineProperty(Namespace.use(o),r[2],{value:{toString(){return e}}}),Namespace.exists("Messages",t)||Object.defineProperty(Namespace.use("Messages"),t,{value:e}))})};DataSource.localize=e=>{t(e),delete window.messages,delete window.Messages,window.Messages={customize(e,...t){let o=Messages[e]||"";for(let e=0;e<t.length;e++)o=o.replace(new RegExp("\\{"+e+"\\}","g"),t[e]);return o.replace(/\{\d+\}/g,"")}},n.forEach(e=>i(e))},DataSource.data&&DataSource.locale&&DataSource.locales&&DataSource.locales.includes(DataSource.locale)&&DataSource.localize(DataSource.locale),Composite.listen(Composite.EVENT_MODULE_LOAD,(e,t,o)=>{var r=new XMLHttpRequest;r.open("GET",Composite.MODULES+"/"+o+".xml",!1),r.send(),200===r.status&&(o=(new DOMParser).parseFromString(r.responseText,"application/xml"),n.push(o),i(o))})})(),(()=>{"use strict";compliant("Reactive",e=>{if(null==e||"object"!=typeof e)throw new TypeError("Invalid object type");return l(e)});let i=null,o=(Composite.listen(Composite.EVENT_RENDER_START,(e,t)=>i=t),Composite.listen(Composite.EVENT_RENDER_NEXT,(e,t)=>i=t),Composite.listen(Composite.EVENT_RENDER_END,(e,t)=>i=null),null);Composite.listen(Composite.EVENT_MODULE_DOCK,(e,t)=>{o=i,i=null}),Composite.listen(Composite.EVENT_MODULE_READY,(e,t)=>{i=o,o=null}),compliant("Object.prototype.reactive",function(){return l(this)});const a=Math.serial(),s=new WeakMap,l=e=>{if("object"!=typeof e||null===e)return e;if(void 0!==e[a])return e;if(s.has(e))return s.get(e);const n=new Proxy(e,{notifications:new Map,cache:new Map,get(t,o){try{if(o===a)return t;let e;var r;return"object"!=typeof(e=i&&(r=Object.getOwnPropertyDescriptor(t,o))&&"function"==typeof r.get?r.get.call(n):t[o])||null===e||e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection?e:void 0!==e[a]?e:s.has(e)?s.get(e):l(e)}finally{Composite.asynchron((e,t,o,r)=>{if(null!==e&&t.hasOwnProperty(o)){var n=r.get(o)||new Map;if(!n.has(e.ordinal())){for(const i of n.values()){if(void 0!==i.contains&&i.contains(e))return;void 0!==e.contains&&e.contains(i)&&n.delete(i.ordinal())}n.set(e.ordinal(),e),r.set(o,n)}}},i,t,o,this.notifications)}},set(e,t,o){if(t===a)return!0;"object"==typeof o&&null!==o&&void 0!==o[a]&&(o=o[a]);try{e[t]=o}finally{return this.cache.get(t)!==o&&(this.cache.set(t,o),Composite.asynchron((e,t,o,r)=>{if(t.hasOwnProperty(o)){var n=this.notifications.get(o)||new Map;for(const i of n.values())document.body.co