@webqit/oohtml 4.3.13 → 4.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-binding.js +1 -1
- package/dist/data-binding.js.map +2 -2
- package/dist/html-imports.js +1 -1
- package/dist/html-imports.js.map +2 -2
- package/dist/main.js +24 -24
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +15 -15
- package/dist/main.lite.js.map +2 -2
- package/package.json +1 -1
- package/src/data-binding/index.js +1 -1
- package/src/html-imports/HTMLImportsContext.js +31 -26
- package/src/html-imports/_HTMLImportElement.js +1 -1
package/dist/main.lite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(()=>{var dr=Object.defineProperty;var Kr=(i,t,e)=>t in i?dr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Ee=(i,t)=>{for(var e in t)dr(i,e,{get:t[e],enumerable:!0})};var F=(i,t,e)=>(Kr(i,typeof t!="symbol"?t+"":t,e),e),pr=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var G=(i,t,e)=>(pr(i,t,"read from private field"),e?e.call(i):t.get(i)),Ht=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)},oe=(i,t,e,r)=>(pr(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e);var ze={};Ee(ze,{AsyncQuantumFunction:()=>Sr,AsyncQuantumScript:()=>qt,Observer:()=>P,QuantumAsyncFunction:()=>Ei,QuantumAsyncScript:()=>Ai,QuantumFunction:()=>Si,QuantumModule:()=>te,QuantumScript:()=>$i,State:()=>_t});var Fe={};Ee(Fe,{apply:()=>ue,batch:()=>pe,construct:()=>ke,defineProperties:()=>yi,defineProperty:()=>Xt,deleteProperties:()=>bi,deleteProperty:()=>Jt,get:()=>at,getOwnPropertyDescriptor:()=>fe,getOwnPropertyDescriptors:()=>mi,getPrototypeOf:()=>Re,has:()=>de,intercept:()=>hi,isExtensible:()=>je,map:()=>gi,observe:()=>He,ownKeys:()=>Qt,path:()=>pi,preventExtensions:()=>De,reduce:()=>Le,set:()=>yt,setPrototypeOf:()=>Ne});function T(i){return!Array.isArray(i)&&typeof i=="object"&&i}function At(i){return typeof i}function A(i){return Array.isArray(i)}function $e(i,t,e=null){return A(t)?i.filter(r=>e?t.filter(n=>e(r,n)).length:t.indexOf(r)!==-1):[]}function D(i,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new Ft}),!arguments.length)return globalThis.webqit.refs;let e=globalThis.webqit.refs.get(i);e||(e=new Ft,globalThis.webqit.refs.set(i,e));let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new Ft,n.set(r,e));return e}var Ft=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,e){let r=super.set(t,e);return this.fire("set",t,e,t),r}delete(t){let e=super.delete(t);return this.fire("delete",t),e}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,e,r){let n={type:t,key:e,callback:r};return this.observers.add(n),()=>this.observers.delete(n)}unobserve(t,e,r){if(Array.isArray(t)||Array.isArray(e))throw new Error('The "type" and "key" arguments can only be strings.');for(let n of this.observers)!(se([t,"*"],n.type)&&se([e,"*"],n.key)&&n.callback===r)||this.observers.delete(n)}fire(t,e,...r){for(let n of this.observers)!(se([t,"*"],n.type)&&se([e,"*"],n.key))||n.callback(...r)}},se=(i,t)=>Array.isArray(t)?$e(i,t).length:i.includes(t);function Pt(i){return typeof i=="function"}function Wt(i){return i===null||i===""}function ot(i){return arguments.length&&(i===void 0||typeof i>"u")}function M(i){return Array.isArray(i)||typeof i=="object"&&i||Pt(i)}function Ae(i){return Wt(i)||ot(i)||i===!1||i===0||M(i)&&!Object.keys(i).length}function I(i){return Pt(i)||i&&{}.toString.call(i)==="[object function]"}function Vt(i){return i instanceof Number||typeof i=="number"}function Q(i){return Vt(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function Ct(i){return i instanceof String||typeof i=="string"&&i!==null}function Pe(i){return!Ct(i)&&!ot(i.length)}function ae(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function Ce(r,t){t=t||Object.prototype,t=t&&!A(t)?[t]:t;for(var e=[],r=r;r&&(!t||t.indexOf(r)<0)&&r.name!=="default";)e.push(r),r=r?Object.getPrototypeOf(r):null;return e}function Te(i,t){var e=[];return Ce(i,t).forEach(r=>{ae(e,...Object.getOwnPropertyNames(r))}),e}function Y(i,t,e=!1,r=!1,n=!1){var o=0,s=i.shift();if((Q(s)||s===!0||s===!1)&&(o=s,s=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((a,l)=>{!M(a)&&!I(a)||(e?Te(a):Object.keys(a)).forEach(c=>{if(!!t(c,s,a,l)){var u=s[c],f=a[c];if((A(u)&&A(f)||T(u)&&T(f))&&(o===!0||o>0))s[c]=A(u)&&A(f)?[]:{},Y([Q(o)?o-1:o,s[c],u,f],t,e,r,n);else if(A(s)&&A(a))r?s[c]=f:s.push(f);else try{n?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(a,c)):s[c]=a[c]}catch{}}})}),s}function Bt(...i){return Y(i,(t,e,r)=>!0,!1,!1,!1)}function k(i,t=!0){return A(i)?i:!t&&T(i)?[i]:i!==!1&&i!==0&&Ae(i)?[]:Pe(i)?Array.prototype.slice.call(i):T(i)?Object.values(i):[i]}var q=(...i)=>D("observer-api",...i),Tt=(i,t)=>i instanceof Promise?i.then(t):t(i),ce={};var mt=class{constructor(t,e){this.registry=t,Object.assign(this,{...e,target:t.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var zt=class extends mt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),ce.setMaxListeners?.(0,this.signal)}remove(){this.abortController.abort(),super.remove()}fire(t){if(this.emit.recursionTarget&&!["inject","force-async","force-sync"].includes(this.params.recursions))return;let e=t,r=this.filter;if(r!==1/0&&(r=k(r,!1))&&(e=t.filter(o=>r.includes(o.key))),this.params.diff&&(e=e.filter(o=>o.type!=="set"||o.value!==o.oldValue)),!e.length)return;if(["inject","defer"].includes(this.params.recursions)){if(this.emit.recursionTarget){this.emit.recursionTarget.push(...e);return}this.emit.recursionTarget=this.params.recursions==="inject"?e:[]}let n=this.filter===1/0||Array.isArray(this.filter)?this.emit(e,this):this.emit(e[0],this);return Tt(n,o=>{let s=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&s?.length?this.emit.currentRegistration.fire(s):o})}};var gt=class{constructor(t){this.target=t,this.entries=[]}addRegistration(t){return this.entries.push(t),t}removeRegistration(t){this.entries=this.entries.filter(e=>e!==t)}static _getInstance(t,e,r=!0,n=this.__namespace){if(!M(e))throw new Error(`Subject must be of type object; "${At(e)}" given!`);let o=this;return n&&q("namespaces").has(t+"-"+n)&&(o=q("namespaces").get(t+"-"+n),t+="-"+n),!q(e,"registry").has(t)&&r&&q(e,"registry").set(t,new o(e)),q(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return q("namespaces").get(t);if(!(r.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${e} must be a subclass of ${this.name}.`);q("namespaces").set(t,r),r.__namespace=e}};var W=class{constructor(t,e){if(this.target=t,!e.operation)throw new Error("Descriptor operation must be given in definition!");Object.assign(this,e)}};var ut=class extends gt{static getInstance(t,e=!0,r=null){return super._getInstance("listeners",...arguments)}static namespace(t,e=null){return super._namespace("listeners",...arguments)}constructor(t){super(t),this.batches=[]}addRegistration(t,e,r){return super.addRegistration(new zt(this,{filter:t,emit:e,params:r}))}emit(t,e=!1){if(this.batches.length){this.batches[0].snapshots.push({events:[...t],isPropertyDescriptors:e});return}this.$emit(this.entries,[{events:t,isPropertyDescriptors:e}])}$emit(t,e){let r=t.filter(l=>l.params.withPropertyDescriptors).length,n=e.some(l=>l.isPropertyDescriptors),o=[],s=[],a=t.length;e.forEach(l=>{(r||!n)&&o.push(...l.events),r!==a&&n&&(l.isPropertyDescriptors?s.push(...l.events.map(c=>{let{target:u,type:f,...d}=c,p=new W(u,{type:"set",...d});return Object.defineProperty(p,"value","get"in d.value?{get:()=>d.value.get()}:{value:d.value.value}),d.oldValue&&Object.defineProperty(p,"oldValue","get"in d.oldValue?{get:()=>d.oldValue.get()}:{value:d.oldValue.value}),p})):s.push(...l.events))}),t.forEach(l=>{l.params.withPropertyDescriptors?l.fire(o.length?o:s):l.fire(s.length?s:o)})}batch(t){this.batches.unshift({entries:[...this.entries],snapshots:[]});let e=t();return Tt(e,r=>{let n=this.batches.shift();return n.snapshots.length&&this.$emit(n.entries,n.snapshots),r})}};var Ut=class extends mt{exec(t,e,r){return this.running||!this.traps[t.operation]?e(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[t.operation](t,r,(...n)=>(this.running=!1,e(...n))))}};var st=class extends gt{static getInstance(t,e=!0,r=null){return super._getInstance("traps",...arguments)}static namespace(t,e=null){return super._namespace("traps",...arguments)}addRegistration(t){return super.addRegistration(new Ut(this,t))}emit(t,e=null){let r=this;return function n(o,...s){let a=r.entries[o];return a?a.exec(t,(...l)=>n(o+1,...l),...s):e?e(t,...s):s[0]}(0)}};var qe={};Ee(qe,{accessorize:()=>fi,proxy:()=>xr,unaccessorize:()=>di,unproxy:()=>Gt});function fi(i,t,e={}){i=le(i);let r=q(i,"accessorizedProps");function n(l){let c,u=i;do c=Object.getOwnPropertyDescriptor(u,l);while(!c&&(u=Object.getPrototypeOf(u)));return c?{proto:u,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(l){if(r.has(l+""))return!0;let c=n(l);c.getValue=function(d=!1){return d?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(d,p=!1){if(this.dirty=!0,p){this.descriptor=d;return}return this.descriptor.set?this.descriptor.set(d)!==!1:(this.descriptor.value=d,!0)},c.intact=function(){let d=Object.getOwnPropertyDescriptor(i,l);return d?.get===f.get&&d?.set===f.set&&r.get(l+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[l]:Object.defineProperty(i,l,this.descriptor),r.delete(l+""),!0):!1},r.set(isNaN(l)?l:parseInt(l),c);let{enumerable:u=!0}=c.descriptor,f={enumerable:u,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(f.set=function(d){return yt(this,l,d,e)}),("value"in c.descriptor||c.descriptor.get)&&(f.get=function(){return at(this,l,e)});try{return Object.defineProperty(i,l,f),!0}catch{return r.delete(l+""),!1}}let a=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(o);return t===void 0||Array.isArray(t)?a:a[0]}function di(i,t,e={}){i=le(i);let r=q(i,"accessorizedProps");function n(a){return r.has(a+"")?r.get(a+"").restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(n);return t===void 0||Array.isArray(t)?s:s[0]}function xr(i,t={},e=void 0){let r=le(i);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&q(r,"membraneRef").has(t.membrane))return q(r,"membraneRef").get(t.membrane);let n={apply(a,l,c){if(Array.isArray(l)){let u=le(l);return q(u).set("$length",u.length),pe(u,()=>ue(a,l,c))}return ue(a,Gt(l),c)},construct:(a,l,c=null)=>ke(a,l,c,t),defineProperty:(a,l,c)=>Xt(a,l,c,t),deleteProperty:(a,l)=>Jt(a,l,t),get:(a,l,c=null)=>{let u={...t,receiver:c};Array.isArray(a)&&l==="length"&&q(a).has("$length")&&(u.forceValue=q(a).get("$length"));let f=at(a,l,u);return Array.isArray(a)&&typeof f=="function"?xr(f,{...t,membrane:c}):f},getOwnPropertyDescriptor:(a,l)=>fe(a,l,t),getPrototypeOf:a=>Re(a,t),has:(a,l)=>de(a,l,t),isExtensible:a=>je(a,t),ownKeys:a=>Qt(a,t),preventExtensions:a=>De(a,t),set:(a,l,c,u=null)=>{let f={...t,receiver:u};return Array.isArray(a)&&l==="length"&&(f.forceOldValue=q(a).get("$length"),q(a).set("$length",c)),yt(a,l,c,f)},setPrototypeOf:(a,l)=>Ne(a,l,t)},o=e?.(n)||n,s=new Proxy(r,o);return t.membrane&&q(r,"membraneRef").set(t.membrane,s),q(s).set(s,r),s}function Gt(i){return q(i).get(i)||i}function le(i){if(!i||!M(i))throw new Error("Target must be of type object!");return Gt(i)}var Yt=class extends Array{};function pi(...i){return new Yt(...i)}function Le(i,t,e,r=o=>o,n={}){if(!!t.length)return function o(s,a,l){let c=a[l.level],u=l.level===a.length-1;return s instanceof W&&s.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!u}),e(s,c,(f,...d)=>{let p=w=>{w instanceof W&&(w.path=[w.key],s instanceof W&&(w.path=s.path.concat(w.key),Object.defineProperty(w,"context",{get:()=>s,configurable:!0})))},h=w=>{let S=Z(w,!1);return Tt(S,g=>{w instanceof W?w.value=g:w=g;let _=d[0]||{};return o(w,a,{...l,..._,level:l.level+1})})};return he(c)&&Array.isArray(f)?(f.forEach(p),u?r(f,...d):f.map(h)):(p(f),u?r(f,...d):h(f))},l)}(i,t.slice(0),{...n,level:0})}function He(i,t,e,r={}){if(i=Z(i,!r.level),I(arguments[1])&&([,e,r={}]=arguments,t=1/0),!I(e))throw new Error(`Handler must be a function; "${At(e)}" given!`);if(t instanceof Yt)return Le(i,t,He,e,r);if(r={...r,descripted:!0},delete r.live,!M(i))return r.probe&&at(i,t,e,r);let n=_r(i,t,e,r);return r.probe?at(i,t,n,r):n()}function hi(i,t,e={}){return i=Z(i),T(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),st.getInstance(i,!0,e.namespace).addRegistration({traps:t,params:e})}function fe(i,t,e=n=>n,r={}){return K(i,"getOwnPropertyDescriptor",{key:t},e,r)}function mi(i,t,e=n=>n,r={}){return K(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Re(i,t=r=>r,e={}){return K(i,"getPrototypeOf",{},t,e)}function je(i,t=r=>r,e={}){return K(i,"isExtensible",{},t,e)}function Qt(i,t=r=>r,e={}){return K(i,"ownKeys",{},t,e)}function de(i,t,e=n=>n,r={}){return K(i,"has",{key:t},e,r)}function at(i,t,e=n=>n,r={}){let n,o=Z(i,!r.level);return T(e)?[r,e]=[e,s=>s]:r.live&&(n=!0),t instanceof Yt?Le(o,t,at,e,r):wi(o,t,s=>{let a=[...s];return function l(c,u,f){if(!u.length)return f(c);let d=u.shift();if(!["string","number","symbol"].includes(typeof d))throw new Error(`Property name/key ${d} invalid.`);function p(S,g=void 0){let _=m=>(S.value=m,l([...c,r.live||r.descripted?S:m],u,f));if(arguments.length>1)return _(g);if(!M(o))return _(o?.[S.key]);let O=q(o,"accessorizedProps",!1),y=O&&O.get(S.key);if(y&&y.intact())return _(y.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let m=Object.getOwnPropertyDescriptor(o,S.key);return"forceValue"in r&&"value"in m&&(m.value=r.forceValue),_(m)}return"forceValue"in r?_(r.forceValue):_(Reflect.get(o,S.key))}let h=new W(o,{type:"get",key:d,value:void 0,operation:"get",related:a});if(!M(o))return p(h);let w=st.getInstance(o,!1,r.namespace);return w?w.emit(h,p):p(h)}([],s.slice(0),l=>{let c=he(t)?l:l[0];return n&&M(o)?_r(o,t,e,r)(c):e(c)})},r)}function pe(i,t,e={}){return i=Z(i),ut.getInstance(i,!0,e.namespace).batch(t)}function gi(i,t,e={}){t=Z(t),i=Z(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Qt(e.spread?[...i]:i).map(c=>isNaN(c)?c:parseInt(c)),s=r.length?r.filter(c=>o.includes(c)):o.filter(c=>!n.includes(c)),a=c=>!Array.isArray(t)||isNaN(c)?c:c-n.filter(u=>u<c).length,l=c=>{let u=fe(i,c,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?yt(t,a(c),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&Xt(t,c,{...u,configurable:!0},e)};return pe(t,()=>{s.forEach(l)}),He(i,c=>{c.filter(u=>r.length?r.includes(u.key):!n.includes(u.key)).forEach(u=>{if(u.operation==="deleteProperty")return Jt(t,a(u.key),e);if(u.operation==="defineProperty"){(u.value.enumerable||e.onlyEnumerable===!1)&&Xt(t,a(u.key),{...u.value,configurable:!0},e);return}l(u.key)})},{...e,withPropertyDescriptors:!0})}function yt(i,t,e,r=s=>s,n={},o=!1){let s=Z(i),a=[[t,e]];T(t)&&([,,r=c=>c,n={},o=!1]=arguments,a=Object.entries(t)),T(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,c=>c]);let l=a.map(([c])=>c);return function c(u,f,d){if(!f.length)return d(u);let[p,h]=f.shift();function w(g,_=void 0){let O=x=>(g.status=x,c(u.concat(g),f,d));if(arguments.length>1)return O(g,_);let y=q(s,"accessorizedProps",!1),m=y&&y.get(g.key);return g.operation==="defineProperty"?(m&&!m.restore()&&O(!1),Object.defineProperty(s,g.key,g.value),O(!0)):m&&m.intact()?O(m.setValue(g.value)):O(Reflect.set(s,g.key,g.value))}function S(g,_){if(n.diff&&h===_)return c(u,f,d);let O=new W(s,{type:o?"def":"set",key:p,value:h,isUpdate:g,oldValue:_,related:[...l],operation:o?"defineProperty":"set",detail:n.detail}),y=st.getInstance(s,!1,n.namespace);return y?y.emit(O,w):w(O)}return de(s,p,g=>{if(!g)return S(g);let _={...n,withPropertyDescriptors:o};return"forceOldValue"in n&&(_.forceValue=n.forceOldValue),at(s,p,O=>S(g,O),_)},n)}([],a.slice(0),c=>{let u=ut.getInstance(s,!1,n.namespace);return u&&u.emit(c,o),r(he(t)?c.map(f=>f.status):c[0]?.status)})}function Xt(i,t,e,r=o=>o,n={}){return yt(i,t,e,r,n,!0)}function yi(i,t,e=n=>n,r={}){return yt(i,t,e,r,!0)}function Jt(i,t,e=n=>n,r={}){i=Z(i),T(e)&&([r,e]=[e,s=>s]);let n=k(t,!1),o=[...n];return function s(a,l,c){if(!l.length)return c(a);let u=l.shift();function f(p,h=void 0){let w=_=>(p.status=_,s(a.concat(p),l,c));if(arguments.length>1)return w(p,h);let S=q(i,"accessorizedProps",!1),g=S&&S.get(p.key);return g&&!g.restore()&&w(!1),w(Reflect.deleteProperty(i,p.key))}function d(p){let h=new W(i,{type:"delete",key:u,oldValue:p,related:[...o],operation:"deleteProperty",detail:r.detail}),w=st.getInstance(i,!1,r.namespace);return w?w.emit(h,f):f(h)}return at(i,u,d,r)}([],n.slice(0),s=>{let a=ut.getInstance(i,!1,r.namespace);return a&&a.emit(s),e(he(t)?s.map(l=>l.status):s[0].status)})}function bi(i,t,e=n=>n,r={}){return Jt(...arguments)}function ke(i,t,e=null,r=o=>o,n={}){return K(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function ue(i,t,e,r=o=>o,n={}){return K(i,"apply",{thisArgument:t,argumentsList:e},r,n)}function Ne(i,t,e=n=>n,r={}){return K(i,"setPrototypeOf",{proto:t},e,r)}function De(i,t=r=>r,e={}){return K(i,"preventExtensions",{},t,e)}function _r(i,t,e,r={}){let n=new AbortController;ce.setMaxListeners?.(0,n.signal),r.signal&&r.signal.addEventListener("abort",()=>n.abort()),r={...r,signal:n.signal};let o=ut.getInstance(i,!0,r.namespace);return function s(a,l=null){l?.remove();let u={signal:o.addRegistration(t,s,r).signal};if(arguments.length){let f=e(a,u);if(arguments.length>1)return f}return n}}function K(i,t,e={},r=o=>o,n={}){i=Z(i),T(r)&&([n,r]=[r,l=>l]);function o(l,c){return arguments.length>1?r(c):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let s=new W(i,{operation:t,...e}),a=st.getInstance(i,!1,n.namespace);return a?a.emit(s,o):o(s)}function he(i){return i===1/0||Array.isArray(i)}function Z(i,t=!0){if((!i||!M(i))&&t)throw new Error(`Object must be of type object or array! "${At(i)}" given.`);return i instanceof W&&(i=i.value),i&&Gt(i)}function wi(i,t,e,r={}){return t===1/0?r.level&&!M(i)?e([]):Qt(i,e,r):e(k(t,!1))}var xi={...Fe,...qe},P=xi;var We=(i,...t)=>{let e=t.pop();if(i.constructor.name==="AsyncFunction")return U(i.call(...t),e);try{return e(i.call(...t))}catch(r){return e(void 0,r)}},U=(i,t)=>i instanceof Promise?i.then(t).catch(e=>t(void 0,e)):t(i),Ve=i=>typeof i=="object"&&i||typeof i=="function";function vr(i){let t=typeof i[i.length-1]=="object"?i.pop():{},e=i.pop()||"";return t.functionParams=i,{source:e,params:t}}var Or={};function It(...i){let t,e={runtimeParams:Oi,compilerParams:vi,parserParams:_i};for(;t=i.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},i.devMode}return e}var _i={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},vi={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Oi={apiVersion:3};var Zt=Object.create(null);var bt=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),Or.setMaxListeners?.(0,this)}fire(t){return this.dispatchEvent(new Event(t,{cancelable:!0}))}on(...t){return this.addEventListener(...t),()=>this.removeEventListener(...t)}abort(t=!1){this.managedAlways.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.clear(),this.fire("abort")}manage(t){this.managedAlways.add(t)}once(t){this.managedOnce.add(t)}};var wt=class extends bt{subscribers=new Set;signals=new Map;constructor(t,e,r){super(),this.context=t,this.context?.once(()=>this.abort()),this.once(()=>this.watchMode(!1)),this.type=e,this.state=r}get name(){return[...this.context?.signals.keys()||[]].find(t=>this.context.signals.get(t)===this)}signal(t,e="prop"){let r=this.signals.get(t);return r||(r=new wt(this,e,e==="object"?t:Ve(this.state)?P.get(this.state,t):void 0),this.signals.set(t,r),this.signals.size===1&&this.watchMode(),r.once(()=>{this.signals.delete(t),this.signals.size||this.watchMode(!1)})),r}subscribe(t){this.subscribers.add(t),t.once(()=>{this.subscribers.delete(t),this.subscribers.size||this.abort()})}watchMode(t=!0){this.mutationsWatch?.abort(),!(!t||!this.signals.size||!Ve(this.state))&&(this.mutationsWatch=P.observe(this.state,e=>{let r={map:new Map,add(o,s){for(let a of o)a.spec.beforeSchedule?.(s)!==!1&&(this.map.has(a.runtime)||this.map.set(a.runtime,new Set),this.map.get(a.runtime).add(a))}};for(let o of e){let s=this.signals.get(o.key);!s||(r.add(s.subscribers,o),s.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,s)=>o.$serial>s.$serial?-1:1):r.map;for(let[o,s]of n)o.state!=="aborted"&&o.schedule(...s)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[e,r]of this.signals)r.refresh(P.get(this.state??{},e));this.watchMode()}};var V=class extends wt{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var tt=class extends bt{state;constructor(t,e,r,n,o,s){super(),t?.once(this),this.context=t,this.type=e,this.spec=r||{},this.scope=o,t?.scope!==o&&this.manage(o),this.serial=n,s&&(this.closure=s),t?.type==="iteration"?this.path=t.path.concat(this.spec.index):t?.type==="round"?this.path=t.path.concat(this.serial):this.path=(t?.path||[]).slice(0,-1).concat(this.serial),this.flowControl=new Map}get runtime(){return this.context.runtime}contains(t){return this===t.context||t.context&&this.contains(t.context)}order(t){if(!t)return this;let[e,r]=t.path.length<this.path.length?[t,this]:[this,t];return e.path.reduce((n,o,s)=>n&&o<=r.path[s],!0)&&e||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){return this.runtime.thread.unshift(this),U(this.beforeExecute(),e=>We(this.closure,this,this,(r,n)=>n?this.throw(n,[this.serial,this.context?.serial],n.code):(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}throw(t,e,r){if(this.type==="function"&&["HandlerFunction","FinalizerFunction"].includes(this.$params.executionMode))return this.$params.lexicalContext.throw(t,e,r);if(this.spec.handler)return this.spec.handler(t);if(this.type!=="function"&&this.context)return this.context.throw(t,e,r);if(t.cause)throw t;let n=`${t.message||t}`,o=r!==null?`[${r}]: ${n}`:n,s=e.map(u=>u!==-1&&this.extractSource(u,!0)).filter(u=>u);s.push({source:this.runtime.$params.originalSource});let a=globalThis[t.name],l=new(a||Error)(o,{cause:s}),c=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw c&&(l.fileName=c),r&&(l.code=r),l}afterExecute(t){this.state="complete";let e=this.flowControl;this.spec.finalizer&&this.spec.finalizer(),this.handleDownstream(e.size,t.size),this.handleRightstream(e.size,t.size);for(let r of["break","continue","return"])e.has(r)&&!e.get(r).endpoint?this.hoistFlowControl(r,e.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,e,r=void 0){let n=Array.isArray(e)?"array":e===null?"null":typeof e;if(n===t||t==="iterable"&&e?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(n))return e;throw t==="iterable"?new Error("value is not iterable."):t==="desctructurable"?new Error((r?`Cannot access ${r}; `:"")+"object not desctructurable."):new Error(`value must be of type ${t}.`)}let(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"let"})}const(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"const"})}var(t,e,r,n={}){n={kind:"var",...n},r||(r=()=>{});let o=n.restOf?(...a)=>{try{return r(...a)}catch(l){throw new Error(`Cannot declare ${t}; ${l.message}`)}}:r,s=(a,l)=>{let c=l.scope;if(n.kind==="var")for(;!["module","function"].includes(c.type)&&!P.has(c.state,t)&&c.context;)c=c.context;else c.type==="this"&&c.context&&(c=c.context);let u=c.symbols.get(t);if(u&&(u.kind!==n.kind||n.kind==="let"&&u.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);u?.reader?.abort(),u={serial:e,kind:n.kind};let f=a;return n.restOf&&(n.type==="array"?f=[]:f={},u.reader=P.map(a,f,{except:n.restOf,spread:n.type==="array"}),l.once(u.reader)),c.symbols.set(t,u),P.set(c.state,t,f),f};return this.autorun(n.kind,{complete:s,...n},e,o)}update(t,e,r={}){let n=this.scope;for(;n&&!P.has(n.state,t);)n=n.context;if(!n)throw new ReferenceError(`${t} is not defined.`);let o=n.symbols.get(t);if(o?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let s=P.get(n.state,t),a=r.restOf?(...l)=>{try{return e(...l)}catch(c){throw new Error(`Cannot update ${t}; ${c.message}`)}}:e;return We(a,void 0,s,(l,c)=>{if(c)return this.throw(c,[this.serial]);o?.reader?.abort();let u=l;return r.restOf&&(o=o||{},r.type==="array"?u=[]:u={},o.reader=P.map(l,u,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),P.set(n.state,t,u),["postinc","postdec"].includes(r.kind)?s:u})}ref(t,...e){let r=0,n={};typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift());let o=this.scope;for(;o&&!P.has(o.state,t);)o=o.context;if(!o){if(n.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let s=o.symbols.get(t)?.kind,a=o.signal(t,s);return n.typed&&this.typed(n.typed,a.state,t),this.autobind(a,r,n)}obj(t,...e){let r=0,n={};return typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,n)}autobind(t,e,r){let n=["QuantumProgram","QuantumFunction"].includes(this.runtime.$params.executionMode),o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",l=this.spec.static,c=this;return function u(f,d){if(n&&!l&&!o&&!s&&!a&&f.subscribe(c),!d||!f.state||typeof f.state!="object"){let h=f.state;return typeof f.state=="function"&&(h=P.proxy(f.state,{membrane:f})),h}let p;return P.proxy(f.state,{},h=>({...h,get(w,S,g=null){return p?h.get(w,S,g):(p=!0,u(f.signal(S),d-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},s=tt,a=this.scope;if(t==="iteration"){let c=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?c.AutoAsyncIterator:c.AutoIterator}["block","switch","iteration"].includes(t)&&(a=new V(a,t));let l=new s(this,t,o,n,a,r);if(t==="downstream"){if(this.downstream=l,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return l.execute()}function(t,e,r,n){e==="Declaration"&&P.set(this.scope.state,n.name,n);let o=this;return Object.defineProperty(n,"toString",{value:function(s=!1){if(s&&t==="QuantumFunction")return Function.prototype.toString.call(n);let a=o.runtime.extractSource(r);return a.startsWith("static ")?a.replace("static ",""):a}}),n}class(t,e,r){return t==="Declaration"&&P.set(this.scope.state,e.name,e),r.forEach(({name:o,isQuantumFunction:s,static:a,serial:l})=>{this.function(s&&"QuantumFunction"||"RegularFunction","Expression",l,a?e[o]:e.prototype[o])}),e}async import(...t){return this.runtime.import(...t)}async export(...t){return this.runtime.export(...t)}continue(t){return this.applyFlowControl("continue",t)}break(t){return this.applyFlowControl("break",t)}return(t){return this.applyFlowControl("return",t)}applyFlowControl(t,e,r=!1){let n=this.flowControl.size;if(r?this.flowControl.delete(t):this.flowControl.set(t,{arg:e}),this.type==="round"&&(this.context.breakpoint=this),this.type==="round"&&["break","continue"].includes(t)&&e===this.context?.spec.label){r||(this.flowControl.get(t).endpoint=!0),this.state!=="running"&&this.handleRightstream(this.flowControl.size,n);return}if(this.context?.type==="switch"&&t==="break"&&!e){r||(this.flowControl.get(t).endpoint=!0),this.context.breakpoint=this;return}this.state!=="running"&&(this.handleDownstream(this.flowControl.size,n),this.hoistFlowControl(...arguments))}hoistFlowControl(...t){return this.context?.applyFlowControl(...t)}flowControlApplied(t,e){return arguments.length?arguments.length===1?this.flowControl.has(t):this.flowControl.get(t)?.arg===e:this.flowControl.size||!1}handleDownstream(t,e){let r;!["block"].includes(this.type)||!(r=this.context?.downstream)||(t?r.abort():e&&(r.state="resuming",this.runtime.schedule(r)))}handleRightstream(t,e){if(this.type!=="round")return;let r=this,n=new Set;for(;r=r.nextRound;)t?r.abort():e&&r.state!=="inert"&&(r.state="resuming",n.add(r));n.size&&this.runtime.schedule(...n),!t&&e&&this.runtime.on("reflection",()=>{this.context.iterating||this.context.iterate()},{once:!0})}abort(t=!1){return t&&(this.context?.breakpoint===this&&delete this.context.breakpoint,this.flowControl.clear()),this.state=t?"inert":"aborted",super.abort(t)}};var xt=class extends tt{rounds=new Map;constructor(t,e,r,n,o,s){r.$closure=s,super(t,e,r,n,o),this.manage(()=>{delete this.breakpoint,this.rounds.clear()})}pseudorun(t){return this.runtime.iThread.unshift(this),U(t(),e=>(this.runtime.iThread.pop(),e))}createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:()=>({done:!this.pseudorun(()=>this.spec.test(this))})}}closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=this.spec.parameters(this),this.iterator=this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&this.spec.init(this),this.iterator=this.createIterator()),this.iterate()}terminated(){return this.breakpoint&&!this.breakpoint.flowControlApplied("continue",this.spec.label)&&this.breakpoint.flowControlApplied()}advance(){this.spec.kind==="for"&&this.pseudorun(()=>this.spec.advance(this))}iterate(){this.iterating=!0;let t=()=>!this.terminated()&&!(this.cursor=this.iterator.next()).done,e=()=>{this.createRound(this.cursor.value).execute(),this.advance()};if(this.spec.kind==="do-while")do e();while(t());else for(;t();)e();this.iterating=!1}createRound(t){let e=this.rounds.size,r={index:e},n=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},o=new V(this.scope,"round",n);this.scope.symbols.forEach((l,c)=>{o.symbols.set(c,l)});let s=new tt(this,"round",r,this.serial,o,this.spec.$closure),a=this.spec.kind==="for-in"?t:e;return this.rounds.set(a,s),this.lastRound&&(this.lastRound.nextRound=s,s.prevRound=this.lastRound),this.lastRound=s,s}watchMode(){if(this.spec.static)return;let t=(e,r)=>{let n=new Set,o=new Set;for(let s of e){if(Array.isArray(this.iteratee)&&s.key==="length")continue;let a=this.spec.kind==="for-in"?s.key:s.value,l=this.spec.kind==="for-in"?s.key:parseInt(s.key),c=this.rounds.get(l);if(c)P.set(c.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(l,void 0),c.prevRound&&(c.prevRound.nextRound=c.nextRound),c.nextRound&&(c.nextRound.prevRound=c.prevRound),n.add(c));else if(s.type!=="delete"&&!s.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(a)}}this.runtime.on("reflection",()=>{n.forEach(s=>s.abort(!0))},{once:!0}),o.size&&(this.iterator=function*(s){yield*s,yield*o}(this.iterator),r.done&&this.iterate())};this.once(P.observe(this.iteratee,e=>{U(this.cursor,r=>t(e,r))}))}};var Kt=class extends xt{async createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:async()=>({done:!await this.pseudorun(()=>this.spec.test(this))})}}async closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=await this.spec.parameters(this),this.iterator=await this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&await this.spec.init(this),this.iterator=await this.createIterator()),await this.iterate()}async iterate(){let t;this.iterating=!0;let e=async()=>!this.terminated()&&(this.cursor=this.iterator.next())&&(t=await this.cursor)&&!t.done,r=async()=>{await this.createRound(t.value).execute(),await this.advance()};if(this.spec.kind==="do-while")do await r();while(await e());else for(;await e();)await r();this.iterating=!1}};var _t=class{constructor(t){Object.defineProperty(this,"runtime",{value:t});let e={statechange:()=>{P.defineProperty(this,"value",{value:t.flowControl.get("return")?.arg,enumerable:!0,configurable:!0})}};for(let r in e)t.on(r,e[r]),e[r]();t.$params.sourceType==="module"&&Object.defineProperty(this,"exports",{value:t.exports})}dispose(){return this.runtime.abort(!0)}};var vt=class extends tt{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){let{$serial:s=0,spec:a,...l}=r;super(t,e,a,-1,n,o),this.$serial=s,this.$params=l,this.$objects=new V(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{P.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,e=!1){let[[r,n,o],[s]]=this.locations[t],a=this.$params.originalSource.slice(r,s);return e?{expr:a,line:n,column:o}:a}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let e=this.queue.size;for(let r of t)this.queue.add(r);if(!e)return this.flowControlDirty=!1,function r(n,o){let s;for(let a of this.queue){if(o&&o.order(a)!==o||["aborted","running"].includes(a.state)||this.iThread[0]?.contains(a)){this.queue.delete(a);continue}s=s?s.order(a):a,o||(o=s)}return s?(s.abort(),s.execute(a=>(this.queue.delete(s),r.call(this,a,s)))):(this.fire("reflection"),this.flowControlApplied()&&this.fire("statechange"),n)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(e=>{let n=["QuantumProgram","QuantumFunction"].includes(this.$params.executionMode)?new _t(this):this.flowControl.get("return")?.arg;return t?t(n,this):n})}spawn(t,e,r,n=null){let o=this.nowRunning||n||this,s={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:n},a=new V(o.scope,"function",{this:e});return new this.constructor(o,"function",s,a,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,n=s=>{if(r.forExport||r.isDynamic)return s;this.assignModules(t,this.scope.state,s,e.serial)};if(this.$params.experimentalFeatures!==!1&&Zt[r.source])return n(Zt[r.source]);let o=(async()=>{let s=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return n(await import(r.source))}catch(a){a.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${s?` imported at "${s}"`:""}.`),[r.serial],a.code):this.throw(a,[r.serial],a.code)}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(o),o}async export(...t){let e=Array.isArray(t[t.length-1])?null:t.pop(),r=e?await this.import({...e,forExport:!0}):this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,n=null){let o=[],s=["QuantumProgram","QuantumFunction"].includes(this.$params.executionMode);for(let[a,l,c]of t){if(a==="*"&&c){(s?P:Reflect).set(e,c,r);continue}P.has(r,a)||this.throw(new Error(`The requested module does not provide an export named "${a}".`),[l,n]),(s?P:Reflect).set(e,c||a,P.get(r,a)),o.push([a,l,c])}!o.length||!s||this.once(P.observe(r,a=>{for(let[l,,c]of o)for(let u of a)l==="*"?P.set(e,u.key,u.value):u.key===l&&P.set(e,c||l,u.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(Zt[this.$params.exportNamespace]=this.exports,this.once(()=>{delete Zt[this.$params.exportNamespace]})),super.afterExecute(...t)}};F(vt,"AutoAsyncIterator",Kt),F(vt,"AutoIterator",xt);function me(i,t,e,r){let{env:n,functionParams:o=[],exportNamespace:s,fileName:a}=r,{parserParams:l,compilerParams:c,runtimeParams:u}=It(r),f=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,d=["async-script","module"].includes(i);if(i==="module")l.sourceType=i,l.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(i)){let h=" "+e.split(`
|
|
1
|
+
(()=>{var dr=Object.defineProperty;var Kr=(i,t,e)=>t in i?dr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var $e=(i,t)=>{for(var e in t)dr(i,e,{get:t[e],enumerable:!0})};var W=(i,t,e)=>(Kr(i,typeof t!="symbol"?t+"":t,e),e),pr=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var F=(i,t,e)=>(pr(i,t,"read from private field"),e?e.call(i):t.get(i)),Wt=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)},Pt=(i,t,e,r)=>(pr(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e);var ze={};$e(ze,{AsyncQuantumFunction:()=>Sr,AsyncQuantumScript:()=>Rt,Observer:()=>P,QuantumAsyncFunction:()=>$i,QuantumAsyncScript:()=>Ai,QuantumFunction:()=>Si,QuantumModule:()=>re,QuantumScript:()=>Ei,State:()=>vt});var Fe={};$e(Fe,{apply:()=>fe,batch:()=>he,construct:()=>qe,defineProperties:()=>yi,defineProperty:()=>Yt,deleteProperties:()=>bi,deleteProperty:()=>Zt,get:()=>at,getOwnPropertyDescriptor:()=>de,getOwnPropertyDescriptors:()=>mi,getPrototypeOf:()=>ke,has:()=>pe,intercept:()=>hi,isExtensible:()=>Re,map:()=>gi,observe:()=>He,ownKeys:()=>Jt,path:()=>pi,preventExtensions:()=>De,reduce:()=>Le,set:()=>bt,setPrototypeOf:()=>Ne});function T(i){return!Array.isArray(i)&&typeof i=="object"&&i}function Ct(i){return typeof i}function A(i){return Array.isArray(i)}function Ee(i,t,e=null){return A(t)?i.filter(r=>e?t.filter(n=>e(r,n)).length:t.indexOf(r)!==-1):[]}function D(i,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new Vt}),!arguments.length)return globalThis.webqit.refs;let e=globalThis.webqit.refs.get(i);e||(e=new Vt,globalThis.webqit.refs.set(i,e));let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new Vt,n.set(r,e));return e}var Vt=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,e){let r=super.set(t,e);return this.fire("set",t,e,t),r}delete(t){let e=super.delete(t);return this.fire("delete",t),e}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,e,r){let n={type:t,key:e,callback:r};return this.observers.add(n),()=>this.observers.delete(n)}unobserve(t,e,r){if(Array.isArray(t)||Array.isArray(e))throw new Error('The "type" and "key" arguments can only be strings.');for(let n of this.observers)!(ae([t,"*"],n.type)&&ae([e,"*"],n.key)&&n.callback===r)||this.observers.delete(n)}fire(t,e,...r){for(let n of this.observers)!(ae([t,"*"],n.type)&&ae([e,"*"],n.key))||n.callback(...r)}},ae=(i,t)=>Array.isArray(t)?Ee(i,t).length:i.includes(t);function Tt(i){return typeof i=="function"}function Bt(i){return i===null||i===""}function ot(i){return arguments.length&&(i===void 0||typeof i>"u")}function M(i){return Array.isArray(i)||typeof i=="object"&&i||Tt(i)}function Ae(i){return Bt(i)||ot(i)||i===!1||i===0||M(i)&&!Object.keys(i).length}function I(i){return Tt(i)||i&&{}.toString.call(i)==="[object function]"}function zt(i){return i instanceof Number||typeof i=="number"}function X(i){return zt(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function It(i){return i instanceof String||typeof i=="string"&&i!==null}function Pe(i){return!It(i)&&!ot(i.length)}function ce(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function Ce(r,t){t=t||Object.prototype,t=t&&!A(t)?[t]:t;for(var e=[],r=r;r&&(!t||t.indexOf(r)<0)&&r.name!=="default";)e.push(r),r=r?Object.getPrototypeOf(r):null;return e}function Te(i,t){var e=[];return Ce(i,t).forEach(r=>{ce(e,...Object.getOwnPropertyNames(r))}),e}function Z(i,t,e=!1,r=!1,n=!1){var o=0,s=i.shift();if((X(s)||s===!0||s===!1)&&(o=s,s=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((a,l)=>{!M(a)&&!I(a)||(e?Te(a):Object.keys(a)).forEach(c=>{if(!!t(c,s,a,l)){var u=s[c],f=a[c];if((A(u)&&A(f)||T(u)&&T(f))&&(o===!0||o>0))s[c]=A(u)&&A(f)?[]:{},Z([X(o)?o-1:o,s[c],u,f],t,e,r,n);else if(A(s)&&A(a))r?s[c]=f:s.push(f);else try{n?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(a,c)):s[c]=a[c]}catch{}}})}),s}function Ut(...i){return Z(i,(t,e,r)=>!0,!1,!1,!1)}function q(i,t=!0){return A(i)?i:!t&&T(i)?[i]:i!==!1&&i!==0&&Ae(i)?[]:Pe(i)?Array.prototype.slice.call(i):T(i)?Object.values(i):[i]}var j=(...i)=>D("observer-api",...i),Mt=(i,t)=>i instanceof Promise?i.then(t):t(i),le={};var gt=class{constructor(t,e){this.registry=t,Object.assign(this,{...e,target:t.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var Gt=class extends gt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),le.setMaxListeners?.(0,this.signal)}remove(){this.abortController.abort(),super.remove()}fire(t){if(this.emit.recursionTarget&&!["inject","force-async","force-sync"].includes(this.params.recursions))return;let e=t,r=this.filter;if(r!==1/0&&(r=q(r,!1))&&(e=t.filter(o=>r.includes(o.key))),this.params.diff&&(e=e.filter(o=>o.type!=="set"||o.value!==o.oldValue)),!e.length)return;if(["inject","defer"].includes(this.params.recursions)){if(this.emit.recursionTarget){this.emit.recursionTarget.push(...e);return}this.emit.recursionTarget=this.params.recursions==="inject"?e:[]}let n=this.filter===1/0||Array.isArray(this.filter)?this.emit(e,this):this.emit(e[0],this);return Mt(n,o=>{let s=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&s?.length?this.emit.currentRegistration.fire(s):o})}};var yt=class{constructor(t){this.target=t,this.entries=[]}addRegistration(t){return this.entries.push(t),t}removeRegistration(t){this.entries=this.entries.filter(e=>e!==t)}static _getInstance(t,e,r=!0,n=this.__namespace){if(!M(e))throw new Error(`Subject must be of type object; "${Ct(e)}" given!`);let o=this;return n&&j("namespaces").has(t+"-"+n)&&(o=j("namespaces").get(t+"-"+n),t+="-"+n),!j(e,"registry").has(t)&&r&&j(e,"registry").set(t,new o(e)),j(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return j("namespaces").get(t);if(!(r.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${e} must be a subclass of ${this.name}.`);j("namespaces").set(t,r),r.__namespace=e}};var V=class{constructor(t,e){if(this.target=t,!e.operation)throw new Error("Descriptor operation must be given in definition!");Object.assign(this,e)}};var ut=class extends yt{static getInstance(t,e=!0,r=null){return super._getInstance("listeners",...arguments)}static namespace(t,e=null){return super._namespace("listeners",...arguments)}constructor(t){super(t),this.batches=[]}addRegistration(t,e,r){return super.addRegistration(new Gt(this,{filter:t,emit:e,params:r}))}emit(t,e=!1){if(this.batches.length){this.batches[0].snapshots.push({events:[...t],isPropertyDescriptors:e});return}this.$emit(this.entries,[{events:t,isPropertyDescriptors:e}])}$emit(t,e){let r=t.filter(l=>l.params.withPropertyDescriptors).length,n=e.some(l=>l.isPropertyDescriptors),o=[],s=[],a=t.length;e.forEach(l=>{(r||!n)&&o.push(...l.events),r!==a&&n&&(l.isPropertyDescriptors?s.push(...l.events.map(c=>{let{target:u,type:f,...d}=c,p=new V(u,{type:"set",...d});return Object.defineProperty(p,"value","get"in d.value?{get:()=>d.value.get()}:{value:d.value.value}),d.oldValue&&Object.defineProperty(p,"oldValue","get"in d.oldValue?{get:()=>d.oldValue.get()}:{value:d.oldValue.value}),p})):s.push(...l.events))}),t.forEach(l=>{l.params.withPropertyDescriptors?l.fire(o.length?o:s):l.fire(s.length?s:o)})}batch(t){this.batches.unshift({entries:[...this.entries],snapshots:[]});let e=t();return Mt(e,r=>{let n=this.batches.shift();return n.snapshots.length&&this.$emit(n.entries,n.snapshots),r})}};var Qt=class extends gt{exec(t,e,r){return this.running||!this.traps[t.operation]?e(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[t.operation](t,r,(...n)=>(this.running=!1,e(...n))))}};var st=class extends yt{static getInstance(t,e=!0,r=null){return super._getInstance("traps",...arguments)}static namespace(t,e=null){return super._namespace("traps",...arguments)}addRegistration(t){return super.addRegistration(new Qt(this,t))}emit(t,e=null){let r=this;return function n(o,...s){let a=r.entries[o];return a?a.exec(t,(...l)=>n(o+1,...l),...s):e?e(t,...s):s[0]}(0)}};var je={};$e(je,{accessorize:()=>fi,proxy:()=>xr,unaccessorize:()=>di,unproxy:()=>Xt});function fi(i,t,e={}){i=ue(i);let r=j(i,"accessorizedProps");function n(l){let c,u=i;do c=Object.getOwnPropertyDescriptor(u,l);while(!c&&(u=Object.getPrototypeOf(u)));return c?{proto:u,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(l){if(r.has(l+""))return!0;let c=n(l);c.getValue=function(d=!1){return d?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(d,p=!1){if(this.dirty=!0,p){this.descriptor=d;return}return this.descriptor.set?this.descriptor.set(d)!==!1:(this.descriptor.value=d,!0)},c.intact=function(){let d=Object.getOwnPropertyDescriptor(i,l);return d?.get===f.get&&d?.set===f.set&&r.get(l+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[l]:Object.defineProperty(i,l,this.descriptor),r.delete(l+""),!0):!1},r.set(isNaN(l)?l:parseInt(l),c);let{enumerable:u=!0}=c.descriptor,f={enumerable:u,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(f.set=function(d){return bt(this,l,d,e)}),("value"in c.descriptor||c.descriptor.get)&&(f.get=function(){return at(this,l,e)});try{return Object.defineProperty(i,l,f),!0}catch{return r.delete(l+""),!1}}let a=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(o);return t===void 0||Array.isArray(t)?a:a[0]}function di(i,t,e={}){i=ue(i);let r=j(i,"accessorizedProps");function n(a){return r.has(a+"")?r.get(a+"").restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(n);return t===void 0||Array.isArray(t)?s:s[0]}function xr(i,t={},e=void 0){let r=ue(i);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&j(r,"membraneRef").has(t.membrane))return j(r,"membraneRef").get(t.membrane);let n={apply(a,l,c){if(Array.isArray(l)){let u=ue(l);return j(u).set("$length",u.length),he(u,()=>fe(a,l,c))}return fe(a,Xt(l),c)},construct:(a,l,c=null)=>qe(a,l,c,t),defineProperty:(a,l,c)=>Yt(a,l,c,t),deleteProperty:(a,l)=>Zt(a,l,t),get:(a,l,c=null)=>{let u={...t,receiver:c};Array.isArray(a)&&l==="length"&&j(a).has("$length")&&(u.forceValue=j(a).get("$length"));let f=at(a,l,u);return Array.isArray(a)&&typeof f=="function"?xr(f,{...t,membrane:c}):f},getOwnPropertyDescriptor:(a,l)=>de(a,l,t),getPrototypeOf:a=>ke(a,t),has:(a,l)=>pe(a,l,t),isExtensible:a=>Re(a,t),ownKeys:a=>Jt(a,t),preventExtensions:a=>De(a,t),set:(a,l,c,u=null)=>{let f={...t,receiver:u};return Array.isArray(a)&&l==="length"&&(f.forceOldValue=j(a).get("$length"),j(a).set("$length",c)),bt(a,l,c,f)},setPrototypeOf:(a,l)=>Ne(a,l,t)},o=e?.(n)||n,s=new Proxy(r,o);return t.membrane&&j(r,"membraneRef").set(t.membrane,s),j(s).set(s,r),s}function Xt(i){return j(i).get(i)||i}function ue(i){if(!i||!M(i))throw new Error("Target must be of type object!");return Xt(i)}var Kt=class extends Array{};function pi(...i){return new Kt(...i)}function Le(i,t,e,r=o=>o,n={}){if(!!t.length)return function o(s,a,l){let c=a[l.level],u=l.level===a.length-1;return s instanceof V&&s.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!u}),e(s,c,(f,...d)=>{let p=x=>{x instanceof V&&(x.path=[x.key],s instanceof V&&(x.path=s.path.concat(x.key),Object.defineProperty(x,"context",{get:()=>s,configurable:!0})))},m=x=>{let S=K(x,!1);return Mt(S,g=>{x instanceof V?x.value=g:x=g;let _=d[0]||{};return o(x,a,{...l,..._,level:l.level+1})})};return me(c)&&Array.isArray(f)?(f.forEach(p),u?r(f,...d):f.map(m)):(p(f),u?r(f,...d):m(f))},l)}(i,t.slice(0),{...n,level:0})}function He(i,t,e,r={}){if(i=K(i,!r.level),I(arguments[1])&&([,e,r={}]=arguments,t=1/0),!I(e))throw new Error(`Handler must be a function; "${Ct(e)}" given!`);if(t instanceof Kt)return Le(i,t,He,e,r);if(r={...r,descripted:!0},delete r.live,!M(i))return r.probe&&at(i,t,e,r);let n=_r(i,t,e,r);return r.probe?at(i,t,n,r):n()}function hi(i,t,e={}){return i=K(i),T(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),st.getInstance(i,!0,e.namespace).addRegistration({traps:t,params:e})}function de(i,t,e=n=>n,r={}){return tt(i,"getOwnPropertyDescriptor",{key:t},e,r)}function mi(i,t,e=n=>n,r={}){return tt(i,"getOwnPropertyDescriptors",{key:t},e,r)}function ke(i,t=r=>r,e={}){return tt(i,"getPrototypeOf",{},t,e)}function Re(i,t=r=>r,e={}){return tt(i,"isExtensible",{},t,e)}function Jt(i,t=r=>r,e={}){return tt(i,"ownKeys",{},t,e)}function pe(i,t,e=n=>n,r={}){return tt(i,"has",{key:t},e,r)}function at(i,t,e=n=>n,r={}){let n,o=K(i,!r.level);return T(e)?[r,e]=[e,s=>s]:r.live&&(n=!0),t instanceof Kt?Le(o,t,at,e,r):wi(o,t,s=>{let a=[...s];return function l(c,u,f){if(!u.length)return f(c);let d=u.shift();if(!["string","number","symbol"].includes(typeof d))throw new Error(`Property name/key ${d} invalid.`);function p(S,g=void 0){let _=h=>(S.value=h,l([...c,r.live||r.descripted?S:h],u,f));if(arguments.length>1)return _(g);if(!M(o))return _(o?.[S.key]);let O=j(o,"accessorizedProps",!1),y=O&&O.get(S.key);if(y&&y.intact())return _(y.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let h=Object.getOwnPropertyDescriptor(o,S.key);return"forceValue"in r&&"value"in h&&(h.value=r.forceValue),_(h)}return"forceValue"in r?_(r.forceValue):_(Reflect.get(o,S.key))}let m=new V(o,{type:"get",key:d,value:void 0,operation:"get",related:a});if(!M(o))return p(m);let x=st.getInstance(o,!1,r.namespace);return x?x.emit(m,p):p(m)}([],s.slice(0),l=>{let c=me(t)?l:l[0];return n&&M(o)?_r(o,t,e,r)(c):e(c)})},r)}function he(i,t,e={}){return i=K(i),ut.getInstance(i,!0,e.namespace).batch(t)}function gi(i,t,e={}){t=K(t),i=K(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Jt(e.spread?[...i]:i).map(c=>isNaN(c)?c:parseInt(c)),s=r.length?r.filter(c=>o.includes(c)):o.filter(c=>!n.includes(c)),a=c=>!Array.isArray(t)||isNaN(c)?c:c-n.filter(u=>u<c).length,l=c=>{let u=de(i,c,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?bt(t,a(c),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&Yt(t,c,{...u,configurable:!0},e)};return he(t,()=>{s.forEach(l)}),He(i,c=>{c.filter(u=>r.length?r.includes(u.key):!n.includes(u.key)).forEach(u=>{if(u.operation==="deleteProperty")return Zt(t,a(u.key),e);if(u.operation==="defineProperty"){(u.value.enumerable||e.onlyEnumerable===!1)&&Yt(t,a(u.key),{...u.value,configurable:!0},e);return}l(u.key)})},{...e,withPropertyDescriptors:!0})}function bt(i,t,e,r=s=>s,n={},o=!1){let s=K(i),a=[[t,e]];T(t)&&([,,r=c=>c,n={},o=!1]=arguments,a=Object.entries(t)),T(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,c=>c]);let l=a.map(([c])=>c);return function c(u,f,d){if(!f.length)return d(u);let[p,m]=f.shift();function x(g,_=void 0){let O=w=>(g.status=w,c(u.concat(g),f,d));if(arguments.length>1)return O(g,_);let y=j(s,"accessorizedProps",!1),h=y&&y.get(g.key);return g.operation==="defineProperty"?(h&&!h.restore()&&O(!1),Object.defineProperty(s,g.key,g.value),O(!0)):h&&h.intact()?O(h.setValue(g.value)):O(Reflect.set(s,g.key,g.value))}function S(g,_){if(n.diff&&m===_)return c(u,f,d);let O=new V(s,{type:o?"def":"set",key:p,value:m,isUpdate:g,oldValue:_,related:[...l],operation:o?"defineProperty":"set",detail:n.detail}),y=st.getInstance(s,!1,n.namespace);return y?y.emit(O,x):x(O)}return pe(s,p,g=>{if(!g)return S(g);let _={...n,withPropertyDescriptors:o};return"forceOldValue"in n&&(_.forceValue=n.forceOldValue),at(s,p,O=>S(g,O),_)},n)}([],a.slice(0),c=>{let u=ut.getInstance(s,!1,n.namespace);return u&&u.emit(c,o),r(me(t)?c.map(f=>f.status):c[0]?.status)})}function Yt(i,t,e,r=o=>o,n={}){return bt(i,t,e,r,n,!0)}function yi(i,t,e=n=>n,r={}){return bt(i,t,e,r,!0)}function Zt(i,t,e=n=>n,r={}){i=K(i),T(e)&&([r,e]=[e,s=>s]);let n=q(t,!1),o=[...n];return function s(a,l,c){if(!l.length)return c(a);let u=l.shift();function f(p,m=void 0){let x=_=>(p.status=_,s(a.concat(p),l,c));if(arguments.length>1)return x(p,m);let S=j(i,"accessorizedProps",!1),g=S&&S.get(p.key);return g&&!g.restore()&&x(!1),x(Reflect.deleteProperty(i,p.key))}function d(p){let m=new V(i,{type:"delete",key:u,oldValue:p,related:[...o],operation:"deleteProperty",detail:r.detail}),x=st.getInstance(i,!1,r.namespace);return x?x.emit(m,f):f(m)}return at(i,u,d,r)}([],n.slice(0),s=>{let a=ut.getInstance(i,!1,r.namespace);return a&&a.emit(s),e(me(t)?s.map(l=>l.status):s[0].status)})}function bi(i,t,e=n=>n,r={}){return Zt(...arguments)}function qe(i,t,e=null,r=o=>o,n={}){return tt(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function fe(i,t,e,r=o=>o,n={}){return tt(i,"apply",{thisArgument:t,argumentsList:e},r,n)}function Ne(i,t,e=n=>n,r={}){return tt(i,"setPrototypeOf",{proto:t},e,r)}function De(i,t=r=>r,e={}){return tt(i,"preventExtensions",{},t,e)}function _r(i,t,e,r={}){let n=new AbortController;le.setMaxListeners?.(0,n.signal),r.signal&&r.signal.addEventListener("abort",()=>n.abort()),r={...r,signal:n.signal};let o=ut.getInstance(i,!0,r.namespace);return function s(a,l=null){l?.remove();let u={signal:o.addRegistration(t,s,r).signal};if(arguments.length){let f=e(a,u);if(arguments.length>1)return f}return n}}function tt(i,t,e={},r=o=>o,n={}){i=K(i),T(r)&&([n,r]=[r,l=>l]);function o(l,c){return arguments.length>1?r(c):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let s=new V(i,{operation:t,...e}),a=st.getInstance(i,!1,n.namespace);return a?a.emit(s,o):o(s)}function me(i){return i===1/0||Array.isArray(i)}function K(i,t=!0){if((!i||!M(i))&&t)throw new Error(`Object must be of type object or array! "${Ct(i)}" given.`);return i instanceof V&&(i=i.value),i&&Xt(i)}function wi(i,t,e,r={}){return t===1/0?r.level&&!M(i)?e([]):Jt(i,e,r):e(q(t,!1))}var xi={...Fe,...je},P=xi;var We=(i,...t)=>{let e=t.pop();if(i.constructor.name==="AsyncFunction")return G(i.call(...t),e);try{return e(i.call(...t))}catch(r){return e(void 0,r)}},G=(i,t)=>i instanceof Promise?i.then(t).catch(e=>t(void 0,e)):t(i),Ve=i=>typeof i=="object"&&i||typeof i=="function";function vr(i){let t=typeof i[i.length-1]=="object"?i.pop():{},e=i.pop()||"";return t.functionParams=i,{source:e,params:t}}var Or={};function jt(...i){let t,e={runtimeParams:Oi,compilerParams:vi,parserParams:_i};for(;t=i.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},i.devMode}return e}var _i={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},vi={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Oi={apiVersion:3};var te=Object.create(null);var wt=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),Or.setMaxListeners?.(0,this)}fire(t){return this.dispatchEvent(new Event(t,{cancelable:!0}))}on(...t){return this.addEventListener(...t),()=>this.removeEventListener(...t)}abort(t=!1){this.managedAlways.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.clear(),this.fire("abort")}manage(t){this.managedAlways.add(t)}once(t){this.managedOnce.add(t)}};var xt=class extends wt{subscribers=new Set;signals=new Map;constructor(t,e,r){super(),this.context=t,this.context?.once(()=>this.abort()),this.once(()=>this.watchMode(!1)),this.type=e,this.state=r}get name(){return[...this.context?.signals.keys()||[]].find(t=>this.context.signals.get(t)===this)}signal(t,e="prop"){let r=this.signals.get(t);return r||(r=new xt(this,e,e==="object"?t:Ve(this.state)?P.get(this.state,t):void 0),this.signals.set(t,r),this.signals.size===1&&this.watchMode(),r.once(()=>{this.signals.delete(t),this.signals.size||this.watchMode(!1)})),r}subscribe(t){this.subscribers.add(t),t.once(()=>{this.subscribers.delete(t),this.subscribers.size||this.abort()})}watchMode(t=!0){this.mutationsWatch?.abort(),!(!t||!this.signals.size||!Ve(this.state))&&(this.mutationsWatch=P.observe(this.state,e=>{let r={map:new Map,add(o,s){for(let a of o)a.spec.beforeSchedule?.(s)!==!1&&(this.map.has(a.runtime)||this.map.set(a.runtime,new Set),this.map.get(a.runtime).add(a))}};for(let o of e){let s=this.signals.get(o.key);!s||(r.add(s.subscribers,o),s.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,s)=>o.$serial>s.$serial?-1:1):r.map;for(let[o,s]of n)o.state!=="aborted"&&o.schedule(...s)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[e,r]of this.signals)r.refresh(P.get(this.state??{},e));this.watchMode()}};var B=class extends xt{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var et=class extends wt{state;constructor(t,e,r,n,o,s){super(),t?.once(this),this.context=t,this.type=e,this.spec=r||{},this.scope=o,t?.scope!==o&&this.manage(o),this.serial=n,s&&(this.closure=s),t?.type==="iteration"?this.path=t.path.concat(this.spec.index):t?.type==="round"?this.path=t.path.concat(this.serial):this.path=(t?.path||[]).slice(0,-1).concat(this.serial),this.flowControl=new Map}get runtime(){return this.context.runtime}contains(t){return this===t.context||t.context&&this.contains(t.context)}order(t){if(!t)return this;let[e,r]=t.path.length<this.path.length?[t,this]:[this,t];return e.path.reduce((n,o,s)=>n&&o<=r.path[s],!0)&&e||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){return this.runtime.thread.unshift(this),G(this.beforeExecute(),e=>We(this.closure,this,this,(r,n)=>n?this.throw(n,[this.serial,this.context?.serial],n.code):(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}throw(t,e,r){if(this.type==="function"&&["HandlerFunction","FinalizerFunction"].includes(this.$params.executionMode))return this.$params.lexicalContext.throw(t,e,r);if(this.spec.handler)return this.spec.handler(t);if(this.type!=="function"&&this.context)return this.context.throw(t,e,r);if(t.cause)throw t;let n=`${t.message||t}`,o=r!==null?`[${r}]: ${n}`:n,s=e.map(u=>u!==-1&&this.extractSource(u,!0)).filter(u=>u);s.push({source:this.runtime.$params.originalSource});let a=globalThis[t.name],l=new(a||Error)(o,{cause:s}),c=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw c&&(l.fileName=c),r&&(l.code=r),l}afterExecute(t){this.state="complete";let e=this.flowControl;this.spec.finalizer&&this.spec.finalizer(),this.handleDownstream(e.size,t.size),this.handleRightstream(e.size,t.size);for(let r of["break","continue","return"])e.has(r)&&!e.get(r).endpoint?this.hoistFlowControl(r,e.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,e,r=void 0){let n=Array.isArray(e)?"array":e===null?"null":typeof e;if(n===t||t==="iterable"&&e?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(n))return e;throw t==="iterable"?new Error("value is not iterable."):t==="desctructurable"?new Error((r?`Cannot access ${r}; `:"")+"object not desctructurable."):new Error(`value must be of type ${t}.`)}let(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"let"})}const(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"const"})}var(t,e,r,n={}){n={kind:"var",...n},r||(r=()=>{});let o=n.restOf?(...a)=>{try{return r(...a)}catch(l){throw new Error(`Cannot declare ${t}; ${l.message}`)}}:r,s=(a,l)=>{let c=l.scope;if(n.kind==="var")for(;!["module","function"].includes(c.type)&&!P.has(c.state,t)&&c.context;)c=c.context;else c.type==="this"&&c.context&&(c=c.context);let u=c.symbols.get(t);if(u&&(u.kind!==n.kind||n.kind==="let"&&u.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);u?.reader?.abort(),u={serial:e,kind:n.kind};let f=a;return n.restOf&&(n.type==="array"?f=[]:f={},u.reader=P.map(a,f,{except:n.restOf,spread:n.type==="array"}),l.once(u.reader)),c.symbols.set(t,u),P.set(c.state,t,f),f};return this.autorun(n.kind,{complete:s,...n},e,o)}update(t,e,r={}){let n=this.scope;for(;n&&!P.has(n.state,t);)n=n.context;if(!n)throw new ReferenceError(`${t} is not defined.`);let o=n.symbols.get(t);if(o?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let s=P.get(n.state,t),a=r.restOf?(...l)=>{try{return e(...l)}catch(c){throw new Error(`Cannot update ${t}; ${c.message}`)}}:e;return We(a,void 0,s,(l,c)=>{if(c)return this.throw(c,[this.serial]);o?.reader?.abort();let u=l;return r.restOf&&(o=o||{},r.type==="array"?u=[]:u={},o.reader=P.map(l,u,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),P.set(n.state,t,u),["postinc","postdec"].includes(r.kind)?s:u})}ref(t,...e){let r=0,n={};typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift());let o=this.scope;for(;o&&!P.has(o.state,t);)o=o.context;if(!o){if(n.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let s=o.symbols.get(t)?.kind,a=o.signal(t,s);return n.typed&&this.typed(n.typed,a.state,t),this.autobind(a,r,n)}obj(t,...e){let r=0,n={};return typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,n)}autobind(t,e,r){let n=["QuantumProgram","QuantumFunction"].includes(this.runtime.$params.executionMode),o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",l=this.spec.static,c=this;return function u(f,d){if(n&&!l&&!o&&!s&&!a&&f.subscribe(c),!d||!f.state||typeof f.state!="object"){let m=f.state;return typeof f.state=="function"&&(m=P.proxy(f.state,{membrane:f})),m}let p;return P.proxy(f.state,{},m=>({...m,get(x,S,g=null){return p?m.get(x,S,g):(p=!0,u(f.signal(S),d-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},s=et,a=this.scope;if(t==="iteration"){let c=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?c.AutoAsyncIterator:c.AutoIterator}["block","switch","iteration"].includes(t)&&(a=new B(a,t));let l=new s(this,t,o,n,a,r);if(t==="downstream"){if(this.downstream=l,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return l.execute()}function(t,e,r,n){e==="Declaration"&&P.set(this.scope.state,n.name,n);let o=this;return Object.defineProperty(n,"toString",{value:function(s=!1){if(s&&t==="QuantumFunction")return Function.prototype.toString.call(n);let a=o.runtime.extractSource(r);return a.startsWith("static ")?a.replace("static ",""):a}}),n}class(t,e,r){return t==="Declaration"&&P.set(this.scope.state,e.name,e),r.forEach(({name:o,isQuantumFunction:s,static:a,serial:l})=>{this.function(s&&"QuantumFunction"||"RegularFunction","Expression",l,a?e[o]:e.prototype[o])}),e}async import(...t){return this.runtime.import(...t)}async export(...t){return this.runtime.export(...t)}continue(t){return this.applyFlowControl("continue",t)}break(t){return this.applyFlowControl("break",t)}return(t){return this.applyFlowControl("return",t)}applyFlowControl(t,e,r=!1){let n=this.flowControl.size;if(r?this.flowControl.delete(t):this.flowControl.set(t,{arg:e}),this.type==="round"&&(this.context.breakpoint=this),this.type==="round"&&["break","continue"].includes(t)&&e===this.context?.spec.label){r||(this.flowControl.get(t).endpoint=!0),this.state!=="running"&&this.handleRightstream(this.flowControl.size,n);return}if(this.context?.type==="switch"&&t==="break"&&!e){r||(this.flowControl.get(t).endpoint=!0),this.context.breakpoint=this;return}this.state!=="running"&&(this.handleDownstream(this.flowControl.size,n),this.hoistFlowControl(...arguments))}hoistFlowControl(...t){return this.context?.applyFlowControl(...t)}flowControlApplied(t,e){return arguments.length?arguments.length===1?this.flowControl.has(t):this.flowControl.get(t)?.arg===e:this.flowControl.size||!1}handleDownstream(t,e){let r;!["block"].includes(this.type)||!(r=this.context?.downstream)||(t?r.abort():e&&(r.state="resuming",this.runtime.schedule(r)))}handleRightstream(t,e){if(this.type!=="round")return;let r=this,n=new Set;for(;r=r.nextRound;)t?r.abort():e&&r.state!=="inert"&&(r.state="resuming",n.add(r));n.size&&this.runtime.schedule(...n),!t&&e&&this.runtime.on("reflection",()=>{this.context.iterating||this.context.iterate()},{once:!0})}abort(t=!1){return t&&(this.context?.breakpoint===this&&delete this.context.breakpoint,this.flowControl.clear()),this.state=t?"inert":"aborted",super.abort(t)}};var _t=class extends et{rounds=new Map;constructor(t,e,r,n,o,s){r.$closure=s,super(t,e,r,n,o),this.manage(()=>{delete this.breakpoint,this.rounds.clear()})}pseudorun(t){return this.runtime.iThread.unshift(this),G(t(),e=>(this.runtime.iThread.pop(),e))}createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:()=>({done:!this.pseudorun(()=>this.spec.test(this))})}}closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=this.spec.parameters(this),this.iterator=this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&this.spec.init(this),this.iterator=this.createIterator()),this.iterate()}terminated(){return this.breakpoint&&!this.breakpoint.flowControlApplied("continue",this.spec.label)&&this.breakpoint.flowControlApplied()}advance(){this.spec.kind==="for"&&this.pseudorun(()=>this.spec.advance(this))}iterate(){this.iterating=!0;let t=()=>!this.terminated()&&!(this.cursor=this.iterator.next()).done,e=()=>{this.createRound(this.cursor.value).execute(),this.advance()};if(this.spec.kind==="do-while")do e();while(t());else for(;t();)e();this.iterating=!1}createRound(t){let e=this.rounds.size,r={index:e},n=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},o=new B(this.scope,"round",n);this.scope.symbols.forEach((l,c)=>{o.symbols.set(c,l)});let s=new et(this,"round",r,this.serial,o,this.spec.$closure),a=this.spec.kind==="for-in"?t:e;return this.rounds.set(a,s),this.lastRound&&(this.lastRound.nextRound=s,s.prevRound=this.lastRound),this.lastRound=s,s}watchMode(){if(this.spec.static)return;let t=(e,r)=>{let n=new Set,o=new Set;for(let s of e){if(Array.isArray(this.iteratee)&&s.key==="length")continue;let a=this.spec.kind==="for-in"?s.key:s.value,l=this.spec.kind==="for-in"?s.key:parseInt(s.key),c=this.rounds.get(l);if(c)P.set(c.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(l,void 0),c.prevRound&&(c.prevRound.nextRound=c.nextRound),c.nextRound&&(c.nextRound.prevRound=c.prevRound),n.add(c));else if(s.type!=="delete"&&!s.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(a)}}this.runtime.on("reflection",()=>{n.forEach(s=>s.abort(!0))},{once:!0}),o.size&&(this.iterator=function*(s){yield*s,yield*o}(this.iterator),r.done&&this.iterate())};this.once(P.observe(this.iteratee,e=>{G(this.cursor,r=>t(e,r))}))}};var ee=class extends _t{async createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:async()=>({done:!await this.pseudorun(()=>this.spec.test(this))})}}async closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=await this.spec.parameters(this),this.iterator=await this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&await this.spec.init(this),this.iterator=await this.createIterator()),await this.iterate()}async iterate(){let t;this.iterating=!0;let e=async()=>!this.terminated()&&(this.cursor=this.iterator.next())&&(t=await this.cursor)&&!t.done,r=async()=>{await this.createRound(t.value).execute(),await this.advance()};if(this.spec.kind==="do-while")do await r();while(await e());else for(;await e();)await r();this.iterating=!1}};var vt=class{constructor(t){Object.defineProperty(this,"runtime",{value:t});let e={statechange:()=>{P.defineProperty(this,"value",{value:t.flowControl.get("return")?.arg,enumerable:!0,configurable:!0})}};for(let r in e)t.on(r,e[r]),e[r]();t.$params.sourceType==="module"&&Object.defineProperty(this,"exports",{value:t.exports})}dispose(){return this.runtime.abort(!0)}};var Ot=class extends et{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){let{$serial:s=0,spec:a,...l}=r;super(t,e,a,-1,n,o),this.$serial=s,this.$params=l,this.$objects=new B(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{P.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,e=!1){let[[r,n,o],[s]]=this.locations[t],a=this.$params.originalSource.slice(r,s);return e?{expr:a,line:n,column:o}:a}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let e=this.queue.size;for(let r of t)this.queue.add(r);if(!e)return this.flowControlDirty=!1,function r(n,o){let s;for(let a of this.queue){if(o&&o.order(a)!==o||["aborted","running"].includes(a.state)||this.iThread[0]?.contains(a)){this.queue.delete(a);continue}s=s?s.order(a):a,o||(o=s)}return s?(s.abort(),s.execute(a=>(this.queue.delete(s),r.call(this,a,s)))):(this.fire("reflection"),this.flowControlApplied()&&this.fire("statechange"),n)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(e=>{let n=["QuantumProgram","QuantumFunction"].includes(this.$params.executionMode)?new vt(this):this.flowControl.get("return")?.arg;return t?t(n,this):n})}spawn(t,e,r,n=null){let o=this.nowRunning||n||this,s={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:n},a=new B(o.scope,"function",{this:e});return new this.constructor(o,"function",s,a,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,n=s=>{if(r.forExport||r.isDynamic)return s;this.assignModules(t,this.scope.state,s,e.serial)};if(this.$params.experimentalFeatures!==!1&&te[r.source])return n(te[r.source]);let o=(async()=>{let s=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return n(await import(r.source))}catch(a){a.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${s?` imported at "${s}"`:""}.`),[r.serial],a.code):this.throw(a,[r.serial],a.code)}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(o),o}async export(...t){let e=Array.isArray(t[t.length-1])?null:t.pop(),r=e?await this.import({...e,forExport:!0}):this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,n=null){let o=[],s=["QuantumProgram","QuantumFunction"].includes(this.$params.executionMode);for(let[a,l,c]of t){if(a==="*"&&c){(s?P:Reflect).set(e,c,r);continue}P.has(r,a)||this.throw(new Error(`The requested module does not provide an export named "${a}".`),[l,n]),(s?P:Reflect).set(e,c||a,P.get(r,a)),o.push([a,l,c])}!o.length||!s||this.once(P.observe(r,a=>{for(let[l,,c]of o)for(let u of a)l==="*"?P.set(e,u.key,u.value):u.key===l&&P.set(e,c||l,u.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(te[this.$params.exportNamespace]=this.exports,this.once(()=>{delete te[this.$params.exportNamespace]})),super.afterExecute(...t)}};W(Ot,"AutoAsyncIterator",ee),W(Ot,"AutoIterator",_t);function ge(i,t,e,r){let{env:n,functionParams:o=[],exportNamespace:s,fileName:a}=r,{parserParams:l,compilerParams:c,runtimeParams:u}=jt(r),f=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,d=["async-script","module"].includes(i);if(i==="module")l.sourceType=i,l.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(i)){let m=" "+e.split(`
|
|
2
2
|
`).join(`
|
|
3
3
|
`);e=`return ${i==="async-function"?"async ":""}function**(${o.join(", ")}) {
|
|
4
|
-
${
|
|
5
|
-
}`,l.executionMode="RegularProgram"}else if(!["script","async-script"].includes(i))throw new Error(`Unrecognized sourceType specified: "${i}".`);c.sourceType=i,l.inBrowser=f,c.base64=d&&f&&"export default async function(%0) {%1}";let p=t(e,{parserParams:l,compilerParams:c});if(p instanceof Promise&&!["async-function","async-script","module"].includes(i))throw new Error("Parse-compile can only return a Promise for sourceTypes: async-function, async-script, module.");return u.sourceType=i,u.inBrowser=f,u.exportNamespace=s,u.fileName=a,
|
|
4
|
+
${m}
|
|
5
|
+
}`,l.executionMode="RegularProgram"}else if(!["script","async-script"].includes(i))throw new Error(`Unrecognized sourceType specified: "${i}".`);c.sourceType=i,l.inBrowser=f,c.base64=d&&f&&"export default async function(%0) {%1}";let p=t(e,{parserParams:l,compilerParams:c});if(p instanceof Promise&&!["async-function","async-script","module"].includes(i))throw new Error("Parse-compile can only return a Promise for sourceTypes: async-function, async-script, module.");return u.sourceType=i,u.inBrowser=f,u.exportNamespace=s,u.fileName=a,G(p,m=>{let x=["function","async-function"].includes(i);return G(((g,_)=>{if(u.compileFunction)return u.compileFunction(_.toString(),[g]);if(c.base64){let O=`data:text/javascript;base64,${_.toString("base64")}`;return(()=>import(O).then(h=>h.default))()}return new(d?async function(){}.constructor:Function)(g,_.toString())})(m.identifier+"",m),g=>{let _=(O,y=n)=>{let h=g;O&&(h=h.bind(O));let w="global",b=new B(void 0,w,globalThis);return(i.endsWith("script")||y)&&(w="env",b=new B(b,w,y)),i==="module"&&(w="module",b=new B(b,w)),typeof O<"u"&&(b=new B(b,"this",{this:O})),new Ot(void 0,w,{...u,originalSource:m.originalSource,executionMode:m.isQuantumProgram&&"QuantumProgram"||"RegularProgram"},b,h)};return x?_().execute():{createRuntime:_,compilation:m}})})}var kt=class{constructor(...t){let e=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{},n=t.pop()||"";this.$program=ge(e.sourceType,e.parseCompileCallback,n,r)}execute(){return G(this.$program,({createRuntime:t})=>t().execute())}bind(t,e=void 0){return G(this.$program,({createRuntime:r})=>r(t,e))}toString(t=!1){return G(this.$program,({compilation:e})=>t?e+"":e.originalSource)}};var Si;function Sr(...i){let{source:t,params:e}=vr(i),r=ge("async-function",Be,t,e);if(!(r instanceof Promise))return r;let n=async function(...o){return(await r).call(this,...o)};return Object.defineProperty(n,"toString",{value:async function(...o){return(await r).toString(...o)}}),n}var $i=Sr,Ei,Rt=class extends kt{};W(Rt,"sourceType","async-script"),W(Rt,"parseCompileCallback",Be);var Ai=Rt,re=class extends kt{};W(re,"sourceType","module"),W(re,"parseCompileCallback",Be);function Be(...i){let t=typeof i[i.length-1]=="object"?i.pop():{},e=i.pop()||"";if(globalThis.webqit?.$qCompiler){let{parse:r,compile:n}=globalThis.webqit.$qCompiler,o=r(e,t.parserParams);return n(o,t.compilerParams)}if(globalThis.webqit=globalThis.webqit||{},!globalThis.webqit.$qCompilerWorker){let o=`
|
|
6
6
|
const compilerUrls = [ '${(document.querySelector('meta[name="$q-compiler-url"]')?.content.split(",")||[]).concat("https://unpkg.com/@webqit/quantum-js/dist/compiler.js").join("','")}' ];
|
|
7
7
|
( function importScript() {
|
|
8
8
|
try { importScripts( compilerUrls.shift().trim() ) } catch( e ) { if ( compilerUrls.length ) { importScript(); } }
|
|
@@ -13,8 +13,8 @@ ${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 ee(i,t,e={},r={}){t=k(t).slice();for(var n=i;!ot(n)&&!Wt(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 Ue(i,t,e,r={},n={}){let o=(u,f,d)=>n.set?n.set(u,f,d):(Q(t[a])&&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=ee(s,t[a],n);if(!M(l)){if(n.buildTree===!1)return!1;l=I(n.buildTree)?n.buildTree(a):Q(t[a+1])?[]:{};var c=o(s,t[a],l);if(!c)return!1}s=l}else return o(s,t[a],e)}var re=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 Er(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Rt(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 $r(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 ie(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(ie(i,t,l.host,r,n)):s(!1)}function Ar(i,t="|"){return[...i].reduce(([e,r,n,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(s)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!n[0].endsWith("\\")&&(e=e===s?null:e||s),n[0]+=s,[e,r,n]),[null,0,[""]])[2].reverse()}var X=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Er(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ar(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var Ot=class{constructor(t,e,r){this.context=t,this.namespace=e,this.window=t.defaultView||t.ownerDocument?.defaultView||r,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(I(t[0])?t=[[],...t]:T(t[0])&&!(t[0]instanceof X)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[k(t[0],!1),void 0,t[1]]:t[0]=k(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof X)&&!(e instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return t[0]=t[0].map(e=>e instanceof X?e:new X(e)),t}registry(...t){return D("realdom.realtime",this.window,this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,e,r){let{window:n}=this,o=new Set,s=new WeakMap;for(let[a,l]of this.registry(t)){let c=[].concat(e).filter(f=>ie(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 ft=class extends Ot{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof X;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=Ir(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let l of s){let c=a?a.generate():{};e(l,c,o)}else{let l=a?.generate()||{};e(s,l,o)}if(r.live){a&&(r={...r,signalGenerator:a});let l=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,l)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof X;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(n?t[0]:t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:o,window:s,webqit:a}=this;r.eventDetails&&!a.realdom.attrInterceptionHooks?.intercepting&&Cr.call(s,"intercept",()=>{});let l=new s.MutationObserver(d=>{d=Tr(d).map(p=>Mr.call(s,p)),Pr.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 X;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let a=r.timing==="intercept"?"intercept":"sync";this.registry(a).size||Cr.call(s,a,d=>{this.forEachMatchingContext(a,d,Pr)});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 Tr(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 Pr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:l}=i;if(o.subtree||(t=t.filter(d=>d.target===e)),!t.length)return;let c=r.map(d=>d+"");if(o.atomic&&!s.size?t=Ir(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:ye(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?l.generate():{};n(u,f,e)}function ye(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 Ir(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:ye(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:ye(i,o.nodeName,()=>o.nodeValue),...r})}function Mr({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 Cr(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=Tr(u).map(f=>Mr.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=ye(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 ne=class extends Ot{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new ft(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(...Rt(this.window,n,u))):(c.length&&f.push(...[...n.children].filter(d=>d.matches(c))),u.length&&f.push(...Rt(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&&jr.call(o,"sync",()=>{});let l=new o.MutationObserver(f=>f.forEach(d=>{Qe.call(o,u,Rr.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=qr.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||jr.call(o,s,d=>{this.forEachMatchingContext(s,d,Qe)});let a=new o.MutationObserver(d=>d.forEach(p=>{Array.isArray((p=Rr.call(o,p)).event)||Qe.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=qr.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 qr(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 ft(e,t).observe(i.$attrs,p=>{let h=new Map,w=_=>(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),w(_.target)[O].push(_.target),w(_.target).event=_.event)});for(let[,_]of h){let O=s?.generate()||{};n(_,O,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function Qe(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]=Ii.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 Ii(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"?$r(this,l,s+""):l.matches&&l.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((l,c)=>s.kind==="xpath"?[...l,...Rt(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=>ie(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 Rr({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 jr(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"]},w={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}),w[y][g]=m)});function _(...y){let m=Object.keys(w).find(L=>this instanceof e[L]&&g in w[L]),x=w[m],b=()=>x[g].value.call(this,...y);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let $=[],E=[],C=this;["insertBefore"].includes(g)?E=[y[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?(E=[y[1]],["beforebegin","afterend"].includes(y[0])&&(C=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?($=[...this.childNodes],E=g==="replaceChildren"?[...y]:[y[0]]):["replaceWith","remove"].includes(g)?($=[this],E=g==="replaceWith"?[...y]:[],C=this.parentNode):["replaceChild"].includes(g)?($=[y[1]],E=[y[0]]):["removeChild"].includes(g)?$=[...y]:(E=[...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 x[g].value.call(this,...y);L=this.parentNode.nodeName}let H=n.createElement(L.includes("-")?"div":L);x.setHTMLUnsafe.value.call(H,E[0],g==="setHTMLUnsafe"?y[1]:{}),E=[...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:E,exits:$,type:"interception",event:[this,g]},()=>x[j].value.call(this,...y))}function O(y){let m=Object.keys(w).find(N=>this instanceof e[N]&&g in w[N]),x=w[m],b=()=>x[g].set.call(this,y);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let $=[],E=[],C=this;if(["outerHTML","outerText"].includes(g)?($=[this],C=this.parentNode):this instanceof c?(C=this.content,$=[...this.content.childNodes]):$=[...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),E=this instanceof c?[...L.content.childNodes]:[...L.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let H=ht=>ht.reduce((it,nt)=>nt instanceof HTMLScriptElement?it.concat(nt):nt instanceof c?it.concat(H([nt.content])):(it=it.concat(H([...nt.querySelectorAll?.("template")||[]].map(Zr=>Zr.content))),it.concat(...nt.querySelectorAll?.("script")||[])),[]);for(let ht of H(E)){if(this instanceof ShadowRoot){ht.setAttribute("data-handling","manual");continue}let it=n.createElement("script");[...ht.attributes].forEach(nt=>it.setAttribute(nt.name,nt.value)),it.textContent=ht.textContent,d(ht,"replaceWith",()=>ht.replaceWith(it))}}g==="outerHTML"?(y=new u,d(y,"append",()=>y.append(...E)),b=()=>d(this,"replaceWith",()=>a.prototype.replaceWith.call(this,y))):this instanceof c?b=()=>d(this.content,"replaceChildren",()=>this.content.replaceChildren(...E)):b=()=>d(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...E))}return p({target:C,entrants:E,exits:$,type:"interception",event:[this,g]},b)}}),f}function kr(){Mi.call(this),qi.call(this),Ri.call(this)}function Mi(){let i=this;i.CSS||(i.CSS={}),i.CSS.escape||(i.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function qi(){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 Ri(){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 Nr(){let i=this;if(i.webqit||(i.webqit={}),i.webqit.realdom)return i.webqit.realdom;i.webqit.realdom={},kr.call(i),i.webqit.realdom.meta=(...e)=>ji.call(i,...e),i.webqit.realdom.ready=(...e)=>Xe.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new ne(e,i);if(r==="attr")return new ft(e,i)};let t=new re(i);return i.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),i.webqit.realdom.synthesizeWhile=(...e)=>t.synthesizeWhile(...e),i.webqit.realdom}function Xe(...i){let t="interactive",e;Ct(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=>Xe.call(this,"interactive",o)),complete:new Promise(o=>Xe.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 ji(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 Ue(n,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:Q(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 be(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),R={};function B(i,t,e){let r=this,n=Nr.call(r);R.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let s=r.webqit.oohtml.configs[o];Bt(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}${be(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 Ye(i,t){return D(i,"internalAttrInteractions").get(t)}function Lr(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 ct(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 Di=()=>(0|Math.random()*9e6).toString(36),Je=new Map;function St(i){let t;return(t=Je.get(i))||(t=Di(),Je.set(i,t)),t}function we(i){let t;return Je.forEach((e,r)=>{e===i&&(t=r)}),t}function xe(){let{window:i}=R,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=n.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let a=["contextrequest","contextclaim"],l=n.pop()||a[0];if(!a.includes(l))throw new Error(`Invalid event type. Must be one of: ${a.join(",")}`);let{kind:c,detail:u,targetContext:f,live:d,signal:p,diff:h,...w}=s;super(l,{...w,bubbles:w.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:()=>w}),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 Et=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=R;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var $t=class extends Error{};var dt=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 $t(`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 Et((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(xe())(...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}}}}=R;return t}get name(){return[R.window.Document,R.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof Ze)||t.target===this.host)return;let e=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),e.add(r))}),e.size)return t.respondWith(e)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:e}=dt.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 jt=class extends z{static createRequest(t=null){let e=super.createRequest();if(t?.startsWith("@")){let[r,...n]=n.slice(1).split("/").map(o=>o.trim());e.targetContext=r,e.detail=n.join("/")}else e.detail=t;return e}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:e}}}=R;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(e.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(n=>n.trim()).filter(n=>n);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=e.reduce(this.namespaceObj,r,e.get,n=>{this.disposed||t.respondWith(n.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};F(jt,"kind","namespace");function Ke(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=jt,Li.call(e,t),Hi.call(e,t)}function Hr(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 tr(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,s=Hr(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[l,c]=ct(i,",").reduce(([f,d],p)=>{let h,w;return p=p.replace(a,(S,g,_,O,y)=>{if(h||(h=[...p.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),h.some($=>y>$.index&&y+S.length<$.index+$[0].length))return S;if(S===":scope")return w=!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}),w?[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 _e(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 kt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return _e.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function ve(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(we(i)||St(i))+(t?"-root":"")}function Li(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(_e.call(t,this))}})})}function Hi(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=Hr(i),f=(m,x,b)=>{if(!Ye(m,x)&&v(m,"attrOriginals").has(x))return v(m,"attrOriginals").get(x);let $=b();return Ye(m,x)?$:$&&$.split(" ").map(E=>(E=E.trim())&&(x===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,E)).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 x=Object.getOwnPropertyDescriptor(nodeApi.prototype,m);Object.defineProperty(nodeApi.prototype,m,{...x,value(b){return x.value.call(this,tr.call(t,b,ve(_e.call(t,this))))}})}let p=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...p,value(m){let x=()=>p.value.call(this,m);return l.includes(m)&&!v(this,"lock").get(m)?f(this,m,x):x()}});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 w=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...w,get(){let m=()=>w.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 x=m==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let b of x){let $=Object.getOwnPropertyDescriptor(b.prototype,c[m]);!$||Object.defineProperty(b.prototype,c[m],{...$,get(){return f(this,m,()=>$.get.call(this,m))}})}}i.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,i.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(i.attr.lid)},set(m){return this.setAttribute(i.attr.lid,m)}});let S=(m,x,b,$)=>Lr(m,x,()=>(typeof b=="function"&&(b=b()),$(b))),g=(m,x,b,$=null)=>{S(m,x,b,E=>{let C=x===i.attr.lid,j=$||kt.call(t,m,C),N=ve(j);if(C){let L=u.uuidToId(E);if(e.get(j,L)!==m){let H=u.toUuid(N,L);H!==E&&m.setAttribute("id",H),e.set(j,L,m)}}else{v(m,"attrOriginals").set(x,E);let L=E.split(" ").map(H=>(H=H.trim())&&u.isUuid(H)?H:u.toUuid(N,H)).join(" ");m.setAttribute(x,L),v(j).set("idrefs",v(j).get("idrefs")||new Set),v(j).get("idrefs").add(m)}})},_=(m,x,b,$=null)=>{S(m,x,b,E=>{let C=x===i.attr.lid,j=$||kt.call(t,m,C);if(C){let N=u.uuidToId(E);e.get(j,N)===m&&e.deleteProperty(j,N)}else{let N=v(m,"attrOriginals").get(x);m.hasAttribute(x)&&m.setAttribute(x,N),v(j).get("idrefs")?.delete(m)}})};r.realtime(t.document).query(i.namespaceSelector,m=>{let x=(b,$,E,C)=>{if(!b.hasAttribute($))return;let j=()=>b.getAttribute($);_(b,$,j,E),b.isConnected&&g(b,$,v(b,"attrOriginals").get($)||j,C)};m.exits.forEach(b=>{if(b.isConnected){let C=_e.call(t,b);for(let j of new Set([...Object.values(C),...v(C).get("idrefs")||[]]))for(let N of l)x(j,N,C)}let $=b[n.CONTEXT_API.api.contexts],E=$.find(o.kind);E&&$.detach(E)}),m.entrants.forEach(b=>{let $,E=kt.call(t,b,!0);for(let j of new Set([...Object.values(E),...v(E).get("idrefs")||[]]))if(($=kt.call(t,j,!0))!==E)for(let N of l)x(j,N,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 x={forID:new Map,forOther:new Map};for(let b of l){let $=b===i.attr.lid?x.forID:x.forOther;m.exits.forEach(E=>{if(!E.hasAttribute(b))return;let C=$.get(E);typeof C>"u"&&(C=(b===i.attr.lid?E.parentNode:E)?.closest?.(i.namespaceSelector)||E.getRootNode().host,$.set(E,C)),!(C&&!C.isConnected)&&_(E,b,()=>E.getAttribute(b))}),m.entrants.forEach(E=>{!E.hasAttribute(b)||g(E,b,()=>E.getAttribute(b))})}x.forID.clear(),x.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(l,m=>{for(let x of m)x.oldValue&&_(x.target,x.name,x.oldValue),x.value&&g(x.target,x.name,x.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)||[],x=m.reduce((b,$)=>b&&b[i.api.namespace][$],t.document);O&&i.target.className&&O.classList.toggle(i.target.className,!1),x&&x!==t.document&&(i.target.className&&x.classList.toggle(i.target.className,!0),i.target.eventName&&x.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&m.length>1&&x.scrollIntoView(),O=x)};t.addEventListener("hashchange",y),r.ready(y)}function er({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:It(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:Wi.bind(r,e)},Fi.call(r,e),Vi.call(r,e)}function Fi(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 Wi(i,t){let e=this,{realdom:r}=e.webqit,n=we(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 Vi(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=Fr.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=St({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 Fr(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=St(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 Wr(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{Fr.call(t,e,r)})}function nr(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:It({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)}]`,Bi.call(e,t)}function Bi(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{Vr.call(this,...r.exits),setTimeout(()=>{Ui.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(()=>{Vr.call(this,...r.exits),zi.call(t,i,...r.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Br(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 Vr(...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 zr(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 zi(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let s=zr(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=Ur.call(e,i,o.expr),{scope:l,bindings:c}=Br.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 rr=new Map;function Ur(i,t){if(rr.has(t))return rr.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}${Nt(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 rr.set(t,a),a}async function Ui(i,...t){for(let e of t){let r=Gr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=Br.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 ir=new Map;function Gr(i,t){if(ir.has(t))return ir.get(t);let e={},r=-1,n=ct(t,";").map(u=>{let[f,d]=ct(u,":").map(g=>g.trim()),p=f[0],h=f.slice(1).trim(),w=`(${d})`,S=`(${w} ?? '')`;if(p==="&")return h.startsWith("--")?`$exec__(this.style, 'setProperty', "${Nt(h)}", ${S});`:`$assign__(this.style, "${Nt(h)}", ${S});`;if(p==="%")return`$exec__(this.classList, 'toggle', "${Nt(h)}", !!${w});`;if(p==="~")return h.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Nt(h.substring(1).trim())}", !!${w});`:`$exec__(this, 'setAttribute', "${Nt(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,_]=ct(d,"/");if(!_)throw new Error(`Invalid ${p}items spec: ${u}; no import specifier.`);let[O,y,m,x]=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($=>$.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
|
-
let $iteratee__ = ${
|
|
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 ie(i,t,e={},r={}){t=q(t).slice();for(var n=i;!ot(n)&&!Bt(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 Ue(i,t,e,r={},n={}){let o=(u,f,d)=>n.set?n.set(u,f,d):(X(t[a])&&A(u)?u.push(d):u[f]=d,!0);t=q(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=ie(s,t[a],n);if(!M(l)){if(n.buildTree===!1)return!1;l=I(n.buildTree)?n.buildTree(a):X(t[a+1])?[]:{};var c=o(s,t[a],l);if(!c)return!1}s=l}else return o(s,t[a],e)}var ne=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 $r(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function qt(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 Er(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 oe(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(oe(i,t,l.host,r,n)):s(!1)}function Ar(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 J=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:$r(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ar(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var St=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 J)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[q(t[0],!1),void 0,t[1]]:t[0]=q(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof J)&&!(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 J?e:new J(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=>oe(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 ft=class extends St{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof J;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=Ir(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let l of s){let c=a?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 J;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&&Cr.call(s,"intercept",()=>{});let l=new s.MutationObserver(d=>{d=Tr(d).map(p=>Mr.call(s,p)),Pr.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 J;[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||Cr.call(s,a,d=>{this.forEachMatchingContext(a,d,Pr)});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 Tr(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 Pr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:l}=i;if(o.subtree||(t=t.filter(d=>d.target===e)),!t.length)return;let c=r.map(d=>d+"");if(o.atomic&&!s.size?t=Ir(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:be(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?l.generate():{};n(u,f,e)}function be(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 Ir(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:be(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:be(i,o.nodeName,()=>o.nodeValue),...r})}function Mr({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 Cr(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(m=>m([u]));let p=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m([u])),p};new e.MutationObserver(u=>{u=u.filter(f=>!(e.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),u=Tr(u).map(f=>Mr.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=be(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(u)&&(d=f[1]),u==="toggleAttribute"&&d===void 0&&(d=p===null);let m={target:this,name:f[0],value:d,oldValue:p,type:"interception",event:[this,u]};return a(m,()=>c[u].call(this,...f))}}),s}var se=class extends St{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new ft(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],m)=>m.kind==="xpath"?[d,p.concat(m)]:[d.concat(m),p],[[],[]]),f=[];r.subtree?(c.length&&f.push(...n.querySelectorAll(c.join(","))),u.length&&f.push(...qt(this.window,n,u))):(c.length&&f.push(...[...n.children].filter(d=>d.matches(c))),u.length&&f.push(...qt(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&&Rr.call(o,"sync",()=>{});let l=new o.MutationObserver(f=>f.forEach(d=>{Qe.call(o,u,kr.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=jr.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||Rr.call(o,s,d=>{this.forEachMatchingContext(s,d,Qe)});let a=new o.MutationObserver(d=>d.forEach(p=>{Array.isArray((p=kr.call(o,p)).event)||Qe.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=jr.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 jr(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(m=>m[1]).concat(l(p)).concat(c(p));if(!(i.$attrs=Array.from(new Set(a.filter(p=>(p+"").includes("[")).reduce((p,m)=>p.concat(u(m+"")),[])))).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 ft(e,t).observe(i.$attrs,p=>{let m=new Map,x=_=>(m.has(_)||m.set(_,{target:_,entrants:[],exits:[],type:"static",event:null}),m.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 m){let O=s?.generate()||{};n(_,O,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function Qe(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]=Ii.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 Ii(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"?Er(this,l,s+""):l.matches&&l.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((l,c)=>s.kind==="xpath"?[...l,...qt(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=>oe(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 kr({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=q(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=q(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 Rr(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 h=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(y)},0);Object.defineProperty(g.event,"timeout",{value:h,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(y=>y(g));let O=_();return r.realdom.domInterceptionHooks.get("sync")?.forEach(y=>y(g)),O},m={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(m).reduce((g,_)=>g.concat(_),[])).forEach(g=>{Object.keys(m).forEach(y=>{if(!m[y].includes(g))return;let h=Object.getOwnPropertyDescriptor(e[y].prototype,g);!h||(Object.defineProperty(e[y].prototype,g,"value"in h?{...h,value:_}:{...h,set:O}),x[y][g]=h)});function _(...y){let h=Object.keys(x).find(L=>this instanceof e[L]&&g in x[L]),w=x[h],b=()=>w[g].value.call(this,...y);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let E=[],$=[],C=this;["insertBefore"].includes(g)?$=[y[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?($=[y[1]],["beforebegin","afterend"].includes(y[0])&&(C=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?(E=[...this.childNodes],$=g==="replaceChildren"?[...y]:[y[0]]):["replaceWith","remove"].includes(g)?(E=[this],$=g==="replaceWith"?[...y]:[],C=this.parentNode):["replaceChild"].includes(g)?(E=[y[1]],$=[y[0]]):["removeChild"].includes(g)?E=[...y]:($=[...y],["before","after"].includes(g)&&(C=this.parentNode));let R=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,$[0],g==="setHTMLUnsafe"?y[1]:{}),$=[...H.childNodes],g==="insertAdjacentHTML"?(R="insertAdjacentElement",y[1]=new u,d(y[1],"append",()=>y[1].append(...H.childNodes))):(R="replaceChildren",y=[...H.childNodes])}return p({target:C,entrants:$,exits:E,type:"interception",event:[this,g]},()=>w[R].value.call(this,...y))}function O(y){let h=Object.keys(x).find(N=>this instanceof e[N]&&g in x[N]),w=x[h],b=()=>w[g].set.call(this,y);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return b();let E=[],$=[],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),$=this instanceof c?[...L.content.childNodes]:[...L.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let H=mt=>mt.reduce((it,nt)=>nt instanceof HTMLScriptElement?it.concat(nt):nt instanceof c?it.concat(H([nt.content])):(it=it.concat(H([...nt.querySelectorAll?.("template")||[]].map(Zr=>Zr.content))),it.concat(...nt.querySelectorAll?.("script")||[])),[]);for(let mt of H($)){if(this instanceof ShadowRoot){mt.setAttribute("data-handling","manual");continue}let it=n.createElement("script");[...mt.attributes].forEach(nt=>it.setAttribute(nt.name,nt.value)),it.textContent=mt.textContent,d(mt,"replaceWith",()=>mt.replaceWith(it))}}g==="outerHTML"?(y=new u,d(y,"append",()=>y.append(...$)),b=()=>d(this,"replaceWith",()=>a.prototype.replaceWith.call(this,y))):this instanceof c?b=()=>d(this.content,"replaceChildren",()=>this.content.replaceChildren(...$)):b=()=>d(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...$))}return p({target:C,entrants:$,exits:E,type:"interception",event:[this,g]},b)}}),f}function qr(){Mi.call(this),ji.call(this),ki.call(this)}function Mi(){let i=this;i.CSS||(i.CSS={}),i.CSS.escape||(i.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function ji(){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 ki(){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 Nr(){let i=this;if(i.webqit||(i.webqit={}),i.webqit.realdom)return i.webqit.realdom;i.webqit.realdom={},qr.call(i),i.webqit.realdom.meta=(...e)=>Ri.call(i,...e),i.webqit.realdom.ready=(...e)=>Xe.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new se(e,i);if(r==="attr")return new ft(e,i)};let t=new ne(i);return i.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),i.webqit.realdom.synthesizeWhile=(...e)=>t.synthesizeWhile(...e),i.webqit.realdom}function Xe(...i){let t="interactive",e;It(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=>Xe.call(this,"interactive",o)),complete:new Promise(o=>Xe.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 Ri(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 Ue(n,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:X(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 we(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),k={};function z(i,t,e){let r=this,n=Nr.call(r);k.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];Ut(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}${we(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 Ye(i,t){return D(i,"internalAttrInteractions").get(t)}function Lr(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 ct(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 Di=()=>(0|Math.random()*9e6).toString(36),Je=new Map;function $t(i){let t;return(t=Je.get(i))||(t=Di(),Je.set(i,t)),t}function xe(i){let t;return Je.forEach((e,r)=>{e===i&&(t=r)}),t}function _e(){let{window:i}=k,{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:m,...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:()=>m}),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 Et=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=k;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var At=class extends Error{};var dt=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 U))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new At(`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 Et((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(_e())(...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}}}}=k;return t}get name(){return[k.window.Document,k.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}=dt.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}},U=Ze;W(U,"kind");var Nt=class extends U{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}}}=k;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()}};W(Nt,"kind","namespace");function Ke(i={}){let{config:t,window:e}=z.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=Nt,Li.call(e,t),Hi.call(e,t)}function Hr(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 tr(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,s=Hr(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[l,c]=ct(i,",").reduce(([f,d],p)=>{let m,x;return p=p.replace(a,(S,g,_,O,y)=>{if(m||(m=[...p.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),m.some(E=>y>E.index&&y+S.length<E.index+E[0].length))return S;if(S===":scope")return x=!0,e;let h=g&&!_;if(g&&_)return`#${s.escape(S.replace("#",""),1)}`;if(h&&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}"])`,h?`: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 ve(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 Dt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return ve.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function Oe(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(xe(i)||$t(i))+(t?"-root":"")}function Li(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(ve.call(t,this))}})})}function Hi(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=Hr(i),f=(h,w,b)=>{if(!Ye(h,w)&&v(h,"attrOriginals").has(w))return v(h,"attrOriginals").get(w);let E=b();return Ye(h,w)?E:E&&E.split(" ").map($=>($=$.trim())&&(w===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,$)).join(" ")},d=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...d,value(h){return this.querySelector(`#${h}`)}});for(let h of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let w=Object.getOwnPropertyDescriptor(nodeApi.prototype,h);Object.defineProperty(nodeApi.prototype,h,{...w,value(b){return w.value.call(this,tr.call(t,b,Oe(ve.call(t,this))))}})}let p=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...p,value(h){let w=()=>p.value.call(this,h);return l.includes(h)&&!v(this,"lock").get(h)?f(this,h,w):w()}});let m=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...m,get(){let h=()=>m.get.call(this);return l.includes(this.name)?f(this.ownerElement,this.name,h):h()}});let x=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...x,get(){let h=()=>x.get.call(this);return this instanceof t.Attr&&l.includes(this.name)?f(this.ownerElement,this.name,h):h()}});for(let h of l){if(!(h in c))continue;let w=h==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let b of w){let E=Object.getOwnPropertyDescriptor(b.prototype,c[h]);!E||Object.defineProperty(b.prototype,c[h],{...E,get(){return f(this,h,()=>E.get.call(this,h))}})}}i.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,i.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(i.attr.lid)},set(h){return this.setAttribute(i.attr.lid,h)}});let S=(h,w,b,E)=>Lr(h,w,()=>(typeof b=="function"&&(b=b()),E(b))),g=(h,w,b,E=null)=>{S(h,w,b,$=>{let C=w===i.attr.lid,R=E||Dt.call(t,h,C),N=Oe(R);if(C){let L=u.uuidToId($);if(e.get(R,L)!==h){let H=u.toUuid(N,L);H!==$&&h.setAttribute("id",H),e.set(R,L,h)}}else{v(h,"attrOriginals").set(w,$);let L=$.split(" ").map(H=>(H=H.trim())&&u.isUuid(H)?H:u.toUuid(N,H)).join(" ");h.setAttribute(w,L),v(R).set("idrefs",v(R).get("idrefs")||new Set),v(R).get("idrefs").add(h)}})},_=(h,w,b,E=null)=>{S(h,w,b,$=>{let C=w===i.attr.lid,R=E||Dt.call(t,h,C);if(C){let N=u.uuidToId($);e.get(R,N)===h&&e.deleteProperty(R,N)}else{let N=v(h,"attrOriginals").get(w);h.hasAttribute(w)&&h.setAttribute(w,N),v(R).get("idrefs")?.delete(h)}})};r.realtime(t.document).query(i.namespaceSelector,h=>{let w=(b,E,$,C)=>{if(!b.hasAttribute(E))return;let R=()=>b.getAttribute(E);_(b,E,R,$),b.isConnected&&g(b,E,v(b,"attrOriginals").get(E)||R,C)};h.exits.forEach(b=>{if(b.isConnected){let C=ve.call(t,b);for(let R of new Set([...Object.values(C),...v(C).get("idrefs")||[]]))for(let N of l)w(R,N,C)}let E=b[n.CONTEXT_API.api.contexts],$=E.find(o.kind);$&&E.detach($)}),h.entrants.forEach(b=>{let E,$=Dt.call(t,b,!0);for(let R of new Set([...Object.values($),...v($).get("idrefs")||[]]))if((E=Dt.call(t,R,!0))!==$)for(let N of l)w(R,N,$,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(h=>t.CSS.escape(h)).join("],[")}]`,h=>{let w={forID:new Map,forOther:new Map};for(let b of l){let E=b===i.attr.lid?w.forID:w.forOther;h.exits.forEach($=>{if(!$.hasAttribute(b))return;let C=E.get($);typeof C>"u"&&(C=(b===i.attr.lid?$.parentNode:$)?.closest?.(i.namespaceSelector)||$.getRootNode().host,E.set($,C)),!(C&&!C.isConnected)&&_($,b,()=>$.getAttribute(b))}),h.entrants.forEach($=>{!$.hasAttribute(b)||g($,b,()=>$.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,h=>{for(let w of h)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 h=t.location.hash?.substring(`#${u.lidrefPrefix()}`.length).split("/").map(b=>b.trim()).filter(b=>b)||[],w=h.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&&h.length>1&&w.scrollIntoView(),O=w)};t.addEventListener("hashchange",y),r.ready(y)}function er({advanced:i={},...t}){let{config:e,window:r}=z.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:jt(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:Wi.bind(r,e)},Fi.call(r,e),Vi.call(r,e)}function Fi(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 Wi(i,t){let e=this,{realdom:r}=e.webqit,n=xe(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 Vi(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=Fr.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=$t({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 Fr(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=$t(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 Wr(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{Fr.call(t,e,r)})}function nr(i={}){let{config:t,window:e}=z.call(this,"data-binding",i,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:jt({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)}]`,Bi.call(e,t)}function Bi(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{Vr.call(this,...r.exits),setTimeout(()=>{Ui.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(()=>{Vr.call(this,...r.exits),zi.call(t,i,...r.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Br(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 Vr(...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 zr(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 zi(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let s=zr(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=Ur.call(e,i,o.expr),{scope:l,bindings:c}=Br.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 rr=new Map;function Ur(i,t){if(rr.has(t))return rr.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}${Lt(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 rr.set(t,a),a}async function Ui(i,...t){for(let e of t){let r=Gr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=Br.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 ir=new Map;function Gr(i,t){if(ir.has(t))return ir.get(t);let e={},r=-1,n=ct(t,";").map(u=>{let[f,d]=ct(u,":").map(g=>g.trim()),p=f[0],m=f.slice(1).trim(),x=`(${d})`,S=`(${x} ?? '')`;if(p==="&")return m.startsWith("--")?`$exec__(this.style, 'setProperty', "${Lt(m)}", ${S});`:`$assign__(this.style, "${Lt(m)}", ${S});`;if(p==="%")return`$exec__(this.classList, 'toggle', "${Lt(m)}", !!${x});`;if(p==="~")return m.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Lt(m.substring(1).trim())}", !!${x});`:`$exec__(this, 'setAttribute', "${Lt(m)}", ${S});`;if(p==="#"){if(e[m])throw new Error(`Duplicate binding: ${f}.`);if(e[m]=!0,m==="text")return`$assign__(this, 'textContent', ${S});`;if(m==="html")return`$assign__(this, 'innerHTML', ${S});`;if(m==="items"){let[g,_]=ct(d,"/");if(!_)throw new Error(`Invalid ${p}items spec: ${u}; no import specifier.`);let[O,y,h,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>(h==="in"?3:2))throw new Error(`Invalid ${p}items spec: ${u}.`);let b=h==="in"?y[2]:y[1]||"$index__";return`
|
|
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__ );
|
|
20
20
|
|
|
@@ -24,12 +24,12 @@ ${h}
|
|
|
24
24
|
$existing__.set( x.getAttribute( '${i.attr.itemIndex}' ), x );
|
|
25
25
|
} );
|
|
26
26
|
${b?`let ${b} = -1;`:""}
|
|
27
|
-
for ( let ${y[0]} ${
|
|
27
|
+
for ( let ${y[0]} ${h} $iteratee__ ) {
|
|
28
28
|
${b?`${b} ++;`:""}
|
|
29
|
-
${
|
|
29
|
+
${h==="in"&&y[1]?`let ${y[1]} = $iteratee__[ ${y[0]} ];`:""}
|
|
30
30
|
const $itemBinding__ = { ${y.join(", ")} };
|
|
31
31
|
|
|
32
|
-
const $key___ = ( ${
|
|
32
|
+
const $key___ = ( ${h==="in"?y[0]:b} ) + '';
|
|
33
33
|
let $itemNode__ = $existing__.get( $key___ );
|
|
34
34
|
if ( $itemNode__ ) {
|
|
35
35
|
$existing__.delete( $key___ );
|
|
@@ -41,19 +41,19 @@ ${h}
|
|
|
41
41
|
$exec__(this, 'appendChild', $itemNode__ );
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if ( ${
|
|
44
|
+
if ( ${h==="in"?`!( ${y[0]} in $iteratee__ )`:`typeof ${y[0]} === 'undefined'`} ) { $itemNode__.remove(); }
|
|
45
45
|
}
|
|
46
46
|
$existing__.forEach( x => x.remove() );
|
|
47
47
|
$existing__.clear();
|
|
48
48
|
}`}}if(p==="@")return r++,`
|
|
49
|
-
const handler${r} = event => ${d.startsWith("{")?d:
|
|
50
|
-
this.addEventListener( '${
|
|
51
|
-
const abort${r} = () => this.removeEventListener( '${
|
|
49
|
+
const handler${r} = event => ${d.startsWith("{")?d:x};
|
|
50
|
+
this.addEventListener( '${m}', handler${r} );
|
|
51
|
+
const abort${r} = () => this.removeEventListener( '${m}', handler${r} );
|
|
52
52
|
this.$oohtml_internal_databinding_signals?.push( { abort: abort${r} } );
|
|
53
|
-
`;if(p==="$")return`$exec__(this, '${
|
|
54
|
-
`),{webqit:{QuantumModule:o}}=this,{parserParams:s,compilerParams:a,runtimeParams:l}=i.advanced,c=new o(n,{parserParams:s,compilerParams:a,runtimeParams:l});return ir.set(t,c),c}var Nt=i=>i.replace(/"/g,'\\"');function Qr(i){let t=this,{webqit:{oohtml:{configs:{DATA_BINDING:e}}}}=t;(i?.matches(e.attrSelector)?[i]:[]).concat([...i?.querySelectorAll(e.attrSelector)||[]]).forEach(r=>{Gr.call(t,e,r.getAttribute(e.attr.render))}),Rt(t,i,`(${e.discreteBindingsSelector})`).forEach(r=>{let n=zr(e,r.nodeValue);Ur.call(t,e,n.expr)})}var J=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 bindingsObj(){return this.host[this.configs.BINDINGS_API.api.bindings]}matchEvent(t){return super.matchEvent(t)&&(!t.detail||!this.detail||(Array.isArray(t.detail)?t.detail[0]===this.detail:t.detail===this.detail))}handle(t){if(t.meta.controller?.abort(),!(t.detail+"").trim())return t.respondWith(this.bindingsObj);let{window:{webqit:{Observer:e}}}=R;t.meta.controller=e.reduce(this.bindingsObj,Array.isArray(t.detail)?t.detail:[t.detail],e.get,r=>{this.disposed||t.respondWith(r.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};F(J,"kind","bindings");function or(i={}){let{config:t,window:e}=B.call(this,"bindings-api",i,{attr:{bindingsreflection:"bindings"},api:{bind:"bind",bindings:"bindings"}});e.webqit.DOMBindingsContext=J,Gi.call(e,t),Xi.call(e,t)}function sr(i,t){let e=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:n}}}}=e;if(!v(t).has("bindings")){let o=Object.create(null);v(t).set("bindings",o),r.observe(o,s=>{if(t instanceof e.Element){let a=Oe(t.getAttribute(i.attr.bindingsreflection)||""),l=new Map(a);for(let c of s)c.detail?.publish!==!1&&(c.type==="delete"?a.delete(c.key):a.set(c.key,void 0));a.size&&a.size!==l.size?t.setAttribute(i.attr.bindingsreflection,`{ ${[...a.entries()].map(([c,u])=>u===void 0?c:`${c}: ${u}`).join(", ")} }`):a.size||t.toggleAttribute(i.attr.bindingsreflection,!1)}else{let a=t[n.api.contexts];for(let l of s)if(l.type==="delete"){let c=a.find(J.kind,l.key);c&&a.detach(c)}else a.find(J.kind,l.key)||a.attach(new J(l.key))}})}return v(t).get("bindings")}function Gi(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.bind in r)throw new Error(`The ${n} prototype already has a "${i.api.bind}" API!`);if(i.api.bindings in r)throw new Error(`The ${n} prototype already has a "${i.api.bindings}" API!`);Object.defineProperty(r,i.api.bind,{value:function(o,s={}){return Qi.call(t,i,this,o,s)}}),Object.defineProperty(r,i.api.bindings,{get:function(){return e.proxy(sr.call(t,i,this))}})})}function Qi(i,t,e,{merge:r,diff:n,publish:o,namespace:s}={}){let a=this,{webqit:{Observer:l}}=a,c=sr.call(this,i,t),u={diff:n,namespace:s,detail:{publish:o}},f=r?[]:l.ownKeys(c,u).filter(d=>!(d in e));return l.batch(c,()=>(f.length&&l.deleteProperties(c,f,u),l.set(c,e,u)),u)}function Xi(i){let t=this,{webqit:{realdom:e,Observer:r,oohtml:{configs:n}}}=t,o=(a,l)=>{let c=a[n.CONTEXT_API.api.contexts];c.find(J.kind,l)||c.attach(new J(l))},s=(a,l)=>{let c,u=a[n.CONTEXT_API.api.contexts];for(;c=u.find(J.kind,l);)u.detach(c)};e.realtime(t.document).query(`[${t.CSS.escape(i.attr.bindingsreflection)}]`,a=>{a.exits.forEach(l=>s(l)),a.entrants.forEach(l=>{let c=Oe(l.getAttribute(i.attr.bindingsreflection)||""),u=[...c.entries()].filter(([f,d])=>d!==void 0);u.length&&l[i.api.bind](Object.fromEntries(u),{merge:!0,publish:!1});for(let[f]of c)o(l,f)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),e.realtime(t.document,"attr").observe(i.attr.bindingsreflection,a=>{let l=sr.call(t,i,a.target),c=Oe(a.value||""),u=Oe(a.oldValue||"");for(let f of new Set([...c.keys(),...u.keys()]))u.has(f)?c.has(f)?c.get(f)!==u.get(f)&&r.set(l,f,c.get(f),{detail:{publish:!1}}):(u.get(f)!==void 0&&r.deleteProperty(l,f,{detail:{publish:!1}}),s(a.target,f)):(c.get(f)!==void 0&&r.set(l,f,c.get(f),{detail:{publish:!1}}),o(a.target,f))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var Oe=i=>(i=i.trim(),new Map(ct(i.slice(1,-1),",").filter(t=>t.trim()).map(t=>ct(t,":").map(e=>e.trim()))));var et=class{static instance(t){return v(t).get("defsmanager::instance")||new this(t)}constructor(t,e=null,r=0){let{window:n}=R,{webqit:{realdom:o,oohtml:{configs:s}}}=n;v(t).get("defsmanager::instance")?.dispose(),v(t).set("defsmanager::instance",this),this.window=n,this.host=t,this.config=s.HTML_IMPORTS,this.parent=e,this.level=r,this.defs=pt(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=o.realtime(this.host.content).children(a=>{this.expose(a.entrants,!0),this.expose(a.exits,!1)},{live:!0,timing:"sync"}),this.realtimeB=o.realtime(this.host).attr(["src","loading"],(...a)=>this.evaluateLoading(...a),{live:!0,atomic:!0,timing:"sync",lifecycleSignals:!0}),this.realtimeC=this.evalInheritance()}validateDefId(t){if(["@","/","*","#"].some(e=>t.includes(e)))throw new Error(`The export ID "${t}" contains an invalid character.`)}expose(t,e){let{window:r}=R,{webqit:{Observer:n}}=r,o,s=this.defs["#"]||[];t.forEach(a=>{if(a.nodeType!==1)return;let l=a.matches(this.config.templateSelector),c=(a.getAttribute(l?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();e?(l&&c?new et(a,this.host,this.level+1):(s.push(a),o=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(u=>u.call(this.window,a))})),c&&(this.validateDefId(c),n.set(this.defs,(!l&&"#"||"")+c,a))):(l&&c?et.instance(a).dispose():(s=s.filter(u=>u!==a),o=!0),c&&n.deleteProperty(this.defs,(!l&&"#"||"")+c))}),o&&n.set(this.defs,"#",s)}evaluateLoading([t,e],{signal:r}){let{window:{webqit:{Observer:n}}}=R,o=(t.value||"").trim();if(!o)return;let s,a=u=>{if(!u)return s;s=u.then(()=>c.remove())},l=(e.value||"").trim(),c=n.intercept(this.defs,"get",async(u,f,d)=>(l==="lazy"&&a(this.load(o,!0)),await a(),d()),{signal:r});l!=="lazy"&&a(this.load(o))}load(t){let{window:e}=R;if(this.host.content.children.length)return Promise.resolve();if(this.fetchInFlight?.src===t)return this.fetchInFlight.request;this.fetchInFlight?.controller.abort();let r=new AbortController,n=(s,a)=>this.host.dispatchEvent(new e.CustomEvent(s,{detail:a})),o=e.fetch(t,{signal:r.signal,element:this.host}).then(s=>s.ok?s.text():Promise.reject(s.statusText)).then(s=>(this.host.innerHTML=s.trim(),n("load"),this.host)).catch(s=>(console.error(`Error fetching the bundle at "${t}": ${s.message}`),this.fetchInFlight=null,n("loaderror"),this.host));return this.fetchInFlight={src:t,request:o,controller:r},o}evalInheritance(){if(!this.parent)return[];let{window:{webqit:{Observer:t}}}=R,e=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(a=>a.trim()).filter(a=>a),n=a=>{a.forEach(l=>{t.get(this.defs,l.key)===l.oldValue&&(["get","set","def"].includes(l.type)?t[l.type.replace("get","set")](this.defs,l.key,l.value):l.type==="delete"&&t.deleteProperty(this.defs,l.key))})},o=[],s=pt(this.parent);return e&&o.push(t.reduce(s,[e,this.config.api.defs,1/0],t.get,n,{live:!0})),r.length&&o.push(t.get(s,r.includes("*")?1/0:r,n,{live:!0})),o}dispose(){this.realtimeA.disconnect(),this.realtimeB.disconnect(),this.realtimeC.forEach(t=>t instanceof Promise?t.then(e=>e.abort()):t.abort()),Object.entries(this.defs).forEach(([t,e])=>{t.startsWith("#")||et.instance(e).dispose()})}};var Se,rt,Dt,Lt,lt=class extends z{constructor(){super(...arguments);Ht(this,Se,{});Ht(this,rt,void 0);Ht(this,Dt,void 0);Ht(this,Lt,void 0)}static createRequest(e=null){let r=super.createRequest();if(e?.startsWith("/"))r.detail=e,r.targetContext=1/0;else if(e?.startsWith("@")){let[n,...o]=e.slice(1).split(/(?<=\w)(?=\/|#)/).map(s=>s.trim());r.targetContext=n,r.detail=o.join("")}else r.detail=e;return r}get localModules(){return pt(this.host)}get inheritedModules(){return G(this,Se)}handle(e){let{window:{webqit:{Observer:r}}}=R;e.meta.controller?.abort();let n=(e.detail||"").split(/\/|(?<=\w)(?=#)/g).map(s=>s.trim()).filter(s=>s);if(!n.length)return e.respondWith();n=n.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(s=>s==="*"?1/0:s)||[];let o={live:e.live,signal:e.signal,descripted:!0};e.meta.controller=r.reduce(G(this,rt),n,r.get,s=>{if(Array.isArray(s)){if(!s.length){e.respondWith(void 0);return}for(let a of s)e.respondWith(a)}else e.respondWith(s.value)},o)}unsubscribed(e){e.meta.controller?.abort()}initialize(e){this.host=e;let{window:{webqit:{Observer:r}}}=R;oe(this,rt,{...this.localModules}),G(this,Dt)?.abort(),oe(this,Dt,r.observe(this.localModules,o=>{for(let s of o)s.type==="delete"?this.inheritedModules&&r.has(this.inheritedModules,s.key)?r.set(G(this,rt),s.key,r.get(this.inheritedModules,s.key)):r.deleteProperty(G(this,rt),s.key):r.set(G(this,rt),s.key,s.value)},{timing:"sync"}));let n=this.configs.HTML_IMPORTS;if(this.host.matches&&n.attr.importscontext){let o=this.host.ownerDocument.defaultView.webqit.realdom,s;G(this,Lt)?.disconnect(),oe(this,Lt,o.realtime(this.host).attr(n.attr.importscontext,(a,{signal:l})=>{let c=(a.value||"").trim();if(c===s)return;s=c;let u={...this.constructor.createRequest(c?`${c}/*`:"*"),live:!0,signal:l,diff:!0};this.host.parentNode[this.configs.CONTEXT_API.api.contexts].request(u,f=>{let d=h=>{Reflect.deleteProperty(this.inheritedModules,h),r.has(this.localModules,h)||r.deleteProperty(G(this,rt),h)},p=(h,w)=>{Reflect.set(this.inheritedModules,h,w),r.has(this.localModules,h)||r.set(G(this,rt),h,w)};f?f.type==="delete"?d(f.key):p(f.key,f.value):Object.keys(this.inheritedModules).forEach(d)})},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(e)}dispose(e){return G(this,Dt)?.abort(),G(this,Lt)?.disconnect(),super.dispose(e)}};Se=new WeakMap,rt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,F(lt,"kind","html-imports");function Xr(){let{window:i}=R,{webqit:t}=i,{realdom:e,oohtml:{configs:r}}=t;if(t.HTMLImportElement)return t.HTMLImportElement;let n=r.HTML_IMPORTS.elements.import.includes("-")?i.HTMLElement:class{};class o extends n{static instance(a){return r.HTML_IMPORTS.elements.import.includes("-")&&a instanceof this?a:v(a).get("import::instance")||new this(a)}constructor(...a){super();let l=a[0]||this;v(l).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>l,configurable:!1});let c={};Object.defineProperty(this,"#",{get:()=>c,configurable:!1}),c.slottedElements=new Set,c.setAnchorNode=u=>(c.anchorNode=u,u),c.live=u=>{if(c.liveImportsRealtime)throw new Error("Import element already in live mode.");let f=this.el.isConnected?this.el.parentNode:c.anchorNode.parentNode;c.liveImportsRealtime=e.realtime(this.el).attr(r.HTML_IMPORTS.attr.ref,(d,{signal:p})=>{c.moduleRef=d.value;let h=c.moduleRef.includes("#")?c.moduleRef:`${c.moduleRef}#`,w={...lt.createRequest(h),live:p&&!0,signal:p,diff:!h.endsWith("#")};f[r.CONTEXT_API.api.contexts].request(w,S=>{u((S instanceof i.HTMLTemplateElement?[...S.content.children]:Array.isArray(S)?S:S&&[S])||[])})},{live:!0,timing:"sync",lifecycleSignals:!0}),c.autoDestroyRealtime=e.realtime(i.document).track(f,()=>{c.die()},{subtree:"cross-roots",timing:"sync",generation:"exits"})},c.die=()=>{c.autoDestroyRealtime?.disconnect(),c.liveImportsRealtime?.disconnect(),c.liveImportsRealtime=null},c.hydrate=(u,f)=>{u.replaceWith(c.setAnchorNode(this.createAnchorNode())),c.live(d=>{if(c.originalsRemapped)return this.fill(d);let p=d.map((h,w)=>({el:h,fragmentDef:h.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:h.tagName,i:w}));f.forEach((h,w)=>{let S=h.tagName,g=h.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",_=(w++,p.find(O=>O.tagName===S&&O.fragmentDef===g&&O.i===w));_&&v(h).set("original@imports",_.el),v(h).set("slot@imports",this.el),c.slottedElements.add(h)}),c.originalsRemapped=!0})},c.autoRestore=(u=null)=>{c.autoRestoreRealtime?.disconnect(),u&&u();let f=()=>{this.el.isConnected||(this.el.setAttribute("data-nodecount",0),c.internalMutation=!0,c.anchorNode.replaceWith(this.el),c.internalMutation=!1,c.setAnchorNode(null))};if(!c.slottedElements.size)return f();let d=e.realtime(c.anchorNode.parentNode).observe([...c.slottedElements],p=>{if(p.exits.forEach(h=>{v(h).delete("slot@imports"),c.slottedElements.delete(h)}),!c.slottedElements.size){if(d.disconnect(),!p.target.isConnected)return;f()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});c.autoRestoreRealtime=d},c.connectedCallback=()=>{c.internalMutation||c.live(u=>this.fill(u))},c.disconnectedCallback=()=>{c.internalMutation||c.die()}}createAnchorNode(){if(i.webqit.env!=="server")return i.document.createTextNode("");let a=i.document.createElement("div");a.textContent=this.el.outerHTML;let l=i.document.createComment(a.innerHTML);return v(l).set("isAnchorNode",!0),l}fill(a,l){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(a)&&(a=new Set(a)),this.el.setAttribute("data-nodecount",a.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(c=>{let u=v(c).get("original@imports");a.has(u)?a.delete(u):(this["#"].slottedElements.delete(c),c.remove())}),a.size&&this.el.isConnected){let c=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(c),this["#"].internalMutation=!1}a.forEach(c=>{let u=c.cloneNode(!0);u.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||u.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),v(u).set("original@imports",c),v(u).set("slot@imports",this.el),this["#"].slottedElements.add(u),this["#"].anchorNode.before(u)})}))}empty(){this["#"].slottedElements.forEach(a=>a.remove())}get anchorNode(){return this["#"].anchorNode}get moduleRef(){return this["#"].moduleRef}get slottedElements(){return this["#"].slottedElements}}return r.HTML_IMPORTS.elements.import.includes("-")&&customElements.define(r.HTML_IMPORTS.elements.import,o),t.HTMLImportElement=o,o}function ar(i={}){let{config:t,window:e}=B.call(this,"html-imports",i,{elements:{import:"import"},attr:{def:"def",extends:"extends",inherits:"inherits",ref:"ref",importscontext:"importscontext"},api:{def:"def",defs:"defs",import:"import"}});t.attr.fragmentdef||(t.attr.fragmentdef=t.attr.def),t.templateSelector=`template[${e.CSS.escape(t.attr.def)}]`,t.importsContextSelector=`[${e.CSS.escape(t.attr.importscontext)}]`,t.slottedElementsSelector=`[${e.CSS.escape(t.attr.fragmentdef)}]:not(template)`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,e.webqit.HTMLImportsContext=lt,e.webqit.HTMLImportElement=Xr(),Ji.call(e,t),Yi.call(e,t)}function pt(i,t=!0){if(!v(i).has("defs")&&t){let e=Object.create(null);v(i).set("defs",e)}return v(i).get("defs")}function Ji(i){let t=this,{webqit:{oohtml:{configs:e}}}=t;if(i.api.def in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.def}" API!`);if(i.api.defs in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.defs}" API!`);Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.def,{get:function(){return this.getAttribute(i.attr.def)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(n){this.toggleAttribute("scoped",n)}}),[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(n=>{let o=n===t.Document.prototype?"Document":n===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.import in n)throw new Error(`The ${o} prototype already has a "${i.api.import}" API!`);Object.defineProperty(n,i.api.import,{value:function(s,a=!1,l=null){return r(this,...arguments)}})});function r(n,o,s=!1,a=null){let l={};typeof s=="function"?(a=s,s=!1):typeof s=="object"&&s?l={...s,...l}:l={live:s};let c={...lt.createRequest(o),...l};return n[e.CONTEXT_API.api.contexts].request(c,a)}}function Yi(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},HTMLImportElement:o,HTMLImportsContext:s}}=t,a=u=>{let f=u[n.CONTEXT_API.api.contexts];f.find(s.kind)||f.attach(new s)},l=u=>{let f=u[n.CONTEXT_API.api.contexts],d=f.find(s.kind);d&&(!u.isConnected||!u.matches?.(i.importsContextSelector)&&!Object.keys(d.localModules).length)&&f.detach(d)};r.realtime(t.document).query([i.templateSelector,i.importsContextSelector],u=>{u.entrants.forEach(f=>{if(f.matches(i.templateSelector)){let d=et.instance(f);d.ownerContext=f.scoped?f.parentNode:f.getRootNode();let p=pt(d.ownerContext);d.defId&&e.set(p,d.defId,f),a(d.ownerContext)}else a(f)}),u.exits.forEach(f=>{if(f.matches(i.templateSelector)){let d=et.instance(f),p=pt(d.ownerContext);d.defId&&d.ownerContext.isConnected&&e.deleteProperty(p,d.defId),l(d.ownerContext)}else l(f)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(i.elements.import,u=>{u.entrants.forEach(f=>c(f,!0,u)),u.exits.forEach(f=>c(f,!1,u))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function c(u,f){let d=o.instance(u);f?d["#"].connectedCallback():d["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${i.anchorNodeSelector})`,u=>{u.entrants.forEach(f=>{if(v(f).get("isAnchorNode"))return;let d=t.document.createElement("div");d.innerHTML=f.nodeValue,d.innerHTML=d.firstChild.textContent;let p=d.firstChild,h=parseInt(p.getAttribute("data-nodecount")),w=new Set,S=f;for(;(S=S.previousElementSibling)&&S.matches(i.slottedElementsSelector)&&h--;)w.add(S);o.instance(p)["#"].hydrate(f,w)})},{id:"imports:hydration",live:!0,subtree:"cross-roots",timing:"sync"})}function cr(i={}){let{config:t,window:e}=B.call(this,"context-api",i,{elements:{roots:"root,webflo-embedded"},attr:{contextname:"contextname"},api:{contexts:"contexts"}}),r=new Map,n=e.EventTarget.prototype.dispatchEvent;Object.defineProperty(e.EventTarget.prototype,"dispatchEvent",{value:function(...o){let s=o[0],a=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(s.type)&&a){s.meta&&(s.meta.target=this);let l=u=>{if(u.stopImmediatePropagation(),u.meta&&(u.meta.target=u.target),!u.answered){if(r.get(a)||r.set(a,new Set),u.type==="contextrequest"&&u.live)r.get(a).add(u);else if(u.type==="contextclaim"){let f=new Set;return r.get(a).forEach(d=>{!u.target.contains(d.target)||!u.detail?.matchEvent?.(d)||(r.get(a).delete(d),f.add(d))}),r.get(a).size||r.delete(a),u.respondWith?.(f)}}};a.addEventListener(s.type,l);let c=n.call(this,...o);return a.removeEventListener(s.type,l),c}return n.call(this,...o)}}),e.webqit.DOMContexts=dt,e.webqit.DOMContext=z,e.webqit.DOMContextRequestEvent=xe(),e.webqit.DOMContextResponse=Et,e.webqit.DuplicateContextError=$t,Zi.call(e,t)}function Zi(i){let t=this;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(e=>{let r=e===t.Document.prototype?"Document":e===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.contexts in e)throw new Error(`The ${r} prototype already has a "${i.api.contexts}" API!`);Object.defineProperty(e,i.api.contexts,{get:function(){return dt.instance(this)}})})}function ur({advanced:i={},...t}){let{config:e,window:r}=B.call(this,"scoped-css",t,{api:{styleSheets:"styleSheets"},style:{retention:"retain",mimeTypes:"text/css",strategy:null}});e.styleSelector=(Array.isArray(e.style.mimeTypes)?e.style.mimeTypes:e.style.mimeTypes.split("|")).concat("").reduce((n,o)=>{let s=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`style${s}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},Ki.call(r,e),tn.call(r,e)}function Ki(i){let t=this,e=new Map;[t.Element.prototype].forEach(r=>{let n="Element";if(i.api.styleSheets in r)throw new Error(`The ${n} prototype already has a "${i.api.styleSheets}" API!`);Object.defineProperty(r,i.api.styleSheets,{get:function(){return e.has(this)||e.set(this,[]),e.get(this)}})}),Object.defineProperty(t.HTMLStyleElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}})}function tn(i){let t=this,{webqit:{oohtml:e,realdom:r}}=t,n=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1;t.CSS.supports||(t.CSS.supports=()=>!1);let o=new WeakSet;r.realtime(t.document).query(i.styleSelector,s=>{s.entrants.forEach(a=>{if(o.has(a))return;o.add(a);let l=St(a.textContent),c=CSS.supports("selector(:has(a,b))"),u=a.scoped&&(c?`:has(> style[rand-${l}])`:`[rand-${l}]`),f=a.scoped&&t.CSSScopeRule&&!1,d=a.scoped&&a.parentNode||a.getRootNode();if(d instanceof t.Element){if(d[i.api.styleSheets].push(a),!n)return;(c?a:d).toggleAttribute(`rand-${l}`,!0)}if(!!n)if(a.scoped&&a.hasAttribute("shared")){let p;(p=e.Style.compileCache.get(l))||(p=en.call(t,a,null,f,u),e.Style.compileCache.set(l,p)),Object.defineProperty(a,"sheet",{value:p,configurable:!0}),a.textContent=`
|
|
53
|
+
`;if(p==="$")return`$exec__(this, '${m}', ${x});`;if(u.trim())throw new Error(`Invalid binding: ${u}.`)}).join(`
|
|
54
|
+
`),{webqit:{QuantumModule:o}}=this,{parserParams:s,compilerParams:a,runtimeParams:l}=i.advanced,c=new o(n,{parserParams:s,compilerParams:a,runtimeParams:l});return ir.set(t,c),c}var Lt=i=>i.replace(/"/g,'\\"');function Qr(i){let t=this,{webqit:{oohtml:{configs:{DATA_BINDING:e}}}}=t;(i?.matches(e.attrSelector)?[i]:[]).concat([...i?.querySelectorAll(e.attrSelector)||[]]).forEach(r=>{Gr.call(t,e,r.getAttribute(e.attr.render))}),qt(t,i,`(${e.discreteBindingsSelector})`).forEach(r=>{let n=zr(e,r.nodeValue);Ur.call(t,e,n.expr)})}var Y=class extends U{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 bindingsObj(){return this.host[this.configs.BINDINGS_API.api.bindings]}matchEvent(t){return super.matchEvent(t)&&(!t.detail||!this.detail||(Array.isArray(t.detail)?t.detail[0]===this.detail:t.detail===this.detail))}handle(t){if(t.meta.controller?.abort(),!(t.detail+"").trim())return t.respondWith(this.bindingsObj);let{window:{webqit:{Observer:e}}}=k;t.meta.controller=e.reduce(this.bindingsObj,Array.isArray(t.detail)?t.detail:[t.detail],e.get,r=>{this.disposed||t.respondWith(r.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};W(Y,"kind","bindings");function or(i={}){let{config:t,window:e}=z.call(this,"bindings-api",i,{attr:{bindingsreflection:"bindings"},api:{bind:"bind",bindings:"bindings"}});e.webqit.DOMBindingsContext=Y,Gi.call(e,t),Xi.call(e,t)}function sr(i,t){let e=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:n}}}}=e;if(!v(t).has("bindings")){let o=Object.create(null);v(t).set("bindings",o),r.observe(o,s=>{if(t instanceof e.Element){let a=Se(t.getAttribute(i.attr.bindingsreflection)||""),l=new Map(a);for(let c of s)c.detail?.publish!==!1&&(c.type==="delete"?a.delete(c.key):a.set(c.key,void 0));a.size&&a.size!==l.size?t.setAttribute(i.attr.bindingsreflection,`{ ${[...a.entries()].map(([c,u])=>u===void 0?c:`${c}: ${u}`).join(", ")} }`):a.size||t.toggleAttribute(i.attr.bindingsreflection,!1)}else{let a=t[n.api.contexts];for(let l of s)if(l.type==="delete"){let c=a.find(Y.kind,l.key);c&&a.detach(c)}else a.find(Y.kind,l.key)||a.attach(new Y(l.key))}})}return v(t).get("bindings")}function Gi(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.bind in r)throw new Error(`The ${n} prototype already has a "${i.api.bind}" API!`);if(i.api.bindings in r)throw new Error(`The ${n} prototype already has a "${i.api.bindings}" API!`);Object.defineProperty(r,i.api.bind,{value:function(o,s={}){return Qi.call(t,i,this,o,s)}}),Object.defineProperty(r,i.api.bindings,{get:function(){return e.proxy(sr.call(t,i,this))}})})}function Qi(i,t,e,{merge:r,diff:n,publish:o,namespace:s}={}){let a=this,{webqit:{Observer:l}}=a,c=sr.call(this,i,t),u={diff:n,namespace:s,detail:{publish:o}},f=r?[]:l.ownKeys(c,u).filter(d=>!(d in e));return l.batch(c,()=>(f.length&&l.deleteProperties(c,f,u),l.set(c,e,u)),u)}function Xi(i){let t=this,{webqit:{realdom:e,Observer:r,oohtml:{configs:n}}}=t,o=(a,l)=>{let c=a[n.CONTEXT_API.api.contexts];c.find(Y.kind,l)||c.attach(new Y(l))},s=(a,l)=>{let c,u=a[n.CONTEXT_API.api.contexts];for(;c=u.find(Y.kind,l);)u.detach(c)};e.realtime(t.document).query(`[${t.CSS.escape(i.attr.bindingsreflection)}]`,a=>{a.exits.forEach(l=>s(l)),a.entrants.forEach(l=>{let c=Se(l.getAttribute(i.attr.bindingsreflection)||""),u=[...c.entries()].filter(([f,d])=>d!==void 0);u.length&&l[i.api.bind](Object.fromEntries(u),{merge:!0,publish:!1});for(let[f]of c)o(l,f)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),e.realtime(t.document,"attr").observe(i.attr.bindingsreflection,a=>{let l=sr.call(t,i,a.target),c=Se(a.value||""),u=Se(a.oldValue||"");for(let f of new Set([...c.keys(),...u.keys()]))u.has(f)?c.has(f)?c.get(f)!==u.get(f)&&r.set(l,f,c.get(f),{detail:{publish:!1}}):(u.get(f)!==void 0&&r.deleteProperty(l,f,{detail:{publish:!1}}),s(a.target,f)):(c.get(f)!==void 0&&r.set(l,f,c.get(f),{detail:{publish:!1}}),o(a.target,f))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var Se=i=>(i=i.trim(),new Map(ct(i.slice(1,-1),",").filter(t=>t.trim()).map(t=>ct(t,":").map(e=>e.trim()))));var rt=class{static instance(t){return v(t).get("defsmanager::instance")||new this(t)}constructor(t,e=null,r=0){let{window:n}=k,{webqit:{realdom:o,oohtml:{configs:s}}}=n;v(t).get("defsmanager::instance")?.dispose(),v(t).set("defsmanager::instance",this),this.window=n,this.host=t,this.config=s.HTML_IMPORTS,this.parent=e,this.level=r,this.defs=pt(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=o.realtime(this.host.content).children(a=>{this.expose(a.entrants,!0),this.expose(a.exits,!1)},{live:!0,timing:"sync"}),this.realtimeB=o.realtime(this.host).attr(["src","loading"],(...a)=>this.evaluateLoading(...a),{live:!0,atomic:!0,timing:"sync",lifecycleSignals:!0}),this.realtimeC=this.evalInheritance()}validateDefId(t){if(["@","/","*","#"].some(e=>t.includes(e)))throw new Error(`The export ID "${t}" contains an invalid character.`)}expose(t,e){let{window:r}=k,{webqit:{Observer:n}}=r,o,s=this.defs["#"]||[];t.forEach(a=>{if(a.nodeType!==1)return;let l=a.matches(this.config.templateSelector),c=(a.getAttribute(l?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();e?(l&&c?new rt(a,this.host,this.level+1):(s.push(a),o=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(u=>u.call(this.window,a))})),c&&(this.validateDefId(c),n.set(this.defs,(!l&&"#"||"")+c,a))):(l&&c?rt.instance(a).dispose():(s=s.filter(u=>u!==a),o=!0),c&&n.deleteProperty(this.defs,(!l&&"#"||"")+c))}),o&&n.set(this.defs,"#",s)}evaluateLoading([t,e],{signal:r}){let{window:{webqit:{Observer:n}}}=k,o=(t.value||"").trim();if(!o)return;let s,a=u=>{if(!u)return s;s=u.then(()=>c.remove())},l=(e.value||"").trim(),c=n.intercept(this.defs,"get",async(u,f,d)=>(l==="lazy"&&a(this.load(o,!0)),await a(),d()),{signal:r});l!=="lazy"&&a(this.load(o))}load(t){let{window:e}=k;if(this.host.content.children.length)return Promise.resolve();if(this.fetchInFlight?.src===t)return this.fetchInFlight.request;this.fetchInFlight?.controller.abort();let r=new AbortController,n=(s,a)=>this.host.dispatchEvent(new e.CustomEvent(s,{detail:a})),o=e.fetch(t,{signal:r.signal,element:this.host}).then(s=>s.ok?s.text():Promise.reject(s.statusText)).then(s=>(this.host.innerHTML=s.trim(),n("load"),this.host)).catch(s=>(console.error(`Error fetching the bundle at "${t}": ${s.message}`),this.fetchInFlight=null,n("loaderror"),this.host));return this.fetchInFlight={src:t,request:o,controller:r},o}evalInheritance(){if(!this.parent)return[];let{window:{webqit:{Observer:t}}}=k,e=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(a=>a.trim()).filter(a=>a),n=a=>{a.forEach(l=>{t.get(this.defs,l.key)===l.oldValue&&(["get","set","def"].includes(l.type)?t[l.type.replace("get","set")](this.defs,l.key,l.value):l.type==="delete"&&t.deleteProperty(this.defs,l.key))})},o=[],s=pt(this.parent);return e&&o.push(t.reduce(s,[e,this.config.api.defs,1/0],t.get,n,{live:!0})),r.length&&o.push(t.get(s,r.includes("*")?1/0:r,n,{live:!0})),o}dispose(){this.realtimeA.disconnect(),this.realtimeB.disconnect(),this.realtimeC.forEach(t=>t instanceof Promise?t.then(e=>e.abort()):t.abort()),Object.entries(this.defs).forEach(([t,e])=>{t.startsWith("#")||rt.instance(e).dispose()})}};var ht,Q,Ht,Ft,lt=class extends U{constructor(){super(...arguments);Wt(this,ht,{});Wt(this,Q,void 0);Wt(this,Ht,void 0);Wt(this,Ft,void 0)}static createRequest(e=null){let r=super.createRequest();if(e?.startsWith("/"))r.detail=e,r.targetContext=1/0;else if(e?.startsWith("@")){let[n,...o]=e.slice(1).split(/(?<=\w)(?=\/|#)/).map(s=>s.trim());r.targetContext=n,r.detail=o.join("")}else r.detail=e;return r}get localModules(){return pt(this.host)}get inheritedModules(){return F(this,ht)}handle(e){let{window:{webqit:{Observer:r}}}=k;e.meta.controller?.abort();let n=(e.detail||"").split(/\/|(?<=\w)(?=#)/g).map(s=>s.trim()).filter(s=>s);if(!n.length)return e.respondWith();n=n.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(s=>s==="*"?1/0:s)||[];let o={live:e.live,signal:e.signal,descripted:!0};e.meta.controller=r.reduce(F(this,Q),n,r.get,s=>{if(Array.isArray(s)){if(!s.length){e.respondWith();return}for(let a of s)e.respondWith(a)}else e.respondWith(s.value)},o)}unsubscribed(e){e.meta.controller?.abort()}initialize(e){this.host=e;let{window:{webqit:{Observer:r}}}=k,n=()=>{for(let s of new Set([...Object.keys(this.localModules),...Object.keys(this.inheritedModules),...Object.keys(F(this,Q))]))if(!r.has(this.localModules,s)&&!r.has(this.inheritedModules,s))r.deleteProperty(F(this,Q),s);else if(s==="#"&&r.has(this.localModules,s)&&r.has(this.inheritedModules,s))r.set(F(this,Q),s,[...r.get(this.localModules,s),...r.get(this.inheritedModules,s)]);else{let a=r.get(this.localModules,s)||r.get(this.inheritedModules,s);r.get(F(this,Q),s)!==a&&r.set(F(this,Q),s,a)}};Pt(this,Q,{...this.localModules}),F(this,Ht)?.abort(),Pt(this,Ht,r.observe(this.localModules,()=>n("local"),{timing:"sync"}));let o=this.configs.HTML_IMPORTS;if(this.host.matches&&o.attr.importscontext){let s=this.host.ownerDocument.defaultView.webqit.realdom,a;F(this,Ft)?.disconnect(),Pt(this,Ft,s.realtime(this.host).attr(o.attr.importscontext,(l,{signal:c})=>{let u=(l.value||"").trim();if(u===a)return;a=u,Pt(this,ht,{});let f={...this.constructor.createRequest(u?`${u}/*`:"*"),live:!0,signal:c,diff:!0};this.host.parentNode[this.configs.CONTEXT_API.api.contexts].request(f,d=>{d?d.type==="delete"?(delete F(this,ht)[d.key],Reflect.has(this.localModules,d.key)||r.deleteProperty(F(this,Q),d.key)):(F(this,ht)[d.key]=d.value,!Reflect.has(this.localModules,d.key)&&Reflect.get(F(this,Q),d.key)!==d.value&&r.set(F(this,Q),d.key,d.value)):(Pt(this,ht,{}),n("inherited"))}),n("inherited")},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(e)}dispose(e){return F(this,Ht)?.abort(),F(this,Ft)?.disconnect(),super.dispose(e)}};ht=new WeakMap,Q=new WeakMap,Ht=new WeakMap,Ft=new WeakMap,W(lt,"kind","html-imports");function Xr(){let{window:i}=k,{webqit:t}=i,{realdom:e,oohtml:{configs:r}}=t;if(t.HTMLImportElement)return t.HTMLImportElement;let n=r.HTML_IMPORTS.elements.import.includes("-")?i.HTMLElement:class{};class o extends n{static instance(a){return r.HTML_IMPORTS.elements.import.includes("-")&&a instanceof this?a:v(a).get("import::instance")||new this(a)}constructor(...a){super();let l=a[0]||this;v(l).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>l,configurable:!1});let c={};Object.defineProperty(this,"#",{get:()=>c,configurable:!1}),c.slottedElements=new Set,c.setAnchorNode=u=>(c.anchorNode=u,u),c.live=u=>{if(c.liveImportsRealtime)throw new Error("Import element already in live mode.");let f=this.el.isConnected?this.el.parentNode:c.anchorNode.parentNode;c.liveImportsRealtime=e.realtime(this.el).attr(r.HTML_IMPORTS.attr.ref,(d,{signal:p})=>{c.moduleRef=d.value;let m=c.moduleRef.includes("#")?c.moduleRef:`${c.moduleRef}#`,x={...lt.createRequest(m),live:p&&!0,signal:p,diff:!m.endsWith("#")};f[r.CONTEXT_API.api.contexts].request(x,S=>{u((S instanceof i.HTMLTemplateElement?[...S.content.children]:Array.isArray(S)?S:S&&[S])||[])})},{live:!0,timing:"sync",lifecycleSignals:!0}),c.autoDestroyRealtime=e.realtime(i.document).track(f,()=>{c.die()},{subtree:"cross-roots",timing:"sync",generation:"exits"})},c.die=()=>{c.autoDestroyRealtime?.disconnect(),c.liveImportsRealtime?.disconnect(),c.liveImportsRealtime=null},c.hydrate=(u,f)=>{u.replaceWith(c.setAnchorNode(this.createAnchorNode())),c.live(d=>{if(c.originalsRemapped)return this.fill(d);let p=d.map((m,x)=>({el:m,fragmentDef:m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:m.tagName,i:x}));f.forEach((m,x)=>{let S=m.tagName,g=m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",_=(x++,p.find(O=>O.tagName===S&&O.fragmentDef===g&&O.i===x));_&&v(m).set("original@imports",_.el),v(m).set("slot@imports",this.el),c.slottedElements.add(m)}),c.originalsRemapped=!0})},c.autoRestore=(u=null)=>{c.autoRestoreRealtime?.disconnect(),u&&u();let f=()=>{this.el.isConnected||(this.el.setAttribute("data-nodecount",0),c.internalMutation=!0,c.anchorNode.replaceWith(this.el),c.internalMutation=!1,c.setAnchorNode(null))};if(!c.slottedElements.size)return f();let d=e.realtime(c.anchorNode.parentNode).observe([...c.slottedElements],p=>{if(p.exits.forEach(m=>{v(m).delete("slot@imports"),c.slottedElements.delete(m)}),!c.slottedElements.size){if(d.disconnect(),!p.target.isConnected)return;f()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});c.autoRestoreRealtime=d},c.connectedCallback=()=>{c.internalMutation||c.live(u=>this.fill(u))},c.disconnectedCallback=()=>{c.internalMutation||c.die()}}createAnchorNode(){if(i.webqit.env!=="server")return i.document.createTextNode("");let a=i.document.createElement("div");a.textContent=this.el.outerHTML;let l=i.document.createComment(a.innerHTML);return v(l).set("isAnchorNode",!0),l}fill(a,l){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(a)&&(a=new Set(a)),this.el.setAttribute("data-nodecount",a.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(c=>{let u=v(c).get("original@imports");a.has(u)?a.delete(u):(this["#"].slottedElements.delete(c),c.remove())}),a.size&&this.el.isConnected){let c=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(c),this["#"].internalMutation=!1}a.forEach(c=>{let u=c.cloneNode(!0);u.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||u.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),v(u).set("original@imports",c),v(u).set("slot@imports",this.el),this["#"].slottedElements.add(u),this["#"].anchorNode.before(u)})}))}empty(){this["#"].slottedElements.forEach(a=>a.remove())}get anchorNode(){return this["#"].anchorNode}get moduleRef(){return this["#"].moduleRef}get slottedElements(){return this["#"].slottedElements}}return r.HTML_IMPORTS.elements.import.includes("-")&&customElements.define(r.HTML_IMPORTS.elements.import,o),t.HTMLImportElement=o,o}function ar(i={}){let{config:t,window:e}=z.call(this,"html-imports",i,{elements:{import:"import"},attr:{def:"def",extends:"extends",inherits:"inherits",ref:"ref",importscontext:"importscontext"},api:{def:"def",defs:"defs",import:"import"}});t.attr.fragmentdef||(t.attr.fragmentdef=t.attr.def),t.templateSelector=`template[${e.CSS.escape(t.attr.def)}]`,t.importsContextSelector=`[${e.CSS.escape(t.attr.importscontext)}]`,t.slottedElementsSelector=`[${e.CSS.escape(t.attr.fragmentdef)}]:not(template)`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,e.webqit.HTMLImportsContext=lt,e.webqit.HTMLImportElement=Xr(),Ji.call(e,t),Yi.call(e,t)}function pt(i,t=!0){if(!v(i).has("defs")&&t){let e=Object.create(null);v(i).set("defs",e)}return v(i).get("defs")}function Ji(i){let t=this,{webqit:{oohtml:{configs:e}}}=t;if(i.api.def in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.def}" API!`);if(i.api.defs in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.defs}" API!`);Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.def,{get:function(){return this.getAttribute(i.attr.def)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(n){this.toggleAttribute("scoped",n)}}),[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(n=>{let o=n===t.Document.prototype?"Document":n===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.import in n)throw new Error(`The ${o} prototype already has a "${i.api.import}" API!`);Object.defineProperty(n,i.api.import,{value:function(s,a=!1,l=null){return r(this,...arguments)}})});function r(n,o,s=!1,a=null){let l={};typeof s=="function"?(a=s,s=!1):typeof s=="object"&&s?l={...s,...l}:l={live:s};let c={...lt.createRequest(o),...l};return n[e.CONTEXT_API.api.contexts].request(c,a)}}function Yi(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},HTMLImportElement:o,HTMLImportsContext:s}}=t,a=u=>{let f=u[n.CONTEXT_API.api.contexts];f.find(s.kind)||f.attach(new s)},l=u=>{let f=u[n.CONTEXT_API.api.contexts],d=f.find(s.kind);d&&(!u.isConnected||!u.matches?.(i.importsContextSelector)&&!Object.keys(d.localModules).length)&&f.detach(d)};r.realtime(t.document).query([i.templateSelector,i.importsContextSelector],u=>{u.entrants.forEach(f=>{if(f.matches(i.templateSelector)){let d=rt.instance(f);d.ownerContext=f.scoped?f.parentNode:f.getRootNode();let p=pt(d.ownerContext);d.defId&&e.set(p,d.defId,f),a(d.ownerContext)}else a(f)}),u.exits.forEach(f=>{if(f.matches(i.templateSelector)){let d=rt.instance(f),p=pt(d.ownerContext);d.defId&&d.ownerContext.isConnected&&e.deleteProperty(p,d.defId),l(d.ownerContext)}else l(f)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(i.elements.import,u=>{u.entrants.forEach(f=>c(f,!0,u)),u.exits.forEach(f=>c(f,!1,u))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function c(u,f){let d=o.instance(u);f?d["#"].connectedCallback():d["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${i.anchorNodeSelector})`,u=>{u.entrants.forEach(f=>{if(v(f).get("isAnchorNode"))return;let d=t.document.createElement("div");d.innerHTML=f.nodeValue,d.innerHTML=d.firstChild.textContent;let p=d.firstChild,m=parseInt(p.getAttribute("data-nodecount")),x=new Set,S=f;for(;(S=S.previousElementSibling)&&S.matches(i.slottedElementsSelector)&&m--;)x.add(S);o.instance(p)["#"].hydrate(f,x)})},{id:"imports:hydration",live:!0,subtree:"cross-roots",timing:"sync"})}function cr(i={}){let{config:t,window:e}=z.call(this,"context-api",i,{elements:{roots:"root,webflo-embedded"},attr:{contextname:"contextname"},api:{contexts:"contexts"}}),r=new Map,n=e.EventTarget.prototype.dispatchEvent;Object.defineProperty(e.EventTarget.prototype,"dispatchEvent",{value:function(...o){let s=o[0],a=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(s.type)&&a){s.meta&&(s.meta.target=this);let l=u=>{if(u.stopImmediatePropagation(),u.meta&&(u.meta.target=u.target),!u.answered){if(r.get(a)||r.set(a,new Set),u.type==="contextrequest"&&u.live)r.get(a).add(u);else if(u.type==="contextclaim"){let f=new Set;return r.get(a).forEach(d=>{!u.target.contains(d.target)||!u.detail?.matchEvent?.(d)||(r.get(a).delete(d),f.add(d))}),r.get(a).size||r.delete(a),u.respondWith?.(f)}}};a.addEventListener(s.type,l);let c=n.call(this,...o);return a.removeEventListener(s.type,l),c}return n.call(this,...o)}}),e.webqit.DOMContexts=dt,e.webqit.DOMContext=U,e.webqit.DOMContextRequestEvent=_e(),e.webqit.DOMContextResponse=Et,e.webqit.DuplicateContextError=At,Zi.call(e,t)}function Zi(i){let t=this;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(e=>{let r=e===t.Document.prototype?"Document":e===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.contexts in e)throw new Error(`The ${r} prototype already has a "${i.api.contexts}" API!`);Object.defineProperty(e,i.api.contexts,{get:function(){return dt.instance(this)}})})}function ur({advanced:i={},...t}){let{config:e,window:r}=z.call(this,"scoped-css",t,{api:{styleSheets:"styleSheets"},style:{retention:"retain",mimeTypes:"text/css",strategy:null}});e.styleSelector=(Array.isArray(e.style.mimeTypes)?e.style.mimeTypes:e.style.mimeTypes.split("|")).concat("").reduce((n,o)=>{let s=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`style${s}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},Ki.call(r,e),tn.call(r,e)}function Ki(i){let t=this,e=new Map;[t.Element.prototype].forEach(r=>{let n="Element";if(i.api.styleSheets in r)throw new Error(`The ${n} prototype already has a "${i.api.styleSheets}" API!`);Object.defineProperty(r,i.api.styleSheets,{get:function(){return e.has(this)||e.set(this,[]),e.get(this)}})}),Object.defineProperty(t.HTMLStyleElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}})}function tn(i){let t=this,{webqit:{oohtml:e,realdom:r}}=t,n=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1;t.CSS.supports||(t.CSS.supports=()=>!1);let o=new WeakSet;r.realtime(t.document).query(i.styleSelector,s=>{s.entrants.forEach(a=>{if(o.has(a))return;o.add(a);let l=$t(a.textContent),c=CSS.supports("selector(:has(a,b))"),u=a.scoped&&(c?`:has(> style[rand-${l}])`:`[rand-${l}]`),f=a.scoped&&t.CSSScopeRule&&!1,d=a.scoped&&a.parentNode||a.getRootNode();if(d instanceof t.Element){if(d[i.api.styleSheets].push(a),!n)return;(c?a:d).toggleAttribute(`rand-${l}`,!0)}if(!!n)if(a.scoped&&a.hasAttribute("shared")){let p;(p=e.Style.compileCache.get(l))||(p=en.call(t,a,null,f,u),e.Style.compileCache.set(l,p)),Object.defineProperty(a,"sheet",{value:p,configurable:!0}),a.textContent=`
|
|
55
55
|
/*[ Shared style sheet ]*/
|
|
56
|
-
`}else{let p=()=>{let
|
|
56
|
+
`}else{let p=()=>{let m=Oe(Dt.call(t,d));lr.call(this,a.sheet,m,!f&&u)};a.isConnected?p():setTimeout(()=>{p()},0)}})},{id:"scoped-css",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants"})}function en(i,t,e,r){let n=this,o=i.textContent,s,a=e&&r?`@scope (${r}) {
|
|
57
57
|
${o.trim()}
|
|
58
58
|
}`:o.trim();try{s=new n.CSSStyleSheet,s.replaceSync(a),lr.call(this,s,t,!e&&r);let l=()=>i.getRootNode().adoptedStyleSheets.push(s);i.isConnected?l():setTimeout(()=>{l()},0)}catch{let c=n.document.createElement("style");i.after(c),c.textContent=a,s=c.sheet,lr.call(this,s,t,!e&&r)}return s}function lr(i,t,e=null){let r=i?.cssRules.length||-1;for(let n=0;n<r;++n){let o=i.cssRules[n];o instanceof CSSImportRule||Jr.call(this,o,t,e)}}function Jr(i,t,e=null){if(i instanceof CSSStyleRule){Yr.call(this,i,t,e);return}if([window.CSSScopeRule,window.CSSMediaRule,window.CSSContainerRule,window.CSSSupportsRule,window.CSSLayerBlockRule].some(r=>r&&i instanceof r)){let r=i.cssRules.length;for(let n=0;n<r;++n)Jr.call(this,i.cssRules[n],t,e)}}function Yr(i,t,e=null){let r=tr.call(this,i.selectorText,t,e,1);if(i.selectorText=r,i.cssRules){let n=i.cssRules.length;for(let o=0;o<n;++o)Yr.call(this,i.cssRules[o],t)}}function fr(i,t={}){this.webqit||(this.webqit={}),Object.assign(this.webqit,i),cr.call(this,t.CONTEXT_API||{}),or.call(this,t.BINDINGS_API||{}),ar.call(this,{...t.HTML_IMPORTS||{},idleCompilers:[Wr,Qr]}),Ke.call(this,t.NAMESPACED_HTML||{}),nr.call(this,t.DATA_BINDING||{}),ur.call(this,t.SCOPED_CSS||{}),er.call(this,t.SCOPED_JS||{})}fr.call(window,ze);})();
|
|
59
59
|
//# sourceMappingURL=main.lite.js.map
|