@webqit/oohtml 4.3.7 → 4.3.8
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/bindings-api.js +1 -1
- package/dist/bindings-api.js.map +2 -2
- package/dist/context-api.js +1 -1
- package/dist/context-api.js.map +2 -2
- package/dist/data-binding.js +1 -1
- package/dist/data-binding.js.map +2 -2
- package/dist/html-imports.js +1 -1
- package/dist/html-imports.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/dist/namespaced-html.js +1 -1
- package/dist/namespaced-html.js.map +2 -2
- package/dist/scoped-css.js +1 -1
- package/dist/scoped-css.js.map +2 -2
- package/package.json +1 -1
- package/src/context-api/DOMContexts.js +1 -1
- package/src/data-binding/index.js +7 -3
package/dist/main.lite.js
CHANGED
|
@@ -13,7 +13,7 @@ ${h}
|
|
|
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 Jt(i,t,e={},r={}){t=k(t).slice();for(var n=i;!it(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,f,d)=>n.set?n.set(u,f,d):(G(t[a])&&$(u)?u.push(d):u[f]=d,!0);t=k(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=Jt(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 Yt=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 yr(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Mt(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 br(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 Zt(i,t,e,r=!1,n=null){let o=n?.get(t)?.get(e);if(typeof o<"u")return o;let s=c=>(n?.has(t)||n?.set(t,new WeakMap),n?.get(t)?.set(e,c),c),a=t.getRootNode(),l=e.getRootNode();return a===l?s(t.contains(e)):r&&l instanceof i.ShadowRoot?s(Zt(i,t,l.host,r,n)):s(!1)}function wr(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 Q=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:yr(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=wr(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var _t=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 Q)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[k(t[0],!1),void 0,t[1]]:t[0]=k(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof Q)&&!(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 Q?e:new Q(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=new Set,s=new WeakMap;for(let[a,l]of this.registry(t)){let c=[].concat(e).filter(f=>Zt(n,a.context,f.target,a.params.subtree==="cross-roots",s));if(!c.length)continue;let u=[a,Array.isArray(e)?c:c[0]];l?o.add(u):r.call(n,...u)}for(let a of o)r.call(n,...a);o.clear()}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 ut=class extends _t{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof Q;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=Or(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 Q;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&&_r.call(s,"intercept",()=>{});let l=new s.MutationObserver(d=>{d=vr(d).map(p=>Sr.call(s,p)),xr.call(s,f,d,o)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(d=>d+"")),l.observe(o,c);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),f={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 Q;[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";this.registry(a).size||_r.call(s,a,d=>{this.forEachMatchingContext(a,d,xr)});let l={disconnect(){f.delete(u)}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:c,disconnectable:l},f=this.registry(a);return f.set(u,!!u.params.deferred),this.disconnectables(r.signal,l,c)}};function vr(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 xr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:l}=i,c=r.map(d=>d+"");if(o.atomic&&!s.size?t=Or(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(d=>c.includes(d.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(d=>{let p;return o.eventDetails||({event:p,...d}=d),!o.oldValue&&"oldValue"in d&&({oldValue:p,...d}=d),!o.newValue&&"value"in d?{value:p,...d}=d:o.newValue&&typeof d.value>"u"&&(d={...d,value:fe(d.target,d.name,()=>d.target.getAttribute(d.name))}),d})),o.atomic&&(t.forEach(d=>s.set(d.name,d)),t=Array.from(s.entries()).map(([,d])=>d));let u=a?t[0]:t,f=l?.generate()||{};n(u,f,e)}function fe(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 Or(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:fe(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:fe(i,o.nodeName,()=>o.nodeValue),...r})}function Sr({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 _r(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,f)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let d=r.realdom.attrInterceptionRecords.get(u.target);if(d[u.name]=d[u.name]||[],d[u.name].unshift(u.event),D(u.target,"internalAttrInteractions").get(u.name))return f();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(h=>h([u]));let p=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(h=>h([u])),p};new e.MutationObserver(u=>{u=u.filter(f=>!(e.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),u=vr(u).map(f=>Sr.call(e,f)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(f=>f(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(f=>f(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(...f){let d,p=fe(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(u)&&(d=f[1]),u==="toggleAttribute"&&d===void 0&&(d=p===null);let h={target:this,name:f[0],value:d,oldValue:p,type:"interception",event:[this,u]};return a(h,()=>c[u].call(this,...f))}}),s}var Kt=class extends _t{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new ut(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(([d,p],h)=>h.kind==="xpath"?[d,p.concat(h)]:[d.concat(h),p],[[],[]]),f=[];r.subtree?(c.length&&f.push(...n.querySelectorAll(c.join(","))),u.length&&f.push(...Mt(this.window,n,u))):(c.length&&f.push(...[...n.children].filter(d=>d.matches(c))),u.length&&f.push(...Mt(this.window,n,u,!1))),f.forEach(d=>s(d.parentNode||n).entrants.push(d))}}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(f=>f.forEach(d=>{Fe.call(o,u,Er.call(o,d),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 f=Ar.call(o,u);return this.disconnectables(r.signal,l,c,f)}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";this.registry(s).size||$r.call(o,s,d=>{this.forEachMatchingContext(s,d,Fe)});let a=new o.MutationObserver(d=>d.forEach(p=>{Array.isArray((p=Er.call(o,p)).event)||Fe.call(o,u,p,n)}));a.observe(n,{childList:!0,subtree:r.subtree&&!0});let l={disconnect(){f.delete(u),a.disconnect()}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:l},f=this.registry(s);if(f.set(u,!!u.params.deferred),r.staticSensitivity){let d=Ar.call(o,u);return this.disconnectables(r.signal,l,c,d)}return this.disconnectables(r.signal,l,c)}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 Ar(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(h=>h[1]).concat(l(p)).concat(c(p));if(!(i.$attrs=Array.from(new Set(a.filter(p=>(p+"").includes("[")).reduce((p,h)=>p.concat(u(h+"")),[])))).length)return;let f=new Set,d=new Set;return f.push=p=>(d.delete(p),f.add(p)),d.push=p=>(f.delete(p),d.add(p)),i.$deliveryCache={entrants:f,exits:d},new ut(e,t).observe(i.$attrs,p=>{let h=new Map,x=_=>(h.has(_)||h.set(_,{target:_,entrants:[],exits:[],type:"static",event:null}),h.get(_)),S=new WeakMap,g=_=>(S.has(_)||S.set(_,a.some(O=>_.matches(O+""))),S.get(_));for(let _ of p)["entrants","exits"].forEach(O=>{o.generation&&O!==o.generation||i.$deliveryCache[O].has(_.target)||(O==="entrants"?!g(_.target):g(_.target))||(i.$deliveryCache[O].push(_.target),x(_.target)[O].push(_.target),x(_.target).event=_.event)});for(let[,_]of h){let O=s?.generate()||{};n(_,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 f of l[u])a[u].push(f)}),!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"?br(this,l,s+""):l.matches&&l.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((l,c)=>s.kind==="xpath"?[...l,...Mt(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=>Zt(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 Er({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=k(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=k(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 f=()=>r.realdom.domInterceptionHooks.get(i).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return f;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let d=(g,_,O)=>{r.realdom.domInterceptionNoRecurse.set(g,_);let y=O();return r.realdom.domInterceptionNoRecurse.delete(g),y},p=(g,_)=>{g.entrants.concat(g.exits).forEach(y=>{clearTimeout(r.realdom.domInterceptionRecords.get(y)?.timeout),r.realdom.domInterceptionRecords.set(y,g.event);let m=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(y)},0);Object.defineProperty(g.event,"timeout",{value:m,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(y=>y(g));let O=_();return r.realdom.domInterceptionHooks.get("sync")?.forEach(y=>y(g)),O},h={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"]},x={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(h).reduce((g,_)=>g.concat(_),[])).forEach(g=>{Object.keys(h).forEach(y=>{if(!h[y].includes(g))return;let m=Object.getOwnPropertyDescriptor(e[y].prototype,g);!m||(Object.defineProperty(e[y].prototype,g,"value"in m?{...m,value:_}:{...m,set:O}),x[y][g]=m)});function _(...y){let m=Object.keys(x).find(L=>this instanceof e[L]&&g in x[L]),w=x[m],b=()=>w[g].value.call(this,...y);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let E=[],A=[],C=this;["insertBefore"].includes(g)?A=[y[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?(A=[y[1]],["beforebegin","afterend"].includes(y[0])&&(C=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?(E=[...this.childNodes],A=g==="replaceChildren"?[...y]:[y[0]]):["replaceWith","remove"].includes(g)?(E=[this],A=g==="replaceWith"?[...y]:[],C=this.parentNode):["replaceChild"].includes(g)?(E=[y[1]],A=[y[0]]):["removeChild"].includes(g)?E=[...y]:(A=[...y],["before","after"].includes(g)&&(C=this.parentNode));let j=g;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(g)){let L=this.nodeName;if(g==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(y[0])){if(!this.parentNode)return w[g].value.call(this,...y);L=this.parentNode.nodeName}let H=n.createElement(L.includes("-")?"div":L);w.setHTMLUnsafe.value.call(H,A[0],g==="setHTMLUnsafe"?y[1]:{}),A=[...H.childNodes],g==="insertAdjacentHTML"?(j="insertAdjacentElement",y[1]=new u,d(y[1],"append",()=>y[1].append(...H.childNodes))):(j="replaceChildren",y=[...H.childNodes])}return p({target:C,entrants:A,exits:E,type:"interception",event:[this,g]},()=>w[j].value.call(this,...y))}function O(y){let m=Object.keys(x).find(N=>this instanceof e[N]&&g in x[N]),w=x[m],b=()=>w[g].set.call(this,y);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let E=[],A=[],C=this;if(["outerHTML","outerText"].includes(g)?(E=[this],C=this.parentNode):this instanceof c?(C=this.content,E=[...this.content.childNodes]):E=[...this.childNodes],["outerHTML","innerHTML"].includes(g)){let N=this.nodeName;if(g==="outerHTML"){if(!this.parentNode)return b();N=this.parentNode.nodeName}let L=n.createElement(N.includes("-")?"div":N);if(d(L,g,()=>L[g]=y),A=this instanceof c?[...L.content.childNodes]:[...L.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let H=dt=>dt.reduce((et,rt)=>rt instanceof HTMLScriptElement?et.concat(rt):rt instanceof c?et.concat(H([rt.content])):(et=et.concat(H([...rt.querySelectorAll?.("template")||[]].map(Br=>Br.content))),et.concat(...rt.querySelectorAll?.("script")||[])),[]);for(let dt of H(A)){if(this instanceof ShadowRoot){dt.setAttribute("data-handling","manual");continue}let et=n.createElement("script");[...dt.attributes].forEach(rt=>et.setAttribute(rt.name,rt.value)),et.textContent=dt.textContent,d(dt,"replaceWith",()=>dt.replaceWith(et))}}g==="outerHTML"?(y=new u,d(y,"append",()=>y.append(...A)),b=()=>d(this,"replaceWith",()=>a.prototype.replaceWith.call(this,y))):this instanceof c?b=()=>d(this.content,"replaceChildren",()=>this.content.replaceChildren(...A)):b=()=>d(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...A))}return p({target:C,entrants:A,exits:E,type:"interception",event:[this,g]},b)}}),f}function Pr(){Si.call(this),Ai.call(this),Ei.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 Ei(){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={},Pr.call(i),i.webqit.realdom.meta=(...e)=>$i.call(i,...e),i.webqit.realdom.ready=(...e)=>We.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new Kt(e,i);if(r==="attr")return new ut(e,i)};let t=new Yt(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 $i(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 de(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 v=(...i)=>D("oohtml",...i),q={};function B(i,t,e){let r=this,n=Cr.call(r);q.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];Lt(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}${de(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 Ir(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 st(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 vt(i){let t;return(t=Ve.get(i))||(t=Ti(),Ve.set(i,t)),t}function pe(i){let t;return Ve.forEach((e,r)=>{e===i&&(t=r)}),t}function me(){let{window:i}=q,{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:f,live:d,signal:p,diff:h,...x}=s;super(l,{...x,bubbles:x.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>c}),Object.defineProperty(this,"targetContext",{get:()=>f}),Object.defineProperty(this,"detail",{get:()=>u}),Object.defineProperty(this,"live",{get:()=>d}),Object.defineProperty(this,"signal",{get:()=>p}),Object.defineProperty(this,"diff",{get:()=>h}),Object.defineProperty(this,"options",{get:()=>x}),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 Ot=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=q;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var St=class extends Error{};var ft=class{static instance(t){return v(t).get("contexts::instance")||new this(t)}constructor(t){v(t).get("contexts::instance")?.dispose(),v(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[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 St(`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 Ot((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(s=>typeof s=="object"&&s))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(me())(...t);this["#"].host.dispatchEvent(o)})}};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}}}}=q;return t}get name(){return[q.window.Document,q.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}=ft.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;e.meta.answered=!1,r.dispatchEvent(e)}),this}},z=ze;F(z,"kind");var Rt=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}}}=q;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(Rt,"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=Rt,Ii.call(e,t),Mi.call(e,t)}function Mr(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))},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=Mr(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[l,c]=st(i,",").reduce(([f,d],p)=>{let h,x;return p=p.replace(a,(S,g,_,O,y)=>{if(h||(h=[...p.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),h.some(E=>y>E.index&&y+S.length<E.index+E[0].length))return S;if(S===":scope")return x=!0,e;let m=g&&!_;if(g&&_)return`#${s.escape(S.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}),x?[f,d.concat(p)]:[f.concat(p),d]},[[],[]]),u;return e&&l.length?u=[l.length>1?`${e} :is(${l.join(", ")})`:`${e} ${l[0]}`,c.join(", ")].filter(f=>f).join(", "):u=[...l,...c].join(", "),u}function he(i){let t=this;if(!v(i).has("namespace")){let e=Object.create(null);v(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 v(i).get("namespace")}function jt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return he.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function ge(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(pe(i)||vt(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(he.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=Mr(i),f=(m,w,b)=>{if(!Be(m,w)&&v(m,"attrOriginals").has(w))return v(m,"attrOriginals").get(w);let E=b();return Be(m,w)?E:E&&E.split(" ").map(A=>(A=A.trim())&&(w===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,A)).join(" ")},d=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...d,value(m){return this.querySelector(`#${m}`)}});for(let m of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let w=Object.getOwnPropertyDescriptor(nodeApi.prototype,m);Object.defineProperty(nodeApi.prototype,m,{...w,value(b){return w.value.call(this,Ge.call(t,b,ge(he.call(t,this))))}})}let p=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...p,value(m){let w=()=>p.value.call(this,m);return l.includes(m)&&!v(this,"lock").get(m)?f(this,m,w):w()}});let h=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...h,get(){let m=()=>h.get.call(this);return l.includes(this.name)?f(this.ownerElement,this.name,m):m()}});let x=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...x,get(){let m=()=>x.get.call(this);return this instanceof t.Attr&&l.includes(this.name)?f(this.ownerElement,this.name,m):m()}});for(let m of l){if(!(m in c))continue;let w=m==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let b of w){let E=Object.getOwnPropertyDescriptor(b.prototype,c[m]);!E||Object.defineProperty(b.prototype,c[m],{...E,get(){return f(this,m,()=>E.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 S=(m,w,b,E)=>Ir(m,w,()=>(typeof b=="function"&&(b=b()),E(b))),g=(m,w,b,E=null)=>{S(m,w,b,A=>{let C=w===i.attr.lid,j=E||jt.call(t,m,C),N=ge(j);if(C){let L=u.uuidToId(A);if(e.get(j,L)!==m){let H=u.toUuid(N,L);H!==A&&m.setAttribute("id",H),e.set(j,L,m)}}else{v(m,"attrOriginals").set(w,A);let L=A.split(" ").map(H=>(H=H.trim())&&u.isUuid(H)?H:u.toUuid(N,H)).join(" ");m.setAttribute(w,L),v(j).set("idrefs",v(j).get("idrefs")||new Set),v(j).get("idrefs").add(m)}})},_=(m,w,b,E=null)=>{S(m,w,b,A=>{let C=w===i.attr.lid,j=E||jt.call(t,m,C);if(C){let N=u.uuidToId(A);e.get(j,N)===m&&e.deleteProperty(j,N)}else{let N=v(m,"attrOriginals").get(w);m.hasAttribute(w)&&m.setAttribute(w,N),v(j).get("idrefs")?.delete(m)}})};r.realtime(t.document).query(i.namespaceSelector,m=>{let w=(b,E,A,C)=>{if(!b.hasAttribute(E))return;let j=()=>b.getAttribute(E);_(b,E,j,A),b.isConnected&&g(b,E,v(b,"attrOriginals").get(E)||j,C)};m.exits.forEach(b=>{if(b.isConnected){let C=he.call(t,b);for(let j of new Set([...Object.values(C),...v(C).get("idrefs")||[]]))for(let N of l)w(j,N,C)}let E=b[n.CONTEXT_API.api.contexts],A=E.find(o.kind);A&&E.detach(A)}),m.entrants.forEach(b=>{let E,A=jt.call(t,b,!0);for(let j of new Set([...Object.values(A),...v(A).get("idrefs")||[]]))if((E=jt.call(t,j,!0))!==A)for(let N of l)w(j,N,A,E);let C=b[n.CONTEXT_API.api.contexts];C.find(o.kind)||C.attach(new o)})},{id:"namespace-html:namespace",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 w={forID:new Map,forOther:new Map};for(let b of l){let E=b===i.attr.lid?w.forID:w.forOther;m.exits.forEach(A=>{if(!A.hasAttribute(b))return;let C=E.get(A);typeof C>"u"&&(C=(b===i.attr.lid?A.parentNode:A)?.closest?.(i.namespaceSelector)||A.getRootNode().host,E.set(A,C)),!(C&&!C.isConnected)&&_(A,b,()=>A.getAttribute(b))}),m.entrants.forEach(A=>{!A.hasAttribute(b)||g(A,b,()=>A.getAttribute(b))})}w.forID.clear(),w.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(l,m=>{for(let w of m)w.oldValue&&_(w.target,w.name,w.oldValue),w.value&&g(w.target,w.name,w.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let O,y=()=>{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)||[],w=m.reduce((b,E)=>b&&b[i.api.namespace][E],t.document);O&&i.target.className&&O.classList.toggle(i.target.className,!1),w&&w!==t.document&&(i.target.className&&w.classList.toggle(i.target.className,!0),i.target.eventName&&w.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&m.length>1&&w.scrollIntoView(),O=w)};t.addEventListener("hashchange",y),r.ready(y)}function Qe({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:Ct(i)}),n=Array.isArray(e.script.mimeTypes)?e.script.mimeTypes:e.script.mimeTypes.split("|").filter(o=>o);e.scriptSelector=n.map(o=>`script[type="${r.CSS.escape(o)}"]:not([oohtmlignore])`).concat("script:not([type])").join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:ji.bind(r,e)},Ri.call(r,e),qi.call(r,e)}function Ri(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!`);[t.ShadowRoot.prototype,t.Element.prototype].forEach(r=>{Object.defineProperty(r,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=pe(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();v(l).has("scriptEnv")||v(l).set("scriptEnv",Object.create(null));let c=await(await s.bind(a,v(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))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function qi(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=Rr.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=vt({script:s,compiledScript:a,thisContext:l});o.type==="query"||s.type&&!t.HTMLScriptElement.supports(s.type)||s.getAttribute("data-handling")==="manual"||i.script.timing==="manual"?e.Script.execute(c):s.textContent=`webqit.oohtml.Script.execute( '${c}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function Rr(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=vt(a),c=r.Script.compileCache[t.quantum?0:1],u;if(!(u=c.get(l))){let{parserParams:f,compilerParams:d,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:{...f,executionMode:t.quantum&&"QuantumProgram"||"RegularProgram"},compilerParams:d,runtimeParams:p}),c.set(l,u)}return u}function jr(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{Rr.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:"]"},advanced:Ct({runtimeParams:{spec:{handler:n=>{}}}})});({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)}]`,ki.call(e,t)}function ki(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{qr.call(this,...r.exits),Di.call(t,i,...r.entrants)},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),e.realtime(t.document).query(`(${i.discreteBindingsSelector})`,r=>{qr.call(this,...r.exits),Ni.call(t,i,...r.entrants)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function kr(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(v(t).has("data-binding"))return v(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(l,c,...u)=>{(()=>{try{l[c](...u)}catch(d){throw new Error(`Error executing "${c}()": ${d.message} at ${d.cause}`)}})()},o.$assign__=(l,c,u)=>{(()=>{try{l[c]=u}catch(d){throw new Error(`Error executing "${c} = ${u}": ${d.message} at ${d.cause}`)}})()},r.intercept(o,{get:(l,c,u)=>{if(!(l.key in o)){let f={...n.createRequest(l.key),live:!0,signal:s.signal};t[i.CONTEXT_API.api.contexts].request(f,d=>{r.set(o,l.key,d)})}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 v(t).set("data-binding",a),a}function qr(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=v(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(),v(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 Ni(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=Dr.call(e,i,o.expr),{scope:l,bindings:c}=kr.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 Xe=new Map;function Dr(i,t){if(Xe.has(t))return Xe.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}${qt(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,{parserParams:n,compilerParams:o,runtimeParams:s}=i.advanced,a=new r(e,{parserParams:n,compilerParams:o,runtimeParams:s});return Xe.set(t,a),a}async function Di(i,...t){for(let e of t){let r=Lr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=kr.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 Lr(i,t){if(Je.has(t))return Je.get(t);let e={},r=-1,n=st(t,";").map(u=>{let[f,d]=st(u,":").map(g=>g.trim()),p=f[0],h=f.slice(1).trim(),x=`(${d})`,S=`(${x} ?? '')`;if(p==="&")return h.startsWith("--")?`$exec__(this.style, 'setProperty', "${qt(h)}", ${S});`:`$assign__(this.style, "${qt(h)}", ${S});`;if(p==="%")return`$exec__(this.classList, 'toggle', "${qt(h)}", !!${x});`;if(p==="~")return h.startsWith("?")?`$exec__(this, 'toggleAttribute', "${qt(h.substring(1).trim())}", !!${x});`:`$exec__(this, 'setAttribute', "${qt(h)}", ${S});`;if(p==="#"){if(e[h])throw new Error(`Duplicate binding: ${f}.`);if(e[h]=!0,h==="text")return`$assign__(this, 'textContent', ${S});`;if(h==="html")return`$exec__(this, 'setHTMLUnsafe', ${S});`;if(h==="items"){let[g,_]=st(d,"/");if(!_)throw new Error(`Invalid ${p}items spec: ${u}; no import specifier.`);let[O,y,m,w]=g.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!O)throw new Error(`Invalid ${p}items spec: ${u}.`);if(y.startsWith("(")?y=y.trim().slice(1,-1).split(",").map(E=>E.trim()):y=[y],y.length>(m==="in"?3:2))throw new Error(`Invalid ${p}items spec: ${u}.`);let b=m==="in"?y[2]:y[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 Jt(i,t,e={},r={}){t=k(t).slice();for(var n=i;!it(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,f,d)=>n.set?n.set(u,f,d):(G(t[a])&&$(u)?u.push(d):u[f]=d,!0);t=k(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=Jt(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 Yt=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 yr(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Mt(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 br(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 Zt(i,t,e,r=!1,n=null){let o=n?.get(t)?.get(e);if(typeof o<"u")return o;let s=c=>(n?.has(t)||n?.set(t,new WeakMap),n?.get(t)?.set(e,c),c),a=t.getRootNode(),l=e.getRootNode();return a===l?s(t.contains(e)):r&&l instanceof i.ShadowRoot?s(Zt(i,t,l.host,r,n)):s(!1)}function wr(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 Q=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:yr(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=wr(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var _t=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 Q)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[k(t[0],!1),void 0,t[1]]:t[0]=k(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof Q)&&!(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 Q?e:new Q(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=new Set,s=new WeakMap;for(let[a,l]of this.registry(t)){let c=[].concat(e).filter(f=>Zt(n,a.context,f.target,a.params.subtree==="cross-roots",s));if(!c.length)continue;let u=[a,Array.isArray(e)?c:c[0]];l?o.add(u):r.call(n,...u)}for(let a of o)r.call(n,...a);o.clear()}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 ut=class extends _t{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof Q;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=Or(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 Q;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&&_r.call(s,"intercept",()=>{});let l=new s.MutationObserver(d=>{d=vr(d).map(p=>Sr.call(s,p)),xr.call(s,f,d,o)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(d=>d+"")),l.observe(o,c);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),f={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 Q;[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";this.registry(a).size||_r.call(s,a,d=>{this.forEachMatchingContext(a,d,xr)});let l={disconnect(){f.delete(u)}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:c,disconnectable:l},f=this.registry(a);return f.set(u,!!u.params.deferred),this.disconnectables(r.signal,l,c)}};function vr(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 xr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:l}=i,c=r.map(d=>d+"");if(o.atomic&&!s.size?t=Or(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(d=>c.includes(d.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(d=>{let p;return o.eventDetails||({event:p,...d}=d),!o.oldValue&&"oldValue"in d&&({oldValue:p,...d}=d),!o.newValue&&"value"in d?{value:p,...d}=d:o.newValue&&typeof d.value>"u"&&(d={...d,value:fe(d.target,d.name,()=>d.target.getAttribute(d.name))}),d})),o.atomic&&(t.forEach(d=>s.set(d.name,d)),t=Array.from(s.entries()).map(([,d])=>d));let u=a?t[0]:t,f=l?.generate()||{};n(u,f,e)}function fe(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 Or(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:fe(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:fe(i,o.nodeName,()=>o.nodeValue),...r})}function Sr({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 _r(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,f)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let d=r.realdom.attrInterceptionRecords.get(u.target);if(d[u.name]=d[u.name]||[],d[u.name].unshift(u.event),D(u.target,"internalAttrInteractions").get(u.name))return f();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(h=>h([u]));let p=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(h=>h([u])),p};new e.MutationObserver(u=>{u=u.filter(f=>!(e.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),u=vr(u).map(f=>Sr.call(e,f)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(f=>f(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(f=>f(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(...f){let d,p=fe(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(u)&&(d=f[1]),u==="toggleAttribute"&&d===void 0&&(d=p===null);let h={target:this,name:f[0],value:d,oldValue:p,type:"interception",event:[this,u]};return a(h,()=>c[u].call(this,...f))}}),s}var Kt=class extends _t{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new ut(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(([d,p],h)=>h.kind==="xpath"?[d,p.concat(h)]:[d.concat(h),p],[[],[]]),f=[];r.subtree?(c.length&&f.push(...n.querySelectorAll(c.join(","))),u.length&&f.push(...Mt(this.window,n,u))):(c.length&&f.push(...[...n.children].filter(d=>d.matches(c))),u.length&&f.push(...Mt(this.window,n,u,!1))),f.forEach(d=>s(d.parentNode||n).entrants.push(d))}}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(f=>f.forEach(d=>{Fe.call(o,u,Er.call(o,d),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 f=Ar.call(o,u);return this.disconnectables(r.signal,l,c,f)}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";this.registry(s).size||$r.call(o,s,d=>{this.forEachMatchingContext(s,d,Fe)});let a=new o.MutationObserver(d=>d.forEach(p=>{Array.isArray((p=Er.call(o,p)).event)||Fe.call(o,u,p,n)}));a.observe(n,{childList:!0,subtree:r.subtree&&!0});let l={disconnect(){f.delete(u),a.disconnect()}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:l},f=this.registry(s);if(f.set(u,!!u.params.deferred),r.staticSensitivity){let d=Ar.call(o,u);return this.disconnectables(r.signal,l,c,d)}return this.disconnectables(r.signal,l,c)}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 Ar(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(h=>h[1]).concat(l(p)).concat(c(p));if(!(i.$attrs=Array.from(new Set(a.filter(p=>(p+"").includes("[")).reduce((p,h)=>p.concat(u(h+"")),[])))).length)return;let f=new Set,d=new Set;return f.push=p=>(d.delete(p),f.add(p)),d.push=p=>(f.delete(p),d.add(p)),i.$deliveryCache={entrants:f,exits:d},new ut(e,t).observe(i.$attrs,p=>{let h=new Map,x=_=>(h.has(_)||h.set(_,{target:_,entrants:[],exits:[],type:"static",event:null}),h.get(_)),S=new WeakMap,g=_=>(S.has(_)||S.set(_,a.some(O=>_.matches(O+""))),S.get(_));for(let _ of p)["entrants","exits"].forEach(O=>{o.generation&&O!==o.generation||i.$deliveryCache[O].has(_.target)||(O==="entrants"?!g(_.target):g(_.target))||(i.$deliveryCache[O].push(_.target),x(_.target)[O].push(_.target),x(_.target).event=_.event)});for(let[,_]of h){let O=s?.generate()||{};n(_,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 f of l[u])a[u].push(f)}),!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"?br(this,l,s+""):l.matches&&l.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((l,c)=>s.kind==="xpath"?[...l,...Mt(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=>Zt(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 Er({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=k(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=k(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 f=()=>r.realdom.domInterceptionHooks.get(i).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return f;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let d=(g,_,O)=>{r.realdom.domInterceptionNoRecurse.set(g,_);let y=O();return r.realdom.domInterceptionNoRecurse.delete(g),y},p=(g,_)=>{g.entrants.concat(g.exits).forEach(y=>{clearTimeout(r.realdom.domInterceptionRecords.get(y)?.timeout),r.realdom.domInterceptionRecords.set(y,g.event);let m=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(y)},0);Object.defineProperty(g.event,"timeout",{value:m,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(y=>y(g));let O=_();return r.realdom.domInterceptionHooks.get("sync")?.forEach(y=>y(g)),O},h={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"]},x={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(h).reduce((g,_)=>g.concat(_),[])).forEach(g=>{Object.keys(h).forEach(y=>{if(!h[y].includes(g))return;let m=Object.getOwnPropertyDescriptor(e[y].prototype,g);!m||(Object.defineProperty(e[y].prototype,g,"value"in m?{...m,value:_}:{...m,set:O}),x[y][g]=m)});function _(...y){let m=Object.keys(x).find(L=>this instanceof e[L]&&g in x[L]),w=x[m],b=()=>w[g].value.call(this,...y);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let E=[],A=[],C=this;["insertBefore"].includes(g)?A=[y[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?(A=[y[1]],["beforebegin","afterend"].includes(y[0])&&(C=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?(E=[...this.childNodes],A=g==="replaceChildren"?[...y]:[y[0]]):["replaceWith","remove"].includes(g)?(E=[this],A=g==="replaceWith"?[...y]:[],C=this.parentNode):["replaceChild"].includes(g)?(E=[y[1]],A=[y[0]]):["removeChild"].includes(g)?E=[...y]:(A=[...y],["before","after"].includes(g)&&(C=this.parentNode));let j=g;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(g)){let L=this.nodeName;if(g==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(y[0])){if(!this.parentNode)return w[g].value.call(this,...y);L=this.parentNode.nodeName}let H=n.createElement(L.includes("-")?"div":L);w.setHTMLUnsafe.value.call(H,A[0],g==="setHTMLUnsafe"?y[1]:{}),A=[...H.childNodes],g==="insertAdjacentHTML"?(j="insertAdjacentElement",y[1]=new u,d(y[1],"append",()=>y[1].append(...H.childNodes))):(j="replaceChildren",y=[...H.childNodes])}return p({target:C,entrants:A,exits:E,type:"interception",event:[this,g]},()=>w[j].value.call(this,...y))}function O(y){let m=Object.keys(x).find(N=>this instanceof e[N]&&g in x[N]),w=x[m],b=()=>w[g].set.call(this,y);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let E=[],A=[],C=this;if(["outerHTML","outerText"].includes(g)?(E=[this],C=this.parentNode):this instanceof c?(C=this.content,E=[...this.content.childNodes]):E=[...this.childNodes],["outerHTML","innerHTML"].includes(g)){let N=this.nodeName;if(g==="outerHTML"){if(!this.parentNode)return b();N=this.parentNode.nodeName}let L=n.createElement(N.includes("-")?"div":N);if(d(L,g,()=>L[g]=y),A=this instanceof c?[...L.content.childNodes]:[...L.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let H=dt=>dt.reduce((et,rt)=>rt instanceof HTMLScriptElement?et.concat(rt):rt instanceof c?et.concat(H([rt.content])):(et=et.concat(H([...rt.querySelectorAll?.("template")||[]].map(Br=>Br.content))),et.concat(...rt.querySelectorAll?.("script")||[])),[]);for(let dt of H(A)){if(this instanceof ShadowRoot){dt.setAttribute("data-handling","manual");continue}let et=n.createElement("script");[...dt.attributes].forEach(rt=>et.setAttribute(rt.name,rt.value)),et.textContent=dt.textContent,d(dt,"replaceWith",()=>dt.replaceWith(et))}}g==="outerHTML"?(y=new u,d(y,"append",()=>y.append(...A)),b=()=>d(this,"replaceWith",()=>a.prototype.replaceWith.call(this,y))):this instanceof c?b=()=>d(this.content,"replaceChildren",()=>this.content.replaceChildren(...A)):b=()=>d(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...A))}return p({target:C,entrants:A,exits:E,type:"interception",event:[this,g]},b)}}),f}function Pr(){Si.call(this),Ai.call(this),Ei.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 Ei(){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={},Pr.call(i),i.webqit.realdom.meta=(...e)=>$i.call(i,...e),i.webqit.realdom.ready=(...e)=>We.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new Kt(e,i);if(r==="attr")return new ut(e,i)};let t=new Yt(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 $i(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 de(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 v=(...i)=>D("oohtml",...i),q={};function B(i,t,e){let r=this,n=Cr.call(r);q.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];Lt(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}${de(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 Ir(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 st(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 vt(i){let t;return(t=Ve.get(i))||(t=Ti(),Ve.set(i,t)),t}function pe(i){let t;return Ve.forEach((e,r)=>{e===i&&(t=r)}),t}function me(){let{window:i}=q,{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:f,live:d,signal:p,diff:h,...x}=s;super(l,{...x,bubbles:x.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>c}),Object.defineProperty(this,"targetContext",{get:()=>f}),Object.defineProperty(this,"detail",{get:()=>u}),Object.defineProperty(this,"live",{get:()=>d}),Object.defineProperty(this,"signal",{get:()=>p}),Object.defineProperty(this,"diff",{get:()=>h}),Object.defineProperty(this,"options",{get:()=>x}),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 Ot=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=q;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var St=class extends Error{};var ft=class{static instance(t){return v(t).get("contexts::instance")||new this(t)}constructor(t){v(t).get("contexts::instance")?.dispose(),v(t).set("contexts::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e})}[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[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 St(`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 Ot((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(s=>typeof s=="object"&&s))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(me())(...t);this["#"].host.dispatchEvent(o)})}};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}}}}=q;return t}get name(){return[q.window.Document,q.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}=ft.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;e.meta.answered=!1,r.dispatchEvent(e)}),this}},z=ze;F(z,"kind");var Rt=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}}}=q;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(Rt,"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=Rt,Ii.call(e,t),Mi.call(e,t)}function Mr(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))},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=Mr(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[l,c]=st(i,",").reduce(([f,d],p)=>{let h,x;return p=p.replace(a,(S,g,_,O,y)=>{if(h||(h=[...p.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),h.some(E=>y>E.index&&y+S.length<E.index+E[0].length))return S;if(S===":scope")return x=!0,e;let m=g&&!_;if(g&&_)return`#${s.escape(S.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}),x?[f,d.concat(p)]:[f.concat(p),d]},[[],[]]),u;return e&&l.length?u=[l.length>1?`${e} :is(${l.join(", ")})`:`${e} ${l[0]}`,c.join(", ")].filter(f=>f).join(", "):u=[...l,...c].join(", "),u}function he(i){let t=this;if(!v(i).has("namespace")){let e=Object.create(null);v(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 v(i).get("namespace")}function jt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return he.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function ge(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(pe(i)||vt(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(he.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=Mr(i),f=(m,w,b)=>{if(!Be(m,w)&&v(m,"attrOriginals").has(w))return v(m,"attrOriginals").get(w);let E=b();return Be(m,w)?E:E&&E.split(" ").map(A=>(A=A.trim())&&(w===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,A)).join(" ")},d=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...d,value(m){return this.querySelector(`#${m}`)}});for(let m of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let w=Object.getOwnPropertyDescriptor(nodeApi.prototype,m);Object.defineProperty(nodeApi.prototype,m,{...w,value(b){return w.value.call(this,Ge.call(t,b,ge(he.call(t,this))))}})}let p=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...p,value(m){let w=()=>p.value.call(this,m);return l.includes(m)&&!v(this,"lock").get(m)?f(this,m,w):w()}});let h=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...h,get(){let m=()=>h.get.call(this);return l.includes(this.name)?f(this.ownerElement,this.name,m):m()}});let x=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...x,get(){let m=()=>x.get.call(this);return this instanceof t.Attr&&l.includes(this.name)?f(this.ownerElement,this.name,m):m()}});for(let m of l){if(!(m in c))continue;let w=m==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let b of w){let E=Object.getOwnPropertyDescriptor(b.prototype,c[m]);!E||Object.defineProperty(b.prototype,c[m],{...E,get(){return f(this,m,()=>E.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 S=(m,w,b,E)=>Ir(m,w,()=>(typeof b=="function"&&(b=b()),E(b))),g=(m,w,b,E=null)=>{S(m,w,b,A=>{let C=w===i.attr.lid,j=E||jt.call(t,m,C),N=ge(j);if(C){let L=u.uuidToId(A);if(e.get(j,L)!==m){let H=u.toUuid(N,L);H!==A&&m.setAttribute("id",H),e.set(j,L,m)}}else{v(m,"attrOriginals").set(w,A);let L=A.split(" ").map(H=>(H=H.trim())&&u.isUuid(H)?H:u.toUuid(N,H)).join(" ");m.setAttribute(w,L),v(j).set("idrefs",v(j).get("idrefs")||new Set),v(j).get("idrefs").add(m)}})},_=(m,w,b,E=null)=>{S(m,w,b,A=>{let C=w===i.attr.lid,j=E||jt.call(t,m,C);if(C){let N=u.uuidToId(A);e.get(j,N)===m&&e.deleteProperty(j,N)}else{let N=v(m,"attrOriginals").get(w);m.hasAttribute(w)&&m.setAttribute(w,N),v(j).get("idrefs")?.delete(m)}})};r.realtime(t.document).query(i.namespaceSelector,m=>{let w=(b,E,A,C)=>{if(!b.hasAttribute(E))return;let j=()=>b.getAttribute(E);_(b,E,j,A),b.isConnected&&g(b,E,v(b,"attrOriginals").get(E)||j,C)};m.exits.forEach(b=>{if(b.isConnected){let C=he.call(t,b);for(let j of new Set([...Object.values(C),...v(C).get("idrefs")||[]]))for(let N of l)w(j,N,C)}let E=b[n.CONTEXT_API.api.contexts],A=E.find(o.kind);A&&E.detach(A)}),m.entrants.forEach(b=>{let E,A=jt.call(t,b,!0);for(let j of new Set([...Object.values(A),...v(A).get("idrefs")||[]]))if((E=jt.call(t,j,!0))!==A)for(let N of l)w(j,N,A,E);let C=b[n.CONTEXT_API.api.contexts];C.find(o.kind)||C.attach(new o)})},{id:"namespace-html:namespace",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 w={forID:new Map,forOther:new Map};for(let b of l){let E=b===i.attr.lid?w.forID:w.forOther;m.exits.forEach(A=>{if(!A.hasAttribute(b))return;let C=E.get(A);typeof C>"u"&&(C=(b===i.attr.lid?A.parentNode:A)?.closest?.(i.namespaceSelector)||A.getRootNode().host,E.set(A,C)),!(C&&!C.isConnected)&&_(A,b,()=>A.getAttribute(b))}),m.entrants.forEach(A=>{!A.hasAttribute(b)||g(A,b,()=>A.getAttribute(b))})}w.forID.clear(),w.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(l,m=>{for(let w of m)w.oldValue&&_(w.target,w.name,w.oldValue),w.value&&g(w.target,w.name,w.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let O,y=()=>{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)||[],w=m.reduce((b,E)=>b&&b[i.api.namespace][E],t.document);O&&i.target.className&&O.classList.toggle(i.target.className,!1),w&&w!==t.document&&(i.target.className&&w.classList.toggle(i.target.className,!0),i.target.eventName&&w.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&m.length>1&&w.scrollIntoView(),O=w)};t.addEventListener("hashchange",y),r.ready(y)}function Qe({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:Ct(i)}),n=Array.isArray(e.script.mimeTypes)?e.script.mimeTypes:e.script.mimeTypes.split("|").filter(o=>o);e.scriptSelector=n.map(o=>`script[type="${r.CSS.escape(o)}"]:not([oohtmlignore])`).concat("script:not([type])").join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:ji.bind(r,e)},Ri.call(r,e),qi.call(r,e)}function Ri(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!`);[t.ShadowRoot.prototype,t.Element.prototype].forEach(r=>{Object.defineProperty(r,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=pe(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();v(l).has("scriptEnv")||v(l).set("scriptEnv",Object.create(null));let c=await(await s.bind(a,v(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))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function qi(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=Rr.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=vt({script:s,compiledScript:a,thisContext:l});o.type==="query"||s.type&&!t.HTMLScriptElement.supports(s.type)||s.getAttribute("data-handling")==="manual"||i.script.timing==="manual"?e.Script.execute(c):s.textContent=`webqit.oohtml.Script.execute( '${c}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function Rr(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=vt(a),c=r.Script.compileCache[t.quantum?0:1],u;if(!(u=c.get(l))){let{parserParams:f,compilerParams:d,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:{...f,executionMode:t.quantum&&"QuantumProgram"||"RegularProgram"},compilerParams:d,runtimeParams:p}),c.set(l,u)}return u}function jr(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{Rr.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:"]"},advanced:Ct({runtimeParams:{spec:{handler:n=>{}}}})});({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)}]`,ki.call(e,t)}function ki(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{qr.call(this,...r.exits),setTimeout(()=>{Di.call(t,i,...r.entrants)},0)},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),e.realtime(t.document).query(`(${i.discreteBindingsSelector})`,r=>{setTimeout(()=>{qr.call(this,...r.exits),Ni.call(t,i,...r.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function kr(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(v(t).has("data-binding"))return v(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(l,c,...u)=>{(()=>{try{l[c](...u)}catch(d){throw new Error(`Error executing "${c}()": ${d.message} at ${d.cause}`)}})()},o.$assign__=(l,c,u)=>{(()=>{try{l[c]=u}catch(d){throw new Error(`Error executing "${c} = ${u}": ${d.message} at ${d.cause}`)}})()},r.intercept(o,{get:(l,c,u)=>{if(!(l.key in o)){let f={...n.createRequest(l.key),live:!0,signal:s.signal};t[i.CONTEXT_API.api.contexts].request(f,d=>{r.set(o,l.key,d)})}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 v(t).set("data-binding",a),a}function qr(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=v(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(),v(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 Ni(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=Dr.call(e,i,o.expr),{scope:l,bindings:c}=kr.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 Xe=new Map;function Dr(i,t){if(Xe.has(t))return Xe.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}${qt(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,{parserParams:n,compilerParams:o,runtimeParams:s}=i.advanced,a=new r(e,{parserParams:n,compilerParams:o,runtimeParams:s});return Xe.set(t,a),a}async function Di(i,...t){for(let e of t){let r=Lr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=kr.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 Lr(i,t){if(Je.has(t))return Je.get(t);let e={},r=-1,n=st(t,";").map(u=>{let[f,d]=st(u,":").map(g=>g.trim()),p=f[0],h=f.slice(1).trim(),x=`(${d})`,S=`(${x} ?? '')`;if(p==="&")return h.startsWith("--")?`$exec__(this.style, 'setProperty', "${qt(h)}", ${S});`:`$assign__(this.style, "${qt(h)}", ${S});`;if(p==="%")return`$exec__(this.classList, 'toggle', "${qt(h)}", !!${x});`;if(p==="~")return h.startsWith("?")?`$exec__(this, 'toggleAttribute', "${qt(h.substring(1).trim())}", !!${x});`:`$exec__(this, 'setAttribute', "${qt(h)}", ${S});`;if(p==="#"){if(e[h])throw new Error(`Duplicate binding: ${f}.`);if(e[h]=!0,h==="text")return`$assign__(this, 'textContent', ${S});`;if(h==="html")return`$exec__(this, 'setHTMLUnsafe', ${S});`;if(h==="items"){let[g,_]=st(d,"/");if(!_)throw new Error(`Invalid ${p}items spec: ${u}; no import specifier.`);let[O,y,m,w]=g.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!O)throw new Error(`Invalid ${p}items spec: ${u}.`);if(y.startsWith("(")?y=y.trim().slice(1,-1).split(",").map(E=>E.trim()):y=[y],y.length>(m==="in"?3:2))throw new Error(`Invalid ${p}items spec: ${u}.`);let b=m==="in"?y[2]:y[1]||"$index__";return`
|
|
17
17
|
let $iteratee__ = ${w};
|
|
18
18
|
let $import__ = this.${i.HTML_IMPORTS.api.import}( ${_.trim()}, true );
|
|
19
19
|
this.$oohtml_internal_databinding_signals?.push( $import__ );
|