@webqit/oohtml 5.0.0 → 5.0.2
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/README.md +42 -35
- package/dist/bindings-api.js +1 -1
- package/dist/bindings-api.js.map +1 -1
- package/dist/context-api.js.map +1 -1
- package/dist/data-binding.js +14 -14
- package/dist/data-binding.js.map +2 -2
- package/dist/html-imports.js +1 -1
- package/dist/html-imports.js.map +2 -2
- package/dist/main.js +29 -29
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +50 -42
- package/dist/main.lite.js.map +3 -3
- package/dist/namespaced-html.js +1 -1
- package/dist/namespaced-html.js.map +2 -2
- package/dist/scoped-css.js +2 -2
- package/dist/scoped-css.js.map +2 -2
- package/dist/scoped-js.js.map +1 -1
- package/package.json +1 -1
- package/src/data-binding/index.js +6 -7
- package/src/html-imports/index.js +0 -1
- package/src/index.lite.js +1 -1
- package/src/namespaced-html/index.js +238 -219
- package/src/util.js +4 -4
- package/test/ii.html +0 -11
- package/test/ii2.html +0 -24
package/dist/main.lite.js
CHANGED
|
@@ -1,63 +1,71 @@
|
|
|
1
|
-
var Fr=Object.defineProperty;var wn=(e,t,i)=>t in e?Fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Pi=(e,t)=>{for(var i in t)Fr(e,i,{get:t[i],enumerable:!0})};var J=(e,t,i)=>(wn(e,typeof t!="symbol"?t+"":t,i),i),jr=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};var et=(e,t,i)=>(jr(e,t,"read from private field"),i?i.call(e):t.get(e)),Pe=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},oe=(e,t,i,r)=>(jr(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);var gr={};Pi(gr,{AsyncLiveFunction:()=>Na,AsyncLiveScript:()=>Ye,LiveFunction:()=>Ta,LiveModule:()=>Je,LiveProgramHandle:()=>Xt,LiveScript:()=>Qe,Observer:()=>M,compile:()=>mr,matchPrologDirective:()=>qe,nextKeyword:()=>Fe,parse:()=>Yt,serialize:()=>we,transform:()=>be});var Ki={};Pi(Ki,{any:()=>Dn,apply:()=>Bi,batch:()=>Gi,construct:()=>ji,defineProperties:()=>jn,defineProperty:()=>Re,deleteProperties:()=>Bn,deleteProperty:()=>Me,get:()=>$t,getOwnPropertyDescriptor:()=>ai,getOwnPropertyDescriptors:()=>qn,getPrototypeOf:()=>Vi,has:()=>oi,intercept:()=>Vn,isExtensible:()=>qi,map:()=>Fn,observe:()=>zi,ownKeys:()=>Fi,path:()=>Rn,preventExtensions:()=>Ui,reduce:()=>Wi,set:()=>Gt,setPrototypeOf:()=>Hi,subtree:()=>Mn});function j(e){return!Array.isArray(e)&&typeof e=="object"&&e}function ue(e){return typeof e}function V(e){return Array.isArray(e)}function le(e){return typeof e=="function"}function Ie(e){return e===null||e===""}function Pt(e){return arguments.length&&(e===void 0||typeof e>"u")}function H(e){return Array.isArray(e)||typeof e=="object"&&e||le(e)}function Ii(e){return Ie(e)||Pt(e)||e===!1||e===0||H(e)&&!Object.keys(e).length}function B(e){return le(e)||e&&{}.toString.call(e)==="[object function]"}function Oe(e){return e instanceof Number||typeof e=="number"}function ht(e){return Oe(e)||e!==!0&&e!==!1&&e!==null&&e!==""&&!isNaN(e*1)}function ce(e){return e instanceof String||typeof e=="string"&&e!==null}function Oi(e){return!ce(e)&&!Pt(e.length)}function ri(e,...t){return t.forEach(i=>{e.indexOf(i)<0&&e.push(i)}),e}function $i(r,t){t=t||Object.prototype,t=t&&!V(t)?[t]:t;for(var i=[],r=r;r&&(!t||t.indexOf(r)<0)&&r.name!=="default";)i.push(r),r=r?Object.getPrototypeOf(r):null;return i}function Ti(e,t){var i=[];return $i(e,t).forEach(r=>{ri(i,...Object.getOwnPropertyNames(r))}),i}function _t(e,t,i=!1,r=!1,s=!1){var n=0,a=e.shift();if((ht(a)||a===!0||a===!1)&&(n=a,a=e.shift()),!e.length)throw new Error("_merge() requires two or more array/objects.");return e.forEach((o,l)=>{!H(o)&&!B(o)||(i?Ti(o):Object.keys(o)).forEach(u=>{if(!!t(u,a,o,l)){var c=a[u],f=o[u];if((V(c)&&V(f)||j(c)&&j(f))&&(n===!0||n>0))a[u]=V(c)&&V(f)?[]:{},_t([ht(n)?n-1:n,a[u],c,f],t,i,r,s);else if(V(a)&&V(o))r?a[u]=f:a.push(f);else try{s?Object.defineProperty(a,u,Object.getOwnPropertyDescriptor(o,u)):a[u]=o[u]}catch{}}})}),a}function $e(...e){return _t(e,(t,i,r)=>!0,!1,!1,!1)}function nt(e,...t){if(!e||!["object","function"].includes(typeof e))throw new Error("Argument #1 must be of type object");let i=e[Symbol.for("wq")];if(i||(i=new si,Object.defineProperty(e,Symbol.for("wq"),{value:i,enumerable:!1,configurable:!1,writable:!1})),!t.length)return i;let r,s;for(;r=t.shift();)(s=i)&&!(i=i.get(r))&&(i=new si,s.set(r,i));return i}var si=class extends Map{};function Q(e,t=!0){return V(e)?e:!t&&j(e)?[e]:e!==!1&&e!==0&&Ii(e)?[]:Oi(e)?Array.prototype.slice.call(e):j(e)?Object.values(e):[e]}var K=(e,...t)=>nt(e,"observerAPI",...t),he=(e,t)=>e instanceof Promise?e.then(t):t(e),ni={};var Wt=class{constructor(t,i){this.registry=t,Object.assign(this,{...i,target:t.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var Te=class extends Wt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),ni.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 i=t,r=this.filter;if(r!==1/0&&(r=Q(r,!1))&&(i=t.filter(n=>r.includes(n.key))),this.params.diff&&(i=i.filter(n=>n.type!=="set"||n.value!==n.oldValue)),!i.length)return;if(["inject","defer"].includes(this.params.recursions)){if(this.emit.recursionTarget){this.emit.recursionTarget.push(...i);return}this.emit.recursionTarget=this.params.recursions==="inject"?i:[]}let s=this.filter===1/0||Array.isArray(this.filter)?this.emit(i,this):this.emit(i[0],this);return he(s,n=>{let a=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&a?.length?this.emit.currentRegistration.fire(a):n})}};var zt=class{constructor(t){this.target=t,this.entries=[]}addRegistration(t){return this.entries.push(t),t}removeRegistration(t){this.entries=this.entries.filter(i=>i!==t)}static _getInstance(t,i,r=!0,s=this.__namespace){if(!H(i))throw new Error(`Subject must be of type object; "${ue(i)}" given!`);let n=this;return s&&K(globalThis,"observerAPI","namespaces").has(t+"-"+s)&&(n=K(globalThis,"observerAPI","namespaces").get(t+"-"+s),t+="-"+s),!K(i,"registry").has(t)&&r&&K(i,"registry").set(t,new n(i)),K(i,"registry").get(t)}static _namespace(t,i,r=null){if(t+="-"+i,arguments.length===2)return K(globalThis,"observerAPI","namespaces").get(t);if(!(r.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${i} must be a subclass of ${this.name}.`);K(globalThis,"observerAPI","namespaces").set(t,r),r.__namespace=i}};var Z=class{constructor(t,i){if(this.target=t,!i.operation)throw new Error("Descriptor operation must be given in definition!");Object.assign(this,i)}};var It=class extends zt{static getInstance(t,i=!0,r=null){return super._getInstance("listeners",...arguments)}static namespace(t,i=null){return super._namespace("listeners",...arguments)}constructor(t){super(t),this.batches=[]}addRegistration(t,i,r){return super.addRegistration(new Te(this,{filter:t,emit:i,params:r}))}emit(t,{eventsArePropertyDescriptors:i=!1,eventIsArrayMethodDescriptor:r=!1}={}){if(this.batches.length){let s=this.batches[0].params.arrayMethodName;this.batches[0].snapshots.push({events:[...t],arrayMethodName:s,eventsArePropertyDescriptors:i,eventIsArrayMethodDescriptor:r});return}this.$emit(this.entries,[{events:t,eventsArePropertyDescriptors:i,eventIsArrayMethodDescriptor:r}])}$emit(t,i){let r=0,s=0,n=0;for(let c of t)r+=1,c.params.withPropertyDescriptors&&(s+=1),c.params.withArrayMethodDescriptors&&(n+=1);let a=[],o=[],l=[],u=[];for(let c of i){let f=c.arrayMethodName,p=c.eventsArePropertyDescriptors,g=c.eventIsArrayMethodDescriptor;for(let m of c.events)if(f&&(m.operation=f),s&&(n&&a.push(m),g||n!==r&&o.push(m)),s!==r){let _=m;if(p){let{target:v,type:y,...b}=m;_=new Z(v,{type:"set",...b}),Object.defineProperty(_,"value","get"in b.value?{get:()=>b.value.get()}:{value:b.value.value}),b.oldValue&&Object.defineProperty(_,"oldValue","get"in b.oldValue?{get:()=>b.oldValue.get()}:{value:b.oldValue.value})}n&&l.push(_),g||n!==r&&u.push(_)}}for(let c of t)c.params.withPropertyDescriptors?c.params.withArrayMethodDescriptors?a.length&&c.fire(a):o.length&&c.fire(o):c.params.withArrayMethodDescriptors?l.length&&c.fire(l):u.length&&c.fire(u)}batch(t,i={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:i});let r=t();return he(r,s=>{let n=this.batches.shift();return n.snapshots.length&&this.$emit(n.entries,n.snapshots),s})}};var Ne=class extends Wt{exec(t,i,r){return this.running||!this.traps[t.operation]?i(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[t.operation](t,r,(...s)=>(this.running=!1,i(...s))))}};var Ot=class extends zt{static getInstance(t,i=!0,r=null){return super._getInstance("traps",...arguments)}static namespace(t,i=null){return super._namespace("traps",...arguments)}addRegistration(t){return super.addRegistration(new Ne(this,t))}emit(t,i=null){let r=this;return function s(n,...a){let o=r.entries[n];return o?o.exec(t,(...l)=>s(n+1,...l),...a):i?i(t,...a):a[0]}(0)}};var Di={};Pi(Di,{accessorize:()=>Nn,proxy:()=>Ri,unaccessorize:()=>Ln,unproxy:()=>Le});var Kr=Symbol("wqOriginal");function Nn(e,t,i={}){e=Mi(e);let r=K(e,"accessorizedProps");function s(l){let u,c=e;do u=Object.getOwnPropertyDescriptor(c,l);while(!u&&(c=Object.getPrototypeOf(c)));return u?{proto:c,descriptor:u}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function n(l){if(r.has(l+""))return!0;let u=s(l);u.getValue=function(p=!1){return p?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},u.setValue=function(p,g=!1){if(this.dirty=!0,g){this.descriptor=p;return}return this.descriptor.set?this.descriptor.set(p)!==!1:(this.descriptor.value=p,!0)},u.intact=function(){let p=Object.getOwnPropertyDescriptor(e,l);return p?.get===f.get&&p?.set===f.set&&r.get(l+"")===this},u.restore=function(){return this.intact()?(this.proto&&this.proto!==e||!this.proto&&!this.dirty?delete e[l]:Object.defineProperty(e,l,this.descriptor),r.delete(l+""),!0):!1},r.set(isNaN(l)?l:parseInt(l),u);let{enumerable:c=!0}=u.descriptor,f={enumerable:c,configurable:!0};("value"in u.descriptor||u.descriptor.set)&&(f.set=function(p){return Gt(this,l,p,i)}),("value"in u.descriptor||u.descriptor.get)&&(f.get=function(){return $t(this,l,i)});try{return Object.defineProperty(e,l,f),!0}catch{return r.delete(l+""),!1}}let o=(Array.isArray(t)?t:t===void 0?Object.keys(e):[t]).map(n);return t===void 0||Array.isArray(t)?o:o[0]}function Ln(e,t,i={}){e=Mi(e);let r=K(e,"accessorizedProps");function s(o){return r.has(o+"")?r.get(o+"").restore():!0}let a=(Array.isArray(t)?t:t===void 0?Object.keys(e):[t]).map(s);return t===void 0||Array.isArray(t)?a:a[0]}function Ri(e,t={},i=void 0){let r=Mi(e);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&K(r,"membraneRef").has(t.membrane))return K(r,"membraneRef").get(t.membrane);let s={apply:(o,l,u)=>Bi(o,l,u,void 0,t),construct:(o,l,u=null)=>ji(o,l,u,t),defineProperty:(o,l,u)=>Re(o,l,u,t),deleteProperty:(o,l)=>Me(o,l,t),get:(o,l,u=null)=>{if(l===Kr)return r;let c={...t,receiver:u},f=$t(o,l,c);return Array.isArray(o)&&typeof f=="function"&&!/^class\s?/.test(Function.prototype.toString.call(f))?Ri(f,{...t,arrayMethodName:l,membrane:u},i):t.chainable&&H(f)&&l!=="prototype"&&!(typeof f=="function"&&/^class\s?|\{\s\[native\scode\]\s\}$/.test(Function.prototype.toString.call(f)))?Ri(f,t,i):f},getOwnPropertyDescriptor:(o,l)=>ai(o,l,t),getPrototypeOf:o=>Vi(o,t),has:(o,l)=>oi(o,l,t),isExtensible:o=>qi(o,t),ownKeys:o=>Fi(o,t),preventExtensions:o=>Ui(o,t),set:(o,l,u,c=null)=>Gt(o,l,u,{...t,receiver:c}),setPrototypeOf:(o,l)=>Hi(o,l,t)},n=i?.(s)||s,a=new Proxy(r,n);return t.membrane&&K(r,"membraneRef").set(t.membrane,a),a}function Le(e){return e&&e[Kr]||e}function Mi(e){if(!e||!H(e))throw new Error("Target must be of type object!");return Le(e)}var De=class extends Array{};function Rn(...e){return new De(...e)}var Kt=class extends Array{};function Mn(){return new Kt}function Dn(){return 1/0}function Wi(e,t,i,r=n=>n,s={}){let n=t instanceof Kt;if(!(!n&&!t?.length))return function a(o,l,u,c){let f=c||l[u.level]instanceof Kt,p=f?1/0:l[u.level],g=f?!1:u.level===l.length-1;return o instanceof Z&&o.operation!=="get"?u={...u,probe:"always"}:u.probe!=="always"&&(u={...u,probe:!g}),i(o,p,(m,..._)=>{let v=S=>{S instanceof Z&&(S.path="key"in S?[S.key]:[],o instanceof Z&&(S.path="key"in S?o.path.concat(S.key):o.path.slice(0),Object.defineProperty(S,"context",{get:()=>o,configurable:!0})))},y=_[0]||{},b=S=>{if(S instanceof Z&&"argumentsList"in S)return;let w=Et(S,!1);return he(w,x=>(S instanceof Z?S.value=x:S=x,a(S,l,{...u,...y,keyInParent:S.key,level:u.level+1},f)))};if(Ve(p)&&Array.isArray(m)){if(m.forEach(v),g)return r(m,..._);f&&m[0]instanceof Z&&(m[0].operation!=="get"||s.asGet)&&r(m,..._);for(let S of m)b(S);return}return v(m),g?r(m,..._):b(m)},u)}(e,t.slice(0),{...s,level:0},n)}function zi(e,t,i,r={}){let s=Et(e,!r.level);if(B(arguments[1])&&([,i,r={}]=arguments,t=1/0),!B(i))throw new Error(`Handler must be a function; "${ue(i)}" given!`);if(t instanceof De||t instanceof Kt)return Wi(s,t,zi,i,r);if(r={...r,descripted:!0},delete r.live,!H(s))return r.probe&&$t(s,t,i,r)||void 0;let n=Xr(s,t,i,r);return r.probe?$t(s,t,n,r):n()}function Vn(e,t,i={}){let r=Et(e);return j(t)||([,,,i={}]=arguments,t={[arguments[1]]:arguments[2]}),Ot.getInstance(r,!0,i.namespace).addRegistration({traps:t,params:i})}function ai(e,t,i=s=>s,r={}){return bt(e,"getOwnPropertyDescriptor",{key:t},i,r)}function qn(e,t,i=s=>s,r={}){return bt(e,"getOwnPropertyDescriptors",{key:t},i,r)}function Vi(e,t=r=>r,i={}){return bt(e,"getPrototypeOf",{},t,i)}function qi(e,t=r=>r,i={}){return bt(e,"isExtensible",{},t,i)}function Fi(e,t=r=>r,i={}){return bt(e,"ownKeys",{},t,i)}function oi(e,t,i=s=>s,r={}){return bt(e,"has",{key:t},i,r)}function $t(e,t,i=s=>s,r={}){let s,n=Et(e,!r.level);return j(i)?[r,i]=[i,a=>a]:r.live&&(s=!0),t instanceof De||t instanceof Kt?Wi(n,t,$t,i,{...r,asGet:!0}):Hn(n,t,a=>{let o=[...a];return function l(u,c,f){if(!c.length)return f(u);let p=c.shift();if(!["string","number","symbol"].includes(typeof p))throw new Error(`Property name/key ${p} invalid.`);function g(v,y=void 0){let b=x=>(v.value=x,l([...u,r.live||r.descripted?v:x],c,f));if(arguments.length>1)return b(y);if(!H(n))return b(n?.[v.key]);let S=K(n,"accessorizedProps",!1),w=S&&S.get(v.key);if(w&&w.intact())return b(w.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let x=Object.getOwnPropertyDescriptor(n,v.key);return b(x)}return b(Reflect.get(n,v.key))}let m=new Z(n,{type:"get",key:p,value:void 0,operation:"get",related:o});if(!H(n))return g(m);let _=Ot.getInstance(n,!1,r.namespace);return _?_.emit(m,g):g(m)}([],a.slice(0),l=>{let u=Ve(t)?l:l[0];return s&&H(n)?Xr(n,t,i,r,e.key)(u):i(u)})},r)}function Gi(e,t,i={}){let r=Et(e);return It.getInstance(r,!0,i.namespace).batch(t,i)}function Fn(e,t,i={}){t=Et(t),e=Et(e);let r=(i.only||[]).slice(0),s=(i.except||[]).slice(0),n=Object.keys(i.spread?[...e]:e).map(u=>isNaN(u)?u:parseInt(u)),a=r.length?r.filter(u=>n.includes(u)):n.filter(u=>!s.includes(u)),o=u=>!Array.isArray(t)||isNaN(u)?u:u-s.filter(c=>c<u).length,l=u=>{let c=ai(e,u,i);"value"in c&&c.writable&&c.enumerable&&c.configurable?Gt(t,o(u),c.value,i):(c.enumerable||i.onlyEnumerable===!1)&&Re(t,u,{...c,configurable:!0},i)};return Gi(t,()=>{a.forEach(l)}),zi(e,u=>{u.filter(c=>r.length?r.includes(c.key):!s.includes(c.key)).forEach(c=>{if(c.type==="delete")return Me(t,o(c.key),i);if(c.type==="def"){(c.value.enumerable||i.onlyEnumerable===!1)&&Re(t,o(c.key),{...c.value,configurable:!0},i);return}l(c.key)})},{...i,withPropertyDescriptors:!0})}function Gt(e,t,i,r=a=>a,s={},n=!1){let a=Et(e),o=[[t,i]];j(t)&&([,,r=u=>u,s={},n=!1]=arguments,o=Object.entries(t)),j(r)&&([n,s,r]=[typeof s=="boolean"?s:n,r,u=>u]);let l=o.map(([u])=>u);return function u(c,f,p){if(!f.length)return p(c);let[g,m]=f.shift();function _(y,b=void 0){let S=C=>(y.status=C,u(c.concat(y),f,p));if(arguments.length>1)return S(y,b);let w=K(a,"accessorizedProps",!1),x=w&&w.get(y.key);return y.type==="def"?(x&&!x.restore()&&S(!1),Object.defineProperty(a,y.key,y.value),S(!0)):x&&x.intact()?S(x.setValue(y.value)):S(Reflect.set(a,y.key,y.value))}function v(y,b){if(s.diff&&m===b)return u(c,f,p);let S=new Z(a,{type:n?"def":"set",key:g,value:m,isUpdate:y,oldValue:b,related:[...l],operation:n?"defineProperty":"set",detail:s.detail}),w=Ot.getInstance(a,!1,s.namespace);return w?w.emit(S,_):_(S)}return oi(a,g,y=>{if(!y)return v(y);if(g==="length"&&Array.isArray(a)&&K(a).has("$length"))return v(!0,K(a).get("$length"));let b={...s,withPropertyDescriptors:n};return $t(a,g,S=>v(y,S),b)},s)}([],o.slice(0),u=>{let c=It.getInstance(a,!1,s.namespace);return c&&c.emit(u,{eventsArePropertyDescriptors:!!n}),r(Ve(t)?u.map(f=>f.status):u[0]?.status)})}function Re(e,t,i,r=n=>n,s={}){return Gt(e,t,i,r,s,!0)}function jn(e,t,i=s=>s,r={}){return Gt(e,t,i,r,!0)}function Me(e,t,i=s=>s,r={}){let s=Et(e);j(i)&&([r,i]=[i,o=>o]);let n=Q(t,!1),a=[...n];return function o(l,u,c){if(!u.length)return c(l);let f=u.shift();function p(m,_=void 0){let v=S=>(m.status=S,o(l.concat(m),u,c));if(arguments.length>1)return v(m,_);let y=K(s,"accessorizedProps",!1),b=y&&y.get(m.key);return b&&!b.restore()&&v(!1),v(Reflect.deleteProperty(s,m.key))}function g(m){let _=new Z(s,{type:"delete",key:f,oldValue:m,related:[...a],operation:"deleteProperty",detail:r.detail}),v=Ot.getInstance(s,!1,r.namespace);return v?v.emit(_,p):p(_)}return $t(s,f,g,r)}([],n.slice(0),o=>{let l=It.getInstance(s,!1,r.namespace);return l&&l.emit(o),i(Ve(t)?o.map(u=>u.status):o[0].status)})}function Bn(e,t,i=s=>s,r={}){return Me(...arguments)}function ji(e,t,i=null,r=n=>n,s={}){return bt(e,"construct",arguments.length>2?{argumentsList:t,newTarget:i}:{argumentsList:t},r,s)}function Bi(e,t,i,r=n=>n,s={}){let n=Le(t),a;if(Array.isArray(t)){if(s.arrayMethodName){let o=new Z(n,{operation:s.arrayMethodName,argumentsList:i});It.getInstance(n,!1,s.namespace)?.emit([o],{eventIsArrayMethodDescriptor:!0})}K(n).set("$length",n.length),a=Gi(n,()=>bt(e,"apply",{thisArgument:t,argumentsList:i},r,s),s),K(n).delete("$length")}else a=bt(e,"apply",{thisArgument:n,argumentsList:i},r,s);return a}function Hi(e,t,i=s=>s,r={}){return bt(e,"setPrototypeOf",{proto:t},i,r)}function Ui(e,t=r=>r,i={}){return bt(e,"preventExtensions",{},t,i)}function Xr(e,t,i,r={}){let s=new AbortController;ni.setMaxListeners?.(0,s.signal),r.signal&&r.signal.addEventListener("abort",()=>s.abort());let n={...r,signal:s.signal},a=It.getInstance(e,!0,n.namespace),o=new Map;return function l(u=[],c=null){let f,p,g;if(Ve(t)){if(c){g=!0,p=c;for(let m of u)o.get(m.key)?.remove(),o.delete(m.key)}else p=a.addRegistration(t,l,n);f={signal:p.signal,childRegistrations:o}}else c?.remove(),p=a.addRegistration(t,l,n),f={signal:p.signal};if(n.childRegistrations&&n.keyInParent&&n.childRegistrations.set(n.keyInParent,p),arguments.length){let m=i(u,f);if(arguments.length>1)return m}return s}}function bt(e,t,i={},r=n=>n,s={}){e=Et(e),j(r)&&([s,r]=[r,l=>l]);function n(l,u){return arguments.length>1?r(u):r((Reflect[t]||Object[t])(e,...Object.values(i)))}let a=new Z(e,{operation:t,...i}),o=Ot.getInstance(e,!1,s.namespace);return o?o.emit(a,n):n(a)}function Ve(e){return e===1/0||Array.isArray(e)}function Et(e,t=!0,i=!0){if((!e||!H(e))&&t)throw new Error(`Object must be of type object or array! "${ue(e)}" given.`);return e instanceof Z&&(e.type==="def"&&i?e=typeof e.value.get=="function"?e.value.get():e.value.value:e=e.value),e&&Le(e)}function Hn(e,t,i,r={}){return t===1/0?r.level&&!H(e)?i([]):i(Object.entries(Object.getOwnPropertyDescriptors(e)).filter(([,s])=>s.writable!==!1&&!s.get&&!s.set).map(([s])=>s)):i(Q(t,!1))}var Un={...Ki,...Di},M=Un;var Xt=class{constructor(t){Object.defineProperty(this,Symbol.toStringTag,{value:"LiveProgramHandle"}),Object.defineProperty(this,"runtime",{value:t});let i={statechange:()=>{M.defineProperty(this,"value",{value:t.flowControl.get("return")?.arg,enumerable:!0,configurable:!0})}};for(let r in i)t.on(r,i[r]),i[r]();t.$params.sourceType==="module"&&Object.defineProperty(this,"exports",{value:t.exports})}abort(){return this.runtime.abort(!0)}};var Xi=(e,...t)=>{let i=t.pop();if(e.constructor.name==="AsyncFunction")return it(e.call(...t),i);try{return i(e.call(...t))}catch(r){return i(void 0,r)}},it=(e,t)=>e instanceof Promise?e.then(t).catch(i=>t(void 0,i)):t(e),Qi=e=>typeof e=="object"&&e||typeof e=="function";function Yi(e){let t=typeof e[e.length-1]=="object"?e.pop():{};return{source:e.pop()||"",args:e,params:t}}var Qr={};function qe(e,t=!1){return t?/^(["'])use live\1\s*(;|$)/.test(e):/(["'])use live\1\s*(;|$)/.test(e)}function Fe(e,t=0,i=null){let r=t,s=e.length,n=()=>{for(;r<s&&/\s/.test(e[r]);)r++},a=()=>{for(r+=2;r<s&&e[r]!==`
|
|
2
|
-
`&&e[r]!=="\r";)r++},o=()=>{for(r+=2;r<s&&!(e[r]==="*"&&e[r+1]==="/");)r++;r<s&&(r+=2)};for(;r<s;){if(n(),e[r]==="/"&&e[r+1]==="/"){a();continue}if(e[r]==="/"&&e[r+1]==="*"){o();continue}break}if(i===0)return e.slice(r);let l=r;if(r<s&&/[A-Za-z$_]/.test(e[r])){for(r++;r<s&&/[A-Za-z0-9$_]/.test(e[r]);)r++;return e.slice(l,r)}return i===1&&r<s?e[r]:null}var Wn=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],es=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,3104,541,1507,4938,6,4191],zn="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F",is="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Ji={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Zi="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Gn={5:Zi,"5module":Zi+" export import",6:Zi+" const class extends export import super"},Kn=/^in(stanceof)?$/,Xn=new RegExp("["+is+"]"),Qn=new RegExp("["+is+zn+"]");function er(e,t){for(var i=65536,r=0;r<t.length;r+=2){if(i+=t[r],i>e)return!1;if(i+=t[r+1],i>=e)return!0}return!1}function Nt(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Xn.test(String.fromCharCode(e)):t===!1?!1:er(e,es)}function fe(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Qn.test(String.fromCharCode(e)):t===!1?!1:er(e,es)||er(e,Wn)}var q=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function ft(e,t){return new q(e,{beforeExpr:!0,binop:t})}var pt={beforeExpr:!0},at={startsExpr:!0},sr={};function R(e,t){return t===void 0&&(t={}),t.keyword=e,sr[e]=new q(e,t)}var h={num:new q("num",at),regexp:new q("regexp",at),string:new q("string",at),name:new q("name",at),privateId:new q("privateId",at),eof:new q("eof"),bracketL:new q("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new q("]"),braceL:new q("{",{beforeExpr:!0,startsExpr:!0}),braceR:new q("}"),parenL:new q("(",{beforeExpr:!0,startsExpr:!0}),parenR:new q(")"),comma:new q(",",pt),semi:new q(";",pt),colon:new q(":",pt),dot:new q("."),question:new q("?",pt),questionDot:new q("?."),arrow:new q("=>",pt),template:new q("template"),invalidTemplate:new q("invalidTemplate"),ellipsis:new q("...",pt),backQuote:new q("`",at),dollarBraceL:new q("${",{beforeExpr:!0,startsExpr:!0}),eq:new q("=",{beforeExpr:!0,isAssign:!0}),assign:new q("_=",{beforeExpr:!0,isAssign:!0}),incDec:new q("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new q("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ft("||",1),logicalAND:ft("&&",2),bitwiseOR:ft("|",3),bitwiseXOR:ft("^",4),bitwiseAND:ft("&",5),equality:ft("==/!=/===/!==",6),relational:ft("</>/<=/>=",7),bitShift:ft("<</>>/>>>",8),plusMin:new q("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ft("%",10),star:ft("*",10),slash:ft("/",10),starstar:new q("**",{beforeExpr:!0}),coalesce:ft("??",1),_break:R("break"),_case:R("case",pt),_catch:R("catch"),_continue:R("continue"),_debugger:R("debugger"),_default:R("default",pt),_do:R("do",{isLoop:!0,beforeExpr:!0}),_else:R("else",pt),_finally:R("finally"),_for:R("for",{isLoop:!0}),_function:R("function",at),_if:R("if"),_return:R("return",pt),_switch:R("switch"),_throw:R("throw",pt),_try:R("try"),_var:R("var"),_const:R("const"),_while:R("while",{isLoop:!0}),_with:R("with"),_new:R("new",{beforeExpr:!0,startsExpr:!0}),_this:R("this",at),_super:R("super",at),_class:R("class",at),_extends:R("extends",pt),_export:R("export"),_import:R("import",at),_null:R("null",at),_true:R("true",at),_false:R("false",at),_in:R("in",{beforeExpr:!0,binop:7}),_instanceof:R("instanceof",{beforeExpr:!0,binop:7}),_typeof:R("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:R("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:R("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},mt=/\r\n?|\n|\u2028|\u2029/,Yn=new RegExp(mt.source,"g");function pe(e){return e===10||e===13||e===8232||e===8233}function rs(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var s=e.charCodeAt(r);if(pe(s))return r<i-1&&s===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var ss=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,dt=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ns=Object.prototype,Jn=ns.hasOwnProperty,Zn=ns.toString,Ue=Object.hasOwn||function(e,t){return Jn.call(e,t)},Yr=Array.isArray||function(e){return Zn.call(e)==="[object Array]"};function Qt(e){return new RegExp("^(?:"+e.replace(/ /g,"|")+")$")}function qt(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var ta=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Be=function(t,i){this.line=t,this.column=i};Be.prototype.offset=function(t){return new Be(this.line,this.column+t)};var fi=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function as(e,t){for(var i=1,r=0;;){var s=rs(e,r,t);if(s<0)return new Be(i,t-r);++i,r=s}}var ir={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Jr=!1;function ea(e){var t={};for(var i in ir)t[i]=e&&Ue(e,i)?e[i]:ir[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Jr&&typeof console=="object"&&console.warn&&(Jr=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
3
|
-
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Yr(t.onToken)){var r=t.onToken;t.onToken=function(s){return r.push(s)}}return Yr(t.onComment)&&(t.onComment=ia(t,t.onComment)),t}function ia(e,t){return function(i,r,s,n,a,o){var l={type:i?"Block":"Line",value:r,start:s,end:n};e.locations&&(l.loc=new fi(this,a,o)),e.ranges&&(l.range=[s,n]),t.push(l)}}var He=1,de=2,nr=4,os=8,us=16,ls=32,ar=64,cs=128,We=256,or=He|de|We;function ur(e,t){return de|(e?nr:0)|(t?os:0)}var li=0,lr=1,Tt=2,hs=3,fs=4,ps=5,Y=function(t,i,r){this.options=t=ea(t),this.sourceFile=t.sourceFile,this.keywords=Qt(Gn[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var s="";t.allowReserved!==!0&&(s=Ji[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(s+=" await")),this.reservedWords=Qt(s);var n=(s?s+" ":"")+Ji.strict;this.reservedWordsStrict=Qt(n),this.reservedWordsStrictBind=Qt(n+" "+Ji.strictBind),this.input=String(i),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf(`
|
|
4
|
-
`,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(mt).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=h.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(He),this.regexpState=null,this.privateNameStack=[]},Ct={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Y.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};Ct.inFunction.get=function(){return(this.currentVarScope().flags&de)>0};Ct.inGenerator.get=function(){return(this.currentVarScope().flags&os)>0&&!this.currentVarScope().inClassFieldInit};Ct.inAsync.get=function(){return(this.currentVarScope().flags&nr)>0&&!this.currentVarScope().inClassFieldInit};Ct.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&We)return!1;if(t.flags&de)return(t.flags&nr)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Ct.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&ar)>0||i||this.options.allowSuperOutsideMethod};Ct.allowDirectSuper.get=function(){return(this.currentThisScope().flags&cs)>0};Ct.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Ct.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(de|We))>0||i};Ct.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&We)>0};Y.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,s=0;s<t.length;s++)r=t[s](r);return r};Y.parse=function(t,i){return new this(i,t).parse()};Y.parseExpressionAt=function(t,i,r){var s=new this(r,t,i);return s.nextToken(),s.parseExpression()};Y.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(Y.prototype,Ct);var rt=Y.prototype,ra=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;rt.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){dt.lastIndex=e,e+=dt.exec(this.input)[0].length;var t=ra.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){dt.lastIndex=e+t[0].length;var i=dt.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||mt.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,dt.lastIndex=e,e+=dt.exec(this.input)[0].length,this.input[e]===";"&&e++}};rt.eat=function(e){return this.type===e?(this.next(),!0):!1};rt.isContextual=function(e){return this.type===h.name&&this.value===e&&!this.containsEsc};rt.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};rt.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};rt.canInsertSemicolon=function(){return this.type===h.eof||this.type===h.braceR||mt.test(this.input.slice(this.lastTokEnd,this.start))};rt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};rt.semicolon=function(){!this.eat(h.semi)&&!this.insertSemicolon()&&this.unexpected()};rt.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};rt.expect=function(e){this.eat(e)||this.unexpected()};rt.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var pi=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};rt.checkPatternErrors=function(e,t){if(!!e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};rt.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")};rt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};rt.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var O=Y.prototype;O.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==h.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var n=s[r];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var cr={kind:"loop"},sa={kind:"switch"};O.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;dt.lastIndex=this.pos;var t=dt.exec(this.input),i=this.pos+t[0].length,r=this.input.charCodeAt(i);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(Nt(r,!0)){for(var s=i+1;fe(r=this.input.charCodeAt(s),!0);)++s;if(r===92||r>55295&&r<56320)return!0;var n=this.input.slice(i,s);if(!Kn.test(n))return!0}return!1};O.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;dt.lastIndex=this.pos;var e=dt.exec(this.input),t=this.pos+e[0].length,i;return!mt.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(fe(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};O.parseStatement=function(e,t,i){var r=this.type,s=this.startNode(),n;switch(this.isLet(e)&&(r=h._var,n="let"),r){case h._break:case h._continue:return this.parseBreakContinueStatement(s,r.keyword);case h._debugger:return this.parseDebuggerStatement(s);case h._do:return this.parseDoStatement(s);case h._for:return this.parseForStatement(s);case h._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case h._class:return e&&this.unexpected(),this.parseClass(s,!0);case h._if:return this.parseIfStatement(s);case h._return:return this.parseReturnStatement(s);case h._switch:return this.parseSwitchStatement(s);case h._throw:return this.parseThrowStatement(s);case h._try:return this.parseTryStatement(s);case h._const:case h._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(s,n);case h._while:return this.parseWhileStatement(s);case h._with:return this.parseWithStatement(s);case h.braceL:return this.parseBlock(!0,s);case h.semi:return this.parseEmptyStatement(s);case h._export:case h._import:if(this.options.ecmaVersion>10&&r===h._import){dt.lastIndex=this.pos;var a=dt.exec(this.input),o=this.pos+a[0].length,l=this.input.charCodeAt(o);if(l===40||l===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===h._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var u=this.value,c=this.parseExpression();return r===h.name&&c.type==="Identifier"&&this.eat(h.colon)?this.parseLabeledStatement(s,u,c,e):this.parseExpressionStatement(s,c)}};O.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(h.semi)||this.insertSemicolon()?e.label=null:this.type!==h.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((e.label==null||s.name===e.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")};O.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};O.parseDoStatement=function(e){return this.next(),this.labels.push(cr),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(h._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(h.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};O.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(cr),this.enterScope(0),this.expect(h.parenL),this.type===h.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===h._var||this.type===h._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),(this.type===h._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===h._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var n=this.isContextual("let"),a=!1,o=new pi,l=this.parseExpression(t>-1?"await":!0,o);return this.type===h._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===h._in?t>-1&&this.unexpected(t):e.await=t>-1),n&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,o),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(o,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};O.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,je|(i?0:rr),!1,t)};O.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(h._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};O.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(h.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};O.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(h.braceL),this.labels.push(sa),this.enterScope(0);for(var t,i=!1;this.type!==h.braceR;)if(this.type===h._case||this.type===h._default){var r=this.type===h._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(h.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};O.parseThrowStatement=function(e){return this.next(),mt.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var na=[];O.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===h._catch){var t=this.startNode();if(this.next(),this.eat(h.parenL)){t.param=this.parseBindingAtom();var i=t.param.type==="Identifier";this.enterScope(i?ls:0),this.checkLValPattern(t.param,i?fs:Tt),this.expect(h.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0);t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(h._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};O.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")};O.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(cr),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};O.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};O.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};O.parseLabeledStatement=function(e,t,i,r){for(var s=0,n=this.labels;s<n.length;s+=1){var a=n[s];a.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===h._switch?"switch":null,l=this.labels.length-1;l>=0;l--){var u=this.labels[l];if(u.statementStart===e.start)u.statementStart=this.start,u.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};O.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};O.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(h.braceL),e&&this.enterScope(0);this.type!==h.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};O.parseFor=function(e,t){return e.init=t,this.expect(h.semi),e.test=this.type===h.semi?null:this.parseExpression(),this.expect(h.semi),e.update=this.type===h.parenR?null:this.parseExpression(),this.expect(h.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};O.parseForIn=function(e,t){var i=this.type===h._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(h.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};O.parseVar=function(e,t,i){for(e.declarations=[],e.kind=i;;){var r=this.startNode();if(this.parseVarId(r,i),this.eat(h.eq)?r.init=this.parseMaybeAssign(t):i==="const"&&!(this.type===h._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():r.id.type!=="Identifier"&&!(t&&(this.type===h._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(h.comma))break}return e};O.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?lr:Tt,!1)};var je=1,rr=2,ds=4;O.parseFunction=function(e,t,i,r,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===h.star&&t&rr&&this.unexpected(),e.generator=this.eat(h.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&je&&(e.id=t&ds&&this.type!==h.name?null:this.parseIdent(),e.id&&!(t&rr)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?lr:Tt:hs));var n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ur(e.async,e.generator)),t&je||(e.id=this.type===h.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&je?"FunctionDeclaration":"FunctionExpression")};O.parseFunctionParams=function(e){this.expect(h.parenL),e.params=this.parseBindingList(h.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};O.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(h.braceL);this.type!==h.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(s.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(n&&this.raise(a.start,"Duplicate constructor in the same class"),n=!0):a.key&&a.key.type==="PrivateIdentifier"&&aa(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};O.parseClassElement=function(e){if(this.eat(h.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(h.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===h.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===h.star)&&!this.canInsertSemicolon()?n=!0:r="async"),!r&&(t>=9||!n)&&this.eat(h.star)&&(s=!0),!r&&!n&&!s){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=l:r=l)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===h.parenL||a!=="method"||s||n){var u=!i.static&&ci(i,"constructor"),c=u&&e;u&&a!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=u?"constructor":a,this.parseClassMethod(i,s,n,c)}else this.parseClassField(i);return i};O.isClassElementNameStart=function(){return this.type===h.name||this.type===h.privateId||this.type===h.num||this.type===h.string||this.type===h.bracketL||this.type.keyword};O.parseClassElementName=function(e){this.type===h.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};O.parseClassMethod=function(e,t,i,r){var s=e.key;e.kind==="constructor"?(t&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):e.static&&ci(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};O.parseClassField=function(e){if(ci(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ci(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(h.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};O.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(We|ar);this.type!==h.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};O.parseClassId=function(e,t){this.type===h.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Tt,!1)):(t===!0&&this.unexpected(),e.id=null)};O.parseClassSuper=function(e){e.superClass=this.eat(h._extends)?this.parseExprSubscripts(null,!1):null};O.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};O.exitClassBody=function(){for(var e=this.privateNameStack.pop(),t=e.declared,i=e.used,r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],n=0;n<i.length;++n){var a=i[n];Ue(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function aa(e,t){var i=t.key.name,r=e[i],s="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(s=(t.static?"s":"i")+t.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(e[i]="true",!1):r?!0:(e[i]=s,!1)}function ci(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}O.parseExport=function(e,t){if(this.next(),this.eat(h.star))return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==h.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration");if(this.eat(h._default)){this.checkExport(t,"default",this.lastTokStart);var i;if(this.type===h._function||(i=this.isAsyncFunction())){var r=this.startNode();this.next(),i&&this.next(),e.declaration=this.parseFunction(r,je|ds,!1,i)}else if(this.type===h._class){var s=this.startNode();e.declaration=this.parseClass(s,"nullableID")}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(null),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==h.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var n=0,a=e.specifiers;n<a.length;n+=1){var o=a[n];this.checkUnreserved(o.local),this.checkLocalExport(o.local),o.local.type==="Literal"&&this.raise(o.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};O.checkExport=function(e,t,i){!e||(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ue(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};O.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var r=0,s=t.properties;r<s.length;r+=1){var n=s[r];this.checkPatternExport(e,n)}else if(i==="ArrayPattern")for(var a=0,o=t.elements;a<o.length;a+=1){var l=o[a];l&&this.checkPatternExport(e,l)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"?this.checkPatternExport(e,t.argument):i==="ParenthesizedExpression"&&this.checkPatternExport(e,t.expression)};O.checkVariableExport=function(e,t){if(!!e)for(var i=0,r=t;i<r.length;i+=1){var s=r[i];this.checkPatternExport(e,s.id)}};O.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};O.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(h.braceL);!this.eat(h.braceR);){if(i)i=!1;else if(this.expect(h.comma),this.afterTrailingComma(h.braceR))break;var r=this.startNode();r.local=this.parseModuleExportName(),r.exported=this.eatContextual("as")?this.parseModuleExportName():r.local,this.checkExport(e,r.exported,r.exported.start),t.push(this.finishNode(r,"ExportSpecifier"))}return t};O.parseImport=function(e){return this.next(),this.type===h.string?(e.specifiers=na,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===h.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};O.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===h.name){var i=this.startNode();if(i.local=this.parseIdent(),this.checkLValSimple(i.local,Tt),e.push(this.finishNode(i,"ImportDefaultSpecifier")),!this.eat(h.comma))return e}if(this.type===h.star){var r=this.startNode();return this.next(),this.expectContextual("as"),r.local=this.parseIdent(),this.checkLValSimple(r.local,Tt),e.push(this.finishNode(r,"ImportNamespaceSpecifier")),e}for(this.expect(h.braceL);!this.eat(h.braceR);){if(t)t=!1;else if(this.expect(h.comma),this.afterTrailingComma(h.braceR))break;var s=this.startNode();s.imported=this.parseModuleExportName(),this.eatContextual("as")?s.local=this.parseIdent():(this.checkUnreserved(s.imported),s.local=s.imported),this.checkLValSimple(s.local,Tt),e.push(this.finishNode(s,"ImportSpecifier"))}return e};O.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===h.string){var e=this.parseLiteral(this.value);return ta.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};O.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)};O.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var vt=Y.prototype;vt.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.toAssignable(n,t),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e};vt.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var s=e[r];s&&this.toAssignable(s,t)}if(i){var n=e[i-1];this.options.ecmaVersion===6&&t&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return e};vt.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};vt.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==h.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};vt.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case h.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(h.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case h.braceL:return this.parseObj(!0)}return this.parseIdent()};vt.parseBindingList=function(e,t,i){for(var r=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(h.comma),t&&this.type===h.comma)r.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===h.ellipsis){var n=this.parseRestBinding();this.parseBindingListItem(n),r.push(n),this.type===h.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else{var a=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(a),r.push(a)}}return r};vt.parseBindingListItem=function(e){return e};vt.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(h.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};vt.checkLValSimple=function(e,t,i){t===void 0&&(t=li);var r=t!==li;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(t===Tt&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Ue(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==ps&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}};vt.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=li),e.type){case"ObjectPattern":for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var l=o[a];l&&this.checkLValInnerPattern(l,t,i)}break;default:this.checkLValSimple(e,t,i)}};vt.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=li),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var wt=function(t,i,r,s,n){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!n},W={b_stat:new wt("{",!1),b_expr:new wt("{",!0),b_tmpl:new wt("${",!1),p_stat:new wt("(",!1),p_expr:new wt("(",!0),q_tmpl:new wt("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new wt("function",!1),f_expr:new wt("function",!0),f_expr_gen:new wt("function",!0,!1,null,!0),f_gen:new wt("function",!1,!1,null,!0)},me=Y.prototype;me.initialContext=function(){return[W.b_stat]};me.curContext=function(){return this.context[this.context.length-1]};me.braceIsBlock=function(e){var t=this.curContext();return t===W.f_expr||t===W.f_stat?!0:e===h.colon&&(t===W.b_stat||t===W.b_expr)?!t.isExpr:e===h._return||e===h.name&&this.exprAllowed?mt.test(this.input.slice(this.lastTokEnd,this.start)):e===h._else||e===h.semi||e===h.eof||e===h.parenR||e===h.arrow?!0:e===h.braceL?t===W.b_stat:e===h._var||e===h._const||e===h.name?!1:!this.exprAllowed};me.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};me.updateContext=function(e){var t,i=this.type;i.keyword&&e===h.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};me.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};h.parenR.updateContext=h.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===W.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};h.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?W.b_stat:W.b_expr),this.exprAllowed=!0};h.dollarBraceL.updateContext=function(){this.context.push(W.b_tmpl),this.exprAllowed=!0};h.parenL.updateContext=function(e){var t=e===h._if||e===h._for||e===h._with||e===h._while;this.context.push(t?W.p_stat:W.p_expr),this.exprAllowed=!0};h.incDec.updateContext=function(){};h._function.updateContext=h._class.updateContext=function(e){e.beforeExpr&&e!==h._else&&!(e===h.semi&&this.curContext()!==W.p_stat)&&!(e===h._return&&mt.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===h.colon||e===h.braceL)&&this.curContext()===W.b_stat)?this.context.push(W.f_expr):this.context.push(W.f_stat),this.exprAllowed=!1};h.backQuote.updateContext=function(){this.curContext()===W.q_tmpl?this.context.pop():this.context.push(W.q_tmpl),this.exprAllowed=!1};h.star.updateContext=function(e){if(e===h._function){var t=this.context.length-1;this.context[t]===W.f_expr?this.context[t]=W.f_expr_gen:this.context[t]=W.f_gen}this.exprAllowed=!0};h.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==h.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var T=Y.prototype;T.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}s="$"+s;var a=t[s];if(a){var o;n==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[n],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=t[s]={init:!1,get:!1,set:!1};a[n]=!0}};T.parseExpression=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===h.comma){var n=this.startNodeAt(i,r);for(n.expressions=[s];this.eat(h.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s};T.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new pi,r=!0);var o=this.start,l=this.startLoc;(this.type===h.parenL||this.type===h.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var u=this.parseMaybeConditional(e,t);if(i&&(u=i.call(this,u,o,l)),this.type.isAssign){var c=this.startNodeAt(o,l);return c.operator=this.value,this.type===h.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===h.eq?this.checkLValPattern(u):this.checkLValSimple(u),c.left=u,this.next(),c.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(c,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),u};T.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(h.question)){var n=this.startNodeAt(i,r);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(h.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s};T.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,e)};T.parseExprOp=function(e,t,i,r,s){var n=this.type.binop;if(n!=null&&(!s||this.type!==h._in)&&n>r){var a=this.type===h.logicalOR||this.type===h.logicalAND,o=this.type===h.coalesce;o&&(n=h.logicalAND.binop);var l=this.value;this.next();var u=this.start,c=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),u,c,n,s),p=this.buildBinary(t,i,e,f,l,a||o);return(a&&this.type===h.coalesce||o&&(this.type===h.logicalOR||this.type===h.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(p,t,i,r,s)}return e};T.buildBinary=function(e,t,i,r,s,n){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=s,a.right=r,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")};T.parseMaybeUnary=function(e,t,i,r){var s=this.start,n=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),l=this.type===h.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,l,r),this.checkExpressionErrors(e,!0),l?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&o.argument.type==="Identifier"?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&ms(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,a=this.finishNode(o,l?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===h.privateId)(r||this.privateNameStack.length===0)&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==h._in&&this.unexpected();else{if(a=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(s,n);u.operator=this.value,u.prefix=!1,u.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(u,"UpdateExpression")}}if(!i&&this.eat(h.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(s,n,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function ms(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&ms(e.expression)}T.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprAtom(e,t);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var n=this.parseSubscripts(s,i,r,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};T.parseSubscripts=function(e,t,i,r,s){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,r,n,a,s);if(o.optional&&(a=!0),o===e||o.type==="ArrowFunctionExpression"){if(a){var l=this.startNodeAt(t,i);l.expression=o,o=this.finishNode(l,"ChainExpression")}return o}e=o}};T.parseSubscript=function(e,t,i,r,s,n,a){var o=this.options.ecmaVersion>=11,l=o&&this.eat(h.questionDot);r&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(h.bracketL);if(u||l&&this.type!==h.parenL&&this.type!==h.backQuote||this.eat(h.dot)){var c=this.startNodeAt(t,i);c.object=e,u?(c.property=this.parseExpression(),this.expect(h.bracketR)):this.type===h.privateId&&e.type!=="Super"?c.property=this.parsePrivateIdent():c.property=this.parseIdent(this.options.allowReserved!=="never"),c.computed=!!u,o&&(c.optional=l),e=this.finishNode(c,"MemberExpression")}else if(!r&&this.eat(h.parenL)){var f=new pi,p=this.yieldPos,g=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var _=this.parseExprList(h.parenR,this.options.ecmaVersion>=8,!1,f);if(s&&!l&&!this.canInsertSemicolon()&&this.eat(h.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=p,this.awaitPos=g,this.awaitIdentPos=m,this.parseArrowExpression(this.startNodeAt(t,i),_,!0,a);this.checkExpressionErrors(f,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=g||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var v=this.startNodeAt(t,i);v.callee=e,v.arguments=_,o&&(v.optional=l),e=this.finishNode(v,"CallExpression")}else if(this.type===h.backQuote){(l||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,i);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e};T.parseExprAtom=function(e,t){this.type===h.slash&&this.readRegexp();var i,r=this.potentialArrowAt===this.start;switch(this.type){case h._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===h.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==h.dot&&this.type!==h.bracketL&&this.type!==h.parenL&&this.unexpected(),this.finishNode(i,"Super");case h._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case h.name:var s=this.start,n=this.startLoc,a=this.containsEsc,o=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!a&&o.name==="async"&&!this.canInsertSemicolon()&&this.eat(h._function))return this.overrideContext(W.f_expr),this.parseFunction(this.startNodeAt(s,n),0,!1,!0,t);if(r&&!this.canInsertSemicolon()){if(this.eat(h.arrow))return this.parseArrowExpression(this.startNodeAt(s,n),[o],!1,t);if(this.options.ecmaVersion>=8&&o.name==="async"&&this.type===h.name&&!a&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return o=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(h.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,n),[o],!0,t)}return o;case h.regexp:var l=this.value;return i=this.parseLiteral(l.value),i.regex={pattern:l.pattern,flags:l.flags},i;case h.num:case h.string:return this.parseLiteral(this.value);case h._null:case h._true:case h._false:return i=this.startNode(),i.value=this.type===h._null?null:this.type===h._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case h.parenL:var u=this.start,c=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),c;case h.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(h.bracketR,!0,!0,e),this.finishNode(i,"ArrayExpression");case h.braceL:return this.overrideContext(W.b_expr),this.parseObj(!1,e);case h._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case h._class:return this.parseClass(this.startNode(),!1);case h._new:return this.parseNew();case h.backQuote:return this.parseTemplate();case h._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}};T.parseExprImport=function(){var e=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var t=this.parseIdent(!0);switch(this.type){case h.parenL:return this.parseDynamicImport(e);case h.dot:return e.meta=t,this.parseImportMeta(e);default:this.unexpected()}};T.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(h.parenR)){var t=this.start;this.eat(h.comma)&&this.eat(h.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};T.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};T.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};T.parseParenExpression=function(){this.expect(h.parenL);var e=this.parseExpression();return this.expect(h.parenR),e};T.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,s,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,l=[],u=!0,c=!1,f=new pi,p=this.yieldPos,g=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==h.parenR;)if(u?u=!1:this.expect(h.comma),n&&this.afterTrailingComma(h.parenR,!0)){c=!0;break}else if(this.type===h.ellipsis){m=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===h.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var _=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(h.parenR),e&&!this.canInsertSemicolon()&&this.eat(h.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=g,this.parseParenArrowList(i,r,l,t);(!l.length||c)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(f,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=g||this.awaitPos,l.length>1?(s=this.startNodeAt(a,o),s.expressions=l,this.finishNodeAt(s,"SequenceExpression",_,v)):s=l[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(i,r);return y.expression=s,this.finishNode(y,"ParenthesizedExpression")}else return s};T.parseParenItem=function(e){return e};T.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var oa=[];T.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(h.dot)){e.meta=t;var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,s=this.startLoc,n=this.type===h._import;return e.callee=this.parseSubscripts(this.parseExprAtom(),r,s,!0,!1),n&&e.callee.type==="ImportExpression"&&this.raise(r,"Cannot use new with import()"),this.eat(h.parenL)?e.arguments=this.parseExprList(h.parenR,this.options.ecmaVersion>=8,!1):e.arguments=oa,this.finishNode(e,"NewExpression")};T.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===h.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value,cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
5
|
-
`),cooked:this.value},this.next(),i.tail=this.type===h.backQuote,this.finishNode(i,"TemplateElement")};T.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===h.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(h.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(h.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};T.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===h.name||this.type===h.num||this.type===h.string||this.type===h.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===h.star)&&!mt.test(this.input.slice(this.lastTokEnd,this.start))};T.parseObj=function(e,t){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(h.braceR);){if(r)r=!1;else if(this.expect(h.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(h.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};T.parseProperty=function(e,t){var i=this.startNode(),r,s,n,a;if(this.options.ecmaVersion>=9&&this.eat(h.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===h.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===h.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,a=this.startLoc),e||(r=this.eat(h.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(h.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,e,r,s,n,a,t,o),this.finishNode(i,"Property")};T.parsePropertyValue=function(e,t,i,r,s,n,a,o){if((i||r)&&this.type===h.colon&&this.unexpected(),this.eat(h.colon))e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init";else if(this.options.ecmaVersion>=6&&this.type===h.parenL)t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,r);else if(!t&&!o&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==h.comma&&this.type!==h.braceR&&this.type!==h.eq){(i||r)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var l=e.kind==="get"?0:1;if(e.value.params.length!==l){var u=e.value.start;e.kind==="get"?this.raiseRecoverable(u,"getter should have no params"):this.raiseRecoverable(u,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")}else this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e.kind="init",t?e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key)):this.type===h.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};T.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(h.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(h.bracketR),e.key;e.computed=!1}return e.key=this.type===h.num||this.type===h.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};T.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};T.parseMethod=function(e,t,i){var r=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ur(t,r.generator)|ar|(i?cs:0)),this.expect(h.parenL),r.params=this.parseBindingList(h.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")};T.parseArrowExpression=function(e,t,i,r){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(ur(i,!1)|us),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")};T.parseFunctionBody=function(e,t,i,r){var s=t&&this.type!==h.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!n&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,ps),e.body=this.parseBlock(!1,void 0,a&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()};T.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.type!=="Identifier")return!1}return!0};T.checkParams=function(e,t){for(var i=Object.create(null),r=0,s=e.params;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,lr,t?null:i)}};T.parseExprList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(h.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===h.comma?a=null:this.type===h.ellipsis?(a=this.parseSpread(r),r&&this.type===h.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),s.push(a)}return s};T.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&r==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))}};T.parseIdent=function(e){var t=this.startNode();return this.type===h.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop()):this.unexpected(),this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t};T.parsePrivateIdent=function(){var e=this.startNode();return this.type===h.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e),e};T.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===h.semi||this.canInsertSemicolon()||this.type!==h.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(h.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};T.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var hi=Y.prototype;hi.raise=function(e,t){var i=as(this.input,e);t+=" ("+i.line+":"+i.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r};hi.raiseRecoverable=hi.raise;hi.curPosition=function(){if(this.options.locations)return new Be(this.curLine,this.pos-this.lineStart)};var Ft=Y.prototype,ua=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Ft.enterScope=function(e){this.scopeStack.push(new ua(e))};Ft.exitScope=function(){this.scopeStack.pop()};Ft.treatFunctionsAsVarInScope=function(e){return e.flags&de||!this.inModule&&e.flags&He};Ft.declareName=function(e,t,i){var r=!1;if(t===Tt){var s=this.currentScope();r=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&s.flags&He&&delete this.undefinedExports[e]}else if(t===fs){var n=this.currentScope();n.lexical.push(e)}else if(t===hs){var a=this.currentScope();this.treatFunctionsAsVar?r=a.lexical.indexOf(e)>-1:r=a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var l=this.scopeStack[o];if(l.lexical.indexOf(e)>-1&&!(l.flags&ls&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){r=!0;break}if(l.var.push(e),this.inModule&&l.flags&He&&delete this.undefinedExports[e],l.flags&or)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};Ft.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};Ft.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Ft.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&or)return t}};Ft.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&or&&!(t.flags&us))return t}};var di=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new fi(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ze=Y.prototype;ze.startNode=function(){return new di(this,this.start,this.startLoc)};ze.startNodeAt=function(e,t){return new di(this,e,t)};function gs(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}ze.finishNode=function(e,t){return gs.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};ze.finishNodeAt=function(e,t,i,r){return gs.call(this,e,t,i,r)};ze.copyNode=function(e){var t=new di(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var ys="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",xs=ys+" Extended_Pictographic",bs=xs,ws=bs+" EBase EComp EMod EPres ExtPict",vs=ws,la=vs,ca={9:ys,10:xs,11:bs,12:ws,13:vs,14:la},Zr="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ss="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",_s=Ss+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Es=_s+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Cs=Es+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ks=Cs+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",ha=ks+" Kawi Nag_Mundari Nagm",fa={9:Ss,10:_s,11:Es,12:Cs,13:ks,14:ha},As={};function pa(e){var t=As[e]={binary:Qt(ca[e]+" "+Zr),nonBinary:{General_Category:Qt(Zr),Script:Qt(fa[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(ui=0,tr=[9,10,11,12,13,14];ui<tr.length;ui+=1)ts=tr[ui],pa(ts);var ts,ui,tr,I=Y.prototype,Lt=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":""),this.unicodeProperties=As[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};Lt.prototype.reset=function(t,i,r){var s=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchN=s&&this.parser.options.ecmaVersion>=9};Lt.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};Lt.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return-1;var n=r.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=s)return n;var a=r.charCodeAt(t+1);return a>=56320&&a<=57343?(n<<10)+a-56613888:n};Lt.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return s;var n=r.charCodeAt(t),a;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=s||(a=r.charCodeAt(t+1))<56320||a>57343?t+1:t+2};Lt.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};Lt.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};Lt.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};Lt.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};I.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=0;r<i.length;r++){var s=i.charAt(r);t.indexOf(s)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(s,r+1)>-1&&this.raise(e.start,"Duplicate regular expression flag")}};I.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};I.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames.indexOf(r)===-1&&e.raise("Invalid named capture referenced")}};I.regexp_disjunction=function(e){for(this.regexp_alternative(e);e.eat(124);)this.regexp_alternative(e);this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")};I.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};I.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1};I.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};I.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};I.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};I.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return s!==-1&&s<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1};I.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)};I.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};I.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)&&e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}e.pos=t}return!1};I.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};I.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};I.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};I.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Ps(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Ps(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}I.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Ps(i);)e.advance();return e.pos!==t};I.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};I.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};I.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};I.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=qt(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=qt(e.lastIntValue);return!0}return!1};I.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),da(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function da(e){return Nt(e,!0)||e===36||e===95}I.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),ma(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function ma(e){return fe(e,!0)||e===36||e===95||e===8204||e===8205}I.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};I.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};I.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};I.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};I.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};I.regexp_eatZero=function(e){return e.current()===48&&!mi(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};I.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};I.regexp_eatControlLetter=function(e){var t=e.current();return Is(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Is(e){return e>=65&&e<=90||e>=97&&e<=122}I.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(r&&s>=55296&&s<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=(s-55296)*1024+(a-56320)+65536,!0}e.pos=n,e.lastIntValue=s}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&ga(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function ga(e){return e>=0&&e<=1114111}I.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};I.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};I.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(ya(t))return e.lastIntValue=-1,e.advance(),!0;if(e.switchU&&this.options.ecmaVersion>=9&&(t===80||t===112)){if(e.lastIntValue=-1,e.advance(),e.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(e)&&e.eat(125))return!0;e.raise("Invalid property name")}return!1};function ya(e){return e===100||e===68||e===115||e===83||e===119||e===87}I.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),!0}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s),!0}return!1};I.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Ue(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};I.regexp_validateUnicodePropertyNameOrValue=function(e,t){e.unicodeProperties.binary.test(t)||e.raise("Invalid property name")};I.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Os(t=e.current());)e.lastStringValue+=qt(t),e.advance();return e.lastStringValue!==""};function Os(e){return Is(e)||e===95}I.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";xa(t=e.current());)e.lastStringValue+=qt(t),e.advance();return e.lastStringValue!==""};function xa(e){return Os(e)||mi(e)}I.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};I.regexp_eatCharacterClass=function(e){if(e.eat(91)){if(e.eat(94),this.regexp_classRanges(e),e.eat(93))return!0;e.raise("Unterminated character class")}return!1};I.regexp_classRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};I.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Ns(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return r!==93?(e.lastIntValue=r,e.advance(),!0):!1};I.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};I.regexp_eatClassControlLetter=function(e){var t=e.current();return mi(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};I.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};I.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;mi(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function mi(e){return e>=48&&e<=57}I.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;$s(i=e.current());)e.lastIntValue=16*e.lastIntValue+Ts(i),e.advance();return e.pos!==t};function $s(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ts(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}I.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};I.regexp_eatOctalDigit=function(e){var t=e.current();return Ns(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Ns(e){return e>=48&&e<=55}I.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var s=e.current();if(!$s(s))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Ts(s),e.advance()}return!0};var hr=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new fi(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},L=Y.prototype;L.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new hr(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};L.getToken=function(){return this.next(),new hr(this)};typeof Symbol<"u"&&(L[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===h.eof,value:t}}}});L.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(h.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};L.readToken=function(e){return Nt(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};L.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};L.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=t;(r=rs(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};L.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!pe(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())};L.skipSpace=function(){t:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(e>8&&e<14||e>=5760&&ss.test(String.fromCharCode(e)))++this.pos;else break t}}};L.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};L.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(h.ellipsis)):(++this.pos,this.finishToken(h.dot))};L.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(h.assign,2):this.finishOp(h.slash,1)};L.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?h.star:h.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=h.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(h.assign,i+1):this.finishOp(r,i)};L.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(h.assign,3)}return this.finishOp(e===124?h.logicalOR:h.logicalAND,2)}return t===61?this.finishOp(h.assign,2):this.finishOp(e===124?h.bitwiseOR:h.bitwiseAND,1)};L.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(h.assign,2):this.finishOp(h.bitwiseXOR,1)};L.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||mt.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(h.incDec,2):t===61?this.finishOp(h.assign,2):this.finishOp(h.plusMin,1)};L.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(h.assign,i+1):this.finishOp(h.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(h.relational,i))};L.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(h.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(h.arrow)):this.finishOp(e===61?h.eq:h.prefix,1)};L.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(h.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(h.assign,3)}return this.finishOp(h.coalesce,2)}}return this.finishOp(h.question,1)};L.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),Nt(t,!0)||t===92))return this.finishToken(h.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+qt(t)+"'")};L.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(h.parenL);case 41:return++this.pos,this.finishToken(h.parenR);case 59:return++this.pos,this.finishToken(h.semi);case 44:return++this.pos,this.finishToken(h.comma);case 91:return++this.pos,this.finishToken(h.bracketL);case 93:return++this.pos,this.finishToken(h.bracketR);case 123:return++this.pos,this.finishToken(h.braceL);case 125:return++this.pos,this.finishToken(h.braceR);case 58:return++this.pos,this.finishToken(h.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(h.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(h.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+qt(e)+"'")};L.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};L.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(mt.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(r==="[")t=!0;else if(r==="]"&&t)t=!1;else if(r==="/"&&!t)break;e=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new Lt(this));o.reset(i,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var l=null;try{l=new RegExp(s,a)}catch{}return this.finishToken(h.regexp,{pattern:s,flags:a,value:l})};L.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,s=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,a=0,o=0,l=0,u=t??1/0;l<u;++l,++this.pos){var c=this.input.charCodeAt(this.pos),f=void 0;if(r&&c===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),l===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=c;continue}if(c>=97?f=c-97+10:c>=65?f=c-65+10:c>=48&&c<=57?f=c-48:f=1/0,f>=e)break;o=c,a=a*e+f}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:a};function ba(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ls(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}L.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Ls(this.input.slice(t,this.pos)),++this.pos):Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(h.num,i)};L.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&r===110){var s=Ls(this.input.slice(t,this.pos));return++this.pos,Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(h.num,s)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),r===46&&!i&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!i&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=ba(this.input.slice(t,this.pos),i);return this.finishToken(h.num,n)};L.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};L.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(pe(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(h.string,t)};var Rs={};L.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Rs)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};L.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Rs;this.raise(e,t)};L.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===h.template||this.type===h.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(h.dollarBraceL)):(++this.pos,this.finishToken(h.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(h.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(pe(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
6
|
-
`;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};L.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(h.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,"Unterminated template")};L.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
7
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return qt(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return pe(t)?"":String.fromCharCode(t)}};L.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};L.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(fe(s,r))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var n=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?Nt:fe)(a,r)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=qt(a),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};L.readWord=function(){var e=this.readWord1(),t=h.name;return this.keywords.test(e)&&(t=sr[e]),this.finishToken(t,e)};var wa="8.8.2";Y.acorn={Parser:Y,version:wa,defaultOptions:ir,Position:Be,SourceLocation:fi,getLineInfo:as,Node:di,TokenType:q,tokTypes:h,keywordTypes:sr,TokContext:wt,tokContexts:W,isIdentifierChar:fe,isIdentifierStart:Nt,Token:hr,isNewLine:pe,lineBreak:mt,lineBreakG:Yn,nonASCIIwhitespace:ss};var Ms=Y.extend(function(e){return class extends e{static parse(t,i){return i.ecmaVersion||(i={...i,ecmaVersion:"latest"}),super.parse(t,i)}constructor(...t){super(...t),this.___meta={},this.isLiveFunction=!1,this.isLiveProgram=t[0].executionMode!=="RegularProgram",this.functionStack=[]}parse(...t){let i=super.parse(...t);return i.isLiveProgram=this.isLiveProgram||qe(Fe(this.input,0,0),!0),i.hasLiveFunctions=!!this.___meta.hasLiveFunctions,i.originalSource=this.input,i}parseFunctionBody(...t){return qe(Fe(this.input,this.pos,0),!0)&&this.functionStack[0]&&(this.functionStack[0].isLiveFunction=!0,this.___meta.hasLiveFunctions=!0),super.parseFunctionBody(...t)}parseArrowExpression(...t){this.functionStack.unshift({type:"arrowFunction",isLiveFunction:this.isLiveFunction});let i=super.parseArrowExpression(...t);return this.functionStack[0].isLiveFunction&&(i.isLiveFunction=!0),this.functionStack.shift(),i}parseFunction(t,i,r,s,n){this.functionStack.unshift({type:"function",isLiveFunction:this.isLiveFunction}),this.isLiveFunction=!1;let a=super.parseFunction(t,i,r,s,n);return this.functionStack[0].isLiveFunction&&(a.isLiveFunction=!0),this.functionStack.shift(),a}parseProperty(t,i){this.functionStack.unshift({type:"property",isLiveFunction:this.isLiveFunction});let r=super.parseProperty(t,i);return this.functionStack[0].isLiveFunction&&(r.value.isLiveFunction=!0),this.functionStack.shift(),r}parseClassElement(t){this.functionStack.unshift({type:"classElement",isLiveFunction:this.isLiveFunction});let i=super.parseClassElement(t);return this.functionStack[0].isLiveFunction&&(i.value.isLiveFunction=!0),this.functionStack.shift(),i}}});var{stringify:va}=JSON;if(!String.prototype.repeat)throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");if(!String.prototype.endsWith)throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation");var gi={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},St=17,Sa={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:St,ClassExpression:St,FunctionExpression:St,ObjectExpression:St,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function ge(e,t){let{generator:i}=e;if(e.write("("),t!=null&&t.length>0){i[t[0].type](t[0],e);let{length:r}=t;for(let s=1;s<r;s++){let n=t[s];e.write(", "),i[n.type](n,e)}}e.write(")")}function Hs(e,t,i,r){let s=e.expressionsPrecedence[t.type];if(s===St)return!0;let n=e.expressionsPrecedence[i.type];return s!==n?!r&&s===15&&n===14&&i.operator==="**"||s<n:s!==13&&s!==14?!1:t.operator==="**"&&i.operator==="**"?!r:s===13&&n===13&&(t.operator==="??"||i.operator==="??")?!0:r?gi[t.operator]<=gi[i.operator]:gi[t.operator]<gi[i.operator]}function yi(e,t,i,r){let{generator:s}=e;Hs(e,t,i,r)?(e.write("("),s[t.type](t,e),e.write(")")):s[t.type](t,e)}function _a(e,t,i,r){let s=t.split(`
|
|
8
|
-
`),n=s.length-1;if(e.write(s[0].trim()),n>0){e.write(r);for(let a=1;a<n;a++)e.write(i+s[a].trim()+r);e.write(i+s[n].trim())}}function st(e,t,i,r){let{length:s}=t;for(let n=0;n<s;n++){let a=t[n];e.write(i),a.type[0]==="L"?e.write("// "+a.value.trim()+`
|
|
9
|
-
`,a):(e.write("/*"),_a(e,a.value,i,r),e.write("*/"+r))}}function Ea(e){let t=e;for(;t!=null;){let{type:i}=t;if(i[0]==="C"&&i[1]==="a")return!0;if(i[0]==="M"&&i[1]==="e"&&i[2]==="m")t=t.object;else return!1}}function fr(e,t){let{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");let{length:s}=r;if(s>0){i.VariableDeclarator(r[0],e);for(let n=1;n<s;n++)e.write(", "),i.VariableDeclarator(r[n],e)}}var Ds,Vs,qs,Fs,js,Bs,Ca={Program(e,t){let i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:s}=t;s&&e.comments!=null&&st(t,e.comments,i,r);let n=e.body,{length:a}=n;for(let o=0;o<a;o++){let l=n[o];s&&l.comments!=null&&st(t,l.comments,i,r),t.write(i),this[l.type](l,t),t.write(r)}s&&e.trailingComments!=null&&st(t,e.trailingComments,i,r)},BlockStatement:Bs=function(e,t){let i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;t.write("{");let a=e.body;if(a!=null&&a.length>0){t.write(r),s&&e.comments!=null&&st(t,e.comments,n,r);let{length:o}=a;for(let l=0;l<o;l++){let u=a[l];s&&u.comments!=null&&st(t,u.comments,n,r),t.write(n),this[u.type](u,t),t.write(r)}t.write(i)}else s&&e.comments!=null&&(t.write(r),st(t,e.comments,n,r),t.write(i));s&&e.trailingComments!=null&&st(t,e.trailingComments,n,r),t.write("}"),t.indentLevel--},ClassBody:Bs,StaticBlock(e,t){t.write("static "),this.BlockStatement(e,t)},EmptyStatement(e,t){t.write(";")},ExpressionStatement(e,t){let i=t.expressionsPrecedence[e.expression.type];i===St||i===3&&e.expression.left.type[0]==="O"?(t.write("("),this[e.expression.type](e.expression,t),t.write(")")):this[e.expression.type](e.expression,t),t.write(";")},IfStatement(e,t){t.write("if ("),this[e.test.type](e.test,t),t.write(") "),this[e.consequent.type](e.consequent,t),e.alternate!=null&&(t.write(" else "),this[e.alternate.type](e.alternate,t))},LabeledStatement(e,t){this[e.label.type](e.label,t),t.write(": "),this[e.body.type](e.body,t)},BreakStatement(e,t){t.write("break"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},ContinueStatement(e,t){t.write("continue"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},WithStatement(e,t){t.write("with ("),this[e.object.type](e.object,t),t.write(") "),this[e.body.type](e.body,t)},SwitchStatement(e,t){let i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t;t.indentLevel++;let n=i+t.indent,a=n+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);let{cases:o}=e,{length:l}=o;for(let u=0;u<l;u++){let c=o[u];s&&c.comments!=null&&st(t,c.comments,n,r),c.test?(t.write(n+"case "),this[c.test.type](c.test,t),t.write(":"+r)):t.write(n+"default:"+r);let{consequent:f}=c,{length:p}=f;for(let g=0;g<p;g++){let m=f[g];s&&m.comments!=null&&st(t,m.comments,a,r),t.write(a),this[m.type](m,t),t.write(r)}}t.indentLevel-=2,t.write(i+"}")},ReturnStatement(e,t){t.write("return"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t)),t.write(";")},ThrowStatement(e,t){t.write("throw "),this[e.argument.type](e.argument,t),t.write(";")},TryStatement(e,t){if(t.write("try "),this[e.block.type](e.block,t),e.handler){let{handler:i}=e;i.param==null?t.write(" catch "):(t.write(" catch ("),this[i.param.type](i.param,t),t.write(") ")),this[i.body.type](i.body,t)}e.finalizer&&(t.write(" finally "),this[e.finalizer.type](e.finalizer,t))},WhileStatement(e,t){t.write("while ("),this[e.test.type](e.test,t),t.write(") "),this[e.body.type](e.body,t)},DoWhileStatement(e,t){t.write("do "),this[e.body.type](e.body,t),t.write(" while ("),this[e.test.type](e.test,t),t.write(");")},ForStatement(e,t){if(t.write("for ("),e.init!=null){let{init:i}=e;i.type[0]==="V"?fr(t,i):this[i.type](i,t)}t.write("; "),e.test&&this[e.test.type](e.test,t),t.write("; "),e.update&&this[e.update.type](e.update,t),t.write(") "),this[e.body.type](e.body,t)},ForInStatement:Ds=function(e,t){t.write(`for ${e.await?"await ":""}(`);let{left:i}=e;i.type[0]==="V"?fr(t,i):this[i.type](i,t),t.write(e.type[3]==="I"?" in ":" of "),this[e.right.type](e.right,t),t.write(") "),this[e.body.type](e.body,t)},ForOfStatement:Ds,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:Vs=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),ge(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:Vs,VariableDeclaration(e,t){fr(t,e),t.write(";")},VariableDeclarator(e,t){this[e.id.type](e.id,t),e.init!=null&&(t.write(" = "),this[e.init.type](e.init,t))},ClassDeclaration(e,t){if(t.write("class "+(e.id?`${e.id.name} `:""),e),e.superClass){t.write("extends ");let{superClass:i}=e,{type:r}=i,s=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(s===St||s<t.expressionsPrecedence.ClassExpression)?(t.write("("),this[e.superClass.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ")}this.ClassBody(e.body,t)},ImportDeclaration(e,t){t.write("import ");let{specifiers:i,attributes:r}=e,{length:s}=i,n=0;if(s>0){for(;n<s;){n>0&&t.write(", ");let a=i[n],o=a.type[6];if(o==="D")t.write(a.local.name,a),n++;else if(o==="N")t.write("* as "+a.local.name,a),n++;else break}if(n<s){for(t.write("{");;){let a=i[n],{name:o}=a.imported;if(t.write(o,a),o!==a.local.name&&t.write(" as "+a.local.name),++n<s)t.write(", ");else break}t.write("}")}t.write(" from ")}if(this.Literal(e.source,t),r&&r.length>0){t.write(" with { ");for(let a=0;a<r.length;a++)this.ImportAttribute(r[a],t),a<r.length-1&&t.write(", ");t.write(" }")}t.write(";")},ImportAttribute(e,t){this.Identifier(e.key,t),t.write(": "),this.Literal(e.value,t)},ImportExpression(e,t){t.write("import("),this[e.source.type](e.source,t),t.write(")")},ExportDefaultDeclaration(e,t){t.write("export default "),this[e.declaration.type](e.declaration,t),t.expressionsPrecedence[e.declaration.type]!=null&&e.declaration.type[0]!=="F"&&t.write(";")},ExportNamedDeclaration(e,t){if(t.write("export "),e.declaration)this[e.declaration.type](e.declaration,t);else{t.write("{");let{specifiers:i}=e,{length:r}=i;if(r>0)for(let s=0;;){let n=i[s],{name:a}=n.local;if(t.write(a,n),a!==n.exported.name&&t.write(" as "+n.exported.name),++s<r)t.write(", ");else break}if(t.write("}"),e.source&&(t.write(" from "),this.Literal(e.source,t)),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let s=0;s<e.attributes.length;s++)this.ImportAttribute(e.attributes[s],t),s<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")}},ExportAllDeclaration(e,t){if(e.exported!=null?t.write("export * as "+e.exported.name+" from "):t.write("export * from "),this.Literal(e.source,t),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let i=0;i<e.attributes.length;i++)this.ImportAttribute(e.attributes[i],t),i<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")},MethodDefinition(e,t){e.static&&t.write("static ");let i=e.kind[0];(i==="g"||i==="s")&&t.write(e.kind+" "),e.value.async&&t.write("async "),e.value.generator&&t.write("*"),e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),ge(t,e.value.params),t.write(" "),this[e.value.body.type](e.value.body,t)},ClassExpression(e,t){this.ClassDeclaration(e,t)},ArrowFunctionExpression(e,t){t.write(e.async?"async ":"",e);let{params:i}=e;i!=null&&(i.length===1&&i[0].type[0]==="I"?t.write(i[0].name,i[0]):ge(t,e.params)),t.write(" => "),e.body.type[0]==="O"?(t.write("("),this.ObjectExpression(e.body,t),t.write(")")):this[e.body.type](e.body,t)},ThisExpression(e,t){t.write("this",e)},Super(e,t){t.write("super",e)},RestElement:qs=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:qs,YieldExpression(e,t){t.write(e.delegate?"yield*":"yield"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t))},AwaitExpression(e,t){t.write("await ",e),yi(t,e.argument,e)},TemplateLiteral(e,t){let{quasis:i,expressions:r}=e;t.write("`");let{length:s}=r;for(let a=0;a<s;a++){let o=r[a],l=i[a];t.write(l.value.raw,l),t.write("${"),this[o.type](o,t),t.write("}")}let n=i[i.length-1];t.write(n.value.raw,n),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){yi(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:js=function(e,t){if(t.write("["),e.elements.length>0){let{elements:i}=e,{length:r}=i;for(let s=0;;){let n=i[s];if(n!=null&&this[n.type](n,t),++s<r)t.write(", ");else{n==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:js,ObjectExpression(e,t){let i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),s&&e.comments!=null&&st(t,e.comments,n,r);let a=","+r,{properties:o}=e,{length:l}=o;for(let u=0;;){let c=o[u];if(s&&c.comments!=null&&st(t,c.comments,n,r),t.write(n),this[c.type](c,t),++u<l)t.write(a);else break}t.write(r),s&&e.trailingComments!=null&&st(t,e.trailingComments,n,r),t.write(i+"}")}else s?e.comments!=null?(t.write(r),st(t,e.comments,n,r),e.trailingComments!=null&&st(t,e.trailingComments,n,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),st(t,e.trailingComments,n,r),t.write(i+"}")):t.write("}"):t.write("}");t.indentLevel--},Property(e,t){e.method||e.kind[0]!=="i"?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),t.write(": ")),this[e.value.type](e.value,t))},PropertyDefinition(e,t){if(e.static&&t.write("static "),e.computed&&t.write("["),this[e.key.type](e.key,t),e.computed&&t.write("]"),e.value==null){e.key.type[0]!=="F"&&t.write(";");return}t.write(" = "),this[e.value.type](e.value,t),t.write(";")},ObjectPattern(e,t){if(t.write("{"),e.properties.length>0){let{properties:i}=e,{length:r}=i;for(let s=0;this[i[s].type](i[s],t),++s<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){ge(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){let{operator:i,argument:r,argument:{type:s}}=e;t.write(i);let n=Hs(t,r,e);!n&&(i.length>1||s[0]==="U"&&(s[1]==="n"||s[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),n?(t.write(i.length>1?" (":"("),this[s](r,t),t.write(")")):this[s](r,t)}else this[e.argument.type](e.argument,t),t.write(e.operator)},UpdateExpression(e,t){e.prefix?(t.write(e.operator),this[e.argument.type](e.argument,t)):(this[e.argument.type](e.argument,t),t.write(e.operator))},AssignmentExpression(e,t){this[e.left.type](e.left,t),t.write(" "+e.operator+" "),this[e.right.type](e.right,t)},AssignmentPattern(e,t){this[e.left.type](e.left,t),t.write(" = "),this[e.right.type](e.right,t)},BinaryExpression:Fs=function(e,t){let i=e.operator==="in";i&&t.write("("),yi(t,e.left,e,!1),t.write(" "+e.operator+" "),yi(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:Fs,ConditionalExpression(e,t){let{test:i}=e,r=t.expressionsPrecedence[i.type];r===St||r<=t.expressionsPrecedence.ConditionalExpression?(t.write("("),this[i.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ? "),this[e.consequent.type](e.consequent,t),t.write(" : "),this[e.alternate.type](e.alternate,t)},NewExpression(e,t){t.write("new ");let i=t.expressionsPrecedence[e.callee.type];i===St||i<t.expressionsPrecedence.CallExpression||Ea(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),ge(t,e.arguments)},CallExpression(e,t){let i=t.expressionsPrecedence[e.callee.type];i===St||i<t.expressionsPrecedence.CallExpression?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),e.optional&&t.write("?."),ge(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){let i=t.expressionsPrecedence[e.object.type];i===St||i<t.expressionsPrecedence.MemberExpression?(t.write("("),this[e.object.type](e.object,t),t.write(")")):this[e.object.type](e.object,t),e.computed?(e.optional&&t.write("?."),t.write("["),this[e.property.type](e.property,t),t.write("]")):(e.optional?t.write("?."):t.write("."),this[e.property.type](e.property,t))},MetaProperty(e,t){t.write(e.meta.name+"."+e.property.name,e)},Identifier(e,t){t.write(e.name,e)},PrivateIdentifier(e,t){t.write(`#${e.name}`,e)},Literal(e,t){e.raw!=null?t.write(e.raw,e):e.regex!=null?this.RegExpLiteral(e,t):e.bigint!=null?t.write(e.bigint+"n",e):t.write(va(e.value),e)},RegExpLiteral(e,t){let{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},ka={};var pr=class{constructor(t){let i=t??ka;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Ca,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:Sa,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
|
|
10
|
-
`,this.indentLevel=i.startingIndentLevel!=null?i.startingIndentLevel:0,this.writeComments=i.comments?i.comments:!1,i.sourceMap!=null&&(this.write=i.output==null?this.writeAndMap:this.writeToStreamAndMap,this.sourceMap=i.sourceMap,this.line=1,this.column=0,this.lineEndSize=this.lineEnd.split(`
|
|
11
|
-
`).length-1,this.mapping={original:null,generated:this,name:void 0,source:i.sourceMap.file||i.sourceMap._file})}write(t){this.output+=t}writeToStream(t){this.output.write(t)}writeAndMap(t,i){this.output+=t,this.map(t,i)}writeToStreamAndMap(t,i){this.output.write(t),this.map(t,i)}map(t,i){if(i!=null){let{type:n}=i;if(n[0]==="L"&&n[2]==="n"){this.column=0,this.line++;return}if(i.loc!=null){let{mapping:a}=this;a.original=i.loc.start,a.name=i.name,this.sourceMap.addMapping(a)}if(n[0]==="T"&&n[8]==="E"||n[0]==="L"&&n[1]==="i"&&typeof i.value=="string"){let{length:a}=t,{column:o,line:l}=this;for(let u=0;u<a;u++)t[u]===`
|
|
12
|
-
`?(o=0,l++):o++;this.column=o,this.line=l;return}}let{length:r}=t,{lineEnd:s}=this;r>0&&(this.lineEndSize>0&&(s.length===1?t[r-1]===s:t.endsWith(s))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}};function Us(e,t){let i=new pr(t);return i.generator[e.type](e,i),i.output}var Rt=class{type="Identifier";whitelist=[];blacklist=[];constructor(t){this.whitelist[0]=t}get name(){return this.whitelist[0]}noConflict(t){let i=this.whitelist.indexOf(t);if(i===-1)return!1;this.blacklist.push(this.whitelist.splice(i,1)),this.whitelist.length||(this.whitelist=this.blacklist.map(r=>{let s;do{let n=String.fromCharCode(0|Math.random()*26+97);s=`${r}${n}`}while(this.blacklist.includes(s));return s}))}};var d={throwStmt(e){return{type:"ThrowStatement",argument:e}},tryStmt(e,t,i,r){return{type:"TryStatement",block:e,handler:t,finalizer:i,guardedHandlers:r}},catchClause(e,t){return{type:"CatchClause",param:e,body:t}},exprStmt(e){return{type:"ExpressionStatement",expression:e}},blockStmt(e){return{type:"BlockStatement",body:e}},labeledStmt(e,t){return{type:"LabeledStatement",label:e,body:t}},withStmt(e,t){return{type:"WithStatement",object:e,body:t}},ifStmt(e,t,i){return this.conditionalExpr(e,t,i,"IfStatement")},switchStmt(e,t,i=!1){return{type:"SwitchStatement",discriminant:e,cases:t}},switchCase(e,t){return{type:"SwitchCase",test:e,consequent:t}},whileStmt(e,t){return{type:"WhileStatement",test:e,body:t}},doWhileStmt(e,t){return{type:"DoWhileStatement",test:e,body:t}},forStmt(e,t,i,r){return{type:"ForStatement",init:e,test:t,update:i,body:r}},forInStmt(e,t,i){return{type:"ForInStatement",left:e,right:t,body:i}},forOfStmt(e,t,i){return{type:"ForOfStatement",left:e,right:t,body:i}},breakStmt(e=null){return{type:"BreakStatement",label:e}},continueStmt(e=null){return{type:"ContinueStatement",label:e}},returnStmt(e){return{type:"ReturnStatement",argument:e}},yieldExpr(e,t=!1){return{type:"YieldExpression",argument:e,delegate:t}},awaitExpr(e){return{type:"AwaitExpression",argument:e}},varDeclaration(e,t){return{type:"VariableDeclaration",kind:e,declarations:t}},varDeclarator(e,t=null){return{type:"VariableDeclarator",id:e,init:t}},funcDeclaration(e,t,i,r=!1,s=!1,n=!1){return this.func("FunctionDeclaration",...arguments)},sequenceExpr(e){return{type:"SequenceExpression",expressions:e}},parensExpr(e){return{type:"ParenthesizedExpression",expression:e}},logicalExpr(e,t,i){return{type:"LogicalExpression",operator:e,left:t,right:i}},binaryExpr(e,t,i){return{type:"BinaryExpression",operator:e,left:t,right:i}},unaryExpr(e,t,i=!0){return{type:"UnaryExpression",operator:e,argument:t,prefix:i}},updateExpr(e,t,i=!1){return{type:"UpdateExpression",operator:e,argument:t,prefix:i}},assignmentExpr(e,t,i="="){return{type:"AssignmentExpression",operator:i,left:e,right:t}},assignmentPattern(e,t){return{type:"AssignmentPattern",left:e,right:t}},thisExpr(){return{type:"ThisExpression"}},conditionalExpr(e,t,i,r="ConditionalExpression"){return{type:r,test:e,consequent:t,alternate:i}},arrayExpr(e){return{type:"ArrayExpression",elements:e}},arrayPattern(e){return{type:"ArrayPattern",elements:e}},objectExpr(e){return{type:"ObjectExpression",properties:e}},objectPattern(e){return{type:"ObjectPattern",properties:e}},chainExpr(e){return{type:"ChainExpression",expression:e}},callExpr(e,t,i=!1){return{type:"CallExpression",callee:e,arguments:t,optional:i}},newExpr(e,t){return{type:"NewExpression",callee:e,arguments:t}},taggedTemplateExpr(e,t){return{type:"TaggedTemplateExpression",tag:e,quasi:t}},memberExpr(e,t,i=!1,r=!1){return{type:"MemberExpression",object:e,property:t,computed:i,optional:r}},funcExpr(e,t,i,r=!1,s=!1,n=!1){return this.func("FunctionExpression",...arguments)},arrowFuncExpr(e,t,i,r=!1,s=!1,n=!1){return this.func("ArrowFunctionExpression",...arguments)},func(e,t,i,r,s=!1,n=!1,a=!1){return{type:e,id:t,params:i,body:r,async:s,expression:n,generator:a}},identifier(e){return{type:"Identifier",name:e}},property(e,t,i="init",r=!1,s=!1,n=!1){return{type:"Property",key:e,value:t,kind:i,shorthand:r,computed:s,method:n}},classDeclaration(e,t,i=null){return this.class("ClassDeclaration",...arguments)},classExpression(e,t,i=null){return this.class("ClassExpression",...arguments)},class(e,t,i,r=null){return{type:e,id:t,body:i,superClass:r}},methodDefinition(e,t,i="method",r=!1,s=!1){return{type:"MethodDefinition",key:e,value:t,kind:i,static:r,computed:s}},propertyDefinition(e,t,i=!1,r=!1){return{type:"PropertyDefinition",key:e,value:t,static:i,computed:r}},spreadElement(e){return{type:"SpreadElement",argument:e}},literal(e){if(typeof e=="object"&&!("name"in e)&&!("value"in e))throw new Error('Objects that convert to literals must have a "name" or "value" property.');return typeof e=="object"?{type:"Literal",get value(){return"name"in e?e.name:e.value}}:{type:"Literal",value:e}},templateLiteral(e,t){return{type:"TemplateLiteral",quasis:e,expressions:t}},comments(e){let t={};return Object.defineProperty(t,"toString",{value:()=>e}),Object.defineProperty(t,"trim",{value:function(){return this.toString()}}),[{type:"Line",value:t}]},withLoc(e,...t){return["start","end"].forEach(i=>{let r=i==="start"?t[0]:t[t.length-1];e[i]=r[i],r.loc&&(e.loc=e.loc||{},e.loc[i]=r.loc?.[i])}),e},invert(e){return this.unaryExpr("!",e)},clone(e){return e={...e},delete e.start,delete e.end,e}};var ye=class{type="BlockStatement";$body=[];constructor(t){this.body=t}get body(){return this.$body}set body(t){this.$body=t,d.withLoc(this,...t)}};var Ge=class{constructor(t,{type:i}){this.context=t,Object.assign(this,{type:i}),this.vars=new Set,this.$qIdentifiers=new Map,this.$qIdentifiersCursors={...this.context?.$qIdentifiersCursors||{}},this.locations=[]}index(t,i=!1){if(!this.type.includes("Function")&&this.context)return this.context.index(...arguments);let r=["start","end"].map(s=>{let n=[d.literal(t[s])];return i&&t.loc&&(n.push(d.literal(t.loc[s].line)),n.push(d.literal(t.loc[s].column))),d.arrayExpr(n)});return this.locations.push(d.arrayExpr(r)),d.literal(this.locations.length-1)}get$qIdentifier(t,i=!0,r=!1){let s=this.$qIdentifiers.get(t);if(!s){if(i&&this.context)return this.context.get$qIdentifier(t,i);r&&(typeof this.$qIdentifiersCursors[t]>"u"&&(this.$qIdentifiersCursors[t]=0),t+=this.$qIdentifiersCursors[t]++),this.$qIdentifiers.set(t,s=new Rt(t))}return s}getRandomIdentifier(t,i=!0){return this.get$qIdentifier(t,i,!0)}$qIdentifiersNoConflict(t){for(let[,i]of this.$qIdentifiers)i.noConflict(t);this.context&&this.context.$qIdentifiersNoConflict(t)}push(t,i,r=!1){let s;return["var","update"].includes(i)&&(s=this.find(t,!1))&&s.type!=="const"?s.willUpdate=!0:(i!=="update"||!this.context)&&(t instanceof Rt||this.$qIdentifiersNoConflict(t.name+""),this.vars.add({identifier:t,type:i,willUpdate:r||i==="update"})),this.context&&(i==="update"||i==="var"&&!this.type.includes("Function"))?this.context.push(t,i):!0}find(t,i=!0){let r;for(let s of this.vars)if(s.identifier.name+""==t.name+""){r=s;break}return!r&&i?this.context?.find(t,i):r}};var xe=class{history=[];scopes=[];functionTypes=["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"];loopTypes=["DoWhileStatement","WhileStatement","ForStatement","ForOfStatement","ForInStatement"];labeledTypes=["SwitchStatement","LabeledStatement"];topLevelAwait=!1;topLevelArgsKeyword=!1;exportIds=[];constructor(t={}){this.params=t}pushScope(t,i){let r=new Ge(this.currentScope,t);this.scopes.unshift(r);let s=i();return this.scopes.shift(),s}get currentScope(){return this.scopes[0]}pushHistory(t,i){this.history.unshift(t);let r=i();return this.history.shift(),r}get currentEntry(){return this.history[0]}serialize(t,i={}){return Us(t,{comments:!0,...i})}transform(t){if(t.type!=="Program")throw new Error('AST must be of type "Program".');return this.pushScope(t,()=>{this.currentScope.get$qIdentifier("$q"),this.currentScope.get$qIdentifier("$q2");let i=this.transformNodes(t.body,{static:!t.isLiveProgram}),r={...t,body:i};r.body.length&&(r.body[0].comments=d.comments("Program body"));let s=d.exprStmt(d.assignmentExpr(this.$path("locations"),d.arrayExpr(this.currentScope.locations)));if(s.comments=d.comments("Location data"),r.body.unshift(s),this.exports.size){this.exports.forEach(c=>{r.body.push(d.exprStmt(this.$call("export",...c)))});let u=d.memberExpr(d.identifier("Promise"),d.identifier("all"));r.body.push(d.exprStmt(d.awaitExpr(d.callExpr(u,[this.$path("$promises.exports")])))),this.topLevelAwait=!0}let n=this.currentScope.get$qIdentifier("$q").name,a=this.currentScope.get$qIdentifier("$q2").name,o=this.params.astResult?r:this.serialize(r,{startingIndentLevel:this.params.startingIndentLevel}),l=this.params.base64&&!this.params.astResult?btoa(this.params.base64.replace("%0",n+"").replace("%1",o)):"";return{identifier:n,identifier2:a,transformedSource:o,transformedSourceBase64:l,originalSource:t.originalSource,isLiveProgram:t.isLiveProgram,hasLiveFuntions:t.hasLiveFuntions,topLevelAwait:this.topLevelAwait,exportIds:this.exportIds,toString(u=void 0){return u==="base64"?this.transformedSourceBase64:this.transformedSource}}})}transformNodes(t,i={}){let r=(t=t.filter(o=>o)).length,[s,n,a]=t.reduce(([o,l,u],c)=>c?.type==="ImportDeclaration"?[o.concat(c),l,u]:c?.type==="FunctionDeclaration"?[o,l.concat(c),u]:[o,l,u.concat(c)],[[],[],[]]);return t=[...s,...n,...a],function o(l,u){if(u===r)return l;let[c,f]=this.transformNode(t[u],i,!0);if(l=l.concat(c||[]),u===s.length-1){let p=d.memberExpr(d.identifier("Promise"),d.identifier("all"));l=l.concat(d.exprStmt(d.awaitExpr(d.callExpr(p,[this.$path("$promises.imports")]))))}if(["ReturnStatement","BreakStatement","ContinueStatement"].includes(t[u].type))return l;if(f.flowControl?.size&&f.node.type==="IfStatement"){let p=t.slice(u+1);if(p.length){let g=new ye(p);return l.concat(this.transformNode(g))}}return o.call(this,l,u+1)}.call(this,[],0)}transformNode(t,i={},r=!1){if(typeof t!="object"||!t)return t;let s={static:this.currentEntry?.static,isLeft:this.currentEntry?.isLeft,mode:this.currentEntry?.mode,...i,parentNode:this.currentEntry?.node,node:t,hoistedAwaitKeyword:!1,flowControl:new Map},n=this.pushHistory(s,()=>this[`transform${t.type}`]?this[`transform${t.type}`].call(this,t):Object.keys(t).reduce((a,o)=>{let l=Array.isArray(t[o])?this.transformNodes(t[o],i):this.transformNode(t[o],i);return{...a,[o]:l}},{}));return r?[n,s]:n}$serial(t){return this.currentScope.index(t,this.params.locations)}$path(t){return t.split(".").reduce((i,r)=>d.memberExpr(i,d.identifier(r)),this.currentScope.get$qIdentifier("$q"))}$trail(){return this.currentEntry.trail?[d.literal(this.currentEntry.trail)]:[]}$call(t,...i){return d.callExpr(this.$path(t),i)}$typed(t,i,r=null){let s=r?[d.literal(r)]:[];return this.$call("typed",d.literal(t),i,...s)}$obj(t){let i=Object.entries(t).map(([r,s])=>d.property(d.identifier(r),Array.isArray(s)?d.arrayExpr(s):s));return d.objectExpr(i)}$closure(...t){let i=t.pop(),r=t.pop()||[];return i.type==="EmptyStatement"&&(i=d.blockStmt([])),d.arrowFuncExpr(null,r,i,this.currentEntry.hoistedAwaitKeyword)}$var(t,i,r,s,...n){let a=s?this.$closure([this.currentScope.get$qIdentifier("$q")],s):d.identifier("undefined"),o=this.$call(t,d.literal(r),i,a,...n);return a.async&&(o=d.awaitExpr(o)),d.exprStmt(o)}$update(t,i,...r){let s=this.$closure(i);return this.$call("update",d.literal(t.name),s,...r)}$autorun(t,...i){let r=i.pop(),s=i.pop(),n=i.pop()||{},a=Object.keys(n).length?[this.$obj(n)]:[],o=this.$closure([this.currentScope.get$qIdentifier("$q")],r),l=this.$call("autorun",d.literal(t),...a,s,o);return o.async&&(l=d.awaitExpr(l)),d.exprStmt(l)}$iteration(t,i,r){let s=d.literal(t),n=this.currentEntry.parentNode?.label?d.literal(this.currentEntry.parentNode.label.name):d.identifier("null"),a={kind:s,label:n},o=d.blockStmt(r);return this.$autorun("iteration",a,i,o)}hoistAwaitKeyword(){for(let t of this.history)if(t.hoistedAwaitKeyword=!0,t.node.type.includes("Function"))return;this.topLevelAwait=!0}hoistArgumentsKeyword(){let t=["FunctionDeclaration","FunctionExpression"];if(!this.history.some(i=>t.includes(i.node.type)))return this.topLevelArgsKeyword=!0,!0}hoistExitStatement(t,i={}){for(let r of this.history){let s=()=>r.node?.type==="SwitchStatement"&&t.value==="break"&&i.name==="null",n=()=>r.parentNode?.type==="LabeledStatement"&&this.loopTypes.includes(r.parentNode.body.type)&&i.value===r.parentNode.label.name,a=()=>this.loopTypes.includes(r.node.type)&&i.name==="null";if(s())return r.node;if(n()||a())return r.flowControl.set(t,{...i,endpoint:!0}),r.node;if(r.node.type.includes("Function"))return;r.flowControl.set(t,i)}}transformFunctionDeclaration(t){return this.transformFunction(d.funcDeclaration,...arguments)}transformFunctionExpression(t){return this.transformFunction(d.funcExpr,...arguments)}transformArrowFunctionExpression(t){return this.transformFunction(d.arrowFuncExpr,...arguments)}transformFunction(t,i){if(i.generator&&i.isLiveFunction)throw new Error("Generator functions cannot be live functions.");let r=this.$serial(i),{id:s,params:n,body:a}=i;[s,n,a]=this.pushScope(i,()=>{let m=[];this.currentEntry.isExport&&!s&&(s=this.currentScope.getRandomIdentifier("$rand",!0)),s&&this.currentScope.push(s,"self");let _=n.map(b=>{if(b.type==="AssignmentPattern"&&i.isLiveFunction){let S=this.currentScope.getRandomIdentifier("$rand",!1),w=this.transformSignal(S,"param"),x=d.varDeclarator(b.left,d.withLoc(d.logicalExpr("||",S,b.right),b));return m.push(...this.transformNode(d.varDeclaration("let",[d.withLoc(x,b)]),{static:!i.isLiveFunction})),w}return this.transformSignal(b,"param")}),v=this.transformNodes(a.type==="BlockStatement"?a.body:[d.returnStmt(a)],{static:!i.isLiveFunction});m.push(...v),m.length&&(m[0].comments=d.comments("Function body"));let y=d.exprStmt(d.assignmentExpr(this.$path("locations"),d.arrayExpr(this.currentScope.locations)));return y.comments=d.comments("Location data"),m.unshift(y),[s,_,d.blockStmt(m)]});let o=this.currentScope.get$qIdentifier("$q"),l=this.$closure([o],a),u=d.literal(i.isLiveFunction?"LiveFunction":i.isHandler?"HandlerFunction":i.isFinalizer?"FinalizerFunction":"RegularFunction"),c=d.literal(i.type==="FunctionDeclaration"?"Declaration":"Expression"),f=d.blockStmt([d.returnStmt(this.$call("runtime.spawn",u,i.type==="ArrowFunctionExpression"?d.identifier("null"):d.thisExpr(),l,o))]),p=m=>this.$call("function",u,c,r,m),g=t.call(d,s,n,f,i.async,i.expresion,i.generator);if(i.type==="FunctionDeclaration"){if(this.currentScope.push(s,"static"),g=[g,d.exprStmt(p(s))],this.currentEntry.isExport){let m=[d.literal(s),r];this.currentEntry.isExport==="as-default"?(m.push(d.literal("default")),this.exportIds.push("default")):this.exportIds.push(s.name),this.exports.add([d.arrayExpr(m)])}}else this.currentEntry.isMethod||(g=p(g));return g}transformClassDeclaration(t){return this.transformClass(d.classDeclaration,...arguments)}transformClassExpression(t){return this.transformClass(d.classExpression,...arguments)}transformClass(t,i){let{id:r,body:s,superClass:n}=i;n&&(n=this.transformNode(n));let a=new Set;s=this.pushScope(i,()=>(this.currentEntry.isExport&&!r&&(r=this.currentScope.getRandomIdentifier("$rand",!0)),r&&this.currentScope.push(r,"self"),this.transformNode(s,{methods:a})));let o=d.literal(i.type==="ClassDeclaration"?"Declaration":"Expression"),l=c=>{let f=d.arrayExpr([...a].map(p=>this.$obj(p)));return this.$call("class",o,c,f)},u=t.call(d,r,s,n);if(i.type==="ClassDeclaration"){if(this.currentScope.push(r,"static"),u=[u,d.exprStmt(l(r))],this.currentEntry.isExport){let c=[d.literal(r),this.$serial(i)];this.currentEntry.isExport==="as-default"?(c.push(d.literal("default")),this.exportIds.push("default")):this.exportIds.push(r.name),this.exports.add([d.arrayExpr(c)])}}else u=l(u);return u}transformMethodDefinition(t){let{key:i,value:r}=t;t.computed&&(i=this.transformNode(i));let s=this.transformNode(r,{static:!0,isMethod:!0});return this.currentEntry.methods.add({name:t.computed?i:d.literal(i),static:d.identifier(t.static),isLiveFunction:d.identifier(r.isLiveFunction||!1),serial:this.$serial(t)}),d.methodDefinition(i,s,t.kind,t.static,t.computed)}transformPropertyDefinition(t){let{key:i,value:r}=t;return t.computed&&(i=this.transformNode(i)),r=this.transformNode(r),d.exprStmt(d.propertyDefinition(i,r,t.static,t.computed))}exports=new Set;transformExportDefaultDeclaration(t){return this.handleExports(...arguments)}transformExportNamedDeclaration(t){return this.handleExports(...arguments)}transformExportAllDeclaration(t){return this.handleExports(...arguments)}handleExports(t){if(t.type==="ExportAllDeclaration"){let r=[d.literal("*"),this.$serial(t.exported||t),d.literal(t.exported?.name||t.exported?.value||"")];this.exports.add([d.arrayExpr(r),this.$obj({source:t.source,serial:this.$serial(t)})]),this.exportIds.push(r[2].value);return}let i=r=>r.map(s=>{let n=[d.literal(s.local.name),this.$serial(s)],a=s.exported.name||s.exported.value;return a!==s.local.name&&n.push(d.literal(a)),this.exportIds.push(a),d.arrayExpr(n)});if(t.source){this.exports.add(i(t.specifiers).concat(this.$obj({source:t.source,serial:this.$serial(t)})));return}if(t.type==="ExportNamedDeclaration"&&t.specifiers.length){this.exports.add(i(t.specifiers));return}if(t.type==="ExportDefaultDeclaration"){if(["Identifier","ThisExpression"].includes(t.declaration.type)){let r=[d.literal(t.declaration.name||"this"),this.$serial(t),d.literal("default")];this.exports.add([d.arrayExpr(r)]),this.exportIds.push("default");return}if(t.declaration.type==="Literal"){let r=[d.identifier(null),this.$serial(t),d.literal("default"),t.declaration];this.exports.add([d.arrayExpr(r)]),this.exportIds.push("default");return}}return this.transformNode(t.declaration,{isExport:t.type==="ExportDefaultDeclaration"?"as-default":!0})}transformImportDeclaration(t){let i=t.specifiers.map(r=>{let{imported:s,local:n}=r;this.transformSignal(n,"import"),r.type==="ImportNamespaceSpecifier"?s=d.identifier("*"):r.type==="ImportDefaultSpecifier"&&(s=d.identifier("default"));let a=s.name||s.value||"",o=[d.literal(a),this.$serial(r)];return a!==r.local.name&&o.push(d.literal(r.local.name)),d.arrayExpr(o)});return d.exprStmt(this.$call("import",...i.concat(this.$obj({source:t.source,serial:this.$serial(t)}))))}transformImportExpression(t){return this.$call("import",this.$obj({source:t.source,isDynamic:d.identifier("true"),serial:this.$serial(t)}))}transformSignal(t,i,r=null){return t.type==="Identifier"?(this.currentScope.push(t,i,["let","param"].includes(i)),r?.add(t),t):this.transformNode(t,{mode:i,static:!0,signals:r})}transformThisExpression(t){return this.transformIdentifier(...arguments)}transformIdentifier(t){let i=this.currentScope.find(t);!i&&t.name&&this.currentScope.$qIdentifiersNoConflict(t.name);let r=[];return t.hint?r.push(this.$obj({[t.hint]:d.identifier(!0)})):this.currentEntry.mode,["param","self"].includes(i?.type)||["arguments"].includes(t.name)?this.currentEntry.trail?this.$call("obj",t,...this.$trail(),...r):t:t.type==="ThisExpression"?this.$call("ref",d.literal("this"),...this.$trail(),...r):(this.history.forEach(s=>s.refs?.add(t)),this.currentEntry.isLeft&&this.currentEntry.mode!=="callee"&&r.push(this.$obj({isLeft:d.literal(!0)})),this.$call("ref",d.literal(t),...this.$trail(),...r))}transformMemberExpression(t){let{object:i,property:r,computed:s,optional:n}=t;s&&(r=this.transformNode(r));let a=this.transformNode(i,{trail:(this.currentEntry.trail||0)+1});return i.typed&&(a=this.$typed(i.typed,a,d.literal(r))),d.memberExpr(a,r,s,n)}transformVariableDeclaration(t){let i=this.currentEntry.isExport;return t.declarations.reduce((s,n)=>["ObjectPattern","ArrayPattern"].includes(n.id.type)?s.concat(this.expandPattern(n.id,n.init)):s.concat(n),[]).reduce((s,n)=>{let a=this.$serial(n),o=this.transformNode(n.init);this.transformSignal(n.id,t.kind,this.currentEntry.signals);let l=[];n.restOf&&(o=this.$typed(n.init.typed,o),l.push(this.$obj({restOf:n.restOf,type:d.literal(n.init.typed==="iterable"?"array":"object")})));let u=s.concat(this.$var(t.kind,a,n.id,o,...l));if(i&&!(n.id instanceof Rt)){let c=[d.literal(n.id),a];this.exports.add([d.arrayExpr(c)]),this.exportIds.push(n.id.name)}return u},[])}transformAssignmentExpression(t){let r=!this.currentEntry.static&&this.history[1].node.type==="ExpressionStatement",{left:s,right:n}=t,a=(l,u)=>(u=this.transformNode(u),l=this.transformNode(l,{isLeft:!0}),d.assignmentExpr(l,u,t.operator));if(["MemberExpression","ChainExpression"].includes(s.type))return a(s,n);if(["ObjectPattern","ArrayPattern"].includes(s.type)){let l=n,u=this.expandPattern(s,n,r).reduce((c,f)=>{if(f.id.originalB&&(l=f.id),f.type==="AssignmentExpression")return c.concat(a(f.left,f.right));let p=this.transformNode(f.init);if(f.id instanceof Rt){let m=this.$serial(f);return c.concat(this.$var("let",m,f.id,p))}this.transformSignal(f.id,"update",this.currentEntry.signals);let g=[];return f.restOf&&(p=this.$typed(f.init.typed,p),g.push(this.$obj({restOf:f.restOf,type:d.literal(f.init.typed==="iterable"?"array":"object")}))),c.concat(this.$update(f.id,p,...g))},[]);return r?u:d.sequenceExpr(u.concat(l))}n=this.transformNode(n),this.transformSignal(s,"update",this.currentEntry.signals);let o=this.currentScope.getRandomIdentifier("$current",!1);return this.$call("update",d.literal(s),this.$closure([o],d.assignmentExpr(o,n,t.operator.replace("====",""))))}transformAssignmentPattern(t){let{left:i,right:r}=t;return r=this.transformNode(r),["MemberExpression","ChainExpression"].includes(i.type)?i=this.transformNode(i,{static:!0}):i=this.transformSignal(i,this.currentEntry.mode,this.currentEntry.signals),d.assignmentPattern(i,r)}expandPattern(t,i,r=!0){let s=[],n=this;if(!["Identifier","Literal"].includes(i.type)&&r){let a=d.withLoc(n.currentScope.getRandomIdentifier("$rand",!1),i);a.originalB=!0,i.typed=t.type==="ObjectPattern"?"desctructurable":"iterable",s.push(d.withLoc(d.varDeclarator(a,i),i)),i=a}return function a(o,l,u){l.typed=u?"desctructurable":"iterable";let c=[];for(let f=0;f<o.length;f++){let p=o[f],g=f,m=p;if(p===null){c.push(f);continue}if(p.type==="RestElement"){let b=d.withLoc(d.varDeclarator(p.argument,l),p);b.restOf=c.map(S=>d.literal(S)),s.push(b);continue}u?{key:g,value:m}=p:g=d.literal(g);let _,v;m.type==="AssignmentPattern"?(_=m.right,m.left.type==="Identifier"?v=m.left:m=m.left):m.type==="Identifier"&&(v=m);let y=d.memberExpr(l,g,u?p.computed:!0);if(_&&(y=d.logicalExpr("||",y,_)),v)s.push(d.withLoc(d.varDeclarator(v,y),p)),c.push(g);else if(m.type==="MemberExpression"||m.type==="ChainExpression"&&(m=m.expression))s.push(d.withLoc(d.assignmentExpr(m,y),p));else if(m.elements||m.properties){let b=(m.properties?m.properties:m.elements).length>1;if(r&&b){let S=n.currentScope.getRandomIdentifier("$rand",!1);s.push(d.withLoc(d.varDeclarator(S,y),p)),y=S}a(m.elements||m.properties,y,m.properties&&!0)}}}(t.elements||t.properties,i,t.properties&&!0),s}transformUpdateExpression(t){if(t.argument.type==="Identifier"){this.transformSignal(t.argument,"update",this.currentEntry.signals);let i=this.currentScope.getRandomIdentifier("$current",!1),r=d.binaryExpr(t.operator==="--"?"-":"+",i,d.literal(1),!0),s=(t.prefix?"pre":"post")+(t.operator==="--"?"dec":"inc");return this.$call("update",d.literal(t.argument.name),this.$closure([i],r),this.$obj({kind:d.literal(s)}))}return d.updateExpr(t.operator,this.transformNode(t.argument),t.prefix)}transformUnaryExpression(t){return t.operator==="typeof"&&t.argument.type==="Identifier"&&(t.argument.hint="isTypeCheck"),d.unaryExpr(t.operator,this.transformNode(t.argument))}transformIfStatement(t){let i=this.$serial(t),{test:r,consequent:s,alternate:n}=t;r=this.transformNode(t.test),s=this.pushScope(t,()=>this.transformNodes(s.type==="BlockStatement"?s.body:[s])),n&&(n=[].concat(this.transformNode(n))[0]);let a=d.ifStmt(r,d.blockStmt(s),n);return this.$autorun("block",{static:d.identifier(this.currentEntry.static)},i,d.blockStmt([a]))}transformSwitchStatement(t){let i=this.$serial(t);return this.pushScope(t,()=>{let r=this.transformNode(t.discriminant),s=t.cases.map(a=>{let o=this.transformNode(a.test),l=this.transformNodes(a.consequent);return d.switchCase(o,l)}),n=d.switchStmt(r,s);return this.$autorun("switch",{static:d.identifier(this.currentEntry.static)},i,d.blockStmt([n]))})}transformTryStatement(t){return this.pushScope(t,()=>{let i=this.$serial(t),{block:r,handler:s,finalizer:n}=t,a=this.transformNodes(r.body),o={};if(s){let{start:l,end:u}=s,c=d.arrowFuncExpr(null,[s.param],s.body);o.handler=this.transformNode({...c,isHandler:!0,start:l,end:u},{static:!0})}if(n){let{start:l,end:u}=n,c=d.arrowFuncExpr(null,[],n.body);o.finalizer=this.transformNode({...c,isFinalizer:!0,start:l,end:u},{static:!0})}return this.$autorun("block",o,i,d.blockStmt(a))})}transformWhileStatement(t){return this.transformLoopStmtA(d.whileStmt,...arguments)}transformDoWhileStatement(t){return this.transformLoopStmtA(d.doWhileStmt,...arguments)}transformForStatement(t){return this.transformLoopStmtA(d.forStmt,...arguments)}transformLoopStmtA(t,i){let r=i.type==="WhileStatement"?"while":i.type==="DoWhileStatement"?"do-while":"for",s=this.$serial(i);return this.pushScope(i,()=>{let n=this.currentScope.get$qIdentifier("$q"),a,o={kind:d.literal(r),label:this.currentEntry.parentNode?.label?d.literal(this.currentEntry.parentNode.label.name):d.identifier("null"),static:d.identifier(this.currentEntry.static)};if(r==="for"){let u=d.blockStmt([].concat(this.transformNode(i.init)||[]));o.init=this.$closure([n],u);let c=this.transformNode(i.test);o.test=this.$closure([n],c);let f=this.transformNode(i.update);o.advance=this.$closure([n],f),a=p=>t.call(d,u,c,f,p)}else{let u=this.transformNode(i.test);o.test=this.$closure([n],u),a=c=>t.call(d,u,c)}let l=d.blockStmt(this.transformNodes(i.body.type==="BlockStatement"?i.body.body:[i.body]));return this.$autorun("iteration",o,s,l)})}transformForOfStatement(t){return this.transformLoopStmtB(d.forOfStmt,...arguments)}transformForInStatement(t){return this.transformLoopStmtB(d.forInStmt,...arguments)}transformLoopStmtB(t,i){let r=i.type==="ForInStatement"?"for-in":"for-of",s=this.$serial(i),n=this.transformNode(i.right);return this.pushScope(i,()=>{let a=this.currentScope.get$qIdentifier("$q"),o=this.currentScope.get$qIdentifier(r==="for-of"?"$val":"$key",!1),l={kind:d.literal(r),label:this.currentEntry.parentNode?.label?d.literal(this.currentEntry.parentNode.label.name):d.identifier("null"),parameters:this.$closure([a],d.arrayExpr([d.literal(o),n])),static:d.identifier(this.currentEntry.static)},u;if(i.left.type==="VariableDeclaration"){let f=d.withLoc(d.varDeclarator(i.left.declarations[0].id,o),i.left);u=d.varDeclaration(i.left.kind,[f])}else u=d.withLoc(d.assignmentExpr(i.left,o),i.left);let c=d.blockStmt(this.transformNodes([u].concat(i.body.type==="BlockStatement"?i.body.body:i.body)));return this.$autorun("iteration",l,s,c)})}transformBreakStatement(t){return this.transformExitStmt(d.breakStmt,...arguments)}transformContinueStatement(t){return this.transformExitStmt(d.continueStmt,...arguments)}transformExitStmt(t,i){let r=i.type==="BreakStatement"?"break":"continue",s=d.literal(r),n=i.label?d.literal(i.label.name):d.identifier("null");return this.hoistExitStatement(s,n),this.currentEntry.parentNode?.type==="SwitchStatement"?t.call(d):d.exprStmt(this.$call(r,n))}transformReturnStatement(t){let i=new Set,r=this.transformNode(t.argument,{refs:i}),s=d.literal("return"),n=r?[s,r]:[s];this.hoistExitStatement(...n);let a=this.$call("return",...n.slice(1));if(!i.size)return d.exprStmt(a);let o=this.$serial(t);return this.$autorun("return",o,a)}transformBlockStatement(t){let i=this.$serial(t);if(t instanceof ye){let r=this.transformNodes(t.body,{static:!1});return this.$autorun("downstream",i,d.blockStmt(r))}return this.pushScope(t,()=>{let r=d.blockStmt(this.transformNodes(t.body));return this.$autorun("block",{static:d.identifier(this.currentEntry.static)},i,r)})}transformLabeledStatement(t){this.currentScope.push(t.label,"const");let i=[].concat(this.transformNode(t.body));return[d.labeledStmt(t.label,i.shift()),...i]}transformExpressionStatement(t){let i=this.$serial(t),r=this.transformNode(t.expression);return[].concat(r||[]).reduce((n,a)=>{if(a.type==="VariableDeclaration"||a.type.endsWith("Statement"))return n.concat(a);let o={};return this.currentEntry.static&&(o.static=d.literal(!0)),["UpdateExpression","UnaryExpression"].includes(a.type)&&(o.isWrite=d.literal(!0)),n.concat(this.$autorun("stmt",o,i,a))},[])}transformAwaitExpression(t){this.hoistAwaitKeyword();let i=this.transformNode(t.argument);return d.awaitExpr(i)}transformSequenceExpression(t){let i=t.expressions.reduce((r,s,n)=>r.concat(this.transformNode(s,{trail:n===t.expressions.length-1?this.currentEntry.trail:void 0})),[]);return this.history[1].node.type==="ExpressionStatement"?i:d.sequenceExpr(i)}transformConditionalExpression(t){let{test:i,consequent:r,alternate:s}=t;return i=this.transformNode(i),r=this.transformNode(r,{trail:this.currentEntry.trail}),s=this.transformNode(s,{trail:this.currentEntry.trail}),d.conditionalExpr(i,r,s)}transformLogicalExpression(t){let{left:i,right:r}=t;return i=this.transformNode(i,{trail:this.currentEntry.trail}),r=this.transformNode(r,{trail:this.currentEntry.trail}),d.logicalExpr(t.operator,i,r)}transformBinaryExpression(t){let{left:i,right:r}=t;i=this.transformNode(i),r=this.transformNode(r);let s=d.binaryExpr(t.operator,i,r);return this.currentEntry.trail?this.$call("obj",s,...this.$trail()):s}transformCallExpression(t){return this.transformCallExpr(d.callExpr,...arguments)}transformNewExpression(t){return this.transformCallExpr(d.newExpr,...arguments)}transformCallExpr(t,i){let r=this.transformNode(i.callee,{mode:"callee"}),s=i.arguments.map(a=>this.transformNode(a)),n=t.call(d,r,s,i.optional);return this.currentEntry.trail?this.$call("obj",n,...this.$trail()):n}transformObjectExpression(t){let i=d.objectExpr(t.properties.map(r=>this.transformNode(r)));return this.currentEntry.trail?this.$call("obj",i,...this.$trail()):i}transformProperty(t){let{key:i,value:r}=t;return t.computed&&(i=this.transformNode(i)),r=this.transformNode(r),d.property(i,r,t.kind,!1,t.computed,!1)}transformArrayExpression(t){let i=d.arrayExpr(t.elements.map(r=>this.transformNode(r)));return this.currentEntry.trail?this.$call("obj",i,...this.$trail()):i}transformTaggedTemplateExpression(t){let[i,r]=this.transformNodes([t.tag,t.quasi]),s=d.taggedTemplateExpr(i,r);return this.currentEntry.trail?this.$call("obj",s,...this.$trail()):s}transformTemplateLiteral(t){let i=t.expressions.map(s=>this.transformNode(s)),r=d.templateLiteral(t.quasis,i);return this.currentEntry.trail?this.$call("obj",r,...this.$trail()):r}};var Ws=new Map;function Yt(e,t={}){if(typeof e!="string")return e;let i=`${e}${JSON.stringify(t)}`,r=Ws.get(i);if(!r){r=Ms.parse(e,t);try{}catch(s){let n=`${s.message||s}`,{pos:a,loc:{line:o,column:l}={}}=s,c=[{expr:e.slice(Math.max(0,a-15),a+15),line:o,column:l},{source:e}];throw t.inBrowser&&console.error(c),new(globalThis[s.name]||Error)(n,{cause:c})}Ws.set(i,r)}return r}function be(e,t={}){return e=Yt(e,t),new xe(t).transform(e)}function we(e,t={}){return new xe(t).serialize(e)}function ve(...e){let t,i={runtimeParams:Ia,transformerParams:Pa,parserParams:Aa};for(;t=e.shift();){let{runtimeParams:r={},transformerParams:{globalsNoObserve:s=[],globalsOnlyPathsExcept:n=[],...a}={},parserParams:o={}}=t;i={runtimeParams:{...i.runtimeParams,...r},transformerParams:{...i.transformerParams,globalsNoObserve:[...i.transformerParams.globalsNoObserve,...s],globalsOnlyPathsExcept:[...i.transformerParams.globalsOnlyPathsExcept,...n],...a},parserParams:{...i.parserParams,...o}},e.devMode}return i}var Aa={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Pa={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Ia={apiVersion:3};var Ke=Object.create(null);var Jt=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),Qr.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(i=>i.abort?i.abort(t):i(t)),this.managedOnce.forEach(i=>i.abort?i.abort(t):i(t)),this.managedOnce.clear(),this.fire("abort")}manage(t){this.managedAlways.add(t)}once(t){this.managedOnce.add(t)}};var Zt=class extends Jt{subscribers=new Set;signals=new Map;constructor(t,i,r){super(),this.context=t,this.context?.once(()=>this.abort()),this.once(()=>this.watchMode(!1)),this.type=i,this.state=r}get name(){return[...this.context?.signals.keys()||[]].find(t=>this.context.signals.get(t)===this)}signal(t,i="prop"){let r=this.signals.get(t);return r||(r=new Zt(this,i,i==="object"?t:Qi(this.state)?M.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||!Qi(this.state))&&(this.mutationsWatch=M.observe(this.state,i=>{let r={map:new Map,add(n,a,o){for(let l of n)l.runtime.thread.includes(l),l.spec.beforeSchedule?.(a)!==!1&&(this.map.has(l.runtime)||this.map.set(l.runtime,new Set),this.map.get(l.runtime).add(l))}};for(let n of i){let a=this.signals.get(n.key);!a||(r.add(a.subscribers,n,a),a.refresh(n.value))}let s=r.map.size?[...r.map].sort((n,a)=>n[0].$serial>a[0].$serial?1:-1):r.map;for(let[n,a]of s)n.state!=="aborted"&&n.schedule(...a)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[i,r]of this.signals)r.refresh(M.get(this.state??{},i));this.watchMode()}};var gt=class extends Zt{symbols=new Map;constructor(t,i,r=void 0){super(t,i,r||Object.create(null))}};var kt=class extends Jt{state;constructor(t,i,r,s,n,a){super(),t?.once(this),this.context=t,this.type=i,this.spec=r||{},this.scope=n,t?.scope!==n&&this.manage(n),this.serial=s,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[i,r]=t.path.length<this.path.length?[t,this]:[this,t];return i.path.reduce((s,n,a)=>s&&n<=r.path[a],!0)&&i||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){return this.runtime.thread.unshift(this),it(this.beforeExecute(),i=>Xi(this.closure,this,this,(r,s)=>s?this.throw(s,[this.serial,this.context?.serial],s.code):(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(i),this.runtime.thread.shift(),t?t(r,this):r)))}throw(t,i,r){if(this.type==="function"&&["HandlerFunction","FinalizerFunction"].includes(this.$params.executionMode))return this.$params.lexicalContext.throw(t,i,r);if(this.spec.handler)return this.spec.handler(t);if(this.type!=="function"&&this.context)return this.context.throw(t,i,r);if(t.cause)throw t;let s=`${t.message||t}`,n=r!==null?`[${r}]: ${s}`:s,a=i.map(c=>c!==-1&&this.extractSource(c,!0)).filter(c=>c);a.push({source:this.runtime.$params.originalSource});let o=globalThis[t.name],l=new(o||Error)(n,{cause:a}),u=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw u&&(l.fileName=u),r&&(l.code=r),l}afterExecute(t){this.state="complete";let i=this.flowControl;this.spec.finalizer&&this.spec.finalizer(),this.handleDownstream(i.size,t.size),this.handleRightstream(i.size,t.size);for(let r of["break","continue","return"])i.has(r)&&!i.get(r).endpoint?this.hoistFlowControl(r,i.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,i,r=void 0){let s=Array.isArray(i)?"array":i===null?"null":typeof i;if(s===t||t==="iterable"&&i?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(s))return i;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,i,r,s={}){return this.var(t,i,r,{...s,kind:"let"})}const(t,i,r,s={}){return this.var(t,i,r,{...s,kind:"const"})}var(t,i,r,s={}){s={kind:"var",...s},r||(r=()=>{});let n=s.restOf?(...o)=>{try{return r(...o)}catch(l){throw new Error(`Cannot declare ${t}; ${l.message}`)}}:r,a=(o,l)=>{let u=l.scope;if(s.kind==="var")for(;!["module","function"].includes(u.type)&&!M.has(u.state,t)&&u.context;)u=u.context;else u.type==="this"&&u.context&&(u=u.context);let c=u.symbols.get(t);if(c&&(c.kind!==s.kind||s.kind==="let"&&c.serial!==i))throw new Error(`Identifier "${t}" has already been declared.`);c?.reader?.abort(),c={serial:i,kind:s.kind};let f=o;return s.restOf&&(s.type==="array"?f=[]:f={},c.reader=M.map(o,f,{except:s.restOf,spread:s.type==="array"}),l.once(c.reader)),u.symbols.set(t,c),M.set(u.state,t,f),f};return this.autorun(s.kind,{complete:a,...s},i,n)}update(t,i,r={}){let s=this.scope;for(;s&&!M.has(s.state,t);)s=s.context;if(!s)throw new ReferenceError(`${t} is not defined.`);let n=s.symbols.get(t);if(n?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let a=M.get(s.state,t),o=r.restOf?(...l)=>{try{return i(...l)}catch(u){throw new Error(`Cannot update ${t}; ${u.message}`)}}:i;return Xi(o,void 0,a,(l,u)=>{if(u)return this.throw(u,[this.serial]);n?.reader?.abort();let c=l;r.restOf&&(n=n||{},r.type==="array"?c=[]:c={},n.reader=M.map(l,c,{except:r.restOf,spread:r.type==="array"}),this.once(n.reader));let f=this.spec.static||this.type==="function"&&this.$params?.executionMode==="RegularFunction";return M.set(s.state,t,c),["postinc","postdec"].includes(r.kind)?a:c})}ref(t,...i){let r=0,s={};typeof i[0]=="number"?(r=i.shift(),s=i.shift()||{}):typeof i[0]=="object"&&(s=i.shift());let n=this.scope;for(;n&&!M.has(n.state,t);)n=n.context;if(!n){if(s.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let a=n.symbols.get(t)?.kind,o=n.signal(t,a);return s.typed&&this.typed(s.typed,o.state,t),this.autobind(o,r,s)}obj(t,...i){let r=0,s={};return typeof i[0]=="number"?(r=i.shift(),s=i.shift()||{}):typeof i[0]=="object"&&(s=i.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,s)}autobind(t,i,r){let s=["LiveProgram","LiveFunction"].includes(this.runtime.$params.executionMode),n=t.type==="const",a=this===this.runtime,o=this.state==="aborted",l=this.spec.static,u=this.spec.isWrite,c=this;return function f(p,g={},m){if(s&&!l&&!u&&!r?.isLeft&&!n&&!a&&!o&&p.subscribe(c),!m||!p.state||typeof p.state!="object"){let v=p.state;return typeof p.state=="function"&&!/^class\s?/.test(Function.prototype.toString.call(p.state))&&(v=M.proxy(p.state,{...g,membrane:p})),v}let _;return M.proxy(p.state,g,v=>({...v,get(y,b,S=null){if(_)return v.get(y,b,S);_=!0;let w={...g};return Array.isArray(y)&&(w.arrayMethodName=b),f(p.signal(b),w,m-1)}}))}(t,{},i)}autorun(t,...i){let r=i.pop(),s=i.pop(),n=i.pop()||{},a=kt,o=this.scope;if(t==="iteration"){let u=this.runtime.constructor;a=r.constructor.name==="AsyncFunction"?u.AutoAsyncIterator:u.AutoIterator}["block","switch","iteration"].includes(t)&&(o=new gt(o,t));let l=new a(this,t,n,s,o,r);if(t==="downstream"){if(this.downstream=l,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return l.execute()}function(t,i,r,s){if(i==="Declaration"){let a=this.scope.type==="this"?this.scope.context:this.scope;M.set(a.state,s.name,s)}let n=this;return Object.defineProperty(s,"toString",{value:function(a=!1){if(a&&t==="LiveFunction")return Function.prototype.toString.call(s);let o=n.runtime.extractSource(r);return o.startsWith("static ")?o.replace("static ",""):o}}),s}class(t,i,r){if(t==="Declaration"){let s=this.scope.type==="this"?this.scope.context:this.scope;M.set(this.scope.state,i.name,i)}return r.forEach(({name:s,isLiveFunction:n,static:a,serial:o})=>{this.function(n&&"LiveFunction"||"RegularFunction","Expression",o,a?i[s]:i.prototype[s])}),i}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,i,r=!1){let s=this.flowControl.size;if(r?this.flowControl.delete(t):this.flowControl.set(t,{arg:i}),this.type==="round"&&(this.context.breakpoint=this),this.type==="round"&&["break","continue"].includes(t)&&i===this.context?.spec.label){r||(this.flowControl.get(t).endpoint=!0),this.state!=="running"&&this.handleRightstream(this.flowControl.size,s);return}if(this.context?.type==="switch"&&t==="break"&&!i){r||(this.flowControl.get(t).endpoint=!0),this.context.breakpoint=this;return}this.state!=="running"&&(this.handleDownstream(this.flowControl.size,s),this.hoistFlowControl(...arguments))}hoistFlowControl(...t){return this.context?.applyFlowControl(...t)}flowControlApplied(t,i){return arguments.length?arguments.length===1?this.flowControl.has(t):this.flowControl.get(t)?.arg===i:this.flowControl.size||!1}handleDownstream(t,i){let r;!["block"].includes(this.type)||!(r=this.context?.downstream)||(t?r.abort():i&&(r.state="resuming",this.runtime.schedule(r)))}handleRightstream(t,i){if(this.type!=="round")return;let r=this,s=new Set;for(;r=r.nextRound;)t?r.abort():i&&r.state!=="inert"&&(r.state="resuming",s.add(r));s.size&&this.runtime.schedule(...s),!t&&i&&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 te=class extends kt{rounds=new Map;constructor(t,i,r,s,n,a){r.$closure=a,super(t,i,r,s,n),this.manage(()=>{delete this.breakpoint,this.rounds.clear()})}pseudorun(t){return this.runtime.iThread.unshift(this),it(t(),i=>(this.runtime.iThread.pop(),i))}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,i=()=>{this.createRound(this.cursor.value).execute(),this.advance()};if(this.spec.kind==="do-while")do i();while(t());else for(;t();)i();this.iterating=!1}createRound(t){let i=this.rounds.size,r={index:i},s=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},n=new gt(this.scope,"round",s);this.scope.symbols.forEach((l,u)=>{n.symbols.set(u,l)});let a=new kt(this,"round",r,this.serial,n,this.spec.$closure),o=this.spec.kind==="for-in"?t:i;return this.rounds.set(o,a),this.lastRound&&(this.lastRound.nextRound=a,a.prevRound=this.lastRound),this.lastRound=a,a}watchMode(){if(this.spec.static)return;let t=(i,r)=>{let s=new Set,n=new Set;for(let a of i){if(Array.isArray(this.iteratee)&&a.key==="length")continue;let o=this.spec.kind==="for-in"?a.key:a.value,l=this.spec.kind==="for-in"?a.key:parseInt(a.key),u=this.rounds.get(l);if(u)M.set(u.scope.state,this.production,o),a.type==="delete"&&(this.rounds.set(l,void 0),u.prevRound&&(u.prevRound.nextRound=u.nextRound),u.nextRound&&(u.nextRound.prevRound=u.prevRound),s.add(u));else if(a.type!=="delete"&&!a.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;n.add(o)}}this.runtime.on("reflection",()=>{s.forEach(a=>a.abort(!0))},{once:!0}),n.size&&(this.iterator=function*(a){yield*a,yield*n}(this.iterator),r.done&&this.iterate())};this.once(M.observe(this.iteratee,i=>{it(this.cursor,r=>t(i,r))}))}};var Xe=class extends te{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 i=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 i());else for(;await i();)await r();this.iterating=!1}};var ee=class extends kt{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,i,r,s,n){let{$serial:a=0,spec:o,...l}=r;super(t,i,o,-1,s,n),this.$serial=a,this.$params=l,this.$objects=new gt(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{M.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,i=!1){let[[r,s,n],[a]]=this.locations[t],o=this.$params.originalSource.slice(r,a);return i?{expr:o,line:s,column:n}:o}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let i=this.queue.size;for(let r of t)this.queue.add(r);if(!i)return this.flowControlDirty=!1,function r(s,n){let a;for(let o of this.queue){if(n&&n.order(o)!==n||["aborted","running"].includes(o.state)||this.iThread[0]?.contains(o)){this.queue.delete(o);continue}a=a?a.order(o):o,n||(n=a)}return a?(a.abort(),a.execute(o=>(this.queue.delete(a),r.call(this,o,a)))):(this.fire("reflection"),this.flowControlApplied()&&this.fire("statechange"),s)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(i=>{let r=["LiveProgram","LiveFunction"].includes(this.$params.executionMode),s=this.$params.sourceType==="module"||this.$params.sourceType==="script",n=r||this.$params.executionMode==="RegularProgram"&&s?new Xt(this):this.flowControl.get("return")?.arg;return t?t(n,this):n})}spawn(t,i,r,s=null){let n=this.nowRunning||s||this,a={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:s},o=new gt(n.scope,"function",i?{this:i}:{});return new this.constructor(n,"function",a,o,r).execute()}async import(...t){let i=t.pop(),r=typeof i=="string"?{source:i}:i,s=a=>{if(r.forExport||r.isDynamic)return a;this.assignModules(t,this.scope.state,a,i.serial)};if(this.$params.experimentalFeatures!==!1&&Ke[r.source])return s(Ke[r.source]);let n=(async()=>{let a=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return s({...await import(r.source)})}catch(o){o.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${a?` imported at "${a}"`:""}.`),[r.serial],o.code):this.throw(o,[r.serial],o.code)}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(n),n}async export(...t){let i=Array.isArray(t[t.length-1])?null:t.pop(),r=i?await this.import({...i,forExport:!0}):this.scope.type==="this"?this.scope.context.state:this.scope.state;this.assignModules(t,this.exports,r,i?.serial)}assignModules(t,i,r,s=null){let n=[],a=["LiveProgram","LiveFunction"].includes(this.$params.executionMode);for(let[o,l,u,c]of t){if(o===null){(a?M:Reflect).set(i,u,c);continue}if(o==="*"&&u){(a?M:Reflect).set(i,u,r);continue}M.has(r,o)||this.throw(new Error(`The requested module does not provide an export named "${o}".`),[l,s]),(a?M:Reflect).set(i,u||o,M.get(r,o)),n.push([o,l,u])}!n.length||!a||this.once(M.observe(r,o=>{for(let[l,,u]of n)for(let c of o)l==="*"?M.set(i,c.key,c.value):c.key===l&&M.set(i,u||l,c.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(Ke[this.$params.exportNamespace]=this.exports,this.once(()=>{delete Ke[this.$params.exportNamespace]})),super.afterExecute(...t)}};J(ee,"AutoAsyncIterator",Xe),J(ee,"AutoIterator",te);function xi(e,t,i,r=[],s={}){typeof r=="object"&&r&&!Array.isArray(r)&&(s=r,r=[]);let{liveMode:n=!0,thisContext:a,env:o,exportNamespace:l,fileName:u,base64:c,compileFunction:f,forDynamicBinding:p=!1,...g}=s,{parserParams:m,transformerParams:_,runtimeParams:v}=ve(g),y=/module/.test(e),b=/script/.test(e),S=/function/.test(e),w=/async/.test(e)||/module/.test(e),x=/source/.test(e),C=/file/.test(e),E=typeof i=="object"&&i?.type==="Program";E||(i=i+"");let P=i;if(y)m.sourceType="module",m.allowAwaitOutsideFunction=!0,m.executionMode=n?"LiveProgram":"RegularProgram";else if(b)m.executionMode=n?"LiveProgram":"RegularProgram";else if(S){if(x)if(E)i=d.funcExpr(null,r.map(D=>d.identifier(D)),d.blockStmt(n?[d.literal("use live"),...i.body]:i.body),w),i.isLiveFunction=P.isLiveProgram;else{let D=" "+i.split(`
|
|
1
|
+
var Sr=Object.defineProperty;var fi=(i,t,e)=>t in i?Sr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Pe=(i,t)=>{for(var e in t)Sr(i,e,{get:t[e],enumerable:!0})};var V=(i,t,e)=>(fi(i,typeof t!="symbol"?t+"":t,e),e),Or=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var U=(i,t,e)=>(Or(i,t,"read from private field"),e?e.call(i):t.get(i)),Ut=(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)},It=(i,t,e,r)=>(Or(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e);var Ke={};Pe(Ke,{AsyncLiveFunction:()=>Wi,AsyncLiveScript:()=>ne,LiveFunction:()=>Fi,LiveModule:()=>oe,LiveProgramHandle:()=>vt,LiveScript:()=>zi,Observer:()=>C,compile:()=>Dr,matchPrologDirective:()=>jr,nextKeyword:()=>Rr,parse:()=>ge,serialize:()=>be,transform:()=>ye});var Xe={};Pe(Xe,{any:()=>Pi,apply:()=>We,batch:()=>Ge,construct:()=>Fe,defineProperties:()=>Mi,defineProperty:()=>Zt,deleteProperties:()=>qi,deleteProperty:()=>Kt,get:()=>ut,getOwnPropertyDescriptor:()=>de,getOwnPropertyDescriptors:()=>Ci,getPrototypeOf:()=>Ne,has:()=>he,intercept:()=>Ti,isExtensible:()=>Le,map:()=>Ii,observe:()=>Ve,ownKeys:()=>He,path:()=>Ei,preventExtensions:()=>Be,reduce:()=>Ue,set:()=>xt,setPrototypeOf:()=>ze,subtree:()=>Ai});function q(i){return!Array.isArray(i)&&typeof i=="object"&&i}function Mt(i){return typeof i}function M(i){return Array.isArray(i)}function qt(i){return typeof i=="function"}function Vt(i){return i===null||i===""}function at(i){return arguments.length&&(i===void 0||typeof i>"u")}function j(i){return Array.isArray(i)||typeof i=="object"&&i||qt(i)}function Te(i){return Vt(i)||at(i)||i===!1||i===0||j(i)&&!Object.keys(i).length}function k(i){return qt(i)||i&&{}.toString.call(i)==="[object function]"}function Gt(i){return i instanceof Number||typeof i=="number"}function Z(i){return Gt(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function kt(i){return i instanceof String||typeof i=="string"&&i!==null}function Ce(i){return!kt(i)&&!at(i.length)}function ue(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function Ie(r,t){t=t||Object.prototype,t=t&&!M(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 Me(i,t){var e=[];return Ie(i,t).forEach(r=>{ue(e,...Object.getOwnPropertyNames(r))}),e}function it(i,t,e=!1,r=!1,n=!1){var o=0,s=i.shift();if((Z(s)||s===!0||s===!1)&&(o=s,s=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((a,c)=>{!j(a)&&!k(a)||(e?Me(a):Object.keys(a)).forEach(l=>{if(!!t(l,s,a,c)){var u=s[l],p=a[l];if((M(u)&&M(p)||q(u)&&q(p))&&(o===!0||o>0))s[l]=M(u)&&M(p)?[]:{},it([Z(o)?o-1:o,s[l],u,p],t,e,r,n);else if(M(s)&&M(a))r?s[l]=p:s.push(p);else try{n?Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(a,l)):s[l]=a[l]}catch{}}})}),s}function Xt(...i){return it(i,(t,e,r)=>!0,!1,!1,!1)}function W(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 fe,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 fe,n.set(r,e));return e}var fe=class extends Map{};function F(i,t=!0){return M(i)?i:!t&&q(i)?[i]:i!==!1&&i!==0&&Te(i)?[]:Ce(i)?Array.prototype.slice.call(i):q(i)?Object.values(i):[i]}var L=(i,...t)=>W(i,"observerAPI",...t),jt=(i,t)=>i instanceof Promise?i.then(t):t(i),pe={};var bt=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 Jt=class extends bt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),pe.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=F(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 jt(n,o=>{let s=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&s?.length?this.emit.currentRegistration.fire(s):o})}};var wt=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(!j(e))throw new Error(`Subject must be of type object; "${Mt(e)}" given!`);let o=this;return n&&L(globalThis,"observerAPI","namespaces").has(t+"-"+n)&&(o=L(globalThis,"observerAPI","namespaces").get(t+"-"+n),t+="-"+n),!L(e,"registry").has(t)&&r&&L(e,"registry").set(t,new o(e)),L(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return L(globalThis,"observerAPI","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}.`);L(globalThis,"observerAPI","namespaces").set(t,r),r.__namespace=e}};var z=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 lt=class extends wt{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 Jt(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 u of t)r+=1,u.params.withPropertyDescriptors&&(n+=1),u.params.withArrayMethodDescriptors&&(o+=1);let s=[],a=[],c=[],l=[];for(let u of e){let p=u.arrayMethodName,f=u.eventsArePropertyDescriptors,d=u.eventIsArrayMethodDescriptor;for(let m of u.events)if(p&&(m.operation=p),n&&(o&&s.push(m),d||o!==r&&a.push(m)),n!==r){let w=m;if(f){let{target:v,type:g,...y}=m;w=new z(v,{type:"set",...y}),Object.defineProperty(w,"value","get"in y.value?{get:()=>y.value.get()}:{value:y.value.value}),y.oldValue&&Object.defineProperty(w,"oldValue","get"in y.oldValue?{get:()=>y.oldValue.get()}:{value:y.oldValue.value})}o&&c.push(w),d||o!==r&&l.push(w)}}for(let u of t)u.params.withPropertyDescriptors?u.params.withArrayMethodDescriptors?s.length&&u.fire(s):a.length&&u.fire(a):u.params.withArrayMethodDescriptors?c.length&&u.fire(c):l.length&&u.fire(l)}batch(t,e={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:e});let r=t();return jt(r,n=>{let o=this.batches.shift();return o.snapshots.length&&this.$emit(o.entries,o.snapshots),n})}};var Qt=class extends bt{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 wt{static getInstance(t,e=!0,r=null){return super._getInstance("traps",...arguments)}static namespace(t,e=null){return super._namespace("traps",...arguments)}addRegistration(t){return super.addRegistration(new Qt(this,t))}emit(t,e=null){let r=this;return function n(o,...s){let a=r.entries[o];return a?a.exec(t,(...c)=>n(o+1,...c),...s):e?e(t,...s):s[0]}(0)}};var De={};Pe(De,{accessorize:()=>Oi,proxy:()=>je,unaccessorize:()=>$i,unproxy:()=>Yt});var Ir=Symbol("wqOriginal");function Oi(i,t,e={}){i=Re(i);let r=L(i,"accessorizedProps");function n(c){let l,u=i;do l=Object.getOwnPropertyDescriptor(u,c);while(!l&&(u=Object.getPrototypeOf(u)));return l?{proto:u,descriptor:l}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(c){if(r.has(c+""))return!0;let l=n(c);l.getValue=function(f=!1){return f?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},l.setValue=function(f,d=!1){if(this.dirty=!0,d){this.descriptor=f;return}return this.descriptor.set?this.descriptor.set(f)!==!1:(this.descriptor.value=f,!0)},l.intact=function(){let f=Object.getOwnPropertyDescriptor(i,c);return f?.get===p.get&&f?.set===p.set&&r.get(c+"")===this},l.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[c]:Object.defineProperty(i,c,this.descriptor),r.delete(c+""),!0):!1},r.set(isNaN(c)?c:parseInt(c),l);let{enumerable:u=!0}=l.descriptor,p={enumerable:u,configurable:!0};("value"in l.descriptor||l.descriptor.set)&&(p.set=function(f){return xt(this,c,f,e)}),("value"in l.descriptor||l.descriptor.get)&&(p.get=function(){return ut(this,c,e)});try{return Object.defineProperty(i,c,p),!0}catch{return r.delete(c+""),!1}}let a=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(o);return t===void 0||Array.isArray(t)?a:a[0]}function $i(i,t,e={}){i=Re(i);let r=L(i,"accessorizedProps");function n(a){return r.has(a+"")?r.get(a+"").restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(n);return t===void 0||Array.isArray(t)?s:s[0]}function je(i,t={},e=void 0){let r=Re(i);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&L(r,"membraneRef").has(t.membrane))return L(r,"membraneRef").get(t.membrane);let n={apply:(a,c,l)=>We(a,c,l,void 0,t),construct:(a,c,l=null)=>Fe(a,c,l,t),defineProperty:(a,c,l)=>Zt(a,c,l,t),deleteProperty:(a,c)=>Kt(a,c,t),get:(a,c,l=null)=>{if(c===Ir)return r;let u={...t,receiver:l},p=ut(a,c,u);return Array.isArray(a)&&typeof p=="function"&&!/^class\s?/.test(Function.prototype.toString.call(p))?je(p,{...t,arrayMethodName:c,membrane:l},e):t.chainable&&j(p)&&c!=="prototype"&&!(typeof p=="function"&&/^class\s?|\{\s\[native\scode\]\s\}$/.test(Function.prototype.toString.call(p)))?je(p,t,e):p},getOwnPropertyDescriptor:(a,c)=>de(a,c,t),getPrototypeOf:a=>Ne(a,t),has:(a,c)=>he(a,c,t),isExtensible:a=>Le(a,t),ownKeys:a=>He(a,t),preventExtensions:a=>Be(a,t),set:(a,c,l,u=null)=>xt(a,c,l,{...t,receiver:u}),setPrototypeOf:(a,c)=>ze(a,c,t)},o=e?.(n)||n,s=new Proxy(r,o);return t.membrane&&L(r,"membraneRef").set(t.membrane,s),s}function Yt(i){return i&&i[Ir]||i}function Re(i){if(!i||!j(i))throw new Error("Target must be of type object!");return Yt(i)}var te=class extends Array{};function Ei(...i){return new te(...i)}var _t=class extends Array{};function Ai(){return new _t}function Pi(){return 1/0}function Ue(i,t,e,r=o=>o,n={}){let o=t instanceof _t;if(!(!o&&!t?.length))return function s(a,c,l,u){let p=u||c[l.level]instanceof _t,f=p?1/0:c[l.level],d=p?!1:l.level===c.length-1;return a instanceof z&&a.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!d}),e(a,f,(m,...w)=>{let v=x=>{x instanceof z&&(x.path="key"in x?[x.key]:[],a instanceof z&&(x.path="key"in x?a.path.concat(x.key):a.path.slice(0),Object.defineProperty(x,"context",{get:()=>a,configurable:!0})))},g=w[0]||{},y=x=>{if(x instanceof z&&"argumentsList"in x)return;let S=nt(x,!1);return jt(S,h=>(x instanceof z?x.value=h:x=h,s(x,c,{...l,...g,keyInParent:x.key,level:l.level+1},p)))};if(ee(f)&&Array.isArray(m)){if(m.forEach(v),d)return r(m,...w);p&&m[0]instanceof z&&(m[0].operation!=="get"||n.asGet)&&r(m,...w);for(let x of m)y(x);return}return v(m),d?r(m,...w):y(m)},l)}(i,t.slice(0),{...n,level:0},o)}function Ve(i,t,e,r={}){let n=nt(i,!r.level);if(k(arguments[1])&&([,e,r={}]=arguments,t=1/0),!k(e))throw new Error(`Handler must be a function; "${Mt(e)}" given!`);if(t instanceof te||t instanceof _t)return Ue(n,t,Ve,e,r);if(r={...r,descripted:!0},delete r.live,!j(n))return r.probe&&ut(n,t,e,r)||void 0;let o=Mr(n,t,e,r);return r.probe?ut(n,t,o,r):o()}function Ti(i,t,e={}){let r=nt(i);return q(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),ct.getInstance(r,!0,e.namespace).addRegistration({traps:t,params:e})}function de(i,t,e=n=>n,r={}){return rt(i,"getOwnPropertyDescriptor",{key:t},e,r)}function Ci(i,t,e=n=>n,r={}){return rt(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Ne(i,t=r=>r,e={}){return rt(i,"getPrototypeOf",{},t,e)}function Le(i,t=r=>r,e={}){return rt(i,"isExtensible",{},t,e)}function He(i,t=r=>r,e={}){return rt(i,"ownKeys",{},t,e)}function he(i,t,e=n=>n,r={}){return rt(i,"has",{key:t},e,r)}function ut(i,t,e=n=>n,r={}){let n,o=nt(i,!r.level);return q(e)?[r,e]=[e,s=>s]:r.live&&(n=!0),t instanceof te||t instanceof _t?Ue(o,t,ut,e,{...r,asGet:!0}):ki(o,t,s=>{let a=[...s];return function c(l,u,p){if(!u.length)return p(l);let f=u.shift();if(!["string","number","symbol"].includes(typeof f))throw new Error(`Property name/key ${f} invalid.`);function d(v,g=void 0){let y=h=>(v.value=h,c([...l,r.live||r.descripted?v:h],u,p));if(arguments.length>1)return y(g);if(!j(o))return y(o?.[v.key]);let x=L(o,"accessorizedProps",!1),S=x&&x.get(v.key);if(S&&S.intact())return y(S.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let h=Object.getOwnPropertyDescriptor(o,v.key);return y(h)}return y(Reflect.get(o,v.key))}let m=new z(o,{type:"get",key:f,value:void 0,operation:"get",related:a});if(!j(o))return d(m);let w=ct.getInstance(o,!1,r.namespace);return w?w.emit(m,d):d(m)}([],s.slice(0),c=>{let l=ee(t)?c:c[0];return n&&j(o)?Mr(o,t,e,r,i.key)(l):e(l)})},r)}function Ge(i,t,e={}){let r=nt(i);return lt.getInstance(r,!0,e.namespace).batch(t,e)}function Ii(i,t,e={}){t=nt(t),i=nt(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Object.keys(e.spread?[...i]:i).map(l=>isNaN(l)?l:parseInt(l)),s=r.length?r.filter(l=>o.includes(l)):o.filter(l=>!n.includes(l)),a=l=>!Array.isArray(t)||isNaN(l)?l:l-n.filter(u=>u<l).length,c=l=>{let u=de(i,l,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?xt(t,a(l),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&Zt(t,l,{...u,configurable:!0},e)};return Ge(t,()=>{s.forEach(c)}),Ve(i,l=>{l.filter(u=>r.length?r.includes(u.key):!n.includes(u.key)).forEach(u=>{if(u.type==="delete")return Kt(t,a(u.key),e);if(u.type==="def"){(u.value.enumerable||e.onlyEnumerable===!1)&&Zt(t,a(u.key),{...u.value,configurable:!0},e);return}c(u.key)})},{...e,withPropertyDescriptors:!0})}function xt(i,t,e,r=s=>s,n={},o=!1){let s=nt(i),a=[[t,e]];q(t)&&([,,r=l=>l,n={},o=!1]=arguments,a=Object.entries(t)),q(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,l=>l]);let c=a.map(([l])=>l);return function l(u,p,f){if(!p.length)return f(u);let[d,m]=p.shift();function w(g,y=void 0){let x=b=>(g.status=b,l(u.concat(g),p,f));if(arguments.length>1)return x(g,y);let S=L(s,"accessorizedProps",!1),h=S&&S.get(g.key);return g.type==="def"?(h&&!h.restore()&&x(!1),Object.defineProperty(s,g.key,g.value),x(!0)):h&&h.intact()?x(h.setValue(g.value)):x(Reflect.set(s,g.key,g.value))}function v(g,y){if(n.diff&&m===y)return l(u,p,f);let x=new z(s,{type:o?"def":"set",key:d,value:m,isUpdate:g,oldValue:y,related:[...c],operation:o?"defineProperty":"set",detail:n.detail}),S=ct.getInstance(s,!1,n.namespace);return S?S.emit(x,w):w(x)}return he(s,d,g=>{if(!g)return v(g);if(d==="length"&&Array.isArray(s)&&L(s).has("$length"))return v(!0,L(s).get("$length"));let y={...n,withPropertyDescriptors:o};return ut(s,d,x=>v(g,x),y)},n)}([],a.slice(0),l=>{let u=lt.getInstance(s,!1,n.namespace);return u&&u.emit(l,{eventsArePropertyDescriptors:!!o}),r(ee(t)?l.map(p=>p.status):l[0]?.status)})}function Zt(i,t,e,r=o=>o,n={}){return xt(i,t,e,r,n,!0)}function Mi(i,t,e=n=>n,r={}){return xt(i,t,e,r,!0)}function Kt(i,t,e=n=>n,r={}){let n=nt(i);q(e)&&([r,e]=[e,a=>a]);let o=F(t,!1),s=[...o];return function a(c,l,u){if(!l.length)return u(c);let p=l.shift();function f(m,w=void 0){let v=x=>(m.status=x,a(c.concat(m),l,u));if(arguments.length>1)return v(m,w);let g=L(n,"accessorizedProps",!1),y=g&&g.get(m.key);return y&&!y.restore()&&v(!1),v(Reflect.deleteProperty(n,m.key))}function d(m){let w=new z(n,{type:"delete",key:p,oldValue:m,related:[...s],operation:"deleteProperty",detail:r.detail}),v=ct.getInstance(n,!1,r.namespace);return v?v.emit(w,f):f(w)}return ut(n,p,d,r)}([],o.slice(0),a=>{let c=lt.getInstance(n,!1,r.namespace);return c&&c.emit(a),e(ee(t)?a.map(l=>l.status):a[0].status)})}function qi(i,t,e=n=>n,r={}){return Kt(...arguments)}function Fe(i,t,e=null,r=o=>o,n={}){return rt(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function We(i,t,e,r=o=>o,n={}){let o=Yt(t),s;if(Array.isArray(t)){if(n.arrayMethodName){let a=new z(o,{operation:n.arrayMethodName,argumentsList:e});lt.getInstance(o,!1,n.namespace)?.emit([a],{eventIsArrayMethodDescriptor:!0})}L(o).set("$length",o.length),s=Ge(o,()=>rt(i,"apply",{thisArgument:t,argumentsList:e},r,n),n),L(o).delete("$length")}else s=rt(i,"apply",{thisArgument:o,argumentsList:e},r,n);return s}function ze(i,t,e=n=>n,r={}){return rt(i,"setPrototypeOf",{proto:t},e,r)}function Be(i,t=r=>r,e={}){return rt(i,"preventExtensions",{},t,e)}function Mr(i,t,e,r={}){let n=new AbortController;pe.setMaxListeners?.(0,n.signal),r.signal&&r.signal.addEventListener("abort",()=>n.abort());let o={...r,signal:n.signal},s=lt.getInstance(i,!0,o.namespace),a=new Map;return function c(l=[],u=null){let p,f,d;if(ee(t)){if(u){d=!0,f=u;for(let m of l)a.get(m.key)?.remove(),a.delete(m.key)}else f=s.addRegistration(t,c,o);p={signal:f.signal,childRegistrations:a}}else u?.remove(),f=s.addRegistration(t,c,o),p={signal:f.signal};if(o.childRegistrations&&o.keyInParent&&o.childRegistrations.set(o.keyInParent,f),arguments.length){let m=e(l,p);if(arguments.length>1)return m}return n}}function rt(i,t,e={},r=o=>o,n={}){i=nt(i),q(r)&&([n,r]=[r,c=>c]);function o(c,l){return arguments.length>1?r(l):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let s=new z(i,{operation:t,...e}),a=ct.getInstance(i,!1,n.namespace);return a?a.emit(s,o):o(s)}function ee(i){return i===1/0||Array.isArray(i)}function nt(i,t=!0,e=!0){if((!i||!j(i))&&t)throw new Error(`Object must be of type object or array! "${Mt(i)}" given.`);return i instanceof z&&(i.type==="def"&&e?i=typeof i.value.get=="function"?i.value.get():i.value.value:i=i.value),i&&Yt(i)}function ki(i,t,e,r={}){return t===1/0?r.level&&!j(i)?e([]):e(Object.entries(Object.getOwnPropertyDescriptors(i)).filter(([,n])=>n.writable!==!1&&!n.get&&!n.set).map(([n])=>n)):e(F(t,!1))}var ji={...Xe,...De},C=ji;var vt=class{constructor(t){Object.defineProperty(this,Symbol.toStringTag,{value:"LiveProgramHandle"}),Object.defineProperty(this,"runtime",{value:t});let e={statechange:()=>{C.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})}abort(){return this.runtime.abort(!0)}};var Je=(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),Qe=i=>typeof i=="object"&&i||typeof i=="function";function qr(i){let t=typeof i[i.length-1]=="object"?i.pop():{};return{source:i.pop()||"",args:i,params:t}}var kr={};function jr(i,t=!1){return t?/^(["'])use live\1\s*(;|$)/.test(i):/(["'])use live\1\s*(;|$)/.test(i)}function Rr(i,t=0,e=null){let r=t,n=i.length,o=()=>{for(;r<n&&/\s/.test(i[r]);)r++},s=()=>{for(r+=2;r<n&&i[r]!==`
|
|
2
|
+
`&&i[r]!=="\r";)r++},a=()=>{for(r+=2;r<n&&!(i[r]==="*"&&i[r+1]==="/");)r++;r<n&&(r+=2)};for(;r<n;){if(o(),i[r]==="/"&&i[r+1]==="/"){s();continue}if(i[r]==="/"&&i[r+1]==="*"){a();continue}break}if(e===0)return i.slice(r);let c=r;if(r<n&&/[A-Za-z$_]/.test(i[r])){for(r++;r<n&&/[A-Za-z0-9$_]/.test(i[r]);)r++;return i.slice(c,r)}return e===1&&r<n?i[r]:null}function Rt(...i){let t,e={runtimeParams:Ni,transformerParams:Di,parserParams:Ri};for(;t=i.shift();){let{runtimeParams:r={},transformerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},transformerParams:{...e.transformerParams,globalsNoObserve:[...e.transformerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.transformerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},i.devMode}return e}var Ri={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Di={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Ni={apiVersion:3};var Dt={throwStmt(i){return{type:"ThrowStatement",argument:i}},tryStmt(i,t,e,r){return{type:"TryStatement",block:i,handler:t,finalizer:e,guardedHandlers:r}},catchClause(i,t){return{type:"CatchClause",param:i,body:t}},exprStmt(i){return{type:"ExpressionStatement",expression:i}},blockStmt(i){return{type:"BlockStatement",body:i}},labeledStmt(i,t){return{type:"LabeledStatement",label:i,body:t}},withStmt(i,t){return{type:"WithStatement",object:i,body:t}},ifStmt(i,t,e){return this.conditionalExpr(i,t,e,"IfStatement")},switchStmt(i,t,e=!1){return{type:"SwitchStatement",discriminant:i,cases:t}},switchCase(i,t){return{type:"SwitchCase",test:i,consequent:t}},whileStmt(i,t){return{type:"WhileStatement",test:i,body:t}},doWhileStmt(i,t){return{type:"DoWhileStatement",test:i,body:t}},forStmt(i,t,e,r){return{type:"ForStatement",init:i,test:t,update:e,body:r}},forInStmt(i,t,e){return{type:"ForInStatement",left:i,right:t,body:e}},forOfStmt(i,t,e){return{type:"ForOfStatement",left:i,right:t,body:e}},breakStmt(i=null){return{type:"BreakStatement",label:i}},continueStmt(i=null){return{type:"ContinueStatement",label:i}},returnStmt(i){return{type:"ReturnStatement",argument:i}},yieldExpr(i,t=!1){return{type:"YieldExpression",argument:i,delegate:t}},awaitExpr(i){return{type:"AwaitExpression",argument:i}},varDeclaration(i,t){return{type:"VariableDeclaration",kind:i,declarations:t}},varDeclarator(i,t=null){return{type:"VariableDeclarator",id:i,init:t}},funcDeclaration(i,t,e,r=!1,n=!1,o=!1){return this.func("FunctionDeclaration",...arguments)},sequenceExpr(i){return{type:"SequenceExpression",expressions:i}},parensExpr(i){return{type:"ParenthesizedExpression",expression:i}},logicalExpr(i,t,e){return{type:"LogicalExpression",operator:i,left:t,right:e}},binaryExpr(i,t,e){return{type:"BinaryExpression",operator:i,left:t,right:e}},unaryExpr(i,t,e=!0){return{type:"UnaryExpression",operator:i,argument:t,prefix:e}},updateExpr(i,t,e=!1){return{type:"UpdateExpression",operator:i,argument:t,prefix:e}},assignmentExpr(i,t,e="="){return{type:"AssignmentExpression",operator:e,left:i,right:t}},assignmentPattern(i,t){return{type:"AssignmentPattern",left:i,right:t}},thisExpr(){return{type:"ThisExpression"}},conditionalExpr(i,t,e,r="ConditionalExpression"){return{type:r,test:i,consequent:t,alternate:e}},arrayExpr(i){return{type:"ArrayExpression",elements:i}},arrayPattern(i){return{type:"ArrayPattern",elements:i}},objectExpr(i){return{type:"ObjectExpression",properties:i}},objectPattern(i){return{type:"ObjectPattern",properties:i}},chainExpr(i){return{type:"ChainExpression",expression:i}},callExpr(i,t,e=!1){return{type:"CallExpression",callee:i,arguments:t,optional:e}},newExpr(i,t){return{type:"NewExpression",callee:i,arguments:t}},taggedTemplateExpr(i,t){return{type:"TaggedTemplateExpression",tag:i,quasi:t}},memberExpr(i,t,e=!1,r=!1){return{type:"MemberExpression",object:i,property:t,computed:e,optional:r}},funcExpr(i,t,e,r=!1,n=!1,o=!1){return this.func("FunctionExpression",...arguments)},arrowFuncExpr(i,t,e,r=!1,n=!1,o=!1){return this.func("ArrowFunctionExpression",...arguments)},func(i,t,e,r,n=!1,o=!1,s=!1){return{type:i,id:t,params:e,body:r,async:n,expression:o,generator:s}},identifier(i){return{type:"Identifier",name:i}},property(i,t,e="init",r=!1,n=!1,o=!1){return{type:"Property",key:i,value:t,kind:e,shorthand:r,computed:n,method:o}},classDeclaration(i,t,e=null){return this.class("ClassDeclaration",...arguments)},classExpression(i,t,e=null){return this.class("ClassExpression",...arguments)},class(i,t,e,r=null){return{type:i,id:t,body:e,superClass:r}},methodDefinition(i,t,e="method",r=!1,n=!1){return{type:"MethodDefinition",key:i,value:t,kind:e,static:r,computed:n}},propertyDefinition(i,t,e=!1,r=!1){return{type:"PropertyDefinition",key:i,value:t,static:e,computed:r}},spreadElement(i){return{type:"SpreadElement",argument:i}},literal(i){if(typeof i=="object"&&!("name"in i)&&!("value"in i))throw new Error('Objects that convert to literals must have a "name" or "value" property.');return typeof i=="object"?{type:"Literal",get value(){return"name"in i?i.name:i.value}}:{type:"Literal",value:i}},templateLiteral(i,t){return{type:"TemplateLiteral",quasis:i,expressions:t}},comments(i){let t={};return Object.defineProperty(t,"toString",{value:()=>i}),Object.defineProperty(t,"trim",{value:function(){return this.toString()}}),[{type:"Line",value:t}]},withLoc(i,...t){return["start","end"].forEach(e=>{let r=e==="start"?t[0]:t[t.length-1];i[e]=r[e],r.loc&&(i.loc=i.loc||{},i.loc[e]=r.loc?.[e])}),i},invert(i){return this.unaryExpr("!",i)},clone(i){return i={...i},delete i.start,delete i.end,i}};var re=Object.create(null);var St=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),kr.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 Ot=class extends St{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 Ot(this,e,e==="object"?t:Qe(this.state)?C.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||!Qe(this.state))&&(this.mutationsWatch=C.observe(this.state,e=>{let r={map:new Map,add(o,s,a){for(let c of o)c.runtime.thread.includes(c),c.spec.beforeSchedule?.(s)!==!1&&(this.map.has(c.runtime)||this.map.set(c.runtime,new Set),this.map.get(c.runtime).add(c))}};for(let o of e){let s=this.signals.get(o.key);!s||(r.add(s.subscribers,o,s),s.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,s)=>o[0].$serial>s[0].$serial?1:-1):r.map;for(let[o,s]of n)o.state!=="aborted"&&o.schedule(...s)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[e,r]of this.signals)r.refresh(C.get(this.state??{},e));this.watchMode()}};var K=class extends Ot{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var ot=class extends St{state;constructor(t,e,r,n,o,s){super(),t?.once(this),this.context=t,this.type=e,this.spec=r||{},this.scope=o,t?.scope!==o&&this.manage(o),this.serial=n,s&&(this.closure=s),t?.type==="iteration"?this.path=t.path.concat(this.spec.index):t?.type==="round"?this.path=t.path.concat(this.serial):this.path=(t?.path||[]).slice(0,-1).concat(this.serial),this.flowControl=new Map}get runtime(){return this.context.runtime}contains(t){return this===t.context||t.context&&this.contains(t.context)}order(t){if(!t)return this;let[e,r]=t.path.length<this.path.length?[t,this]:[this,t];return e.path.reduce((n,o,s)=>n&&o<=r.path[s],!0)&&e||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){return this.runtime.thread.unshift(this),G(this.beforeExecute(),e=>Je(this.closure,this,this,(r,n)=>n?this.throw(n,[this.serial,this.context?.serial],n.code):(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}throw(t,e,r){if(this.type==="function"&&["HandlerFunction","FinalizerFunction"].includes(this.$params.executionMode))return this.$params.lexicalContext.throw(t,e,r);if(this.spec.handler)return this.spec.handler(t);if(this.type!=="function"&&this.context)return this.context.throw(t,e,r);if(t.cause)throw t;let n=`${t.message||t}`,o=r!==null?`[${r}]: ${n}`:n,s=e.map(u=>u!==-1&&this.extractSource(u,!0)).filter(u=>u);s.push({source:this.runtime.$params.originalSource});let a=globalThis[t.name],c=new(a||Error)(o,{cause:s}),l=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw l&&(c.fileName=l),r&&(c.code=r),c}afterExecute(t){this.state="complete";let e=this.flowControl;this.spec.finalizer&&this.spec.finalizer(),this.handleDownstream(e.size,t.size),this.handleRightstream(e.size,t.size);for(let r of["break","continue","return"])e.has(r)&&!e.get(r).endpoint?this.hoistFlowControl(r,e.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,e,r=void 0){let n=Array.isArray(e)?"array":e===null?"null":typeof e;if(n===t||t==="iterable"&&e?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(n))return e;throw t==="iterable"?new Error("value is not iterable."):t==="desctructurable"?new Error((r?`Cannot access ${r}; `:"")+"object not desctructurable."):new Error(`value must be of type ${t}.`)}let(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"let"})}const(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"const"})}var(t,e,r,n={}){n={kind:"var",...n},r||(r=()=>{});let o=n.restOf?(...a)=>{try{return r(...a)}catch(c){throw new Error(`Cannot declare ${t}; ${c.message}`)}}:r,s=(a,c)=>{let l=c.scope;if(n.kind==="var")for(;!["module","function"].includes(l.type)&&!C.has(l.state,t)&&l.context;)l=l.context;else l.type==="this"&&l.context&&(l=l.context);let u=l.symbols.get(t);if(u&&(u.kind!==n.kind||n.kind==="let"&&u.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);u?.reader?.abort(),u={serial:e,kind:n.kind};let p=a;return n.restOf&&(n.type==="array"?p=[]:p={},u.reader=C.map(a,p,{except:n.restOf,spread:n.type==="array"}),c.once(u.reader)),l.symbols.set(t,u),C.set(l.state,t,p),p};return this.autorun(n.kind,{complete:s,...n},e,o)}update(t,e,r={}){let n=this.scope;for(;n&&!C.has(n.state,t);)n=n.context;if(!n)throw new ReferenceError(`${t} is not defined.`);let o=n.symbols.get(t);if(o?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let s=C.get(n.state,t),a=r.restOf?(...c)=>{try{return e(...c)}catch(l){throw new Error(`Cannot update ${t}; ${l.message}`)}}:e;return Je(a,void 0,s,(c,l)=>{if(l)return this.throw(l,[this.serial]);o?.reader?.abort();let u=c;r.restOf&&(o=o||{},r.type==="array"?u=[]:u={},o.reader=C.map(c,u,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader));let p=this.spec.static||this.type==="function"&&this.$params?.executionMode==="RegularFunction";return C.set(n.state,t,u),["postinc","postdec"].includes(r.kind)?s:u})}ref(t,...e){let r=0,n={};typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift());let o=this.scope;for(;o&&!C.has(o.state,t);)o=o.context;if(!o){if(n.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let s=o.symbols.get(t)?.kind,a=o.signal(t,s);return n.typed&&this.typed(n.typed,a.state,t),this.autobind(a,r,n)}obj(t,...e){let r=0,n={};return typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,n)}autobind(t,e,r){let n=["LiveProgram","LiveFunction"].includes(this.runtime.$params.executionMode),o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",c=this.spec.static,l=this.spec.isWrite,u=this;return function p(f,d={},m){if(n&&!c&&!l&&!r?.isLeft&&!o&&!s&&!a&&f.subscribe(u),!m||!f.state||typeof f.state!="object"){let v=f.state;return typeof f.state=="function"&&!/^class\s?/.test(Function.prototype.toString.call(f.state))&&(v=C.proxy(f.state,{...d,membrane:f})),v}let w;return C.proxy(f.state,d,v=>({...v,get(g,y,x=null){if(w)return v.get(g,y,x);w=!0;let S={...d};return Array.isArray(g)&&(S.arrayMethodName=y),p(f.signal(y),S,m-1)}}))}(t,{},e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},s=ot,a=this.scope;if(t==="iteration"){let l=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?l.AutoAsyncIterator:l.AutoIterator}["block","switch","iteration"].includes(t)&&(a=new K(a,t));let c=new s(this,t,o,n,a,r);if(t==="downstream"){if(this.downstream=c,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return c.execute()}function(t,e,r,n){if(e==="Declaration"){let s=this.scope.type==="this"?this.scope.context:this.scope;C.set(s.state,n.name,n)}let o=this;return Object.defineProperty(n,"toString",{value:function(s=!1){if(s&&t==="LiveFunction")return Function.prototype.toString.call(n);let a=o.runtime.extractSource(r);return a.startsWith("static ")?a.replace("static ",""):a}}),n}class(t,e,r){if(t==="Declaration"){let n=this.scope.type==="this"?this.scope.context:this.scope;C.set(this.scope.state,e.name,e)}return r.forEach(({name:n,isLiveFunction:o,static:s,serial:a})=>{this.function(o&&"LiveFunction"||"RegularFunction","Expression",a,s?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 $t=class extends ot{rounds=new Map;constructor(t,e,r,n,o,s){r.$closure=s,super(t,e,r,n,o),this.manage(()=>{delete this.breakpoint,this.rounds.clear()})}pseudorun(t){return this.runtime.iThread.unshift(this),G(t(),e=>(this.runtime.iThread.pop(),e))}createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:()=>({done:!this.pseudorun(()=>this.spec.test(this))})}}closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=this.spec.parameters(this),this.iterator=this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&this.spec.init(this),this.iterator=this.createIterator()),this.iterate()}terminated(){return this.breakpoint&&!this.breakpoint.flowControlApplied("continue",this.spec.label)&&this.breakpoint.flowControlApplied()}advance(){this.spec.kind==="for"&&this.pseudorun(()=>this.spec.advance(this))}iterate(){this.iterating=!0;let t=()=>!this.terminated()&&!(this.cursor=this.iterator.next()).done,e=()=>{this.createRound(this.cursor.value).execute(),this.advance()};if(this.spec.kind==="do-while")do e();while(t());else for(;t();)e();this.iterating=!1}createRound(t){let e=this.rounds.size,r={index:e},n=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},o=new K(this.scope,"round",n);this.scope.symbols.forEach((c,l)=>{o.symbols.set(l,c)});let s=new ot(this,"round",r,this.serial,o,this.spec.$closure),a=this.spec.kind==="for-in"?t:e;return this.rounds.set(a,s),this.lastRound&&(this.lastRound.nextRound=s,s.prevRound=this.lastRound),this.lastRound=s,s}watchMode(){if(this.spec.static)return;let t=(e,r)=>{let n=new Set,o=new Set;for(let s of e){if(Array.isArray(this.iteratee)&&s.key==="length")continue;let a=this.spec.kind==="for-in"?s.key:s.value,c=this.spec.kind==="for-in"?s.key:parseInt(s.key),l=this.rounds.get(c);if(l)C.set(l.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(c,void 0),l.prevRound&&(l.prevRound.nextRound=l.nextRound),l.nextRound&&(l.nextRound.prevRound=l.prevRound),n.add(l));else if(s.type!=="delete"&&!s.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(a)}}this.runtime.on("reflection",()=>{n.forEach(s=>s.abort(!0))},{once:!0}),o.size&&(this.iterator=function*(s){yield*s,yield*o}(this.iterator),r.done&&this.iterate())};this.once(C.observe(this.iteratee,e=>{G(this.cursor,r=>t(e,r))}))}};var ie=class extends $t{async createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:async()=>({done:!await this.pseudorun(()=>this.spec.test(this))})}}async closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=await this.spec.parameters(this),this.iterator=await this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&await this.spec.init(this),this.iterator=await this.createIterator()),await this.iterate()}async iterate(){let t;this.iterating=!0;let e=async()=>!this.terminated()&&(this.cursor=this.iterator.next())&&(t=await this.cursor)&&!t.done,r=async()=>{await this.createRound(t.value).execute(),await this.advance()};if(this.spec.kind==="do-while")do await r();while(await e());else for(;await e();)await r();this.iterating=!1}};var Et=class extends ot{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){let{$serial:s=0,spec:a,...c}=r;super(t,e,a,-1,n,o),this.$serial=s,this.$params=c,this.$objects=new K(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{C.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,e=!1){let[[r,n,o],[s]]=this.locations[t],a=this.$params.originalSource.slice(r,s);return e?{expr:a,line:n,column:o}:a}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let e=this.queue.size;for(let r of t)this.queue.add(r);if(!e)return this.flowControlDirty=!1,function r(n,o){let s;for(let a of this.queue){if(o&&o.order(a)!==o||["aborted","running"].includes(a.state)||this.iThread[0]?.contains(a)){this.queue.delete(a);continue}s=s?s.order(a):a,o||(o=s)}return s?(s.abort(),s.execute(a=>(this.queue.delete(s),r.call(this,a,s)))):(this.fire("reflection"),this.flowControlApplied()&&this.fire("statechange"),n)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(e=>{let r=["LiveProgram","LiveFunction"].includes(this.$params.executionMode),n=this.$params.sourceType==="module"||this.$params.sourceType==="script",o=r||this.$params.executionMode==="RegularProgram"&&n?new vt(this):this.flowControl.get("return")?.arg;return t?t(o,this):o})}spawn(t,e,r,n=null){let o=this.nowRunning||n||this,s={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:n},a=new K(o.scope,"function",e?{this:e}:{});return new this.constructor(o,"function",s,a,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,n=s=>{if(r.forExport||r.isDynamic)return s;this.assignModules(t,this.scope.state,s,e.serial)};if(this.$params.experimentalFeatures!==!1&&re[r.source])return n(re[r.source]);let o=(async()=>{let s=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return n({...await import(r.source)})}catch(a){a.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${s?` imported at "${s}"`:""}.`),[r.serial],a.code):this.throw(a,[r.serial],a.code)}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(o),o}async export(...t){let e=Array.isArray(t[t.length-1])?null:t.pop(),r=e?await this.import({...e,forExport:!0}):this.scope.type==="this"?this.scope.context.state:this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,n=null){let o=[],s=["LiveProgram","LiveFunction"].includes(this.$params.executionMode);for(let[a,c,l,u]of t){if(a===null){(s?C:Reflect).set(e,l,u);continue}if(a==="*"&&l){(s?C:Reflect).set(e,l,r);continue}C.has(r,a)||this.throw(new Error(`The requested module does not provide an export named "${a}".`),[c,n]),(s?C:Reflect).set(e,l||a,C.get(r,a)),o.push([a,c,l])}!o.length||!s||this.once(C.observe(r,a=>{for(let[c,,l]of o)for(let u of a)c==="*"?C.set(e,u.key,u.value):u.key===c&&C.set(e,l||c,u.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(re[this.$params.exportNamespace]=this.exports,this.once(()=>{delete re[this.$params.exportNamespace]})),super.afterExecute(...t)}};V(Et,"AutoAsyncIterator",ie),V(Et,"AutoIterator",$t);function me(i,t,e,r=[],n={}){typeof r=="object"&&r&&!Array.isArray(r)&&(n=r,r=[]);let{liveMode:o=!0,thisContext:s,env:a,exportNamespace:c,fileName:l,base64:u,compileFunction:p,forDynamicBinding:f=!1,...d}=n,{parserParams:m,transformerParams:w,runtimeParams:v}=Rt(d),g=/module/.test(i),y=/script/.test(i),x=/function/.test(i),S=/async/.test(i)||/module/.test(i),h=/source/.test(i),b=/file/.test(i),_=typeof e=="object"&&e?.type==="Program";_||(e=e+"");let O=e;if(g)m.sourceType="module",m.allowAwaitOutsideFunction=!0,m.executionMode=o?"LiveProgram":"RegularProgram";else if(y)m.executionMode=o?"LiveProgram":"RegularProgram";else if(x){if(h)if(_)e=Dt.funcExpr(null,r.map(I=>Dt.identifier(I)),Dt.blockStmt(o?[Dt.literal("use live"),...e.body]:e.body),S),e.isLiveFunction=O.isLiveProgram;else{let I=" "+e.split(`
|
|
13
3
|
`).join(`
|
|
14
|
-
`);
|
|
15
|
-
${
|
|
16
|
-
`:""}${
|
|
17
|
-
}`}else
|
|
18
|
-
`);return
|
|
19
|
-
${
|
|
4
|
+
`);e=`${S?"async function":"function"}(${r.join(", ")}) {
|
|
5
|
+
${o?` "use live";
|
|
6
|
+
`:""}${I}
|
|
7
|
+
}`}else _&&(e=e.body[0]);_?e={type:"Program",body:[Dt.returnStmt(e)],start:O.start,end:O.end,hasLiveFunctions:O.hasLiveFunctions,originalSource:O.originalSource}:e=`return ${e}`,m.executionMode="RegularProgram"}else throw new Error(`Unrecognized sourceType specified: "${i}".`);let $=g?"module":y?"script":"function",T=g&&b&&u&&"export default async function(%0) {%1}";w.sourceType=$,w.base64=T,v.sourceType=$,v.fileName=l,g&&(v.exportNamespace=c);let R=t.transform(e,{...m,...w,astResult:_});function N(I,P=!1){let A=I.join(`
|
|
8
|
+
`);return _?G(t.parse(A,m),H=>(H.body.find(Q=>Q.type==="ExpressionStatement"&&Q.expression?.type==="AssignmentExpression"&&Q.expression.left.type==="MemberExpression"&&Q.expression.left.object.type==="Identifier"&&Q.expression.left.property.type==="Identifier"&&Q.expression.left.property.name==="main"&&Q.expression.right.type==="FunctionExpression").expression.right.body.body.push(...R.transformedSource.body),P?G(H,Q=>t.serialize(Q)):H)):A}return G(R,I=>{if(!I)return;let P=[],A=I.identifier2,H;if(b&&Ye)P.push(`const { Scope, Runtime } = await import('${Ye}/index.js');`),P.push(`const ${A} = { Scope, Runtime, params: { ...(${JSON.stringify(v)}), executionMode: '${I.isLiveProgram&&"LiveProgram"||"RegularProgram"}', originalSource: \`${I.originalSource.replace(/`/g,"\\`")}\`, }, };`);else{let yt={Scope:K,Runtime:Et,params:{...v,originalSource:I.originalSource,executionMode:I.isLiveProgram&&"LiveProgram"||"RegularProgram"},thisContext:s,env:a};b?(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.UseLive||(globalThis.webqit.UseLive={}),globalThis.webqit.UseLive.Script||(globalThis.webqit.UseLive.Script=yt),P.push(`const ${A} = globalThis.webqit.UseLive.Script;`)):H=yt}P.push(`${A}.main = ${g?"async ":""}function(${I.identifier}) {${_?"":`
|
|
9
|
+
${I.transformedSource.replace(/\n/g,`
|
|
20
10
|
`)}
|
|
21
|
-
`}};`);let tt="global";if(N.push(`${$}.scope = new ${$}.Scope(undefined, '${tt}', globalThis);`),(b||X?.env||X&&p)&&(tt="env",N.push(`${$}.scope = new ${$}.Scope(${$}.scope, '${tt}', ${$}.env);`)),y&&(tt="module",N.push(`${$}.scope = new ${$}.Scope(${$}.scope, '${tt}');`)),(typeof X?.thisContext<"u"||X&&p)&&N.push(`${$}.scope = new ${$}.Scope(${$}.scope, 'this', { ['this']: ${$}.thisContext });`),N.push(`${$}.runtime = new ${$}.Runtime(undefined, '${tt}', ${$}.params, ${$}.scope, ${$}.main);`),y&&C){N.push(`${$}.result = await ${$}.runtime.execute();`);let[Ut,Vr]=D.exportIds.reduce(([,qr],Ai)=>Ai==="default"?[Ai,qr]:[,qr.concat(Ai)],[null,[]]);return Vr.length&&N.push(`export const { ${Vr.join(", ")} } = ${$}.result.exports;`),Ut&&N.push(`export default ${$}.result.exports.default;`),G(N)}if(C)return N.push(`${$}.result = ${$}.runtime.execute();`),S&&N.push(`return ${$}.result;`),G(N);N.push(S?`return ${$}.runtime.execute();`:`return ${$}.runtime;`);let lt=G(N,!0),Dr=f||Function;return it(lt,Ut=>p?[Dr($,Ut),X]:Dr($,Ut)(X))})}var dr;try{dr=eval("import.meta.url")}catch(e){}function Qp(e){let t=Oa(e);return $a(t)}function Oa(e){if(typeof e!="string")throw new TypeError("URL must be a string");if(!e.startsWith("file://"))return e;let t=e.slice(7);return t=t.replace(/^\/([A-Za-z]:)/,"$1"),t=decodeURIComponent(t),t}function $a(e){if(typeof e!="string")throw new TypeError("path must be a string");let t=e.includes("\\")?"\\":"/",i=e.lastIndexOf(t);return i===-1?e:i===0?t:e.slice(0,i)}var ie=class{constructor(...t){let i=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{};this.source=t.pop()||"",this.$program=xi(i.sourceType,i.astTools,this.source,{...r,forDynamicBinding:!0})}execute(){return it(this.$program,([t,i])=>it(t(i),r=>r.execute()))}bind(t,i=void 0){return it(this.$program,([r,s])=>r({...s,thisContext:t,env:i}))}toString(t=!1){return t?it(this.$program,([i])=>i+""):this.source}};function Ta(...e){let{source:t,args:i,params:r}=Yi(e);return mr("function-source",t,i,r)}function Na(...e){let{source:t,args:i,params:r}=Yi(e);return mr("async-function-source",t,i,r)}var Qe=class extends ie{};J(Qe,"sourceType","script"),J(Qe,"astTools",{parse:Yt,transform:be,serialize:we});var Ye=class extends ie{};J(Ye,"sourceType","async-script"),J(Ye,"astTools",{parse:Yt,transform:be,serialize:we});var Je=class extends ie{};J(Je,"sourceType","module"),J(Je,"astTools",{parse:Yt,transform:be,serialize:we});function mr(e,t,...i){return xi(e,{parse:Yt,transform:be,serialize:we},t,...i)}function Ze(e,t,i={},r={}){t=Q(t).slice();for(var s=e;!Pt(s)&&!Ie(s)&&t.length;){var n=t.shift();if(!(i.get?i.get(s,n):H(s)?n in s:s[n])){r.exists=!1;return}s=i.get?i.get(s,n):s[n]}return r.exists=!0,s}function yr(e,t,i,r={},s={}){let n=(c,f,p)=>s.set?s.set(c,f,p):(ht(t[o])&&V(c)?c.push(p):c[f]=p,!0);t=Q(t);for(var a=e,o=0;o<t.length;o++)if(o<t.length-1){if(!a||!H(a)&&!B(a))return!1;var l=Ze(a,t[o],s);if(!H(l)){if(s.buildTree===!1)return!1;l=B(s.buildTree)?s.buildTree(o):ht(t[o+1])?[]:{};var u=n(a,t[o],l);if(!u)return!1}a=l}else return n(a,t[o],i)}var ti=class{constructor(t,i=!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}),!i&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let i=await t();return this._synthesis--,i}_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,i=!1){if(i)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,i=!1){if(i)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,i,r){this.onread(()=>{let s=t(r),n=a=>{a!==void 0&&this.onwrite(()=>{let o=i(a,r),l=u=>{u!==void 0&&this.cycle(t,i,u)};o instanceof Promise?o.then(l):l(o)})};s instanceof Promise?s.then(n):n(s)})}};function zs(e){return(e=e.trim())&&e.startsWith("(")&&e.endsWith(")")}function Se(e,t,i,r=!0){i=(Array.isArray(i)?i:[i]).map(a=>(a+"").replace("(",r?"(.//":"(./")).join("|");let s=[],n;try{let a=e.document.evaluate(i,t,null,e.XPathResult.ANY_TYPE);for(;n=a.iterateNext();)s.push(n)}catch{}return s}function Gs(e,t,i){i=(Array.isArray(i)?i:[i]).map(r=>(r+"").replace("(","(self::")).join("|");try{return e.document.evaluate(`${i}`,t,null,e.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function ei(e,t,i,r=!1,s=null){let n=s?.get(t)?.get(i);if(typeof n<"u")return n;let a=u=>(s?.has(t)||s?.set(t,new WeakMap),s?.get(t)?.set(i,u),u),o=t.getRootNode(),l=i.getRootNode();return o===l?a(t.contains(i)):r&&l instanceof e.ShadowRoot?a(ei(e,t,l.host,r,s)):a(!1)}function Ks(e,t="|"){return[...e].reduce(([i,r,s,n],a)=>!i&&r===0&&(Array.isArray(t)?t:[t]).includes(a)?[i,r,[""].concat(s)]:(!i&&["(","[","{"].includes(a)&&!s[0].endsWith("\\")&&r++,!i&&[")","]","}"].includes(a)&&!s[0].endsWith("\\")&&r--,['"',"'","`"].includes(a)&&!s[0].endsWith("\\")&&(i=i===a?null:i||a),s[0]+=a,[i,r,s]),[null,0,[""]])[2].reverse()}var yt=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:zs(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ks(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var re=class{constructor(t,i,r){this.context=t,this.namespace=i,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(B(t[0])?t=[[],...t]:j(t[0])&&!(t[0]instanceof yt)&&t.length===1?t=[[],void 0,t[0]]:j(t[1])&&t.length===2?t=[Q(t[0],!1),void 0,t[1]]:t[0]=Q(t[0],!1),t[0].filter(i=>typeof i!="string"&&!(i instanceof yt)&&!(i 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(i=>i instanceof yt?i:new yt(i)),t}registry(...t){return nt(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,i,r){let{window:s}=this,n=new Set,a=new WeakMap;for(let[o,l]of this.registry(t)){let u=[].concat(i).filter(f=>ei(s,o.context,f.target,o.params.subtree==="cross-roots",a));if(!u.length)continue;let c=[o,Array.isArray(i)?u:u[0]];l?n.add(c):r.call(s,...c)}for(let o of n)r.call(s,...o);n.clear()}disconnectables(t,...i){let r={disconnect(){i.forEach(s=>s&&B(s.disconnect)&&s.disconnect()||B(s)&&s()||j(s)&&(s.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var jt=class extends re{type="attr";constructor(t,...i){super(t,"attr",...i)}get(t,i=void 0,r={}){let s=typeof t=="string"||t instanceof yt;[t=[],i=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,a=Js(n,t);if(!i)return a;let o=r.lifecycleSignals&&this.createSignalGenerator();if(s)for(let l of a){let u=o?o.generate():{};i(l,u,n)}else{let l=o?.generate()||{};i(a,l,n)}if(r.live){o&&(r={...r,signalGenerator:o});let l=this.observe(s?t[0]:t,i,{newValue:!0,...r});return this.disconnectables(r.signal,l)}}observe(t,i,r={}){let s=typeof t=="string"||t instanceof yt;if([t=[],i,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(s?t[0]:t,i,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:n,window:a,webqit:o}=this;r.eventDetails&&!o.realdom.attrInterceptionHooks?.intercepting&&Qs.call(a,"intercept",()=>{});let l=new a.MutationObserver(p=>{p=Ys(p).map(g=>Zs.call(a,g)),Xs.call(a,f,p,n)}),u={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(u.attributeFilter=t.map(p=>p+"")),l.observe(n,u);let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),f={context:n,spec:t,callback:i,params:r,atomics:new Map,originalFilterIsString:s,signalGenerator:c,disconnectable:l};return this.disconnectables(r.signal,l,c)}observeSync(t,i,r={}){let s=typeof t=="string"||t instanceof yt;[t,i,r={}]=this.resolveArgs(arguments);let{context:n,window:a}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let o=r.timing==="intercept"?"intercept":"sync";this.registry(o).size||Qs.call(a,o,p=>{this.forEachMatchingContext(o,p,Xs)});let l={disconnect(){f.delete(c)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),c={context:n,spec:t,callback:i,params:r,atomics:new Map,originalFilterIsString:s,signalGenerator:u,disconnectable:l},f=this.registry(o);return f.set(c,!!c.params.deferred),this.disconnectables(r.signal,l,u)}};function Ys(e){return e.reduce((t,i,r)=>t[r-1]?.attributeName===i.attributeName||nt(i.target,"realdom","internalAttrInteractions").get(i.attributeName)?t:t.concat(i),[])}function Xs(e,t){let{context:i,spec:r,callback:s,params:n,atomics:a,originalFilterIsString:o,signalGenerator:l}=e;if(n.subtree||(t=t.filter(p=>p.target===i)),!t.length)return;let u=r.map(p=>p+"");if(n.atomic&&!a.size?t=Js(i,r,t):n.timing!=="async"&&r.length&&(t=t.filter(p=>u.includes(p.name))),!t.length)return;n.newValue===null&&n.oldValue===null&&n.eventDetails||(t=t.map(p=>{let g;return n.eventDetails||({event:g,...p}=p),!n.oldValue&&"oldValue"in p&&({oldValue:g,...p}=p),!n.newValue&&"value"in p?{value:g,...p}=p:n.newValue&&typeof p.value>"u"&&(p={...p,value:wi(p.target,p.name,()=>p.target.getAttribute(p.name))}),p})),n.atomic&&(t.forEach(p=>a.set(p.name,p)),t=Array.from(a.entries()).map(([,p])=>p));let c=o?t[0]:t,f=l?l.generate():{};s(c,f,i)}function wi(e,t,i){let r=nt(e,"realdom","internalAttrInteractions").get(t);nt(e,"realdom","internalAttrInteractions").set(t,!0);let s=i();return nt(e,"realdom","internalAttrInteractions").set(t,r),s}function Js(e,t,i=[]){let r={event:null,type:"attribute"};return t.length?t.map(n=>(n=n+"",i.find(a=>a.name===n)||{target:e,name:n,value:wi(e,n,()=>e.getAttribute(n)),...r})):Array.from(e.attributes).map(n=>i.find(a=>a.name===n.nodeName)||{target:e,name:n.nodeName,value:wi(e,n.nodeName,()=>n.nodeValue),...r})}function Zs({target:e,attributeName:t,value:i,oldValue:r}){let a=(this.webqit.realdom.attrInterceptionRecords?.get(e)||{})[t]?.[0]||"mutation";return{target:e,name:t,value:i,oldValue:r,type:"observation",event:a}}function Qs(e,t){let i=this,{webqit:r,document:s,Element:n}=i;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(e)||r.realdom.attrInterceptionHooks.set(e,new Set),r.realdom.attrInterceptionHooks.get(e).add(t);let a=()=>r.realdom.attrInterceptionHooks.get(e).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 o=(c,f)=>{r.realdom.attrInterceptionRecords.has(c.target)||r.realdom.attrInterceptionRecords.set(c.target,{});let p=r.realdom.attrInterceptionRecords.get(c.target);if(p[c.name]=p[c.name]||[],p[c.name].unshift(c.event),nt(c.target,"realdom","internalAttrInteractions").get(c.name))return f();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m([c]));let g=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m([c])),g};new i.MutationObserver(c=>{c=c.filter(f=>!(i.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),c=Ys(c).map(f=>Zs.call(i,f)),c.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(f=>f(c)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(f=>f(c)))}).observe(s,{attributes:!0,subtree:!0,attributeOldValue:!0});let u=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(c=>{u[c]=n.prototype[c],n.prototype[c]=function(...f){let p,g=wi(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(c)&&(p=f[1]),c==="toggleAttribute"&&p===void 0&&(p=g===null);let m={target:this,name:f[0],value:p,oldValue:g,type:"interception",event:[this,c]};return o(m,()=>u[c].call(this,...f))}}),a}var ii=class extends re{constructor(t,...i){super(t,"tree",...i)}attr(t,i=void 0,r={}){let{context:s,window:n}=this;return new jt(s,n).get(...arguments)}query(t,i=void 0,r={}){[t,i=void 0,r={}]=this.resolveArgs(arguments);let{context:s}=this,n=new Map,a=u=>(n.has(u)||n.set(u,{target:u,entrants:[],exits:[],type:"query",event:null}),n.get(u));if(!r.generation||r.generation==="entrants"){if(!t.length)[...s.children].forEach(u=>a(s).entrants.push(u));else if(t.every(u=>u.type==="selector")){let[u,c]=t.reduce(([p,g],m)=>m.kind==="xpath"?[p,g.concat(m)]:[p.concat(m),g],[[],[]]),f=[];r.subtree?(u.length&&f.push(...s.querySelectorAll(u.join(","))),c.length&&f.push(...Se(this.window,s,c))):(u.length&&f.push(...[...s.children].filter(p=>p.matches(u))),c.length&&f.push(...Se(this.window,s,c,!1))),f.forEach(p=>a(p.parentNode||s).entrants.push(p))}}if(!i)return n;let o={disconnected:!1},l=i&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,u]of n){if(o.disconnected)break;let c=l?.generate()||{};i(u,c,s)}if(r.live){l&&(r={...r,signalGenerator:l});let u=this.observe(t,i,r);return this.disconnectables(r.signal,o,u)}return this.disconnectables(r.signal,o,l)}children(t,i=void 0,r={}){return[t,i=void 0,r={}]=this.resolveArgs(arguments),this.query(t,i,{...r,subtree:!1})}subtree(t,i=void 0,r={}){return[t,i=void 0,r={}]=this.resolveArgs(arguments),this.query(t,i,{...r,subtree:!0})}observe(t,i,r={}){if([t,i,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,i,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:s,window:n,webqit:a,document:o}=this;r.eventDetails&&(a.realdom.domInterceptionRecordsAlwaysOn=!0),(o.readyState==="loading"||a.realdom.domInterceptionRecordsAlwaysOn)&&!a.realdom.domInterceptionHooks?.intercepting&&rn.call(n,"sync",()=>{});let l=new n.MutationObserver(f=>f.forEach(p=>{br.call(n,c,en.call(n,p),s)}));l.observe(s,{childList:!0,subtree:r.subtree&&!0});let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),c={context:s,spec:t,callback:i,params:r,signalGenerator:u,disconnectable:l};if(r.staticSensitivity){let f=tn.call(n,c);return this.disconnectables(r.signal,l,u,f)}return this.disconnectables(r.signal,l,u)}observeSync(t,i,r={}){[t,i,r={}]=this.resolveArgs(arguments);let{context:s,window:n}=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||rn.call(n,a,p=>{this.forEachMatchingContext(a,p,br)});let o=new n.MutationObserver(p=>p.forEach(g=>{Array.isArray((g=en.call(n,g)).event)||br.call(n,c,g,s)}));o.observe(s,{childList:!0,subtree:r.subtree&&!0});let l={disconnect(){f.delete(c),o.disconnect()}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),c={context:s,spec:t,callback:i,params:r,signalGenerator:u,disconnectable:l},f=this.registry(a);if(f.set(c,!!c.params.deferred),r.staticSensitivity){let p=tn.call(n,c);return this.disconnectables(r.signal,l,u,p)}return this.disconnectables(r.signal,l,u)}track(t,i,r={}){return r={subtree:!0,...r},this.observe(t,s=>{s.entrants.length&&i(!0,Array.isArray(t)?s.entrants:s.entrants[0]),s.exits.length&&i(!1,Array.isArray(t)?s.exits:s.exits[0])},r)}};function tn(e){let t=this,{context:i,spec:r,callback:s,params:n,signalGenerator:a}=e,o=r.filter(g=>g.kind==="css"),l=g=>g.match(/\.([\w-]+)/g)?.length?["class"]:[],u=g=>g.match(/#([\w-]+)/g)?.length?["id"]:[],c=g=>[...g.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(m=>m[1]).concat(l(g)).concat(u(g));if(!(e.$attrs=Array.from(new Set(o.filter(g=>(g+"").includes("[")).reduce((g,m)=>g.concat(c(m+"")),[])))).length)return;let f=new Set,p=new Set;return f.push=g=>(p.delete(g),f.add(g)),p.push=g=>(f.delete(g),p.add(g)),e.$deliveryCache={entrants:f,exits:p},new jt(i,t).observe(e.$attrs,g=>{let m=new Map,_=b=>(m.has(b)||m.set(b,{target:b,entrants:[],exits:[],type:"static",event:null}),m.get(b)),v=new WeakMap,y=b=>(v.has(b)||v.set(b,o.some(S=>b.matches(S+""))),v.get(b));for(let b of g)["entrants","exits"].forEach(S=>{n.generation&&S!==n.generation||e.$deliveryCache[S].has(b.target)||(S==="entrants"?!y(b.target):y(b.target))||(e.$deliveryCache[S].push(b.target),_(b.target)[S].push(b.target),_(b.target).event=b.event)});for(let[,b]of m){let S=a?.generate()||{};s(b,S,i)}},{subtree:n.subtree,timing:n.timing,eventDetails:n.eventDetails})}function br(e,t){let{context:i,spec:r,callback:s,params:n,signalGenerator:a,$deliveryCache:o}=e,l={...t,entrants:[],exits:[]};if(n.eventDetails||delete l.event,["entrants","exits"].forEach(c=>{if(!(n.generation&&c!==n.generation)&&(r.length?l[c]=Da.call(this,r,n.subtree==="cross-roots",t[c],t.event!=="parse"):l[c]=[...t[c]],!!o))for(let f of l[c])o[c].push(f)}),!l.entrants.length&&!l.exits.length)return;let u=a?.generate()||{};s(l,u,i)}function Da(e,t,i,r){i=Array.isArray(i)?i:[...i];let s=(n,a)=>{if(a.type==="selector"){let o=a.isXpathAttr?[]:n.filter(l=>a.kind==="xpath"?Gs(this,l,a+""):l.matches&&l.matches(a+""));if((r||a.isXpathAttr)&&(o=n.reduce((l,u)=>a.kind==="xpath"?[...l,...Se(this,u,a,r)]:u.querySelectorAll?[...l,...u.querySelectorAll(a+"")]:l,o)),o.length)return o}else if(n.includes(a.content)||r&&n.some(o=>ei(this,o,a.content,t)))return[a.content]};return i.$$searchCache||(i.$$searchCache=new Map),e.reduce((n,a)=>{let o;return i.$$searchCache.has(a.content)?o=i.$$searchCache.get(a.content):(o=s(i,a)||[],a.type==="instance"&&i.$$searchCache.set(a.content,o)),n.concat(o)},[])}function en({target:e,addedNodes:t,removedNodes:i}){let r=this,s;return s=Q(t).reduce((n,a)=>n||r.webqit.realdom.domInterceptionRecords?.get(a),null),s=Q(i).reduce((n,a)=>n||r.webqit.realdom.domInterceptionRecords?.get(a),s),s=s||r.document.readyState==="loading"&&"parse"||"mutation",{target:e,entrants:t,exits:i,type:"observation",event:s}}function rn(e,t){let i=this,{webqit:r,document:s,Node:n,CharacterData:a,Element:o,HTMLElement:l,HTMLTemplateElement:u,DocumentFragment:c}=i;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(e)||r.realdom.domInterceptionHooks.set(e,new Set),r.realdom.domInterceptionHooks.get(e).add(t);let f=()=>r.realdom.domInterceptionHooks.get(e).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 p=(y,b,S)=>{r.realdom.domInterceptionNoRecurse.set(y,b);let w=S();return r.realdom.domInterceptionNoRecurse.delete(y),w},g=(y,b)=>{y.entrants.concat(y.exits).forEach(w=>{clearTimeout(r.realdom.domInterceptionRecords.get(w)?.timeout),r.realdom.domInterceptionRecords.set(w,y.event);let x=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(w)},0);Object.defineProperty(y.event,"timeout",{value:x,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(w=>w(y));let S=b();return r.realdom.domInterceptionHooks.get("sync")?.forEach(w=>w(y)),S},m={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},_={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(m).reduce((y,b)=>y.concat(b),[])).forEach(y=>{Object.keys(m).forEach(w=>{if(!m[w].includes(y))return;let x=Object.getOwnPropertyDescriptor(i[w].prototype,y);!x||(Object.defineProperty(i[w].prototype,y,"value"in x?{...x,value:b}:{...x,set:S}),_[w][y]=x)});function b(...w){let x=Object.keys(_).find(D=>this instanceof i[D]&&y in _[D]),C=_[x],E=()=>C[y].value.call(this,...w);if(r.realdom.domInterceptionNoRecurse.get(this)===y)return E();let P=[],A=[],F=this;["insertBefore"].includes(y)?A=[w[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(y)?(A=[w[1]],["beforebegin","afterend"].includes(w[0])&&(F=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(y)?(P=[...this.childNodes],A=y==="replaceChildren"?[...w]:[w[0]]):["replaceWith","remove"].includes(y)?(P=[this],A=y==="replaceWith"?[...w]:[],F=this.parentNode):["replaceChild"].includes(y)?(P=[w[1]],A=[w[0]]):["removeChild"].includes(y)?P=[...w]:(A=[...w],["before","after"].includes(y)&&(F=this.parentNode));let U=y;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(y)){let D=this.nodeName;if(y==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(w[0])){if(!this.parentNode)return C[y].value.call(this,...w);D=this.parentNode.nodeName}let N=s.createElement(D.includes("-")?"div":D);C.setHTMLUnsafe.value.call(N,A[0],y==="setHTMLUnsafe"?w[1]:{}),A=[...N.childNodes],y==="insertAdjacentHTML"?(U="insertAdjacentElement",w[1]=new c,p(w[1],"append",()=>w[1].append(...N.childNodes))):(U="replaceChildren",w=[...N.childNodes])}return F?g({target:F,entrants:A,exits:P,type:"interception",event:[this,y]},()=>C[U].value.call(this,...w)):E()}function S(w){let x=Object.keys(_).find(G=>this instanceof i[G]&&y in _[G]),C=_[x],E=()=>C[y].set.call(this,w);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===y)return E();let P=[],A=[],F=this;if(["outerHTML","outerText"].includes(y)?(P=[this],F=this.parentNode):this instanceof u?(F=this.content,P=[...this.content.childNodes]):P=[...this.childNodes],["outerHTML","innerHTML"].includes(y)){let G=this.nodeName;if(y==="outerHTML"){if(!this.parentNode)return E();G=this.parentNode.nodeName}let D=s.createElement(G.includes("-")?"div":G);if(p(D,y,()=>D[y]=w),A=this instanceof u?[...D.content.childNodes]:[...D.childNodes],this instanceof u&&this.hasAttribute("src")||this instanceof ShadowRoot){let N=$=>$.reduce((X,tt)=>tt instanceof HTMLScriptElement?X.concat(tt):tt instanceof u?X.concat(N([tt.content])):(X=X.concat(N([...tt.querySelectorAll?.("template")||[]].map(lt=>lt.content))),X.concat(...tt.querySelectorAll?.("script")||[])),[]);for(let $ of N(A)){if(this instanceof ShadowRoot){$.setAttribute("data-handling","manual");continue}let X=s.createElement("script");[...$.attributes].forEach(tt=>X.setAttribute(tt.name,tt.value)),X.textContent=$.textContent,p($,"replaceWith",()=>$.replaceWith(X))}}y==="outerHTML"?(w=new c,p(w,"append",()=>w.append(...A)),E=()=>p(this,"replaceWith",()=>o.prototype.replaceWith.call(this,w))):this instanceof u?E=()=>p(this.content,"replaceChildren",()=>this.content.replaceChildren(...A)):E=()=>p(this,"replaceChildren",()=>o.prototype.replaceChildren.call(this,...A))}return g({target:F,entrants:A,exits:P,type:"interception",event:[this,y]},E)}}),f}function sn(){Va.call(this),qa.call(this),Fa.call(this)}function Va(){let e=this;e.CSS||(e.CSS={}),e.CSS.escape||(e.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function qa(){let e=this;"isConnected"in e.Node.prototype||Object.defineProperty(e.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function Fa(){let e=this;e.Element.prototype.matches||(e.Element.prototype.matches=e.Element.prototype.matchesSelector||e.Element.prototype.mozMatchesSelector||e.Element.prototype.msMatchesSelector||e.Element.prototype.oMatchesSelector||e.Element.prototype.webkitMatchesSelector||function(t){for(var i=(this.document||this.ownerDocument).querySelectorAll(t),r=i.length;--r>=0&&i.item(r)!==this;);return r>-1})}function nn(){let e=this;if(e.webqit||(e.webqit={}),e.webqit.realdom)return e.webqit.realdom;e.webqit.realdom={},sn.call(e),e.webqit.realdom.meta=(...i)=>ja.call(e,...i),e.webqit.realdom.ready=(...i)=>wr.call(e,...i),e.webqit.realdom.realtime=(i,r="dom")=>{if(r==="dom")return new ii(i,e);if(r==="attr")return new jt(i,e)};let t=new ti(e);return e.webqit.realdom.schedule=(i,...r)=>t[`on${i}`](...r),e.webqit.realdom.synthesizeWhile=(...i)=>t.synthesizeWhile(...i),e.webqit.realdom}function wr(...e){let t="interactive",i;ce(e[0])?(t=e[0],B(e[1])&&(i=e[1])):B(e[0])&&(i=e[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let s=this;if(!i)return s.webqit.realdom.readyStatePromises||(s.webqit.realdom.readyStatePromises={interactive:new Promise(n=>wr.call(this,"interactive",n)),complete:new Promise(n=>wr.call(this,"complete",n))}),s.webqit.realdom.readyStatePromises[t];if(r[t].includes(s.document.readyState))return i(s);s.webqit.realdom.readyStateCallbacks||(s.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},s.document.addEventListener("readystatechange",()=>{let n=s.document.readyState;for(let a of s.webqit.realdom.readyStateCallbacks[n].splice(0))a(s)},!1)),s.webqit.realdom.readyStateCallbacks[t].push(i)}function ja(e){let t=this,i={},r;return(r=t.document.querySelector(`meta[name="${e}"]`))&&(i=(r.content||"").split(";").filter(s=>s).reduce((s,n)=>{let a=n.split("=").map(o=>o.trim());return yr(s,a[0].split("."),a[1]==="true"?!0:a[1]==="false"?!1:ht(a[1])?parseInt(a[1]):a[1]),s},{})),{get name(){return e},get content(){return r.content},json(){return JSON.parse(JSON.stringify(i))}}}function vi(e,t){return typeof e!="string"?e:e.replace(/\w\S*/g,function(i){return i.charAt(0).toUpperCase()+(typeof t!==void 0&&t?i.substr(1).toLowerCase():i.substr(1))})}var k=(e,...t)=>nt(e,"oohtml",...t),z={};function ot(e,t,i){let r=this,s=nn.call(r);z.window=r,r.webqitConfig||(r.webqitConfig=s.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let n=e.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[n]){r.webqit.oohtml.configs[n]={};let a=r.webqit.oohtml.configs[n];$e(2,a,i,t,s.meta(e).json()),r.webqitConfig.prefix&&Object.keys(a).forEach(o=>{Object.keys(a[o]).forEach(l=>{o==="api"&&typeof a[o][l]=="string"?a[o][l]=`${r.webqitConfig.prefix}${vi(a[o][l])}`:["attr","elements"].includes(o)&&a[o][l]?.startsWith("data-")===!1&&(a[o][l]=`${r.webqitConfig.prefix}-${a[o][l]}`)})})}return{config:r.webqit.oohtml.configs[n],realdom:s,window:r}}function Sr(e,t){return k(e,"internalAttrInteractions").get(t)}function on(e,t,i){let r=k(e,"internalAttrInteractions").get(t);k(e,"internalAttrInteractions").set(t,!0);let s=i();return k(e,"internalAttrInteractions").set(t,r),s}function Mt(e,t){return[...e].reduce(([i,r,s],n)=>!i&&r===0&&(Array.isArray(t)?t:[t]).includes(n)?[i,r,[""].concat(s)]:(!i&&["(","[","{"].includes(n)&&!s[0].endsWith("\\")&&r++,!i&&[")","]","}"].includes(n)&&!s[0].endsWith("\\")&&r--,['"',"'","`"].includes(n)&&!s[0].endsWith("\\")&&(i=i===n?null:i||n),s[0]+=n,[i,r,s]),[null,0,[""]])[2].reverse()}var Ua=()=>(0|Math.random()*9e6).toString(36),vr=new Map;function se(e){let t;return(t=vr.get(e))||(t=Ua(),vr.set(e,t)),t}function Si(e){let t;return vr.forEach((i,r)=>{i===e&&(t=r)}),t}function _i(){let{window:e}=z,{webqit:t}=e;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class i extends e.Event{constructor(...s){let n=s.pop();if(typeof n!="function")throw new Error("Callback must be provided.");let a=s.pop();if(!a?.kind)throw new Error('"options.kind" must be specified.');let o=["contextrequest","contextclaim"],l=s.pop()||o[0];if(!o.includes(l))throw new Error(`Invalid event type. Must be one of: ${o.join(",")}`);let{kind:u,detail:c,targetContext:f,live:p,signal:g,diff:m,..._}=a;super(l,{..._,bubbles:_.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>n}),Object.defineProperty(this,"kind",{get:()=>u}),Object.defineProperty(this,"targetContext",{get:()=>f}),Object.defineProperty(this,"detail",{get:()=>c}),Object.defineProperty(this,"live",{get:()=>p}),Object.defineProperty(this,"signal",{get:()=>g}),Object.defineProperty(this,"diff",{get:()=>m}),Object.defineProperty(this,"options",{get:()=>_}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(s){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===s)return;Object.defineProperty(this,"_prevValue",{value:s,configurable:!0})}return this.callback(s)}}return t.DOMContextRequestEvent=i,i}var ne=class extends AbortController{constructor(t){super(),t(i=>{let{window:{webqit:{Observer:r}}}=z;r.defineProperty(this,"value",{value:i,configurable:!0,enumerable:!0})},this)}};var ae=class extends Error{};var Bt=class{static instance(t){return k(t).get("contexts::instance")||new this(t)}constructor(t){k(t).get("contexts::instance")?.dispose(),k(t).set("contexts::instance",this);let i={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>i})}[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]()}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(i=>typeof t[0]=="function"?t[0](i):i.constructor.kind===t[0]&&(!t[1]||i.detail===t[1]))}attach(t){if(!(t instanceof ut))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new ae(`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 ne((i,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(i):t[t.length-1]=i);let s;(s=t.find(a=>typeof a=="object"&&a))&&s.live&&(s.signal&&s.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(s)]={...s,signal:r.signal});let n=new(_i())(...t);this["#"].host.dispatchEvent(n)})}};var _r=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}}}}=z;return t}get name(){return[z.window.Document,z.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 _r)||t.target===this.host)return;let i=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),i.add(r))}),i.size)return t.respondWith(i)}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:i}=Bt.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return i?.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(i=>{this.subscriptions.delete(i),this.unsubscribed(i);let{target:r}=i;i.meta.answered=!1,r.dispatchEvent(i)}),this}},ut=_r;J(ut,"kind");var _e=class extends ut{static createRequest(t=null){let i=super.createRequest();if(t?.startsWith("@")){let[r,...s]=s.slice(1).split("/").map(n=>n.trim());i.targetContext=r,i.detail=s.join("/")}else i.detail=t;return i}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:i}}}=z;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(i.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(s=>s.trim()).filter(s=>s);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=i.reduce(this.namespaceObj,r,i.get,s=>{this.disposed||t.respondWith(s.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};J(_e,"kind","namespace");function Er(e={}){let{config:t,window:i}=ot.call(this,"namespaced-html",e,{attr:{namespace:"namespace",lid:"id"},api:{namespace:"namespace"},tokens:{lidrefPrefix:"~",lidrefSeparator:":"},target:{className:":target",eventName:":target",scrolling:!0}});t.lidSelector=`[${i.CSS.escape(t.attr.lid)}]`,t.namespaceSelector=`[${i.CSS.escape(t.attr.namespace)}]`,i.webqit.DOMNamingContext=_e,Wa.call(i,t),za.call(i,t)}function un(e){let{lidrefPrefix:t,lidrefSeparator:i}=e.tokens;return{escape(r,s=1){return[...r].map(n=>/\w/.test(n)?n:s===2?`\\\\${n}`:`\\${n}`).join("")},lidrefPrefix(r=0){return r?this.escape(t,r):t},lidrefSeparator(r=0){return r?this.escape(i,r):i},isUuid(r,s=0){return r.startsWith(this.lidrefPrefix(s))&&r.includes(this.lidrefSeparator(s))},toUuid(r,s,n=0){return r.endsWith("-root")?s:`${this.lidrefPrefix(n)}${r}${this.lidrefSeparator(n)}${s}`},uuidToId(r,s=0){return this.isUuid(r)?r.split(this.lidrefSeparator(s))[1]:r},uuidToLidref(r,s=0){return this.isUuid(r)?`${this.lidrefPrefix(s)}${r.split(this.lidrefSeparator(s))[1]}`:r}}}function Cr(e,t,i=null,r=0){let s=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:n}}}}=s,a=un(n),o=new RegExp(`${i?":scope|":""}#(${a.lidrefPrefix(r+1)})?([\\w]+${a.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[l,u]=Mt(e,",").reduce(([f,p],g)=>{let m,_;return g=g.replace(o,(v,y,b,S,w)=>{if(m||(m=[...g.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),m.some(P=>w>P.index&&w+v.length<P.index+P[0].length))return v;if(v===":scope")return _=!0,i;let x=y&&!b;if(y&&b)return`#${a.escape(v.replace("#",""),1)}`;if(x&&n.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${a.toUuid(t,S,1)}`;let E;return n.attr.lid==="id"?E=`:is(#${S},[id^="${a.lidrefPrefix(r)}"][id$="${a.lidrefSeparator(r)}${S}"])`:E=`:is(#${S},[${s.CSS.escape(n.attr.lid)}="${S}"])`,x?`:is(${E}):not(${i?i+" ":""}${n.namespaceSelector} *)`:E}),_?[f,p.concat(g)]:[f.concat(g),p]},[[],[]]),c;return i&&l.length?c=[l.length>1?`${i} :is(${l.join(", ")})`:`${i} ${l[0]}`,u.join(", ")].filter(f=>f).join(", "):c=[...l,...u].join(", "),c}function Ei(e){let t=this;if(!k(e).has("namespace")){let i=Object.create(null);k(e).set("namespace",i);let r=[t.Document,t.ShadowRoot].some(s=>e instanceof s);Object.defineProperty(i,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return k(e).get("namespace")}function Ee(e,t=!1){let i=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=i,s=[i.Document,i.ShadowRoot].some(n=>e instanceof n);return Ei.call(i,s?e:(t?e.parentNode:e)?.closest?.(r.namespaceSelector)||e.getRootNode())}function Ci(e){let t=Object.prototype.toString.call(e)==="[object RootNamespaceRegistry]";return(Si(e)||se(e))+(t?"-root":"")}function Wa(e){let t=this,{webqit:{Observer:i}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let s=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(e.api.namespace in r)throw new Error(`The ${s} prototype already has a "${e.api.namespace}" API!`);Object.defineProperty(r,e.api.namespace,{get:function(){return i.proxy(Ei.call(t,this))}})})}function za(e){let t=this,{webqit:{Observer:i,realdom:r,oohtml:{configs:s},DOMNamingContext:n}}=t,a=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],o=["for","list","form","aria-activedescendant","aria-details","aria-errormessage"],l=[e.attr.lid,...a,...o],u={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"},c=un(e),f=(x,C,E)=>{if(!Sr(x,C)&&k(x,"attrOriginals").has(C))return k(x,"attrOriginals").get(C);let P=E();return Sr(x,C)?P:P&&P.split(" ").map(A=>(A=A.trim())&&(C===e.attr.lid?c.uuidToId:c.uuidToLidref).call(c,A)).join(" ")},p=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...p,value(x){return this.querySelector(`#${x}`)}});for(let x of["querySelector","querySelectorAll"])for(let C of[t.Document,t.Element]){let E=Object.getOwnPropertyDescriptor(C.prototype,x);Object.defineProperty(C.prototype,x,{...E,value(P){return E.value.call(this,Cr.call(t,P,Ci(Ei.call(t,this))))}})}let g=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...g,value(x){let C=()=>g.value.call(this,x);return l.includes(x)&&!k(this,"lock").get(x)?f(this,x,C):C()}});let m=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...m,get(){let x=()=>m.get.call(this);return l.includes(this.name)?f(this.ownerElement,this.name,x):x()}});let _=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{..._,get(){let x=()=>_.get.call(this);return this instanceof t.Attr&&l.includes(this.name)?f(this.ownerElement,this.name,x):x()}});for(let x of l){if(!(x in u))continue;let C=x==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let E of C){let P=Object.getOwnPropertyDescriptor(E.prototype,u[x]);!P||Object.defineProperty(E.prototype,u[x],{...P,get(){return f(this,x,()=>P.get.call(this,x))}})}}e.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,e.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(e.attr.lid)},set(x){return this.setAttribute(e.attr.lid,x)}});let v=(x,C,E,P)=>on(x,C,()=>(typeof E=="function"&&(E=E()),P(E))),y=(x,C,E,P=null)=>{v(x,C,E,A=>{let F=C===e.attr.lid,U=P||Ee.call(t,x,F),G=Ci(U);if(F){let D=c.uuidToId(A);if(i.get(U,D)!==x){let N=c.toUuid(G,D);N!==A&&x.setAttribute("id",N),i.set(U,D,x)}}else{k(x,"attrOriginals").set(C,A);let D=A.split(" ").map(N=>(N=N.trim())&&c.isUuid(N)?N:c.toUuid(G,N)).join(" ");x.setAttribute(C,D),k(U).set("idrefs",k(U).get("idrefs")||new Set),k(U).get("idrefs").add(x)}})},b=(x,C,E,P=null)=>{v(x,C,E,A=>{let F=C===e.attr.lid,U=P||Ee.call(t,x,F);if(F){let G=c.uuidToId(A);i.get(U,G)===x&&i.deleteProperty(U,G)}else{let G=k(x,"attrOriginals").get(C);x.hasAttribute(C)&&x.setAttribute(C,G),k(U).get("idrefs")?.delete(x)}})};r.realtime(t.document).query(e.namespaceSelector,x=>{let C=(E,P,A,F)=>{if(!E.hasAttribute(P))return;let U=()=>E.getAttribute(P);b(E,P,U,A),E.isConnected&&y(E,P,k(E,"attrOriginals").get(P)||U,F)};x.exits.forEach(E=>{if(E.isConnected){let F=Ei.call(t,E);for(let U of new Set([...Object.values(F),...k(F).get("idrefs")||[]]))for(let G of l)C(U,G,F)}let P=E[s.CONTEXT_API.api.contexts],A=P.find(n.kind);A&&P.detach(A)}),x.entrants.forEach(E=>{let P,A=Ee.call(t,E,!0);for(let U of new Set([...Object.values(A),...k(A).get("idrefs")||[]]))if((P=Ee.call(t,U,!0))!==A)for(let G of l)C(U,G,A,P);let F=E[s.CONTEXT_API.api.contexts];F.find(n.kind)||F.attach(new n)})},{id:"namespace-html:namespace",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${l.map(x=>t.CSS.escape(x)).join("],[")}]`,x=>{let C={forID:new Map,forOther:new Map};for(let E of l){let P=E===e.attr.lid?C.forID:C.forOther;x.exits.forEach(A=>{if(!A.hasAttribute(E))return;let F=P.get(A);typeof F>"u"&&(F=(E===e.attr.lid?A.parentNode:A)?.closest?.(e.namespaceSelector)||A.getRootNode().host,P.set(A,F)),!(F&&!F.isConnected)&&b(A,E,()=>A.getAttribute(E))}),x.entrants.forEach(A=>{!A.hasAttribute(E)||y(A,E,()=>A.getAttribute(E))})}C.forID.clear(),C.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(l,x=>{for(let C of x)C.oldValue&&C.value!==C.oldValue&&b(C.target,C.name,C.oldValue),C.value&&C.value!==C.oldValue&&y(C.target,C.name,C.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let S,w=()=>{if(!t.location.hash?.startsWith(`#${c.lidrefPrefix()}`))return;let x=t.location.hash?.substring(`#${c.lidrefPrefix()}`.length).split("/").map(E=>E.trim()).filter(E=>E)||[],C=x.reduce((E,P)=>E&&E[e.api.namespace][P],t.document);S&&e.target.className&&S.classList.toggle(e.target.className,!1),C&&C!==t.document&&(e.target.className&&C.classList.toggle(e.target.className,!0),e.target.eventName&&C.dispatchEvent(new t.CustomEvent(e.target.eventName)),e.target.scrolling&&x.length>1&&C.scrollIntoView(),S=C)};t.addEventListener("hashchange",w),r.ready(w)}function kr({advanced:e={},...t}){let{config:i,window:r}=ot.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:ve(e)}),s=Array.isArray(i.script.mimeTypes)?i.script.mimeTypes:i.script.mimeTypes.split("|").filter(n=>n);i.scriptSelector=s.map(n=>`script[type="${r.CSS.escape(n)}"]:not([oohtmlignore])`).concat("script:not([type])").join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:Ka.bind(r,i)},Ga.call(r,i),Xa.call(r,i)}function Ga(e){let t=this,{webqit:{nextKeyword:i,matchPrologDirective:r}}=t,s=new Map;if(e.api.scripts in t.Element.prototype)throw new Error(`The "Element" class already has a "${e.api.scripts}" property!`);[t.ShadowRoot.prototype,t.Element.prototype].forEach(n=>{Object.defineProperty(n,e.api.scripts,{get:function(){return s.has(this)||s.set(this,[]),s.get(this)}})}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(n){this.toggleAttribute("scoped",n)}},live:{configurable:!0,get(){if(this.liveProgramHandle)return!0;let n=i(this.oohtml__textContent||this.textContent||"",0,0);return r(n,!0)}}})}async function Ka(e,t){let i=this,{realdom:r}=i.webqit,s=Si(t);if(!s)throw new Error("Argument must be a valid exec hash.");let{script:n,compiledScript:a,thisContext:o}=s;e.script.retention==="dispose"?n.remove():e.script.retention==="hidden"?n.textContent='"source hidden"':setTimeout(async()=>{n.textContent=await a.toString()},0);let l=n.scoped?o:n.getRootNode();k(l).has("scriptEnv")||k(l).set("scriptEnv",Object.create(null));let u=await(await a.bind(o,k(l).get("scriptEnv"))).execute();n.live&&Object.defineProperty(n,"liveProgramHandle",{value:u}),r.realtime(i.document).observe(n,()=>{n.live&&u.abort(),o instanceof i.Element&&o[e.api.scripts]?.splice(o[e.api.scripts].indexOf(n,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function Xa(e){let t=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,i=this,{webqit:{oohtml:r,realdom:s}}=i;i.HTMLScriptElement.supports||(i.HTMLScriptElement.supports=a=>["text/javascript","application/javascript"].includes(a));let n=new WeakSet;s.realtime(i.document).query(e.scriptSelector,a=>{a.entrants.forEach(o=>{if(n.has(o)||o.hasAttribute("oohtmlno")||!t&&!o.hasAttribute("ssr"))return;let l=ln.call(i,e,o);if(!l)return;n.add(o);let u=o.scoped?o.parentNode||a.target:o.type==="module"?void 0:i;o.scoped&&u[e.api.scripts].push(o);let c=se({script:o,compiledScript:l,thisContext:u});a.type==="query"||o.type&&!i.HTMLScriptElement.supports(o.type)||o.getAttribute("data-handling")==="manual"||e.script.timing==="manual"?r.Script.execute(c):o.textContent=`webqit.oohtml.Script.execute( '${c}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function ln(e,t){let i=this,{webqit:{oohtml:r,LiveScript:s,AsyncLiveScript:n,LiveModule:a}}=i,o=t.textContent.trim();if(o.startsWith("/*@oohtml*/if(false){")&&o.endsWith("}/*@oohtml*/")&&(o=o.slice(21,-12),Object.defineProperty(t,"oohtml__textContent",{value:o})),!o.trim().length)return;let l=se(o),u=r.Script.compileCache[t.live?0:1],c;if(!(c=u.get(l))){let{parserParams:f,compilerParams:p,runtimeParams:g}=e.advanced;c=new(t.type==="module"?a:s||n)(o,{liveMode:t.live,exportNamespace:`#${t.id}`,fileName:`${i.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:f,compilerParams:p,runtimeParams:g}),u.set(l,c)}return c}function cn(e){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:i}}}}=t;[...e?.querySelectorAll(i.scriptSelector)||[]].forEach(r=>{ln.call(t,i,r)})}function Ir(e={}){let{config:t,window:i}=ot.call(this,"data-binding",e,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:ve({runtimeParams:{spec:{handler:s=>{}}}})});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=i.webqit.oohtml.configs),t.attrSelector=`[${i.CSS.escape(t.attr.render)}]`;let r=(s,n)=>{let a=`starts-with(., "${s}")`,o=`substring(., string-length(.) - string-length("${n}") + 1) = "${n}"`;return`${a} and ${o}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,Qa.call(i,t)}function Qa(e){let t=this,{webqit:{realdom:i}}=t;i.realtime(t.document).query(e.attrSelector,r=>{hn.call(this,...r.exits),Ja.call(t,e,...r.entrants),queueMicrotask(()=>{},0)},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),i.realtime(t.document).query(`(${e.discreteBindingsSelector})`,r=>{hn.call(this,...r.exits),Ya.call(t,e,...r.entrants),queueMicrotask(()=>{})},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function fn(e,t){let{webqit:{realdom:i,Observer:r,DOMBindingsContext:s}}=this;if(k(t).has("data-binding"))return k(t).get("data-binding");let n=Object.create(null),a=new AbortController;n.$exec__=(l,u,...c)=>{(()=>{try{l[u](...c)}catch(p){throw new Error(`Error executing "${u}()": ${p.message} at ${p.cause}`)}})()},n.$assign__=(l,u,c)=>{(()=>{try{l[u]=c}catch(p){throw new Error(`Error executing "${u} = ${c}": ${p.message} at ${p.cause}`)}})()},r.intercept(n,{get:(l,u,c)=>{if(!(l.key in n)){let f={...s.createRequest(l.key),live:!0,signal:a.signal};t[e.CONTEXT_API.api.contexts].request(f,p=>{r.set(n,l.key,p)})}return c(n[l.key]??(l.key in globalThis?globalThis[l.key]:void 0))},has:(l,u,c)=>c(!0)});let o={scope:n,abortController:a,bindings:new Map};return k(t).set("data-binding",o),o}function hn(...e){for(let t of e){let i=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:s}=k(i).get("data-binding")||{};if(!r?.has(t))return;r.get(t).liveProgramHandle.abort(),r.get(t).signals?.forEach(n=>n.abort()),r.delete(t),r.size||(s.abort(),k(i).delete("data-binding"))}}function pn(e,t){let i=e.tokens.tagStart.split("").map(u=>`\\${u}`).join(""),r=e.tokens.tagEnd.split("").map(u=>`\\${u}`).join(""),s=e.tokens.stateStart.split("").map(u=>u===" "?"(?:\\s+)?":`\\${u}`).join(""),n=e.tokens.stateEnd.split("").map(u=>`\\${u}`).join(""),a=`^${i}(.*?)(?:${s}(\\d+)${n}(?:\\s+)?)?${r}$`,[,o,l]=t.match(new RegExp(a));return{raw:t,expr:o,span:parseInt(l??0)}}async function Ya(e,...t){let i=this,r=t.reduce((s,n)=>{if(n.isBound)return s;let a=pn(e,n.nodeValue),o=n;if(a.span){if(o=n.nextSibling,o?.nodeName!=="#text"||o.nodeValue.length<a.span)return s;o.nodeValue.length>a.span&&o.splitText(a.span)}else o=n.ownerDocument.createTextNode(""),n.after(o);o.isBound=!0;let l=n;return i.webqit.env!=="server"&&(l.remove(),l=null),s.concat({textNode:o,template:a,anchorNode:l})},[]);for(let{textNode:s,template:n,anchorNode:a}of r){let o=dn.call(i,e,n.expr),{scope:l,bindings:u}=fn.call(this,e,s.parentNode);Object.defineProperty(s,"$oohtml_internal_databinding_anchorNode",{value:a,configurable:!0});try{u.set(s,{liveProgramHandle:await(await o.bind(s,l)).execute()})}catch(c){console.log(c)}}}var Ar=new Map;function dn(e,t){if(Ar.has(t))return Ar.get(t);let i=`let content = ((${t}) ?? '') + '';`;i+="$assign__(this, 'nodeValue', content);",i+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${e.tokens.tagStart}${Ce(t)}${e.tokens.stateStart}" + content.length + "${e.tokens.stateEnd} ${e.tokens.tagEnd}"); }`;let{webqit:{LiveScript:r}}=this,{parserParams:s,compilerParams:n,runtimeParams:a}=e.advanced,o=new r(i,{parserParams:s,compilerParams:n,runtimeParams:a});return Ar.set(t,o),o}async function Ja(e,...t){for(let i of t){let r=mn.call(this,e,i.getAttribute(e.attr.render)),{scope:s,bindings:n}=fn.call(this,e,i),a=[];Object.defineProperty(i,"$oohtml_internal_databinding_signals",{value:a,configurable:!0});try{n.set(i,{signals:a,liveProgramHandle:await(await r.bind(i,s)).execute()})}catch(o){console.log(o)}}}var Pr=new Map;function mn(e,t){if(Pr.has(t))return Pr.get(t);let i={},r=-1,s=Mt(t,";").map(c=>{let[f,p]=Mt(c,":").map(y=>y.trim()),g=f[0],m=f.slice(1).trim(),_=`(${p})`,v=`(${_} ?? '')`;if(g==="&")return m.startsWith("--")?`$exec__(this.style, 'setProperty', "${Ce(m)}", ${v});`:`$assign__(this.style, "${Ce(m)}", ${v});`;if(g==="%")return`$exec__(this.classList, 'toggle', "${Ce(m)}", !!${_});`;if(g==="~")return m.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Ce(m.substring(1).trim())}", !!${_});`:`$exec__(this, 'setAttribute', "${Ce(m)}", ${v});`;if(g==="#"){if(i[m])throw new Error(`Duplicate binding: ${f}.`);if(i[m]=!0,m==="text")return`$assign__(this, 'textContent', ${v});`;if(m==="html")return`$assign__(this, 'innerHTML', ${v});`;if(m==="items"){let[y,b]=Mt(p,"/");if(!b)throw new Error(`Invalid ${g}items spec: ${c}; no import specifier.`);let[S,w,x,C]=y.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!S)throw new Error(`Invalid ${g}items spec: ${c}.`);if(w.startsWith("(")?w=w.trim().slice(1,-1).split(",").map(A=>A.trim()):w=[w],w.length>(x==="in"?3:2))throw new Error(`Invalid ${g}items spec: ${c}.`);let E=x==="in"?w[2]:w[1]||"$index__";return`console.log('-|---|---||');
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
`}};`);let B="global";if(P.push(`${A}.scope = new ${A}.Scope(undefined, '${B}', globalThis);`),(y||H?.env||H&&f)&&(B="env",P.push(`${A}.scope = new ${A}.Scope(${A}.scope, '${B}', ${A}.env);`)),g&&(B="module",P.push(`${A}.scope = new ${A}.Scope(${A}.scope, '${B}');`)),(typeof H?.thisContext<"u"||H&&f)&&P.push(`${A}.scope = new ${A}.Scope(${A}.scope, 'this', { ['this']: ${A}.thisContext });`),P.push(`${A}.runtime = new ${A}.Runtime(undefined, '${B}', ${A}.params, ${A}.scope, ${A}.main);`),g&&b){P.push(`${A}.result = await ${A}.runtime.execute();`);let[yt,_r]=I.exportIds.reduce(([,vr],Ae)=>Ae==="default"?[Ae,vr]:[,vr.concat(Ae)],[null,[]]);return _r.length&&P.push(`export const { ${_r.join(", ")} } = ${A}.result.exports;`),yt&&P.push(`export default ${A}.result.exports.default;`),N(P)}if(b)return P.push(`${A}.result = ${A}.runtime.execute();`),x&&P.push(`return ${A}.result;`),N(P);P.push(x?`return ${A}.runtime.execute();`:`return ${A}.runtime;`);let Q=N(P,!0),xr=p||Function;return G(Q,yt=>f?[xr(A,yt),H]:xr(A,yt)(H))})}var Ye;try{Ye=eval("import.meta.url")}catch(i){}function Lu(i){let t=Li(i);return Hi(t)}function Li(i){if(typeof i!="string")throw new TypeError("URL must be a string");if(!i.startsWith("file://"))return i;let t=i.slice(7);return t=t.replace(/^\/([A-Za-z]:)/,"$1"),t=decodeURIComponent(t),t}function Hi(i){if(typeof i!="string")throw new TypeError("path must be a string");let t=i.includes("\\")?"\\":"/",e=i.lastIndexOf(t);return e===-1?i:e===0?t:i.slice(0,e)}var Nt=class{constructor(...t){let e=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{};this.source=t.pop()||"",this.$program=me(e.sourceType,e.astTools,this.source,{...r,forDynamicBinding:!0})}execute(){return G(this.$program,([t,e])=>G(t(e),r=>r.execute()))}bind(t,e=void 0){return G(this.$program,([r,n])=>r({...n,thisContext:t,env:e}))}toString(t=!1){return t?G(this.$program,([e])=>e+""):this.source}};var Fi;function Wi(...i){let{source:t,args:e,params:r}=qr(i),n=Dr("async-function-source",t,e,r);if(!(n instanceof Promise))return n;let o=async function(...s){return(await n).call(this,...s)};return Object.defineProperty(o,"toString",{value:async function(...s){return(await n).toString(...s)}}),o}var zi,ne=class extends Nt{};V(ne,"sourceType","async-script-source"),V(ne,"astTools",{parse:ge,transform:ye,serialize:be});var oe=class extends Nt{};V(oe,"sourceType","module"),V(oe,"astTools",{parse:ge,transform:ye,serialize:be});function Dr(i,t,...e){return me(i,{parse:ge,transform:ye,serialize:be},t,...e)}function ge(i,t){return Ze("parse",i,t)}function ye(i,t){return Ze("transform",i,t)}function be(i,t){return Ze("serialize",i,t)}function Ze(i,t,e){let r=n=>(Object.defineProperty(n,"toString",{value:o=>o==="base64"?n.transformedSourceBase64:n.transformedSource}),n);if(globalThis.webqit?.$useLiveT){let{parse:n,transform:o,serialize:s}=globalThis.webqit.$useLiveT;if(i==="serialize")return s(t,e);if(i==="parse")return n(t,e);if(i==="transform"){let a=o(t,e);return r(a)}}if(globalThis.webqit=globalThis.webqit||{},!globalThis.webqit.$useLiveTWorker){let s=`
|
|
12
|
+
const transformerUrls = [ '${(document.querySelector('meta[name="$q-transformer-url"]')?.content.split(",")||[]).concat("https://unpkg.com/@webqit/use-live/dist/transformer.js").join("','")}' ];
|
|
13
|
+
( function importScript() {
|
|
14
|
+
try { importScripts( transformerUrls.shift().trim() ) } catch( e ) { if ( transformerUrls.length ) { importScript(); } }
|
|
15
|
+
} )();
|
|
16
|
+
const { parse, transform, serialize } = globalThis.webqit.$useLiveT;
|
|
17
|
+
globalThis.onmessage = e => {
|
|
18
|
+
const { action, input, params } = e.data;
|
|
19
|
+
let result;
|
|
20
|
+
if (action === 'serialize') {
|
|
21
|
+
result = serialize(input, params);
|
|
22
|
+
} else if (action === 'parse') {
|
|
23
|
+
result = parse(input, params);
|
|
24
|
+
} else if (action === 'transform') {
|
|
25
|
+
const { toString, ...compilation } = transform(input, params);
|
|
26
|
+
result = compilation;
|
|
27
|
+
}
|
|
28
|
+
e.ports[0]?.postMessage(result);
|
|
29
|
+
};`;globalThis.webqit.$useLiveTWorker=new Worker(`data:text/javascript;base64,${btoa(s)}`)}return new Promise(n=>{let o=new MessageChannel;webqit.$useLiveTWorker.postMessage({action:i,input:t,params:e},[o.port2]),o.port1.onmessage=s=>{let a=s.data;i==="transform"&&r(a),n(a)}})}function se(i,t,e={},r={}){t=F(t).slice();for(var n=i;!at(n)&&!Vt(n)&&t.length;){var o=t.shift();if(!(e.get?e.get(n,o):j(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 tr(i,t,e,r={},n={}){let o=(u,p,f)=>n.set?n.set(u,p,f):(Z(t[a])&&M(u)?u.push(f):u[p]=f,!0);t=F(t);for(var s=i,a=0;a<t.length;a++)if(a<t.length-1){if(!s||!j(s)&&!k(s))return!1;var c=se(s,t[a],n);if(!j(c)){if(n.buildTree===!1)return!1;c=k(n.buildTree)?n.buildTree(a):Z(t[a+1])?[]:{};var l=o(s,t[a],c);if(!l)return!1}s=c}else return o(s,t[a],e)}var ae=class{constructor(t,e=!1){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!e&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let e=await t();return this._synthesis--,e}_fulfill(){for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.readCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,e,r){this.onread(()=>{let n=t(r),o=s=>{s!==void 0&&this.onwrite(()=>{let a=e(s,r),c=l=>{l!==void 0&&this.cycle(t,e,l)};a instanceof Promise?a.then(c):c(a)})};n instanceof Promise?n.then(o):o(n)})}};function Nr(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Lt(i,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(s=>(s+"").replace("(",r?"(.//":"(./")).join("|");let n=[],o;try{let s=i.document.evaluate(e,t,null,i.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)n.push(o)}catch{}return n}function Lr(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 le(i,t,e,r=!1,n=null){let o=n?.get(t)?.get(e);if(typeof o<"u")return o;let s=l=>(n?.has(t)||n?.set(t,new WeakMap),n?.get(t)?.set(e,l),l),a=t.getRootNode(),c=e.getRootNode();return a===c?s(t.contains(e)):r&&c instanceof i.ShadowRoot?s(le(i,t,c.host,r,n)):s(!1)}function Hr(i,t="|"){return[...i].reduce(([e,r,n,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(s)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!n[0].endsWith("\\")&&(e=e===s?null:e||s),n[0]+=s,[e,r,n]),[null,0,[""]])[2].reverse()}var tt=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Nr(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Hr(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(k(t[0])?t=[[],...t]:q(t[0])&&!(t[0]instanceof tt)&&t.length===1?t=[[],void 0,t[0]]:q(t[1])&&t.length===2?t=[F(t[0],!1),void 0,t[1]]:t[0]=F(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof tt)&&!(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 tt?e:new tt(e)),t}registry(...t){return W(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,s=new WeakMap;for(let[a,c]of this.registry(t)){let l=[].concat(e).filter(p=>le(n,a.context,p.target,a.params.subtree==="cross-roots",s));if(!l.length)continue;let u=[a,Array.isArray(e)?l:l[0]];c?o.add(u):r.call(n,...u)}for(let a of o)r.call(n,...a);o.clear()}disconnectables(t,...e){let r={disconnect(){e.forEach(n=>n&&k(n.disconnect)&&n.disconnect()||k(n)&&n()||q(n)&&(n.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var ht=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 tt;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=Br(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let c of s){let l=a?a.generate():{};e(c,l,o)}else{let c=a?.generate()||{};e(s,c,o)}if(r.live){a&&(r={...r,signalGenerator:a});let c=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,c)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof tt;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(n?t[0]:t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:o,window:s,webqit:a}=this;r.eventDetails&&!a.realdom.attrInterceptionHooks?.intercepting&&Wr.call(s,"intercept",()=>{});let c=new s.MutationObserver(f=>{f=zr(f).map(d=>Ur.call(s,d)),Fr.call(s,p,f,o)}),l={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(l.attributeFilter=t.map(f=>f+"")),c.observe(o,l);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),p={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:u,disconnectable:c};return this.disconnectables(r.signal,c,u)}observeSync(t,e,r={}){let n=typeof t=="string"||t instanceof tt;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let a=r.timing==="intercept"?"intercept":"sync";this.registry(a).size||Wr.call(s,a,f=>{this.forEachMatchingContext(a,f,Fr)});let c={disconnect(){p.delete(u)}},l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:l,disconnectable:c},p=this.registry(a);return p.set(u,!!u.params.deferred),this.disconnectables(r.signal,c,l)}};function zr(i){return i.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName||W(e.target,"realdom","internalAttrInteractions").get(e.attributeName)?t:t.concat(e),[])}function Fr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:c}=i;if(o.subtree||(t=t.filter(f=>f.target===e)),!t.length)return;let l=r.map(f=>f+"");if(o.atomic&&!s.size?t=Br(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(f=>l.includes(f.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(f=>{let d;return o.eventDetails||({event:d,...f}=f),!o.oldValue&&"oldValue"in f&&({oldValue:d,...f}=f),!o.newValue&&"value"in f?{value:d,...f}=f:o.newValue&&typeof f.value>"u"&&(f={...f,value:xe(f.target,f.name,()=>f.target.getAttribute(f.name))}),f})),o.atomic&&(t.forEach(f=>s.set(f.name,f)),t=Array.from(s.entries()).map(([,f])=>f));let u=a?t[0]:t,p=c?c.generate():{};n(u,p,e)}function xe(i,t,e){let r=W(i,"realdom","internalAttrInteractions").get(t);W(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return W(i,"realdom","internalAttrInteractions").set(t,r),n}function Br(i,t,e=[]){let r={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",e.find(s=>s.name===o)||{target:i,name:o,value:xe(i,o,()=>i.getAttribute(o)),...r})):Array.from(i.attributes).map(o=>e.find(s=>s.name===o.nodeName)||{target:i,name:o.nodeName,value:xe(i,o.nodeName,()=>o.nodeValue),...r})}function Ur({target:i,attributeName:t,value:e,oldValue:r}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(i)||{})[t]?.[0]||"mutation";return{target:i,name:t,value:e,oldValue:r,type:"observation",event:s}}function Wr(i,t){let e=this,{webqit:r,document:n,Element:o}=e;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(i)||r.realdom.attrInterceptionHooks.set(i,new Set),r.realdom.attrInterceptionHooks.get(i).add(t);let s=()=>r.realdom.attrInterceptionHooks.get(i).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let a=(u,p)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let f=r.realdom.attrInterceptionRecords.get(u.target);if(f[u.name]=f[u.name]||[],f[u.name].unshift(u.event),W(u.target,"realdom","internalAttrInteractions").get(u.name))return p();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m([u]));let d=p();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m([u])),d};new e.MutationObserver(u=>{u=u.filter(p=>!(e.webqit.realdom.attrInterceptionRecords?.get(p.target)||{})[p.attributeName]?.shift()),u=zr(u).map(p=>Ur.call(e,p)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(p=>p(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(p=>p(u)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let l=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(u=>{l[u]=o.prototype[u],o.prototype[u]=function(...p){let f,d=xe(this,p[0],()=>this.getAttribute(p[0]));["setAttribute","toggleAttribute"].includes(u)&&(f=p[1]),u==="toggleAttribute"&&f===void 0&&(f=d===null);let m={target:this,name:p[0],value:f,oldValue:d,type:"interception",event:[this,u]};return a(m,()=>l[u].call(this,...p))}}),s}var ce=class extends At{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new ht(n,o).get(...arguments)}query(t,e=void 0,r={}){[t,e=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,o=new Map,s=l=>(o.has(l)||o.set(l,{target:l,entrants:[],exits:[],type:"query",event:null}),o.get(l));if(!r.generation||r.generation==="entrants"){if(!t.length)[...n.children].forEach(l=>s(n).entrants.push(l));else if(t.every(l=>l.type==="selector")){let[l,u]=t.reduce(([f,d],m)=>m.kind==="xpath"?[f,d.concat(m)]:[f.concat(m),d],[[],[]]),p=[];r.subtree?(l.length&&p.push(...n.querySelectorAll(l.join(","))),u.length&&p.push(...Lt(this.window,n,u))):(l.length&&p.push(...[...n.children].filter(f=>f.matches(l))),u.length&&p.push(...Lt(this.window,n,u,!1))),p.forEach(f=>s(f.parentNode||n).entrants.push(f))}}if(!e)return o;let a={disconnected:!1},c=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,l]of o){if(a.disconnected)break;let u=c?.generate()||{};e(l,u,n)}if(r.live){c&&(r={...r,signalGenerator:c});let l=this.observe(t,e,r);return this.disconnectables(r.signal,a,l)}return this.disconnectables(r.signal,a,c)}children(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!1})}subtree(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!0})}observe(t,e,r={}){if([t,e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:n,window:o,webqit:s,document:a}=this;r.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(a.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Xr.call(o,"sync",()=>{});let c=new o.MutationObserver(p=>p.forEach(f=>{rr.call(o,u,Gr.call(o,f),n)}));c.observe(n,{childList:!0,subtree:r.subtree&&!0});let l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:l,disconnectable:c};if(r.staticSensitivity){let p=Vr.call(o,u);return this.disconnectables(r.signal,c,l,p)}return this.disconnectables(r.signal,c,l)}observeSync(t,e,r={}){[t,e,r={}]=this.resolveArgs(arguments);let{context:n,window:o}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let s=r.timing==="intercept"?"intercept":"sync";this.registry(s).size||Xr.call(o,s,f=>{this.forEachMatchingContext(s,f,rr)});let a=new o.MutationObserver(f=>f.forEach(d=>{Array.isArray((d=Gr.call(o,d)).event)||rr.call(o,u,d,n)}));a.observe(n,{childList:!0,subtree:r.subtree&&!0});let c={disconnect(){p.delete(u),a.disconnect()}},l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:l,disconnectable:c},p=this.registry(s);if(p.set(u,!!u.params.deferred),r.staticSensitivity){let f=Vr.call(o,u);return this.disconnectables(r.signal,c,l,f)}return this.disconnectables(r.signal,c,l)}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 Vr(i){let t=this,{context:e,spec:r,callback:n,params:o,signalGenerator:s}=i,a=r.filter(d=>d.kind==="css"),c=d=>d.match(/\.([\w-]+)/g)?.length?["class"]:[],l=d=>d.match(/#([\w-]+)/g)?.length?["id"]:[],u=d=>[...d.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(m=>m[1]).concat(c(d)).concat(l(d));if(!(i.$attrs=Array.from(new Set(a.filter(d=>(d+"").includes("[")).reduce((d,m)=>d.concat(u(m+"")),[])))).length)return;let p=new Set,f=new Set;return p.push=d=>(f.delete(d),p.add(d)),f.push=d=>(p.delete(d),f.add(d)),i.$deliveryCache={entrants:p,exits:f},new ht(e,t).observe(i.$attrs,d=>{let m=new Map,w=y=>(m.has(y)||m.set(y,{target:y,entrants:[],exits:[],type:"static",event:null}),m.get(y)),v=new WeakMap,g=y=>(v.has(y)||v.set(y,a.some(x=>y.matches(x+""))),v.get(y));for(let y of d)["entrants","exits"].forEach(x=>{o.generation&&x!==o.generation||i.$deliveryCache[x].has(y.target)||(x==="entrants"?!g(y.target):g(y.target))||(i.$deliveryCache[x].push(y.target),w(y.target)[x].push(y.target),w(y.target).event=y.event)});for(let[,y]of m){let x=s?.generate()||{};n(y,x,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function rr(i,t){let{context:e,spec:r,callback:n,params:o,signalGenerator:s,$deliveryCache:a}=i,c={...t,entrants:[],exits:[]};if(o.eventDetails||delete c.event,["entrants","exits"].forEach(u=>{if(!(o.generation&&u!==o.generation)&&(r.length?c[u]=Gi.call(this,r,o.subtree==="cross-roots",t[u],t.event!=="parse"):c[u]=[...t[u]],!!a))for(let p of c[u])a[u].push(p)}),!c.entrants.length&&!c.exits.length)return;let l=s?.generate()||{};n(c,l,e)}function Gi(i,t,e,r){e=Array.isArray(e)?e:[...e];let n=(o,s)=>{if(s.type==="selector"){let a=s.isXpathAttr?[]:o.filter(c=>s.kind==="xpath"?Lr(this,c,s+""):c.matches&&c.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((c,l)=>s.kind==="xpath"?[...c,...Lt(this,l,s,r)]:l.querySelectorAll?[...c,...l.querySelectorAll(s+"")]:c,a)),a.length)return a}else if(o.includes(s.content)||r&&o.some(a=>le(this,a,s.content,t)))return[s.content]};return e.$$searchCache||(e.$$searchCache=new Map),i.reduce((o,s)=>{let a;return e.$$searchCache.has(s.content)?a=e.$$searchCache.get(s.content):(a=n(e,s)||[],s.type==="instance"&&e.$$searchCache.set(s.content,a)),o.concat(a)},[])}function Gr({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=F(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=F(e).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),n),n=n||r.document.readyState==="loading"&&"parse"||"mutation",{target:i,entrants:t,exits:e,type:"observation",event:n}}function Xr(i,t){let e=this,{webqit:r,document:n,Node:o,CharacterData:s,Element:a,HTMLElement:c,HTMLTemplateElement:l,DocumentFragment:u}=e;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionNoRecurse||Object.defineProperty(r.realdom,"domInterceptionNoRecurse",{value:new Map}),r.realdom.domInterceptionHooks.has(i)||r.realdom.domInterceptionHooks.set(i,new Set),r.realdom.domInterceptionHooks.get(i).add(t);let p=()=>r.realdom.domInterceptionHooks.get(i).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return p;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let f=(g,y,x)=>{r.realdom.domInterceptionNoRecurse.set(g,y);let S=x();return r.realdom.domInterceptionNoRecurse.delete(g),S},d=(g,y)=>{g.entrants.concat(g.exits).forEach(S=>{clearTimeout(r.realdom.domInterceptionRecords.get(S)?.timeout),r.realdom.domInterceptionRecords.set(S,g.event);let h=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(S)},0);Object.defineProperty(g.event,"timeout",{value:h,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(S=>S(g));let x=y();return r.realdom.domInterceptionHooks.get("sync")?.forEach(S=>S(g)),x},m={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},w={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(m).reduce((g,y)=>g.concat(y),[])).forEach(g=>{Object.keys(m).forEach(S=>{if(!m[S].includes(g))return;let h=Object.getOwnPropertyDescriptor(e[S].prototype,g);!h||(Object.defineProperty(e[S].prototype,g,"value"in h?{...h,value:y}:{...h,set:x}),w[S][g]=h)});function y(...S){let h=Object.keys(w).find(I=>this instanceof e[I]&&g in w[I]),b=w[h],_=()=>b[g].value.call(this,...S);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return _();let O=[],$=[],T=this;["insertBefore"].includes(g)?$=[S[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?($=[S[1]],["beforebegin","afterend"].includes(S[0])&&(T=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?(O=[...this.childNodes],$=g==="replaceChildren"?[...S]:[S[0]]):["replaceWith","remove"].includes(g)?(O=[this],$=g==="replaceWith"?[...S]:[],T=this.parentNode):["replaceChild"].includes(g)?(O=[S[1]],$=[S[0]]):["removeChild"].includes(g)?O=[...S]:($=[...S],["before","after"].includes(g)&&(T=this.parentNode));let R=g;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(g)){let I=this.nodeName;if(g==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(S[0])){if(!this.parentNode)return b[g].value.call(this,...S);I=this.parentNode.nodeName}let P=n.createElement(I.includes("-")?"div":I);b.setHTMLUnsafe.value.call(P,$[0],g==="setHTMLUnsafe"?S[1]:{}),$=[...P.childNodes],g==="insertAdjacentHTML"?(R="insertAdjacentElement",S[1]=new u,f(S[1],"append",()=>S[1].append(...P.childNodes))):(R="replaceChildren",S=[...P.childNodes])}return T?d({target:T,entrants:$,exits:O,type:"interception",event:[this,g]},()=>b[R].value.call(this,...S)):_()}function x(S){let h=Object.keys(w).find(N=>this instanceof e[N]&&g in w[N]),b=w[h],_=()=>b[g].set.call(this,S);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return _();let O=[],$=[],T=this;if(["outerHTML","outerText"].includes(g)?(O=[this],T=this.parentNode):this instanceof l?(T=this.content,O=[...this.content.childNodes]):O=[...this.childNodes],["outerHTML","innerHTML"].includes(g)){let N=this.nodeName;if(g==="outerHTML"){if(!this.parentNode)return _();N=this.parentNode.nodeName}let I=n.createElement(N.includes("-")?"div":N);if(f(I,g,()=>I[g]=S),$=this instanceof l?[...I.content.childNodes]:[...I.childNodes],this instanceof l&&this.hasAttribute("src")||this instanceof ShadowRoot){let P=A=>A.reduce((H,B)=>B instanceof HTMLScriptElement?H.concat(B):B instanceof l?H.concat(P([B.content])):(H=H.concat(P([...B.querySelectorAll?.("template")||[]].map(Q=>Q.content))),H.concat(...B.querySelectorAll?.("script")||[])),[]);for(let A of P($)){if(this instanceof ShadowRoot){A.setAttribute("data-handling","manual");continue}let H=n.createElement("script");[...A.attributes].forEach(B=>H.setAttribute(B.name,B.value)),H.textContent=A.textContent,f(A,"replaceWith",()=>A.replaceWith(H))}}g==="outerHTML"?(S=new u,f(S,"append",()=>S.append(...$)),_=()=>f(this,"replaceWith",()=>a.prototype.replaceWith.call(this,S))):this instanceof l?_=()=>f(this.content,"replaceChildren",()=>this.content.replaceChildren(...$)):_=()=>f(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...$))}return d({target:T,entrants:$,exits:O,type:"interception",event:[this,g]},_)}}),p}function Jr(){Xi.call(this),Ji.call(this),Qi.call(this)}function Xi(){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 Qi(){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 Qr(){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)=>Yi.call(i,...e),i.webqit.realdom.ready=(...e)=>ir.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new ce(e,i);if(r==="attr")return new ht(e,i)};let t=new ae(i);return i.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),i.webqit.realdom.synthesizeWhile=(...e)=>t.synthesizeWhile(...e),i.webqit.realdom}function ir(...i){let t="interactive",e;kt(i[0])?(t=i[0],k(i[1])&&(e=i[1])):k(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=>ir.call(this,"interactive",o)),complete:new Promise(o=>ir.call(this,"complete",o))}),n.webqit.realdom.readyStatePromises[t];if(r[t].includes(n.document.readyState))return e(n);n.webqit.realdom.readyStateCallbacks||(n.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},n.document.addEventListener("readystatechange",()=>{let o=n.document.readyState;for(let s of n.webqit.realdom.readyStateCallbacks[o].splice(0))s(n)},!1)),n.webqit.realdom.readyStateCallbacks[t].push(e)}function Yi(i){let t=this,e={},r;return(r=t.document.querySelector(`meta[name="${i}"]`))&&(e=(r.content||"").split(";").filter(n=>n).reduce((n,o)=>{let s=o.split("=").map(a=>a.trim());return tr(n,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:Z(s[1])?parseInt(s[1]):s[1]),n},{})),{get name(){return i},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}function _e(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 E=(i,...t)=>W(i,"oohtml",...t),D={};function X(i,t,e){let r=this,n=Qr.call(r);D.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let s=r.webqit.oohtml.configs[o];Xt(2,s,e,t,n.meta(i).json()),r.webqitConfig.prefix&&Object.keys(s).forEach(a=>{Object.keys(s[a]).forEach(c=>{a==="api"&&typeof s[a][c]=="string"?s[a][c]=`${r.webqitConfig.prefix}${_e(s[a][c])}`:["attr","elements"].includes(a)&&s[a][c]?.startsWith("data-")===!1&&(s[a][c]=`${r.webqitConfig.prefix}-${s[a][c]}`)})})}return{config:r.webqit.oohtml.configs[o],realdom:n,window:r}}function or(i,t){return W(i,"realdom","internalAttrInteractions").get(t)}function Zr(i,t,e){let r=W(i,"realdom","internalAttrInteractions").get(t);W(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return W(i,"realdom","internalAttrInteractions").set(t,r),n}function ft(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 tn=()=>(0|Math.random()*9e6).toString(36),nr=new Map;function Pt(i){let t;return(t=nr.get(i))||(t=tn(),nr.set(i,t)),t}function ve(i){let t;return nr.forEach((e,r)=>{e===i&&(t=r)}),t}function Se(){let{window:i}=D,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=n.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let a=["contextrequest","contextclaim"],c=n.pop()||a[0];if(!a.includes(c))throw new Error(`Invalid event type. Must be one of: ${a.join(",")}`);let{kind:l,detail:u,targetContext:p,live:f,signal:d,diff:m,...w}=s;super(c,{...w,bubbles:w.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>l}),Object.defineProperty(this,"targetContext",{get:()=>p}),Object.defineProperty(this,"detail",{get:()=>u}),Object.defineProperty(this,"live",{get:()=>f}),Object.defineProperty(this,"signal",{get:()=>d}),Object.defineProperty(this,"diff",{get:()=>m}),Object.defineProperty(this,"options",{get:()=>w}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(n){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===n)return;Object.defineProperty(this,"_prevValue",{value:n,configurable:!0})}return this.callback(n)}}return t.DOMContextRequestEvent=e,e}var Tt=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=D;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var Ct=class extends Error{};var mt=class{static instance(t){return E(t).get("contexts::instance")||new this(t)}constructor(t){E(t).get("contexts::instance")?.dispose(),E(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 J))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new Ct(`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 Tt((e,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(e):t[t.length-1]=e);let n;(n=t.find(s=>typeof s=="object"&&s))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(Se())(...t);this["#"].host.dispatchEvent(o)})}};var sr=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}}}}=D;return t}get name(){return[D.window.Document,D.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 sr)||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}=mt.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}},J=sr;V(J,"kind");var Ht=class extends J{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}}}=D;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()}};V(Ht,"kind","namespace");function ar(i={}){let{config:t,window:e}=X.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=Ht,en.call(e,t),rn.call(e,t)}function Kr(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 lr(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,s=Kr(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[c,l]=ft(i,",").reduce(([p,f],d)=>{let m,w;return d=d.replace(a,(v,g,y,x,S)=>{if(m||(m=[...d.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),m.some(O=>S>O.index&&S+v.length<O.index+O[0].length))return v;if(v===":scope")return w=!0,e;let h=g&&!y;if(g&&y)return`#${s.escape(v.replace("#",""),1)}`;if(h&&o.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${s.toUuid(t,x,1)}`;let _;return o.attr.lid==="id"?_=`:is(#${x},[id^="${s.lidrefPrefix(r)}"][id$="${s.lidrefSeparator(r)}${x}"])`:_=`:is(#${x},[${n.CSS.escape(o.attr.lid)}="${x}"])`,h?`:is(${_}):not(${e?e+" ":""}${o.namespaceSelector} *)`:_}),w?[p,f.concat(d)]:[p.concat(d),f]},[[],[]]),u;return e&&c.length?u=[c.length>1?`${e} :is(${c.join(", ")})`:`${e} ${c[0]}`,l.join(", ")].filter(p=>p).join(", "):u=[...c,...l].join(", "),u}function Oe(i){let t=this;if(!E(i).has("namespace")){let e=Object.create(null);E(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 E(i).get("namespace")}function Ft(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return Oe.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function $e(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(ve(i)||Pt(i))+(t?"-root":"")}function en(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(Oe.call(t,this))}})})}function rn(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},DOMNamingContext:o}}=t,s=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],a=["for","list","form","aria-activedescendant","aria-details","aria-errormessage","popovertarget"],c=[i.attr.lid,...s,...a],l={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",popovertarget:"popoverTargetElement"},u=Kr(i),p=(h,b,_)=>{if(!or(h,b)&&E(h,"attrOriginals").has(b))return E(h,"attrOriginals").get(b);let O=_();return or(h,b)?O:O&&O.split(" ").map($=>($=$.trim())&&(b===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,$)).join(" ")},f=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...f,value(h){return this.querySelector(`#${h}`)}});for(let h of["querySelector","querySelectorAll"])for(let b of[t.Document,t.Element]){let _=Object.getOwnPropertyDescriptor(b.prototype,h);Object.defineProperty(b.prototype,h,{..._,value(O){return _.value.call(this,lr.call(t,O,$e(Oe.call(t,this))))}})}let d=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...d,value(h){let b=()=>d.value.call(this,h);return c.includes(h)&&!E(this,"lock").get(h)?p(this,h,b):b()}});let m=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...m,get(){let h=()=>m.get.call(this);return c.includes(this.name)?p(this.ownerElement,this.name,h):h()}});let w=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...w,get(){let h=()=>w.get.call(this);return this instanceof t.Attr&&c.includes(this.name)?p(this.ownerElement,this.name,h):h()}});for(let h of c){if(!(h in l))continue;let b=h==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:h==="popovertarget"?[t.HTMLButtonElement,t.HTMLInputElement]:[t.Element];for(let _ of b){let O=Object.getOwnPropertyDescriptor(_.prototype,l[h]);!O||Object.defineProperty(_.prototype,l[h],{...O,get(){return p(this,h,()=>O.get.call(this,h))}})}}i.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,i.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(i.attr.lid)},set(h){return this.setAttribute(i.attr.lid,h)}});let v=(h,b,_,O)=>Zr(h,b,()=>(typeof _=="function"&&(_=_()),O(_))),g=(h,b,_,O=null)=>{v(h,b,_,$=>{let T=b===i.attr.lid,R=O||Ft.call(t,h,T),N=$e(R);if(T){let I=u.uuidToId($);if(e.get(R,I)!==h){let P=u.toUuid(N,I);P!==$&&h.setAttribute("id",P),e.set(R,I,h)}}else{E(h,"attrOriginals").set(b,$);let I=$.split(" ").map(P=>(P=P.trim())&&u.isUuid(P)?P:u.toUuid(N,P)).join(" ");h.setAttribute(b,I),E(R).set("idrefs",E(R).get("idrefs")||new Set),E(R).get("idrefs").add(h)}})},y=(h,b,_,O=null)=>{v(h,b,_,$=>{let T=b===i.attr.lid,R=O||Ft.call(t,h,T);if(T){let N=u.uuidToId($);e.get(R,N)===h&&e.deleteProperty(R,N)}else{let N=E(h,"attrOriginals").get(b);h.hasAttribute(b)&&h.setAttribute(b,N),E(R).get("idrefs")?.delete(h)}})};r.realtime(t.document).query(i.namespaceSelector,h=>{let b=(_,O,$,T)=>{if(!_.hasAttribute(O))return;let R=()=>_.getAttribute(O);y(_,O,R,$),_.isConnected&&g(_,O,E(_,"attrOriginals").get(O)||R,T)};h.exits.forEach(_=>{if(_.isConnected){let T=Oe.call(t,_);for(let R of new Set([...Object.values(T),...E(T).get("idrefs")||[]]))for(let N of c)b(R,N,T)}let O=_[n.CONTEXT_API.api.contexts],$=O.find(o.kind);$&&O.detach($)}),h.entrants.forEach(_=>{let O,$=Ft.call(t,_,!0);for(let R of new Set([...Object.values($),...E($).get("idrefs")||[]]))if((O=Ft.call(t,R,!0))!==$)for(let N of c)b(R,N,$,O);let T=_[n.CONTEXT_API.api.contexts];T.find(o.kind)||T.attach(new o)})},{id:"namespace-html:namespace",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${c.map(h=>t.CSS.escape(h)).join("],[")}]`,h=>{let b={forID:new Map,forOther:new Map};for(let _ of c){let O=_===i.attr.lid?b.forID:b.forOther;h.exits.forEach($=>{if(!$.hasAttribute(_))return;let T=O.get($);typeof T>"u"&&(T=(_===i.attr.lid?$.parentNode:$)?.closest?.(i.namespaceSelector)||$.getRootNode().host,O.set($,T)),!(T&&!T.isConnected)&&y($,_,()=>$.getAttribute(_))}),h.entrants.forEach($=>{!$.hasAttribute(_)||g($,_,()=>$.getAttribute(_))})}b.forID.clear(),b.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(c,h=>{for(let b of h)b.oldValue&&b.value!==b.oldValue&&y(b.target,b.name,b.oldValue),b.value&&b.value!==b.oldValue&&g(b.target,b.name,b.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let x,S=()=>{if(!t.location.hash?.startsWith(`#${u.lidrefPrefix()}`))return;let h=t.location.hash?.substring(`#${u.lidrefPrefix()}`.length).split("/").map(_=>_.trim()).filter(_=>_)||[],b=h.reduce((_,O)=>_&&_[i.api.namespace][O],t.document);x&&i.target.className&&x.classList.toggle(i.target.className,!1),b&&b!==t.document&&(i.target.className&&b.classList.toggle(i.target.className,!0),i.target.eventName&&b.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&h.length>1&&b.scrollIntoView(),x=b)};t.addEventListener("hashchange",S),r.ready(S)}function cr({advanced:i={},...t}){let{config:e,window:r}=X.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:Rt(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:on.bind(r,e)},nn.call(r,e),sn.call(r,e)}function nn(i){let t=this,{webqit:{nextKeyword:e,matchPrologDirective:r}}=t,n=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(o=>{Object.defineProperty(o,i.api.scripts,{get:function(){return n.has(this)||n.set(this,[]),n.get(this)}})}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(o){this.toggleAttribute("scoped",o)}},live:{configurable:!0,get(){if(this.liveProgramHandle)return!0;let o=e(this.oohtml__textContent||this.textContent||"",0,0);return r(o,!0)}}})}async function on(i,t){let e=this,{realdom:r}=e.webqit,n=ve(t);if(!n)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:s,thisContext:a}=n;i.script.retention==="dispose"?o.remove():i.script.retention==="hidden"?o.textContent='"source hidden"':setTimeout(async()=>{o.textContent=await s.toString()},0);let c=o.scoped?a:o.getRootNode();E(c).has("scriptEnv")||E(c).set("scriptEnv",Object.create(null));let l=await(await s.bind(a,E(c).get("scriptEnv"))).execute();o.live&&Object.defineProperty(o,"liveProgramHandle",{value:l}),r.realtime(e.document).observe(o,()=>{o.live&&l.abort(),a instanceof e.Element&&a[i.api.scripts]?.splice(a[i.api.scripts].indexOf(o,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function sn(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=s=>["text/javascript","application/javascript"].includes(s));let o=new WeakSet;n.realtime(e.document).query(i.scriptSelector,s=>{s.entrants.forEach(a=>{if(o.has(a)||a.hasAttribute("oohtmlno")||!t&&!a.hasAttribute("ssr"))return;let c=ti.call(e,i,a);if(!c)return;o.add(a);let l=a.scoped?a.parentNode||s.target:a.type==="module"?void 0:e;a.scoped&&l[i.api.scripts].push(a);let u=Pt({script:a,compiledScript:c,thisContext:l});s.type==="query"||a.type&&!e.HTMLScriptElement.supports(a.type)||a.getAttribute("data-handling")==="manual"||i.script.timing==="manual"?r.Script.execute(u):a.textContent=`webqit.oohtml.Script.execute( '${u}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function ti(i,t){let e=this,{webqit:{oohtml:r,LiveScript:n,AsyncLiveScript:o,LiveModule:s}}=e,a=t.textContent.trim();if(a.startsWith("/*@oohtml*/if(false){")&&a.endsWith("}/*@oohtml*/")&&(a=a.slice(21,-12),Object.defineProperty(t,"oohtml__textContent",{value:a})),!a.trim().length)return;let c=Pt(a),l=r.Script.compileCache[t.live?0:1],u;if(!(u=l.get(c))){let{parserParams:p,compilerParams:f,runtimeParams:d}=i.advanced;u=new(t.type==="module"?s:n||o)(a,{liveMode:t.live,exportNamespace:`#${t.id}`,fileName:`${e.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:p,compilerParams:f,runtimeParams:d}),l.set(c,u)}return u}function ei(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{ti.call(t,e,r)})}function pr(i={}){let{config:t,window:e}=X.call(this,"data-binding",i,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:Rt({runtimeParams:{spec:{handler:n=>{}}}})});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=e.webqit.oohtml.configs),t.attrSelector=`[${e.CSS.escape(t.attr.render)}]`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,an.call(e,t)}function an(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{ri.call(this,...r.exits),cn.call(t,i,...r.entrants),queueMicrotask(()=>{})},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),e.realtime(t.document).query(`(${i.discreteBindingsSelector})`,r=>{ri.call(this,...r.exits),ln.call(t,i,...r.entrants),queueMicrotask(()=>{})},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function ii(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(E(t).has("data-binding"))return E(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(c,l,...u)=>{(()=>{try{c[l](...u)}catch(f){throw new Error(`Error executing "${l}()": ${f.message} at ${f.cause}`)}})()},o.$assign__=(c,l,u)=>{(()=>{try{c[l]=u}catch(f){throw new Error(`Error executing "${l} = ${u}": ${f.message} at ${f.cause}`)}})()},r.intercept(o,{get:(c,l,u)=>{if(!(c.key in o)){let p={...n.createRequest(c.key),live:!0,signal:s.signal};t[i.CONTEXT_API.api.contexts].request(p,f=>{r.set(o,c.key,f)})}return u(o[c.key]??(c.key in globalThis?globalThis[c.key]:void 0))},has:(c,l,u)=>u(!0)});let a={scope:o,abortController:s,bindings:new Map};return E(t).set("data-binding",a),a}function ri(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=E(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).liveProgramHandle.abort(),r.get(t).signals?.forEach(o=>o.abort()),r.delete(t),r.size||(n.abort(),E(e).delete("data-binding"))}}function ni(i,t){let e=i.tokens.tagStart.split("").map(l=>`\\${l}`).join(""),r=i.tokens.tagEnd.split("").map(l=>`\\${l}`).join(""),n=i.tokens.stateStart.split("").map(l=>l===" "?"(?:\\s+)?":`\\${l}`).join(""),o=i.tokens.stateEnd.split("").map(l=>`\\${l}`).join(""),s=`^${e}(.*?)(?:${n}(\\d+)${o}(?:\\s+)?)?${r}$`,[,a,c]=t.match(new RegExp(s));return{raw:t,expr:a,span:parseInt(c??0)}}async function ln(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let s=ni(i,o.nodeValue),a=o;if(s.span){if(a=o.nextSibling,a?.nodeName!=="#text"||a.nodeValue.length<s.span)return n;a.nodeValue.length>s.span&&a.splitText(s.span)}else a=o.ownerDocument.createTextNode(""),o.after(a);a.isBound=!0;let c=o;return e.webqit.env!=="server"&&(c.remove(),c=null),n.concat({textNode:a,template:s,anchorNode:c})},[]);for(let{textNode:n,template:o,anchorNode:s}of r){let a=oi.call(e,i,o.expr),{scope:c,bindings:l}=ii.call(this,i,n.parentNode);Object.defineProperty(n,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{l.set(n,{liveProgramHandle:await(await a.bind(n,c)).execute()})}catch(u){console.log(u)}}}var ur=new Map;function oi(i,t){if(ur.has(t))return ur.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}${Wt(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{LiveScript:r,AsyncLiveScript:n}}=this,{parserParams:o,compilerParams:s,runtimeParams:a}=i.advanced,c=new(r||n)(e,{parserParams:o,compilerParams:s,runtimeParams:a});return ur.set(t,c),c}async function cn(i,...t){for(let e of t){let r=si.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=ii.call(this,i,e),s=[];Object.defineProperty(e,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(e,{signals:s,liveProgramHandle:await(await r.bind(e,n)).execute()})}catch(a){console.log(a)}}}var fr=new Map;function si(i,t){if(fr.has(t))return fr.get(t);let e={},r=-1,n=ft(t,";").map(p=>{let[f,d]=ft(p,":").map(y=>y.trim()),m=f[0],w=f.slice(1).trim(),v=`(${d})`,g=`(${v} ?? '')`;if(m==="&")return w.startsWith("--")?`$exec__(this.style, 'setProperty', "${Wt(w)}", ${g});`:`$assign__(this.style, "${Wt(w)}", ${g});`;if(m==="%")return`$exec__(this.classList, 'toggle', "${Wt(w)}", !!${v});`;if(m==="~")return w.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Wt(w.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${Wt(w)}", ${g});`;if(m==="#"){if(e[w])throw new Error(`Duplicate binding: ${f}.`);if(e[w]=!0,w==="text")return`$assign__(this, 'textContent', ${g});`;if(w==="html")return`$assign__(this, 'innerHTML', ${g});`;if(w==="items"){let[y,x]=ft(d,"/");if(!x)throw new Error(`Invalid ${m}items spec: ${p}; no import specifier.`);let[S,h,b,_]=y.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!S)throw new Error(`Invalid ${m}items spec: ${p}.`);if(h.startsWith("(")?h=h.trim().slice(1,-1).split(",").map(T=>T.trim()):h=[h],h.length>(b==="in"?3:2))throw new Error(`Invalid ${m}items spec: ${p}.`);let O=b==="in"?h[2]:h[1]||"$index__";return`
|
|
30
|
+
let $iteratee__ = ${_};
|
|
31
|
+
let $import__ = this.${i.HTML_IMPORTS.api.import}( ${x.trim()}, true );
|
|
24
32
|
this.$oohtml_internal_databinding_signals?.push( $import__ );
|
|
25
33
|
if ( $import__.value && $iteratee__ ) {
|
|
26
34
|
let $existing__ = new Map;
|
|
27
|
-
[ ...this.children ].filter( el => el.matches( '[${
|
|
28
|
-
$existing__.set( x.getAttribute( '${
|
|
35
|
+
[ ...this.children ].filter( el => el.matches( '[${i.attr.itemIndex}]' ) ).forEach( x => {
|
|
36
|
+
$existing__.set( x.getAttribute( '${i.attr.itemIndex}' ), x );
|
|
29
37
|
} );
|
|
30
|
-
${
|
|
31
|
-
for ( let ${
|
|
32
|
-
${
|
|
33
|
-
${
|
|
34
|
-
let $itemBinding__ = { ${
|
|
38
|
+
${O?`let ${O} = -1;`:""}
|
|
39
|
+
for ( let ${h[0]} ${b} $iteratee__ ) {
|
|
40
|
+
${O?`${O} ++;`:""}
|
|
41
|
+
${b==="in"&&h[1]?`let /*value*/${h[1]} = $iteratee__[ ${h[0]} ];`:""}
|
|
42
|
+
let $itemBinding__ = { ${h.join(", ")} };
|
|
35
43
|
|
|
36
|
-
const $key___ = ( ${
|
|
44
|
+
const $key___ = ( ${b==="in"?h[0]:O} ) + '';
|
|
37
45
|
let $itemNode__ = $existing__.get( $key___ );
|
|
38
46
|
if ( $itemNode__ ) {
|
|
39
47
|
$existing__.delete( $key___ );
|
|
40
|
-
$exec__($itemNode__, '${
|
|
48
|
+
$exec__($itemNode__, '${i.BINDINGS_API.api.bind}', $itemBinding__ );
|
|
41
49
|
} else {
|
|
42
50
|
$itemNode__ = ( Array.isArray( $import__.value ) ? $import__.value[ 0 ] : ( $import__.value instanceof window.HTMLTemplateElement ? $import__.value.content.firstElementChild : $import__.value ) ).cloneNode( true );
|
|
43
|
-
$itemNode__.setAttribute( "${
|
|
44
|
-
$exec__($itemNode__, '${
|
|
51
|
+
$itemNode__.setAttribute( "${i.attr.itemIndex}", $key___ );
|
|
52
|
+
$exec__($itemNode__, '${i.BINDINGS_API.api.bind}', $itemBinding__ );
|
|
45
53
|
$exec__(this, 'appendChild', $itemNode__ );
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
if ( ${
|
|
56
|
+
if ( ${b==="in"?`!( ${h[0]} in $iteratee__ )`:`typeof ${h[0]} === 'undefined'`} ) { $itemNode__.remove(); }
|
|
49
57
|
}
|
|
50
58
|
$existing__.forEach( x => x.remove() );
|
|
51
59
|
$existing__.clear();
|
|
52
|
-
}`}}if(
|
|
53
|
-
const handler${r} = event => ${
|
|
54
|
-
this.addEventListener( '${
|
|
55
|
-
const abort${r} = () => this.removeEventListener( '${
|
|
60
|
+
}`}}if(m==="@")return r++,`
|
|
61
|
+
const handler${r} = event => ${d.startsWith("{")?d:v};
|
|
62
|
+
this.addEventListener( '${w}', handler${r} );
|
|
63
|
+
const abort${r} = () => this.removeEventListener( '${w}', handler${r} );
|
|
56
64
|
this.$oohtml_internal_databinding_signals?.push( { abort: abort${r} } );
|
|
57
|
-
`;if(
|
|
58
|
-
`),{webqit:{LiveScript:n}}=this,{parserParams:a,compilerParams:o,runtimeParams:l}=e.advanced,u=new n(s,{parserParams:a,compilerParams:o,runtimeParams:l});return Pr.set(t,u),u}var Ce=e=>e.replace(/"/g,'\\"');function gn(e){let t=this,{webqit:{oohtml:{configs:{DATA_BINDING:i}}}}=t;(e?.matches(i.attrSelector)?[e]:[]).concat([...e?.querySelectorAll(i.attrSelector)||[]]).forEach(r=>{mn.call(t,i,r.getAttribute(i.attr.render))}),Se(t,e,`(${i.discreteBindingsSelector})`).forEach(r=>{let s=pn(i,r.nodeValue);dn.call(t,i,s.expr)})}var xt=class extends ut{static createRequest(t=null){let i=super.createRequest();if(t?.startsWith("@")){let[r,...s]=s.slice(1).split(".").map(n=>n.trim());i.targetContext=r,i.detail=s.join(".")}else i.detail=t;return i}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:i}}}=z;t.meta.controller=i.reduce(this.bindingsObj,Array.isArray(t.detail)?t.detail:[t.detail],i.get,r=>{this.disposed||t.respondWith(r.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};J(xt,"kind","bindings");function Or(e={}){let{config:t,window:i}=ot.call(this,"bindings-api",e,{attr:{bindingsreflection:"bindings"},api:{bind:"bind",bindings:"bindings"}});i.webqit.DOMBindingsContext=xt,Za.call(i,t),eo.call(i,t)}function $r(e,t){let i=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:s}}}}=i;if(!k(t).has("bindings")){let n=Object.create(null);k(t).set("bindings",n),r.observe(n,a=>{if(t instanceof i.Element){let o=ki(t.getAttribute(e.attr.bindingsreflection)||""),l=new Map(o);for(let u of a)u.detail?.publish!==!1&&(u.type==="delete"?o.delete(u.key):o.set(u.key,void 0));o.size&&o.size!==l.size?t.setAttribute(e.attr.bindingsreflection,`{ ${[...o.entries()].map(([u,c])=>c===void 0?u:`${u}: ${c}`).join(", ")} }`):o.size||t.toggleAttribute(e.attr.bindingsreflection,!1)}else{let o=t[s.api.contexts];for(let l of a)if(l.type==="delete"){let u=o.find(xt.kind,l.key);u&&o.detach(u)}else o.find(xt.kind,l.key)||o.attach(new xt(l.key))}})}return k(t).get("bindings")}function Za(e){let t=this,{webqit:{Observer:i}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let s=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(e.api.bind in r)throw new Error(`The ${s} prototype already has a "${e.api.bind}" API!`);if(e.api.bindings in r)throw new Error(`The ${s} prototype already has a "${e.api.bindings}" API!`);Object.defineProperty(r,e.api.bind,{value:function(n,a={}){return to.call(t,e,this,n,a)}}),Object.defineProperty(r,e.api.bindings,{get:function(){return i.proxy($r.call(t,e,this))}})})}function to(e,t,i,{merge:r,diff:s,publish:n,namespace:a}={}){let o=this,{webqit:{Observer:l}}=o,u=$r.call(this,e,t),c={diff:s,namespace:a,detail:{publish:n}},f=r?[]:Object.keys(u).filter(p=>!(p in i));return l.batch(u,()=>(f.length&&l.deleteProperties(u,f,c),l.set(u,i,c)),c)}function eo(e){let t=this,{webqit:{realdom:i,Observer:r,oohtml:{configs:s}}}=t,n=(o,l)=>{let u=o[s.CONTEXT_API.api.contexts];u.find(xt.kind,l)||u.attach(new xt(l))},a=(o,l)=>{let u,c=o[s.CONTEXT_API.api.contexts];for(;u=c.find(xt.kind,l);)c.detach(u)};i.realtime(t.document).query(`[${t.CSS.escape(e.attr.bindingsreflection)}]`,o=>{o.exits.forEach(l=>a(l)),o.entrants.forEach(l=>{let u=ki(l.getAttribute(e.attr.bindingsreflection)||""),c=[...u.entries()].filter(([f,p])=>p!==void 0);c.length&&l[e.api.bind](Object.fromEntries(c),{merge:!0,publish:!1});for(let[f]of u)n(l,f)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),i.realtime(t.document,"attr").observe(e.attr.bindingsreflection,o=>{let l=$r.call(t,e,o.target),u=ki(o.value||""),c=ki(o.oldValue||"");for(let f of new Set([...u.keys(),...c.keys()]))c.has(f)?u.has(f)?u.get(f)!==c.get(f)&&r.set(l,f,u.get(f),{detail:{publish:!1}}):(c.get(f)!==void 0&&r.deleteProperty(l,f,{detail:{publish:!1}}),a(o.target,f)):(u.get(f)!==void 0&&r.set(l,f,u.get(f),{detail:{publish:!1}}),n(o.target,f))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var ki=e=>(e=e.trim(),new Map(Mt(e.slice(1,-1),",").filter(t=>t.trim()).map(t=>Mt(t,":").map(i=>i.trim()))));var At=class{static instance(t){return k(t).get("defsmanager::instance")||new this(t)}constructor(t,i=null,r=0){let{window:s}=z,{webqit:{realdom:n,oohtml:{configs:a}}}=s;k(t).get("defsmanager::instance")?.dispose(),k(t).set("defsmanager::instance",this),this.window=s,this.host=t,this.config=a.HTML_IMPORTS,this.parent=i,this.level=r,this.defs=Dt(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=n.realtime(this.host.content).children(o=>{this.expose(o.exits,!1),this.expose(o.entrants,!0)},{live:!0,timing:"sync"}),this.realtimeB=n.realtime(this.host).attr(["src","loading"],(...o)=>this.evaluateLoading(...o),{live:!0,atomic:!0,timing:"sync",lifecycleSignals:!0}),this.realtimeC=this.evalInheritance()}validateDefId(t){if(["@","/","*","#"].some(i=>t.includes(i)))throw new Error(`The export ID "${t}" contains an invalid character.`)}expose(t,i){let{window:r}=z,{webqit:{Observer:s}}=r,n,a=this.defs["#"]||[];t.forEach(o=>{if(!o||o.nodeType!==1)return;let l=o.matches(this.config.templateSelector),u=(o.getAttribute(l?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();i?(l&&u?new At(o,this.host,this.level+1):(a.push(o),n=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(c=>c.call(this.window,o))})),u&&(this.validateDefId(u),s.set(this.defs,(!l&&"#"||"")+u,o))):(l&&u?At.instance(o).dispose():(a=a.filter(c=>c!==o),n=!0),u&&s.deleteProperty(this.defs,(!l&&"#"||"")+u))}),n&&s.set(this.defs,"#",a)}evaluateLoading([t,i],{signal:r}){let{window:{webqit:{Observer:s}}}=z,n=(t.value||"").trim();if(!n)return;let a,o=c=>{if(!c)return a;a=c.then(()=>u.remove())},l=(i.value||"").trim(),u=s.intercept(this.defs,"get",async(c,f,p)=>(l==="lazy"&&o(this.load(n,!0)),await o(),p()),{signal:r});l!=="lazy"&&o(this.load(n))}#t=new Set;#e;load(t){let{window:i}=z;if(this.#t.has(t)||(this.#t.add(t),this.#t.size===1&&this.host.content.children.length))return Promise.resolve();this.#e?.controller.abort();let r=new AbortController,s=(a,o)=>this.host.dispatchEvent(new i.CustomEvent(a,{detail:o})),n=i.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(),s("load"),this.host)).catch(a=>(console.error(`Error fetching the bundle at "${t}": ${a.message}`),this.#e=null,s("loaderror"),this.host));return this.#e={request:n,controller:r},n}evalInheritance(){if(!this.parent)return[];let{window:{webqit:{Observer:t}}}=z,i=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(o=>o.trim()).filter(o=>o),s=o=>{o.forEach(l=>{t.get(this.defs,l.key)===l.oldValue&&(["get","set","def"].includes(l.type)?t[l.type.replace("get","set")](this.defs,l.key,l.value):l.type==="delete"&&t.deleteProperty(this.defs,l.key))})},n=[],a=Dt(this.parent);return i&&n.push(t.reduce(a,[i,this.config.api.defs,1/0],t.get,s,{live:!0})),r.length&&n.push(t.get(a,r.includes("*")?1/0:r,s,{live:!0})),n}dispose(){this.realtimeA.disconnect(),this.realtimeB.disconnect(),this.realtimeC.forEach(t=>t instanceof Promise?t.then(i=>i.abort()):t.abort()),Object.entries(this.defs).forEach(([t,i])=>{t.startsWith("#")||At.instance(i).dispose()})}};var Ht,ct,ke,Ae,Vt=class extends ut{constructor(){super(...arguments);Pe(this,Ht,{});Pe(this,ct,void 0);Pe(this,ke,void 0);Pe(this,Ae,void 0)}static createRequest(i=null){let r=super.createRequest();if(i?.startsWith("/"))r.detail=i,r.targetContext=1/0;else if(i?.startsWith("@")){let[s,...n]=i.slice(1).split(/(?<=\w)(?=\/|#)/).map(a=>a.trim());r.targetContext=s,r.detail=n.join("")}else r.detail=i;return r}get localModules(){return Dt(this.host)}get inheritedModules(){return et(this,Ht)}handle(i){let{window:{webqit:{Observer:r}}}=z;i.meta.controller?.abort();let s=(i.detail||"").split(/\/|(?<=\w)(?=#)/g).map(a=>a.trim()).filter(a=>a);if(!s.length)return i.respondWith();s=s.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(a=>a==="*"?1/0:a)||[];let n={live:i.live,sig_nal:i.signal,descripted:!0};i.meta.controller=r.reduce(et(this,ct),s,r.get,a=>{if(Array.isArray(a)){if(!a.length){i.respondWith();return}for(let o of a)i.respondWith(o)}else i.respondWith(a.value)},n)}unsubscribed(i){i.meta.controller?.abort()}initialize(i){this.host=i;let{window:{webqit:{Observer:r}}}=z,s=()=>{for(let a of new Set([...Object.keys(this.localModules),...Object.keys(this.inheritedModules),...Object.keys(et(this,ct))]))if(!r.has(this.localModules,a)&&!r.has(this.inheritedModules,a))r.deleteProperty(et(this,ct),a);else if(a==="#"&&r.has(this.localModules,a)&&r.has(this.inheritedModules,a))r.set(et(this,ct),a,[...r.get(this.localModules,a),...r.get(this.inheritedModules,a)]);else{let o=r.get(this.localModules,a)||r.get(this.inheritedModules,a);r.get(et(this,ct),a)!==o&&r.set(et(this,ct),a,o)}};oe(this,ct,{...this.localModules}),et(this,ke)?.abort(),oe(this,ke,r.observe(this.localModules,()=>s("local"),{timing:"sync"}));let n=this.configs.HTML_IMPORTS;if(this.host.matches&&n.attr.importscontext){let a=this.host.ownerDocument.defaultView.webqit.realdom,o;et(this,Ae)?.disconnect(),oe(this,Ae,a.realtime(this.host).attr(n.attr.importscontext,(l,{signal:u})=>{let c=(l.value||"").trim();o=c,oe(this,Ht,{});let f={...this.constructor.createRequest(c?`${c}/*`:"*"),live:!0,signal:u,diff:!0};this.host.parentNode[this.configs.CONTEXT_API.api.contexts].request(f,p=>{p?p.type==="delete"?(delete et(this,Ht)[p.key],Reflect.has(this.localModules,p.key)||r.deleteProperty(et(this,ct),p.key)):(et(this,Ht)[p.key]=p.value,!Reflect.has(this.localModules,p.key)&&Reflect.get(et(this,ct),p.key)!==p.value&&r.set(et(this,ct),p.key,p.value)):(oe(this,Ht,{}),s("inherited"))}),s("inherited")},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(i)}dispose(i){return et(this,ke)?.abort(),et(this,Ae)?.disconnect(),super.dispose(i)}};Ht=new WeakMap,ct=new WeakMap,ke=new WeakMap,Ae=new WeakMap,J(Vt,"kind","html-imports");function yn(){let{window:e}=z,{webqit:t}=e,{realdom:i,oohtml:{configs:r}}=t;if(t.HTMLImportElement)return t.HTMLImportElement;let s=r.HTML_IMPORTS.elements.import.includes("-")?e.HTMLElement:class{};class n extends s{static instance(o){return r.HTML_IMPORTS.elements.import.includes("-")&&o instanceof this?o:k(o).get("import::instance")||new this(o)}constructor(...o){super();let l=o[0]||this;k(l).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>l,configurable:!1});let u={};Object.defineProperty(this,"#",{get:()=>u,configurable:!1}),u.slottedElements=new Set,u.setAnchorNode=c=>(u.anchorNode=c,c),u.live=c=>{if(u.liveImportsRealtime)throw new Error("Import element already in live mode.");let f=this.el.isConnected?this.el.parentNode:u.anchorNode.parentNode;u.liveImportsRealtime=i.realtime(this.el).attr(r.HTML_IMPORTS.attr.ref,(p,{signal:g})=>{u.moduleRef=p.value;let m=u.moduleRef.includes("#")?u.moduleRef:`${u.moduleRef}#`,_={...Vt.createRequest(m),live:g&&!0,signal:g,diff:!m.endsWith("#")};f[r.CONTEXT_API.api.contexts].request(_,v=>{c((v instanceof e.HTMLTemplateElement?[...v.content.children]:Array.isArray(v)?v:v&&[v])||[])})},{live:!0,timing:"sync",lifecycleSignals:!0}),u.autoDestroyRealtime=i.realtime(e.document).track(f,()=>{u.die()},{subtree:"cross-roots",timing:"sync",generation:"exits"})},u.die=()=>{u.autoDestroyRealtime?.disconnect(),u.liveImportsRealtime?.disconnect(),u.liveImportsRealtime=null},u.hydrate=(c,f)=>{c.replaceWith(u.setAnchorNode(this.createAnchorNode())),u.live(p=>{if(u.originalsRemapped)return this.fill(p);let g=p.map((m,_)=>({el:m,fragmentDef:m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:m.tagName,i:_}));f.forEach((m,_)=>{let v=m.tagName,y=m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",b=(_++,g.find(S=>S.tagName===v&&S.fragmentDef===y&&S.i===_));b&&k(m).set("original@imports",b.el),k(m).set("slot@imports",this.el),u.slottedElements.add(m)}),u.originalsRemapped=!0})},u.autoRestore=(c=null)=>{u.autoRestoreRealtime?.disconnect(),c&&c();let f=()=>{this.el.isConnected||(this.el.setAttribute("data-nodecount",0),u.internalMutation=!0,u.anchorNode.replaceWith(this.el),u.internalMutation=!1,u.setAnchorNode(null))};if(!u.slottedElements.size)return f();let p=i.realtime(u.anchorNode.parentNode).observe([...u.slottedElements],g=>{if(g.exits.forEach(m=>{k(m).delete("slot@imports"),u.slottedElements.delete(m)}),!u.slottedElements.size){if(p.disconnect(),!g.target.isConnected)return;f()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});u.autoRestoreRealtime=p},u.connectedCallback=()=>{u.internalMutation||u.live(c=>this.fill(c))},u.disconnectedCallback=()=>{u.internalMutation||u.die()}}createAnchorNode(){if(e.webqit.env!=="server")return e.document.createTextNode("");let o=e.document.createElement("div");o.textContent=this.el.outerHTML;let l=e.document.createComment(o.innerHTML);return k(l).set("isAnchorNode",!0),l}fill(o,l){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(o)&&(o=new Set(o)),this.el.setAttribute("data-nodecount",o.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(u=>{let c=k(u).get("original@imports");o.has(c)?o.delete(c):(this["#"].slottedElements.delete(u),u.remove())}),o.size&&this.el.isConnected){let u=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(u),this["#"].internalMutation=!1}o.forEach(u=>{let c=u.cloneNode(!0);c.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||c.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),k(c).set("original@imports",u),k(c).set("slot@imports",this.el),this["#"].slottedElements.add(c),this["#"].anchorNode.before(c)})}))}empty(){this["#"].slottedElements.forEach(o=>o.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,n),t.HTMLImportElement=n,n}function Tr(e={}){let{config:t,window:i}=ot.call(this,"html-imports",e,{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[${i.CSS.escape(t.attr.def)}]`,t.importsContextSelector=`[${i.CSS.escape(t.attr.importscontext)}]`,t.slottedElementsSelector=`[${i.CSS.escape(t.attr.fragmentdef)}]:not(template)`;let r=(s,n)=>{let a=`starts-with(., "${s}")`,o=`substring(., string-length(.) - string-length("${n}") + 1) = "${n}"`;return`${a} and ${o}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,i.webqit.HTMLImportsContext=Vt,i.webqit.HTMLImportElement=yn(),io.call(i,t),ro.call(i,t)}function Dt(e,t=!0){if(!k(e).has("defs")&&t){let i=Object.create(null);k(e).set("defs",i)}return k(e).get("defs")}function io(e){let t=this,{webqit:{oohtml:{configs:i}}}=t;if(e.api.def in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${e.api.def}" API!`);if(e.api.defs in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${e.api.defs}" API!`);Object.defineProperty(t.HTMLTemplateElement.prototype,e.api.def,{get:function(){return this.getAttribute(e.attr.def)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,e.api.defs,{get:function(){return Dt(this)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(s){this.toggleAttribute("scoped",s)}}),[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(s=>{let n=s===t.Document.prototype?"Document":s===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(e.api.import in s)throw new Error(`The ${n} prototype already has a "${e.api.import}" API!`);if(e.api.defs in s)throw new Error(`The ${n} prototype already has a "${e.api.defs}" API!`);Object.defineProperty(s,e.api.defs,{get:function(){return Dt(this)}}),Object.defineProperty(s,e.api.import,{value:function(a,o=!1,l=null){return r(this,...arguments)}})});function r(s,n,a=!1,o=null){let l={};typeof a=="function"?(o=a,a=!1):typeof a=="object"&&a?l={...a,...l}:l={live:a};let u={...Vt.createRequest(n),...l};return s[i.CONTEXT_API.api.contexts].request(u,o)}}function ro(e){let t=this,{webqit:{Observer:i,realdom:r,oohtml:{configs:s},HTMLImportElement:n,HTMLImportsContext:a}}=t,o=c=>{let f=c[s.CONTEXT_API.api.contexts];f.find(a.kind)||f.attach(new a)},l=c=>{let f=c[s.CONTEXT_API.api.contexts],p=f.find(a.kind);p&&(!c.isConnected||!c.matches?.(e.importsContextSelector)&&!Object.keys(p.localModules).length)&&f.detach(p)};r.realtime(t.document).query([e.templateSelector,e.importsContextSelector],c=>{c.entrants.forEach(f=>{if(f.matches(e.templateSelector)){let p=At.instance(f);p.ownerContext=f.scoped?f.parentNode:f.getRootNode();let g=Dt(p.ownerContext);p.defId&&i.set(g,p.defId,f),o(p.ownerContext)}else o(f)}),c.exits.forEach(f=>{if(f.matches(e.templateSelector)){let p=At.instance(f),g=Dt(p.ownerContext);p.defId&&p.ownerContext.isConnected&&i.deleteProperty(g,p.defId),l(p.ownerContext)}else l(f)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(e.elements.import,c=>{console.log("_________record"),c.entrants.forEach(f=>u(f,!0,c)),c.exits.forEach(f=>u(f,!1,c))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function u(c,f){let p=n.instance(c);f?p["#"].connectedCallback():p["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${e.anchorNodeSelector})`,c=>{c.entrants.forEach(f=>{if(k(f).get("isAnchorNode"))return;let p=t.document.createElement("div");p.innerHTML=f.nodeValue,p.innerHTML=p.firstChild.textContent;let g=p.firstChild,m=parseInt(g.getAttribute("data-nodecount")),_=new Set,v=f;for(;(v=v.previousElementSibling)&&v.matches(e.slottedElementsSelector)&&m--;)_.add(v);n.instance(g)["#"].hydrate(f,_)})},{id:"imports:hydration",live:!0,subtree:"cross-roots",timing:"sync"})}function Nr(e={}){let{config:t,window:i}=ot.call(this,"context-api",e,{elements:{roots:"root,webflo-embedded"},attr:{contextname:"contextname"},api:{contexts:"contexts"}}),r=new Map,s=i.EventTarget.prototype.dispatchEvent;Object.defineProperty(i.EventTarget.prototype,"dispatchEvent",{value:function(...n){let a=n[0],o=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(a.type)&&o){a.meta&&(a.meta.target=this);let l=c=>{if(c.stopImmediatePropagation(),c.meta&&(c.meta.target=c.target),!c.answered){if(r.get(o)||r.set(o,new Set),c.type==="contextrequest"&&c.live)r.get(o).add(c);else if(c.type==="contextclaim"){let f=new Set;return r.get(o).forEach(p=>{!c.target.contains(p.target)||!c.detail?.matchEvent?.(p)||(r.get(o).delete(p),f.add(p))}),r.get(o).size||r.delete(o),c.respondWith?.(f)}}};o.addEventListener(a.type,l);let u=s.call(this,...n);return o.removeEventListener(a.type,l),u}return s.call(this,...n)}}),i.webqit.DOMContexts=Bt,i.webqit.DOMContext=ut,i.webqit.DOMContextRequestEvent=_i(),i.webqit.DOMContextResponse=ne,i.webqit.DuplicateContextError=ae,so.call(i,t)}function so(e){let t=this;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(i=>{let r=i===t.Document.prototype?"Document":i===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(e.api.contexts in i)throw new Error(`The ${r} prototype already has a "${e.api.contexts}" API!`);Object.defineProperty(i,e.api.contexts,{get:function(){return Bt.instance(this)}})})}function Rr({advanced:e={},...t}){let{config:i,window:r}=ot.call(this,"scoped-css",t,{api:{styleSheets:"styleSheets"},style:{retention:"retain",mimeTypes:"text/css",strategy:null}});i.styleSelector=(Array.isArray(i.style.mimeTypes)?i.style.mimeTypes:i.style.mimeTypes.split("|")).concat("").reduce((s,n)=>{let a=n?`[type="${r.CSS.escape(n)}"]`:":not([type])";return s.concat(`style${a}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},no.call(r,i),ao.call(r,i)}function no(e){let t=this,i=new Map;[t.Element.prototype].forEach(r=>{let s="Element";if(e.api.styleSheets in r)throw new Error(`The ${s} prototype already has a "${e.api.styleSheets}" API!`);Object.defineProperty(r,e.api.styleSheets,{get:function(){return i.has(this)||i.set(this,[]),i.get(this)}})}),Object.defineProperty(t.HTMLStyleElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}})}function ao(e){let t=this,{webqit:{oohtml:i,realdom:r}}=t,s=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1;t.CSS.supports||(t.CSS.supports=()=>!1);let n=new WeakSet;r.realtime(t.document).query(e.styleSelector,a=>{a.entrants.forEach(o=>{if(n.has(o))return;n.add(o);let l=se(o.textContent),u=CSS.supports("selector(:has(a,b))"),c=o.scoped&&(u?`:has(> style[rand-${l}])`:`[rand-${l}]`),f=o.scoped&&t.CSSScopeRule&&!1,p=o.scoped&&o.parentNode||o.getRootNode();if(p instanceof t.Element){if(p[e.api.styleSheets].push(o),!s)return;(u?o:p).toggleAttribute(`rand-${l}`,!0)}if(!!s)if(o.scoped&&o.hasAttribute("shared")){let g;(g=i.Style.compileCache.get(l))||(g=oo.call(t,o,null,f,c),i.Style.compileCache.set(l,g)),Object.defineProperty(o,"sheet",{value:g,configurable:!0}),o.textContent=`
|
|
65
|
+
`;if(m==="$")return`$exec__(this, '${w}', ${v});`;if(p.trim())throw new Error(`Invalid binding: ${p}.`)}).join(`
|
|
66
|
+
`),{webqit:{LiveScript:o,AsyncLiveScript:s}}=this,{parserParams:a,compilerParams:c,runtimeParams:l}=i.advanced,u=new(o||s)(n,{parserParams:a,compilerParams:c,runtimeParams:l});return fr.set(t,u),u}var Wt=i=>i.replace(/"/g,'\\"');function ai(i){let t=this,{webqit:{oohtml:{configs:{DATA_BINDING:e}}}}=t;(i?.matches(e.attrSelector)?[i]:[]).concat([...i?.querySelectorAll(e.attrSelector)||[]]).forEach(r=>{si.call(t,e,r.getAttribute(e.attr.render))}),Lt(t,i,`(${e.discreteBindingsSelector})`).forEach(r=>{let n=ni(e,r.nodeValue);oi.call(t,e,n.expr)})}var et=class extends J{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}}}=D;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()}};V(et,"kind","bindings");function dr(i={}){let{config:t,window:e}=X.call(this,"bindings-api",i,{attr:{bindingsreflection:"bindings"},api:{bind:"bind",bindings:"bindings"}});e.webqit.DOMBindingsContext=et,un.call(e,t),pn.call(e,t)}function hr(i,t){let e=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:n}}}}=e;if(!E(t).has("bindings")){let o=Object.create(null);E(t).set("bindings",o),r.observe(o,s=>{if(t instanceof e.Element){let a=Ee(t.getAttribute(i.attr.bindingsreflection)||""),c=new Map(a);for(let l of s)l.detail?.publish!==!1&&(l.type==="delete"?a.delete(l.key):a.set(l.key,void 0));a.size&&a.size!==c.size?t.setAttribute(i.attr.bindingsreflection,`{ ${[...a.entries()].map(([l,u])=>u===void 0?l:`${l}: ${u}`).join(", ")} }`):a.size||t.toggleAttribute(i.attr.bindingsreflection,!1)}else{let a=t[n.api.contexts];for(let c of s)if(c.type==="delete"){let l=a.find(et.kind,c.key);l&&a.detach(l)}else a.find(et.kind,c.key)||a.attach(new et(c.key))}})}return E(t).get("bindings")}function un(i){let t=this,{webqit:{Observer:e}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let n=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.bind in r)throw new Error(`The ${n} prototype already has a "${i.api.bind}" API!`);if(i.api.bindings in r)throw new Error(`The ${n} prototype already has a "${i.api.bindings}" API!`);Object.defineProperty(r,i.api.bind,{value:function(o,s={}){return fn.call(t,i,this,o,s)}}),Object.defineProperty(r,i.api.bindings,{get:function(){return e.proxy(hr.call(t,i,this))}})})}function fn(i,t,e,{merge:r,diff:n,publish:o,namespace:s}={}){let a=this,{webqit:{Observer:c}}=a,l=hr.call(this,i,t),u={diff:n,namespace:s,detail:{publish:o}},p=r?[]:Object.keys(l).filter(f=>!(f in e));return c.batch(l,()=>(p.length&&c.deleteProperties(l,p,u),c.set(l,e,u)),u)}function pn(i){let t=this,{webqit:{realdom:e,Observer:r,oohtml:{configs:n}}}=t,o=(a,c)=>{let l=a[n.CONTEXT_API.api.contexts];l.find(et.kind,c)||l.attach(new et(c))},s=(a,c)=>{let l,u=a[n.CONTEXT_API.api.contexts];for(;l=u.find(et.kind,c);)u.detach(l)};e.realtime(t.document).query(`[${t.CSS.escape(i.attr.bindingsreflection)}]`,a=>{a.exits.forEach(c=>s(c)),a.entrants.forEach(c=>{let l=Ee(c.getAttribute(i.attr.bindingsreflection)||""),u=[...l.entries()].filter(([p,f])=>f!==void 0);u.length&&c[i.api.bind](Object.fromEntries(u),{merge:!0,publish:!1});for(let[p]of l)o(c,p)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),e.realtime(t.document,"attr").observe(i.attr.bindingsreflection,a=>{let c=hr.call(t,i,a.target),l=Ee(a.value||""),u=Ee(a.oldValue||"");for(let p of new Set([...l.keys(),...u.keys()]))u.has(p)?l.has(p)?l.get(p)!==u.get(p)&&r.set(c,p,l.get(p),{detail:{publish:!1}}):(u.get(p)!==void 0&&r.deleteProperty(c,p,{detail:{publish:!1}}),s(a.target,p)):(l.get(p)!==void 0&&r.set(c,p,l.get(p),{detail:{publish:!1}}),o(a.target,p))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var Ee=i=>(i=i.trim(),new Map(ft(i.slice(1,-1),",").filter(t=>t.trim()).map(t=>ft(t,":").map(e=>e.trim()))));var st=class{static instance(t){return E(t).get("defsmanager::instance")||new this(t)}constructor(t,e=null,r=0){let{window:n}=D,{webqit:{realdom:o,oohtml:{configs:s}}}=n;E(t).get("defsmanager::instance")?.dispose(),E(t).set("defsmanager::instance",this),this.window=n,this.host=t,this.config=s.HTML_IMPORTS,this.parent=e,this.level=r,this.defs=pt(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=o.realtime(this.host.content).children(a=>{this.expose(a.exits,!1),this.expose(a.entrants,!0)},{live:!0,timing:"sync"}),this.realtimeB=o.realtime(this.host).attr(["src","loading"],(...a)=>this.evaluateLoading(...a),{live:!0,atomic:!0,timing:"sync",lifecycleSignals:!0}),this.realtimeC=this.evalInheritance()}validateDefId(t){if(["@","/","*","#"].some(e=>t.includes(e)))throw new Error(`The export ID "${t}" contains an invalid character.`)}expose(t,e){let{window:r}=D,{webqit:{Observer:n}}=r,o,s=this.defs["#"]||[];t.forEach(a=>{if(!a||a.nodeType!==1)return;let c=a.matches(this.config.templateSelector),l=(a.getAttribute(c?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();e?(c&&l?new st(a,this.host,this.level+1):(s.push(a),o=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(u=>u.call(this.window,a))})),l&&(this.validateDefId(l),n.set(this.defs,(!c&&"#"||"")+l,a))):(c&&l?st.instance(a).dispose():(s=s.filter(u=>u!==a),o=!0),l&&n.deleteProperty(this.defs,(!c&&"#"||"")+l))}),o&&n.set(this.defs,"#",s)}evaluateLoading([t,e],{signal:r}){let{window:{webqit:{Observer:n}}}=D,o=(t.value||"").trim();if(!o)return;let s,a=u=>{if(!u)return s;s=u.then(()=>l.remove())},c=(e.value||"").trim(),l=n.intercept(this.defs,"get",async(u,p,f)=>(c==="lazy"&&a(this.load(o,!0)),await a(),f()),{signal:r});c!=="lazy"&&a(this.load(o))}#t=new Set;#e;load(t){let{window:e}=D;if(this.#t.has(t)||(this.#t.add(t),this.#t.size===1&&this.host.content.children.length))return Promise.resolve();this.#e?.controller.abort();let r=new AbortController,n=(s,a)=>this.host.dispatchEvent(new e.CustomEvent(s,{detail:a})),o=e.fetch(t,{signal:r.signal,element:this.host}).then(s=>s.ok?s.text():Promise.reject(s.statusText)).then(s=>(this.host.innerHTML=s.trim(),n("load"),this.host)).catch(s=>(console.error(`Error fetching the bundle at "${t}": ${s.message}`),this.#e=null,n("loaderror"),this.host));return this.#e={request:o,controller:r},o}evalInheritance(){if(!this.parent)return[];let{window:{webqit:{Observer:t}}}=D,e=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(a=>a.trim()).filter(a=>a),n=a=>{a.forEach(c=>{t.get(this.defs,c.key)===c.oldValue&&(["get","set","def"].includes(c.type)?t[c.type.replace("get","set")](this.defs,c.key,c.value):c.type==="delete"&&t.deleteProperty(this.defs,c.key))})},o=[],s=pt(this.parent);return e&&o.push(t.reduce(s,[e,this.config.api.defs,1/0],t.get,n,{live:!0})),r.length&&o.push(t.get(s,r.includes("*")?1/0:r,n,{live:!0})),o}dispose(){this.realtimeA.disconnect(),this.realtimeB.disconnect(),this.realtimeC.forEach(t=>t instanceof Promise?t.then(e=>e.abort()):t.abort()),Object.entries(this.defs).forEach(([t,e])=>{t.startsWith("#")||st.instance(e).dispose()})}};var gt,Y,zt,Bt,dt=class extends J{constructor(){super(...arguments);Ut(this,gt,{});Ut(this,Y,void 0);Ut(this,zt,void 0);Ut(this,Bt,void 0)}static createRequest(e=null){let r=super.createRequest();if(e?.startsWith("/"))r.detail=e,r.targetContext=1/0;else if(e?.startsWith("@")){let[n,...o]=e.slice(1).split(/(?<=\w)(?=\/|#)/).map(s=>s.trim());r.targetContext=n,r.detail=o.join("")}else r.detail=e;return r}get localModules(){return pt(this.host)}get inheritedModules(){return U(this,gt)}handle(e){let{window:{webqit:{Observer:r}}}=D;e.meta.controller?.abort();let n=(e.detail||"").split(/\/|(?<=\w)(?=#)/g).map(s=>s.trim()).filter(s=>s);if(!n.length)return e.respondWith();n=n.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(s=>s==="*"?1/0:s)||[];let o={live:e.live,sig_nal:e.signal,descripted:!0};e.meta.controller=r.reduce(U(this,Y),n,r.get,s=>{if(Array.isArray(s)){if(!s.length){e.respondWith();return}for(let a of s)e.respondWith(a)}else e.respondWith(s.value)},o)}unsubscribed(e){e.meta.controller?.abort()}initialize(e){this.host=e;let{window:{webqit:{Observer:r}}}=D,n=()=>{for(let s of new Set([...Object.keys(this.localModules),...Object.keys(this.inheritedModules),...Object.keys(U(this,Y))]))if(!r.has(this.localModules,s)&&!r.has(this.inheritedModules,s))r.deleteProperty(U(this,Y),s);else if(s==="#"&&r.has(this.localModules,s)&&r.has(this.inheritedModules,s))r.set(U(this,Y),s,[...r.get(this.localModules,s),...r.get(this.inheritedModules,s)]);else{let a=r.get(this.localModules,s)||r.get(this.inheritedModules,s);r.get(U(this,Y),s)!==a&&r.set(U(this,Y),s,a)}};It(this,Y,{...this.localModules}),U(this,zt)?.abort(),It(this,zt,r.observe(this.localModules,()=>n("local"),{timing:"sync"}));let o=this.configs.HTML_IMPORTS;if(this.host.matches&&o.attr.importscontext){let s=this.host.ownerDocument.defaultView.webqit.realdom,a;U(this,Bt)?.disconnect(),It(this,Bt,s.realtime(this.host).attr(o.attr.importscontext,(c,{signal:l})=>{let u=(c.value||"").trim();a=u,It(this,gt,{});let p={...this.constructor.createRequest(u?`${u}/*`:"*"),live:!0,signal:l,diff:!0};this.host.parentNode[this.configs.CONTEXT_API.api.contexts].request(p,f=>{f?f.type==="delete"?(delete U(this,gt)[f.key],Reflect.has(this.localModules,f.key)||r.deleteProperty(U(this,Y),f.key)):(U(this,gt)[f.key]=f.value,!Reflect.has(this.localModules,f.key)&&Reflect.get(U(this,Y),f.key)!==f.value&&r.set(U(this,Y),f.key,f.value)):(It(this,gt,{}),n("inherited"))}),n("inherited")},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(e)}dispose(e){return U(this,zt)?.abort(),U(this,Bt)?.disconnect(),super.dispose(e)}};gt=new WeakMap,Y=new WeakMap,zt=new WeakMap,Bt=new WeakMap,V(dt,"kind","html-imports");function li(){let{window:i}=D,{webqit:t}=i,{realdom:e,oohtml:{configs:r}}=t;if(t.HTMLImportElement)return t.HTMLImportElement;let n=r.HTML_IMPORTS.elements.import.includes("-")?i.HTMLElement:class{};class o extends n{static instance(a){return r.HTML_IMPORTS.elements.import.includes("-")&&a instanceof this?a:E(a).get("import::instance")||new this(a)}constructor(...a){super();let c=a[0]||this;E(c).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>c,configurable:!1});let l={};Object.defineProperty(this,"#",{get:()=>l,configurable:!1}),l.slottedElements=new Set,l.setAnchorNode=u=>(l.anchorNode=u,u),l.live=u=>{if(l.liveImportsRealtime)throw new Error("Import element already in live mode.");let p=this.el.isConnected?this.el.parentNode:l.anchorNode.parentNode;l.liveImportsRealtime=e.realtime(this.el).attr(r.HTML_IMPORTS.attr.ref,(f,{signal:d})=>{l.moduleRef=f.value;let m=l.moduleRef.includes("#")?l.moduleRef:`${l.moduleRef}#`,w={...dt.createRequest(m),live:d&&!0,signal:d,diff:!m.endsWith("#")};p[r.CONTEXT_API.api.contexts].request(w,v=>{u((v instanceof i.HTMLTemplateElement?[...v.content.children]:Array.isArray(v)?v:v&&[v])||[])})},{live:!0,timing:"sync",lifecycleSignals:!0}),l.autoDestroyRealtime=e.realtime(i.document).track(p,()=>{l.die()},{subtree:"cross-roots",timing:"sync",generation:"exits"})},l.die=()=>{l.autoDestroyRealtime?.disconnect(),l.liveImportsRealtime?.disconnect(),l.liveImportsRealtime=null},l.hydrate=(u,p)=>{u.replaceWith(l.setAnchorNode(this.createAnchorNode())),l.live(f=>{if(l.originalsRemapped)return this.fill(f);let d=f.map((m,w)=>({el:m,fragmentDef:m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:m.tagName,i:w}));p.forEach((m,w)=>{let v=m.tagName,g=m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",y=(w++,d.find(x=>x.tagName===v&&x.fragmentDef===g&&x.i===w));y&&E(m).set("original@imports",y.el),E(m).set("slot@imports",this.el),l.slottedElements.add(m)}),l.originalsRemapped=!0})},l.autoRestore=(u=null)=>{l.autoRestoreRealtime?.disconnect(),u&&u();let p=()=>{this.el.isConnected||(this.el.setAttribute("data-nodecount",0),l.internalMutation=!0,l.anchorNode.replaceWith(this.el),l.internalMutation=!1,l.setAnchorNode(null))};if(!l.slottedElements.size)return p();let f=e.realtime(l.anchorNode.parentNode).observe([...l.slottedElements],d=>{if(d.exits.forEach(m=>{E(m).delete("slot@imports"),l.slottedElements.delete(m)}),!l.slottedElements.size){if(f.disconnect(),!d.target.isConnected)return;p()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});l.autoRestoreRealtime=f},l.connectedCallback=()=>{l.internalMutation||l.live(u=>this.fill(u))},l.disconnectedCallback=()=>{l.internalMutation||l.die()}}createAnchorNode(){if(i.webqit.env!=="server")return i.document.createTextNode("");let a=i.document.createElement("div");a.textContent=this.el.outerHTML;let c=i.document.createComment(a.innerHTML);return E(c).set("isAnchorNode",!0),c}fill(a,c){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(a)&&(a=new Set(a)),this.el.setAttribute("data-nodecount",a.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(l=>{let u=E(l).get("original@imports");a.has(u)?a.delete(u):(this["#"].slottedElements.delete(l),l.remove())}),a.size&&this.el.isConnected){let l=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(l),this["#"].internalMutation=!1}a.forEach(l=>{let u=l.cloneNode(!0);u.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||u.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),E(u).set("original@imports",l),E(u).set("slot@imports",this.el),this["#"].slottedElements.add(u),this["#"].anchorNode.before(u)})}))}empty(){this["#"].slottedElements.forEach(a=>a.remove())}get anchorNode(){return this["#"].anchorNode}get moduleRef(){return this["#"].moduleRef}get slottedElements(){return this["#"].slottedElements}}return r.HTML_IMPORTS.elements.import.includes("-")&&customElements.define(r.HTML_IMPORTS.elements.import,o),t.HTMLImportElement=o,o}function mr(i={}){let{config:t,window:e}=X.call(this,"html-imports",i,{elements:{import:"import"},attr:{def:"def",extends:"extends",inherits:"inherits",ref:"ref",importscontext:"importscontext"},api:{def:"def",defs:"defs",import:"import"}});t.attr.fragmentdef||(t.attr.fragmentdef=t.attr.def),t.templateSelector=`template[${e.CSS.escape(t.attr.def)}]`,t.importsContextSelector=`[${e.CSS.escape(t.attr.importscontext)}]`,t.slottedElementsSelector=`[${e.CSS.escape(t.attr.fragmentdef)}]:not(template)`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,e.webqit.HTMLImportsContext=dt,e.webqit.HTMLImportElement=li(),dn.call(e,t),hn.call(e,t)}function pt(i,t=!0){if(!E(i).has("defs")&&t){let e=Object.create(null);E(i).set("defs",e)}return E(i).get("defs")}function dn(i){let t=this,{webqit:{oohtml:{configs:e}}}=t;if(i.api.def in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.def}" API!`);if(i.api.defs in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.defs}" API!`);Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.def,{get:function(){return this.getAttribute(i.attr.def)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(n){this.toggleAttribute("scoped",n)}}),[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(n=>{let o=n===t.Document.prototype?"Document":n===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.import in n)throw new Error(`The ${o} prototype already has a "${i.api.import}" API!`);if(i.api.defs in n)throw new Error(`The ${o} prototype already has a "${i.api.defs}" API!`);Object.defineProperty(n,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(n,i.api.import,{value:function(s,a=!1,c=null){return r(this,...arguments)}})});function r(n,o,s=!1,a=null){let c={};typeof s=="function"?(a=s,s=!1):typeof s=="object"&&s?c={...s,...c}:c={live:s};let l={...dt.createRequest(o),...c};return n[e.CONTEXT_API.api.contexts].request(l,a)}}function hn(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},HTMLImportElement:o,HTMLImportsContext:s}}=t,a=u=>{let p=u[n.CONTEXT_API.api.contexts];p.find(s.kind)||p.attach(new s)},c=u=>{let p=u[n.CONTEXT_API.api.contexts],f=p.find(s.kind);f&&(!u.isConnected||!u.matches?.(i.importsContextSelector)&&!Object.keys(f.localModules).length)&&p.detach(f)};r.realtime(t.document).query([i.templateSelector,i.importsContextSelector],u=>{u.entrants.forEach(p=>{if(p.matches(i.templateSelector)){let f=st.instance(p);f.ownerContext=p.scoped?p.parentNode:p.getRootNode();let d=pt(f.ownerContext);f.defId&&e.set(d,f.defId,p),a(f.ownerContext)}else a(p)}),u.exits.forEach(p=>{if(p.matches(i.templateSelector)){let f=st.instance(p),d=pt(f.ownerContext);f.defId&&f.ownerContext.isConnected&&e.deleteProperty(d,f.defId),c(f.ownerContext)}else c(p)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(i.elements.import,u=>{u.entrants.forEach(p=>l(p,!0,u)),u.exits.forEach(p=>l(p,!1,u))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function l(u,p){let f=o.instance(u);p?f["#"].connectedCallback():f["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${i.anchorNodeSelector})`,u=>{u.entrants.forEach(p=>{if(E(p).get("isAnchorNode"))return;let f=t.document.createElement("div");f.innerHTML=p.nodeValue,f.innerHTML=f.firstChild.textContent;let d=f.firstChild,m=parseInt(d.getAttribute("data-nodecount")),w=new Set,v=p;for(;(v=v.previousElementSibling)&&v.matches(i.slottedElementsSelector)&&m--;)w.add(v);o.instance(d)["#"].hydrate(p,w)})},{id:"imports:hydration",live:!0,subtree:"cross-roots",timing:"sync"})}function gr(i={}){let{config:t,window:e}=X.call(this,"context-api",i,{elements:{roots:"root,webflo-embedded"},attr:{contextname:"contextname"},api:{contexts:"contexts"}}),r=new Map,n=e.EventTarget.prototype.dispatchEvent;Object.defineProperty(e.EventTarget.prototype,"dispatchEvent",{value:function(...o){let s=o[0],a=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(s.type)&&a){s.meta&&(s.meta.target=this);let c=u=>{if(u.stopImmediatePropagation(),u.meta&&(u.meta.target=u.target),!u.answered){if(r.get(a)||r.set(a,new Set),u.type==="contextrequest"&&u.live)r.get(a).add(u);else if(u.type==="contextclaim"){let p=new Set;return r.get(a).forEach(f=>{!u.target.contains(f.target)||!u.detail?.matchEvent?.(f)||(r.get(a).delete(f),p.add(f))}),r.get(a).size||r.delete(a),u.respondWith?.(p)}}};a.addEventListener(s.type,c);let l=n.call(this,...o);return a.removeEventListener(s.type,c),l}return n.call(this,...o)}}),e.webqit.DOMContexts=mt,e.webqit.DOMContext=J,e.webqit.DOMContextRequestEvent=Se(),e.webqit.DOMContextResponse=Tt,e.webqit.DuplicateContextError=Ct,mn.call(e,t)}function mn(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 mt.instance(this)}})})}function br({advanced:i={},...t}){let{config:e,window:r}=X.call(this,"scoped-css",t,{api:{styleSheets:"styleSheets"},style:{retention:"retain",mimeTypes:"text/css",strategy:null}});e.styleSelector=(Array.isArray(e.style.mimeTypes)?e.style.mimeTypes:e.style.mimeTypes.split("|")).concat("").reduce((n,o)=>{let s=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`style${s}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},gn.call(r,e),yn.call(r,e)}function gn(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 yn(i){let t=this,{webqit:{oohtml:e,realdom:r}}=t,n=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1;t.CSS.supports||(t.CSS.supports=()=>!1);let o=new WeakSet;r.realtime(t.document).query(i.styleSelector,s=>{s.entrants.forEach(a=>{if(o.has(a))return;o.add(a);let c=Pt(a.textContent),l=CSS.supports("selector(:has(a,b))"),u=a.scoped&&(l?`:has(> style[rand-${c}])`:`[rand-${c}]`),p=a.scoped&&t.CSSScopeRule&&!1,f=a.scoped&&a.parentNode||a.getRootNode();if(f instanceof t.Element){if(f[i.api.styleSheets].push(a),!n)return;(l?a:f).toggleAttribute(`rand-${c}`,!0)}if(!!n)if(a.scoped&&a.hasAttribute("shared")){let d;(d=e.Style.compileCache.get(c))||(d=bn.call(t,a,null,p,u),e.Style.compileCache.set(c,d)),Object.defineProperty(a,"sheet",{value:d,configurable:!0}),a.textContent=`
|
|
59
67
|
/*[ Shared style sheet ]*/
|
|
60
|
-
`}else{let
|
|
61
|
-
${
|
|
62
|
-
}`:
|
|
68
|
+
`}else{let d=()=>{let m=$e(Ft.call(t,f));yr.call(this,a.sheet,m,!p&&u)};a.isConnected?d():setTimeout(()=>{d()},0)}})},{id:"scoped-css",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants"})}function bn(i,t,e,r){let n=this,o=i.textContent,s,a=e&&r?`@scope (${r}) {
|
|
69
|
+
${o.trim()}
|
|
70
|
+
}`:o.trim();try{s=new n.CSSStyleSheet,s.replaceSync(a),yr.call(this,s,t,!e&&r);let c=()=>i.getRootNode().adoptedStyleSheets.push(s);i.isConnected?c():setTimeout(()=>{c()},0)}catch{let l=n.document.createElement("style");i.after(l),l.textContent=a,s=l.sheet,yr.call(this,s,t,!e&&r)}return s}function yr(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||ci.call(this,o,t,e)}}function ci(i,t,e=null){if(i instanceof CSSStyleRule){ui.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)ci.call(this,i.cssRules[n],t,e)}}function ui(i,t,e=null){let r=lr.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)ui.call(this,i.cssRules[o],t)}}function wr(i,t={}){this.webqit||(this.webqit={}),Object.assign(this.webqit,i),gr.call(this,t.CONTEXT_API||{}),dr.call(this,t.BINDINGS_API||{}),mr.call(this,{...t.HTML_IMPORTS||{},idleCompilers:[ei,ai]}),ar.call(this,t.NAMESPACED_HTML||{}),pr.call(this,t.DATA_BINDING||{}),br.call(this,t.SCOPED_CSS||{}),cr.call(this,t.SCOPED_JS||{})}wr.call(window,Ke);
|
|
63
71
|
//# sourceMappingURL=main.lite.js.map
|