@seanox/aspect-js
Version:
full stack JavaScript framework for SPAs incl. reactivity rendering, mvc / mvvm, models, expression language, datasource, virtual paths, unit test and some more
1 lines • 55 kB
JavaScript
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 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 n=e.length,i=null;return 0<e.length&&"object"==typeof e[0]&&(i=e.shift()),n-=e.length,(e=e.join(".")).split(Namespace.PATTERN_NAMESPACE_SEPARATOR).forEach((e,t,o)=>{var r=0===t&&null===i?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===i){if(void 0!==(i=_populate(i,e))&&!(i instanceof Element))return;i=window}var r=_populate(i,e),a=typeof r;if("undefined"!=a&&"object"!=a)throw new TypeError(`Invalid namespace type at level ${t+1+n}: `+a);(null==r||r instanceof Element)&&(t<o.length-1&&o[t+1].match(/^\d+$/)?i[e]=[]:i[e]={}),i=_populate(i,e)}),i},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 a=t[e],n=e+o===0?Namespace.PATTERN_NAMESPACE_LEVEL_START:Namespace.PATTERN_NAMESPACE_LEVEL;if(!a.match(n))throw new Error("Invalid namespace at level "+(e+1+o)+(a&&a.trim()?": "+a.trim():""));if(0===e&&null===r){if(void 0!==(r=_populate(r,a)))continue;r=window}if(void 0===(r=_populate(r,a))||null===r)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}}})(),(()=>{const o=Element.prototype.appendChild;Element.prototype.appendChild=function(t,e){if(e&&(this.innerHTML=""),t instanceof Node)o.call(this,t);else if(Array.isArray(t)||t instanceof NodeList||Symbol&&Symbol.iterator&&t&&(t[Symbol.iterator],1)){t=Array.from(t);for(let e=0;e<t.length;e++)o.call(this,t[e])}else o.call(this,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",()=>e.toString());const o=-9466848e5,e={timing:(new Date).getTime()+o,number:0,toString(){var e=(new Date).getTime()+o,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(){if(void 0===this.hash||0===this.hash){let t=this.hash=0;for(let e=0;e<this.length;e++){var o=31*this.hash+this.charCodeAt(e);Number.isSafeInteger(o)?this.hash=o:(t++,this.hash=Number.MAX_SAFE_INTEGER-this.hash+this.charCodeAt(e))}this.hash=Math.abs(this.hash).toString(36),this.hash=this.hash.length.toString(36)+this.hash,this.hash=(this.hash+t.toString(36)).toUpperCase()}return this.hash}),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.pathcontext"),Object.defineProperty(window.location,"pathcontext",{value:window.location.pathname.replace(/\/([^\/]*\.[^\/]*){0,}$/g,"")||"/"}),compliant("window.location.combine",(...e)=>"/"+e.join("/").replace(/[\/\\]+/g,"/").replace(/(^\/+)|(\/+$)/g,"")),(()=>{const s=window.location.combine(window.location.pathcontext,"/data"),c=/^(?:([a-z]+):\/+)(\/((\w+)|(\w+(\-+\w+)+)))+$/,p=/^\s*text\s*\/\s*javascript\s*$/i,n=/(^\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,a,n=new XSLTProcessor;if(n.importStylesheet(t),o&&"object"==typeof o)for([r,a]of"function"!=typeof o[Symbol.iterator]?Object.entries(o):o)"function"!=typeof o[r]&&n.setParameter(null,r,a);let i=e.evaluate("string(/*/@escape)",e,null,XPathResult.ANY_TYPE,null).stringValue;i=!!i.match(/^yes|on|true|1$/i);t=n.transformToDocument(e.clone());let s=t.querySelectorAll(i?"*":"*[escape]");s.forEach(e=>{var t;(i||(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],a=e.match(c)[2];if(1===arguments.length){let e=s+"/"+DataSource.locale+"/"+a+"."+r;a=(e=e.replace(/\/+/g,"/")).hashCode();if(l.hasOwnProperty(a))return l[a];var n=new XMLHttpRequest;if(n.overrideMimeType("application/xslt+xml"),n.open("GET",e,!1),n.send(),200!==n.status)throw new Error(`HTTP status ${n.status} for `+n.responseURL);return e=n.responseXML,(l[a]=e).clone()}if(!r.match(/^xml$/)&&t)throw new Error("Transformation is not supported for this locator");n=DataSource.fetch(e);if(!t)return n.clone();let i=e.replace(/(^((\w+\-+(?=\w))+)\w*)|(^\w+)/,"xslt");if("boolean"==typeof t||"string"==typeof(i=t)&&i.match(c))return DataSource.transform(n,DataSource.fetch(i),o);throw new Error("Invalid style: "+String(i))},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(n))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 a=document.implementation.createDocument(null,o,null);return t.forEach(e=>{if("string"!=typeof e)throw new TypeError("Invalid collection entry");a.documentElement.appendChild(DataSource.fetch(e).documentElement.cloneNode(!0))}),(l[r]=a).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(o=o.concat(navigator.language),void 0!==navigator.languages&&(o=o.concat(navigator.languages)),Array.from(o).forEach(e=>{(e=e.match(/^[a-z]+/i,""))&&!o.includes(e[0])&&o.push(e[0])}),(o=(o=o.map(e=>e.trim().toLowerCase())).filter((e,t)=>o.indexOf(e)===t)).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 a=e.nodeName.toLowerCase();DataSource.locales.includes(a)||DataSource.locales.push(a)}for(let e=(t=r.evaluate("/locales/*",r,null,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null)).iterateNext();e;e=t.iterateNext()){var i=e.nodeName.toLowerCase();DataSource.locales.includes(i)||DataSource.locales.push(i)}if(DataSource.locales.length<=0)throw new Error("Locale not available");o.push(DataSource.locales[0]),o=o.filter(function(e){return DataSource.locales.includes(e)}),DataSource.locales.selection=(o.length?o:DataSource.locales)[0]}})(),(()=>{compliant("messages",{}),compliant("Messages",{});const r=DataSource.localize;DataSource.localize=e=>{r(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,"")}};var t=new Map,e="/locales/"+DataSource.locale+"/label",o=DataSource.data.evaluate(e,DataSource.data,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(let e=o.iterateNext();e;e=o.iterateNext())t.set((e.getAttribute("key")||"").trim(),((e.getAttribute("value")||"").trim()||(e.textContent||"").trim()).unescape());new Map([...t.entries()].sort()).forEach((e,t)=>{var o,r=t.match(/^(?:((?:\w+\.)*\w+)\.)*(\w+)$/);r&&(o="messages"+(r[1]?"."+r[1]:""),Object.defineProperty(Namespace.use(o),r[2],{value:{toString(){return e}}}),Object.defineProperty(Namespace.use("Messages"),t,{value:e}))})},DataSource.data&&DataSource.locale&&DataSource.locales&&DataSource.locales.includes(DataSource.locale)&&DataSource.localize(DataSource.locale)})(),(()=>{compliant("Scripting",{eval(a){let n,o;for(let r=0;r<a.length;r++){let e=a.charAt(r);if(!(r>=a.length)||n){if(o<0){if("?"===e){o=1;var t="_tolerate(()=>";a=a.substring(0,r)+t+a.substring(r+1),r+=t.length;continue}e.match(/\s/)||(o=0)}if("\\"===e)r++;else if(n)(n===a.substring(r,r+n.length)||"\n"===n&&"\r"===e)&&(n=null);else switch(e){case"/":"/"===(e=a.charAt(r+1))&&(n="\n"),"*"===e&&(n="*/");continue;case"(":0<o?o++:o=-1;continue;case")":if(o<=0)continue;if(0<--o)continue;a=a.substring(0,r)+")"+a.substring(r),r+=")".length;continue;case"'":case'"':case"`":n=e;continue;case"#":let t=a.substring(r-1,r+10);var i=t.match(/(^|\W)(#(?:import|export|module|use))\s/);if(i){let o=i[2];for(let e=r+o.length;e<=a.length;e++)if((t=a.charAt(e)).match(/[;\r\n]/)||!(e<a.length)){let t=a.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=[],n=/^([_a-z]\w*)(?:@((?:[_a-z]\w*)(?:\.[_a-z]\w*)*))?$/i;t.split(/\s+/).forEach(e=>{e=e.match(n);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(",")+"])"}a=a.substring(0,r-1)+(i[1]||"")+o+a.substring(e),r+=o.length;break}}continue;default:continue}}}return this.run(a)},run(script){if(script.trim())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}}})(),(()=>{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)?a.get(o):null;r=r||c(n,t),o&&a.set(o,r);try{return Scripting.run(r)}catch(e){return console.error(e.message+"\n\t"+r),e.message+" in "+r}}});const a=new Map,n=0,i=["and","&&","or","||","not","!","eq","==","eeq","===","ne","!=","nee","!==","lt","<","gt",">","le","<=","ge",">=","empty","!","div","/","mod","%"],s=new RegExp("(^|[^\\w\\.])("+i.filter((e,t)=>t%2==0).join("|")+")(?=[^\\w\\.]|$)","ig"),l=(e,o)=>e.replace(/[\t\r](\d+)\n/g,(e,t)=>o[t]),c=(t,o,r=[])=>{switch(t){case n:let e=o=o.replace(/[\r\n]/g," ").trim();if((e=(e=e.replace(/\{\{(.*?)\}\}/g,(e,t)=>c(3,t,r))).replace(/((?:[^\n]+$)|(?:[^\n]+(?=\r)))/g,(e,t)=>c(2,t,r))).match(/^(\r(\d+)\n)*$/))return e=(e=(e=(e=(e=(e=(e=e.replace(/(?:\r(\d+)\n)/g,(e,t)=>"\r"+r[t]+"\n")).replaceAll("\r\\u0022\n",'\\"')).replaceAll("\r\\u0027\n","\\'")).replaceAll("\r\\u0060\n","\\`")).replace(/(\n\r)+/g," + ")).replace(/(^\r)|(\n$)/g,"")).replace(/[\r\n]+/g," ");throw Error("Error in the expression structure\n\t"+o);case 2:o='"'+o+'"';case 1:return r.push(o),"\r"+(r.length-1)+"\n";case 3:if(!(o=o.trim()))return"";if((o=(o=(o=(o=(o=(o=(o=(o=(o=o.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(/((['\"\`]).*?\2)/gs,(e,t)=>c(1,t,r))).replace(/\t+/g," ")).replace(s,(e,t,o)=>t+i[i.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)=>(r.push(l('document.getElementById("'+t+'")',r)),"\r"+(r.length-1)+"\n"))).replace(/#([_a-z]\w*)/gi,(e,t)=>(r.push(l('document.getElementById("'+t+'")',r)),"\r"+(r.length-1)+"\n"))).match(/\(\s*\?/))for(let e=-1;e<r.length;)e=r.length,o=o.replace(/(\([^\(\)]*\))/g,e=>(e=e.replace(/^\( *\?+ *(.*?) *\)$/s,(e,t)=>"_tolerate(()=>("+t+"))"),r.push(l(e,r)),"\t"+(r.length-1)+"\n"));return o=o.replace(/ {2,}/g," "),r.push(l(o,r)),"\r"+(r.length-1)+"\n";default:throw new Error("Unexpected script type")}}})(),(()=>{compliant("Composite",{get MODULES(){return window.location.combine(window.location.pathcontext,"/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_NAMESPACE(){return"namespace"},get ATTRIBUTE_NOTIFICATION(){return"notification"},get ATTRIBUTE_NAME(){return"name"},get ATTRIBUTE_OUTPUT(){return"output"},get ATTRIBUTE_RENDER(){return"render"},get ATTRIBUTE_RELEASE(){return"release"},get ATTRIBUTE_STRICT(){return"strict"},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|namespace|notification|output|release|render|strict|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*$/i},get PATTERN_ELEMENT_ID(){return/^([_a-z]\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_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=O[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)},validate(r,a){if((arguments.length<2||!1!==a)&&(a=!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,a),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(),n=O[o];let t=!0;"function"==typeof r.setCustomValidity&&r.setCustomValidity(""),"function"==typeof r.checkValidity&&(t=r.checkValidity());var i,s=c(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])),n.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALIDATE)&&!0===t&&!0!==a&&"function"==typeof s.model[Composite.ATTRIBUTE_VALIDATE]&&(i=s.model[Composite.ATTRIBUTE_VALIDATE],t=void 0!==e?i.call(s.model,r,e):i.call(s.model,r))}if(!0!==t){let e;"string"!=typeof(e="string"==typeof t&&t.trim()?t.trim():e)&&((e=n.attributes.hasOwnProperty(Composite.ATTRIBUTE_MESSAGE)?String(n.attributes[Composite.ATTRIBUTE_MESSAGE]||""):e)||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e=String(Expression.eval(o+":"+Composite.ATTRIBUTE_MESSAGE,e))),"function"==typeof r.setCustomValidity&&Object.usable(e)&&(r.setCustomValidity(e),n.attributes.hasOwnProperty(Composite.ATTRIBUTE_NOTIFICATION))&&"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=O[e];if(r instanceof Object){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 a=c(t);if(a instanceof Object){let t=a.model;for(var n in t=void 0!==a.target?"object"==typeof a.target?a.target:null:t)"function"==typeof t[n]&&n.match(Composite.PATTERN_EVENT_FUNCTIONS)&&(n=n.substring(2).toLowerCase(),o.includes(n)||o.push(n));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)}Composite.mount.stack.push(t),o.forEach(e=>{t.addEventListener(e.toLowerCase(),r=>{var a=r.currentTarget,t=a.ordinal(),n=O[t],i=r.type.toLowerCase();if(Composite.PATTERN_EVENT_FILTER.includes(i)){i=Composite.PATTERN_EVENT_FILTER.indexOf(i),i=Composite.PATTERN_EVENT_NAMES[i];let o;var s=Composite.validate(a,!1),l=c(a);if(l instanceof Object){let t;if(a instanceof Element&&(a.tagName.match(/^input$/i)&&a.type.match(/^radio|checkbox/i)?t=a.checked:a.tagName.match(/^select/i)&&"selectedIndex"in a?t=a.options[a.selectedIndex].value:Composite.ATTRIBUTE_VALUE in a&&(t=a[Composite.ATTRIBUTE_VALUE])),!n.attributes.hasOwnProperty(Composite.ATTRIBUTE_STRICT)||!0===s){a=e=>{var t=typeof e;return void 0!==e&&("object"==t&&null===e||"boolean"==t||"number"==t||"string"==t)};a(l.target)?l.target=t:"object"==typeof l.target?a(l.target.value)&&(l.target.value=t):void 0===l.target&&a(l.model.value)&&(l.model.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"+i]&&(o=e["on"+i].call(e,r))}}let e=n.attributes.hasOwnProperty(Composite.ATTRIBUTE_EVENTS)?n.attributes[Composite.ATTRIBUTE_EVENTS]:"";if((e=(e=String(e||"")).toLowerCase().split(/\s+/)).includes(i.toLowerCase())){let e=n.attributes.hasOwnProperty(Composite.ATTRIBUTE_RENDER)?n.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}})})}}}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(),y.has(e)||e.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||(y.add(e),r.push(e))});const a=t=>{if(t instanceof Element){var e=t.ordinal();const o=O[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=>a(e)))}};void a(document.body)}else if("function"==typeof t&&1===e.length)S.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?I.delete(t.toLowerCase()):I.set(t.toLowerCase(),e):(o=t.toLowerCase().hashCode(),null===e?v.delete(o):v.set(o,{selector:t,callback:e}))}},render(n,i){if(Composite.render.queue=Composite.render.queue||[],n||!(Composite.render.queue.length<=0))if(Composite.render.lock&&Composite.render.lock!==i)Composite.render.queue.includes(n)||Composite.render.queue.push(n),Composite.asynchron(Composite.render);else{n=n||Composite.render.queue[0],i=Composite.lock(Composite.render,n);const a=n;try{if("string"==typeof n)return(n=n.trim())?void document.querySelectorAll(n).forEach(e=>Composite.render(e,i.share())):void 0;if(n instanceof Node){var e,t,o,s,l,r=I.get(n.nodeName.toLowerCase());if(!r||!1!==r(n)){if(n.parentNode)for(var[c,p]of v){var m=n.parentNode.querySelectorAll(p.selector);if(Array.from(m).includes(n)&&!1===p.callback(n))return}let r=n.ordinal(),a=O[r];if(!a&&(S.forEach(e=>e.call(null,n)),a={serial:r,element:n,attributes:{}},O[r]=a,n instanceof Element)&&n.attributes){if(Array.from(n.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)||y.has(e.name))&&(!e.name.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||y.has(e.name)||e.name===Composite.ATTRIBUTE_RELEASE||n.removeAttribute(e.name),a.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||y.has(e.name))&&(e.value=Expression.eval(n.ordinal()+":"+e.name,e.value)),!e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)&&e.name!==Composite.ATTRIBUTE_ID&&e.name!==Composite.ATTRIBUTE_EVENTS||(a.attributes[e.name]=e.value),a.statics=a.statics||{},y.has(e.name)&&(a.statics[e.name]=e.value),e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||e.name===Composite.ATTRIBUTE_ID||e.name===Composite.ATTRIBUTE_EVENTS||y.has(e.name))&&n.setAttribute(e.name,e.value)}),a.attributes.hasOwnProperty(Composite.ATTRIBUTE_CONDITION)){var T,u,E,h=(a.attributes[Composite.ATTRIBUTE_CONDITION]||"").trim();if(h.match(Composite.PATTERN_EXPRESSION_CONDITION))return T=document.createTextNode(""),u=n.cloneNode(!0),E=a.attributes,a={serial:T.ordinal(),element:T,attributes:E,condition:{expression:h,template:u,marker:T,element:null,attributes:E,complete:!1,share:null}},O[a.serial]=a,delete O[r],n.parentNode.replaceChild(T,n),void Composite.render(T,i.share());throw new Error("Invalid condition"+(h?": "+h:""))}a.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&Composite.include(n)}if(!a.hasOwnProperty("condition")||a.condition.share!==i.ordinal()){if(a.hasOwnProperty("condition")&&Math.abs(a.condition.share||0)!==i.ordinal())return a.condition.share=-i.ordinal(),e=a.condition,!0!==Expression.eval(r+":"+Composite.ATTRIBUTE_CONDITION,e.expression)?(e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.element=null,void(e.share=i.ordinal())):(e.element||(e.element=e.template.cloneNode(!0),t=e.element,o=Object.assign({},e.attributes),O[t.ordinal()]={serial:t.ordinal(),element:t,attributes:o,condition:e},o.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&Composite.include(t),n.parentNode.insertBefore(t,n)),void Composite.render(e.element,i.share()));if(a.hasOwnProperty("condition")&&a.condition.share!==-i.ordinal()&&(a.condition.share=i.ordinal()),n.nodeType===Node.TEXT_NODE){if(n.parentNode&&n.parentNode.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE))return;if(a.attributes.hasOwnProperty(Composite.ATTRIBUTE_TEXT))return;if(a.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALUE))return void a.render();let e=n.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,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,O[t]=o,"{{"+t+"}}"):""})).match(Composite.PATTERN_EXPRESSION_CONTAINS))return(s=e.split(/(\{\{\d+\}\})/)).forEach((e,t,o)=>{var r,a;e.match(/^\{\{\d+\}\}$/)?(a=parseInt(e.substring(2,e.length-2).trim()),a=O[a],Composite.fire(Composite.EVENT_RENDER_NEXT,a.element),a.render(),o[t]=a.element):(a={serial:r=(a=document.createTextNode(e)).ordinal(),element:a,attributes:{}},Composite.fire(Composite.EVENT_RENDER_NEXT,a.element),a.element.textContent=e,a.attributes[Composite.ATTRIBUTE_TEXT]=e,O[r]=a,o[t]=a.element)}),null===n.parentNode?void 0:(s.forEach(e=>n.parentNode.insertBefore(e,n)),void n.parentNode.removeChild(n));n.nodeValue=e}void(a.attributes[Composite.ATTRIBUTE_TEXT]=e)}else{if(n instanceof Element&&a.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)){let e=String(a.attributes[Composite.ATTRIBUTE_ID]||"").trim();if(!e.match(Composite.PATTERN_COMPOSITE_ID))throw new Error("Invalid composite id"+(e?": "+e:""));b.has(e)||(b.add(e),(e=Object.lookup(e))&&"function"==typeof e.dock&&e.dock.call(e))}if(n instanceof Element){if(a.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT)){n.innerHTML="";let t=a.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)n.appendChild(t,!0),delete a.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]),n.appendChild(e,!0);var d=n.ordinal();delete O[d].attributes[Composite.ATTRIBUTE_IMPORT]}else void 0!==P[t]?(n.innerHTML=P[t],l=n.ordinal(),delete O[l].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 a=r.responseText.trim(),n=(P[r.responseURL]=a,e.innerHTML=a,e.ordinal());delete O[n].attributes[Composite.ATTRIBUTE_IMPORT]}catch(e){throw Composite.fire(Composite.EVENT_HTTP_ERROR,e),e}finally{t.release()}},n,i.share(),t);else delete a.attributes[Composite.ATTRIBUTE_IMPORT]}if(a.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)){n.innerHTML="";let t=a.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]),n.appendChild(e,!0)}else t instanceof Node?n.appendChild(t.cloneNode(!0),!0):t instanceof NodeList?Array.from(t).forEach(function(e,t){n.appendChild(e.cloneNode(!0),0===t)}):n.innerHTML=String(t)}let e=String(a.attributes[Composite.ATTRIBUTE_INTERVAL]||"").trim();if(e&&!a.interval){var f=r+":"+Composite.ATTRIBUTE_INTERVAL;if(!(e=String(Expression.eval(f,e))).match(/^\d*$/))throw new Error("Invalid interval: "+e);e=Number.parseInt(e),a.interval=window.setInterval(()=>{document.body.contains(n)?Composite.render(n):(window.clearInterval(a.interval),delete a.interval)},e)}if(a.attributes.hasOwnProperty(Composite.ATTRIBUTE_ITERATE)){if(!a.iterate){var A=String(a.attributes[Composite.ATTRIBUTE_ITERATE]||"").trim(),g=A.match(Composite.PATTERN_EXPRESSION_VARIABLE);if(!g)throw new Error("Invalid iterate"+(A?": "+A:""));a.iterate={name:g[1].trim(),expression:"{{"+g[2].trim()+"}}"},a.template=n.cloneNode(!0)}var C=window[a.iterate.name];try{n.innerHTML="";var w=r+":"+Composite.ATTRIBUTE_ITERATE;let e=Expression.eval(w,a.iterate.expression);if(e){if(e instanceof XPathResult){for(var R={entry:null,array:[],iterate:e};R.entry=R.iterate.iterateNext();)R.array.push(R.entry);e=R.array}else e=Array.from(e);e.forEach((e,t,o)=>{var r={};Object.defineProperty(r,"item",{value:e,enumerable:!0}),Object.defineProperty(r,"index",{value:t,enumerable:!0}),Object.defineProperty(r,"data",{value:o,enumerable:!0}),window[a.iterate.name]=r,Array.from(a.template.cloneNode(!0).childNodes).forEach(e=>{n.appendChild(e),Composite.render(e,i.share())})})}}finally{delete window[a.iterate.name],void 0!==C&&(window[a.iterate.name]=C)}}if(!n.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)){var N=[];for(const _ in a.attributes)a.attributes.hasOwnProperty(_)&&N.push(_);Composite.ATTRIBUTE_VALUE in n&&a.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALUE)&&!N.includes(Composite.ATTRIBUTE_VALUE)&&N.push(Composite.ATTRIBUTE_VALUE),N.forEach(t=>{if(!t.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||t.match(Composite.PATTERN_ATTRIBUTE_STATIC)){let e=String(a.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 n&&(n.value=e),t.startsWith("@")&&(n.removeAttribute(t),t=t.replace(/^@+/,"")),n.setAttribute(t,e)):n.removeAttribute(t))}})}if(n.nodeName.match(Composite.PATTERN_SCRIPT))if((n.getAttribute(Composite.ATTRIBUTE_TYPE)||"").trim().match(Composite.PATTERN_COMPOSITE_SCRIPT))try{Scripting.eval(n.textContent)}catch(e){throw new Error("Composite JavaScript",e)}!n.childNodes||n.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)||a.attributes.hasOwnProperty(Composite.ATTRIBUTE_ITERATE)||Array.from(n.childNodes).forEach(e=>{n.contains(e)&&Composite.render(e,i.share())}),n.hasAttribute(Composite.ATTRIBUTE_RELEASE)&&n.removeAttribute(Composite.ATTRIBUTE_RELEASE)}}}}}}catch(e){console.error(e),Composite.fire(Composite.EVENT_ERROR,e),a instanceof Element&&(a.innerText="Error: "+(e.message.match(/(\{\{|\}\})/)?"Invalid expression":e.message))}finally{Composite.render.queue=Composite.render.queue.filter(e=>e!==a),i.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.replaceAll(/\/{2,}/g,"/")).startsWith(Composite.MODULES+"/"))throw new Error("Resource not supported: "+t);if(!(t in P&&t.match(/\.(js|css)(\?.*)?$/i)||t in P&&void 0===P[t])){if(!(t in P)){P[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);P[t]=o.responseText.trim()}var r=P[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=O[e.ordinal()]))throw new Error("Unknown composite");t=e.id,o.attributes.hasOwnProperty(Composite.ATTRIBUTE_STRICT)||(t=t.uncapitalize());var r=i(e);t=r&&r.namespace?r.namespace.concat(t):[t]}var r=Composite.MODULES+"/"+t.join("/"),a=(t=t.join("."),Object.lookup(t));void 0!==P[r+".composite"]?void 0===P[r+".html"]||!o||o.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT)||o.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)||e.innerHTML.trim()||(n(e),e instanceof Element&&(e.innerHTML=P[r+".html"])):(P[r+".composite"]=null,(void 0===a||a instanceof Element||a instanceof HTMLCollection||"common"===t)&&this.load(r+".js"),"common"===t&&this.load(r+".css"),!o||e.innerHTML.trim()||(this.load(r+".css"),o.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT))||o.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)||void 0!==(a=this.load(r+".html"))&&(n(e),e instanceof Element)&&(e.innerHTML=a))}});const y=new Set,I=new Map,v=new Map,S=new Set,r=new Map,b=new Set,n=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)},i=(e,t=!1)=>{if(!(e instanceof Element))return null;let o=(e.getAttribute(Composite.ATTRIBUTE_ID)||"").trim();if(e.hasAttribute(Composite.ATTRIBUTE_COMPOSITE)){if(!o.match(Composite.PATTERN_COMPOSITE_ID))throw new Error("Invalid composite id"+(o?": "+o:""));const r=O[e.ordinal()];if(!r||!r.attributes||!r.attributes.hasOwnProperty(Composite.ATTRIBUTE_NAMESPACE))return t?null:{model:o};const a=i(e.parentNode,!0);return a?(a.namespace?a.namespace.push(a.model):a.namespace=[a.model],{namespace:a.namespace,model:o}):{model:o}}const r=O[e.ordinal()];if(r&&r.attributes&&r.attributes.hasOwnProperty(Composite.ATTRIBUTE_NAMESPACE))throw new Error("Namespace without composite"+(o?" for: "+o:""));const a=i(e.parentNode);if(!e.hasAttribute(Composite.ATTRIBUTE_ID))return a;if(o.match(Composite.PATTERN_ELEMENT_ID))return t={namespace:[],model:null,route:[],target:null},a&&(a.namespace?a.namespace.push(a.model):a.namespace=[a.model],t.namespace=a.namespace,a.route?t.route.push(...a.route):t.route.push(a.model)),(o=o.match(Composite.PATTERN_ELEMENT_ID))[4]&&(t.namespace=o[4].substring(1).split(/:/),t.route=[t.namespace[t.namespace.length-1]]),t.route.push(o[1]),o[2]&&t.route.push(...o[2].substring(1).split(/:/)),o[3]&&(t.unique=o[3]),t.target=t.route[t.route.length-1],t.model=t.namespace.pop(),t.namespace.length<=0&&delete t.namespace,t.model?t:null;throw new Error("Invalid element id"+(o?": "+o:""))},c=e=>{var t,o,e=i(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},P={},O=[];Object.defineProperty(Composite.render,"meta",{value:O});let e=0;compliant("Object.prototype.serial"),compliant("Object.prototype.ordinal",function(){return void 0===this.serial&&Object.defineProperty(this,"serial",{value:++e}),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"),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),O.length&&(o=e.target.ordinal(),t=O[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):y.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&&e.addedNodes.forEach(e=>{(e instanceof Element||e instanceof Node&&e.nodeType===Node.TEXT_NODE)&&!O[e.ordinal()]&&document.body.contains(e)&&Composite.render(e)}),e.removedNodes&&e.removedNodes.forEach(e=>{const o=e=>{e.childNodes&&Array.from(e.childNodes).forEach(e=>o(e));var t=e.ordinal(),t=O[t];t&&t.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&(t=c(e))&&t.meta&&t.meta.model&&t.model&&b.has(t.meta.model)&&(b.delete(t.meta.model),"function"==typeof t.model.undock)&&t.model.undock.call(t.model),delete O[e.ordinal()]};o(e)})))})}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,characterData:!0}),Composite.render(document.body)})})(),(()=>{compliant("Reactive",e=>{if("object"!=typeof e)throw new TypeError("Not supported data type: "+typeof e);if("object"===e)throw new TypeError("Not supported data type: null");return l(e)});let n=null;Composite.listen(Composite.EVENT_RENDER_START,(e,t)=>n=t),Composite.listen(Composite.EVENT_RENDER_NEXT,(e,t)=>n=t),Composite.listen(Composite.EVENT_RENDER_END,(e,t)=>n=null),compliant("Object.prototype.reactive",function(){return l(this)});const i=Math.serial(),s=new WeakMap,l=e=>{if("object"!=typeof e||null===e)return e;if(void 0!==e[i])return e;if(s.has(e))return s.get(e);const a=new Proxy(e,{notifications:new Map,cache:new Map,get(t,o){try{if(o===i)return t;let e;var r;return"object"!=typeof(e=n&&(r=Object.getOwnPropertyDescriptor(t,o))&&"function"==typeof r.get?r.get.call(a):t[o])||null===e?e:void 0!==e[i]?e:s.has(e)?s.get(e):l(e)}finally{Composite.asynchron((t,e,o,r)=>{if(null!==t&&e.hasOwnProperty(o)){for(let e=t;e.parentNode;e=e.parentNode){var a=(Composite.render.meta||[])[e.ordinal()]||{};a.attributes&&a.attributes.hasOwnProperty(Composite.ATTRIBUTE_ITERATE)&&(t=e)}var n=r.get(o)||new Map;if(!n.has(t.ordinal())){for(const i of n.values()){if(void 0!==i.contains&&i.contains(t))return;void 0!==t.contains&&t.contains(i)&&n.delete(i.ordinal())}n.set(t.ordinal(),t),r.set(o,n)}}},n,t,o,this.notifications)}},set(e,t,o){"object"==typeof o&&null!==o&&void 0!==o[i]&&(o=o[i]);try{return e[t]=o}finally{if(this.cache.get(t)===o)return;this.cache.set(t,o),Composite.asynchron((e,t,o,r)=>{if(t.hasOwnProperty(o)){var a=this.notifications.get(o)||new Map;for(const n of a.values())document.body.contains(n)?Composite.render(n):a.delete(n.ordinal())}},n,e,t,this.notifications)}}});return s.set(e,a),a}})(),(()=>{const s=/(^((#\w[\-\w]+\w)|(#\w+))+$)|(^#$)/,l=/^((\w[\-\w]+\w)|(\w+))(#((\w[\-\w]+\w)|(\w+)))*$/,c=/(^((\w[\-\w]+\w)|(\w+))(#((\w[\-\w]+\w)|(\w+)))*(\.){3}$)|(^\.{3}$)/;let p=!1;compliant("SiteMap",{get location(){var e;return a.size<=0?window.location.hash||"#":(e=Array.from(a))[e.length-1]},set location(e){if(a.has(e))for(var t=Array.from(a.values());a.has(e)&&t.includes(e);){var o=t.pop();if(o===e)return;a.delete(o)}else a.add(e)},permit(e){for(var t of o)if((!t.pattern||t.pattern.test(e))&&!0!==(t=t.action.call(null,e)))return t="string"==typeof t?Path.normalize(t):t;return!0},locate(t){t=t||"";var o=e=>{var t=[SiteMap.location,e];return e.match(/(^#[^#].*$)|(^#$)/)&&t.shift(),t};try{t=Path.normalize(...o(t))}catch(e){for(;;){t=t.replace(/(^[^#]+$)|(#[^#]*$)/,"");try{t=Path.normalize(...o(t))}catch(e){continue}break}}if(t.match(E))return t;let e=Array.from(m.keys());for(e=e.concat(Array.from(T.keys()));e&&1<t.length;){for(const r of u)if((t+"#").startsWith(r+"#"))return t;if(e.includes(t))return t;t=Path.normalize(t+"##")}return"#"},navigate(e){Composite.asynchron(e=>{window.location.hash=e},SiteMap.locate(e)),SiteMap.locate(e)},lookup(e){arguments.length<=0&&(e=SiteMap.location);var t,o;for(const r of u)if((e+"#").startsWith(r+"#")){if(m.has(r))return{path:e,face:r,facet:null,get data(){return e.substring(r.length)||null}};if(T.has(r)){const a=T.get(r);return{path:e,face:a.path,facet:a.facet,get data(){return e.substring(a.path.length+a.facet.length)||null}}}break}return m.has(e)?{path:e,face:e,facet:null}:T.has(e)?(t=T.get(e),{path:(o=t).facet?o.path.endsWith("#")?o.path+o.facet:o.path+"#"+o.facet:o.path,face:t.path,facet:t.facet}):null},forward(e){var t