@webqit/oohtml 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-binding.js +1 -1
- package/dist/data-binding.js.map +2 -2
- package/dist/main.js +1 -1
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +1 -1
- package/dist/main.lite.js.map +2 -2
- package/package.json +1 -1
- package/src/data-binding/index.js +1 -2
package/dist/main.lite.js
CHANGED
|
@@ -13,7 +13,7 @@ ${g}
|
|
|
13
13
|
const ast = parse( source, params.parserParams );
|
|
14
14
|
const { toString, ...compilation } = compile( ast, params.compilerParams );
|
|
15
15
|
e.ports[ 0 ]?.postMessage( compilation );
|
|
16
|
-
};`;globalThis.webqit.$qCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return new Promise(r=>{let n=new MessageChannel;webqit.$qCompilerWorker.postMessage({source:e,params:t},[n.port2]),n.port1.onmessage=o=>{let{...s}=o.data;Object.defineProperty(s,"toString",{value:a=>a==="base64"?s.compiledSourceBase64:s.compiledSource}),r(s)}})}function Qt(i,t,e={},r={}){t=N(t).slice();for(var n=i;!rt(n)&&!Nt(n)&&t.length;){var o=t.shift();if(!(e.get?e.get(n,o):M(n)?o in n:n[o])){r.exists=!1;return}n=e.get?e.get(n,o):n[o]}return r.exists=!0,n}function Le(i,t,e,r={},n={}){let o=(u,d,f)=>n.set?n.set(u,d,f):(G(t[a])&&E(u)?u.push(f):u[d]=f,!0);t=N(t);for(var s=i,a=0;a<t.length;a++)if(a<t.length-1){if(!s||!M(s)&&!I(s))return!1;var l=Qt(s,t[a],n);if(!M(l)){if(n.buildTree===!1)return!1;l=I(n.buildTree)?n.buildTree(a):G(t[a+1])?[]:{};var c=o(s,t[a],l);if(!c)return!1}s=l}else return o(s,t[a],e)}var Jt=class{constructor(t,e=!1){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!e&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let e=await t();return this._synthesis--,e}_fulfill(){for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.readCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,e,r){this.onread(()=>{let n=t(r),o=s=>{s!==void 0&&this.onwrite(()=>{let a=e(s,r),l=c=>{c!==void 0&&this.cycle(t,e,c)};a instanceof Promise?a.then(l):l(a)})};n instanceof Promise?n.then(o):o(n)})}};function gr(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Tt(i,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(s=>(s+"").replace("(",r?"(.//":"(./")).join("|");let n=[],o;try{let s=i.document.evaluate(e,t,null,i.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)n.push(o)}catch{}return n}function yr(i,t,e){e=(Array.isArray(e)?e:[e]).map(r=>(r+"").replace("(","(self::")).join("|");try{return i.document.evaluate(`${e}`,t,null,i.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function Yt(i,t,e,r=!1){let n=t.getRootNode(),o=e.getRootNode();return n===o?t.contains(e):r&&o instanceof i.ShadowRoot?Yt(i,t,o.host,r):!1}function br(i,t="|"){return[...i].reduce(([e,r,n,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(s)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!n[0].endsWith("\\")&&(e=e===s?null:e||s),n[0]+=s,[e,r,n]),[null,0,[""]])[2].reverse()}var X=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:gr(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=br(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var wt=class{constructor(t,e,r){this.context=t,this.namespace=e,this.window=t.defaultView||t.ownerDocument?.defaultView||r,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(I(t[0])?t=[[],...t]:T(t[0])&&!(t[0]instanceof X)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[N(t[0],!1),void 0,t[1]]:t[0]=N(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof X)&&!(e instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return t[0]=t[0].map(e=>e instanceof X?e:new X(e)),t}registry(...t){return D("realdom.realtime",this.window,this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,e,r){let{window:n}=this,o=Array.isArray(e)?e:[e],s=new Set;for(let[a,l]of this.registry(t))for(let[c,u]of l){let d=o.filter(f=>Yt(n,c,f.target,a==="cross-roots")?["subtree","cross-roots"].includes(a)||f.target===c:!1);if(!!d.length){Array.isArray(e)||(d=d[0]);for(let f of u)s.add([f,d,c])}}for(let[a,l,c]of[...s].reverse())r.call(n,a,l,c)}disconnectables(t,...e){let r={disconnect(){e.forEach(n=>n&&I(n.disconnect)&&n.disconnect()||I(n)&&n()||T(n)&&(n.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var lt=class extends wt{constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof X;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=vr(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let l of s){let c=a?.generate()||{};e(l,c,o)}else{let l=a?.generate()||{};e(s,l,o)}if(r.live){a&&(r={...r,signalGenerator:a});let l=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,l)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof X;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(n?t[0]:t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:o,window:s,webqit:a}=this;r.eventDetails&&!a.realdom.attrInterceptionHooks?.intercepting&&xr.call(s,"intercept",()=>{});let l=new s.MutationObserver(f=>{f=_r(f).map(p=>Or.call(s,p)),wr.call(s,d,f,o)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(f=>f+"")),l.observe(o,c);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:u,disconnectable:l};return this.disconnectables(r.signal,l,u)}observeSync(t,e,r={}){let n=typeof t=="string"||t instanceof X;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let a=r.timing==="intercept"?"intercept":"sync",l=r.subtree==="cross-roots"?"cross-roots":r.subtree?"subtree":"children";this.registry(a).size||xr.call(s,a,g=>{this.forEachMatchingContext(a,g,wr)});let c={disconnect(){p.delete(d),p.size||f.delete(o)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:u,disconnectable:c},f=this.registry(a,l);f.has(o)||f.set(o,new Set);let p=f.get(o);return p.add(d),this.disconnectables(r.signal,c,u)}};function _r(i){return i.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName||D(e.target,"internalAttrInteractions").get(e.attributeName)?t:t.concat(e),[])}function wr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:l}=i,c=r.map(f=>f+"");if(o.atomic&&!s.size?t=vr(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(f=>c.includes(f.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(f=>{let p;return o.eventDetails||({event:p,...f}=f),!o.oldValue&&"oldValue"in f&&({oldValue:p,...f}=f),!o.newValue&&"value"in f?{value:p,...f}=f:o.newValue&&typeof f.value>"u"&&(f={...f,value:de(f.target,f.name,()=>f.target.getAttribute(f.name))}),f})),o.atomic&&(t.forEach(f=>s.set(f.name,f)),t=Array.from(s.entries()).map(([,f])=>f));let u=a?t[0]:t,d=l?.generate()||{};n(u,d,e)}function de(i,t,e){let r=D(i,"internalAttrInteractions").get(t);D(i,"internalAttrInteractions").set(t,!0);let n=e();return D(i,"internalAttrInteractions").set(t,r),n}function vr(i,t,e=[]){let r={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",e.find(s=>s.name===o)||{target:i,name:o,value:de(i,o,()=>i.getAttribute(o)),...r})):Array.from(i.attributes).map(o=>e.find(s=>s.name===o.nodeName)||{target:i,name:o.nodeName,value:de(i,o.nodeName,()=>o.nodeValue),...r})}function Or({target:i,attributeName:t,value:e,oldValue:r}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(i)||{})[t]?.[0]||"mutation";return{target:i,name:t,value:e,oldValue:r,type:"observation",event:s}}function xr(i,t){let e=this,{webqit:r,document:n,Element:o}=e;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(i)||r.realdom.attrInterceptionHooks.set(i,new Set),r.realdom.attrInterceptionHooks.get(i).add(t);let s=()=>r.realdom.attrInterceptionHooks.get(i).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let a=(u,d)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let f=r.realdom.attrInterceptionRecords.get(u.target);if(f[u.name]=f[u.name]||[],f[u.name].unshift(u.event),D(u.target,"internalAttrInteractions").get(u.name))return d();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([u]));let p=d();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([u])),p};new e.MutationObserver(u=>{u=u.filter(d=>!(e.webqit.realdom.attrInterceptionRecords?.get(d.target)||{})[d.attributeName]?.shift()),u=_r(u).map(d=>Or.call(e,d)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(d=>d(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(d=>d(u)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(u=>{c[u]=o.prototype[u],o.prototype[u]=function(...d){let f,p=de(this,d[0],()=>this.getAttribute(d[0]));["setAttribute","toggleAttribute"].includes(u)&&(f=d[1]),u==="toggleAttribute"&&f===void 0&&(f=p===null);let g={target:this,name:d[0],value:f,oldValue:p,type:"interception",event:[this,u]};return a(g,()=>c[u].call(this,...d))}}),s}var Zt=class extends wt{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new lt(n,o).get(...arguments)}query(t,e=void 0,r={}){[t,e=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,o=new Map,s=c=>(o.has(c)||o.set(c,{target:c,entrants:[],exits:[],type:"query",event:null}),o.get(c));if(!r.generation||r.generation==="entrants"){if(!t.length)[...n.children].forEach(c=>s(n).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,u]=t.reduce(([f,p],g)=>g.kind==="xpath"?[f,p.concat(g)]:[f.concat(g),p],[[],[]]),d=[];r.subtree?(c.length&&d.push(...n.querySelectorAll(c.join(","))),u.length&&d.push(...Tt(this.window,n,u))):(c.length&&d.push(...[...n.children].filter(f=>f.matches(c))),u.length&&d.push(...Tt(this.window,n,u,!1))),d.forEach(f=>s(f.parentNode||n).entrants.push(f))}}if(!e)return o;let a={disconnected:!1},l=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(a.disconnected)break;let u=l?.generate()||{};e(c,u,n)}if(r.live){l&&(r={...r,signalGenerator:l});let c=this.observe(t,e,r);return this.disconnectables(r.signal,a,c)}return this.disconnectables(r.signal,a,l)}children(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!1})}subtree(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!0})}observe(t,e,r={}){if([t,e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:n,window:o,webqit:s,document:a}=this;r.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(a.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&$r.call(o,"sync",()=>{});let l=new o.MutationObserver(d=>d.forEach(f=>{Fe.call(o,u,Ar.call(o,f),n)}));l.observe(n,{childList:!0,subtree:r.subtree&&!0});let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:l};if(r.staticSensitivity){let d=Sr.call(o,u);return this.disconnectables(r.signal,l,c,d)}return this.disconnectables(r.signal,l,c)}observeSync(t,e,r={}){[t,e,r={}]=this.resolveArgs(arguments);let{context:n,window:o}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let s=r.timing==="intercept"?"intercept":"sync",a=r.subtree==="cross-roots"?"cross-roots":r.subtree?"subtree":"children";this.registry(s).size||$r.call(o,s,g=>{this.forEachMatchingContext(s,g,Fe)});let l=new o.MutationObserver(g=>g.forEach(y=>{Array.isArray((y=Ar.call(o,y)).event)||Fe.call(o,d,y,n)}));l.observe(n,{childList:!0,subtree:r.subtree&&!0});let c={disconnect(){l.disconnect(),p.delete(d),p.size||f.delete(n)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),d={context:n,spec:t,callback:e,params:r,signalGenerator:u,disconnectable:c},f=this.registry(s,a);f.has(n)||f.set(n,new Set);let p=f.get(n);if(p.add(d),r.staticSensitivity){let g=Sr.call(o,d);return this.disconnectables(r.signal,c,u,g)}return this.disconnectables(r.signal,c,u)}track(t,e,r={}){return r={subtree:!0,...r},this.observe(t,n=>{n.entrants.length&&e(!0,Array.isArray(t)?n.entrants:n.entrants[0]),n.exits.length&&e(!1,Array.isArray(t)?n.exits:n.exits[0])},r)}};function Sr(i){let t=this,{context:e,spec:r,callback:n,params:o,signalGenerator:s}=i,a=r.filter(p=>p.kind==="css"),l=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],c=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],u=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(l(p)).concat(c(p));if(!(i.$attrs=Array.from(new Set(a.filter(p=>(p+"").includes("[")).reduce((p,g)=>p.concat(u(g+"")),[])))).length)return;let d=new Set,f=new Set;return d.push=p=>(f.delete(p),d.add(p)),f.push=p=>(d.delete(p),f.add(p)),i.$deliveryCache={entrants:d,exits:f},new lt(e,t).observe(i.$attrs,p=>{let g=new Map,y=w=>(g.has(w)||g.set(w,{target:w,entrants:[],exits:[],type:"static",event:null}),g.get(w)),v=new WeakMap,h=w=>(v.has(w)||v.set(w,a.some(O=>w.matches(O+""))),v.get(w));for(let w of p)["entrants","exits"].forEach(O=>{o.generation&&O!==o.generation||i.$deliveryCache[O].has(w.target)||(O==="entrants"?!h(w.target):h(w.target))||(i.$deliveryCache[O].push(w.target),y(w.target)[O].push(w.target),y(w.target).event=w.event)});for(let[,w]of g){let O=s?.generate()||{};n(w,O,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function Fe(i,t){let{context:e,spec:r,callback:n,params:o,signalGenerator:s,$deliveryCache:a}=i,l={...t,entrants:[],exits:[]};if(o.eventDetails||delete l.event,["entrants","exits"].forEach(u=>{if(!(o.generation&&u!==o.generation)&&(r.length?l[u]=Oi.call(this,r,o.subtree==="cross-roots",t[u],t.event!=="parse"):l[u]=[...t[u]],!!a))for(let d of l[u])a[u].push(d)}),!l.entrants.length&&!l.exits.length)return;let c=s?.generate()||{};n(l,c,e)}function Oi(i,t,e,r){e=Array.isArray(e)?e:[...e];let n=(o,s)=>{if(s.type==="selector"){let a=s.isXpathAttr?[]:o.filter(l=>s.kind==="xpath"?yr(this,l,s+""):l.matches&&l.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((l,c)=>s.kind==="xpath"?[...l,...Tt(this,c,s,r)]:c.querySelectorAll?[...l,...c.querySelectorAll(s+"")]:l,a)),a.length)return a}else if(o.includes(s.content)||r&&o.some(a=>Yt(this,a,s.content,t)))return[s.content]};return e.$$searchCache||(e.$$searchCache=new Map),i.reduce((o,s)=>{let a;return e.$$searchCache.has(s.content)?a=e.$$searchCache.get(s.content):(a=n(e,s)||[],s.type==="instance"&&e.$$searchCache.set(s.content,a)),o.concat(a)},[])}function Ar({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=N(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=N(e).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),n),n=n||r.document.readyState==="loading"&&"parse"||"mutation",{target:i,entrants:t,exits:e,type:"observation",event:n}}function $r(i,t){let e=this,{webqit:r,document:n,Node:o,CharacterData:s,Element:a,HTMLElement:l,HTMLTemplateElement:c,DocumentFragment:u}=e;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionNoRecurse||Object.defineProperty(r.realdom,"domInterceptionNoRecurse",{value:new Map}),r.realdom.domInterceptionHooks.has(i)||r.realdom.domInterceptionHooks.set(i,new Set),r.realdom.domInterceptionHooks.get(i).add(t);let d=()=>r.realdom.domInterceptionHooks.get(i).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return d;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let f=(h,w,O)=>{r.realdom.domInterceptionNoRecurse.set(h,w);let _=O();return r.realdom.domInterceptionNoRecurse.delete(h),_},p=(h,w)=>{h.entrants.concat(h.exits).forEach(_=>{clearTimeout(r.realdom.domInterceptionRecords.get(_)?.timeout),r.realdom.domInterceptionRecords.set(_,h.event);let m=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(_)},0);Object.defineProperty(h.event,"timeout",{value:m,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(_=>_(h));let O=w();return r.realdom.domInterceptionHooks.get("sync")?.forEach(_=>_(h)),O},g={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},y={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(g).reduce((h,w)=>h.concat(w),[])).forEach(h=>{Object.keys(g).forEach(_=>{if(!g[_].includes(h))return;let m=Object.getOwnPropertyDescriptor(e[_].prototype,h);!m||(Object.defineProperty(e[_].prototype,h,"value"in m?{...m,value:w}:{...m,set:O}),y[_][h]=m)});function w(..._){let m=Object.keys(y).find(H=>this instanceof e[H]&&h in y[H]),x=y[m],b=()=>x[h].value.call(this,..._);if(r.realdom.domInterceptionNoRecurse.get(this)===h)return b();let $=[],A=[],P=this;["insertBefore"].includes(h)?A=[_[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(h)?(A=[_[1]],["beforebegin","afterend"].includes(_[0])&&(P=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(h)?($=[...this.childNodes],A=h==="replaceChildren"?[..._]:[_[0]]):["replaceWith","remove"].includes(h)?($=[this],A=h==="replaceWith"?[..._]:[],P=this.parentNode):["replaceChild"].includes(h)?($=[_[1]],A=[_[0]]):["removeChild"].includes(h)?$=[..._]:(A=[..._],["before","after"].includes(h)&&(P=this.parentNode));let j=h;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(h)){let H=this.nodeName;if(h==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(_[0])){if(!this.parentNode)return x[h].value.call(this,..._);H=this.parentNode.nodeName}let L=n.createElement(H);x.setHTMLUnsafe.value.call(L,A[0],h==="setHTMLUnsafe"?_[1]:{}),A=[...L.childNodes],h==="insertAdjacentHTML"?(j="insertAdjacentElement",_[1]=new u,f(_[1],"append",()=>_[1].append(...L.childNodes))):(j="replaceChildren",_=[...L.childNodes])}return p({target:P,entrants:A,exits:$,type:"interception",event:[this,h]},()=>x[j].value.call(this,..._))}function O(_){let m=Object.keys(y).find(k=>this instanceof e[k]&&h in y[k]),x=y[m],b=()=>x[h].set.call(this,_);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===h)return b();let $=[],A=[],P=this;if(["outerHTML","outerText"].includes(h)?($=[this],P=this.parentNode):this instanceof c?(P=this.content,$=[...this.content.childNodes]):$=[...this.childNodes],["outerHTML","innerHTML"].includes(h)){let k=this.nodeName;if(h==="outerHTML"){if(!this.parentNode)return b();k=this.parentNode.nodeName}let H=n.createElement(k.includes("-")?"div":k);if(f(H,h,()=>H[h]=_),A=this instanceof c?[...H.content.childNodes]:[...H.childNodes],this instanceof c&&this.hasAttribute("src")){let L=Ot=>Ot.reduce((tt,et)=>et instanceof HTMLScriptElement?tt.concat(et):et instanceof c?tt.concat(L([et.content])):(tt=tt.concat(L([...et.querySelectorAll?.("template")||[]].map(Br=>Br.content))),tt.concat(...et.querySelectorAll?.("script")||[])),[]);for(let Ot of L(A)){let tt=n.createElement("script");[...Ot.attributes].forEach(et=>tt.setAttribute(et.name,et.value)),tt.textContent=Ot.textContent,f(Ot,"replaceWith",()=>Ot.replaceWith(tt))}}h==="outerHTML"?(_=new u,f(_,"append",()=>_.append(...A)),b=()=>f(this,"replaceWith",()=>a.prototype.replaceWith.call(this,_))):this instanceof c?b=()=>f(this.content,"replaceChildren",()=>this.content.replaceChildren(...A)):b=()=>f(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...A))}return p({target:P,entrants:A,exits:$,type:"interception",event:[this,h]},b)}}),d}function Er(){Si.call(this),Ai.call(this),$i.call(this)}function Si(){let i=this;i.CSS||(i.CSS={}),i.CSS.escape||(i.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function Ai(){let i=this;"isConnected"in i.Node.prototype||Object.defineProperty(i.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function $i(){let i=this;i.Element.prototype.matches||(i.Element.prototype.matches=i.Element.prototype.matchesSelector||i.Element.prototype.mozMatchesSelector||i.Element.prototype.msMatchesSelector||i.Element.prototype.oMatchesSelector||i.Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}function Cr(){let i=this;if(i.webqit||(i.webqit={}),i.webqit.realdom)return i.webqit.realdom;i.webqit.realdom={},Er.call(i),i.webqit.realdom.meta=(...e)=>Ei.call(i,...e),i.webqit.realdom.ready=(...e)=>We.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new Zt(e,i);if(r==="attr")return new lt(e,i)};let t=new Jt(i);return i.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),i.webqit.realdom.synthesizeWhile=(...e)=>t.synthesizeWhile(...e),i.webqit.realdom}function We(...i){let t="interactive",e;$t(i[0])?(t=i[0],I(i[1])&&(e=i[1])):I(i[0])&&(e=i[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let n=this;if(!e)return n.webqit.realdom.readyStatePromises||(n.webqit.realdom.readyStatePromises={interactive:new Promise(o=>We.call(this,"interactive",o)),complete:new Promise(o=>We.call(this,"complete",o))}),n.webqit.realdom.readyStatePromises[t];if(r[t].includes(n.document.readyState))return e(n);n.webqit.realdom.readyStateCallbacks||(n.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},n.document.addEventListener("readystatechange",()=>{let o=n.document.readyState;for(let s of n.webqit.realdom.readyStateCallbacks[o].splice(0))s(n)},!1)),n.webqit.realdom.readyStateCallbacks[t].push(e)}function Ei(i){let t=this,e={},r;return(r=t.document.querySelector(`meta[name="${i}"]`))&&(e=(r.content||"").split(";").filter(n=>n).reduce((n,o)=>{let s=o.split("=").map(a=>a.trim());return Le(n,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:G(s[1])?parseInt(s[1]):s[1]),n},{})),{get name(){return i},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}function pe(i,t){return typeof i!="string"?i:i.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+(typeof t!==void 0&&t?e.substr(1).toLowerCase():e.substr(1))})}var S=(...i)=>D("oohtml",...i),R={};function B(i,t,e){let r=this,n=Cr.call(r);R.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let s=r.webqit.oohtml.configs[o];Dt(2,s,e,t,n.meta(i).json()),r.webqitConfig.prefix&&Object.keys(s).forEach(a=>{Object.keys(s[a]).forEach(l=>{a==="api"&&typeof s[a][l]=="string"?s[a][l]=`${r.webqitConfig.prefix}${pe(s[a][l])}`:["attr","elements"].includes(a)&&s[a][l]?.startsWith("data-")===!1&&(s[a][l]=`${r.webqitConfig.prefix}-${s[a][l]}`)})})}return{config:r.webqit.oohtml.configs[o],realdom:n,window:r}}function Be(i,t){return D(i,"internalAttrInteractions").get(t)}function Tr(i,t,e){let r=D(i,"internalAttrInteractions").get(t);D(i,"internalAttrInteractions").set(t,!0);let n=e();return D(i,"internalAttrInteractions").set(t,r),n}function It(i,t){return[...i].reduce(([e,r,n],o)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(o)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(o)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(o)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(o)&&!n[0].endsWith("\\")&&(e=e===o?null:e||o),n[0]+=o,[e,r,n]),[null,0,[""]])[2].reverse()}var Ti=()=>(0|Math.random()*9e6).toString(36),Ve=new Map;function xt(i){let t;return(t=Ve.get(i))||(t=Ti(),Ve.set(i,t)),t}function he(i){let t;return Ve.forEach((e,r)=>{e===i&&(t=r)}),t}function me(){let{window:i}=R,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=n.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let a=["contextrequest","contextclaim"],l=n.pop()||a[0];if(!a.includes(l))throw new Error(`Invalid event type. Must be one of: ${a.join(",")}`);let{kind:c,detail:u,targetContext:d,live:f,signal:p,diff:g,...y}=s;super(l,{...y,bubbles:y.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>c}),Object.defineProperty(this,"targetContext",{get:()=>d}),Object.defineProperty(this,"detail",{get:()=>u}),Object.defineProperty(this,"live",{get:()=>f}),Object.defineProperty(this,"signal",{get:()=>p}),Object.defineProperty(this,"diff",{get:()=>g}),Object.defineProperty(this,"options",{get:()=>y}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(n){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===n)return;Object.defineProperty(this,"_prevValue",{value:n,configurable:!0})}return this.callback(n)}}return t.DOMContextRequestEvent=e,e}var _t=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=R;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var vt=class extends Error{};var Kt=new Map,ut=class{static instance(t){return S(t).get("contexts::instance")||new this(t)}constructor(t){S(t).get("contexts::instance")?.dispose(),S(t).set("contexts::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e})}get[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(e=>typeof t[0]=="function"?t[0](e):e.constructor.kind===t[0]&&(t.length===1||e.detail===t[1]))}attach(t){if(!(t instanceof z))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new vt(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new _t((e,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(e):t[t.length-1]=e);let n;(n=t.find(l=>typeof l=="object"&&l))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(me())(...t);o.meta.target=this["#"].host;let s=this["#"].host.getRootNode(),a=l=>{if(l.stopImmediatePropagation(),l.meta.target=l.target,!l.answered){if(Kt.get(s)||Kt.set(s,new Set),l.type==="contextrequest"&&l.live)Kt.get(s).add(l);else if(l.type==="contextclaim"){let c=new Set;return Kt.get(s).forEach(u=>{!this["#"].host.contains(u.target)||!l.detail.matchEvent(u)||(Kt.get(s).delete(u),c.add(u))}),l.respondWith(c)}}};s.addEventListener(o.type,a),this["#"].host.dispatchEvent(o),s.removeEventListener(o.type,a)})}};var ze=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=R;return t}get name(){return[R.window.Document,R.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof ze)||t.target===this.host)return;let e=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),e.add(r))}),e.size)return t.respondWith(e)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:e}=ut.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return e?.forEach(r=>{this.subscriptions.add(r),this.subscribed(r),this.handle(r)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(e=>{this.subscriptions.delete(e),this.unsubscribed(e);let{target:r}=e;r.dispatchEvent(e)}),this}},z=ze;F(z,"kind");var Mt=class extends z{static createRequest(t=null){let e=super.createRequest();if(t?.startsWith("@")){let[r,...n]=n.slice(1).split("/").map(o=>o.trim());e.targetContext=r,e.detail=n.join("/")}else e.detail=t;return e}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:e}}}=R;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(e.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(n=>n.trim()).filter(n=>n);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=e.reduce(this.namespaceObj,r,e.get,n=>{this.disposed||t.respondWith(n.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};F(Mt,"kind","namespace");function Ue(i={}){let{config:t,window:e}=B.call(this,"namespaced-html",i,{attr:{namespace:"namespace",lid:"id"},api:{namespace:"namespace"},tokens:{lidrefPrefix:"~",lidrefSeparator:":"},target:{className:":target",eventName:":target",scrolling:!0}});t.lidSelector=`[${e.CSS.escape(t.attr.lid)}]`,t.namespaceSelector=`[${e.CSS.escape(t.attr.namespace)}]`,e.webqit.DOMNamingContext=Mt,Ii.call(e,t),Mi.call(e,t)}function Ir(i){let{lidrefPrefix:t,lidrefSeparator:e}=i.tokens;return{escape(r,n=1){return[...r].map(o=>/\w/.test(o)?o:n===2?`\\\\${o}`:`\\${o}`).join("")},lidrefPrefix(r=0){return r?this.escape(t,r):t},lidrefSeparator(r=0){return r?this.escape(e,r):e},isUuid(r,n=0){return r.startsWith(this.lidrefPrefix(n))&&r.includes(this.lidrefSeparator(n))},isLidref(r,n=0){return r.startsWith(this.lidrefPrefix(n))&&!r.includes(this.lidrefSeparator(n))},toUuid(r,n,o=0){return r.endsWith("-root")?n:`${this.lidrefPrefix(o)}${r}${this.lidrefSeparator(o)}${n}`},uuidToId(r,n=0){return this.isUuid(r)?r.split(this.lidrefSeparator(n))[1]:r},uuidToLidref(r,n=0){return this.isUuid(r)?`${this.lidrefPrefix(n)}${r.split(this.lidrefSeparator(n))[1]}`:r}}}function Ge(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,s=Ir(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[l,c]=It(i,",").reduce(([d,f],p)=>{let g,y;return p=p.replace(a,(v,h,w,O,_)=>{if(g||(g=[...p.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),g.some($=>_>$.index&&_+v.length<$.index+$[0].length))return v;if(v===":scope")return y=!0,e;let m=h&&!w;if(h&&w)return`#${s.escape(v.replace("#",""),1)}`;if(m&&o.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${s.toUuid(t,O,1)}`;let b;return o.attr.lid==="id"?b=`:is(#${O},[id^="${s.lidrefPrefix(r)}"][id$="${s.lidrefSeparator(r)}${O}"])`:b=`:is(#${O},[${n.CSS.escape(o.attr.lid)}="${O}"])`,m?`:is(${b}):not(${e?e+" ":""}${o.namespaceSelector} *)`:b}),y?[d,f.concat(p)]:[d.concat(p),f]},[[],[]]),u;return e&&l.length?u=[l.length>1?`${e} :is(${l.join(", ")})`:`${e} ${l[0]}`,c.join(", ")].filter(d=>d).join(", "):u=[...l,...c].join(", "),u}function ge(i){let t=this;if(!S(i).has("namespace")){let e=Object.create(null);S(i).set("namespace",e);let r=[t.Document,t.ShadowRoot].some(n=>i instanceof n);Object.defineProperty(e,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return S(i).get("namespace")}function qt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return ge.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function ye(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(he(i)||xt(i))+(t?"-root":"")}function Ii(i){let t=this,{webqit:{Observer:e}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let n=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.namespace in r)throw new Error(`The ${n} prototype already has a "${i.api.namespace}" API!`);Object.defineProperty(r,i.api.namespace,{get:function(){return e.proxy(ge.call(t,this))}})})}function Mi(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},DOMNamingContext:o}}=t,s=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],a=["for","list","form","aria-activedescendant","aria-details","aria-errormessage"],l=[i.attr.lid,...s,...a],c={id:"id",for:"htmlFor","aria-owns":"ariaOwns","aria-controls":"ariaControls","aria-labelledby":"ariaLabelledBy","aria-describedby":"ariaDescribedBy","aria-flowto":"ariaFlowto","aria-activedescendant":"ariaActiveDescendant","aria-details":"ariaDetails","aria-errormessage":"ariaErrorMessage"},u=Ir(i),d=(m,x,b)=>{if(!Be(m,x)&&S(m,"attrOriginals").has(x))return S(m,"attrOriginals").get(x);let $=b();return Be(m,x)?$:$&&$.split(" ").map(A=>(A=A.trim())&&(x===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,A)).join(" ")},f=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...f,value(m){return this.querySelector(`#${m}`)}});for(let m of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let x=Object.getOwnPropertyDescriptor(nodeApi.prototype,m);Object.defineProperty(nodeApi.prototype,m,{...x,value(b){return x.value.call(this,Ge.call(t,b,ye(ge.call(t,this))))}})}let p=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...p,value(m){let x=()=>p.value.call(this,m);return l.includes(m)&&!S(this,"lock").get(m)?d(this,m,x):x()}});let g=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...g,get(){let m=()=>g.get.call(this);return l.includes(this.name)?d(this.ownerElement,this.name,m):m()}});let y=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...y,get(){let m=()=>y.get.call(this);return this instanceof t.Attr&&l.includes(this.name)?d(this.ownerElement,this.name,m):m()}});for(let m of l){if(!(m in c))continue;let x=m==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let b of x){let $=Object.getOwnPropertyDescriptor(b.prototype,c[m]);!$||Object.defineProperty(b.prototype,c[m],{...$,get(){return d(this,m,()=>$.get.call(this,m))}})}}i.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,i.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(i.attr.lid)},set(m){return this.setAttribute(i.attr.lid,m)}});let v=(m,x,b,$)=>Tr(m,x,()=>(typeof b=="function"&&(b=b()),$(b))),h=(m,x,b,$=null)=>{v(m,x,b,A=>{let P=x===i.attr.lid,j=$||qt.call(t,m,P),k=ye(j);if(P){let H=u.uuidToId(A);if(e.get(j,H)!==m){let L=u.toUuid(k,H);L!==A&&m.setAttribute("id",L),e.set(j,H,m)}}else{S(m,"attrOriginals").set(x,A);let H=A.split(" ").map(L=>(L=L.trim())&&!u.isLidref(L)?L:u.toUuid(k,L.replace(u.lidrefPrefix(),""))).join(" ");m.setAttribute(x,H),S(j).set("idrefs",S(j).get("idrefs")||new Set),S(j).get("idrefs").add(m)}})},w=(m,x,b,$=null)=>{v(m,x,b,A=>{let P=x===i.attr.lid,j=$||qt.call(t,m,P);if(P){let k=u.uuidToId(A);e.get(j,k)===m&&e.deleteProperty(j,k)}else{let k=S(m,"attrOriginals").get(x);m.setAttribute(x,k),S(j).get("idrefs")?.delete(m)}})};r.realtime(t.document).query(i.namespaceSelector,m=>{let x=(b,$,A,P)=>{if(!b.hasAttribute($))return;let j=()=>b.getAttribute($);w(b,$,j,A),b.isConnected&&h(b,$,S(b,"attrOriginals").get($)||j,P)};m.exits.forEach(b=>{if(b.isConnected){let P=ge.call(t,b);for(let j of new Set([...Object.values(P),...S(P).get("idrefs")||[]]))for(let k of l)x(j,k,P)}let $=b[n.CONTEXT_API.api.contexts],A=$.find(o.kind);A&&$.detach(A)}),m.entrants.forEach(b=>{let $,A=qt.call(t,b,!0);for(let j of new Set([...Object.values(A),...S(A).get("idrefs")||[]]))if(($=qt.call(t,j,!0))!==A)for(let k of l)x(j,k,A,$);let P=b[n.CONTEXT_API.api.contexts];P.find(o.kind)||P.attach(new o)})},{live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${l.map(m=>t.CSS.escape(m)).join("],[")}]`,m=>{let x={forID:new Map,forOther:new Map};for(let b of l){let $=b===i.attr.lid?x.forID:x.forOther;m.exits.forEach(A=>{if(!A.hasAttribute(b))return;let P=$.get(A);typeof P>"u"&&(P=(b===i.attr.lid?A.parentNode:A)?.closest?.(i.namespaceSelector)||A.getRootNode().host,$.set(A,P)),!(P&&!P.isConnected)&&w(A,b,()=>A.getAttribute(b))}),m.entrants.forEach(A=>{!A.hasAttribute(b)||h(A,b,()=>A.getAttribute(b))})}x.forID.clear(),x.forOther.clear()},{live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(l,m=>{for(let x of m)x.oldValue&&w(x.target,x.name,x.oldValue),x.value&&h(x.target,x.name,x.value)},{subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let O,_=()=>{if(!t.location.hash?.startsWith(`#${u.lidrefPrefix()}`))return;let m=t.location.hash?.substring(`#${u.lidrefPrefix()}`.length).split("/").map(b=>b.trim()).filter(b=>b)||[],x=m.reduce((b,$)=>b&&b[i.api.namespace][$],t.document);O&&i.target.className&&O.classList.toggle(i.target.className,!1),x&&x!==t.document&&(i.target.className&&x.classList.toggle(i.target.className,!0),i.target.eventName&&x.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&m.length>1&&x.scrollIntoView(),O=x)};t.addEventListener("hashchange",_),r.ready(_)}function Xe({advanced:i={},...t}){let{config:e,window:r}=B.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:le(i)});e.scriptSelector=(Array.isArray(e.script.mimeTypes)?e.script.mimeTypes:e.script.mimeTypes.split("|")).concat("").reduce((n,o)=>{let s=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`script${s}`)},[]).join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:ji.bind(r,e)},qi.call(r,e),Ri.call(r,e)}function qi(i){let t=this,e=new Map;if(i.api.scripts in t.Element.prototype)throw new Error(`The "Element" class already has a "${i.api.scripts}" property!`);Object.defineProperty(t.Element.prototype,i.api.scripts,{get:function(){return e.has(this)||e.set(this,[]),e.get(this)}}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}},quantum:{configurable:!0,get(){return this.hasAttribute("quantum")},set(r){this.toggleAttribute("quantum",r)}}})}async function ji(i,t){let e=this,{realdom:r}=e.webqit,n=he(t);if(!n)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:s,thisContext:a}=n;i.script.retention==="dispose"?o.remove():i.script.retention==="hidden"?o.textContent='"source hidden"':o.textContent=await s.toString();let l=o.scoped?a:o.getRootNode();S(l).has("scriptEnv")||S(l).set("scriptEnv",Object.create(null));let c=await(await s.bind(a,S(l).get("scriptEnv"))).execute();o.quantum&&Object.defineProperty(o,"state",{value:c}),r.realtime(e.document).observe(o,()=>{o.quantum&&c.dispose(),a instanceof e.Element&&a[i.api.scripts]?.splice(a[i.api.scripts].indexOf(o,1))},{subtree:"cross-roots",timing:"sync",generation:"exits"})}function Ri(i){let t=this,{webqit:{oohtml:e,realdom:r}}=t;t.HTMLScriptElement.supports||(t.HTMLScriptElement.supports=o=>["text/javascript","application/javascript"].includes(o));let n=new WeakSet;r.realtime(t.document).query(i.scriptSelector,o=>{o.entrants.forEach(s=>{if(n.has(s))return;let a=Mr.call(t,i,s);if(!a)return;n.add(s);let l=s.scoped?s.parentNode||o.target:s.type==="module"?void 0:t;s.scoped&&l[i.api.scripts].push(s);let c=xt({script:s,compiledScript:a,thisContext:l});o.type==="query"||s.type&&!t.HTMLScriptElement.supports(s.type)||i.script.timing==="manual"?e.Script.execute(c):s.textContent=`webqit.oohtml.Script.execute( '${c}' );`})},{live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function Mr(i,t){let e=this,{webqit:{oohtml:r,QuantumScript:n,AsyncQuantumScript:o,QuantumModule:s}}=e,a=(t._=t.textContent.trim())&&t._.startsWith("/*@oohtml*/if(false){")&&t._.endsWith("}/*@oohtml*/")?t._.slice(21,-12):t.textContent;if(!a.trim().length)return;let l=xt(a),c=r.Script.compileCache[t.quantum?0:1],u;if(!(u=c.get(l))){let{parserParams:d,compilerParams:f,runtimeParams:p}=i.advanced;u=new(t.type==="module"?s:n||o)(a,{exportNamespace:`#${t.id}`,fileName:`${e.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:{...d,quantumMode:t.quantum},compilerParams:f,runtimeParams:p}),c.set(l,u)}return u}function qr(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{Mr.call(t,e,r)})}function Ye(i={}){let{config:t,window:e}=B.call(this,"data-binding",i,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"}});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=e.webqit.oohtml.configs),t.attrSelector=`[${e.CSS.escape(t.attr.render)}]`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,Ni.call(e,t)}function Ni(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(`(${i.discreteBindingsSelector})`,r=>{jr.call(this,...r.exits),ki.call(t,i,...r.entrants)},{live:!0,subtree:"cross-roots",timing:"sync"}),e.realtime(t.document).query(i.attrSelector,r=>{jr.call(this,...r.exits),Di.call(t,i,...r.entrants)},{live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0})}function Rr(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(S(t).has("data-binding"))return S(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(l,c,...u)=>{let d=()=>{l[c](...u);try{}catch(f){console.error(`${f.message} at ${f.cause}`)}};e.schedule("write",d)},o.$assign__=(l,c,u)=>{let d=()=>{try{l[c]=u}catch(f){console.error(`${f.message} at ${f.cause}`)}};e.schedule("write",d)},r.intercept(o,{get:(l,c,u)=>{if(!(l.key in o)){let d={...n.createRequest(l.key),live:!0,signal:s.signal};t[i.CONTEXT_API.api.contexts].request(d,f=>{r.set(o,l.key,f)})}return u(o[l.key]??(l.key in globalThis?globalThis[l.key]:void 0))},has:(l,c,u)=>u(!0)});let a={scope:o,abortController:s,bindings:new Map};return S(t).set("data-binding",a),a}function jr(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=S(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals?.forEach(o=>o.abort()),r.delete(t),r.size||(n.abort(),S(e).delete("data-binding"))}}function Nr(i,t){let e=i.tokens.tagStart.split("").map(c=>`\\${c}`).join(""),r=i.tokens.tagEnd.split("").map(c=>`\\${c}`).join(""),n=i.tokens.stateStart.split("").map(c=>c===" "?"(?:\\s+)?":`\\${c}`).join(""),o=i.tokens.stateEnd.split("").map(c=>`\\${c}`).join(""),s=`^${e}(.*?)(?:${n}(\\d+)${o}(?:\\s+)?)?${r}$`,[,a,l]=t.match(new RegExp(s));return{raw:t,expr:a,span:parseInt(l??0)}}async function ki(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let s=Nr(i,o.nodeValue),a=o;if(s.span){if(a=o.nextSibling,a?.nodeName!=="#text"||a.nodeValue.length<s.span)return n;a.nodeValue.length>s.span&&a.splitText(s.span)}else a=o.ownerDocument.createTextNode(""),o.after(a);a.isBound=!0;let l=o;return e.webqit.env!=="server"&&(l.remove(),l=null),n.concat({textNode:a,template:s,anchorNode:l})},[]);for(let{textNode:n,template:o,anchorNode:s}of r){let a=kr.call(e,i,o.expr),{scope:l,bindings:c}=Rr.call(this,i,n.parentNode);Object.defineProperty(n,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{c.set(n,{state:await(await a.bind(n,l)).execute()})}catch(u){console.log(u)}}}var Qe=new Map;function kr(i,t){if(Qe.has(t))return Qe.get(t);let e=`let content = ((${t}) ?? '') + '';`;e+="$assign__(this, 'nodeValue', content);",e+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${i.tokens.tagStart}${jt(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,n=new r(e);return Qe.set(t,n),n}async function Di(i,...t){for(let e of t){let r=Dr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=Rr.call(this,i,e),s=[];Object.defineProperty(e,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(e,{signals:s,state:await(await r.bind(e,n)).execute()})}catch(a){console.log(a)}}}var Je=new Map;function Dr(i,t){if(Je.has(t))return Je.get(t);let e={},r=It(t,";").map(s=>{let[a,l]=It(s,":").map(p=>p.trim()),c=a[0],u=a.slice(1).trim(),d=`(${l})`,f=`(${d} ?? '')`;if(c==="&")return u.startsWith("--")?`$exec__(this.style, 'setProperty', "${jt(u)}", ${f});`:`$assign__(this.style, "${jt(u)}", ${f});`;if(c==="%")return`$exec__(this.classList, 'toggle', "${jt(u)}", !!${d});`;if(c==="~")return u.startsWith("?")?`$exec__(this, 'toggleAttribute', "${jt(u.substring(1).trim())}", !!${d});`:`$exec__(this, 'setAttribute', "${jt(u)}", ${f});`;if(c==="#"){if(e[u])throw new Error(`Duplicate binding: ${a}.`);if(e[u]=!0,u==="text")return`$assign__(this, 'textContent', ${f});`;if(u==="html")return`$exec__(this, 'setHTMLUnsafe', ${f});`;if(u==="items"){let[p,g]=It(l,"/");if(!g)throw new Error(`Invalid ${c}items spec: ${s}; no import specifier.`);let[y,v,h,w]=p.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!y)throw new Error(`Invalid ${c}items spec: ${s}.`);if(v.startsWith("(")?v=v.trim().slice(1,-1).split(",").map(_=>_.trim()):v=[v],v.length>(h==="in"?3:2))throw new Error(`Invalid ${c}items spec: ${s}.`);let O=h==="in"?v[2]:v[1]||"$index__";return`
|
|
16
|
+
};`;globalThis.webqit.$qCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return new Promise(r=>{let n=new MessageChannel;webqit.$qCompilerWorker.postMessage({source:e,params:t},[n.port2]),n.port1.onmessage=o=>{let{...s}=o.data;Object.defineProperty(s,"toString",{value:a=>a==="base64"?s.compiledSourceBase64:s.compiledSource}),r(s)}})}function Qt(i,t,e={},r={}){t=N(t).slice();for(var n=i;!rt(n)&&!Nt(n)&&t.length;){var o=t.shift();if(!(e.get?e.get(n,o):M(n)?o in n:n[o])){r.exists=!1;return}n=e.get?e.get(n,o):n[o]}return r.exists=!0,n}function Le(i,t,e,r={},n={}){let o=(u,d,f)=>n.set?n.set(u,d,f):(G(t[a])&&E(u)?u.push(f):u[d]=f,!0);t=N(t);for(var s=i,a=0;a<t.length;a++)if(a<t.length-1){if(!s||!M(s)&&!I(s))return!1;var l=Qt(s,t[a],n);if(!M(l)){if(n.buildTree===!1)return!1;l=I(n.buildTree)?n.buildTree(a):G(t[a+1])?[]:{};var c=o(s,t[a],l);if(!c)return!1}s=l}else return o(s,t[a],e)}var Jt=class{constructor(t,e=!1){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!e&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let e=await t();return this._synthesis--,e}_fulfill(){for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.readCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,e,r){this.onread(()=>{let n=t(r),o=s=>{s!==void 0&&this.onwrite(()=>{let a=e(s,r),l=c=>{c!==void 0&&this.cycle(t,e,c)};a instanceof Promise?a.then(l):l(a)})};n instanceof Promise?n.then(o):o(n)})}};function gr(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Tt(i,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(s=>(s+"").replace("(",r?"(.//":"(./")).join("|");let n=[],o;try{let s=i.document.evaluate(e,t,null,i.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)n.push(o)}catch{}return n}function yr(i,t,e){e=(Array.isArray(e)?e:[e]).map(r=>(r+"").replace("(","(self::")).join("|");try{return i.document.evaluate(`${e}`,t,null,i.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function Yt(i,t,e,r=!1){let n=t.getRootNode(),o=e.getRootNode();return n===o?t.contains(e):r&&o instanceof i.ShadowRoot?Yt(i,t,o.host,r):!1}function br(i,t="|"){return[...i].reduce(([e,r,n,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(s)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!n[0].endsWith("\\")&&(e=e===s?null:e||s),n[0]+=s,[e,r,n]),[null,0,[""]])[2].reverse()}var X=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:gr(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=br(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var wt=class{constructor(t,e,r){this.context=t,this.namespace=e,this.window=t.defaultView||t.ownerDocument?.defaultView||r,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(I(t[0])?t=[[],...t]:T(t[0])&&!(t[0]instanceof X)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[N(t[0],!1),void 0,t[1]]:t[0]=N(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof X)&&!(e instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return t[0]=t[0].map(e=>e instanceof X?e:new X(e)),t}registry(...t){return D("realdom.realtime",this.window,this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,e,r){let{window:n}=this,o=Array.isArray(e)?e:[e],s=new Set;for(let[a,l]of this.registry(t))for(let[c,u]of l){let d=o.filter(f=>Yt(n,c,f.target,a==="cross-roots")?["subtree","cross-roots"].includes(a)||f.target===c:!1);if(!!d.length){Array.isArray(e)||(d=d[0]);for(let f of u)s.add([f,d,c])}}for(let[a,l,c]of[...s].reverse())r.call(n,a,l,c)}disconnectables(t,...e){let r={disconnect(){e.forEach(n=>n&&I(n.disconnect)&&n.disconnect()||I(n)&&n()||T(n)&&(n.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var lt=class extends wt{constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof X;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=vr(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let l of s){let c=a?.generate()||{};e(l,c,o)}else{let l=a?.generate()||{};e(s,l,o)}if(r.live){a&&(r={...r,signalGenerator:a});let l=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,l)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof X;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(n?t[0]:t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:o,window:s,webqit:a}=this;r.eventDetails&&!a.realdom.attrInterceptionHooks?.intercepting&&xr.call(s,"intercept",()=>{});let l=new s.MutationObserver(f=>{f=_r(f).map(p=>Or.call(s,p)),wr.call(s,d,f,o)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(f=>f+"")),l.observe(o,c);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:u,disconnectable:l};return this.disconnectables(r.signal,l,u)}observeSync(t,e,r={}){let n=typeof t=="string"||t instanceof X;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let a=r.timing==="intercept"?"intercept":"sync",l=r.subtree==="cross-roots"?"cross-roots":r.subtree?"subtree":"children";this.registry(a).size||xr.call(s,a,g=>{this.forEachMatchingContext(a,g,wr)});let c={disconnect(){p.delete(d),p.size||f.delete(o)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:u,disconnectable:c},f=this.registry(a,l);f.has(o)||f.set(o,new Set);let p=f.get(o);return p.add(d),this.disconnectables(r.signal,c,u)}};function _r(i){return i.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName||D(e.target,"internalAttrInteractions").get(e.attributeName)?t:t.concat(e),[])}function wr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:l}=i,c=r.map(f=>f+"");if(o.atomic&&!s.size?t=vr(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(f=>c.includes(f.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(f=>{let p;return o.eventDetails||({event:p,...f}=f),!o.oldValue&&"oldValue"in f&&({oldValue:p,...f}=f),!o.newValue&&"value"in f?{value:p,...f}=f:o.newValue&&typeof f.value>"u"&&(f={...f,value:de(f.target,f.name,()=>f.target.getAttribute(f.name))}),f})),o.atomic&&(t.forEach(f=>s.set(f.name,f)),t=Array.from(s.entries()).map(([,f])=>f));let u=a?t[0]:t,d=l?.generate()||{};n(u,d,e)}function de(i,t,e){let r=D(i,"internalAttrInteractions").get(t);D(i,"internalAttrInteractions").set(t,!0);let n=e();return D(i,"internalAttrInteractions").set(t,r),n}function vr(i,t,e=[]){let r={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",e.find(s=>s.name===o)||{target:i,name:o,value:de(i,o,()=>i.getAttribute(o)),...r})):Array.from(i.attributes).map(o=>e.find(s=>s.name===o.nodeName)||{target:i,name:o.nodeName,value:de(i,o.nodeName,()=>o.nodeValue),...r})}function Or({target:i,attributeName:t,value:e,oldValue:r}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(i)||{})[t]?.[0]||"mutation";return{target:i,name:t,value:e,oldValue:r,type:"observation",event:s}}function xr(i,t){let e=this,{webqit:r,document:n,Element:o}=e;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(i)||r.realdom.attrInterceptionHooks.set(i,new Set),r.realdom.attrInterceptionHooks.get(i).add(t);let s=()=>r.realdom.attrInterceptionHooks.get(i).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let a=(u,d)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let f=r.realdom.attrInterceptionRecords.get(u.target);if(f[u.name]=f[u.name]||[],f[u.name].unshift(u.event),D(u.target,"internalAttrInteractions").get(u.name))return d();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([u]));let p=d();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([u])),p};new e.MutationObserver(u=>{u=u.filter(d=>!(e.webqit.realdom.attrInterceptionRecords?.get(d.target)||{})[d.attributeName]?.shift()),u=_r(u).map(d=>Or.call(e,d)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(d=>d(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(d=>d(u)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(u=>{c[u]=o.prototype[u],o.prototype[u]=function(...d){let f,p=de(this,d[0],()=>this.getAttribute(d[0]));["setAttribute","toggleAttribute"].includes(u)&&(f=d[1]),u==="toggleAttribute"&&f===void 0&&(f=p===null);let g={target:this,name:d[0],value:f,oldValue:p,type:"interception",event:[this,u]};return a(g,()=>c[u].call(this,...d))}}),s}var Zt=class extends wt{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new lt(n,o).get(...arguments)}query(t,e=void 0,r={}){[t,e=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,o=new Map,s=c=>(o.has(c)||o.set(c,{target:c,entrants:[],exits:[],type:"query",event:null}),o.get(c));if(!r.generation||r.generation==="entrants"){if(!t.length)[...n.children].forEach(c=>s(n).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,u]=t.reduce(([f,p],g)=>g.kind==="xpath"?[f,p.concat(g)]:[f.concat(g),p],[[],[]]),d=[];r.subtree?(c.length&&d.push(...n.querySelectorAll(c.join(","))),u.length&&d.push(...Tt(this.window,n,u))):(c.length&&d.push(...[...n.children].filter(f=>f.matches(c))),u.length&&d.push(...Tt(this.window,n,u,!1))),d.forEach(f=>s(f.parentNode||n).entrants.push(f))}}if(!e)return o;let a={disconnected:!1},l=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(a.disconnected)break;let u=l?.generate()||{};e(c,u,n)}if(r.live){l&&(r={...r,signalGenerator:l});let c=this.observe(t,e,r);return this.disconnectables(r.signal,a,c)}return this.disconnectables(r.signal,a,l)}children(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!1})}subtree(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!0})}observe(t,e,r={}){if([t,e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:n,window:o,webqit:s,document:a}=this;r.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(a.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&$r.call(o,"sync",()=>{});let l=new o.MutationObserver(d=>d.forEach(f=>{Fe.call(o,u,Ar.call(o,f),n)}));l.observe(n,{childList:!0,subtree:r.subtree&&!0});let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:l};if(r.staticSensitivity){let d=Sr.call(o,u);return this.disconnectables(r.signal,l,c,d)}return this.disconnectables(r.signal,l,c)}observeSync(t,e,r={}){[t,e,r={}]=this.resolveArgs(arguments);let{context:n,window:o}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let s=r.timing==="intercept"?"intercept":"sync",a=r.subtree==="cross-roots"?"cross-roots":r.subtree?"subtree":"children";this.registry(s).size||$r.call(o,s,g=>{this.forEachMatchingContext(s,g,Fe)});let l=new o.MutationObserver(g=>g.forEach(y=>{Array.isArray((y=Ar.call(o,y)).event)||Fe.call(o,d,y,n)}));l.observe(n,{childList:!0,subtree:r.subtree&&!0});let c={disconnect(){l.disconnect(),p.delete(d),p.size||f.delete(n)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),d={context:n,spec:t,callback:e,params:r,signalGenerator:u,disconnectable:c},f=this.registry(s,a);f.has(n)||f.set(n,new Set);let p=f.get(n);if(p.add(d),r.staticSensitivity){let g=Sr.call(o,d);return this.disconnectables(r.signal,c,u,g)}return this.disconnectables(r.signal,c,u)}track(t,e,r={}){return r={subtree:!0,...r},this.observe(t,n=>{n.entrants.length&&e(!0,Array.isArray(t)?n.entrants:n.entrants[0]),n.exits.length&&e(!1,Array.isArray(t)?n.exits:n.exits[0])},r)}};function Sr(i){let t=this,{context:e,spec:r,callback:n,params:o,signalGenerator:s}=i,a=r.filter(p=>p.kind==="css"),l=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],c=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],u=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(l(p)).concat(c(p));if(!(i.$attrs=Array.from(new Set(a.filter(p=>(p+"").includes("[")).reduce((p,g)=>p.concat(u(g+"")),[])))).length)return;let d=new Set,f=new Set;return d.push=p=>(f.delete(p),d.add(p)),f.push=p=>(d.delete(p),f.add(p)),i.$deliveryCache={entrants:d,exits:f},new lt(e,t).observe(i.$attrs,p=>{let g=new Map,y=w=>(g.has(w)||g.set(w,{target:w,entrants:[],exits:[],type:"static",event:null}),g.get(w)),v=new WeakMap,h=w=>(v.has(w)||v.set(w,a.some(O=>w.matches(O+""))),v.get(w));for(let w of p)["entrants","exits"].forEach(O=>{o.generation&&O!==o.generation||i.$deliveryCache[O].has(w.target)||(O==="entrants"?!h(w.target):h(w.target))||(i.$deliveryCache[O].push(w.target),y(w.target)[O].push(w.target),y(w.target).event=w.event)});for(let[,w]of g){let O=s?.generate()||{};n(w,O,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function Fe(i,t){let{context:e,spec:r,callback:n,params:o,signalGenerator:s,$deliveryCache:a}=i,l={...t,entrants:[],exits:[]};if(o.eventDetails||delete l.event,["entrants","exits"].forEach(u=>{if(!(o.generation&&u!==o.generation)&&(r.length?l[u]=Oi.call(this,r,o.subtree==="cross-roots",t[u],t.event!=="parse"):l[u]=[...t[u]],!!a))for(let d of l[u])a[u].push(d)}),!l.entrants.length&&!l.exits.length)return;let c=s?.generate()||{};n(l,c,e)}function Oi(i,t,e,r){e=Array.isArray(e)?e:[...e];let n=(o,s)=>{if(s.type==="selector"){let a=s.isXpathAttr?[]:o.filter(l=>s.kind==="xpath"?yr(this,l,s+""):l.matches&&l.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((l,c)=>s.kind==="xpath"?[...l,...Tt(this,c,s,r)]:c.querySelectorAll?[...l,...c.querySelectorAll(s+"")]:l,a)),a.length)return a}else if(o.includes(s.content)||r&&o.some(a=>Yt(this,a,s.content,t)))return[s.content]};return e.$$searchCache||(e.$$searchCache=new Map),i.reduce((o,s)=>{let a;return e.$$searchCache.has(s.content)?a=e.$$searchCache.get(s.content):(a=n(e,s)||[],s.type==="instance"&&e.$$searchCache.set(s.content,a)),o.concat(a)},[])}function Ar({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=N(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=N(e).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),n),n=n||r.document.readyState==="loading"&&"parse"||"mutation",{target:i,entrants:t,exits:e,type:"observation",event:n}}function $r(i,t){let e=this,{webqit:r,document:n,Node:o,CharacterData:s,Element:a,HTMLElement:l,HTMLTemplateElement:c,DocumentFragment:u}=e;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionNoRecurse||Object.defineProperty(r.realdom,"domInterceptionNoRecurse",{value:new Map}),r.realdom.domInterceptionHooks.has(i)||r.realdom.domInterceptionHooks.set(i,new Set),r.realdom.domInterceptionHooks.get(i).add(t);let d=()=>r.realdom.domInterceptionHooks.get(i).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return d;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let f=(h,w,O)=>{r.realdom.domInterceptionNoRecurse.set(h,w);let _=O();return r.realdom.domInterceptionNoRecurse.delete(h),_},p=(h,w)=>{h.entrants.concat(h.exits).forEach(_=>{clearTimeout(r.realdom.domInterceptionRecords.get(_)?.timeout),r.realdom.domInterceptionRecords.set(_,h.event);let m=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(_)},0);Object.defineProperty(h.event,"timeout",{value:m,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(_=>_(h));let O=w();return r.realdom.domInterceptionHooks.get("sync")?.forEach(_=>_(h)),O},g={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},y={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(g).reduce((h,w)=>h.concat(w),[])).forEach(h=>{Object.keys(g).forEach(_=>{if(!g[_].includes(h))return;let m=Object.getOwnPropertyDescriptor(e[_].prototype,h);!m||(Object.defineProperty(e[_].prototype,h,"value"in m?{...m,value:w}:{...m,set:O}),y[_][h]=m)});function w(..._){let m=Object.keys(y).find(H=>this instanceof e[H]&&h in y[H]),x=y[m],b=()=>x[h].value.call(this,..._);if(r.realdom.domInterceptionNoRecurse.get(this)===h)return b();let $=[],A=[],P=this;["insertBefore"].includes(h)?A=[_[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(h)?(A=[_[1]],["beforebegin","afterend"].includes(_[0])&&(P=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(h)?($=[...this.childNodes],A=h==="replaceChildren"?[..._]:[_[0]]):["replaceWith","remove"].includes(h)?($=[this],A=h==="replaceWith"?[..._]:[],P=this.parentNode):["replaceChild"].includes(h)?($=[_[1]],A=[_[0]]):["removeChild"].includes(h)?$=[..._]:(A=[..._],["before","after"].includes(h)&&(P=this.parentNode));let j=h;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(h)){let H=this.nodeName;if(h==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(_[0])){if(!this.parentNode)return x[h].value.call(this,..._);H=this.parentNode.nodeName}let L=n.createElement(H);x.setHTMLUnsafe.value.call(L,A[0],h==="setHTMLUnsafe"?_[1]:{}),A=[...L.childNodes],h==="insertAdjacentHTML"?(j="insertAdjacentElement",_[1]=new u,f(_[1],"append",()=>_[1].append(...L.childNodes))):(j="replaceChildren",_=[...L.childNodes])}return p({target:P,entrants:A,exits:$,type:"interception",event:[this,h]},()=>x[j].value.call(this,..._))}function O(_){let m=Object.keys(y).find(k=>this instanceof e[k]&&h in y[k]),x=y[m],b=()=>x[h].set.call(this,_);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===h)return b();let $=[],A=[],P=this;if(["outerHTML","outerText"].includes(h)?($=[this],P=this.parentNode):this instanceof c?(P=this.content,$=[...this.content.childNodes]):$=[...this.childNodes],["outerHTML","innerHTML"].includes(h)){let k=this.nodeName;if(h==="outerHTML"){if(!this.parentNode)return b();k=this.parentNode.nodeName}let H=n.createElement(k.includes("-")?"div":k);if(f(H,h,()=>H[h]=_),A=this instanceof c?[...H.content.childNodes]:[...H.childNodes],this instanceof c&&this.hasAttribute("src")){let L=Ot=>Ot.reduce((tt,et)=>et instanceof HTMLScriptElement?tt.concat(et):et instanceof c?tt.concat(L([et.content])):(tt=tt.concat(L([...et.querySelectorAll?.("template")||[]].map(Br=>Br.content))),tt.concat(...et.querySelectorAll?.("script")||[])),[]);for(let Ot of L(A)){let tt=n.createElement("script");[...Ot.attributes].forEach(et=>tt.setAttribute(et.name,et.value)),tt.textContent=Ot.textContent,f(Ot,"replaceWith",()=>Ot.replaceWith(tt))}}h==="outerHTML"?(_=new u,f(_,"append",()=>_.append(...A)),b=()=>f(this,"replaceWith",()=>a.prototype.replaceWith.call(this,_))):this instanceof c?b=()=>f(this.content,"replaceChildren",()=>this.content.replaceChildren(...A)):b=()=>f(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...A))}return p({target:P,entrants:A,exits:$,type:"interception",event:[this,h]},b)}}),d}function Er(){Si.call(this),Ai.call(this),$i.call(this)}function Si(){let i=this;i.CSS||(i.CSS={}),i.CSS.escape||(i.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function Ai(){let i=this;"isConnected"in i.Node.prototype||Object.defineProperty(i.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function $i(){let i=this;i.Element.prototype.matches||(i.Element.prototype.matches=i.Element.prototype.matchesSelector||i.Element.prototype.mozMatchesSelector||i.Element.prototype.msMatchesSelector||i.Element.prototype.oMatchesSelector||i.Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}function Cr(){let i=this;if(i.webqit||(i.webqit={}),i.webqit.realdom)return i.webqit.realdom;i.webqit.realdom={},Er.call(i),i.webqit.realdom.meta=(...e)=>Ei.call(i,...e),i.webqit.realdom.ready=(...e)=>We.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new Zt(e,i);if(r==="attr")return new lt(e,i)};let t=new Jt(i);return i.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),i.webqit.realdom.synthesizeWhile=(...e)=>t.synthesizeWhile(...e),i.webqit.realdom}function We(...i){let t="interactive",e;$t(i[0])?(t=i[0],I(i[1])&&(e=i[1])):I(i[0])&&(e=i[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let n=this;if(!e)return n.webqit.realdom.readyStatePromises||(n.webqit.realdom.readyStatePromises={interactive:new Promise(o=>We.call(this,"interactive",o)),complete:new Promise(o=>We.call(this,"complete",o))}),n.webqit.realdom.readyStatePromises[t];if(r[t].includes(n.document.readyState))return e(n);n.webqit.realdom.readyStateCallbacks||(n.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},n.document.addEventListener("readystatechange",()=>{let o=n.document.readyState;for(let s of n.webqit.realdom.readyStateCallbacks[o].splice(0))s(n)},!1)),n.webqit.realdom.readyStateCallbacks[t].push(e)}function Ei(i){let t=this,e={},r;return(r=t.document.querySelector(`meta[name="${i}"]`))&&(e=(r.content||"").split(";").filter(n=>n).reduce((n,o)=>{let s=o.split("=").map(a=>a.trim());return Le(n,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:G(s[1])?parseInt(s[1]):s[1]),n},{})),{get name(){return i},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}function pe(i,t){return typeof i!="string"?i:i.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+(typeof t!==void 0&&t?e.substr(1).toLowerCase():e.substr(1))})}var S=(...i)=>D("oohtml",...i),R={};function B(i,t,e){let r=this,n=Cr.call(r);R.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let s=r.webqit.oohtml.configs[o];Dt(2,s,e,t,n.meta(i).json()),r.webqitConfig.prefix&&Object.keys(s).forEach(a=>{Object.keys(s[a]).forEach(l=>{a==="api"&&typeof s[a][l]=="string"?s[a][l]=`${r.webqitConfig.prefix}${pe(s[a][l])}`:["attr","elements"].includes(a)&&s[a][l]?.startsWith("data-")===!1&&(s[a][l]=`${r.webqitConfig.prefix}-${s[a][l]}`)})})}return{config:r.webqit.oohtml.configs[o],realdom:n,window:r}}function Be(i,t){return D(i,"internalAttrInteractions").get(t)}function Tr(i,t,e){let r=D(i,"internalAttrInteractions").get(t);D(i,"internalAttrInteractions").set(t,!0);let n=e();return D(i,"internalAttrInteractions").set(t,r),n}function It(i,t){return[...i].reduce(([e,r,n],o)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(o)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(o)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(o)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(o)&&!n[0].endsWith("\\")&&(e=e===o?null:e||o),n[0]+=o,[e,r,n]),[null,0,[""]])[2].reverse()}var Ti=()=>(0|Math.random()*9e6).toString(36),Ve=new Map;function xt(i){let t;return(t=Ve.get(i))||(t=Ti(),Ve.set(i,t)),t}function he(i){let t;return Ve.forEach((e,r)=>{e===i&&(t=r)}),t}function me(){let{window:i}=R,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=n.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let a=["contextrequest","contextclaim"],l=n.pop()||a[0];if(!a.includes(l))throw new Error(`Invalid event type. Must be one of: ${a.join(",")}`);let{kind:c,detail:u,targetContext:d,live:f,signal:p,diff:g,...y}=s;super(l,{...y,bubbles:y.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>c}),Object.defineProperty(this,"targetContext",{get:()=>d}),Object.defineProperty(this,"detail",{get:()=>u}),Object.defineProperty(this,"live",{get:()=>f}),Object.defineProperty(this,"signal",{get:()=>p}),Object.defineProperty(this,"diff",{get:()=>g}),Object.defineProperty(this,"options",{get:()=>y}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(n){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===n)return;Object.defineProperty(this,"_prevValue",{value:n,configurable:!0})}return this.callback(n)}}return t.DOMContextRequestEvent=e,e}var _t=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=R;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var vt=class extends Error{};var Kt=new Map,ut=class{static instance(t){return S(t).get("contexts::instance")||new this(t)}constructor(t){S(t).get("contexts::instance")?.dispose(),S(t).set("contexts::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e})}get[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(e=>typeof t[0]=="function"?t[0](e):e.constructor.kind===t[0]&&(t.length===1||e.detail===t[1]))}attach(t){if(!(t instanceof z))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new vt(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new _t((e,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(e):t[t.length-1]=e);let n;(n=t.find(l=>typeof l=="object"&&l))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(me())(...t);o.meta.target=this["#"].host;let s=this["#"].host.getRootNode(),a=l=>{if(l.stopImmediatePropagation(),l.meta.target=l.target,!l.answered){if(Kt.get(s)||Kt.set(s,new Set),l.type==="contextrequest"&&l.live)Kt.get(s).add(l);else if(l.type==="contextclaim"){let c=new Set;return Kt.get(s).forEach(u=>{!this["#"].host.contains(u.target)||!l.detail.matchEvent(u)||(Kt.get(s).delete(u),c.add(u))}),l.respondWith(c)}}};s.addEventListener(o.type,a),this["#"].host.dispatchEvent(o),s.removeEventListener(o.type,a)})}};var ze=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=R;return t}get name(){return[R.window.Document,R.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof ze)||t.target===this.host)return;let e=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),e.add(r))}),e.size)return t.respondWith(e)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:e}=ut.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return e?.forEach(r=>{this.subscriptions.add(r),this.subscribed(r),this.handle(r)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(e=>{this.subscriptions.delete(e),this.unsubscribed(e);let{target:r}=e;r.dispatchEvent(e)}),this}},z=ze;F(z,"kind");var Mt=class extends z{static createRequest(t=null){let e=super.createRequest();if(t?.startsWith("@")){let[r,...n]=n.slice(1).split("/").map(o=>o.trim());e.targetContext=r,e.detail=n.join("/")}else e.detail=t;return e}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:e}}}=R;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(e.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(n=>n.trim()).filter(n=>n);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=e.reduce(this.namespaceObj,r,e.get,n=>{this.disposed||t.respondWith(n.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};F(Mt,"kind","namespace");function Ue(i={}){let{config:t,window:e}=B.call(this,"namespaced-html",i,{attr:{namespace:"namespace",lid:"id"},api:{namespace:"namespace"},tokens:{lidrefPrefix:"~",lidrefSeparator:":"},target:{className:":target",eventName:":target",scrolling:!0}});t.lidSelector=`[${e.CSS.escape(t.attr.lid)}]`,t.namespaceSelector=`[${e.CSS.escape(t.attr.namespace)}]`,e.webqit.DOMNamingContext=Mt,Ii.call(e,t),Mi.call(e,t)}function Ir(i){let{lidrefPrefix:t,lidrefSeparator:e}=i.tokens;return{escape(r,n=1){return[...r].map(o=>/\w/.test(o)?o:n===2?`\\\\${o}`:`\\${o}`).join("")},lidrefPrefix(r=0){return r?this.escape(t,r):t},lidrefSeparator(r=0){return r?this.escape(e,r):e},isUuid(r,n=0){return r.startsWith(this.lidrefPrefix(n))&&r.includes(this.lidrefSeparator(n))},isLidref(r,n=0){return r.startsWith(this.lidrefPrefix(n))&&!r.includes(this.lidrefSeparator(n))},toUuid(r,n,o=0){return r.endsWith("-root")?n:`${this.lidrefPrefix(o)}${r}${this.lidrefSeparator(o)}${n}`},uuidToId(r,n=0){return this.isUuid(r)?r.split(this.lidrefSeparator(n))[1]:r},uuidToLidref(r,n=0){return this.isUuid(r)?`${this.lidrefPrefix(n)}${r.split(this.lidrefSeparator(n))[1]}`:r}}}function Ge(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,s=Ir(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[l,c]=It(i,",").reduce(([d,f],p)=>{let g,y;return p=p.replace(a,(v,h,w,O,_)=>{if(g||(g=[...p.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),g.some($=>_>$.index&&_+v.length<$.index+$[0].length))return v;if(v===":scope")return y=!0,e;let m=h&&!w;if(h&&w)return`#${s.escape(v.replace("#",""),1)}`;if(m&&o.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${s.toUuid(t,O,1)}`;let b;return o.attr.lid==="id"?b=`:is(#${O},[id^="${s.lidrefPrefix(r)}"][id$="${s.lidrefSeparator(r)}${O}"])`:b=`:is(#${O},[${n.CSS.escape(o.attr.lid)}="${O}"])`,m?`:is(${b}):not(${e?e+" ":""}${o.namespaceSelector} *)`:b}),y?[d,f.concat(p)]:[d.concat(p),f]},[[],[]]),u;return e&&l.length?u=[l.length>1?`${e} :is(${l.join(", ")})`:`${e} ${l[0]}`,c.join(", ")].filter(d=>d).join(", "):u=[...l,...c].join(", "),u}function ge(i){let t=this;if(!S(i).has("namespace")){let e=Object.create(null);S(i).set("namespace",e);let r=[t.Document,t.ShadowRoot].some(n=>i instanceof n);Object.defineProperty(e,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return S(i).get("namespace")}function qt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return ge.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function ye(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(he(i)||xt(i))+(t?"-root":"")}function Ii(i){let t=this,{webqit:{Observer:e}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let n=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.namespace in r)throw new Error(`The ${n} prototype already has a "${i.api.namespace}" API!`);Object.defineProperty(r,i.api.namespace,{get:function(){return e.proxy(ge.call(t,this))}})})}function Mi(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},DOMNamingContext:o}}=t,s=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],a=["for","list","form","aria-activedescendant","aria-details","aria-errormessage"],l=[i.attr.lid,...s,...a],c={id:"id",for:"htmlFor","aria-owns":"ariaOwns","aria-controls":"ariaControls","aria-labelledby":"ariaLabelledBy","aria-describedby":"ariaDescribedBy","aria-flowto":"ariaFlowto","aria-activedescendant":"ariaActiveDescendant","aria-details":"ariaDetails","aria-errormessage":"ariaErrorMessage"},u=Ir(i),d=(m,x,b)=>{if(!Be(m,x)&&S(m,"attrOriginals").has(x))return S(m,"attrOriginals").get(x);let $=b();return Be(m,x)?$:$&&$.split(" ").map(A=>(A=A.trim())&&(x===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,A)).join(" ")},f=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...f,value(m){return this.querySelector(`#${m}`)}});for(let m of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let x=Object.getOwnPropertyDescriptor(nodeApi.prototype,m);Object.defineProperty(nodeApi.prototype,m,{...x,value(b){return x.value.call(this,Ge.call(t,b,ye(ge.call(t,this))))}})}let p=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...p,value(m){let x=()=>p.value.call(this,m);return l.includes(m)&&!S(this,"lock").get(m)?d(this,m,x):x()}});let g=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...g,get(){let m=()=>g.get.call(this);return l.includes(this.name)?d(this.ownerElement,this.name,m):m()}});let y=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...y,get(){let m=()=>y.get.call(this);return this instanceof t.Attr&&l.includes(this.name)?d(this.ownerElement,this.name,m):m()}});for(let m of l){if(!(m in c))continue;let x=m==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let b of x){let $=Object.getOwnPropertyDescriptor(b.prototype,c[m]);!$||Object.defineProperty(b.prototype,c[m],{...$,get(){return d(this,m,()=>$.get.call(this,m))}})}}i.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,i.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(i.attr.lid)},set(m){return this.setAttribute(i.attr.lid,m)}});let v=(m,x,b,$)=>Tr(m,x,()=>(typeof b=="function"&&(b=b()),$(b))),h=(m,x,b,$=null)=>{v(m,x,b,A=>{let P=x===i.attr.lid,j=$||qt.call(t,m,P),k=ye(j);if(P){let H=u.uuidToId(A);if(e.get(j,H)!==m){let L=u.toUuid(k,H);L!==A&&m.setAttribute("id",L),e.set(j,H,m)}}else{S(m,"attrOriginals").set(x,A);let H=A.split(" ").map(L=>(L=L.trim())&&!u.isLidref(L)?L:u.toUuid(k,L.replace(u.lidrefPrefix(),""))).join(" ");m.setAttribute(x,H),S(j).set("idrefs",S(j).get("idrefs")||new Set),S(j).get("idrefs").add(m)}})},w=(m,x,b,$=null)=>{v(m,x,b,A=>{let P=x===i.attr.lid,j=$||qt.call(t,m,P);if(P){let k=u.uuidToId(A);e.get(j,k)===m&&e.deleteProperty(j,k)}else{let k=S(m,"attrOriginals").get(x);m.setAttribute(x,k),S(j).get("idrefs")?.delete(m)}})};r.realtime(t.document).query(i.namespaceSelector,m=>{let x=(b,$,A,P)=>{if(!b.hasAttribute($))return;let j=()=>b.getAttribute($);w(b,$,j,A),b.isConnected&&h(b,$,S(b,"attrOriginals").get($)||j,P)};m.exits.forEach(b=>{if(b.isConnected){let P=ge.call(t,b);for(let j of new Set([...Object.values(P),...S(P).get("idrefs")||[]]))for(let k of l)x(j,k,P)}let $=b[n.CONTEXT_API.api.contexts],A=$.find(o.kind);A&&$.detach(A)}),m.entrants.forEach(b=>{let $,A=qt.call(t,b,!0);for(let j of new Set([...Object.values(A),...S(A).get("idrefs")||[]]))if(($=qt.call(t,j,!0))!==A)for(let k of l)x(j,k,A,$);let P=b[n.CONTEXT_API.api.contexts];P.find(o.kind)||P.attach(new o)})},{live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${l.map(m=>t.CSS.escape(m)).join("],[")}]`,m=>{let x={forID:new Map,forOther:new Map};for(let b of l){let $=b===i.attr.lid?x.forID:x.forOther;m.exits.forEach(A=>{if(!A.hasAttribute(b))return;let P=$.get(A);typeof P>"u"&&(P=(b===i.attr.lid?A.parentNode:A)?.closest?.(i.namespaceSelector)||A.getRootNode().host,$.set(A,P)),!(P&&!P.isConnected)&&w(A,b,()=>A.getAttribute(b))}),m.entrants.forEach(A=>{!A.hasAttribute(b)||h(A,b,()=>A.getAttribute(b))})}x.forID.clear(),x.forOther.clear()},{live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(l,m=>{for(let x of m)x.oldValue&&w(x.target,x.name,x.oldValue),x.value&&h(x.target,x.name,x.value)},{subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let O,_=()=>{if(!t.location.hash?.startsWith(`#${u.lidrefPrefix()}`))return;let m=t.location.hash?.substring(`#${u.lidrefPrefix()}`.length).split("/").map(b=>b.trim()).filter(b=>b)||[],x=m.reduce((b,$)=>b&&b[i.api.namespace][$],t.document);O&&i.target.className&&O.classList.toggle(i.target.className,!1),x&&x!==t.document&&(i.target.className&&x.classList.toggle(i.target.className,!0),i.target.eventName&&x.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&m.length>1&&x.scrollIntoView(),O=x)};t.addEventListener("hashchange",_),r.ready(_)}function Xe({advanced:i={},...t}){let{config:e,window:r}=B.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:le(i)});e.scriptSelector=(Array.isArray(e.script.mimeTypes)?e.script.mimeTypes:e.script.mimeTypes.split("|")).concat("").reduce((n,o)=>{let s=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`script${s}`)},[]).join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:ji.bind(r,e)},qi.call(r,e),Ri.call(r,e)}function qi(i){let t=this,e=new Map;if(i.api.scripts in t.Element.prototype)throw new Error(`The "Element" class already has a "${i.api.scripts}" property!`);Object.defineProperty(t.Element.prototype,i.api.scripts,{get:function(){return e.has(this)||e.set(this,[]),e.get(this)}}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}},quantum:{configurable:!0,get(){return this.hasAttribute("quantum")},set(r){this.toggleAttribute("quantum",r)}}})}async function ji(i,t){let e=this,{realdom:r}=e.webqit,n=he(t);if(!n)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:s,thisContext:a}=n;i.script.retention==="dispose"?o.remove():i.script.retention==="hidden"?o.textContent='"source hidden"':o.textContent=await s.toString();let l=o.scoped?a:o.getRootNode();S(l).has("scriptEnv")||S(l).set("scriptEnv",Object.create(null));let c=await(await s.bind(a,S(l).get("scriptEnv"))).execute();o.quantum&&Object.defineProperty(o,"state",{value:c}),r.realtime(e.document).observe(o,()=>{o.quantum&&c.dispose(),a instanceof e.Element&&a[i.api.scripts]?.splice(a[i.api.scripts].indexOf(o,1))},{subtree:"cross-roots",timing:"sync",generation:"exits"})}function Ri(i){let t=this,{webqit:{oohtml:e,realdom:r}}=t;t.HTMLScriptElement.supports||(t.HTMLScriptElement.supports=o=>["text/javascript","application/javascript"].includes(o));let n=new WeakSet;r.realtime(t.document).query(i.scriptSelector,o=>{o.entrants.forEach(s=>{if(n.has(s))return;let a=Mr.call(t,i,s);if(!a)return;n.add(s);let l=s.scoped?s.parentNode||o.target:s.type==="module"?void 0:t;s.scoped&&l[i.api.scripts].push(s);let c=xt({script:s,compiledScript:a,thisContext:l});o.type==="query"||s.type&&!t.HTMLScriptElement.supports(s.type)||i.script.timing==="manual"?e.Script.execute(c):s.textContent=`webqit.oohtml.Script.execute( '${c}' );`})},{live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function Mr(i,t){let e=this,{webqit:{oohtml:r,QuantumScript:n,AsyncQuantumScript:o,QuantumModule:s}}=e,a=(t._=t.textContent.trim())&&t._.startsWith("/*@oohtml*/if(false){")&&t._.endsWith("}/*@oohtml*/")?t._.slice(21,-12):t.textContent;if(!a.trim().length)return;let l=xt(a),c=r.Script.compileCache[t.quantum?0:1],u;if(!(u=c.get(l))){let{parserParams:d,compilerParams:f,runtimeParams:p}=i.advanced;u=new(t.type==="module"?s:n||o)(a,{exportNamespace:`#${t.id}`,fileName:`${e.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:{...d,quantumMode:t.quantum},compilerParams:f,runtimeParams:p}),c.set(l,u)}return u}function qr(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{Mr.call(t,e,r)})}function Ye(i={}){let{config:t,window:e}=B.call(this,"data-binding",i,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"}});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=e.webqit.oohtml.configs),t.attrSelector=`[${e.CSS.escape(t.attr.render)}]`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,Ni.call(e,t)}function Ni(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(`(${i.discreteBindingsSelector})`,r=>{jr.call(this,...r.exits),ki.call(t,i,...r.entrants)},{live:!0,subtree:"cross-roots",timing:"sync"}),e.realtime(t.document).query(i.attrSelector,r=>{jr.call(this,...r.exits),Di.call(t,i,...r.entrants)},{live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0})}function Rr(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(S(t).has("data-binding"))return S(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(l,c,...u)=>{let d=()=>{try{l[c](...u)}catch(f){console.error(`Error executing "${c}": ${f.message} at ${f.cause}`)}};e.schedule("write",d)},o.$assign__=(l,c,u)=>{let d=()=>{try{l[c]=u}catch(f){console.error(`${f.message} at ${f.cause}`)}};e.schedule("write",d)},r.intercept(o,{get:(l,c,u)=>{if(!(l.key in o)){let d={...n.createRequest(l.key),live:!0,signal:s.signal};t[i.CONTEXT_API.api.contexts].request(d,f=>{r.set(o,l.key,f)})}return u(o[l.key]??(l.key in globalThis?globalThis[l.key]:void 0))},has:(l,c,u)=>u(!0)});let a={scope:o,abortController:s,bindings:new Map};return S(t).set("data-binding",a),a}function jr(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=S(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals?.forEach(o=>o.abort()),r.delete(t),r.size||(n.abort(),S(e).delete("data-binding"))}}function Nr(i,t){let e=i.tokens.tagStart.split("").map(c=>`\\${c}`).join(""),r=i.tokens.tagEnd.split("").map(c=>`\\${c}`).join(""),n=i.tokens.stateStart.split("").map(c=>c===" "?"(?:\\s+)?":`\\${c}`).join(""),o=i.tokens.stateEnd.split("").map(c=>`\\${c}`).join(""),s=`^${e}(.*?)(?:${n}(\\d+)${o}(?:\\s+)?)?${r}$`,[,a,l]=t.match(new RegExp(s));return{raw:t,expr:a,span:parseInt(l??0)}}async function ki(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let s=Nr(i,o.nodeValue),a=o;if(s.span){if(a=o.nextSibling,a?.nodeName!=="#text"||a.nodeValue.length<s.span)return n;a.nodeValue.length>s.span&&a.splitText(s.span)}else a=o.ownerDocument.createTextNode(""),o.after(a);a.isBound=!0;let l=o;return e.webqit.env!=="server"&&(l.remove(),l=null),n.concat({textNode:a,template:s,anchorNode:l})},[]);for(let{textNode:n,template:o,anchorNode:s}of r){let a=kr.call(e,i,o.expr),{scope:l,bindings:c}=Rr.call(this,i,n.parentNode);Object.defineProperty(n,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{c.set(n,{state:await(await a.bind(n,l)).execute()})}catch(u){console.log(u)}}}var Qe=new Map;function kr(i,t){if(Qe.has(t))return Qe.get(t);let e=`let content = ((${t}) ?? '') + '';`;e+="$assign__(this, 'nodeValue', content);",e+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${i.tokens.tagStart}${jt(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,n=new r(e);return Qe.set(t,n),n}async function Di(i,...t){for(let e of t){let r=Dr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=Rr.call(this,i,e),s=[];Object.defineProperty(e,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(e,{signals:s,state:await(await r.bind(e,n)).execute()})}catch(a){console.log(a)}}}var Je=new Map;function Dr(i,t){if(Je.has(t))return Je.get(t);let e={},r=It(t,";").map(s=>{let[a,l]=It(s,":").map(p=>p.trim()),c=a[0],u=a.slice(1).trim(),d=`(${l})`,f=`(${d} ?? '')`;if(c==="&")return u.startsWith("--")?`$exec__(this.style, 'setProperty', "${jt(u)}", ${f});`:`$assign__(this.style, "${jt(u)}", ${f});`;if(c==="%")return`$exec__(this.classList, 'toggle', "${jt(u)}", !!${d});`;if(c==="~")return u.startsWith("?")?`$exec__(this, 'toggleAttribute', "${jt(u.substring(1).trim())}", !!${d});`:`$exec__(this, 'setAttribute', "${jt(u)}", ${f});`;if(c==="#"){if(e[u])throw new Error(`Duplicate binding: ${a}.`);if(e[u]=!0,u==="text")return`$assign__(this, 'textContent', ${f});`;if(u==="html")return`$exec__(this, 'setHTMLUnsafe', ${f});`;if(u==="items"){let[p,g]=It(l,"/");if(!g)throw new Error(`Invalid ${c}items spec: ${s}; no import specifier.`);let[y,v,h,w]=p.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!y)throw new Error(`Invalid ${c}items spec: ${s}.`);if(v.startsWith("(")?v=v.trim().slice(1,-1).split(",").map(_=>_.trim()):v=[v],v.length>(h==="in"?3:2))throw new Error(`Invalid ${c}items spec: ${s}.`);let O=h==="in"?v[2]:v[1]||"$index__";return`
|
|
17
17
|
let $iteratee__ = ${w};
|
|
18
18
|
let $import__ = this.${i.HTML_IMPORTS.api.import}( ${g.trim()}, true );
|
|
19
19
|
this.$oohtml_internal_databinding_signals?.push( $import__ );
|