UNPKG

@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 65.8 kB
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,r)=>{var o=0===t&&null===i?Namespace.PATTERN_NAMESPACE_LEVEL_START:Namespace.PATTERN_NAMESPACE_LEVEL;if(!e.match(o))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 o=_populate(i,e),a=typeof o;if("undefined"!=a&&"object"!=a)throw new TypeError(`Invalid namespace type at level ${t+1+n}: `+a);(null==o||o instanceof Element)&&(t<r.length-1&&r[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(),r=(e=_filter(...e)).pop(),e=Namespace.use(...e);return null===e?null:(e[r]=t,_populate(e,r))},lookup(...t){if(t.length<=0)return window;_filter(...t);var r=t.length;let o=null;0<t.length&&"object"==typeof t[0]&&(o=t.shift()),r-=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+r===0?Namespace.PATTERN_NAMESPACE_LEVEL_START:Namespace.PATTERN_NAMESPACE_LEVEL;if(!a.match(n))throw new Error("Invalid namespace at level "+(e+1+r)+(a&&a.trim()?": "+a.trim():""));if(0===e&&null===o){if(void 0!==(o=_populate(o,a)))continue;o=window}if(void 0===(o=_populate(o,a))||null===o)return o;if(o instanceof Element)return}return o},exists(...e){return!(e.length<1)&&Object.usable(Namespace.lookup(...e))}});const _filter=(...e)=>{const r=[];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],r.push(...e)}),r},_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 r=Element.prototype.appendChild;Element.prototype.appendChild=function(t,e){if(e&&(this.innerHTML=""),t instanceof Node)r.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++)r.call(this,t[e])}else r.call(this,t)}})(),compliant("Math.unique",t=>{(t=t||16)<0&&(t=16);let r="";for(let e=0;e<t;e++){var o=Math.floor(Math.random()*Math.floor(26));Math.floor(Math.random()*Math.floor(26))%2==0?r+=String(o%10):r+=String.fromCharCode(65+o)}return r}),(()=>{compliant("Math.serial",()=>e.toString());const r=-9466848e5,e={timing:(new Date).getTime()+r,number:0,toString(){var e=(new Date).getTime()+r,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 r="";for(let t=0;t<this.length;t++){let e=Number(this.charCodeAt(t)).toString(16).toUpperCase();for(;e.length<2;)e="0"+e;r+=e}return"0x"+r}),compliant("String.prototype.decodeHex",function(){let t=this,r=(t.match(/^0x/)&&(t=t.substring(2)),"");for(let e=0;e<t.length;e+=2)r+=String.fromCharCode(parseInt(t.substring(e,2),16));return r}),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 r=31*this.hash+this.charCodeAt(e);Number.isSafeInteger(r)?this.hash=r:(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+)+)))+$/,u=/^\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,r){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 o,a,n=new XSLTProcessor;if(n.importStylesheet(t),r&&"object"==typeof r)for([o,a]of"function"!=typeof r[Symbol.iterator]?Object.entries(r):r)"function"!=typeof r[o]&&n.setParameter(null,o,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(u)||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,r){if("string"!=typeof e||!e.match(c))throw new Error("Invalid locator: "+String(e));var o=e.match(c)[1],a=e.match(c)[2];if(1===arguments.length){let e=s+"/"+DataSource.locale+"/"+a+"."+o;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(!o.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),r);throw new Error("Invalid style: "+String(i))},collect(...e){if(e.length<=0)return null;let t=[],r="collection";if(2===e.length&&"string"==typeof e[0]&&Array.isArray(e[1])){if(!e[0].match(n))throw new TypeError("Invalid collector");r=e[0],t=Array.from(e[1])}else t=1===e.length&&Array.isArray(e[0])?t.concat(e[0]):Array.from(e);let o=r.hashCode()+":"+t.join().hashCode();if(t.forEach(e=>o+=":"+String(e).hashCode()),l.hasOwnProperty(o))return l[o].clone();const a=document.implementation.createDocument(null,r,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[o]=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 r=[];if(r=r.concat(navigator.language),void 0!==navigator.languages&&(r=r.concat(navigator.languages)),Array.from(r).forEach(e=>{(e=e.match(/^[a-z]+/i,""))&&!r.includes(e[0])&&r.push(e[0])}),(r=(r=r.map(e=>e.trim().toLowerCase())).filter((e,t)=>r.indexOf(e)===t)).length<=0)throw new Error("Locale not available");var o=new XMLHttpRequest;if(o.overrideMimeType("text/plain"),o.open("GET",s+"/locales.xml",!1),o.send(),Object.defineProperty(DataSource,"data",{value:200===o.status?(new DOMParser).parseFromString(o.responseText,"text/xml"):null}),!DataSource.data&&404!==o.status)throw new Error("Locale not available");if(DataSource.data){o=DataSource.data;let t=o.evaluate("/locales/*[@default]",o,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=o.evaluate("/locales/*",o,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");r.push(DataSource.locales[0]),r=r.filter(function(e){return DataSource.locales.includes(e)}),DataSource.locales.selection=(r.length?r:DataSource.locales)[0]}})(),(()=>{compliant("messages",{}),compliant("Messages",{});const o=DataSource.localize;DataSource.localize=e=>{o(e),delete window.messages,delete window.Messages,window.Messages={customize(e,...t){let r=Messages[e]||"";for(let e=0;e<t.length;e++)r=r.replace(new RegExp("\\{"+e+"\\}","g"),t[e]);return r.replace(/\{\d+\}/g,"")}};var t=new Map,e="/locales/"+DataSource.locale+"/label",r=DataSource.data.evaluate(e,DataSource.data,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(let e=r.iterateNext();e;e=r.iterateNext())t.set((e.getAttribute("key")||"").trim(),((e.getAttribute("value")||"").trim()||(e.textContent||"").trim()).unescape());new Map([...t.entries()].sort()).forEach((e,t)=>{var r,o=t.match(/^(?:((?:\w+\.)*\w+)\.)*(\w+)$/);o&&(r="messages"+(o[1]?"."+o[1]:""),Object.defineProperty(Namespace.use(r),o[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,r;for(let o=0;o<a.length;o++){let e=a.charAt(o);if(!(o>=a.length)||n){if(r<0){if("?"===e){r=1;var t="_tolerate(()=>";a=a.substring(0,o)+t+a.substring(o+1),o+=t.length;continue}e.match(/\s/)||(r=0)}if("\\"===e)o++;else if(n)(n===a.substring(o,o+n.length)||"\n"===n&&"\r"===e)&&(n=null);else switch(e){case"/":"/"===(e=a.charAt(o+1))&&(n="\n"),"*"===e&&(n="*/");continue;case"(":0<r?r++:r=-1;continue;case")":if(r<=0)continue;if(0<--r)continue;a=a.substring(0,o)+")"+a.substring(o),o+=")".length;continue;case"'":case'"':case"`":n=e;continue;case"#":let t=a.substring(o-1,o+10);var i=t.match(/(^|\W)(#(?:import|export|module|use))\s/);if(i){let r=i[2];for(let e=o+r.length;e<=a.length;e++)if((t=a.charAt(e)).match(/[;\r\n]/)||!(e<a.length)){let t=a.substring(o+r.length,e).trim();switch(r){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+'"');r="_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(",")+"]")}),r="_export(...["+l.join(",")+"])";break;case"#module":r=(r=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").trim())&&"console.debug(`Module: "+r+"`)";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+'"');r="_use(...["+s.join(",")+"])"}a=a.substring(0,o-1)+(i[1]||"")+r+a.substring(e),o+=r.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 r=t[e[1]];if(!(void 0===r||r instanceof Element||r 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 r,o=(r=1<e.length&&e[0]?String(e[0]):r)?a.get(r):null;o=o||c(n,t),r&&a.set(r,o);try{return Scripting.run(o)}catch(e){return console.error(e.message+"\n\t"+o),e.message+" in "+o}}});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,r)=>e.replace(/[\t\r](\d+)\n/g,(e,t)=>r[t]),c=(t,r,o=[])=>{switch(t){case n:let e=r=r.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)*$/))return e=(e=(e=(e=(e=(e=(e=e.replace(/(?:\r(\d+)\n)/g,(e,t)=>"\r"+o[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"+r);case 2:r='"'+r+'"';case 1:return o.push(r),"\r"+(o.length-1)+"\n";case 3:if(!(r=r.trim()))return"";if((r=(r=(r=(r=(r=(r=(r=(r=(r=r.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,o))).replace(/\t+/g," ")).replace(s,(e,t,r)=>t+i[i.indexOf(r.toLowerCase())+1])).replace(/(^|[^\w\.])(true|false|null|undefined|new|instanceof|typeof)(?=[^\w\.]|$)/gi,(e,t="",r="")=>t+r.toLowerCase())).replace(/#\[([^\[\]]*)\]/g,(e,t)=>(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,r=r.replace(/(\([^\(\)]*\))/g,e=>(e=e.replace(/^\( *\?+ *(.*?) *\)$/s,(e,t)=>"_tolerate(()=>("+t+"))"),o.push(l(e,o)),"\t"+(o.length-1)+"\n"));return r=r.replace(/ {2,}/g," "),o.push(l(r,o)),"\r"+(o.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&&(r=e.ordinal(),(r=O[r]||{}).condition)&&r.condition.element&&r.condition.marker===this.selector&&(e=r.condition.element);let t=[];"string"==typeof e?(r=document.querySelectorAll(e),Array.from(r).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 r=e.queue.shift();r&&Composite.asynchron(e,r),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(),o.has(e)&&Array.isArray(o.get(e))||o.set(e,[]),o.get(e).push(t)},fire(e,...t){var r;e=(e||"").trim(),o.size<=0||!e||(r=o.get(e.toLowerCase()),Array.isArray(r)&&(t=[e,...t],r.forEach(e=>e(...t))))},asynchron(e,...t){window.setTimeout((e,...t)=>{e(...t)},0,e,...t)},validate(o,a){if((arguments.length<2||!1!==a)&&(a=!0),"string"==typeof o){if(!(o=o.trim()))return;let r=Array.from(document.querySelectorAll(o));return r.forEach((e,t)=>{r[t]=Composite.validate(e,a),void 0===r[t]?r[t]=0:r[t]=!0===r[t]?1:2}),(r=r.join("")).match(/^1+$/)?!0:!r.match(/2/)&&void 0}if(o instanceof Element){var r=o.ordinal(),n=O[r];let t=!0;"function"==typeof o.setCustomValidity&&o.setCustomValidity(""),"function"==typeof o.checkValidity&&(t=o.checkValidity());var i,s=c(o);if(s instanceof Object){let e;o instanceof Element&&(o.tagName.match(/^input$/i)&&o.type.match(/^radio|checkbox/i)?e=o.checked:o.tagName.match(/^select/i)&&"selectedIndex"in o?e=o.options[o.selectedIndex].value:Composite.ATTRIBUTE_VALUE in o&&(e=o[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,o,e):i.call(s.model,o))}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(r+":"+Composite.ATTRIBUTE_MESSAGE,e))),"function"==typeof o.setCustomValidity&&Object.usable(e)&&(o.setCustomValidity(e),n.attributes.hasOwnProperty(Composite.ATTRIBUTE_NOTIFICATION))&&"function"==typeof o.reportValidity&&o.reportValidity()}if(void 0!==t)return t}},mount(t,r){if(Composite.mount.queue=Composite.mount.queue||[],Composite.mount.lock&&Composite.mount.lock!==r)Composite.mount.queue.includes(t)||Composite.mount.queue.push(t);else{r=Composite.lock(Composite.mount,t);try{if("string"==typeof t)return(t=t.trim())?void document.querySelectorAll(t).forEach(e=>Composite.mount(e,r.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(),o=O[e];if(o instanceof Object){let r=o.attributes.hasOwnProperty(Composite.ATTRIBUTE_EVENTS)?o.attributes[Composite.ATTRIBUTE_EVENTS]:"";r=(r=(r=String(r||"")).toLowerCase().split(/\s+/)).filter((e,t,r)=>Composite.PATTERN_EVENT_FILTER.includes(e)&&r.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(),r.includes(n)||r.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(),r.includes(e)||r.push(e))}),e=Object.getPrototypeOf(e)}Composite.mount.stack.push(t),r.forEach(e=>{t.addEventListener(e.toLowerCase(),o=>{var a=o.currentTarget,t=a.ordinal(),n=O[t],i=o.type.toLowerCase();if(Composite.PATTERN_EVENT_FILTER.includes(i)){i=Composite.PATTERN_EVENT_FILTER.indexOf(i),i=Composite.PATTERN_EVENT_NAMES[i];let r;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]&&(r=e["on"+i].call(e,o))}}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!==r&&!r||void 0!==s&&!0!==s)&&o.preventDefault(),void 0!==r)?r:void 0}})})}}}finally{r.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 o=[];(e[1]||"").trim().split(/\s+/).forEach(e=>{e=e.toLowerCase(),v.has(e)||e.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||(v.add(e),o.push(e))});const a=t=>{if(t instanceof Element){var e=t.ordinal();const r=O[e];r&&(o.forEach(e=>{r.statics=r.statics||{},r.statics.hasOwnProperty[e]&&void 0!==r.statics[e]||(t.hasAttribute(e)?r.statics[e]=t.getAttribute(e):r.statics[e]=null)}),Array.from(t.childNodes).forEach(e=>a(e)))}};void a(document.body)}else if("function"==typeof t&&1===e.length)I.add(t);else{if("string"!=typeof t)throw new TypeError("Invalid scope: "+typeof t);var r,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?_.delete(t.toLowerCase()):_.set(t.toLowerCase(),e):(r=t.toLowerCase().hashCode(),null===e?S.delete(r):S.set(r,{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,r,s,l,o=_.get(n.nodeName.toLowerCase());if(!o||!1!==o(n)){if(n.parentNode)for(var[c,u]of S){var p=n.parentNode.querySelectorAll(u.selector);if(Array.from(p).includes(n)&&!1===u.callback(n))return}let o=n.ordinal(),a=O[o];if(!a&&(I.forEach(e=>e.call(null,n)),a={serial:o,element:n,attributes:{}},O[o]=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)||v.has(e.name))&&(!e.name.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||v.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||v.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||{},v.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||v.has(e.name))&&n.setAttribute(e.name,e.value)}),a.attributes.hasOwnProperty(Composite.ATTRIBUTE_CONDITION)){var T,m,E,d=(a.attributes[Composite.ATTRIBUTE_CONDITION]||"").trim();if(d.match(Composite.PATTERN_EXPRESSION_CONDITION))return T=document.createTextNode(""),m=n.cloneNode(!0),E=a.attributes,a={serial:T.ordinal(),element:T,attributes:E,condition:{expression:d,template:m,marker:T,element:null,attributes:E,complete:!1,share:null}},O[a.serial]=a,delete O[o],n.parentNode.replaceChild(T,n),void Composite.render(T,i.share());throw new Error("Invalid condition"+(d?": "+d:""))}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(o+":"+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,r=Object.assign({},e.attributes),O[t.ordinal()]={serial:t.ordinal(),element:t,attributes:r,condition:e},r.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,r,o;return e.substring(2,e.length-2).trim()?(r={serial:t=(r=document.createTextNode("")).ordinal(),element:r,attributes:{},value:null,render(){let e="";var t,r;this.attributes.hasOwnProperty(Composite.ATTRIBUTE_NAME)?(t=String(this.attributes[Composite.ATTRIBUTE_NAME]||"").trim(),r=String(this.attributes[Composite.ATTRIBUTE_VALUE]||"").trim(),window[t]=Expression.eval(this.serial+":"+Composite.ATTRIBUTE_VALUE,r)):(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:""}},(o=e.match(Composite.PATTERN_EXPRESSION_VARIABLE))?(r.attributes[Composite.ATTRIBUTE_NAME]=o[1],r.attributes[Composite.ATTRIBUTE_VALUE]="{{"+o[2]+"}}"):r.attributes[Composite.ATTRIBUTE_VALUE]=e,O[t]=r,"{{"+t+"}}"):""})).match(Composite.PATTERN_EXPRESSION_CONTAINS))return(s=e.split(/(\{\{\d+\}\})/)).forEach((e,t,r)=>{var o,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(),r[t]=a.element):(a={serial:o=(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[o]=a,r[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(o+":"+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 h=n.ordinal();delete O[h].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,r)=>{try{var o=new XMLHttpRequest;if(o.overrideMimeType("text/plain"),o.open("GET",r,!1),o.send(),200!==o.status)throw new Error(`HTTP status ${o.status} for `+o.responseURL);var a=o.responseText.trim(),n=(P[o.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(o+":"+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=o+":"+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 w=String(a.attributes[Composite.ATTRIBUTE_ITERATE]||"").trim(),g=w.match(Composite.PATTERN_EXPRESSION_VARIABLE);if(!g)throw new Error("Invalid iterate"+(w?": "+w:""));a.iterate={name:g[1].trim(),expression:"{{"+g[2].trim()+"}}"},a.template=n.cloneNode(!0)}var A=window[a.iterate.name];try{n.innerHTML="";var N=o+":"+Composite.ATTRIBUTE_ITERATE;let e=Expression.eval(N,a.iterate.expression);if(e){if(e instanceof XPathResult){for(var C={entry:null,array:[],iterate:e};C.entry=C.iterate.iterateNext();)C.array.push(C.entry);e=C.array}else e=Array.from(e);e.forEach((e,t,r)=>{var o={};Object.defineProperty(o,"item",{value:e,enumerable:!0}),Object.defineProperty(o,"index",{value:t,enumerable:!0}),Object.defineProperty(o,"data",{value:r,enumerable:!0}),window[a.iterate.name]=o,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!==A&&(window[a.iterate.name]=A)}}if(!n.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)){var y=[];for(const R in a.attributes)a.attributes.hasOwnProperty(R)&&y.push(R);Composite.ATTRIBUTE_VALUE in n&&a.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALUE)&&!y.includes(Composite.ATTRIBUTE_VALUE)&&y.push(Composite.ATTRIBUTE_VALUE),y.forEach(t=>{if(!t.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||t.match(Composite.PATTERN_ATTRIBUTE_STATIC)){let e=String(a.attributes[t]||"");var r;e.match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(r=o+":"+t,void 0!==(e=Expression.eval(r,e))?(e=(e=String(e).encodeHtml()).replace(/"/g,"&quot;"),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(r=t,(o=document.createElement("a")).href=r,!(t=o.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 r=new XMLHttpRequest;if(r.overrideMimeType("text/plain"),r.open("GET",t,!1),r.send(),404===r.status&&!e)return;if(200!==r.status)throw new Error(`HTTP status ${r.status} for `+r.responseURL);P[t]=r.responseText.trim()}var o=P[t];if(t.match(/\.js(\?.*)?$/i))try{Scripting.eval(o)}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");r=document.createElement("style");r.setAttribute("type","text/css"),r.textContent=o,e.appendChild(r)}else if(t.match(/\.html(\?.*)?$/i))return o}},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,r=null;if(e instanceof Element){if(!e.hasAttribute(Composite.ATTRIBUTE_ID))throw new Error("Unknown composite without id");if(!(r=O[e.ordinal()]))throw new Error("Unknown composite");t=e.id,r.attributes.hasOwnProperty(Composite.ATTRIBUTE_STRICT)||(t=t.uncapitalize());var o=i(e);t=o&&o.namespace?o.namespace.concat(t):[t]}var o=Composite.MODULES+"/"+t.join("/"),a=(t=t.join("."),Object.lookup(t));void 0!==P[o+".composite"]?void 0===P[o+".html"]||!r||r.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT)||r.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)||e.innerHTML.trim()||(n(e),e instanceof Element&&(e.innerHTML=P[o+".html"])):(P[o+".composite"]=null,(void 0===a||a instanceof Element||a instanceof HTMLCollection||"common"===t)&&this.load(o+".js"),"common"===t&&this.load(o+".css"),!r||e.innerHTML.trim()||(this.load(o+".css"),r.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT))||r.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)||void 0!==(a=this.load(o+".html"))&&(n(e),e instanceof Element)&&(e.innerHTML=a))}});const v=new Set,_=new Map,S=new Map,I=new Set,o=new Map,b=new Set,n=e=>{for(var t=(e instanceof Element&&e.id||"").trim(),r=t.toLowerCase();r&&e instanceof Element;)if((e=e.parentNode)instanceof Element&&e.hasAttribute(Composite.ATTRIBUTE_COMPOSITE)&&e.hasAttribute(Composite.ATTRIBUTE_ID)&&(e.id||"").toLowerCase().trim()===r)throw new Error("Recursion detected for composite: "+t)},i=(e,t=!1)=>{if(!(e instanceof Element))return null;let r=(e.getAttribute(Composite.ATTRIBUTE_ID)||"").trim();if(e.hasAttribute(Composite.ATTRIBUTE_COMPOSITE)){if(!r.match(Composite.PATTERN_COMPOSITE_ID))throw new Error("Invalid composite id"+(r?": "+r:""));const o=O[e.ordinal()];if(!o||!o.attributes||!o.attributes.hasOwnProperty(Composite.ATTRIBUTE_NAMESPACE))return t?null:{model:r};const a=i(e.parentNode,!0);return a?(a.namespace?a.namespace.push(a.model):a.namespace=[a.model],{namespace:a.namespace,model:r}):{model:r}}const o=O[e.ordinal()];if(o&&o.attributes&&o.attributes.hasOwnProperty(Composite.ATTRIBUTE_NAMESPACE))throw new Error("Namespace without composite"+(r?" for: "+r:""));const a=i(e.parentNode);if(!e.hasAttribute(Composite.ATTRIBUTE_ID))return a;if(r.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)),(r=r.match(Composite.PATTERN_ELEMENT_ID))[4]&&(t.namespace=r[4].substring(1).split(/:/),t.route=[t.namespace[t.namespace.length-1]]),t.route.push(r[1]),r[2]&&t.route.push(...r[2].substring(1).split(/:/)),r[3]&&(t.unique=r[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"+(r?": "+r:""))},c=e=>{var t,r,e=i(e);return e&&(t=Namespace.lookup(...e.namespace||[]),r=Object.lookup(t||window,e.model))?void 0===e.target?{meta:e,namespace:t,model:r}:(e={meta:e,namespace:t,model:r,get target(){return Object.lookup(this.namespace,...this.meta.route||[])},set target(e){let t=[this.meta.model];var r=(t=this.meta.route?this.meta.route:t).pop();Object.lookup(this.namespace,...t)[r]=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 r=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)),r.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,r;"attributes"===e.type&&(t=e.attributeName).match(/^(autofocus|disabled|hidden|multiple|readonly|required)$/i)&&("false"===(r=String(e.target.getAttribute(t)))&&e.target.removeAttribute(t),"true"===r)&&e.target.setAttribute(t,t),O.length&&(r=e.target.ordinal(),t=O[r],"characterData"===e.type&&e.target.nodeType===Node.TEXT_NODE?t&&t.hasOwnProperty(Composite.ATTRIBUTE_VALUE)&&(r=void 0===t.value?"":String(t.value))!==e.target.textContent&&(e.target.textContent=r):(t&&"attributes"===e.type&&((r=(e.attributeName||"").toLowerCase().trim()).match(Composite.PATTERN_ATTRIBUTE_ACCEPT)&&!r.match(Composite.PATTERN_ATTRIBUTE_STATIC)?e.target.hasAttribute(r)&&e.target.removeAttribute(r):r.match(Composite.PATTERN_ATTRIBUTE_STATIC)?t.attributes.hasOwnProperty(r)?e.target.hasAttribute(r)&&t.attributes[r]===e.target.getAttribute(r)||e.target.setAttribute(r,t.attributes[r]):e.target.hasAttribute(r)&&e.target.removeAttribute(r):v.has(r)&&(t.statics=t.statics||{},t.statics.hasOwnProperty(r)?e.target.hasAttribute(r)&&t.statics[r]===e.target.getAttribute(r)||e.target.setAttribute(r,t.statics[r]):e.target.hasAttribute(r)&&e.target.removeAttribute(r))),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 r=e=>{e.childNodes&&Array.from(e.childNodes).forEach(e=>r(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()]};r(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,r){try{if(r===i)return t;let e;var o;return"object"!=typeof(e=n&&(o=Object.getOwnPropertyDescriptor(t,r))&&"function"==typeof o.get?o.get.call(a):t[r])||null===e?e:void 0!==e[i]?e:s.has(e)?s.get(e):l(e)}finally{Composite.asynchron((t,e,r,o)=>{if(null!==t&&e.hasOwnProperty(r)){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=o.get(r)||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),o.set(r,n)}}},n,t,r,this.notifications)}},set(e,t,r){"object"==typeof r&&null!==r&&void 0!==r[i]&&(r=r[i]);try{return e[t]=r}finally{if(this.cache.get(t)===r)return;this.cache.set(t,r),Composite.asynchron((e,t,r,o)=>{if(t.hasOwnProperty(r)){var a=this.notifications.get(r)||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 u=!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 r=t.pop();if(r===e)return;a.delete(r)}else a.add(e)},permit(e){for(var t of r)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 r=e=>{var t=[SiteMap.location,e];return e.match(/(^#[^#].*$)|(^#$)/)&&t.shift(),t};try{t=Path.normalize(...r(t))}catch(e){for(;;){t=t.replace(/(^[^#]+$)|(#[^#]*$)/,"");try{t=Path.normalize(...r(t))}catch(e){continue}break}}if(t.match(E))return t;let e=Array.from(p.keys());for(e=e.concat(Array.from(T.keys()));e&&1<t.length;){for(const o of m)if((t+"#").startsWith(o+"#"))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,r;for(const o of m)if((e+"#").startsWith(o+"#")){if(p.has(o))return{path:e,face:o,facet:null,get data(){return e.substring(o.length)||null}};if(T.has(o)){const a=T.get(o);return{path:e,face:a.path,facet:a.facet,get data(){return e.substring(a.path.length+a.facet.length)||null}}}break}return p.has(e)?{path:e,face:e,facet:null}:T.has(e)?(t=T.get(e),{path:(r=t).facet?r.path.endsWith("#")?r.path+r.facet:r.path+"#"+r.facet:r.path,face:t.path,facet:t.facet}):null},forward(e){var t