@webqit/oohtml 4.5.0 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bindings-api.js +1 -1
- package/dist/bindings-api.js.map +2 -2
- package/dist/data-binding.js +5 -5
- package/dist/data-binding.js.map +2 -2
- package/dist/main.js +15 -15
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +10 -10
- package/dist/main.lite.js.map +2 -2
- package/package.json +2 -2
- package/src/bindings-api/index.js +1 -1
- package/src/data-binding/index.js +13 -13
package/dist/main.lite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(()=>{var fr=Object.defineProperty;var Kr=(i,t,e)=>t in i?fr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var _e=(i,t)=>{for(var e in t)fr(i,e,{get:t[e],enumerable:!0})};var W=(i,t,e)=>(Kr(i,typeof t!="symbol"?t+"":t,e),e),dr=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var F=(i,t,e)=>(dr(i,t,"read from private field"),e?e.call(i):t.get(i)),Bt=(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)},Ct=(i,t,e,r)=>(dr(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e);var Ve={};_e(Ve,{AsyncQuantumFunction:()=>Sr,AsyncQuantumScript:()=>jt,Observer:()=>P,QuantumAsyncFunction:()=>Pi,QuantumAsyncScript:()=>Ti,QuantumFunction:()=>Ei,QuantumModule:()=>re,QuantumScript:()=>Ci,State:()=>Ot});var He={};_e(He,{any:()=>gi,apply:()=>ke,batch:()=>Le,construct:()=>qe,defineProperties:()=>xi,defineProperty:()=>Jt,deleteProperties:()=>_i,deleteProperty:()=>Yt,get:()=>lt,getOwnPropertyDescriptor:()=>ue,getOwnPropertyDescriptors:()=>wi,getPrototypeOf:()=>Te,has:()=>fe,intercept:()=>yi,isExtensible:()=>Ie,map:()=>bi,observe:()=>De,ownKeys:()=>Me,path:()=>hi,preventExtensions:()=>je,reduce:()=>Ne,set:()=>wt,setPrototypeOf:()=>Re,subtree:()=>mi});function T(i){return!Array.isArray(i)&&typeof i=="object"&&i}function Tt(i){return typeof i}function E(i){return Array.isArray(i)}function It(i){return typeof i=="function"}function Vt(i){return i===null||i===""}function st(i){return arguments.length&&(i===void 0||typeof i>"u")}function M(i){return Array.isArray(i)||typeof i=="object"&&i||It(i)}function ve(i){return Vt(i)||st(i)||i===!1||i===0||M(i)&&!Object.keys(i).length}function I(i){return It(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 Mt(i){return i instanceof String||typeof i=="string"&&i!==null}function Oe(i){return!Mt(i)&&!st(i.length)}function ae(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function Se(r,t){t=t||Object.prototype,t=t&&!E(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 Ae(i,t){var e=[];return Se(i,t).forEach(r=>{ae(e,...Object.getOwnPropertyNames(r))}),e}function tt(i,t,e=!1,r=!1,n=!1){var o=0,a=i.shift();if((X(a)||a===!0||a===!1)&&(o=a,a=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((s,u)=>{!M(s)&&!I(s)||(e?Ae(s):Object.keys(s)).forEach(c=>{if(!!t(c,a,s,u)){var l=a[c],f=s[c];if((E(l)&&E(f)||T(l)&&T(f))&&(o===!0||o>0))a[c]=E(l)&&E(f)?[]:{},tt([X(o)?o-1:o,a[c],l,f],t,e,r,n);else if(E(a)&&E(s))r?a[c]=f:a.push(f);else try{n?Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(s,c)):a[c]=s[c]}catch{}}})}),a}function Ut(...i){return tt(i,(t,e,r)=>!0,!1,!1,!1)}function V(i,...t){if(!i||!["object","function"].includes(typeof i))throw new Error("Argument #1 must be of type object");let e=i[Symbol.for("wq")];if(e||(e=new ce,Object.defineProperty(i,Symbol.for("wq"),{value:e,enumerable:!1,configurable:!1,writable:!1})),!t.length)return e;let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new ce,n.set(r,e));return e}var ce=class extends Map{};function j(i,t=!0){return E(i)?i:!t&&T(i)?[i]:i!==!1&&i!==0&&ve(i)?[]:Oe(i)?Array.prototype.slice.call(i):T(i)?Object.values(i):[i]}var R=(i,...t)=>V(i,"observerAPI",...t),qt=(i,t)=>i instanceof Promise?i.then(t):t(i),le={};var yt=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 yt{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=j(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 qt(n,o=>{let a=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&a?.length?this.emit.currentRegistration.fire(a):o})}};var J=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; "${Tt(e)}" given!`);let o=this;return n&&R(J,"namespaces").has(t+"-"+n)&&(o=R(J,"namespaces").get(t+"-"+n),t+="-"+n),!R(e,"registry").has(t)&&r&&R(e,"registry").set(t,new o(e)),R(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return R(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}.`);R(J,"namespaces").set(t,r),r.__namespace=e}};var D=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 at=class extends J{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,{eventsArePropertyDescriptors:e=!1,eventIsArrayMethodDescriptor:r=!1}={}){if(this.batches.length){let n=this.batches[0].params.arrayMethodName;this.batches[0].snapshots.push({events:[...t],arrayMethodName:n,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r});return}this.$emit(this.entries,[{events:t,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r}])}$emit(t,e){let r=0,n=0,o=0;for(let l of t)r+=1,l.params.withPropertyDescriptors&&(n+=1),l.params.withArrayMethodDescriptors&&(o+=1);let a=[],s=[],u=[],c=[];for(let l of e){let f=l.arrayMethodName,d=l.eventsArePropertyDescriptors,h=l.eventIsArrayMethodDescriptor;for(let p of l.events)if(f&&(p.operation=f),n&&(o&&a.push(p),h||o!==r&&s.push(p)),n!==r){let v=p;if(d){let{target:O,type:g,...w}=p;v=new D(O,{type:"set",...w}),Object.defineProperty(v,"value","get"in w.value?{get:()=>w.value.get()}:{value:w.value.value}),w.oldValue&&Object.defineProperty(v,"oldValue","get"in w.oldValue?{get:()=>w.oldValue.get()}:{value:w.oldValue.value})}o&&u.push(v),h||o!==r&&c.push(v)}}for(let l of t)l.params.withPropertyDescriptors?l.params.withArrayMethodDescriptors?a.length&&l.fire(a):s.length&&l.fire(s):l.params.withArrayMethodDescriptors?u.length&&l.fire(u):c.length&&l.fire(c)}batch(t,e={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:e});let r=t();return qt(r,n=>{let o=this.batches.shift();return o.snapshots.length&&this.$emit(o.entries,o.snapshots),n})}};var Qt=class extends yt{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 ct=class extends J{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,...a){let s=r.entries[o];return s?s.exec(t,(...u)=>n(o+1,...u),...a):e?e(t,...a):a[0]}(0)}};var Ce={};_e(Ce,{accessorize:()=>di,proxy:()=>xr,unaccessorize:()=>pi,unproxy:()=>Xt});var br=Symbol("wqOriginal");function di(i,t,e={}){i=Pe(i);let r=R(i,"accessorizedProps");function n(u){let c,l=i;do c=Object.getOwnPropertyDescriptor(l,u);while(!c&&(l=Object.getPrototypeOf(l)));return c?{proto:l,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(u){if(r.has(u+""))return!0;let c=n(u);c.getValue=function(d=!1){return d?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(d,h=!1){if(this.dirty=!0,h){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,u);return d?.get===f.get&&d?.set===f.set&&r.get(u+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[u]:Object.defineProperty(i,u,this.descriptor),r.delete(u+""),!0):!1},r.set(isNaN(u)?u:parseInt(u),c);let{enumerable:l=!0}=c.descriptor,f={enumerable:l,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(f.set=function(d){return wt(this,u,d,e)}),("value"in c.descriptor||c.descriptor.get)&&(f.get=function(){return lt(this,u,e)});try{return Object.defineProperty(i,u,f),!0}catch{return r.delete(u+""),!1}}let s=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(o);return t===void 0||Array.isArray(t)?s:s[0]}function pi(i,t,e={}){i=Pe(i);let r=R(i,"accessorizedProps");function n(s){return r.has(s+"")?r.get(s+"").restore():!0}let a=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(n);return t===void 0||Array.isArray(t)?a:a[0]}function xr(i,t={},e=void 0){let r=Pe(i);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&R(r,"membraneRef").has(t.membrane))return R(r,"membraneRef").get(t.membrane);let n={apply:(s,u,c)=>ke(s,u,c,void 0,t),construct:(s,u,c=null)=>qe(s,u,c,t),defineProperty:(s,u,c)=>Jt(s,u,c,t),deleteProperty:(s,u)=>Yt(s,u,t),get:(s,u,c=null)=>{if(u===br)return r;let l={...t,receiver:c},f=lt(s,u,l);return Array.isArray(s)&&typeof f=="function"?xr(f,{...t,arrayMethodName:u,membrane:c}):f},getOwnPropertyDescriptor:(s,u)=>ue(s,u,t),getPrototypeOf:s=>Te(s,t),has:(s,u)=>fe(s,u,t),isExtensible:s=>Ie(s,t),ownKeys:s=>Me(s,t),preventExtensions:s=>je(s,t),set:(s,u,c,l=null)=>wt(s,u,c,{...t,receiver:l}),setPrototypeOf:(s,u)=>Re(s,u,t)},o=e?.(n)||n,a=new Proxy(r,o);return t.membrane&&R(r,"membraneRef").set(t.membrane,a),a}function Xt(i){return i&&i[br]||i}function Pe(i){if(!i||!M(i))throw new Error("Target must be of type object!");return Xt(i)}var Zt=class extends Array{};function hi(...i){return new Zt(...i)}var bt=class extends Array{};function mi(){return new bt}function gi(){return 1/0}function Ne(i,t,e,r=o=>o,n={}){let o=t instanceof bt;if(!(!o&&!t?.length))return function a(s,u,c,l){let f=l||u[c.level]instanceof bt,d=f?1/0:u[c.level],h=f?!1:c.level===u.length-1;return s instanceof D&&s.operation!=="get"?c={...c,probe:"always"}:c.probe!=="always"&&(c={...c,probe:!h}),e(s,d,(p,...v)=>{let O=b=>{b instanceof D&&(b.path="key"in b?[b.key]:[],s instanceof D&&(b.path="key"in b?s.path.concat(b.key):s.path.slice(0),Object.defineProperty(b,"context",{get:()=>s,configurable:!0})))},g=v[0]||{},w=b=>{if(b instanceof D&&"argumentsList"in b)return;let y=et(b,!1);return qt(y,m=>(b instanceof D?b.value=m:b=m,a(b,u,{...c,...g,keyInParent:b.key,level:c.level+1},f)))};if(Kt(d)&&Array.isArray(p)){if(p.forEach(O),h)return r(p,...v);f&&p[0]instanceof D&&(p[0].operation!=="get"||n.asGet)&&r(p,...v);for(let b of p)w(b);return}return O(p),h?r(p,...v):w(p)},c)}(i,t.slice(0),{...n,level:0},o)}function De(i,t,e,r={}){let n=et(i,!r.level);if(I(arguments[1])&&([,e,r={}]=arguments,t=1/0),!I(e))throw new Error(`Handler must be a function; "${Tt(e)}" given!`);if(t instanceof Zt||t instanceof bt)return Ne(n,t,De,e,r);if(r={...r,descripted:!0},delete r.live,!M(n))return r.probe&<(n,t,e,r)||void 0;let o=_r(n,t,e,r);return r.probe?lt(n,t,o,r):o()}function yi(i,t,e={}){let r=et(i);return T(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),ct.getInstance(r,!0,e.namespace).addRegistration({traps:t,params:e})}function ue(i,t,e=n=>n,r={}){return K(i,"getOwnPropertyDescriptor",{key:t},e,r)}function wi(i,t,e=n=>n,r={}){return K(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Te(i,t=r=>r,e={}){return K(i,"getPrototypeOf",{},t,e)}function Ie(i,t=r=>r,e={}){return K(i,"isExtensible",{},t,e)}function Me(i,t=r=>r,e={}){return K(i,"ownKeys",{},t,e)}function fe(i,t,e=n=>n,r={}){return K(i,"has",{key:t},e,r)}function lt(i,t,e=n=>n,r={}){let n,o=et(i,!r.level);return T(e)?[r,e]=[e,a=>a]:r.live&&(n=!0),t instanceof Zt||t instanceof bt?Ne(o,t,lt,e,{...r,asGet:!0}):vi(o,t,a=>{let s=[...a];return function u(c,l,f){if(!l.length)return f(c);let d=l.shift();if(!["string","number","symbol"].includes(typeof d))throw new Error(`Property name/key ${d} invalid.`);function h(O,g=void 0){let w=m=>(O.value=m,u([...c,r.live||r.descripted?O:m],l,f));if(arguments.length>1)return w(g);if(!M(o))return w(o?.[O.key]);let b=R(o,"accessorizedProps",!1),y=b&&b.get(O.key);if(y&&y.intact())return w(y.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let m=Object.getOwnPropertyDescriptor(o,O.key);return w(m)}return w(Reflect.get(o,O.key))}let p=new D(o,{type:"get",key:d,value:void 0,operation:"get",related:s});if(!M(o))return h(p);let v=ct.getInstance(o,!1,r.namespace);return v?v.emit(p,h):h(p)}([],a.slice(0),u=>{let c=Kt(t)?u:u[0];return n&&M(o)?_r(o,t,e,r,i.key)(c):e(c)})},r)}function Le(i,t,e={}){let r=et(i);return at.getInstance(r,!0,e.namespace).batch(t,e)}function bi(i,t,e={}){t=et(t),i=et(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Object.keys(e.spread?[...i]:i).map(c=>isNaN(c)?c:parseInt(c)),a=r.length?r.filter(c=>o.includes(c)):o.filter(c=>!n.includes(c)),s=c=>!Array.isArray(t)||isNaN(c)?c:c-n.filter(l=>l<c).length,u=c=>{let l=ue(i,c,e);"value"in l&&l.writable&&l.enumerable&&l.configurable?wt(t,s(c),l.value,e):(l.enumerable||e.onlyEnumerable===!1)&&Jt(t,c,{...l,configurable:!0},e)};return Le(t,()=>{a.forEach(u)}),De(i,c=>{c.filter(l=>r.length?r.includes(l.key):!n.includes(l.key)).forEach(l=>{if(l.type==="delete")return Yt(t,s(l.key),e);if(l.type==="def"){(l.value.enumerable||e.onlyEnumerable===!1)&&Jt(t,s(l.key),{...l.value,configurable:!0},e);return}u(l.key)})},{...e,withPropertyDescriptors:!0})}function wt(i,t,e,r=a=>a,n={},o=!1){let a=et(i),s=[[t,e]];T(t)&&([,,r=c=>c,n={},o=!1]=arguments,s=Object.entries(t)),T(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,c=>c]);let u=s.map(([c])=>c);return function c(l,f,d){if(!f.length)return d(l);let[h,p]=f.shift();function v(g,w=void 0){let b=_=>(g.status=_,c(l.concat(g),f,d));if(arguments.length>1)return b(g,w);let y=R(a,"accessorizedProps",!1),m=y&&y.get(g.key);return g.type==="def"?(m&&!m.restore()&&b(!1),Object.defineProperty(a,g.key,g.value),b(!0)):m&&m.intact()?b(m.setValue(g.value)):b(Reflect.set(a,g.key,g.value))}function O(g,w){if(n.diff&&p===w)return c(l,f,d);let b=new D(a,{type:o?"def":"set",key:h,value:p,isUpdate:g,oldValue:w,related:[...u],operation:o?"defineProperty":"set",detail:n.detail}),y=ct.getInstance(a,!1,n.namespace);return y?y.emit(b,v):v(b)}return fe(a,h,g=>{if(!g)return O(g);if(h==="length"&&Array.isArray(a)&&R(a).has("$length"))return O(!0,R(a).get("$length"));let w={...n,withPropertyDescriptors:o};return lt(a,h,b=>O(g,b),w)},n)}([],s.slice(0),c=>{let l=at.getInstance(a,!1,n.namespace);return l&&l.emit(c,{eventsArePropertyDescriptors:!!o}),r(Kt(t)?c.map(f=>f.status):c[0]?.status)})}function Jt(i,t,e,r=o=>o,n={}){return wt(i,t,e,r,n,!0)}function xi(i,t,e=n=>n,r={}){return wt(i,t,e,r,!0)}function Yt(i,t,e=n=>n,r={}){let n=et(i);T(e)&&([r,e]=[e,s=>s]);let o=j(t,!1),a=[...o];return function s(u,c,l){if(!c.length)return l(u);let f=c.shift();function d(p,v=void 0){let O=b=>(p.status=b,s(u.concat(p),c,l));if(arguments.length>1)return O(p,v);let g=R(n,"accessorizedProps",!1),w=g&&g.get(p.key);return w&&!w.restore()&&O(!1),O(Reflect.deleteProperty(n,p.key))}function h(p){let v=new D(n,{type:"delete",key:f,oldValue:p,related:[...a],operation:"deleteProperty",detail:r.detail}),O=ct.getInstance(n,!1,r.namespace);return O?O.emit(v,d):d(v)}return lt(n,f,h,r)}([],o.slice(0),s=>{let u=at.getInstance(n,!1,r.namespace);return u&&u.emit(s),e(Kt(t)?s.map(c=>c.status):s[0].status)})}function _i(i,t,e=n=>n,r={}){return Yt(...arguments)}function qe(i,t,e=null,r=o=>o,n={}){return K(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function ke(i,t,e,r=o=>o,n={}){let o=Xt(t),a;if(Array.isArray(t)){if(n.arrayMethodName){let s=new D(o,{operation:n.arrayMethodName,argumentsList:e});at.getInstance(o,!1,n.namespace)?.emit([s],{eventIsArrayMethodDescriptor:!0})}R(o).set("$length",o.length),a=Le(o,()=>K(i,"apply",{thisArgument:t,argumentsList:e},r,n),n),R(o).delete("$length")}else a=K(i,"apply",{thisArgument:o,argumentsList:e},r,n);return a}function Re(i,t,e=n=>n,r={}){return K(i,"setPrototypeOf",{proto:t},e,r)}function je(i,t=r=>r,e={}){return K(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());let o={...r,signal:n.signal},a=at.getInstance(i,!0,o.namespace),s=new Map;return function u(c=[],l=null){let f,d,h;if(Kt(t)){if(l){h=!0,d=l;for(let p of c)s.get(p.key)?.remove(),s.delete(p.key)}else d=a.addRegistration(t,u,o);f={signal:d.signal,childRegistrations:s}}else l?.remove(),d=a.addRegistration(t,u,o),f={signal:d.signal};if(o.childRegistrations&&o.keyInParent&&o.childRegistrations.set(o.keyInParent,d),arguments.length){let p=e(c,f);if(arguments.length>1)return p}return n}}function K(i,t,e={},r=o=>o,n={}){i=et(i),T(r)&&([n,r]=[r,u=>u]);function o(u,c){return arguments.length>1?r(c):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let a=new D(i,{operation:t,...e}),s=ct.getInstance(i,!1,n.namespace);return s?s.emit(a,o):o(a)}function Kt(i){return i===1/0||Array.isArray(i)}function et(i,t=!0,e=!0){if((!i||!M(i))&&t)throw new Error(`Object must be of type object or array! "${Tt(i)}" given.`);return i instanceof D&&(i.type==="def"&&e?i=typeof i.value.get=="function"?i.value.get():i.value.value:i=i.value),i&&Xt(i)}function vi(i,t,e,r={}){return t===1/0?r.level&&!M(i)?e([]):e(Object.keys(i)):e(j(t,!1))}var Oi={...He,...Ce},P=Oi;var Fe=(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),We=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 kt(...i){let t,e={runtimeParams:$i,compilerParams:Ai,parserParams:Si};for(;t=i.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...a}={},parserParams:s={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...a},parserParams:{...e.parserParams,...s}},i.devMode}return e}var Si={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Ai={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},$i={apiVersion:3};var te=Object.create(null);var xt=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 _t=class extends xt{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 _t(this,e,e==="object"?t:We(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||!We(this.state))&&(this.mutationsWatch=P.observe(this.state,e=>{let r={map:new Map,add(o,a){for(let s of o)s.spec.beforeSchedule?.(a)!==!1&&(this.map.has(s.runtime)||this.map.set(s.runtime,new Set),this.map.get(s.runtime).add(s))}};for(let o of e){let a=this.signals.get(o.key);!a||(r.add(a.subscribers,o),a.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,a)=>o.$serial>a.$serial?-1:1):r.map;for(let[o,a]of n)o.state!=="aborted"&&o.schedule(...a)},{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 _t{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var rt=class extends xt{state;constructor(t,e,r,n,o,a){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,a&&(this.closure=a),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,a)=>n&&o<=r.path[a],!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=>Fe(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,a=e.map(l=>l!==-1&&this.extractSource(l,!0)).filter(l=>l);a.push({source:this.runtime.$params.originalSource});let s=globalThis[t.name],u=new(s||Error)(o,{cause:a}),c=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw c&&(u.fileName=c),r&&(u.code=r),u}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?(...s)=>{try{return r(...s)}catch(u){throw new Error(`Cannot declare ${t}; ${u.message}`)}}:r,a=(s,u)=>{let c=u.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 l=c.symbols.get(t);if(l&&(l.kind!==n.kind||n.kind==="let"&&l.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);l?.reader?.abort(),l={serial:e,kind:n.kind};let f=s;return n.restOf&&(n.type==="array"?f=[]:f={},l.reader=P.map(s,f,{except:n.restOf,spread:n.type==="array"}),u.once(l.reader)),c.symbols.set(t,l),P.set(c.state,t,f),f};return this.autorun(n.kind,{complete:a,...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 a=P.get(n.state,t),s=r.restOf?(...u)=>{try{return e(...u)}catch(c){throw new Error(`Cannot update ${t}; ${c.message}`)}}:e;return Fe(s,void 0,a,(u,c)=>{if(c)return this.throw(c,[this.serial]);o?.reader?.abort();let l=u;return r.restOf&&(o=o||{},r.type==="array"?l=[]:l={},o.reader=P.map(u,l,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),P.set(n.state,t,l),["postinc","postdec"].includes(r.kind)?a:l})}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 a=o.symbols.get(t)?.kind,s=o.signal(t,a);return n.typed&&this.typed(n.typed,s.state,t),this.autobind(s,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",a=this===this.runtime,s=this.state==="aborted",u=this.spec.static,c=this;return function l(f,d){if(n&&!u&&!o&&!a&&!s&&f.subscribe(c),!d||!f.state||typeof f.state!="object"){let p=f.state;return typeof f.state=="function"&&!/^class\s?/.test(Function.prototype.toString.call(f.state))&&(p=P.proxy(f.state,{membrane:f})),p}let h;return P.proxy(f.state,{},p=>({...p,get(v,O,g=null){return h?p.get(v,O,g):(h=!0,l(f.signal(O),d-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},a=rt,s=this.scope;if(t==="iteration"){let c=this.runtime.constructor;a=r.constructor.name==="AsyncFunction"?c.AutoAsyncIterator:c.AutoIterator}["block","switch","iteration"].includes(t)&&(s=new B(s,t));let u=new a(this,t,o,n,s,r);if(t==="downstream"){if(this.downstream=u,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return u.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(a=!1){if(a&&t==="QuantumFunction")return Function.prototype.toString.call(n);let s=o.runtime.extractSource(r);return s.startsWith("static ")?s.replace("static ",""):s}}),n}class(t,e,r){return t==="Declaration"&&P.set(this.scope.state,e.name,e),r.forEach(({name:n,isQuantumFunction:o,static:a,serial:s})=>{this.function(o&&"QuantumFunction"||"RegularFunction","Expression",s,a?e[n]:e.prototype[n])}),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 vt=class extends rt{rounds=new Map;constructor(t,e,r,n,o,a){r.$closure=a,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((u,c)=>{o.symbols.set(c,u)});let a=new rt(this,"round",r,this.serial,o,this.spec.$closure),s=this.spec.kind==="for-in"?t:e;return this.rounds.set(s,a),this.lastRound&&(this.lastRound.nextRound=a,a.prevRound=this.lastRound),this.lastRound=a,a}watchMode(){if(this.spec.static)return;let t=(e,r)=>{let n=new Set,o=new Set;for(let a of e){if(Array.isArray(this.iteratee)&&a.key==="length")continue;let s=this.spec.kind==="for-in"?a.key:a.value,u=this.spec.kind==="for-in"?a.key:parseInt(a.key),c=this.rounds.get(u);if(c)P.set(c.scope.state,this.production,s),a.type==="delete"&&(this.rounds.set(u,void 0),c.prevRound&&(c.prevRound.nextRound=c.nextRound),c.nextRound&&(c.nextRound.prevRound=c.prevRound),n.add(c));else if(a.type!=="delete"&&!a.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(s)}}this.runtime.on("reflection",()=>{n.forEach(a=>a.abort(!0))},{once:!0}),o.size&&(this.iterator=function*(a){yield*a,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 vt{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 Ot=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 St=class extends rt{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){let{$serial:a=0,spec:s,...u}=r;super(t,e,s,-1,n,o),this.$serial=a,this.$params=u,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],[a]]=this.locations[t],s=this.$params.originalSource.slice(r,a);return e?{expr:s,line:n,column:o}:s}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 a;for(let s of this.queue){if(o&&o.order(s)!==o||["aborted","running"].includes(s.state)||this.iThread[0]?.contains(s)){this.queue.delete(s);continue}a=a?a.order(s):s,o||(o=a)}return a?(a.abort(),a.execute(s=>(this.queue.delete(a),r.call(this,s,a)))):(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 Ot(this):this.flowControl.get("return")?.arg;return t?t(n,this):n})}spawn(t,e,r,n=null){let o=this.nowRunning||n||this,a={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:n},s=new B(o.scope,"function",{this:e});return new this.constructor(o,"function",a,s,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,n=a=>{if(r.forExport||r.isDynamic)return a;this.assignModules(t,this.scope.state,a,e.serial)};if(this.$params.experimentalFeatures!==!1&&te[r.source])return n(te[r.source]);let o=(async()=>{let a=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return n({...await import(r.source)})}catch(s){s.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${a?` imported at "${a}"`:""}.`),[r.serial],s.code):this.throw(s,[r.serial],s.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=[],a=["QuantumProgram","QuantumFunction"].includes(this.$params.executionMode);for(let[s,u,c]of t){if(s==="*"&&c){(a?P:Reflect).set(e,c,r);continue}P.has(r,s)||this.throw(new Error(`The requested module does not provide an export named "${s}".`),[u,n]),(a?P:Reflect).set(e,c||s,P.get(r,s)),o.push([s,u,c])}!o.length||!a||this.once(P.observe(r,s=>{for(let[u,,c]of o)for(let l of s)u==="*"?P.set(e,l.key,l.value):l.key===u&&P.set(e,c||u,l.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(St,"AutoAsyncIterator",ee),W(St,"AutoIterator",vt);function de(i,t,e,r){let{env:n,functionParams:o=[],exportNamespace:a,fileName:s}=r,{parserParams:u,compilerParams:c,runtimeParams:l}=kt(r),f=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,d=["async-script","module"].includes(i);if(i==="module")u.sourceType=i,u.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(i)){let p=" "+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)),Bt=(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)},Ct=(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:()=>jt,Observer:()=>P,QuantumAsyncFunction:()=>Pi,QuantumAsyncScript:()=>Ti,QuantumFunction:()=>Ei,QuantumModule:()=>re,QuantumScript:()=>Ci,State:()=>Ot});var Fe={};_e(Fe,{any:()=>gi,apply:()=>Re,batch:()=>He,construct:()=>ke,defineProperties:()=>xi,defineProperty:()=>Jt,deleteProperties:()=>_i,deleteProperty:()=>Yt,get:()=>lt,getOwnPropertyDescriptor:()=>ue,getOwnPropertyDescriptors:()=>wi,getPrototypeOf:()=>Ie,has:()=>fe,intercept:()=>yi,isExtensible:()=>Me,map:()=>bi,observe:()=>Le,ownKeys:()=>qe,path:()=>hi,preventExtensions:()=>Ne,reduce:()=>De,set:()=>wt,setPrototypeOf:()=>je,subtree:()=>mi});function T(i){return!Array.isArray(i)&&typeof i=="object"&&i}function Tt(i){return typeof i}function E(i){return Array.isArray(i)}function It(i){return typeof i=="function"}function Vt(i){return i===null||i===""}function st(i){return arguments.length&&(i===void 0||typeof i>"u")}function M(i){return Array.isArray(i)||typeof i=="object"&&i||It(i)}function ve(i){return Vt(i)||st(i)||i===!1||i===0||M(i)&&!Object.keys(i).length}function I(i){return It(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 Mt(i){return i instanceof String||typeof i=="string"&&i!==null}function Oe(i){return!Mt(i)&&!st(i.length)}function ae(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function Se(r,t){t=t||Object.prototype,t=t&&!E(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 Ae(i,t){var e=[];return Se(i,t).forEach(r=>{ae(e,...Object.getOwnPropertyNames(r))}),e}function tt(i,t,e=!1,r=!1,n=!1){var o=0,a=i.shift();if((X(a)||a===!0||a===!1)&&(o=a,a=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((s,u)=>{!M(s)&&!I(s)||(e?Ae(s):Object.keys(s)).forEach(c=>{if(!!t(c,a,s,u)){var l=a[c],f=s[c];if((E(l)&&E(f)||T(l)&&T(f))&&(o===!0||o>0))a[c]=E(l)&&E(f)?[]:{},tt([X(o)?o-1:o,a[c],l,f],t,e,r,n);else if(E(a)&&E(s))r?a[c]=f:a.push(f);else try{n?Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(s,c)):a[c]=s[c]}catch{}}})}),a}function Ut(...i){return tt(i,(t,e,r)=>!0,!1,!1,!1)}function V(i,...t){if(!i||!["object","function"].includes(typeof i))throw new Error("Argument #1 must be of type object");let e=i[Symbol.for("wq")];if(e||(e=new ce,Object.defineProperty(i,Symbol.for("wq"),{value:e,enumerable:!1,configurable:!1,writable:!1})),!t.length)return e;let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new ce,n.set(r,e));return e}var ce=class extends Map{};function j(i,t=!0){return E(i)?i:!t&&T(i)?[i]:i!==!1&&i!==0&&ve(i)?[]:Oe(i)?Array.prototype.slice.call(i):T(i)?Object.values(i):[i]}var R=(i,...t)=>V(i,"observerAPI",...t),qt=(i,t)=>i instanceof Promise?i.then(t):t(i),le={};var yt=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 yt{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=j(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 qt(n,o=>{let a=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&a?.length?this.emit.currentRegistration.fire(a):o})}};var J=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; "${Tt(e)}" given!`);let o=this;return n&&R(J,"namespaces").has(t+"-"+n)&&(o=R(J,"namespaces").get(t+"-"+n),t+="-"+n),!R(e,"registry").has(t)&&r&&R(e,"registry").set(t,new o(e)),R(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return R(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}.`);R(J,"namespaces").set(t,r),r.__namespace=e}};var D=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 at=class extends J{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,{eventsArePropertyDescriptors:e=!1,eventIsArrayMethodDescriptor:r=!1}={}){if(this.batches.length){let n=this.batches[0].params.arrayMethodName;this.batches[0].snapshots.push({events:[...t],arrayMethodName:n,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r});return}this.$emit(this.entries,[{events:t,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r}])}$emit(t,e){let r=0,n=0,o=0;for(let l of t)r+=1,l.params.withPropertyDescriptors&&(n+=1),l.params.withArrayMethodDescriptors&&(o+=1);let a=[],s=[],u=[],c=[];for(let l of e){let f=l.arrayMethodName,d=l.eventsArePropertyDescriptors,h=l.eventIsArrayMethodDescriptor;for(let p of l.events)if(f&&(p.operation=f),n&&(o&&a.push(p),h||o!==r&&s.push(p)),n!==r){let v=p;if(d){let{target:O,type:g,...w}=p;v=new D(O,{type:"set",...w}),Object.defineProperty(v,"value","get"in w.value?{get:()=>w.value.get()}:{value:w.value.value}),w.oldValue&&Object.defineProperty(v,"oldValue","get"in w.oldValue?{get:()=>w.oldValue.get()}:{value:w.oldValue.value})}o&&u.push(v),h||o!==r&&c.push(v)}}for(let l of t)l.params.withPropertyDescriptors?l.params.withArrayMethodDescriptors?a.length&&l.fire(a):s.length&&l.fire(s):l.params.withArrayMethodDescriptors?u.length&&l.fire(u):c.length&&l.fire(c)}batch(t,e={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:e});let r=t();return qt(r,n=>{let o=this.batches.shift();return o.snapshots.length&&this.$emit(o.entries,o.snapshots),n})}};var Qt=class extends yt{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 ct=class extends J{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,...a){let s=r.entries[o];return s?s.exec(t,(...u)=>n(o+1,...u),...a):e?e(t,...a):a[0]}(0)}};var Te={};_e(Te,{accessorize:()=>di,proxy:()=>Pe,unaccessorize:()=>pi,unproxy:()=>Xt});var xr=Symbol("wqOriginal");function di(i,t,e={}){i=Ce(i);let r=R(i,"accessorizedProps");function n(u){let c,l=i;do c=Object.getOwnPropertyDescriptor(l,u);while(!c&&(l=Object.getPrototypeOf(l)));return c?{proto:l,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(u){if(r.has(u+""))return!0;let c=n(u);c.getValue=function(d=!1){return d?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(d,h=!1){if(this.dirty=!0,h){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,u);return d?.get===f.get&&d?.set===f.set&&r.get(u+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[u]:Object.defineProperty(i,u,this.descriptor),r.delete(u+""),!0):!1},r.set(isNaN(u)?u:parseInt(u),c);let{enumerable:l=!0}=c.descriptor,f={enumerable:l,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(f.set=function(d){return wt(this,u,d,e)}),("value"in c.descriptor||c.descriptor.get)&&(f.get=function(){return lt(this,u,e)});try{return Object.defineProperty(i,u,f),!0}catch{return r.delete(u+""),!1}}let s=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(o);return t===void 0||Array.isArray(t)?s:s[0]}function pi(i,t,e={}){i=Ce(i);let r=R(i,"accessorizedProps");function n(s){return r.has(s+"")?r.get(s+"").restore():!0}let a=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(n);return t===void 0||Array.isArray(t)?a:a[0]}function Pe(i,t={},e=void 0){let r=Ce(i);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&R(r,"membraneRef").has(t.membrane))return R(r,"membraneRef").get(t.membrane);let n={apply:(s,u,c)=>Re(s,u,c,void 0,t),construct:(s,u,c=null)=>ke(s,u,c,t),defineProperty:(s,u,c)=>Jt(s,u,c,t),deleteProperty:(s,u)=>Yt(s,u,t),get:(s,u,c=null)=>{if(u===xr)return r;let l={...t,receiver:c},f=lt(s,u,l);return Array.isArray(s)&&typeof f=="function"?Pe(f,{...t,arrayMethodName:u,membrane:c},e):t.chainable&&M(f)?Pe(f,t,e):f},getOwnPropertyDescriptor:(s,u)=>ue(s,u,t),getPrototypeOf:s=>Ie(s,t),has:(s,u)=>fe(s,u,t),isExtensible:s=>Me(s,t),ownKeys:s=>qe(s,t),preventExtensions:s=>Ne(s,t),set:(s,u,c,l=null)=>wt(s,u,c,{...t,receiver:l}),setPrototypeOf:(s,u)=>je(s,u,t)},o=e?.(n)||n,a=new Proxy(r,o);return t.membrane&&R(r,"membraneRef").set(t.membrane,a),a}function Xt(i){return i&&i[xr]||i}function Ce(i){if(!i||!M(i))throw new Error("Target must be of type object!");return Xt(i)}var Zt=class extends Array{};function hi(...i){return new Zt(...i)}var bt=class extends Array{};function mi(){return new bt}function gi(){return 1/0}function De(i,t,e,r=o=>o,n={}){let o=t instanceof bt;if(!(!o&&!t?.length))return function a(s,u,c,l){let f=l||u[c.level]instanceof bt,d=f?1/0:u[c.level],h=f?!1:c.level===u.length-1;return s instanceof D&&s.operation!=="get"?c={...c,probe:"always"}:c.probe!=="always"&&(c={...c,probe:!h}),e(s,d,(p,...v)=>{let O=b=>{b instanceof D&&(b.path="key"in b?[b.key]:[],s instanceof D&&(b.path="key"in b?s.path.concat(b.key):s.path.slice(0),Object.defineProperty(b,"context",{get:()=>s,configurable:!0})))},g=v[0]||{},w=b=>{if(b instanceof D&&"argumentsList"in b)return;let y=et(b,!1);return qt(y,m=>(b instanceof D?b.value=m:b=m,a(b,u,{...c,...g,keyInParent:b.key,level:c.level+1},f)))};if(Kt(d)&&Array.isArray(p)){if(p.forEach(O),h)return r(p,...v);f&&p[0]instanceof D&&(p[0].operation!=="get"||n.asGet)&&r(p,...v);for(let b of p)w(b);return}return O(p),h?r(p,...v):w(p)},c)}(i,t.slice(0),{...n,level:0},o)}function Le(i,t,e,r={}){let n=et(i,!r.level);if(I(arguments[1])&&([,e,r={}]=arguments,t=1/0),!I(e))throw new Error(`Handler must be a function; "${Tt(e)}" given!`);if(t instanceof Zt||t instanceof bt)return De(n,t,Le,e,r);if(r={...r,descripted:!0},delete r.live,!M(n))return r.probe&<(n,t,e,r)||void 0;let o=_r(n,t,e,r);return r.probe?lt(n,t,o,r):o()}function yi(i,t,e={}){let r=et(i);return T(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),ct.getInstance(r,!0,e.namespace).addRegistration({traps:t,params:e})}function ue(i,t,e=n=>n,r={}){return K(i,"getOwnPropertyDescriptor",{key:t},e,r)}function wi(i,t,e=n=>n,r={}){return K(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Ie(i,t=r=>r,e={}){return K(i,"getPrototypeOf",{},t,e)}function Me(i,t=r=>r,e={}){return K(i,"isExtensible",{},t,e)}function qe(i,t=r=>r,e={}){return K(i,"ownKeys",{},t,e)}function fe(i,t,e=n=>n,r={}){return K(i,"has",{key:t},e,r)}function lt(i,t,e=n=>n,r={}){let n,o=et(i,!r.level);return T(e)?[r,e]=[e,a=>a]:r.live&&(n=!0),t instanceof Zt||t instanceof bt?De(o,t,lt,e,{...r,asGet:!0}):vi(o,t,a=>{let s=[...a];return function u(c,l,f){if(!l.length)return f(c);let d=l.shift();if(!["string","number","symbol"].includes(typeof d))throw new Error(`Property name/key ${d} invalid.`);function h(O,g=void 0){let w=m=>(O.value=m,u([...c,r.live||r.descripted?O:m],l,f));if(arguments.length>1)return w(g);if(!M(o))return w(o?.[O.key]);let b=R(o,"accessorizedProps",!1),y=b&&b.get(O.key);if(y&&y.intact())return w(y.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let m=Object.getOwnPropertyDescriptor(o,O.key);return w(m)}return w(Reflect.get(o,O.key))}let p=new D(o,{type:"get",key:d,value:void 0,operation:"get",related:s});if(!M(o))return h(p);let v=ct.getInstance(o,!1,r.namespace);return v?v.emit(p,h):h(p)}([],a.slice(0),u=>{let c=Kt(t)?u:u[0];return n&&M(o)?_r(o,t,e,r,i.key)(c):e(c)})},r)}function He(i,t,e={}){let r=et(i);return at.getInstance(r,!0,e.namespace).batch(t,e)}function bi(i,t,e={}){t=et(t),i=et(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Object.keys(e.spread?[...i]:i).map(c=>isNaN(c)?c:parseInt(c)),a=r.length?r.filter(c=>o.includes(c)):o.filter(c=>!n.includes(c)),s=c=>!Array.isArray(t)||isNaN(c)?c:c-n.filter(l=>l<c).length,u=c=>{let l=ue(i,c,e);"value"in l&&l.writable&&l.enumerable&&l.configurable?wt(t,s(c),l.value,e):(l.enumerable||e.onlyEnumerable===!1)&&Jt(t,c,{...l,configurable:!0},e)};return He(t,()=>{a.forEach(u)}),Le(i,c=>{c.filter(l=>r.length?r.includes(l.key):!n.includes(l.key)).forEach(l=>{if(l.type==="delete")return Yt(t,s(l.key),e);if(l.type==="def"){(l.value.enumerable||e.onlyEnumerable===!1)&&Jt(t,s(l.key),{...l.value,configurable:!0},e);return}u(l.key)})},{...e,withPropertyDescriptors:!0})}function wt(i,t,e,r=a=>a,n={},o=!1){let a=et(i),s=[[t,e]];T(t)&&([,,r=c=>c,n={},o=!1]=arguments,s=Object.entries(t)),T(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,c=>c]);let u=s.map(([c])=>c);return function c(l,f,d){if(!f.length)return d(l);let[h,p]=f.shift();function v(g,w=void 0){let b=_=>(g.status=_,c(l.concat(g),f,d));if(arguments.length>1)return b(g,w);let y=R(a,"accessorizedProps",!1),m=y&&y.get(g.key);return g.type==="def"?(m&&!m.restore()&&b(!1),Object.defineProperty(a,g.key,g.value),b(!0)):m&&m.intact()?b(m.setValue(g.value)):b(Reflect.set(a,g.key,g.value))}function O(g,w){if(n.diff&&p===w)return c(l,f,d);let b=new D(a,{type:o?"def":"set",key:h,value:p,isUpdate:g,oldValue:w,related:[...u],operation:o?"defineProperty":"set",detail:n.detail}),y=ct.getInstance(a,!1,n.namespace);return y?y.emit(b,v):v(b)}return fe(a,h,g=>{if(!g)return O(g);if(h==="length"&&Array.isArray(a)&&R(a).has("$length"))return O(!0,R(a).get("$length"));let w={...n,withPropertyDescriptors:o};return lt(a,h,b=>O(g,b),w)},n)}([],s.slice(0),c=>{let l=at.getInstance(a,!1,n.namespace);return l&&l.emit(c,{eventsArePropertyDescriptors:!!o}),r(Kt(t)?c.map(f=>f.status):c[0]?.status)})}function Jt(i,t,e,r=o=>o,n={}){return wt(i,t,e,r,n,!0)}function xi(i,t,e=n=>n,r={}){return wt(i,t,e,r,!0)}function Yt(i,t,e=n=>n,r={}){let n=et(i);T(e)&&([r,e]=[e,s=>s]);let o=j(t,!1),a=[...o];return function s(u,c,l){if(!c.length)return l(u);let f=c.shift();function d(p,v=void 0){let O=b=>(p.status=b,s(u.concat(p),c,l));if(arguments.length>1)return O(p,v);let g=R(n,"accessorizedProps",!1),w=g&&g.get(p.key);return w&&!w.restore()&&O(!1),O(Reflect.deleteProperty(n,p.key))}function h(p){let v=new D(n,{type:"delete",key:f,oldValue:p,related:[...a],operation:"deleteProperty",detail:r.detail}),O=ct.getInstance(n,!1,r.namespace);return O?O.emit(v,d):d(v)}return lt(n,f,h,r)}([],o.slice(0),s=>{let u=at.getInstance(n,!1,r.namespace);return u&&u.emit(s),e(Kt(t)?s.map(c=>c.status):s[0].status)})}function _i(i,t,e=n=>n,r={}){return Yt(...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 Re(i,t,e,r=o=>o,n={}){let o=Xt(t),a;if(Array.isArray(t)){if(n.arrayMethodName){let s=new D(o,{operation:n.arrayMethodName,argumentsList:e});at.getInstance(o,!1,n.namespace)?.emit([s],{eventIsArrayMethodDescriptor:!0})}R(o).set("$length",o.length),a=He(o,()=>K(i,"apply",{thisArgument:t,argumentsList:e},r,n),n),R(o).delete("$length")}else a=K(i,"apply",{thisArgument:o,argumentsList:e},r,n);return a}function je(i,t,e=n=>n,r={}){return K(i,"setPrototypeOf",{proto:t},e,r)}function Ne(i,t=r=>r,e={}){return K(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());let o={...r,signal:n.signal},a=at.getInstance(i,!0,o.namespace),s=new Map;return function u(c=[],l=null){let f,d,h;if(Kt(t)){if(l){h=!0,d=l;for(let p of c)s.get(p.key)?.remove(),s.delete(p.key)}else d=a.addRegistration(t,u,o);f={signal:d.signal,childRegistrations:s}}else l?.remove(),d=a.addRegistration(t,u,o),f={signal:d.signal};if(o.childRegistrations&&o.keyInParent&&o.childRegistrations.set(o.keyInParent,d),arguments.length){let p=e(c,f);if(arguments.length>1)return p}return n}}function K(i,t,e={},r=o=>o,n={}){i=et(i),T(r)&&([n,r]=[r,u=>u]);function o(u,c){return arguments.length>1?r(c):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let a=new D(i,{operation:t,...e}),s=ct.getInstance(i,!1,n.namespace);return s?s.emit(a,o):o(a)}function Kt(i){return i===1/0||Array.isArray(i)}function et(i,t=!0,e=!0){if((!i||!M(i))&&t)throw new Error(`Object must be of type object or array! "${Tt(i)}" given.`);return i instanceof D&&(i.type==="def"&&e?i=typeof i.value.get=="function"?i.value.get():i.value.value:i=i.value),i&&Xt(i)}function vi(i,t,e,r={}){return t===1/0?r.level&&!M(i)?e([]):e(Object.keys(i)):e(j(t,!1))}var Oi={...Fe,...Te},P=Oi;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),Be=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 kt(...i){let t,e={runtimeParams:$i,compilerParams:Ai,parserParams:Si};for(;t=i.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...a}={},parserParams:s={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...a},parserParams:{...e.parserParams,...s}},i.devMode}return e}var Si={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Ai={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},$i={apiVersion:3};var te=Object.create(null);var xt=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 _t=class extends xt{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 _t(this,e,e==="object"?t:Be(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||!Be(this.state))&&(this.mutationsWatch=P.observe(this.state,e=>{let r={map:new Map,add(o,a){for(let s of o)s.spec.beforeSchedule?.(a)!==!1&&(this.map.has(s.runtime)||this.map.set(s.runtime,new Set),this.map.get(s.runtime).add(s))}};for(let o of e){let a=this.signals.get(o.key);!a||(r.add(a.subscribers,o),a.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,a)=>o.$serial>a.$serial?-1:1):r.map;for(let[o,a]of n)o.state!=="aborted"&&o.schedule(...a)},{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 _t{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var rt=class extends xt{state;constructor(t,e,r,n,o,a){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,a&&(this.closure=a),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,a)=>n&&o<=r.path[a],!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,a=e.map(l=>l!==-1&&this.extractSource(l,!0)).filter(l=>l);a.push({source:this.runtime.$params.originalSource});let s=globalThis[t.name],u=new(s||Error)(o,{cause:a}),c=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw c&&(u.fileName=c),r&&(u.code=r),u}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?(...s)=>{try{return r(...s)}catch(u){throw new Error(`Cannot declare ${t}; ${u.message}`)}}:r,a=(s,u)=>{let c=u.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 l=c.symbols.get(t);if(l&&(l.kind!==n.kind||n.kind==="let"&&l.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);l?.reader?.abort(),l={serial:e,kind:n.kind};let f=s;return n.restOf&&(n.type==="array"?f=[]:f={},l.reader=P.map(s,f,{except:n.restOf,spread:n.type==="array"}),u.once(l.reader)),c.symbols.set(t,l),P.set(c.state,t,f),f};return this.autorun(n.kind,{complete:a,...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 a=P.get(n.state,t),s=r.restOf?(...u)=>{try{return e(...u)}catch(c){throw new Error(`Cannot update ${t}; ${c.message}`)}}:e;return We(s,void 0,a,(u,c)=>{if(c)return this.throw(c,[this.serial]);o?.reader?.abort();let l=u;return r.restOf&&(o=o||{},r.type==="array"?l=[]:l={},o.reader=P.map(u,l,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),P.set(n.state,t,l),["postinc","postdec"].includes(r.kind)?a:l})}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 a=o.symbols.get(t)?.kind,s=o.signal(t,a);return n.typed&&this.typed(n.typed,s.state,t),this.autobind(s,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",a=this===this.runtime,s=this.state==="aborted",u=this.spec.static,c=this;return function l(f,d){if(n&&!u&&!o&&!a&&!s&&f.subscribe(c),!d||!f.state||typeof f.state!="object"){let p=f.state;return typeof f.state=="function"&&!/^class\s?/.test(Function.prototype.toString.call(f.state))&&(p=P.proxy(f.state,{membrane:f})),p}let h;return P.proxy(f.state,{},p=>({...p,get(v,O,g=null){return h?p.get(v,O,g):(h=!0,l(f.signal(O),d-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},a=rt,s=this.scope;if(t==="iteration"){let c=this.runtime.constructor;a=r.constructor.name==="AsyncFunction"?c.AutoAsyncIterator:c.AutoIterator}["block","switch","iteration"].includes(t)&&(s=new B(s,t));let u=new a(this,t,o,n,s,r);if(t==="downstream"){if(this.downstream=u,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return u.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(a=!1){if(a&&t==="QuantumFunction")return Function.prototype.toString.call(n);let s=o.runtime.extractSource(r);return s.startsWith("static ")?s.replace("static ",""):s}}),n}class(t,e,r){return t==="Declaration"&&P.set(this.scope.state,e.name,e),r.forEach(({name:n,isQuantumFunction:o,static:a,serial:s})=>{this.function(o&&"QuantumFunction"||"RegularFunction","Expression",s,a?e[n]:e.prototype[n])}),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 vt=class extends rt{rounds=new Map;constructor(t,e,r,n,o,a){r.$closure=a,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((u,c)=>{o.symbols.set(c,u)});let a=new rt(this,"round",r,this.serial,o,this.spec.$closure),s=this.spec.kind==="for-in"?t:e;return this.rounds.set(s,a),this.lastRound&&(this.lastRound.nextRound=a,a.prevRound=this.lastRound),this.lastRound=a,a}watchMode(){if(this.spec.static)return;let t=(e,r)=>{let n=new Set,o=new Set;for(let a of e){if(Array.isArray(this.iteratee)&&a.key==="length")continue;let s=this.spec.kind==="for-in"?a.key:a.value,u=this.spec.kind==="for-in"?a.key:parseInt(a.key),c=this.rounds.get(u);if(c)P.set(c.scope.state,this.production,s),a.type==="delete"&&(this.rounds.set(u,void 0),c.prevRound&&(c.prevRound.nextRound=c.nextRound),c.nextRound&&(c.nextRound.prevRound=c.prevRound),n.add(c));else if(a.type!=="delete"&&!a.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(s)}}this.runtime.on("reflection",()=>{n.forEach(a=>a.abort(!0))},{once:!0}),o.size&&(this.iterator=function*(a){yield*a,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 vt{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 Ot=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 St=class extends rt{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){let{$serial:a=0,spec:s,...u}=r;super(t,e,s,-1,n,o),this.$serial=a,this.$params=u,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],[a]]=this.locations[t],s=this.$params.originalSource.slice(r,a);return e?{expr:s,line:n,column:o}:s}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 a;for(let s of this.queue){if(o&&o.order(s)!==o||["aborted","running"].includes(s.state)||this.iThread[0]?.contains(s)){this.queue.delete(s);continue}a=a?a.order(s):s,o||(o=a)}return a?(a.abort(),a.execute(s=>(this.queue.delete(a),r.call(this,s,a)))):(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 Ot(this):this.flowControl.get("return")?.arg;return t?t(n,this):n})}spawn(t,e,r,n=null){let o=this.nowRunning||n||this,a={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:n},s=new B(o.scope,"function",{this:e});return new this.constructor(o,"function",a,s,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,n=a=>{if(r.forExport||r.isDynamic)return a;this.assignModules(t,this.scope.state,a,e.serial)};if(this.$params.experimentalFeatures!==!1&&te[r.source])return n(te[r.source]);let o=(async()=>{let a=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return n({...await import(r.source)})}catch(s){s.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${a?` imported at "${a}"`:""}.`),[r.serial],s.code):this.throw(s,[r.serial],s.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=[],a=["QuantumProgram","QuantumFunction"].includes(this.$params.executionMode);for(let[s,u,c]of t){if(s==="*"&&c){(a?P:Reflect).set(e,c,r);continue}P.has(r,s)||this.throw(new Error(`The requested module does not provide an export named "${s}".`),[u,n]),(a?P:Reflect).set(e,c||s,P.get(r,s)),o.push([s,u,c])}!o.length||!a||this.once(P.observe(r,s=>{for(let[u,,c]of o)for(let l of s)u==="*"?P.set(e,l.key,l.value):l.key===u&&P.set(e,c||u,l.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(St,"AutoAsyncIterator",ee),W(St,"AutoIterator",vt);function de(i,t,e,r){let{env:n,functionParams:o=[],exportNamespace:a,fileName:s}=r,{parserParams:u,compilerParams:c,runtimeParams:l}=kt(r),f=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,d=["async-script","module"].includes(i);if(i==="module")u.sourceType=i,u.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(i)){let p=" "+e.split(`
|
|
2
2
|
`).join(`
|
|
3
3
|
`);e=`return ${i==="async-function"?"async ":""}function**(${o.join(", ")}) {
|
|
4
4
|
${p}
|
|
5
|
-
}`,u.executionMode="RegularProgram"}else if(!["script","async-script"].includes(i))throw new Error(`Unrecognized sourceType specified: "${i}".`);c.sourceType=i,u.inBrowser=f,c.base64=d&&f&&"export default async function(%0) {%1}";let h=t(e,{parserParams:u,compilerParams:c});if(h 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 l.sourceType=i,l.inBrowser=f,l.exportNamespace=a,l.fileName=s,G(h,p=>{let v=["function","async-function"].includes(i);return G(((g,w)=>{if(l.compileFunction)return l.compileFunction(w.toString(),[g]);if(c.base64){let b=`data:text/javascript;base64,${w.toString("base64")}`;return(()=>import(b).then(m=>m.default))()}return new(d?async function(){}.constructor:Function)(g,w.toString())})(p.identifier+"",p),g=>{let w=(b,y=n)=>{let m=g;b&&(m=m.bind(b));let _="global",x=new B(void 0,_,globalThis);return(i.endsWith("script")||y)&&(_="env",x=new B(x,_,y)),i==="module"&&(_="module",x=new B(x,_)),typeof b<"u"&&(x=new B(x,"this",{this:b})),new St(void 0,_,{...l,originalSource:p.originalSource,executionMode:p.isQuantumProgram&&"QuantumProgram"||"RegularProgram"},x,m)};return v?w().execute():{createRuntime:w,compilation:p}})})}var Rt=class{constructor(...t){let e=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{},n=t.pop()||"";this.$program=de(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 Ei;function Sr(...i){let{source:t,params:e}=vr(i),r=de("async-function",
|
|
5
|
+
}`,u.executionMode="RegularProgram"}else if(!["script","async-script"].includes(i))throw new Error(`Unrecognized sourceType specified: "${i}".`);c.sourceType=i,u.inBrowser=f,c.base64=d&&f&&"export default async function(%0) {%1}";let h=t(e,{parserParams:u,compilerParams:c});if(h 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 l.sourceType=i,l.inBrowser=f,l.exportNamespace=a,l.fileName=s,G(h,p=>{let v=["function","async-function"].includes(i);return G(((g,w)=>{if(l.compileFunction)return l.compileFunction(w.toString(),[g]);if(c.base64){let b=`data:text/javascript;base64,${w.toString("base64")}`;return(()=>import(b).then(m=>m.default))()}return new(d?async function(){}.constructor:Function)(g,w.toString())})(p.identifier+"",p),g=>{let w=(b,y=n)=>{let m=g;b&&(m=m.bind(b));let _="global",x=new B(void 0,_,globalThis);return(i.endsWith("script")||y)&&(_="env",x=new B(x,_,y)),i==="module"&&(_="module",x=new B(x,_)),typeof b<"u"&&(x=new B(x,"this",{this:b})),new St(void 0,_,{...l,originalSource:p.originalSource,executionMode:p.isQuantumProgram&&"QuantumProgram"||"RegularProgram"},x,m)};return v?w().execute():{createRuntime:w,compilation:p}})})}var Rt=class{constructor(...t){let e=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{},n=t.pop()||"";this.$program=de(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 Ei;function Sr(...i){let{source:t,params:e}=vr(i),r=de("async-function",Ve,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 Pi=Sr,Ci,jt=class extends Rt{};W(jt,"sourceType","async-script"),W(jt,"parseCompileCallback",Ve);var Ti=jt,re=class extends Rt{};W(re,"sourceType","module"),W(re,"parseCompileCallback",Ve);function Ve(...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,7 +13,7 @@ ${p}
|
|
|
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{...a}=o.data;Object.defineProperty(a,"toString",{value:s=>s==="base64"?a.compiledSourceBase64:a.compiledSource}),r(a)}})}function ie(i,t,e={},r={}){t=j(t).slice();for(var n=i;!st(n)&&!Vt(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 ze(i,t,e,r={},n={}){let o=(l,f,d)=>n.set?n.set(l,f,d):(X(t[s])&&E(l)?l.push(d):l[f]=d,!0);t=j(t);for(var a=i,s=0;s<t.length;s++)if(s<t.length-1){if(!a||!M(a)&&!I(a))return!1;var u=ie(a,t[s],n);if(!M(u)){if(n.buildTree===!1)return!1;u=I(n.buildTree)?n.buildTree(s):X(t[s+1])?[]:{};var c=o(a,t[s],u);if(!c)return!1}a=u}else return o(a,t[s],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=a=>{a!==void 0&&this.onwrite(()=>{let s=e(a,r),u=c=>{c!==void 0&&this.cycle(t,e,c)};s instanceof Promise?s.then(u):u(s)})};n instanceof Promise?n.then(o):o(n)})}};function Ar(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Nt(i,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(a=>(a+"").replace("(",r?"(.//":"(./")).join("|");let n=[],o;try{let a=i.document.evaluate(e,t,null,i.XPathResult.ANY_TYPE);for(;o=a.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 oe(i,t,e,r=!1,n=null){let o=n?.get(t)?.get(e);if(typeof o<"u")return o;let a=c=>(n?.has(t)||n?.set(t,new WeakMap),n?.get(t)?.set(e,c),c),s=t.getRootNode(),u=e.getRootNode();return s===u?a(t.contains(e)):r&&u instanceof i.ShadowRoot?a(oe(i,t,u.host,r,n)):a(!1)}function Er(i,t="|"){return[...i].reduce(([e,r,n,o],a)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(a)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(a)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(a)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(a)&&!n[0].endsWith("\\")&&(e=e===a?null:e||a),n[0]+=a,[e,r,n]),[null,0,[""]])[2].reverse()}var Y=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Ar(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Er(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var At=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 Y)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[j(t[0],!1),void 0,t[1]]:t[0]=j(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof Y)&&!(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 Y?e:new Y(e)),t}registry(...t){return V(this.window,"realdom",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,a=new WeakMap;for(let[s,u]of this.registry(t)){let c=[].concat(e).filter(f=>oe(n,s.context,f.target,s.params.subtree==="cross-roots",a));if(!c.length)continue;let l=[s,Array.isArray(e)?c:c[0]];u?o.add(l):r.call(n,...l)}for(let s of o)r.call(n,...s);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 dt=class extends At{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof Y;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,a=Ir(o,t);if(!e)return a;let s=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let u of a){let c=s?s.generate():{};e(u,c,o)}else{let u=s?.generate()||{};e(a,u,o)}if(r.live){s&&(r={...r,signalGenerator:s});let u=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,u)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof Y;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:a,webqit:s}=this;r.eventDetails&&!s.realdom.attrInterceptionHooks?.intercepting&&Cr.call(a,"intercept",()=>{});let u=new a.MutationObserver(d=>{d=Tr(d).map(h=>Mr.call(a,h)),Pr.call(a,f,d,o)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(d=>d+"")),u.observe(o,c);let l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),f={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:l,disconnectable:u};return this.disconnectables(r.signal,u,l)}observeSync(t,e,r={}){let n=typeof t=="string"||t instanceof Y;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:a}=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||Cr.call(a,s,d=>{this.forEachMatchingContext(s,d,Pr)});let u={disconnect(){f.delete(l)}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:c,disconnectable:u},f=this.registry(s);return f.set(l,!!l.params.deferred),this.disconnectables(r.signal,u,c)}};function Tr(i){return i.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName||V(e.target,"realdom","internalAttrInteractions").get(e.attributeName)?t:t.concat(e),[])}function Pr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:a,originalFilterIsString:s,signalGenerator:u}=i;if(o.subtree||(t=t.filter(d=>d.target===e)),!t.length)return;let c=r.map(d=>d+"");if(o.atomic&&!a.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 h;return o.eventDetails||({event:h,...d}=d),!o.oldValue&&"oldValue"in d&&({oldValue:h,...d}=d),!o.newValue&&"value"in d?{value:h,...d}=d:o.newValue&&typeof d.value>"u"&&(d={...d,value:he(d.target,d.name,()=>d.target.getAttribute(d.name))}),d})),o.atomic&&(t.forEach(d=>a.set(d.name,d)),t=Array.from(a.entries()).map(([,d])=>d));let l=s?t[0]:t,f=u?u.generate():{};n(l,f,e)}function he(i,t,e){let r=V(i,"realdom","internalAttrInteractions").get(t);V(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return V(i,"realdom","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(a=>a.name===o)||{target:i,name:o,value:he(i,o,()=>i.getAttribute(o)),...r})):Array.from(i.attributes).map(o=>e.find(a=>a.name===o.nodeName)||{target:i,name:o.nodeName,value:he(i,o.nodeName,()=>o.nodeValue),...r})}function Mr({target:i,attributeName:t,value:e,oldValue:r}){let a=(this.webqit.realdom.attrInterceptionRecords?.get(i)||{})[t]?.[0]||"mutation";return{target:i,name:t,value:e,oldValue:r,type:"observation",event:a}}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 a=()=>r.realdom.attrInterceptionHooks.get(i).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return a;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let s=(l,f)=>{r.realdom.attrInterceptionRecords.has(l.target)||r.realdom.attrInterceptionRecords.set(l.target,{});let d=r.realdom.attrInterceptionRecords.get(l.target);if(d[l.name]=d[l.name]||[],d[l.name].unshift(l.event),V(l.target,"realdom","internalAttrInteractions").get(l.name))return f();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(p=>p([l]));let h=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(p=>p([l])),h};new e.MutationObserver(l=>{l=l.filter(f=>!(e.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),l=Tr(l).map(f=>Mr.call(e,f)),l.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(f=>f(l)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(f=>f(l)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{c[l]=o.prototype[l],o.prototype[l]=function(...f){let d,h=he(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(l)&&(d=f[1]),l==="toggleAttribute"&&d===void 0&&(d=h===null);let p={target:this,name:f[0],value:d,oldValue:h,type:"interception",event:[this,l]};return s(p,()=>c[l].call(this,...f))}}),a}var se=class extends At{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new dt(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,a=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=>a(n).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,l]=t.reduce(([d,h],p)=>p.kind==="xpath"?[d,h.concat(p)]:[d.concat(p),h],[[],[]]),f=[];r.subtree?(c.length&&f.push(...n.querySelectorAll(c.join(","))),l.length&&f.push(...Nt(this.window,n,l))):(c.length&&f.push(...[...n.children].filter(d=>d.matches(c))),l.length&&f.push(...Nt(this.window,n,l,!1))),f.forEach(d=>a(d.parentNode||n).entrants.push(d))}}if(!e)return o;let s={disconnected:!1},u=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(s.disconnected)break;let l=u?.generate()||{};e(c,l,n)}if(r.live){u&&(r={...r,signalGenerator:u});let c=this.observe(t,e,r);return this.disconnectables(r.signal,s,c)}return this.disconnectables(r.signal,s,u)}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:a,document:s}=this;r.eventDetails&&(a.realdom.domInterceptionRecordsAlwaysOn=!0),(s.readyState==="loading"||a.realdom.domInterceptionRecordsAlwaysOn)&&!a.realdom.domInterceptionHooks?.intercepting&&Rr.call(o,"sync",()=>{});let u=new o.MutationObserver(f=>f.forEach(d=>{Ge.call(o,l,kr.call(o,d),n)}));u.observe(n,{childList:!0,subtree:r.subtree&&!0});let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:u};if(r.staticSensitivity){let f=qr.call(o,l);return this.disconnectables(r.signal,u,c,f)}return this.disconnectables(r.signal,u,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 a=r.timing==="intercept"?"intercept":"sync";this.registry(a).size||Rr.call(o,a,d=>{this.forEachMatchingContext(a,d,Ge)});let s=new o.MutationObserver(d=>d.forEach(h=>{Array.isArray((h=kr.call(o,h)).event)||Ge.call(o,l,h,n)}));s.observe(n,{childList:!0,subtree:r.subtree&&!0});let u={disconnect(){f.delete(l),s.disconnect()}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:u},f=this.registry(a);if(f.set(l,!!l.params.deferred),r.staticSensitivity){let d=qr.call(o,l);return this.disconnectables(r.signal,u,c,d)}return this.disconnectables(r.signal,u,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:a}=i,s=r.filter(h=>h.kind==="css"),u=h=>h.match(/\.([\w-]+)/g)?.length?["class"]:[],c=h=>h.match(/#([\w-]+)/g)?.length?["id"]:[],l=h=>[...h.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(p=>p[1]).concat(u(h)).concat(c(h));if(!(i.$attrs=Array.from(new Set(s.filter(h=>(h+"").includes("[")).reduce((h,p)=>h.concat(l(p+"")),[])))).length)return;let f=new Set,d=new Set;return f.push=h=>(d.delete(h),f.add(h)),d.push=h=>(f.delete(h),d.add(h)),i.$deliveryCache={entrants:f,exits:d},new dt(e,t).observe(i.$attrs,h=>{let p=new Map,v=w=>(p.has(w)||p.set(w,{target:w,entrants:[],exits:[],type:"static",event:null}),p.get(w)),O=new WeakMap,g=w=>(O.has(w)||O.set(w,s.some(b=>w.matches(b+""))),O.get(w));for(let w of h)["entrants","exits"].forEach(b=>{o.generation&&b!==o.generation||i.$deliveryCache[b].has(w.target)||(b==="entrants"?!g(w.target):g(w.target))||(i.$deliveryCache[b].push(w.target),v(w.target)[b].push(w.target),v(w.target).event=w.event)});for(let[,w]of p){let b=a?.generate()||{};n(w,b,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function Ge(i,t){let{context:e,spec:r,callback:n,params:o,signalGenerator:a,$deliveryCache:s}=i,u={...t,entrants:[],exits:[]};if(o.eventDetails||delete u.event,["entrants","exits"].forEach(l=>{if(!(o.generation&&l!==o.generation)&&(r.length?u[l]=ki.call(this,r,o.subtree==="cross-roots",t[l],t.event!=="parse"):u[l]=[...t[l]],!!s))for(let f of u[l])s[l].push(f)}),!u.entrants.length&&!u.exits.length)return;let c=a?.generate()||{};n(u,c,e)}function ki(i,t,e,r){e=Array.isArray(e)?e:[...e];let n=(o,a)=>{if(a.type==="selector"){let s=a.isXpathAttr?[]:o.filter(u=>a.kind==="xpath"?$r(this,u,a+""):u.matches&&u.matches(a+""));if((r||a.isXpathAttr)&&(s=o.reduce((u,c)=>a.kind==="xpath"?[...u,...Nt(this,c,a,r)]:c.querySelectorAll?[...u,...c.querySelectorAll(a+"")]:u,s)),s.length)return s}else if(o.includes(a.content)||r&&o.some(s=>oe(this,s,a.content,t)))return[a.content]};return e.$$searchCache||(e.$$searchCache=new Map),i.reduce((o,a)=>{let s;return e.$$searchCache.has(a.content)?s=e.$$searchCache.get(a.content):(s=n(e,a)||[],a.type==="instance"&&e.$$searchCache.set(a.content,s)),o.concat(s)},[])}function kr({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=j(t).reduce((o,a)=>o||r.webqit.realdom.domInterceptionRecords?.get(a),null),n=j(e).reduce((o,a)=>o||r.webqit.realdom.domInterceptionRecords?.get(a),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:a,Element:s,HTMLElement:u,HTMLTemplateElement:c,DocumentFragment:l}=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,w,b)=>{r.realdom.domInterceptionNoRecurse.set(g,w);let y=b();return r.realdom.domInterceptionNoRecurse.delete(g),y},h=(g,w)=>{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 b=w();return r.realdom.domInterceptionHooks.get("sync")?.forEach(y=>y(g)),b},p={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"]},v={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(p).reduce((g,w)=>g.concat(w),[])).forEach(g=>{Object.keys(p).forEach(y=>{if(!p[y].includes(g))return;let m=Object.getOwnPropertyDescriptor(e[y].prototype,g);!m||(Object.defineProperty(e[y].prototype,g,"value"in m?{...m,value:w}:{...m,set:b}),v[y][g]=m)});function w(...y){let m=Object.keys(v).find(L=>this instanceof e[L]&&g in v[L]),_=v[m],x=()=>_[g].value.call(this,...y);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return x();let $=[],A=[],C=this;["insertBefore"].includes(g)?A=[y[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?(A=[y[1]],["beforebegin","afterend"].includes(y[0])&&(C=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?($=[...this.childNodes],A=g==="replaceChildren"?[...y]:[y[0]]):["replaceWith","remove"].includes(g)?($=[this],A=g==="replaceWith"?[...y]:[],C=this.parentNode):["replaceChild"].includes(g)?($=[y[1]],A=[y[0]]):["removeChild"].includes(g)?$=[...y]:(A=[...y],["before","after"].includes(g)&&(C=this.parentNode));let k=g;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(g)){let L=this.nodeName;if(g==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(y[0])){if(!this.parentNode)return _[g].value.call(this,...y);L=this.parentNode.nodeName}let H=n.createElement(L.includes("-")?"div":L);_.setHTMLUnsafe.value.call(H,A[0],g==="setHTMLUnsafe"?y[1]:{}),A=[...H.childNodes],g==="insertAdjacentHTML"?(k="insertAdjacentElement",y[1]=new l,d(y[1],"append",()=>y[1].append(...H.childNodes))):(k="replaceChildren",y=[...H.childNodes])}return h({target:C,entrants:A,exits:$,type:"interception",event:[this,g]},()=>_[k].value.call(this,...y))}function b(y){let m=Object.keys(v).find(N=>this instanceof e[N]&&g in v[N]),_=v[m],x=()=>_[g].set.call(this,y);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return x();let $=[],A=[],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 x();N=this.parentNode.nodeName}let L=n.createElement(N.includes("-")?"div":N);if(d(L,g,()=>L[g]=y),A=this instanceof c?[...L.content.childNodes]:[...L.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let H=gt=>gt.reduce((nt,ot)=>ot instanceof HTMLScriptElement?nt.concat(ot):ot instanceof c?nt.concat(H([ot.content])):(nt=nt.concat(H([...ot.querySelectorAll?.("template")||[]].map(Zr=>Zr.content))),nt.concat(...ot.querySelectorAll?.("script")||[])),[]);for(let gt of H(A)){if(this instanceof ShadowRoot){gt.setAttribute("data-handling","manual");continue}let nt=n.createElement("script");[...gt.attributes].forEach(ot=>nt.setAttribute(ot.name,ot.value)),nt.textContent=gt.textContent,d(gt,"replaceWith",()=>gt.replaceWith(nt))}}g==="outerHTML"?(y=new l,d(y,"append",()=>y.append(...A)),x=()=>d(this,"replaceWith",()=>s.prototype.replaceWith.call(this,y))):this instanceof c?x=()=>d(this.content,"replaceChildren",()=>this.content.replaceChildren(...A)):x=()=>d(this,"replaceChildren",()=>s.prototype.replaceChildren.call(this,...A))}return h({target:C,entrants:A,exits:$,type:"interception",event:[this,g]},x)}}),f}function jr(){Ri.call(this),ji.call(this),Ni.call(this)}function Ri(){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 Ni(){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={},jr.call(i),i.webqit.realdom.meta=(...e)=>Di.call(i,...e),i.webqit.realdom.ready=(...e)=>Qe.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new se(e,i);if(r==="attr")return new dt(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 Qe(...i){let t="interactive",e;Mt(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=>Qe.call(this,"interactive",o)),complete:new Promise(o=>Qe.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 a of n.webqit.realdom.readyStateCallbacks[o].splice(0))a(n)},!1)),n.webqit.realdom.readyStateCallbacks[t].push(e)}function Di(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 a=o.split("=").map(s=>s.trim());return ze(n,a[0].split("."),a[1]==="true"?!0:a[1]==="false"?!1:X(a[1])?parseInt(a[1]):a[1]),n},{})),{get name(){return i},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}function me(i,t){return typeof i!="string"?i:i.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+(typeof t!==void 0&&t?e.substr(1).toLowerCase():e.substr(1))})}var S=(i,...t)=>V(i,"oohtml",...t),q={};function z(i,t,e){let r=this,n=Nr.call(r);q.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let a=r.webqit.oohtml.configs[o];Ut(2,a,e,t,n.meta(i).json()),r.webqitConfig.prefix&&Object.keys(a).forEach(s=>{Object.keys(a[s]).forEach(u=>{s==="api"&&typeof a[s][u]=="string"?a[s][u]=`${r.webqitConfig.prefix}${me(a[s][u])}`:["attr","elements"].includes(s)&&a[s][u]?.startsWith("data-")===!1&&(a[s][u]=`${r.webqitConfig.prefix}-${a[s][u]}`)})})}return{config:r.webqit.oohtml.configs[o],realdom:n,window:r}}function Je(i,t){return S(i,"internalAttrInteractions").get(t)}function Lr(i,t,e){let r=S(i,"internalAttrInteractions").get(t);S(i,"internalAttrInteractions").set(t,!0);let n=e();return S(i,"internalAttrInteractions").set(t,r),n}function ut(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 Fi=()=>(0|Math.random()*9e6).toString(36),Xe=new Map;function $t(i){let t;return(t=Xe.get(i))||(t=Fi(),Xe.set(i,t)),t}function ge(i){let t;return Xe.forEach((e,r)=>{e===i&&(t=r)}),t}function ye(){let{window:i}=q,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let a=n.pop();if(!a?.kind)throw new Error('"options.kind" must be specified.');let s=["contextrequest","contextclaim"],u=n.pop()||s[0];if(!s.includes(u))throw new Error(`Invalid event type. Must be one of: ${s.join(",")}`);let{kind:c,detail:l,targetContext:f,live:d,signal:h,diff:p,...v}=a;super(u,{...v,bubbles:v.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:()=>l}),Object.defineProperty(this,"live",{get:()=>d}),Object.defineProperty(this,"signal",{get:()=>h}),Object.defineProperty(this,"diff",{get:()=>p}),Object.defineProperty(this,"options",{get:()=>v}),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}}}=q;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var Pt=class extends Error{};var pt=class{static instance(t){return S(t).get("contexts::instance")||new this(t)}constructor(t){S(t).get("contexts::instance")?.dispose(),S(t).set("contexts::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e})}[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 Pt(`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(a=>typeof a=="object"&&a))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(ye())(...t);this["#"].host.dispatchEvent(o)})}};var Ye=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=q;return t}get name(){return[q.window.Document,q.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof Ye)||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}=pt.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=Ye;W(U,"kind");var Dt=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}}}=q;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(e.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(n=>n.trim()).filter(n=>n);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=e.reduce(this.namespaceObj,r,e.get,n=>{this.disposed||t.respondWith(n.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};W(Dt,"kind","namespace");function Ze(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=Dt,Wi.call(e,t),Bi.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 Ke(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,a=Hr(o),s=new RegExp(`${e?":scope|":""}#(${a.lidrefPrefix(r+1)})?([\\w]+${a.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[u,c]=ut(i,",").reduce(([f,d],h)=>{let p,v;return h=h.replace(s,(O,g,w,b,y)=>{if(p||(p=[...h.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),p.some($=>y>$.index&&y+O.length<$.index+$[0].length))return O;if(O===":scope")return v=!0,e;let m=g&&!w;if(g&&w)return`#${a.escape(O.replace("#",""),1)}`;if(m&&o.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${a.toUuid(t,b,1)}`;let x;return o.attr.lid==="id"?x=`:is(#${b},[id^="${a.lidrefPrefix(r)}"][id$="${a.lidrefSeparator(r)}${b}"])`:x=`:is(#${b},[${n.CSS.escape(o.attr.lid)}="${b}"])`,m?`:is(${x}):not(${e?e+" ":""}${o.namespaceSelector} *)`:x}),v?[f,d.concat(h)]:[f.concat(h),d]},[[],[]]),l;return e&&u.length?l=[u.length>1?`${e} :is(${u.join(", ")})`:`${e} ${u[0]}`,c.join(", ")].filter(f=>f).join(", "):l=[...u,...c].join(", "),l}function we(i){let t=this;if(!S(i).has("namespace")){let e=Object.create(null);S(i).set("namespace",e);let r=[t.Document,t.ShadowRoot].some(n=>i instanceof n);Object.defineProperty(e,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return S(i).get("namespace")}function Lt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return we.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function be(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(ge(i)||$t(i))+(t?"-root":"")}function Wi(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(we.call(t,this))}})})}function Bi(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},DOMNamingContext:o}}=t,a=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],s=["for","list","form","aria-activedescendant","aria-details","aria-errormessage"],u=[i.attr.lid,...a,...s],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"},l=Hr(i),f=(m,_,x)=>{if(!Je(m,_)&&S(m,"attrOriginals").has(_))return S(m,"attrOriginals").get(_);let $=x();return Je(m,_)?$:$&&$.split(" ").map(A=>(A=A.trim())&&(_===i.attr.lid?l.uuidToId:l.uuidToLidref).call(l,A)).join(" ")},d=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...d,value(m){return this.querySelector(`#${m}`)}});for(let m of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let _=Object.getOwnPropertyDescriptor(nodeApi.prototype,m);Object.defineProperty(nodeApi.prototype,m,{..._,value(x){return _.value.call(this,Ke.call(t,x,be(we.call(t,this))))}})}let h=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...h,value(m){let _=()=>h.value.call(this,m);return u.includes(m)&&!S(this,"lock").get(m)?f(this,m,_):_()}});let p=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...p,get(){let m=()=>p.get.call(this);return u.includes(this.name)?f(this.ownerElement,this.name,m):m()}});let v=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...v,get(){let m=()=>v.get.call(this);return this instanceof t.Attr&&u.includes(this.name)?f(this.ownerElement,this.name,m):m()}});for(let m of u){if(!(m in c))continue;let _=m==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let x of _){let $=Object.getOwnPropertyDescriptor(x.prototype,c[m]);!$||Object.defineProperty(x.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 O=(m,_,x,$)=>Lr(m,_,()=>(typeof x=="function"&&(x=x()),$(x))),g=(m,_,x,$=null)=>{O(m,_,x,A=>{let C=_===i.attr.lid,k=$||Lt.call(t,m,C),N=be(k);if(C){let L=l.uuidToId(A);if(e.get(k,L)!==m){let H=l.toUuid(N,L);H!==A&&m.setAttribute("id",H),e.set(k,L,m)}}else{S(m,"attrOriginals").set(_,A);let L=A.split(" ").map(H=>(H=H.trim())&&l.isUuid(H)?H:l.toUuid(N,H)).join(" ");m.setAttribute(_,L),S(k).set("idrefs",S(k).get("idrefs")||new Set),S(k).get("idrefs").add(m)}})},w=(m,_,x,$=null)=>{O(m,_,x,A=>{let C=_===i.attr.lid,k=$||Lt.call(t,m,C);if(C){let N=l.uuidToId(A);e.get(k,N)===m&&e.deleteProperty(k,N)}else{let N=S(m,"attrOriginals").get(_);m.hasAttribute(_)&&m.setAttribute(_,N),S(k).get("idrefs")?.delete(m)}})};r.realtime(t.document).query(i.namespaceSelector,m=>{let _=(x,$,A,C)=>{if(!x.hasAttribute($))return;let k=()=>x.getAttribute($);w(x,$,k,A),x.isConnected&&g(x,$,S(x,"attrOriginals").get($)||k,C)};m.exits.forEach(x=>{if(x.isConnected){let C=we.call(t,x);for(let k of new Set([...Object.values(C),...S(C).get("idrefs")||[]]))for(let N of u)_(k,N,C)}let $=x[n.CONTEXT_API.api.contexts],A=$.find(o.kind);A&&$.detach(A)}),m.entrants.forEach(x=>{let $,A=Lt.call(t,x,!0);for(let k of new Set([...Object.values(A),...S(A).get("idrefs")||[]]))if(($=Lt.call(t,k,!0))!==A)for(let N of u)_(k,N,A,$);let C=x[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(`[${u.map(m=>t.CSS.escape(m)).join("],[")}]`,m=>{let _={forID:new Map,forOther:new Map};for(let x of u){let $=x===i.attr.lid?_.forID:_.forOther;m.exits.forEach(A=>{if(!A.hasAttribute(x))return;let C=$.get(A);typeof C>"u"&&(C=(x===i.attr.lid?A.parentNode:A)?.closest?.(i.namespaceSelector)||A.getRootNode().host,$.set(A,C)),!(C&&!C.isConnected)&&w(A,x,()=>A.getAttribute(x))}),m.entrants.forEach(A=>{!A.hasAttribute(x)||g(A,x,()=>A.getAttribute(x))})}_.forID.clear(),_.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(u,m=>{for(let _ of m)_.oldValue&&w(_.target,_.name,_.oldValue),_.value&&g(_.target,_.name,_.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let b,y=()=>{if(!t.location.hash?.startsWith(`#${l.lidrefPrefix()}`))return;let m=t.location.hash?.substring(`#${l.lidrefPrefix()}`.length).split("/").map(x=>x.trim()).filter(x=>x)||[],_=m.reduce((x,$)=>x&&x[i.api.namespace][$],t.document);b&&i.target.className&&b.classList.toggle(i.target.className,!1),_&&_!==t.document&&(i.target.className&&_.classList.toggle(i.target.className,!0),i.target.eventName&&_.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&m.length>1&&_.scrollIntoView(),b=_)};t.addEventListener("hashchange",y),r.ready(y)}function tr({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:kt(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:zi.bind(r,e)},Vi.call(r,e),Ui.call(r,e)}function Vi(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 zi(i,t){let e=this,{realdom:r}=e.webqit,n=ge(t);if(!n)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:a,thisContext:s}=n;i.script.retention==="dispose"?o.remove():i.script.retention==="hidden"?o.textContent='"source hidden"':o.textContent=await a.toString();let u=o.scoped?s:o.getRootNode();S(u).has("scriptEnv")||S(u).set("scriptEnv",Object.create(null));let c=await(await a.bind(s,S(u).get("scriptEnv"))).execute();o.quantum&&Object.defineProperty(o,"state",{value:c}),r.realtime(e.document).observe(o,()=>{o.quantum&&c.dispose(),s instanceof e.Element&&s[i.api.scripts]?.splice(s[i.api.scripts].indexOf(o,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function Ui(i){let t=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,e=this,{webqit:{oohtml:r,realdom:n}}=e;e.HTMLScriptElement.supports||(e.HTMLScriptElement.supports=a=>["text/javascript","application/javascript"].includes(a));let o=new WeakSet;n.realtime(e.document).query(i.scriptSelector,a=>{a.entrants.forEach(s=>{if(o.has(s)||!t&&!s.hasAttribute("ssr"))return;let u=Fr.call(e,i,s);if(!u)return;o.add(s);let c=s.scoped?s.parentNode||a.target:s.type==="module"?void 0:e;s.scoped&&c[i.api.scripts].push(s);let l=$t({script:s,compiledScript:u,thisContext:c});a.type==="query"||s.type&&!e.HTMLScriptElement.supports(s.type)||s.getAttribute("data-handling")==="manual"||i.script.timing==="manual"?r.Script.execute(l):s.textContent=`webqit.oohtml.Script.execute( '${l}' );`})},{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:a}}=e,s=(t._=t.textContent.trim())&&t._.startsWith("/*@oohtml*/if(false){")&&t._.endsWith("}/*@oohtml*/")?t._.slice(21,-12):t.textContent;if(!s.trim().length)return;let u=$t(s),c=r.Script.compileCache[t.quantum?0:1],l;if(!(l=c.get(u))){let{parserParams:f,compilerParams:d,runtimeParams:h}=i.advanced;l=new(t.type==="module"?a:n||o)(s,{exportNamespace:`#${t.id}`,fileName:`${e.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:{...f,executionMode:t.quantum&&"QuantumProgram"||"RegularProgram"},compilerParams:d,runtimeParams:h}),c.set(u,l)}return l}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 ir(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:kt({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 a=`starts-with(., "${n}")`,s=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${a} and ${s}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,Gi.call(e,t)}function Gi(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{Br.call(this,...r.exits),setTimeout(()=>{Xi.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(()=>{Br.call(this,...r.exits),Qi.call(t,i,...r.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Vr(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(S(t).has("data-binding"))return S(t).get("data-binding");let o=Object.create(null),a=new AbortController;o.$exec__=(u,c,...l)=>{(()=>{try{u[c](...l)}catch(d){throw new Error(`Error executing "${c}()": ${d.message} at ${d.cause}`)}})()},o.$assign__=(u,c,l)=>{(()=>{try{u[c]=l}catch(d){throw new Error(`Error executing "${c} = ${l}": ${d.message} at ${d.cause}`)}})()},r.intercept(o,{get:(u,c,l)=>{if(!(u.key in o)){let f={...n.createRequest(u.key),live:!0,signal:a.signal};t[i.CONTEXT_API.api.contexts].request(f,d=>{r.set(o,u.key,d)})}return l(o[u.key]??(u.key in globalThis?globalThis[u.key]:void 0))},has:(u,c,l)=>l(!0)});let s={scope:o,abortController:a,bindings:new Map};return S(t).set("data-binding",s),s}function Br(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=S(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals?.forEach(o=>o.abort()),r.delete(t),r.size||(n.abort(),S(e).delete("data-binding"))}}function 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(""),a=`^${e}(.*?)(?:${n}(\\d+)${o}(?:\\s+)?)?${r}$`,[,s,u]=t.match(new RegExp(a));return{raw:t,expr:s,span:parseInt(u??0)}}async function Qi(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let a=zr(i,o.nodeValue),s=o;if(a.span){if(s=o.nextSibling,s?.nodeName!=="#text"||s.nodeValue.length<a.span)return n;s.nodeValue.length>a.span&&s.splitText(a.span)}else s=o.ownerDocument.createTextNode(""),o.after(s);s.isBound=!0;let u=o;return e.webqit.env!=="server"&&(u.remove(),u=null),n.concat({textNode:s,template:a,anchorNode:u})},[]);for(let{textNode:n,template:o,anchorNode:a}of r){let s=Ur.call(e,i,o.expr),{scope:u,bindings:c}=Vr.call(this,i,n.parentNode);Object.defineProperty(n,"$oohtml_internal_databinding_anchorNode",{value:a,configurable:!0});try{c.set(n,{state:await(await s.bind(n,u)).execute()})}catch(l){console.log(l)}}}var er=new Map;function Ur(i,t){if(er.has(t))return er.get(t);let e=`let content = ((${t}) ?? '') + '';`;e+="$assign__wq(this, 'nodeValue', content);",e+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__wq(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${i.tokens.tagStart}${Ht(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,{parserParams:n,compilerParams:o,runtimeParams:a}=i.advanced,s=new r(e,{parserParams:n,compilerParams:o,runtimeParams:a});return er.set(t,s),s}async function Xi(i,...t){for(let e of t){let r=Gr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=Vr.call(this,i,e),a=[];Object.defineProperty(e,"$oohtml_internal_databinding_signals",{value:a,configurable:!0});try{o.set(e,{signals:a,state:await(await r.bind(e,n)).execute()})}catch(s){console.log(s)}}}var rr=new Map;function Gr(i,t){if(rr.has(t))return rr.get(t);let e={},r=-1,n=ut(t,";").map(l=>{let[f,d]=ut(l,":").map(g=>g.trim()),h=f[0],p=f.slice(1).trim(),v=`(${d})`,O=`(${v} ?? '')`;if(h==="&")return p.startsWith("--")?`$exec__wq(this.style, 'setProperty', "${Ht(p)}", ${O});`:`$assign__wq(this.style, "${Ht(p)}", ${O});`;if(h==="%")return`$exec__wq(this.classList, 'toggle', "${Ht(p)}", !!${v});`;if(h==="~")return p.startsWith("?")?`$exec__wq(this, 'toggleAttribute', "${Ht(p.substring(1).trim())}", !!${v});`:`$exec__wq(this, 'setAttribute', "${Ht(p)}", ${O});`;if(h==="#"){if(e[p])throw new Error(`Duplicate binding: ${f}.`);if(e[p]=!0,p==="text")return`$assign__wq(this, 'textContent', ${O});`;if(p==="html")return`$assign__wq(this, 'innerHTML', ${O});`;if(p==="items"){let[g,w]=ut(d,"/");if(!w)throw new Error(`Invalid ${h}items spec: ${l}; no import specifier.`);let[b,y,m,_]=g.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!b)throw new Error(`Invalid ${h}items spec: ${l}.`);if(y.startsWith("(")?y=y.trim().slice(1,-1).split(",").map($=>$.trim()):y=[y],y.length>(m==="in"?3:2))throw new Error(`Invalid ${h}items spec: ${l}.`);let x=m==="in"?y[2]:y[1]||"$index__";return`
|
|
16
|
+
};`;globalThis.webqit.$qCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return new Promise(r=>{let n=new MessageChannel;webqit.$qCompilerWorker.postMessage({source:e,params:t},[n.port2]),n.port1.onmessage=o=>{let{...a}=o.data;Object.defineProperty(a,"toString",{value:s=>s==="base64"?a.compiledSourceBase64:a.compiledSource}),r(a)}})}function ie(i,t,e={},r={}){t=j(t).slice();for(var n=i;!st(n)&&!Vt(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=(l,f,d)=>n.set?n.set(l,f,d):(X(t[s])&&E(l)?l.push(d):l[f]=d,!0);t=j(t);for(var a=i,s=0;s<t.length;s++)if(s<t.length-1){if(!a||!M(a)&&!I(a))return!1;var u=ie(a,t[s],n);if(!M(u)){if(n.buildTree===!1)return!1;u=I(n.buildTree)?n.buildTree(s):X(t[s+1])?[]:{};var c=o(a,t[s],u);if(!c)return!1}a=u}else return o(a,t[s],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=a=>{a!==void 0&&this.onwrite(()=>{let s=e(a,r),u=c=>{c!==void 0&&this.cycle(t,e,c)};s instanceof Promise?s.then(u):u(s)})};n instanceof Promise?n.then(o):o(n)})}};function Ar(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Nt(i,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(a=>(a+"").replace("(",r?"(.//":"(./")).join("|");let n=[],o;try{let a=i.document.evaluate(e,t,null,i.XPathResult.ANY_TYPE);for(;o=a.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 oe(i,t,e,r=!1,n=null){let o=n?.get(t)?.get(e);if(typeof o<"u")return o;let a=c=>(n?.has(t)||n?.set(t,new WeakMap),n?.get(t)?.set(e,c),c),s=t.getRootNode(),u=e.getRootNode();return s===u?a(t.contains(e)):r&&u instanceof i.ShadowRoot?a(oe(i,t,u.host,r,n)):a(!1)}function Er(i,t="|"){return[...i].reduce(([e,r,n,o],a)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(a)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(a)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(a)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(a)&&!n[0].endsWith("\\")&&(e=e===a?null:e||a),n[0]+=a,[e,r,n]),[null,0,[""]])[2].reverse()}var Y=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Ar(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Er(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var At=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 Y)&&t.length===1?t=[[],void 0,t[0]]:T(t[1])&&t.length===2?t=[j(t[0],!1),void 0,t[1]]:t[0]=j(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof Y)&&!(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 Y?e:new Y(e)),t}registry(...t){return V(this.window,"realdom",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,a=new WeakMap;for(let[s,u]of this.registry(t)){let c=[].concat(e).filter(f=>oe(n,s.context,f.target,s.params.subtree==="cross-roots",a));if(!c.length)continue;let l=[s,Array.isArray(e)?c:c[0]];u?o.add(l):r.call(n,...l)}for(let s of o)r.call(n,...s);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 dt=class extends At{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof Y;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,a=Ir(o,t);if(!e)return a;let s=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let u of a){let c=s?s.generate():{};e(u,c,o)}else{let u=s?.generate()||{};e(a,u,o)}if(r.live){s&&(r={...r,signalGenerator:s});let u=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,u)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof Y;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:a,webqit:s}=this;r.eventDetails&&!s.realdom.attrInterceptionHooks?.intercepting&&Cr.call(a,"intercept",()=>{});let u=new a.MutationObserver(d=>{d=Tr(d).map(h=>Mr.call(a,h)),Pr.call(a,f,d,o)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(d=>d+"")),u.observe(o,c);let l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),f={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:l,disconnectable:u};return this.disconnectables(r.signal,u,l)}observeSync(t,e,r={}){let n=typeof t=="string"||t instanceof Y;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:a}=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||Cr.call(a,s,d=>{this.forEachMatchingContext(s,d,Pr)});let u={disconnect(){f.delete(l)}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:c,disconnectable:u},f=this.registry(s);return f.set(l,!!l.params.deferred),this.disconnectables(r.signal,u,c)}};function Tr(i){return i.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName||V(e.target,"realdom","internalAttrInteractions").get(e.attributeName)?t:t.concat(e),[])}function Pr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:a,originalFilterIsString:s,signalGenerator:u}=i;if(o.subtree||(t=t.filter(d=>d.target===e)),!t.length)return;let c=r.map(d=>d+"");if(o.atomic&&!a.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 h;return o.eventDetails||({event:h,...d}=d),!o.oldValue&&"oldValue"in d&&({oldValue:h,...d}=d),!o.newValue&&"value"in d?{value:h,...d}=d:o.newValue&&typeof d.value>"u"&&(d={...d,value:he(d.target,d.name,()=>d.target.getAttribute(d.name))}),d})),o.atomic&&(t.forEach(d=>a.set(d.name,d)),t=Array.from(a.entries()).map(([,d])=>d));let l=s?t[0]:t,f=u?u.generate():{};n(l,f,e)}function he(i,t,e){let r=V(i,"realdom","internalAttrInteractions").get(t);V(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return V(i,"realdom","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(a=>a.name===o)||{target:i,name:o,value:he(i,o,()=>i.getAttribute(o)),...r})):Array.from(i.attributes).map(o=>e.find(a=>a.name===o.nodeName)||{target:i,name:o.nodeName,value:he(i,o.nodeName,()=>o.nodeValue),...r})}function Mr({target:i,attributeName:t,value:e,oldValue:r}){let a=(this.webqit.realdom.attrInterceptionRecords?.get(i)||{})[t]?.[0]||"mutation";return{target:i,name:t,value:e,oldValue:r,type:"observation",event:a}}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 a=()=>r.realdom.attrInterceptionHooks.get(i).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return a;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let s=(l,f)=>{r.realdom.attrInterceptionRecords.has(l.target)||r.realdom.attrInterceptionRecords.set(l.target,{});let d=r.realdom.attrInterceptionRecords.get(l.target);if(d[l.name]=d[l.name]||[],d[l.name].unshift(l.event),V(l.target,"realdom","internalAttrInteractions").get(l.name))return f();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(p=>p([l]));let h=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(p=>p([l])),h};new e.MutationObserver(l=>{l=l.filter(f=>!(e.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),l=Tr(l).map(f=>Mr.call(e,f)),l.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(f=>f(l)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(f=>f(l)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{c[l]=o.prototype[l],o.prototype[l]=function(...f){let d,h=he(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(l)&&(d=f[1]),l==="toggleAttribute"&&d===void 0&&(d=h===null);let p={target:this,name:f[0],value:d,oldValue:h,type:"interception",event:[this,l]};return s(p,()=>c[l].call(this,...f))}}),a}var se=class extends At{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new dt(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,a=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=>a(n).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,l]=t.reduce(([d,h],p)=>p.kind==="xpath"?[d,h.concat(p)]:[d.concat(p),h],[[],[]]),f=[];r.subtree?(c.length&&f.push(...n.querySelectorAll(c.join(","))),l.length&&f.push(...Nt(this.window,n,l))):(c.length&&f.push(...[...n.children].filter(d=>d.matches(c))),l.length&&f.push(...Nt(this.window,n,l,!1))),f.forEach(d=>a(d.parentNode||n).entrants.push(d))}}if(!e)return o;let s={disconnected:!1},u=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(s.disconnected)break;let l=u?.generate()||{};e(c,l,n)}if(r.live){u&&(r={...r,signalGenerator:u});let c=this.observe(t,e,r);return this.disconnectables(r.signal,s,c)}return this.disconnectables(r.signal,s,u)}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:a,document:s}=this;r.eventDetails&&(a.realdom.domInterceptionRecordsAlwaysOn=!0),(s.readyState==="loading"||a.realdom.domInterceptionRecordsAlwaysOn)&&!a.realdom.domInterceptionHooks?.intercepting&&Rr.call(o,"sync",()=>{});let u=new o.MutationObserver(f=>f.forEach(d=>{Qe.call(o,l,kr.call(o,d),n)}));u.observe(n,{childList:!0,subtree:r.subtree&&!0});let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:u};if(r.staticSensitivity){let f=qr.call(o,l);return this.disconnectables(r.signal,u,c,f)}return this.disconnectables(r.signal,u,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 a=r.timing==="intercept"?"intercept":"sync";this.registry(a).size||Rr.call(o,a,d=>{this.forEachMatchingContext(a,d,Qe)});let s=new o.MutationObserver(d=>d.forEach(h=>{Array.isArray((h=kr.call(o,h)).event)||Qe.call(o,l,h,n)}));s.observe(n,{childList:!0,subtree:r.subtree&&!0});let u={disconnect(){f.delete(l),s.disconnect()}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:n,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:u},f=this.registry(a);if(f.set(l,!!l.params.deferred),r.staticSensitivity){let d=qr.call(o,l);return this.disconnectables(r.signal,u,c,d)}return this.disconnectables(r.signal,u,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:a}=i,s=r.filter(h=>h.kind==="css"),u=h=>h.match(/\.([\w-]+)/g)?.length?["class"]:[],c=h=>h.match(/#([\w-]+)/g)?.length?["id"]:[],l=h=>[...h.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(p=>p[1]).concat(u(h)).concat(c(h));if(!(i.$attrs=Array.from(new Set(s.filter(h=>(h+"").includes("[")).reduce((h,p)=>h.concat(l(p+"")),[])))).length)return;let f=new Set,d=new Set;return f.push=h=>(d.delete(h),f.add(h)),d.push=h=>(f.delete(h),d.add(h)),i.$deliveryCache={entrants:f,exits:d},new dt(e,t).observe(i.$attrs,h=>{let p=new Map,v=w=>(p.has(w)||p.set(w,{target:w,entrants:[],exits:[],type:"static",event:null}),p.get(w)),O=new WeakMap,g=w=>(O.has(w)||O.set(w,s.some(b=>w.matches(b+""))),O.get(w));for(let w of h)["entrants","exits"].forEach(b=>{o.generation&&b!==o.generation||i.$deliveryCache[b].has(w.target)||(b==="entrants"?!g(w.target):g(w.target))||(i.$deliveryCache[b].push(w.target),v(w.target)[b].push(w.target),v(w.target).event=w.event)});for(let[,w]of p){let b=a?.generate()||{};n(w,b,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function Qe(i,t){let{context:e,spec:r,callback:n,params:o,signalGenerator:a,$deliveryCache:s}=i,u={...t,entrants:[],exits:[]};if(o.eventDetails||delete u.event,["entrants","exits"].forEach(l=>{if(!(o.generation&&l!==o.generation)&&(r.length?u[l]=ki.call(this,r,o.subtree==="cross-roots",t[l],t.event!=="parse"):u[l]=[...t[l]],!!s))for(let f of u[l])s[l].push(f)}),!u.entrants.length&&!u.exits.length)return;let c=a?.generate()||{};n(u,c,e)}function ki(i,t,e,r){e=Array.isArray(e)?e:[...e];let n=(o,a)=>{if(a.type==="selector"){let s=a.isXpathAttr?[]:o.filter(u=>a.kind==="xpath"?$r(this,u,a+""):u.matches&&u.matches(a+""));if((r||a.isXpathAttr)&&(s=o.reduce((u,c)=>a.kind==="xpath"?[...u,...Nt(this,c,a,r)]:c.querySelectorAll?[...u,...c.querySelectorAll(a+"")]:u,s)),s.length)return s}else if(o.includes(a.content)||r&&o.some(s=>oe(this,s,a.content,t)))return[a.content]};return e.$$searchCache||(e.$$searchCache=new Map),i.reduce((o,a)=>{let s;return e.$$searchCache.has(a.content)?s=e.$$searchCache.get(a.content):(s=n(e,a)||[],a.type==="instance"&&e.$$searchCache.set(a.content,s)),o.concat(s)},[])}function kr({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=j(t).reduce((o,a)=>o||r.webqit.realdom.domInterceptionRecords?.get(a),null),n=j(e).reduce((o,a)=>o||r.webqit.realdom.domInterceptionRecords?.get(a),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:a,Element:s,HTMLElement:u,HTMLTemplateElement:c,DocumentFragment:l}=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,w,b)=>{r.realdom.domInterceptionNoRecurse.set(g,w);let y=b();return r.realdom.domInterceptionNoRecurse.delete(g),y},h=(g,w)=>{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 b=w();return r.realdom.domInterceptionHooks.get("sync")?.forEach(y=>y(g)),b},p={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"]},v={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(p).reduce((g,w)=>g.concat(w),[])).forEach(g=>{Object.keys(p).forEach(y=>{if(!p[y].includes(g))return;let m=Object.getOwnPropertyDescriptor(e[y].prototype,g);!m||(Object.defineProperty(e[y].prototype,g,"value"in m?{...m,value:w}:{...m,set:b}),v[y][g]=m)});function w(...y){let m=Object.keys(v).find(L=>this instanceof e[L]&&g in v[L]),_=v[m],x=()=>_[g].value.call(this,...y);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return x();let $=[],A=[],C=this;["insertBefore"].includes(g)?A=[y[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?(A=[y[1]],["beforebegin","afterend"].includes(y[0])&&(C=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?($=[...this.childNodes],A=g==="replaceChildren"?[...y]:[y[0]]):["replaceWith","remove"].includes(g)?($=[this],A=g==="replaceWith"?[...y]:[],C=this.parentNode):["replaceChild"].includes(g)?($=[y[1]],A=[y[0]]):["removeChild"].includes(g)?$=[...y]:(A=[...y],["before","after"].includes(g)&&(C=this.parentNode));let k=g;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(g)){let L=this.nodeName;if(g==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(y[0])){if(!this.parentNode)return _[g].value.call(this,...y);L=this.parentNode.nodeName}let H=n.createElement(L.includes("-")?"div":L);_.setHTMLUnsafe.value.call(H,A[0],g==="setHTMLUnsafe"?y[1]:{}),A=[...H.childNodes],g==="insertAdjacentHTML"?(k="insertAdjacentElement",y[1]=new l,d(y[1],"append",()=>y[1].append(...H.childNodes))):(k="replaceChildren",y=[...H.childNodes])}return h({target:C,entrants:A,exits:$,type:"interception",event:[this,g]},()=>_[k].value.call(this,...y))}function b(y){let m=Object.keys(v).find(N=>this instanceof e[N]&&g in v[N]),_=v[m],x=()=>_[g].set.call(this,y);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return x();let $=[],A=[],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 x();N=this.parentNode.nodeName}let L=n.createElement(N.includes("-")?"div":N);if(d(L,g,()=>L[g]=y),A=this instanceof c?[...L.content.childNodes]:[...L.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let H=gt=>gt.reduce((nt,ot)=>ot instanceof HTMLScriptElement?nt.concat(ot):ot instanceof c?nt.concat(H([ot.content])):(nt=nt.concat(H([...ot.querySelectorAll?.("template")||[]].map(Zr=>Zr.content))),nt.concat(...ot.querySelectorAll?.("script")||[])),[]);for(let gt of H(A)){if(this instanceof ShadowRoot){gt.setAttribute("data-handling","manual");continue}let nt=n.createElement("script");[...gt.attributes].forEach(ot=>nt.setAttribute(ot.name,ot.value)),nt.textContent=gt.textContent,d(gt,"replaceWith",()=>gt.replaceWith(nt))}}g==="outerHTML"?(y=new l,d(y,"append",()=>y.append(...A)),x=()=>d(this,"replaceWith",()=>s.prototype.replaceWith.call(this,y))):this instanceof c?x=()=>d(this.content,"replaceChildren",()=>this.content.replaceChildren(...A)):x=()=>d(this,"replaceChildren",()=>s.prototype.replaceChildren.call(this,...A))}return h({target:C,entrants:A,exits:$,type:"interception",event:[this,g]},x)}}),f}function jr(){Ri.call(this),ji.call(this),Ni.call(this)}function Ri(){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 Ni(){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={},jr.call(i),i.webqit.realdom.meta=(...e)=>Di.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 dt(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;Mt(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 a of n.webqit.realdom.readyStateCallbacks[o].splice(0))a(n)},!1)),n.webqit.realdom.readyStateCallbacks[t].push(e)}function Di(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 a=o.split("=").map(s=>s.trim());return Ue(n,a[0].split("."),a[1]==="true"?!0:a[1]==="false"?!1:X(a[1])?parseInt(a[1]):a[1]),n},{})),{get name(){return i},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}function me(i,t){return typeof i!="string"?i:i.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+(typeof t!==void 0&&t?e.substr(1).toLowerCase():e.substr(1))})}var S=(i,...t)=>V(i,"oohtml",...t),q={};function z(i,t,e){let r=this,n=Nr.call(r);q.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let a=r.webqit.oohtml.configs[o];Ut(2,a,e,t,n.meta(i).json()),r.webqitConfig.prefix&&Object.keys(a).forEach(s=>{Object.keys(a[s]).forEach(u=>{s==="api"&&typeof a[s][u]=="string"?a[s][u]=`${r.webqitConfig.prefix}${me(a[s][u])}`:["attr","elements"].includes(s)&&a[s][u]?.startsWith("data-")===!1&&(a[s][u]=`${r.webqitConfig.prefix}-${a[s][u]}`)})})}return{config:r.webqit.oohtml.configs[o],realdom:n,window:r}}function Ye(i,t){return S(i,"internalAttrInteractions").get(t)}function Lr(i,t,e){let r=S(i,"internalAttrInteractions").get(t);S(i,"internalAttrInteractions").set(t,!0);let n=e();return S(i,"internalAttrInteractions").set(t,r),n}function ut(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 Fi=()=>(0|Math.random()*9e6).toString(36),Je=new Map;function $t(i){let t;return(t=Je.get(i))||(t=Fi(),Je.set(i,t)),t}function ge(i){let t;return Je.forEach((e,r)=>{e===i&&(t=r)}),t}function ye(){let{window:i}=q,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let a=n.pop();if(!a?.kind)throw new Error('"options.kind" must be specified.');let s=["contextrequest","contextclaim"],u=n.pop()||s[0];if(!s.includes(u))throw new Error(`Invalid event type. Must be one of: ${s.join(",")}`);let{kind:c,detail:l,targetContext:f,live:d,signal:h,diff:p,...v}=a;super(u,{...v,bubbles:v.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:()=>l}),Object.defineProperty(this,"live",{get:()=>d}),Object.defineProperty(this,"signal",{get:()=>h}),Object.defineProperty(this,"diff",{get:()=>p}),Object.defineProperty(this,"options",{get:()=>v}),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}}}=q;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var Pt=class extends Error{};var pt=class{static instance(t){return S(t).get("contexts::instance")||new this(t)}constructor(t){S(t).get("contexts::instance")?.dispose(),S(t).set("contexts::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e})}[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 Pt(`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(a=>typeof a=="object"&&a))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(ye())(...t);this["#"].host.dispatchEvent(o)})}};var Ze=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=q;return t}get name(){return[q.window.Document,q.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof Ze)||t.target===this.host)return;let e=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),e.add(r))}),e.size)return t.respondWith(e)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:e}=pt.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 Dt=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}}}=q;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(e.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(n=>n.trim()).filter(n=>n);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=e.reduce(this.namespaceObj,r,e.get,n=>{this.disposed||t.respondWith(n.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};W(Dt,"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=Dt,Wi.call(e,t),Bi.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,a=Hr(o),s=new RegExp(`${e?":scope|":""}#(${a.lidrefPrefix(r+1)})?([\\w]+${a.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[u,c]=ut(i,",").reduce(([f,d],h)=>{let p,v;return h=h.replace(s,(O,g,w,b,y)=>{if(p||(p=[...h.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),p.some($=>y>$.index&&y+O.length<$.index+$[0].length))return O;if(O===":scope")return v=!0,e;let m=g&&!w;if(g&&w)return`#${a.escape(O.replace("#",""),1)}`;if(m&&o.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${a.toUuid(t,b,1)}`;let x;return o.attr.lid==="id"?x=`:is(#${b},[id^="${a.lidrefPrefix(r)}"][id$="${a.lidrefSeparator(r)}${b}"])`:x=`:is(#${b},[${n.CSS.escape(o.attr.lid)}="${b}"])`,m?`:is(${x}):not(${e?e+" ":""}${o.namespaceSelector} *)`:x}),v?[f,d.concat(h)]:[f.concat(h),d]},[[],[]]),l;return e&&u.length?l=[u.length>1?`${e} :is(${u.join(", ")})`:`${e} ${u[0]}`,c.join(", ")].filter(f=>f).join(", "):l=[...u,...c].join(", "),l}function we(i){let t=this;if(!S(i).has("namespace")){let e=Object.create(null);S(i).set("namespace",e);let r=[t.Document,t.ShadowRoot].some(n=>i instanceof n);Object.defineProperty(e,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return S(i).get("namespace")}function Lt(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return we.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function be(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(ge(i)||$t(i))+(t?"-root":"")}function Wi(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(we.call(t,this))}})})}function Bi(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},DOMNamingContext:o}}=t,a=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],s=["for","list","form","aria-activedescendant","aria-details","aria-errormessage"],u=[i.attr.lid,...a,...s],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"},l=Hr(i),f=(m,_,x)=>{if(!Ye(m,_)&&S(m,"attrOriginals").has(_))return S(m,"attrOriginals").get(_);let $=x();return Ye(m,_)?$:$&&$.split(" ").map(A=>(A=A.trim())&&(_===i.attr.lid?l.uuidToId:l.uuidToLidref).call(l,A)).join(" ")},d=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...d,value(m){return this.querySelector(`#${m}`)}});for(let m of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let _=Object.getOwnPropertyDescriptor(nodeApi.prototype,m);Object.defineProperty(nodeApi.prototype,m,{..._,value(x){return _.value.call(this,tr.call(t,x,be(we.call(t,this))))}})}let h=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...h,value(m){let _=()=>h.value.call(this,m);return u.includes(m)&&!S(this,"lock").get(m)?f(this,m,_):_()}});let p=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...p,get(){let m=()=>p.get.call(this);return u.includes(this.name)?f(this.ownerElement,this.name,m):m()}});let v=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...v,get(){let m=()=>v.get.call(this);return this instanceof t.Attr&&u.includes(this.name)?f(this.ownerElement,this.name,m):m()}});for(let m of u){if(!(m in c))continue;let _=m==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let x of _){let $=Object.getOwnPropertyDescriptor(x.prototype,c[m]);!$||Object.defineProperty(x.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 O=(m,_,x,$)=>Lr(m,_,()=>(typeof x=="function"&&(x=x()),$(x))),g=(m,_,x,$=null)=>{O(m,_,x,A=>{let C=_===i.attr.lid,k=$||Lt.call(t,m,C),N=be(k);if(C){let L=l.uuidToId(A);if(e.get(k,L)!==m){let H=l.toUuid(N,L);H!==A&&m.setAttribute("id",H),e.set(k,L,m)}}else{S(m,"attrOriginals").set(_,A);let L=A.split(" ").map(H=>(H=H.trim())&&l.isUuid(H)?H:l.toUuid(N,H)).join(" ");m.setAttribute(_,L),S(k).set("idrefs",S(k).get("idrefs")||new Set),S(k).get("idrefs").add(m)}})},w=(m,_,x,$=null)=>{O(m,_,x,A=>{let C=_===i.attr.lid,k=$||Lt.call(t,m,C);if(C){let N=l.uuidToId(A);e.get(k,N)===m&&e.deleteProperty(k,N)}else{let N=S(m,"attrOriginals").get(_);m.hasAttribute(_)&&m.setAttribute(_,N),S(k).get("idrefs")?.delete(m)}})};r.realtime(t.document).query(i.namespaceSelector,m=>{let _=(x,$,A,C)=>{if(!x.hasAttribute($))return;let k=()=>x.getAttribute($);w(x,$,k,A),x.isConnected&&g(x,$,S(x,"attrOriginals").get($)||k,C)};m.exits.forEach(x=>{if(x.isConnected){let C=we.call(t,x);for(let k of new Set([...Object.values(C),...S(C).get("idrefs")||[]]))for(let N of u)_(k,N,C)}let $=x[n.CONTEXT_API.api.contexts],A=$.find(o.kind);A&&$.detach(A)}),m.entrants.forEach(x=>{let $,A=Lt.call(t,x,!0);for(let k of new Set([...Object.values(A),...S(A).get("idrefs")||[]]))if(($=Lt.call(t,k,!0))!==A)for(let N of u)_(k,N,A,$);let C=x[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(`[${u.map(m=>t.CSS.escape(m)).join("],[")}]`,m=>{let _={forID:new Map,forOther:new Map};for(let x of u){let $=x===i.attr.lid?_.forID:_.forOther;m.exits.forEach(A=>{if(!A.hasAttribute(x))return;let C=$.get(A);typeof C>"u"&&(C=(x===i.attr.lid?A.parentNode:A)?.closest?.(i.namespaceSelector)||A.getRootNode().host,$.set(A,C)),!(C&&!C.isConnected)&&w(A,x,()=>A.getAttribute(x))}),m.entrants.forEach(A=>{!A.hasAttribute(x)||g(A,x,()=>A.getAttribute(x))})}_.forID.clear(),_.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(u,m=>{for(let _ of m)_.oldValue&&w(_.target,_.name,_.oldValue),_.value&&g(_.target,_.name,_.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let b,y=()=>{if(!t.location.hash?.startsWith(`#${l.lidrefPrefix()}`))return;let m=t.location.hash?.substring(`#${l.lidrefPrefix()}`.length).split("/").map(x=>x.trim()).filter(x=>x)||[],_=m.reduce((x,$)=>x&&x[i.api.namespace][$],t.document);b&&i.target.className&&b.classList.toggle(i.target.className,!1),_&&_!==t.document&&(i.target.className&&_.classList.toggle(i.target.className,!0),i.target.eventName&&_.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&m.length>1&&_.scrollIntoView(),b=_)};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:kt(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:zi.bind(r,e)},Vi.call(r,e),Ui.call(r,e)}function Vi(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 zi(i,t){let e=this,{realdom:r}=e.webqit,n=ge(t);if(!n)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:a,thisContext:s}=n;i.script.retention==="dispose"?o.remove():i.script.retention==="hidden"?o.textContent='"source hidden"':o.textContent=await a.toString();let u=o.scoped?s:o.getRootNode();S(u).has("scriptEnv")||S(u).set("scriptEnv",Object.create(null));let c=await(await a.bind(s,S(u).get("scriptEnv"))).execute();o.quantum&&Object.defineProperty(o,"state",{value:c}),r.realtime(e.document).observe(o,()=>{o.quantum&&c.dispose(),s instanceof e.Element&&s[i.api.scripts]?.splice(s[i.api.scripts].indexOf(o,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function Ui(i){let t=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,e=this,{webqit:{oohtml:r,realdom:n}}=e;e.HTMLScriptElement.supports||(e.HTMLScriptElement.supports=a=>["text/javascript","application/javascript"].includes(a));let o=new WeakSet;n.realtime(e.document).query(i.scriptSelector,a=>{a.entrants.forEach(s=>{if(o.has(s)||!t&&!s.hasAttribute("ssr"))return;let u=Fr.call(e,i,s);if(!u)return;o.add(s);let c=s.scoped?s.parentNode||a.target:s.type==="module"?void 0:e;s.scoped&&c[i.api.scripts].push(s);let l=$t({script:s,compiledScript:u,thisContext:c});a.type==="query"||s.type&&!e.HTMLScriptElement.supports(s.type)||s.getAttribute("data-handling")==="manual"||i.script.timing==="manual"?r.Script.execute(l):s.textContent=`webqit.oohtml.Script.execute( '${l}' );`})},{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:a}}=e,s=(t._=t.textContent.trim())&&t._.startsWith("/*@oohtml*/if(false){")&&t._.endsWith("}/*@oohtml*/")?t._.slice(21,-12):t.textContent;if(!s.trim().length)return;let u=$t(s),c=r.Script.compileCache[t.quantum?0:1],l;if(!(l=c.get(u))){let{parserParams:f,compilerParams:d,runtimeParams:h}=i.advanced;l=new(t.type==="module"?a:n||o)(s,{exportNamespace:`#${t.id}`,fileName:`${e.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:{...f,executionMode:t.quantum&&"QuantumProgram"||"RegularProgram"},compilerParams:d,runtimeParams:h}),c.set(u,l)}return l}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:kt({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 a=`starts-with(., "${n}")`,s=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${a} and ${s}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,Gi.call(e,t)}function Gi(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{Br.call(this,...r.exits),setTimeout(()=>{Xi.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(()=>{Br.call(this,...r.exits),Qi.call(t,i,...r.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Vr(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(S(t).has("data-binding"))return S(t).get("data-binding");let o=Object.create(null),a=new AbortController;o.$exec__=(u,c,...l)=>{(()=>{try{u[c](...l)}catch(d){throw new Error(`Error executing "${c}()": ${d.message} at ${d.cause}`)}})()},o.$assign__=(u,c,l)=>{(()=>{try{u[c]=l}catch(d){throw new Error(`Error executing "${c} = ${l}": ${d.message} at ${d.cause}`)}})()},r.intercept(o,{get:(u,c,l)=>{if(!(u.key in o)){let f={...n.createRequest(u.key),live:!0,signal:a.signal};t[i.CONTEXT_API.api.contexts].request(f,d=>{r.set(o,u.key,d)})}return l(o[u.key]??(u.key in globalThis?globalThis[u.key]:void 0))},has:(u,c,l)=>l(!0)});let s={scope:o,abortController:a,bindings:new Map};return S(t).set("data-binding",s),s}function Br(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=S(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals?.forEach(o=>o.abort()),r.delete(t),r.size||(n.abort(),S(e).delete("data-binding"))}}function 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(""),a=`^${e}(.*?)(?:${n}(\\d+)${o}(?:\\s+)?)?${r}$`,[,s,u]=t.match(new RegExp(a));return{raw:t,expr:s,span:parseInt(u??0)}}async function Qi(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let a=zr(i,o.nodeValue),s=o;if(a.span){if(s=o.nextSibling,s?.nodeName!=="#text"||s.nodeValue.length<a.span)return n;s.nodeValue.length>a.span&&s.splitText(a.span)}else s=o.ownerDocument.createTextNode(""),o.after(s);s.isBound=!0;let u=o;return e.webqit.env!=="server"&&(u.remove(),u=null),n.concat({textNode:s,template:a,anchorNode:u})},[]);for(let{textNode:n,template:o,anchorNode:a}of r){let s=Ur.call(e,i,o.expr),{scope:u,bindings:c}=Vr.call(this,i,n.parentNode);Object.defineProperty(n,"$oohtml_internal_databinding_anchorNode",{value:a,configurable:!0});try{c.set(n,{state:await(await s.bind(n,u)).execute()})}catch(l){console.log(l)}}}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}${Ht(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,{parserParams:n,compilerParams:o,runtimeParams:a}=i.advanced,s=new r(e,{parserParams:n,compilerParams:o,runtimeParams:a});return rr.set(t,s),s}async function Xi(i,...t){for(let e of t){let r=Gr.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=Vr.call(this,i,e),a=[];Object.defineProperty(e,"$oohtml_internal_databinding_signals",{value:a,configurable:!0});try{o.set(e,{signals:a,state:await(await r.bind(e,n)).execute()})}catch(s){console.log(s)}}}var ir=new Map;function Gr(i,t){if(ir.has(t))return ir.get(t);let e={},r=-1,n=ut(t,";").map(l=>{let[f,d]=ut(l,":").map(g=>g.trim()),h=f[0],p=f.slice(1).trim(),v=`(${d})`,O=`(${v} ?? '')`;if(h==="&")return p.startsWith("--")?`$exec__(this.style, 'setProperty', "${Ht(p)}", ${O});`:`$assign__(this.style, "${Ht(p)}", ${O});`;if(h==="%")return`$exec__(this.classList, 'toggle', "${Ht(p)}", !!${v});`;if(h==="~")return p.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Ht(p.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${Ht(p)}", ${O});`;if(h==="#"){if(e[p])throw new Error(`Duplicate binding: ${f}.`);if(e[p]=!0,p==="text")return`$assign__(this, 'textContent', ${O});`;if(p==="html")return`$assign__(this, 'innerHTML', ${O});`;if(p==="items"){let[g,w]=ut(d,"/");if(!w)throw new Error(`Invalid ${h}items spec: ${l}; no import specifier.`);let[b,y,m,_]=g.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!b)throw new Error(`Invalid ${h}items spec: ${l}.`);if(y.startsWith("(")?y=y.trim().slice(1,-1).split(",").map($=>$.trim()):y=[y],y.length>(m==="in"?3:2))throw new Error(`Invalid ${h}items spec: ${l}.`);let x=m==="in"?y[2]:y[1]||"$index__";return`
|
|
17
17
|
let $iteratee__ = ${_};
|
|
18
18
|
let $import__ = this.${i.HTML_IMPORTS.api.import}( ${w.trim()}, true );
|
|
19
19
|
this.$oohtml_internal_databinding_signals?.push( $import__ );
|
|
@@ -33,12 +33,12 @@ ${p}
|
|
|
33
33
|
let $itemNode__ = $existing__.get( $key___ );
|
|
34
34
|
if ( $itemNode__ ) {
|
|
35
35
|
$existing__.delete( $key___ );
|
|
36
|
-
$
|
|
36
|
+
$exec__($itemNode__, '${i.BINDINGS_API.api.bind}', $itemBinding__ );
|
|
37
37
|
} else {
|
|
38
38
|
$itemNode__ = ( Array.isArray( $import__.value ) ? $import__.value[ 0 ] : ( $import__.value instanceof window.HTMLTemplateElement ? $import__.value.content.firstElementChild : $import__.value ) ).cloneNode( true );
|
|
39
39
|
$itemNode__.setAttribute( "${i.attr.itemIndex}", $key___ );
|
|
40
|
-
$
|
|
41
|
-
$
|
|
40
|
+
$exec__($itemNode__, '${i.BINDINGS_API.api.bind}', $itemBinding__ );
|
|
41
|
+
$exec__(this, 'appendChild', $itemNode__ );
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if ( ${m==="in"?`!( ${y[0]} in $iteratee__ )`:`typeof ${y[0]} === 'undefined'`} ) { $itemNode__.remove(); }
|
|
@@ -50,10 +50,10 @@ ${p}
|
|
|
50
50
|
this.addEventListener( '${p}', handler${r} );
|
|
51
51
|
const abort${r} = () => this.removeEventListener( '${p}', handler${r} );
|
|
52
52
|
this.$oohtml_internal_databinding_signals?.push( { abort: abort${r} } );
|
|
53
|
-
`;if(h==="$")return`$
|
|
54
|
-
`),{webqit:{QuantumModule:o}}=this,{parserParams:a,compilerParams:s,runtimeParams:u}=i.advanced,c=new o(n,{parserParams:a,compilerParams:s,runtimeParams:u});return rr.set(t,c),c}var Ht=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))}),Nt(t,i,`(${e.discreteBindingsSelector})`).forEach(r=>{let n=zr(e,r.nodeValue);Ur.call(t,e,n.expr)})}var Z=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}}}=q;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(Z,"kind","bindings");function nr(i={}){let{config:t,window:e}=z.call(this,"bindings-api",i,{attr:{bindingsreflection:"bindings"},api:{bind:"bind",bindings:"bindings"}});e.webqit.DOMBindingsContext=Z,Ji.call(e,t),Zi.call(e,t)}function or(i,t){let e=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:n}}}}=e;if(!S(t).has("bindings")){let o=Object.create(null);S(t).set("bindings",o),r.observe(o,a=>{if(t instanceof e.Element){let s=xe(t.getAttribute(i.attr.bindingsreflection)||""),u=new Map(s);for(let c of a)c.detail?.publish!==!1&&(c.type==="delete"?s.delete(c.key):s.set(c.key,void 0));s.size&&s.size!==u.size?t.setAttribute(i.attr.bindingsreflection,`{ ${[...s.entries()].map(([c,l])=>l===void 0?c:`${c}: ${l}`).join(", ")} }`):s.size||t.toggleAttribute(i.attr.bindingsreflection,!1)}else{let s=t[n.api.contexts];for(let u of a)if(u.type==="delete"){let c=s.find(Z.kind,u.key);c&&s.detach(c)}else s.find(Z.kind,u.key)||s.attach(new Z(u.key))}})}return S(t).get("bindings")}function Ji(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,a={}){return Yi.call(t,i,this,o,a)}}),Object.defineProperty(r,i.api.bindings,{get:function(){return e.proxy(or.call(t,i,this))}})})}function Yi(i,t,e,{merge:r,diff:n,publish:o,namespace:a}={}){let s=this,{webqit:{Observer:u}}=s,c=or.call(this,i,t),l={diff:n,namespace:a,detail:{publish:o}},f=r?[]:Object.keys(c,l).filter(d=>!(d in e));return u.batch(c,()=>(f.length&&u.deleteProperties(c,f,l),u.set(c,e,l)),l)}function Zi(i){let t=this,{webqit:{realdom:e,Observer:r,oohtml:{configs:n}}}=t,o=(s,u)=>{let c=s[n.CONTEXT_API.api.contexts];c.find(Z.kind,u)||c.attach(new Z(u))},a=(s,u)=>{let c,l=s[n.CONTEXT_API.api.contexts];for(;c=l.find(Z.kind,u);)l.detach(c)};e.realtime(t.document).query(`[${t.CSS.escape(i.attr.bindingsreflection)}]`,s=>{s.exits.forEach(u=>a(u)),s.entrants.forEach(u=>{let c=xe(u.getAttribute(i.attr.bindingsreflection)||""),l=[...c.entries()].filter(([f,d])=>d!==void 0);l.length&&u[i.api.bind](Object.fromEntries(l),{merge:!0,publish:!1});for(let[f]of c)o(u,f)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),e.realtime(t.document,"attr").observe(i.attr.bindingsreflection,s=>{let u=or.call(t,i,s.target),c=xe(s.value||""),l=xe(s.oldValue||"");for(let f of new Set([...c.keys(),...l.keys()]))l.has(f)?c.has(f)?c.get(f)!==l.get(f)&&r.set(u,f,c.get(f),{detail:{publish:!1}}):(l.get(f)!==void 0&&r.deleteProperty(u,f,{detail:{publish:!1}}),a(s.target,f)):(c.get(f)!==void 0&&r.set(u,f,c.get(f),{detail:{publish:!1}}),o(s.target,f))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var xe=i=>(i=i.trim(),new Map(ut(i.slice(1,-1),",").filter(t=>t.trim()).map(t=>ut(t,":").map(e=>e.trim()))));var it=class{static instance(t){return S(t).get("defsmanager::instance")||new this(t)}constructor(t,e=null,r=0){let{window:n}=q,{webqit:{realdom:o,oohtml:{configs:a}}}=n;S(t).get("defsmanager::instance")?.dispose(),S(t).set("defsmanager::instance",this),this.window=n,this.host=t,this.config=a.HTML_IMPORTS,this.parent=e,this.level=r,this.defs=ht(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=o.realtime(this.host.content).children(s=>{this.expose(s.entrants,!0),this.expose(s.exits,!1)},{live:!0,timing:"sync"}),this.realtimeB=o.realtime(this.host).attr(["src","loading"],(...s)=>this.evaluateLoading(...s),{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}=q,{webqit:{Observer:n}}=r,o,a=this.defs["#"]||[];t.forEach(s=>{if(s.nodeType!==1)return;let u=s.matches(this.config.templateSelector),c=(s.getAttribute(u?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();e?(u&&c?new it(s,this.host,this.level+1):(a.push(s),o=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(l=>l.call(this.window,s))})),c&&(this.validateDefId(c),n.set(this.defs,(!u&&"#"||"")+c,s))):(u&&c?it.instance(s).dispose():(a=a.filter(l=>l!==s),o=!0),c&&n.deleteProperty(this.defs,(!u&&"#"||"")+c))}),o&&n.set(this.defs,"#",a)}evaluateLoading([t,e],{signal:r}){let{window:{webqit:{Observer:n}}}=q,o=(t.value||"").trim();if(!o)return;let a,s=l=>{if(!l)return a;a=l.then(()=>c.remove())},u=(e.value||"").trim(),c=n.intercept(this.defs,"get",async(l,f,d)=>(u==="lazy"&&s(this.load(o,!0)),await s(),d()),{signal:r});u!=="lazy"&&s(this.load(o))}load(t){let{window:e}=q;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=(a,s)=>this.host.dispatchEvent(new e.CustomEvent(a,{detail:s})),o=e.fetch(t,{signal:r.signal,element:this.host}).then(a=>a.ok?a.text():Promise.reject(a.statusText)).then(a=>(this.host.innerHTML=a.trim(),n("load"),this.host)).catch(a=>(console.error(`Error fetching the bundle at "${t}": ${a.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}}}=q,e=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(s=>s.trim()).filter(s=>s),n=s=>{s.forEach(u=>{t.get(this.defs,u.key)===u.oldValue&&(["get","set","def"].includes(u.type)?t[u.type.replace("get","set")](this.defs,u.key,u.value):u.type==="delete"&&t.deleteProperty(this.defs,u.key))})},o=[],a=ht(this.parent);return e&&o.push(t.reduce(a,[e,this.config.api.defs,1/0],t.get,n,{live:!0})),r.length&&o.push(t.get(a,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("#")||it.instance(e).dispose()})}};var mt,Q,Ft,Wt,ft=class extends U{constructor(){super(...arguments);Bt(this,mt,{});Bt(this,Q,void 0);Bt(this,Ft,void 0);Bt(this,Wt,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(a=>a.trim());r.targetContext=n,r.detail=o.join("")}else r.detail=e;return r}get localModules(){return ht(this.host)}get inheritedModules(){return F(this,mt)}handle(e){let{window:{webqit:{Observer:r}}}=q;e.meta.controller?.abort();let n=(e.detail||"").split(/\/|(?<=\w)(?=#)/g).map(a=>a.trim()).filter(a=>a);if(!n.length)return e.respondWith();n=n.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(a=>a==="*"?1/0:a)||[];let o={live:e.live,signal:e.signal,descripted:!0};e.meta.controller=r.reduce(F(this,Q),n,r.get,a=>{if(Array.isArray(a)){if(!a.length){e.respondWith();return}for(let s of a)e.respondWith(s)}else e.respondWith(a.value)},o)}unsubscribed(e){e.meta.controller?.abort()}initialize(e){this.host=e;let{window:{webqit:{Observer:r}}}=q,n=()=>{for(let a of new Set([...Object.keys(this.localModules),...Object.keys(this.inheritedModules),...Object.keys(F(this,Q))]))if(!r.has(this.localModules,a)&&!r.has(this.inheritedModules,a))r.deleteProperty(F(this,Q),a);else if(a==="#"&&r.has(this.localModules,a)&&r.has(this.inheritedModules,a))r.set(F(this,Q),a,[...r.get(this.localModules,a),...r.get(this.inheritedModules,a)]);else{let s=r.get(this.localModules,a)||r.get(this.inheritedModules,a);r.get(F(this,Q),a)!==s&&r.set(F(this,Q),a,s)}};Ct(this,Q,{...this.localModules}),F(this,Ft)?.abort(),Ct(this,Ft,r.observe(this.localModules,()=>n("local"),{timing:"sync"}));let o=this.configs.HTML_IMPORTS;if(this.host.matches&&o.attr.importscontext){let a=this.host.ownerDocument.defaultView.webqit.realdom,s;F(this,Wt)?.disconnect(),Ct(this,Wt,a.realtime(this.host).attr(o.attr.importscontext,(u,{signal:c})=>{let l=(u.value||"").trim();if(l===s)return;s=l,Ct(this,mt,{});let f={...this.constructor.createRequest(l?`${l}/*`:"*"),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,mt)[d.key],Reflect.has(this.localModules,d.key)||r.deleteProperty(F(this,Q),d.key)):(F(this,mt)[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)):(Ct(this,mt,{}),n("inherited"))}),n("inherited")},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(e)}dispose(e){return F(this,Ft)?.abort(),F(this,Wt)?.disconnect(),super.dispose(e)}};mt=new WeakMap,Q=new WeakMap,Ft=new WeakMap,Wt=new WeakMap,W(ft,"kind","html-imports");function Xr(){let{window:i}=q,{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(s){return r.HTML_IMPORTS.elements.import.includes("-")&&s instanceof this?s:S(s).get("import::instance")||new this(s)}constructor(...s){super();let u=s[0]||this;S(u).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>u,configurable:!1});let c={};Object.defineProperty(this,"#",{get:()=>c,configurable:!1}),c.slottedElements=new Set,c.setAnchorNode=l=>(c.anchorNode=l,l),c.live=l=>{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:h})=>{c.moduleRef=d.value;let p=c.moduleRef.includes("#")?c.moduleRef:`${c.moduleRef}#`,v={...ft.createRequest(p),live:h&&!0,signal:h,diff:!p.endsWith("#")};f[r.CONTEXT_API.api.contexts].request(v,O=>{l((O instanceof i.HTMLTemplateElement?[...O.content.children]:Array.isArray(O)?O:O&&[O])||[])})},{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=(l,f)=>{l.replaceWith(c.setAnchorNode(this.createAnchorNode())),c.live(d=>{if(c.originalsRemapped)return this.fill(d);let h=d.map((p,v)=>({el:p,fragmentDef:p.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:p.tagName,i:v}));f.forEach((p,v)=>{let O=p.tagName,g=p.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",w=(v++,h.find(b=>b.tagName===O&&b.fragmentDef===g&&b.i===v));w&&S(p).set("original@imports",w.el),S(p).set("slot@imports",this.el),c.slottedElements.add(p)}),c.originalsRemapped=!0})},c.autoRestore=(l=null)=>{c.autoRestoreRealtime?.disconnect(),l&&l();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],h=>{if(h.exits.forEach(p=>{S(p).delete("slot@imports"),c.slottedElements.delete(p)}),!c.slottedElements.size){if(d.disconnect(),!h.target.isConnected)return;f()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});c.autoRestoreRealtime=d},c.connectedCallback=()=>{c.internalMutation||c.live(l=>this.fill(l))},c.disconnectedCallback=()=>{c.internalMutation||c.die()}}createAnchorNode(){if(i.webqit.env!=="server")return i.document.createTextNode("");let s=i.document.createElement("div");s.textContent=this.el.outerHTML;let u=i.document.createComment(s.innerHTML);return S(u).set("isAnchorNode",!0),u}fill(s,u){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(s)&&(s=new Set(s)),this.el.setAttribute("data-nodecount",s.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(c=>{let l=S(c).get("original@imports");s.has(l)?s.delete(l):(this["#"].slottedElements.delete(c),c.remove())}),s.size&&this.el.isConnected){let c=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(c),this["#"].internalMutation=!1}s.forEach(c=>{let l=c.cloneNode(!0);l.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||l.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),S(l).set("original@imports",c),S(l).set("slot@imports",this.el),this["#"].slottedElements.add(l),this["#"].anchorNode.before(l)})}))}empty(){this["#"].slottedElements.forEach(s=>s.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 sr(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 a=`starts-with(., "${n}")`,s=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${a} and ${s}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,e.webqit.HTMLImportsContext=ft,e.webqit.HTMLImportElement=Xr(),Ki.call(e,t),tn.call(e,t)}function ht(i,t=!0){if(!S(i).has("defs")&&t){let e=Object.create(null);S(i).set("defs",e)}return S(i).get("defs")}function Ki(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 ht(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(a,s=!1,u=null){return r(this,...arguments)}})});function r(n,o,a=!1,s=null){let u={};typeof a=="function"?(s=a,a=!1):typeof a=="object"&&a?u={...a,...u}:u={live:a};let c={...ft.createRequest(o),...u};return n[e.CONTEXT_API.api.contexts].request(c,s)}}function tn(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},HTMLImportElement:o,HTMLImportsContext:a}}=t,s=l=>{let f=l[n.CONTEXT_API.api.contexts];f.find(a.kind)||f.attach(new a)},u=l=>{let f=l[n.CONTEXT_API.api.contexts],d=f.find(a.kind);d&&(!l.isConnected||!l.matches?.(i.importsContextSelector)&&!Object.keys(d.localModules).length)&&f.detach(d)};r.realtime(t.document).query([i.templateSelector,i.importsContextSelector],l=>{l.entrants.forEach(f=>{if(f.matches(i.templateSelector)){let d=it.instance(f);d.ownerContext=f.scoped?f.parentNode:f.getRootNode();let h=ht(d.ownerContext);d.defId&&e.set(h,d.defId,f),s(d.ownerContext)}else s(f)}),l.exits.forEach(f=>{if(f.matches(i.templateSelector)){let d=it.instance(f),h=ht(d.ownerContext);d.defId&&d.ownerContext.isConnected&&e.deleteProperty(h,d.defId),u(d.ownerContext)}else u(f)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(i.elements.import,l=>{l.entrants.forEach(f=>c(f,!0,l)),l.exits.forEach(f=>c(f,!1,l))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function c(l,f){let d=o.instance(l);f?d["#"].connectedCallback():d["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${i.anchorNodeSelector})`,l=>{l.entrants.forEach(f=>{if(S(f).get("isAnchorNode"))return;let d=t.document.createElement("div");d.innerHTML=f.nodeValue,d.innerHTML=d.firstChild.textContent;let h=d.firstChild,p=parseInt(h.getAttribute("data-nodecount")),v=new Set,O=f;for(;(O=O.previousElementSibling)&&O.matches(i.slottedElementsSelector)&&p--;)v.add(O);o.instance(h)["#"].hydrate(f,v)})},{id:"imports:hydration",live:!0,subtree:"cross-roots",timing:"sync"})}function ar(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 a=o[0],s=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(a.type)&&s){a.meta&&(a.meta.target=this);let u=l=>{if(l.stopImmediatePropagation(),l.meta&&(l.meta.target=l.target),!l.answered){if(r.get(s)||r.set(s,new Set),l.type==="contextrequest"&&l.live)r.get(s).add(l);else if(l.type==="contextclaim"){let f=new Set;return r.get(s).forEach(d=>{!l.target.contains(d.target)||!l.detail?.matchEvent?.(d)||(r.get(s).delete(d),f.add(d))}),r.get(s).size||r.delete(s),l.respondWith?.(f)}}};s.addEventListener(a.type,u);let c=n.call(this,...o);return s.removeEventListener(a.type,u),c}return n.call(this,...o)}}),e.webqit.DOMContexts=pt,e.webqit.DOMContext=U,e.webqit.DOMContextRequestEvent=ye(),e.webqit.DOMContextResponse=Et,e.webqit.DuplicateContextError=Pt,en.call(e,t)}function en(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 pt.instance(this)}})})}function lr({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 a=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`style${a}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},rn.call(r,e),nn.call(r,e)}function rn(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 nn(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,a=>{a.entrants.forEach(s=>{if(o.has(s))return;o.add(s);let u=$t(s.textContent),c=CSS.supports("selector(:has(a,b))"),l=s.scoped&&(c?`:has(> style[rand-${u}])`:`[rand-${u}]`),f=s.scoped&&t.CSSScopeRule&&!1,d=s.scoped&&s.parentNode||s.getRootNode();if(d instanceof t.Element){if(d[i.api.styleSheets].push(s),!n)return;(c?s:d).toggleAttribute(`rand-${u}`,!0)}if(!!n)if(s.scoped&&s.hasAttribute("shared")){let h;(h=e.Style.compileCache.get(u))||(h=on.call(t,s,null,f,l),e.Style.compileCache.set(u,h)),Object.defineProperty(s,"sheet",{value:h,configurable:!0}),s.textContent=`
|
|
53
|
+
`;if(h==="$")return`$exec__(this, '${p}', ${v});`;if(l.trim())throw new Error(`Invalid binding: ${l}.`)}).join(`
|
|
54
|
+
`),{webqit:{QuantumModule:o}}=this,{parserParams:a,compilerParams:s,runtimeParams:u}=i.advanced,c=new o(n,{parserParams:a,compilerParams:s,runtimeParams:u});return ir.set(t,c),c}var Ht=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))}),Nt(t,i,`(${e.discreteBindingsSelector})`).forEach(r=>{let n=zr(e,r.nodeValue);Ur.call(t,e,n.expr)})}var Z=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}}}=q;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(Z,"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=Z,Ji.call(e,t),Zi.call(e,t)}function sr(i,t){let e=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:n}}}}=e;if(!S(t).has("bindings")){let o=Object.create(null);S(t).set("bindings",o),r.observe(o,a=>{if(t instanceof e.Element){let s=xe(t.getAttribute(i.attr.bindingsreflection)||""),u=new Map(s);for(let c of a)c.detail?.publish!==!1&&(c.type==="delete"?s.delete(c.key):s.set(c.key,void 0));s.size&&s.size!==u.size?t.setAttribute(i.attr.bindingsreflection,`{ ${[...s.entries()].map(([c,l])=>l===void 0?c:`${c}: ${l}`).join(", ")} }`):s.size||t.toggleAttribute(i.attr.bindingsreflection,!1)}else{let s=t[n.api.contexts];for(let u of a)if(u.type==="delete"){let c=s.find(Z.kind,u.key);c&&s.detach(c)}else s.find(Z.kind,u.key)||s.attach(new Z(u.key))}})}return S(t).get("bindings")}function Ji(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,a={}){return Yi.call(t,i,this,o,a)}}),Object.defineProperty(r,i.api.bindings,{get:function(){return e.proxy(sr.call(t,i,this))}})})}function Yi(i,t,e,{merge:r,diff:n,publish:o,namespace:a}={}){let s=this,{webqit:{Observer:u}}=s,c=sr.call(this,i,t),l={diff:n,namespace:a,detail:{publish:o}},f=r?[]:Object.keys(c).filter(d=>!(d in e));return u.batch(c,()=>(f.length&&u.deleteProperties(c,f,l),u.set(c,e,l)),l)}function Zi(i){let t=this,{webqit:{realdom:e,Observer:r,oohtml:{configs:n}}}=t,o=(s,u)=>{let c=s[n.CONTEXT_API.api.contexts];c.find(Z.kind,u)||c.attach(new Z(u))},a=(s,u)=>{let c,l=s[n.CONTEXT_API.api.contexts];for(;c=l.find(Z.kind,u);)l.detach(c)};e.realtime(t.document).query(`[${t.CSS.escape(i.attr.bindingsreflection)}]`,s=>{s.exits.forEach(u=>a(u)),s.entrants.forEach(u=>{let c=xe(u.getAttribute(i.attr.bindingsreflection)||""),l=[...c.entries()].filter(([f,d])=>d!==void 0);l.length&&u[i.api.bind](Object.fromEntries(l),{merge:!0,publish:!1});for(let[f]of c)o(u,f)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),e.realtime(t.document,"attr").observe(i.attr.bindingsreflection,s=>{let u=sr.call(t,i,s.target),c=xe(s.value||""),l=xe(s.oldValue||"");for(let f of new Set([...c.keys(),...l.keys()]))l.has(f)?c.has(f)?c.get(f)!==l.get(f)&&r.set(u,f,c.get(f),{detail:{publish:!1}}):(l.get(f)!==void 0&&r.deleteProperty(u,f,{detail:{publish:!1}}),a(s.target,f)):(c.get(f)!==void 0&&r.set(u,f,c.get(f),{detail:{publish:!1}}),o(s.target,f))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var xe=i=>(i=i.trim(),new Map(ut(i.slice(1,-1),",").filter(t=>t.trim()).map(t=>ut(t,":").map(e=>e.trim()))));var it=class{static instance(t){return S(t).get("defsmanager::instance")||new this(t)}constructor(t,e=null,r=0){let{window:n}=q,{webqit:{realdom:o,oohtml:{configs:a}}}=n;S(t).get("defsmanager::instance")?.dispose(),S(t).set("defsmanager::instance",this),this.window=n,this.host=t,this.config=a.HTML_IMPORTS,this.parent=e,this.level=r,this.defs=ht(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=o.realtime(this.host.content).children(s=>{this.expose(s.entrants,!0),this.expose(s.exits,!1)},{live:!0,timing:"sync"}),this.realtimeB=o.realtime(this.host).attr(["src","loading"],(...s)=>this.evaluateLoading(...s),{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}=q,{webqit:{Observer:n}}=r,o,a=this.defs["#"]||[];t.forEach(s=>{if(s.nodeType!==1)return;let u=s.matches(this.config.templateSelector),c=(s.getAttribute(u?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();e?(u&&c?new it(s,this.host,this.level+1):(a.push(s),o=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(l=>l.call(this.window,s))})),c&&(this.validateDefId(c),n.set(this.defs,(!u&&"#"||"")+c,s))):(u&&c?it.instance(s).dispose():(a=a.filter(l=>l!==s),o=!0),c&&n.deleteProperty(this.defs,(!u&&"#"||"")+c))}),o&&n.set(this.defs,"#",a)}evaluateLoading([t,e],{signal:r}){let{window:{webqit:{Observer:n}}}=q,o=(t.value||"").trim();if(!o)return;let a,s=l=>{if(!l)return a;a=l.then(()=>c.remove())},u=(e.value||"").trim(),c=n.intercept(this.defs,"get",async(l,f,d)=>(u==="lazy"&&s(this.load(o,!0)),await s(),d()),{signal:r});u!=="lazy"&&s(this.load(o))}load(t){let{window:e}=q;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=(a,s)=>this.host.dispatchEvent(new e.CustomEvent(a,{detail:s})),o=e.fetch(t,{signal:r.signal,element:this.host}).then(a=>a.ok?a.text():Promise.reject(a.statusText)).then(a=>(this.host.innerHTML=a.trim(),n("load"),this.host)).catch(a=>(console.error(`Error fetching the bundle at "${t}": ${a.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}}}=q,e=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(s=>s.trim()).filter(s=>s),n=s=>{s.forEach(u=>{t.get(this.defs,u.key)===u.oldValue&&(["get","set","def"].includes(u.type)?t[u.type.replace("get","set")](this.defs,u.key,u.value):u.type==="delete"&&t.deleteProperty(this.defs,u.key))})},o=[],a=ht(this.parent);return e&&o.push(t.reduce(a,[e,this.config.api.defs,1/0],t.get,n,{live:!0})),r.length&&o.push(t.get(a,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("#")||it.instance(e).dispose()})}};var mt,Q,Ft,Wt,ft=class extends U{constructor(){super(...arguments);Bt(this,mt,{});Bt(this,Q,void 0);Bt(this,Ft,void 0);Bt(this,Wt,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(a=>a.trim());r.targetContext=n,r.detail=o.join("")}else r.detail=e;return r}get localModules(){return ht(this.host)}get inheritedModules(){return F(this,mt)}handle(e){let{window:{webqit:{Observer:r}}}=q;e.meta.controller?.abort();let n=(e.detail||"").split(/\/|(?<=\w)(?=#)/g).map(a=>a.trim()).filter(a=>a);if(!n.length)return e.respondWith();n=n.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(a=>a==="*"?1/0:a)||[];let o={live:e.live,signal:e.signal,descripted:!0};e.meta.controller=r.reduce(F(this,Q),n,r.get,a=>{if(Array.isArray(a)){if(!a.length){e.respondWith();return}for(let s of a)e.respondWith(s)}else e.respondWith(a.value)},o)}unsubscribed(e){e.meta.controller?.abort()}initialize(e){this.host=e;let{window:{webqit:{Observer:r}}}=q,n=()=>{for(let a of new Set([...Object.keys(this.localModules),...Object.keys(this.inheritedModules),...Object.keys(F(this,Q))]))if(!r.has(this.localModules,a)&&!r.has(this.inheritedModules,a))r.deleteProperty(F(this,Q),a);else if(a==="#"&&r.has(this.localModules,a)&&r.has(this.inheritedModules,a))r.set(F(this,Q),a,[...r.get(this.localModules,a),...r.get(this.inheritedModules,a)]);else{let s=r.get(this.localModules,a)||r.get(this.inheritedModules,a);r.get(F(this,Q),a)!==s&&r.set(F(this,Q),a,s)}};Ct(this,Q,{...this.localModules}),F(this,Ft)?.abort(),Ct(this,Ft,r.observe(this.localModules,()=>n("local"),{timing:"sync"}));let o=this.configs.HTML_IMPORTS;if(this.host.matches&&o.attr.importscontext){let a=this.host.ownerDocument.defaultView.webqit.realdom,s;F(this,Wt)?.disconnect(),Ct(this,Wt,a.realtime(this.host).attr(o.attr.importscontext,(u,{signal:c})=>{let l=(u.value||"").trim();if(l===s)return;s=l,Ct(this,mt,{});let f={...this.constructor.createRequest(l?`${l}/*`:"*"),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,mt)[d.key],Reflect.has(this.localModules,d.key)||r.deleteProperty(F(this,Q),d.key)):(F(this,mt)[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)):(Ct(this,mt,{}),n("inherited"))}),n("inherited")},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(e)}dispose(e){return F(this,Ft)?.abort(),F(this,Wt)?.disconnect(),super.dispose(e)}};mt=new WeakMap,Q=new WeakMap,Ft=new WeakMap,Wt=new WeakMap,W(ft,"kind","html-imports");function Xr(){let{window:i}=q,{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(s){return r.HTML_IMPORTS.elements.import.includes("-")&&s instanceof this?s:S(s).get("import::instance")||new this(s)}constructor(...s){super();let u=s[0]||this;S(u).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>u,configurable:!1});let c={};Object.defineProperty(this,"#",{get:()=>c,configurable:!1}),c.slottedElements=new Set,c.setAnchorNode=l=>(c.anchorNode=l,l),c.live=l=>{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:h})=>{c.moduleRef=d.value;let p=c.moduleRef.includes("#")?c.moduleRef:`${c.moduleRef}#`,v={...ft.createRequest(p),live:h&&!0,signal:h,diff:!p.endsWith("#")};f[r.CONTEXT_API.api.contexts].request(v,O=>{l((O instanceof i.HTMLTemplateElement?[...O.content.children]:Array.isArray(O)?O:O&&[O])||[])})},{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=(l,f)=>{l.replaceWith(c.setAnchorNode(this.createAnchorNode())),c.live(d=>{if(c.originalsRemapped)return this.fill(d);let h=d.map((p,v)=>({el:p,fragmentDef:p.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:p.tagName,i:v}));f.forEach((p,v)=>{let O=p.tagName,g=p.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",w=(v++,h.find(b=>b.tagName===O&&b.fragmentDef===g&&b.i===v));w&&S(p).set("original@imports",w.el),S(p).set("slot@imports",this.el),c.slottedElements.add(p)}),c.originalsRemapped=!0})},c.autoRestore=(l=null)=>{c.autoRestoreRealtime?.disconnect(),l&&l();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],h=>{if(h.exits.forEach(p=>{S(p).delete("slot@imports"),c.slottedElements.delete(p)}),!c.slottedElements.size){if(d.disconnect(),!h.target.isConnected)return;f()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});c.autoRestoreRealtime=d},c.connectedCallback=()=>{c.internalMutation||c.live(l=>this.fill(l))},c.disconnectedCallback=()=>{c.internalMutation||c.die()}}createAnchorNode(){if(i.webqit.env!=="server")return i.document.createTextNode("");let s=i.document.createElement("div");s.textContent=this.el.outerHTML;let u=i.document.createComment(s.innerHTML);return S(u).set("isAnchorNode",!0),u}fill(s,u){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(s)&&(s=new Set(s)),this.el.setAttribute("data-nodecount",s.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(c=>{let l=S(c).get("original@imports");s.has(l)?s.delete(l):(this["#"].slottedElements.delete(c),c.remove())}),s.size&&this.el.isConnected){let c=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(c),this["#"].internalMutation=!1}s.forEach(c=>{let l=c.cloneNode(!0);l.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||l.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),S(l).set("original@imports",c),S(l).set("slot@imports",this.el),this["#"].slottedElements.add(l),this["#"].anchorNode.before(l)})}))}empty(){this["#"].slottedElements.forEach(s=>s.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 a=`starts-with(., "${n}")`,s=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${a} and ${s}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,e.webqit.HTMLImportsContext=ft,e.webqit.HTMLImportElement=Xr(),Ki.call(e,t),tn.call(e,t)}function ht(i,t=!0){if(!S(i).has("defs")&&t){let e=Object.create(null);S(i).set("defs",e)}return S(i).get("defs")}function Ki(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 ht(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(a,s=!1,u=null){return r(this,...arguments)}})});function r(n,o,a=!1,s=null){let u={};typeof a=="function"?(s=a,a=!1):typeof a=="object"&&a?u={...a,...u}:u={live:a};let c={...ft.createRequest(o),...u};return n[e.CONTEXT_API.api.contexts].request(c,s)}}function tn(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},HTMLImportElement:o,HTMLImportsContext:a}}=t,s=l=>{let f=l[n.CONTEXT_API.api.contexts];f.find(a.kind)||f.attach(new a)},u=l=>{let f=l[n.CONTEXT_API.api.contexts],d=f.find(a.kind);d&&(!l.isConnected||!l.matches?.(i.importsContextSelector)&&!Object.keys(d.localModules).length)&&f.detach(d)};r.realtime(t.document).query([i.templateSelector,i.importsContextSelector],l=>{l.entrants.forEach(f=>{if(f.matches(i.templateSelector)){let d=it.instance(f);d.ownerContext=f.scoped?f.parentNode:f.getRootNode();let h=ht(d.ownerContext);d.defId&&e.set(h,d.defId,f),s(d.ownerContext)}else s(f)}),l.exits.forEach(f=>{if(f.matches(i.templateSelector)){let d=it.instance(f),h=ht(d.ownerContext);d.defId&&d.ownerContext.isConnected&&e.deleteProperty(h,d.defId),u(d.ownerContext)}else u(f)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(i.elements.import,l=>{l.entrants.forEach(f=>c(f,!0,l)),l.exits.forEach(f=>c(f,!1,l))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function c(l,f){let d=o.instance(l);f?d["#"].connectedCallback():d["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${i.anchorNodeSelector})`,l=>{l.entrants.forEach(f=>{if(S(f).get("isAnchorNode"))return;let d=t.document.createElement("div");d.innerHTML=f.nodeValue,d.innerHTML=d.firstChild.textContent;let h=d.firstChild,p=parseInt(h.getAttribute("data-nodecount")),v=new Set,O=f;for(;(O=O.previousElementSibling)&&O.matches(i.slottedElementsSelector)&&p--;)v.add(O);o.instance(h)["#"].hydrate(f,v)})},{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 a=o[0],s=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(a.type)&&s){a.meta&&(a.meta.target=this);let u=l=>{if(l.stopImmediatePropagation(),l.meta&&(l.meta.target=l.target),!l.answered){if(r.get(s)||r.set(s,new Set),l.type==="contextrequest"&&l.live)r.get(s).add(l);else if(l.type==="contextclaim"){let f=new Set;return r.get(s).forEach(d=>{!l.target.contains(d.target)||!l.detail?.matchEvent?.(d)||(r.get(s).delete(d),f.add(d))}),r.get(s).size||r.delete(s),l.respondWith?.(f)}}};s.addEventListener(a.type,u);let c=n.call(this,...o);return s.removeEventListener(a.type,u),c}return n.call(this,...o)}}),e.webqit.DOMContexts=pt,e.webqit.DOMContext=U,e.webqit.DOMContextRequestEvent=ye(),e.webqit.DOMContextResponse=Et,e.webqit.DuplicateContextError=Pt,en.call(e,t)}function en(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 pt.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 a=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`style${a}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},rn.call(r,e),nn.call(r,e)}function rn(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 nn(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,a=>{a.entrants.forEach(s=>{if(o.has(s))return;o.add(s);let u=$t(s.textContent),c=CSS.supports("selector(:has(a,b))"),l=s.scoped&&(c?`:has(> style[rand-${u}])`:`[rand-${u}]`),f=s.scoped&&t.CSSScopeRule&&!1,d=s.scoped&&s.parentNode||s.getRootNode();if(d instanceof t.Element){if(d[i.api.styleSheets].push(s),!n)return;(c?s:d).toggleAttribute(`rand-${u}`,!0)}if(!!n)if(s.scoped&&s.hasAttribute("shared")){let h;(h=e.Style.compileCache.get(u))||(h=on.call(t,s,null,f,l),e.Style.compileCache.set(u,h)),Object.defineProperty(s,"sheet",{value:h,configurable:!0}),s.textContent=`
|
|
55
55
|
/*[ Shared style sheet ]*/
|
|
56
|
-
`}else{let h=()=>{let p=be(Lt.call(t,d));
|
|
56
|
+
`}else{let h=()=>{let p=be(Lt.call(t,d));lr.call(this,s.sheet,p,!f&&l)};s.isConnected?h():setTimeout(()=>{h()},0)}})},{id:"scoped-css",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants"})}function on(i,t,e,r){let n=this,o=i.textContent,a,s=e&&r?`@scope (${r}) {
|
|
57
57
|
${o.trim()}
|
|
58
|
-
}`:o.trim();try{a=new n.CSSStyleSheet,a.replaceSync(s),
|
|
58
|
+
}`:o.trim();try{a=new n.CSSStyleSheet,a.replaceSync(s),lr.call(this,a,t,!e&&r);let u=()=>i.getRootNode().adoptedStyleSheets.push(a);i.isConnected?u():setTimeout(()=>{u()},0)}catch{let c=n.document.createElement("style");i.after(c),c.textContent=s,a=c.sheet,lr.call(this,a,t,!e&&r)}return a}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
|