@webqit/oohtml 4.3.14 → 4.3.16

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 CHANGED
@@ -221,7 +221,7 @@ If you'll be going ahead to build a real app with OOHTML, you may want to consid
221
221
 
222
222
  <details><summary>Show</summary>
223
223
 
224
- Amidst a multitude of approaches, vanilla HTML remains an attractive option for the UI author! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and certain modern paradigms like data binding! Authors still have to rely on tools - and, for the most part, have to do half of the work in HTML and half in JS - to express even basic concepts!
224
+ Amidst a multitude of approaches, vanilla HTML remains an attractive option for authoring modern UI! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and certain modern paradigms like data binding! Authors still have to rely on tools - and, for the most part, have to do half of the work in HTML and half in JS - to express even basic concepts!
225
225
 
226
226
  "As an author, I want to be able to do 'x' *declaratively* in HTML instead of *imperatively* in JavaScript or by means of a special Custom Element!" "As a Web Component author, I want to be able to leverage *conventions* that keep my component logic *concise*!" All such "user stories" represent important developer intuitions that has yet to be met in HTML; much of which belong under a broad subject: an object-oriented markup language! This subject is what we explore with OOHTML!
227
227
 
@@ -1033,7 +1033,7 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1033
1033
  **-->** *which would give us the following for a CSS property*:
1034
1034
 
1035
1035
  ```html
1036
- <div render="& color:someColor; & backgroundColor:'red'"></div>
1036
+ <div render="&color:someColor; &backgroundColor:'red'"></div>
1037
1037
  ```
1038
1038
 
1039
1039
  **-->** *without being space-sensitive*:
@@ -1046,23 +1046,24 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1046
1046
 
1047
1047
  | Directive | Type | Usage |
1048
1048
  | :---- | :---- | :---- |
1049
- | `&` | CSS Property | `<div render="& color:someColor; & backgroundColor:someBgColor;"></div>` |
1050
- | `%` | Class Name | `<div render="% active:app.isActive; % expanded:app.isExpanded;"></div>` |
1051
- | `~` | Attribute Name | `<a render="~ href:person.profileUrl+'#bio'; ~ title:'Click me';"></a>` |
1052
- | | Boolean Attribute | `<a render="~ ?required:formField.required; ~ ?aria-checked: formField.checked"></a>` |
1053
- | `@` | Structural Directive: | *See below* |
1054
- | `@text` | Plain text content | `<span render="@text:firstName+' '+lastName;"></span>` |
1055
- | `@html` | Markup content | `<span render="@html: '<i>'+firstName+'</i>';"></span>` |
1056
- | `@items` | A list, of the following format | `<declaration> <of\|in> <iterable> / <importRef>`<br>*See next two tables* |
1049
+ | `&` | CSS Property | `<div render="&color:someColor; &backgroundColor:someBgColor;"></div>` |
1050
+ | `%` | Class Name | `<div render="%active:app.isActive; %expanded:app.isExpanded;"></div>` |
1051
+ | `~` | Attribute Name | `<a render="~href:person.profileUrl+'#bio'; ~title:'Click me';"></a>` |
1052
+ | | Boolean Attribute | `<a render="~?required:formField.required; ~?aria-checked: formField.checked"></a>` |
1053
+ | `@` | DOM Event | `<div render="@click: this.methodCall(); @change: { state.prop1 = this.value };"></div>` |
1054
+ | `#` | Structural Directive: | *See below* |
1055
+ | `#text` | Plain text content | `<span render="#text:firstName+' '+lastName;"></span>` |
1056
+ | `#html` | Markup content | `<span render="#html: '<i>'+firstName+'</i>';"></span>` |
1057
+ | `#items` | A list, of the following format | `<declaration> <of\|in> <iterable> / <importRef>`<br>*See next two tables* |
1057
1058
 
1058
1059
  <details><summary><code>For ... Of</code> Loops</summary>
1059
1060
 
1060
1061
  | Idea | Usage |
1061
1062
  | :---- | :---- |
1062
- | A `for...of` loop over an array/iterable | `<ul render="@items: value of [1,2,3] / 'foo#fragment';"></ul>` |
1063
- | Same as above but with a `key` declaration | `<ul render="@items: (value,key) of [1,2,3] / 'foo#fragment';"></ul>` |
1064
- | Same as above but with different variable names | `<ul render="@items: (product,id) of store.products / 'foo#fragment';"></ul>` |
1065
- | Same as above but with a dynamic `importRef` | `<ul render="@items: (product,id) of store.products / store.importRef;"></ul>` |
1063
+ | A `for...of` loop over an array/iterable | `<ul render="#items: value of [1,2,3] / 'foo#fragment';"></ul>` |
1064
+ | Same as above but with a `key` declaration | `<ul render="#items: (value,key) of [1,2,3] / 'foo#fragment';"></ul>` |
1065
+ | Same as above but with different variable names | `<ul render="#items: (product,id) of store.products / 'foo#fragment';"></ul>` |
1066
+ | Same as above but with a dynamic `importRef` | `<ul render="#items: (product,id) of store.products / store.importRef;"></ul>` |
1066
1067
 
1067
1068
  </details>
1068
1069
 
@@ -1070,8 +1071,8 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1070
1071
 
1071
1072
  | Idea | Usage |
1072
1073
  | :---- | :---- |
1073
- | A `for...in` loop over an object | `<ul render="@items: key in {a:1,b:2} / 'foo#fragment';"></ul>` |
1074
- | Same as above but with a `value` and `index` declaration | `<ul render="@items: (key,value,index) in {a:1, b:2} / 'foo#fragment';"></ul>` |
1074
+ | A `for...in` loop over an object | `<ul render="#items: key in {a:1,b:2} / 'foo#fragment';"></ul>` |
1075
+ | Same as above but with a `value` and `index` declaration | `<ul render="#items: (key,value,index) in {a:1, b:2} / 'foo#fragment';"></ul>` |
1075
1076
 
1076
1077
  </details>
1077
1078
 
@@ -1811,7 +1812,7 @@ The following is a hypothetical list page!
1811
1812
  </template>
1812
1813
 
1813
1814
  <!-- The loop -->
1814
- <ul render="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1815
+ <ul render="#items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1815
1816
 
1816
1817
  </section>
1817
1818
  ```
@@ -1,4 +1,4 @@
1
- (()=>{function Ae(...n){let e,r={runtimeParams:Ze,compilerParams:Ye,parserParams:Je};for(;e=n.shift();){let{runtimeParams:t={},compilerParams:{globalsNoObserve:i=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:l={}}=e;r={runtimeParams:{...r.runtimeParams,...t},compilerParams:{...r.compilerParams,globalsNoObserve:[...r.compilerParams.globalsNoObserve,...i],globalsOnlyPathsExcept:[...r.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...r.parserParams,...l}},n.devMode}return r}var Je={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Ye={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Ze={apiVersion:3};function Se(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function ie(n,e,r,t=!0){r=(Array.isArray(r)?r:[r]).map(s=>(s+"").replace("(",t?"(.//":"(./")).join("|");let i=[],o;try{let s=n.document.evaluate(r,e,null,n.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)i.push(o)}catch{}return i}function Ee(n,e,r){r=(Array.isArray(r)?r:[r]).map(t=>(t+"").replace("(","(self::")).join("|");try{return n.document.evaluate(`${r}`,e,null,n.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function z(n,e,r,t=!1,i=null){let o=i?.get(e)?.get(r);if(typeof o<"u")return o;let s=a=>(i?.has(e)||i?.set(e,new WeakMap),i?.get(e)?.set(r,a),a),l=e.getRootNode(),c=r.getRootNode();return l===c?s(e.contains(r)):t&&c instanceof n.ShadowRoot?s(z(n,e,c.host,t,i)):s(!1)}function Ie(n,e="|"){return[...n].reduce(([r,t,i,o],s)=>!r&&t===0&&(Array.isArray(e)?e:[e]).includes(s)?[r,t,[""].concat(i)]:(!r&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&t++,!r&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&t--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(r=r===s?null:r||s),i[0]+=s,[r,t,i]),[null,0,[""]])[2].reverse()}function x(n){return!Array.isArray(n)&&typeof n=="object"&&n}function _(n){return Array.isArray(n)}function me(n,e,r=null){return _(e)?n.filter(t=>r?e.filter(i=>r(t,i)).length:e.indexOf(t)!==-1):[]}function T(n,...e){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new J}),!arguments.length)return globalThis.webqit.refs;let r=globalThis.webqit.refs.get(n);r||(r=new J,globalThis.webqit.refs.set(n,r));let t,i;for(;t=e.shift();)(i=r)&&!(r=r.get(t))&&(r=new J,i.set(t,r));return r}var J=class extends Map{constructor(...e){super(...e),this.observers=new Set}set(e,r){let t=super.set(e,r);return this.fire("set",e,r,e),t}delete(e){let r=super.delete(e);return this.fire("delete",e),r}has(e){return this.fire("has",e),super.has(e)}get(e){return this.fire("get",e),super.get(e)}keyNames(){return Array.from(super.keys())}observe(e,r,t){let i={type:e,key:r,callback:t};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(e,r,t){if(Array.isArray(e)||Array.isArray(r))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(oe([e,"*"],i.type)&&oe([r,"*"],i.key)&&i.callback===t)||this.observers.delete(i)}fire(e,r,...t){for(let i of this.observers)!(oe([e,"*"],i.type)&&oe([r,"*"],i.key))||i.callback(...t)}},oe=(n,e)=>Array.isArray(e)?me(n,e).length:n.includes(e);function V(n){return typeof n=="function"}function Y(n){return n===null||n===""}function L(n){return arguments.length&&(n===void 0||typeof n>"u")}function A(n){return Array.isArray(n)||typeof n=="object"&&n||V(n)}function de(n){return Y(n)||L(n)||n===!1||n===0||A(n)&&!Object.keys(n).length}function w(n){return V(n)||n&&{}.toString.call(n)==="[object function]"}function Z(n){return n instanceof Number||typeof n=="number"}function C(n){return Z(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function G(n){return n instanceof String||typeof n=="string"&&n!==null}function pe(n){return!G(n)&&!L(n.length)}function se(n,...e){return e.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function he(t,e){e=e||Object.prototype,e=e&&!_(e)?[e]:e;for(var r=[],t=t;t&&(!e||e.indexOf(t)<0)&&t.name!=="default";)r.push(t),t=t?Object.getPrototypeOf(t):null;return r}function ge(n,e){var r=[];return he(n,e).forEach(t=>{se(r,...Object.getOwnPropertyNames(t))}),r}function q(n,e,r=!1,t=!1,i=!1){var o=0,s=n.shift();if((C(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((l,c)=>{!A(l)&&!w(l)||(r?ge(l):Object.keys(l)).forEach(a=>{if(!!e(a,s,l,c)){var f=s[a],m=l[a];if((_(f)&&_(m)||x(f)&&x(m))&&(o===!0||o>0))s[a]=_(f)&&_(m)?[]:{},q([C(o)?o-1:o,s[a],f,m],e,r,t,i);else if(_(s)&&_(l))t?s[a]=m:s.push(m);else try{i?Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(l,a)):s[a]=l[a]}catch{}}})}),s}function K(...n){return q(n,(e,r,t)=>!0,!1,!1,!1)}function S(n,e=!0){return _(n)?n:!e&&x(n)?[n]:n!==!1&&n!==0&&de(n)?[]:pe(n)?Array.prototype.slice.call(n):x(n)?Object.values(n):[n]}function ee(n,e,r={},t={}){e=S(e).slice();for(var i=n;!L(i)&&!Y(i)&&e.length;){var o=e.shift();if(!(r.get?r.get(i,o):A(i)?o in i:i[o])){t.exists=!1;return}i=r.get?r.get(i,o):i[o]}return t.exists=!0,i}function ye(n,e,r,t={},i={}){let o=(f,m,u)=>i.set?i.set(f,m,u):(C(e[l])&&_(f)?f.push(u):f[m]=u,!0);e=S(e);for(var s=n,l=0;l<e.length;l++)if(l<e.length-1){if(!s||!A(s)&&!w(s))return!1;var c=ee(s,e[l],i);if(!A(c)){if(i.buildTree===!1)return!1;c=w(i.buildTree)?i.buildTree(l):C(e[l+1])?[]:{};var a=o(s,e[l],c);if(!a)return!1}s=c}else return o(s,e[l],r)}var te=class{constructor(e,r=!1){Object.defineProperty(this,"window",{value:e}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!r&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(e){this._synthesis++,this._fulfill();let r=await e();return this._synthesis--,r}_fulfill(){for(let e of this.readCallbacks)e(),this.readCallbacks.delete(e);for(let e of this.writeCallbacks)e(),this.writeCallbacks.delete(e)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(e,r=!1){if(r)return new Promise(t=>{this.synthesis?t(e()):this.readCallbacks.add(()=>{t(e())})});this.synthesis?Promise.resolve().then(e):this.readCallbacks.add(e)}onwrite(e,r=!1){if(r)return new Promise(t=>{this.synthesis?t(e()):this.writeCallbacks.add(()=>{t(e())})});this.synthesis?Promise.resolve().then(e):this.writeCallbacks.add(e)}cycle(e,r,t){this.onread(()=>{let i=e(t),o=s=>{s!==void 0&&this.onwrite(()=>{let l=r(s,t),c=a=>{a!==void 0&&this.cycle(e,r,a)};l instanceof Promise?l.then(c):c(l)})};i instanceof Promise?i.then(o):o(i)})}};var P=class{constructor(e){this.content=e,this.type=typeof e=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Se(e)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ie(e.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var U=class{constructor(e,r,t){this.context=e,this.namespace=r,this.window=e.defaultView||e.ownerDocument?.defaultView||t,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(e){if(w(e[0])?e=[[],...e]:x(e[0])&&!(e[0]instanceof P)&&e.length===1?e=[[],void 0,e[0]]:x(e[1])&&e.length===2?e=[S(e[0],!1),void 0,e[1]]:e[0]=S(e[0],!1),e[0].filter(r=>typeof r!="string"&&!(r instanceof P)&&!(r 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 e[0]=e[0].map(r=>r instanceof P?r:new P(r)),e}registry(...e){return T("realdom.realtime",this.window,this.namespace,...e)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(e,r,t){let{window:i}=this,o=new Set,s=new WeakMap;for(let[l,c]of this.registry(e)){let a=[].concat(r).filter(m=>z(i,l.context,m.target,l.params.subtree==="cross-roots",s));if(!a.length)continue;let f=[l,Array.isArray(r)?a:a[0]];c?o.add(f):t.call(i,...f)}for(let l of o)t.call(i,...l);o.clear()}disconnectables(e,...r){let t={disconnect(){r.forEach(i=>i&&w(i.disconnect)&&i.disconnect()||w(i)&&i()||x(i)&&(i.disconnected=!0))}};return e&&e.addEventListener("abort",()=>t.disconnect()),t}};var B=class extends U{type="attr";constructor(e,...r){super(e,"attr",...r)}get(e,r=void 0,t={}){let i=typeof e=="string"||e instanceof P;[e=[],r=void 0,t={}]=this.resolveArgs(arguments);let{context:o}=this,s=je(o,e);if(!r)return s;let l=t.lifecycleSignals&&this.createSignalGenerator();if(i)for(let c of s){let a=l?l.generate():{};r(c,a,o)}else{let c=l?.generate()||{};r(s,c,o)}if(t.live){l&&(t={...t,signalGenerator:l});let c=this.observe(i?e[0]:e,r,{newValue:!0,...t});return this.disconnectables(t.signal,c)}}observe(e,r,t={}){let i=typeof e=="string"||e instanceof P;if([e=[],r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(i?e[0]:e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:o,window:s,webqit:l}=this;t.eventDetails&&!l.realdom.attrInterceptionHooks?.intercepting&&He.call(s,"intercept",()=>{});let c=new s.MutationObserver(u=>{u=Le(u).map(p=>De.call(s,p)),ke.call(s,m,u,o)}),a={attributes:!0,attributeOldValue:t.oldValue,subtree:t.subtree&&!0};e.length&&(a.attributeFilter=e.map(u=>u+"")),c.observe(o,a);let f=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),m={context:o,spec:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:f,disconnectable:c};return this.disconnectables(t.signal,c,f)}observeSync(e,r,t={}){let i=typeof e=="string"||e instanceof P;[e,r,t={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let l=t.timing==="intercept"?"intercept":"sync";this.registry(l).size||He.call(s,l,u=>{this.forEachMatchingContext(l,u,ke)});let c={disconnect(){m.delete(f)}},a=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),f={context:o,spec:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:a,disconnectable:c},m=this.registry(l);return m.set(f,!!f.params.deferred),this.disconnectables(t.signal,c,a)}};function Le(n){return n.reduce((e,r,t)=>e[t-1]?.attributeName===r.attributeName||T(r.target,"internalAttrInteractions").get(r.attributeName)?e:e.concat(r),[])}function ke(n,e){let{context:r,spec:t,callback:i,params:o,atomics:s,originalFilterIsString:l,signalGenerator:c}=n;if(o.subtree||(e=e.filter(u=>u.target===r)),!e.length)return;let a=t.map(u=>u+"");if(o.atomic&&!s.size?e=je(r,t,e):o.timing!=="async"&&t.length&&(e=e.filter(u=>a.includes(u.name))),!e.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(e=e.map(u=>{let p;return o.eventDetails||({event:p,...u}=u),!o.oldValue&&"oldValue"in u&&({oldValue:p,...u}=u),!o.newValue&&"value"in u?{value:p,...u}=u:o.newValue&&typeof u.value>"u"&&(u={...u,value:ae(u.target,u.name,()=>u.target.getAttribute(u.name))}),u})),o.atomic&&(e.forEach(u=>s.set(u.name,u)),e=Array.from(s.entries()).map(([,u])=>u));let f=l?e[0]:e,m=c?c.generate():{};i(f,m,r)}function ae(n,e,r){let t=T(n,"internalAttrInteractions").get(e);T(n,"internalAttrInteractions").set(e,!0);let i=r();return T(n,"internalAttrInteractions").set(e,t),i}function je(n,e,r=[]){let t={event:null,type:"attribute"};return e.length?e.map(o=>(o=o+"",r.find(s=>s.name===o)||{target:n,name:o,value:ae(n,o,()=>n.getAttribute(o)),...t})):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:ae(n,o.nodeName,()=>o.nodeValue),...t})}function De({target:n,attributeName:e,value:r,oldValue:t}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[e]?.[0]||"mutation";return{target:n,name:e,value:r,oldValue:t,type:"observation",event:s}}function He(n,e){let r=this,{webqit:t,document:i,Element:o}=r;t.realdom.attrInterceptionHooks||Object.defineProperty(t.realdom,"attrInterceptionHooks",{value:new Map}),t.realdom.attrInterceptionHooks.has(n)||t.realdom.attrInterceptionHooks.set(n,new Set),t.realdom.attrInterceptionHooks.get(n).add(e);let s=()=>t.realdom.attrInterceptionHooks.get(n).delete(e);if(t.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),t.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(t.realdom,"attrInterceptionRecords",{value:new Map});let l=(f,m)=>{t.realdom.attrInterceptionRecords.has(f.target)||t.realdom.attrInterceptionRecords.set(f.target,{});let u=t.realdom.attrInterceptionRecords.get(f.target);if(u[f.name]=u[f.name]||[],u[f.name].unshift(f.event),T(f.target,"internalAttrInteractions").get(f.name))return m();t.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([f]));let p=m();return t.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([f])),p};new r.MutationObserver(f=>{f=f.filter(m=>!(r.webqit.realdom.attrInterceptionRecords?.get(m.target)||{})[m.attributeName]?.shift()),f=Le(f).map(m=>De.call(r,m)),f.length&&(t.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m(f)),t.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m(f)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let a=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(f=>{a[f]=o.prototype[f],o.prototype[f]=function(...m){let u,p=ae(this,m[0],()=>this.getAttribute(m[0]));["setAttribute","toggleAttribute"].includes(f)&&(u=m[1]),f==="toggleAttribute"&&u===void 0&&(u=p===null);let g={target:this,name:m[0],value:u,oldValue:p,type:"interception",event:[this,f]};return l(g,()=>a[f].call(this,...m))}}),s}var re=class extends U{constructor(e,...r){super(e,"tree",...r)}attr(e,r=void 0,t={}){let{context:i,window:o}=this;return new B(i,o).get(...arguments)}query(e,r=void 0,t={}){[e,r=void 0,t={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=a=>(o.has(a)||o.set(a,{target:a,entrants:[],exits:[],type:"query",event:null}),o.get(a));if(!t.generation||t.generation==="entrants"){if(!e.length)[...i.children].forEach(a=>s(i).entrants.push(a));else if(e.every(a=>a.type==="selector")){let[a,f]=e.reduce(([u,p],g)=>g.kind==="xpath"?[u,p.concat(g)]:[u.concat(g),p],[[],[]]),m=[];t.subtree?(a.length&&m.push(...i.querySelectorAll(a.join(","))),f.length&&m.push(...ie(this.window,i,f))):(a.length&&m.push(...[...i.children].filter(u=>u.matches(a))),f.length&&m.push(...ie(this.window,i,f,!1))),m.forEach(u=>s(u.parentNode||i).entrants.push(u))}}if(!r)return o;let l={disconnected:!1},c=r&&t.lifecycleSignals&&this.createSignalGenerator();for(let[,a]of o){if(l.disconnected)break;let f=c?.generate()||{};r(a,f,i)}if(t.live){c&&(t={...t,signalGenerator:c});let a=this.observe(e,r,t);return this.disconnectables(t.signal,l,a)}return this.disconnectables(t.signal,l,c)}children(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!1})}subtree(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!0})}observe(e,r,t={}){if([e,r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:i,window:o,webqit:s,document:l}=this;t.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(l.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Re.call(o,"sync",()=>{});let c=new o.MutationObserver(m=>m.forEach(u=>{xe.call(o,f,Be.call(o,u),i)}));c.observe(i,{childList:!0,subtree:t.subtree&&!0});let a=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),f={context:i,spec:e,callback:r,params:t,signalGenerator:a,disconnectable:c};if(t.staticSensitivity){let m=Fe.call(o,f);return this.disconnectables(t.signal,c,a,m)}return this.disconnectables(t.signal,c,a)}observeSync(e,r,t={}){[e,r,t={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let s=t.timing==="intercept"?"intercept":"sync";this.registry(s).size||Re.call(o,s,u=>{this.forEachMatchingContext(s,u,xe)});let l=new o.MutationObserver(u=>u.forEach(p=>{Array.isArray((p=Be.call(o,p)).event)||xe.call(o,f,p,i)}));l.observe(i,{childList:!0,subtree:t.subtree&&!0});let c={disconnect(){m.delete(f),l.disconnect()}},a=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),f={context:i,spec:e,callback:r,params:t,signalGenerator:a,disconnectable:c},m=this.registry(s);if(m.set(f,!!f.params.deferred),t.staticSensitivity){let u=Fe.call(o,f);return this.disconnectables(t.signal,c,a,u)}return this.disconnectables(t.signal,c,a)}track(e,r,t={}){return t={subtree:!0,...t},this.observe(e,i=>{i.entrants.length&&r(!0,Array.isArray(e)?i.entrants:i.entrants[0]),i.exits.length&&r(!1,Array.isArray(e)?i.exits:i.exits[0])},t)}};function Fe(n){let e=this,{context:r,spec:t,callback:i,params:o,signalGenerator:s}=n,l=t.filter(p=>p.kind==="css"),c=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],a=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],f=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(c(p)).concat(a(p));if(!(n.$attrs=Array.from(new Set(l.filter(p=>(p+"").includes("[")).reduce((p,g)=>p.concat(f(g+"")),[])))).length)return;let m=new Set,u=new Set;return m.push=p=>(u.delete(p),m.add(p)),u.push=p=>(m.delete(p),u.add(p)),n.$deliveryCache={entrants:m,exits:u},new B(r,e).observe(n.$attrs,p=>{let g=new Map,v=y=>(g.has(y)||g.set(y,{target:y,entrants:[],exits:[],type:"static",event:null}),g.get(y)),M=new WeakMap,h=y=>(M.has(y)||M.set(y,l.some($=>y.matches($+""))),M.get(y));for(let y of p)["entrants","exits"].forEach($=>{o.generation&&$!==o.generation||n.$deliveryCache[$].has(y.target)||($==="entrants"?!h(y.target):h(y.target))||(n.$deliveryCache[$].push(y.target),v(y.target)[$].push(y.target),v(y.target).event=y.event)});for(let[,y]of g){let $=s?.generate()||{};i(y,$,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function xe(n,e){let{context:r,spec:t,callback:i,params:o,signalGenerator:s,$deliveryCache:l}=n,c={...e,entrants:[],exits:[]};if(o.eventDetails||delete c.event,["entrants","exits"].forEach(f=>{if(!(o.generation&&f!==o.generation)&&(t.length?c[f]=dt.call(this,t,o.subtree==="cross-roots",e[f],e.event!=="parse"):c[f]=[...e[f]],!!l))for(let m of c[f])l[f].push(m)}),!c.entrants.length&&!c.exits.length)return;let a=s?.generate()||{};i(c,a,r)}function dt(n,e,r,t){r=Array.isArray(r)?r:[...r];let i=(o,s)=>{if(s.type==="selector"){let l=s.isXpathAttr?[]:o.filter(c=>s.kind==="xpath"?Ee(this,c,s+""):c.matches&&c.matches(s+""));if((t||s.isXpathAttr)&&(l=o.reduce((c,a)=>s.kind==="xpath"?[...c,...ie(this,a,s,t)]:a.querySelectorAll?[...c,...a.querySelectorAll(s+"")]:c,l)),l.length)return l}else if(o.includes(s.content)||t&&o.some(l=>z(this,l,s.content,e)))return[s.content]};return r.$$searchCache||(r.$$searchCache=new Map),n.reduce((o,s)=>{let l;return r.$$searchCache.has(s.content)?l=r.$$searchCache.get(s.content):(l=i(r,s)||[],s.type==="instance"&&r.$$searchCache.set(s.content,l)),o.concat(l)},[])}function Be({target:n,addedNodes:e,removedNodes:r}){let t=this,i;return i=S(e).reduce((o,s)=>o||t.webqit.realdom.domInterceptionRecords?.get(s),null),i=S(r).reduce((o,s)=>o||t.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||t.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:e,exits:r,type:"observation",event:i}}function Re(n,e){let r=this,{webqit:t,document:i,Node:o,CharacterData:s,Element:l,HTMLElement:c,HTMLTemplateElement:a,DocumentFragment:f}=r;t.realdom.domInterceptionHooks||Object.defineProperty(t.realdom,"domInterceptionHooks",{value:new Map}),t.realdom.domInterceptionNoRecurse||Object.defineProperty(t.realdom,"domInterceptionNoRecurse",{value:new Map}),t.realdom.domInterceptionHooks.has(n)||t.realdom.domInterceptionHooks.set(n,new Set),t.realdom.domInterceptionHooks.get(n).add(e);let m=()=>t.realdom.domInterceptionHooks.get(n).delete(e);if(t.realdom.domInterceptionHooks?.intercepting)return m;console.warn("DOM mutation APIs are now being intercepted."),t.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(t.realdom,"domInterceptionRecords",{value:new Map});let u=(h,y,$)=>{t.realdom.domInterceptionNoRecurse.set(h,y);let d=$();return t.realdom.domInterceptionNoRecurse.delete(h),d},p=(h,y)=>{h.entrants.concat(h.exits).forEach(d=>{clearTimeout(t.realdom.domInterceptionRecords.get(d)?.timeout),t.realdom.domInterceptionRecords.set(d,h.event);let b=setTimeout(()=>{t.realdom.domInterceptionRecords.delete(d)},0);Object.defineProperty(h.event,"timeout",{value:b,configurable:!0})}),t.realdom.domInterceptionHooks.get("intercept")?.forEach(d=>d(h));let $=y();return t.realdom.domInterceptionHooks.get("sync")?.forEach(d=>d(h)),$},g={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},v={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(g).reduce((h,y)=>h.concat(y),[])).forEach(h=>{Object.keys(g).forEach(d=>{if(!g[d].includes(h))return;let b=Object.getOwnPropertyDescriptor(r[d].prototype,h);!b||(Object.defineProperty(r[d].prototype,h,"value"in b?{...b,value:y}:{...b,set:$}),v[d][h]=b)});function y(...d){let b=Object.keys(v).find(N=>this instanceof r[N]&&h in v[N]),j=v[b],E=()=>j[h].value.call(this,...d);if(t.realdom.domInterceptionNoRecurse.get(this)===h)return E();let I=[],O=[],D=this;["insertBefore"].includes(h)?O=[d[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(h)?(O=[d[1]],["beforebegin","afterend"].includes(d[0])&&(D=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(h)?(I=[...this.childNodes],O=h==="replaceChildren"?[...d]:[d[0]]):["replaceWith","remove"].includes(h)?(I=[this],O=h==="replaceWith"?[...d]:[],D=this.parentNode):["replaceChild"].includes(h)?(I=[d[1]],O=[d[0]]):["removeChild"].includes(h)?I=[...d]:(O=[...d],["before","after"].includes(h)&&(D=this.parentNode));let ne=h;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(h)){let N=this.nodeName;if(h==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(d[0])){if(!this.parentNode)return j[h].value.call(this,...d);N=this.parentNode.nodeName}let F=i.createElement(N.includes("-")?"div":N);j.setHTMLUnsafe.value.call(F,O[0],h==="setHTMLUnsafe"?d[1]:{}),O=[...F.childNodes],h==="insertAdjacentHTML"?(ne="insertAdjacentElement",d[1]=new f,u(d[1],"append",()=>d[1].append(...F.childNodes))):(ne="replaceChildren",d=[...F.childNodes])}return p({target:D,entrants:O,exits:I,type:"interception",event:[this,h]},()=>j[ne].value.call(this,...d))}function $(d){let b=Object.keys(v).find(R=>this instanceof r[R]&&h in v[R]),j=v[b],E=()=>j[h].set.call(this,d);if(this instanceof HTMLScriptElement||t.realdom.domInterceptionNoRecurse.get(this)===h)return E();let I=[],O=[],D=this;if(["outerHTML","outerText"].includes(h)?(I=[this],D=this.parentNode):this instanceof a?(D=this.content,I=[...this.content.childNodes]):I=[...this.childNodes],["outerHTML","innerHTML"].includes(h)){let R=this.nodeName;if(h==="outerHTML"){if(!this.parentNode)return E();R=this.parentNode.nodeName}let N=i.createElement(R.includes("-")?"div":R);if(u(N,h,()=>N[h]=d),O=this instanceof a?[...N.content.childNodes]:[...N.childNodes],this instanceof a&&this.hasAttribute("src")||this instanceof ShadowRoot){let F=W=>W.reduce((k,H)=>H instanceof HTMLScriptElement?k.concat(H):H instanceof a?k.concat(F([H.content])):(k=k.concat(F([...H.querySelectorAll?.("template")||[]].map(ze=>ze.content))),k.concat(...H.querySelectorAll?.("script")||[])),[]);for(let W of F(O)){if(this instanceof ShadowRoot){W.setAttribute("data-handling","manual");continue}let k=i.createElement("script");[...W.attributes].forEach(H=>k.setAttribute(H.name,H.value)),k.textContent=W.textContent,u(W,"replaceWith",()=>W.replaceWith(k))}}h==="outerHTML"?(d=new f,u(d,"append",()=>d.append(...O)),E=()=>u(this,"replaceWith",()=>l.prototype.replaceWith.call(this,d))):this instanceof a?E=()=>u(this.content,"replaceChildren",()=>this.content.replaceChildren(...O)):E=()=>u(this,"replaceChildren",()=>l.prototype.replaceChildren.call(this,...O))}return p({target:D,entrants:O,exits:I,type:"interception",event:[this,h]},E)}}),m}function We(){pt.call(this),ht.call(this),gt.call(this)}function pt(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=e=>e.replace(/([\:@\~\$\&])/g,"\\$1"))}function ht(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function gt(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(e){for(var r=(this.document||this.ownerDocument).querySelectorAll(e),t=r.length;--t>=0&&r.item(t)!==this;);return t>-1})}function Ue(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},We.call(n),n.webqit.realdom.meta=(...r)=>_t.call(n,...r),n.webqit.realdom.ready=(...r)=>be.call(n,...r),n.webqit.realdom.realtime=(r,t="dom")=>{if(t==="dom")return new re(r,n);if(t==="attr")return new B(r,n)};let e=new te(n);return n.webqit.realdom.schedule=(r,...t)=>e[`on${r}`](...t),n.webqit.realdom.synthesizeWhile=(...r)=>e.synthesizeWhile(...r),n.webqit.realdom}function be(...n){let e="interactive",r;G(n[0])?(e=n[0],w(n[1])&&(r=n[1])):w(n[0])&&(r=n[0]);let t={interactive:["interactive","complete"],complete:["complete"]};if(!t[e])throw new Error(`Invalid ready-state timing: ${e}.`);let i=this;if(!r)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>be.call(this,"interactive",o)),complete:new Promise(o=>be.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[e];if(t[e].includes(i.document.readyState))return r(i);i.webqit.realdom.readyStateCallbacks||(i.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},i.document.addEventListener("readystatechange",()=>{let o=i.document.readyState;for(let s of i.webqit.realdom.readyStateCallbacks[o].splice(0))s(i)},!1)),i.webqit.realdom.readyStateCallbacks[e].push(r)}function _t(n){let e=this,r={},t;return(t=e.document.querySelector(`meta[name="${n}"]`))&&(r=(t.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(l=>l.trim());return ye(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:C(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return t.content},json(){return JSON.parse(JSON.stringify(r))}}}function fe(n,e){return typeof n!="string"?n:n.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+(typeof e!==void 0&&e?r.substr(1).toLowerCase():r.substr(1))})}var X=(...n)=>T("oohtml",...n),xt={};function Ge(n,e,r){let t=this,i=Ue.call(t);xt.window=t,t.webqitConfig||(t.webqitConfig=i.meta("webqit").json()),t.webqit||(t.webqit={}),t.webqit.oohtml||(t.webqit.oohtml={}),t.webqit.oohtml.configs||(t.webqit.oohtml.configs={});let o=n.toUpperCase().replace("-","_");if(!t.webqit.oohtml.configs[o]){t.webqit.oohtml.configs[o]={};let s=t.webqit.oohtml.configs[o];K(2,s,r,e,i.meta(n).json()),t.webqitConfig.prefix&&Object.keys(s).forEach(l=>{Object.keys(s[l]).forEach(c=>{l==="api"&&typeof s[l][c]=="string"?s[l][c]=`${t.webqitConfig.prefix}${fe(s[l][c])}`:["attr","elements"].includes(l)&&s[l][c]?.startsWith("data-")===!1&&(s[l][c]=`${t.webqitConfig.prefix}-${s[l][c]}`)})})}return{config:t.webqit.oohtml.configs[o],realdom:i,window:t}}function ce(n,e){return[...n].reduce(([r,t,i],o)=>!r&&t===0&&(Array.isArray(e)?e:[e]).includes(o)?[r,t,[""].concat(i)]:(!r&&["(","[","{"].includes(o)&&!i[0].endsWith("\\")&&t++,!r&&[")","]","}"].includes(o)&&!i[0].endsWith("\\")&&t--,['"',"'","`"].includes(o)&&!i[0].endsWith("\\")&&(r=r===o?null:r||o),i[0]+=o,[r,t,i]),[null,0,[""]])[2].reverse()}function Oe(n={}){let{config:e,window:r}=Ge.call(this,"data-binding",n,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:Ae({runtimeParams:{spec:{handler:i=>{}}}})});({CONTEXT_API:e.CONTEXT_API,BINDINGS_API:e.BINDINGS_API,HTML_IMPORTS:e.HTML_IMPORTS}=r.webqit.oohtml.configs),e.attrSelector=`[${r.CSS.escape(e.attr.render)}]`;let t=(i,o)=>{let s=`starts-with(., "${i}")`,l=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${l}`};e.discreteBindingsSelector=`comment()[${t(e.tokens.tagStart,e.tokens.tagEnd)}]`,bt.call(r,e)}function bt(n){let e=this,{webqit:{realdom:r}}=e;r.realtime(e.document).query(n.attrSelector,t=>{Xe.call(this,...t.exits),setTimeout(()=>{At.call(e,n,...t.entrants)},0)},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),r.realtime(e.document).query(`(${n.discreteBindingsSelector})`,t=>{setTimeout(()=>{Xe.call(this,...t.exits),$t.call(e,n,...t.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Qe(n,e){let{webqit:{realdom:r,Observer:t,DOMBindingsContext:i}}=this;if(X(e).has("data-binding"))return X(e).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(c,a,...f)=>{(()=>{try{c[a](...f)}catch(u){throw new Error(`Error executing "${a}()": ${u.message} at ${u.cause}`)}})()},o.$assign__=(c,a,f)=>{(()=>{try{c[a]=f}catch(u){throw new Error(`Error executing "${a} = ${f}": ${u.message} at ${u.cause}`)}})()},t.intercept(o,{get:(c,a,f)=>{if(!(c.key in o)){let m={...i.createRequest(c.key),live:!0,signal:s.signal};e[n.CONTEXT_API.api.contexts].request(m,u=>{t.set(o,c.key,u)})}return f(o[c.key]??(c.key in globalThis?globalThis[c.key]:void 0))},has:(c,a,f)=>f(!0)});let l={scope:o,abortController:s,bindings:new Map};return X(e).set("data-binding",l),l}function Xe(...n){for(let e of n){let r=e.nodeName==="#text"?e.parentNode:e,{bindings:t,abortController:i}=X(r).get("data-binding")||{};if(!t?.has(e))return;t.get(e).state.dispose(),t.get(e).signals?.forEach(o=>o.abort()),t.delete(e),t.size||(i.abort(),X(r).delete("data-binding"))}}function vt(n,e){let r=n.tokens.tagStart.split("").map(a=>`\\${a}`).join(""),t=n.tokens.tagEnd.split("").map(a=>`\\${a}`).join(""),i=n.tokens.stateStart.split("").map(a=>a===" "?"(?:\\s+)?":`\\${a}`).join(""),o=n.tokens.stateEnd.split("").map(a=>`\\${a}`).join(""),s=`^${r}(.*?)(?:${i}(\\d+)${o}(?:\\s+)?)?${t}$`,[,l,c]=e.match(new RegExp(s));return{raw:e,expr:l,span:parseInt(c??0)}}async function $t(n,...e){let r=this,t=e.reduce((i,o)=>{if(o.isBound)return i;let s=vt(n,o.nodeValue),l=o;if(s.span){if(l=o.nextSibling,l?.nodeName!=="#text"||l.nodeValue.length<s.span)return i;l.nodeValue.length>s.span&&l.splitText(s.span)}else l=o.ownerDocument.createTextNode(""),o.after(l);l.isBound=!0;let c=o;return r.webqit.env!=="server"&&(c.remove(),c=null),i.concat({textNode:l,template:s,anchorNode:c})},[]);for(let{textNode:i,template:o,anchorNode:s}of t){let l=Ot.call(r,n,o.expr),{scope:c,bindings:a}=Qe.call(this,n,i.parentNode);Object.defineProperty(i,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{a.set(i,{state:await(await l.bind(i,c)).execute()})}catch(f){console.log(f)}}}var ve=new Map;function Ot(n,e){if(ve.has(e))return ve.get(e);let r=`let content = ((${e}) ?? '') + '';`;r+="$assign__(this, 'nodeValue', content);",r+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${n.tokens.tagStart}${Q(e)}${n.tokens.stateStart}" + content.length + "${n.tokens.stateEnd} ${n.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:t}}=this,{parserParams:i,compilerParams:o,runtimeParams:s}=n.advanced,l=new t(r,{parserParams:i,compilerParams:o,runtimeParams:s});return ve.set(e,l),l}async function At(n,...e){for(let r of e){let t=St.call(this,n,r.getAttribute(n.attr.render)),{scope:i,bindings:o}=Qe.call(this,n,r),s=[];Object.defineProperty(r,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(r,{signals:s,state:await(await t.bind(r,i)).execute()})}catch(l){console.log(l)}}}var $e=new Map;function St(n,e){if($e.has(e))return $e.get(e);let r={},t=-1,i=ce(e,";").map(f=>{let[m,u]=ce(f,":").map(h=>h.trim()),p=m[0],g=m.slice(1).trim(),v=`(${u})`,M=`(${v} ?? '')`;if(p==="&")return g.startsWith("--")?`$exec__(this.style, 'setProperty', "${Q(g)}", ${M});`:`$assign__(this.style, "${Q(g)}", ${M});`;if(p==="%")return`$exec__(this.classList, 'toggle', "${Q(g)}", !!${v});`;if(p==="~")return g.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Q(g.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${Q(g)}", ${M});`;if(p==="#"){if(r[g])throw new Error(`Duplicate binding: ${m}.`);if(r[g]=!0,g==="text")return`$assign__(this, 'textContent', ${M});`;if(g==="html")return`$exec__(this, 'setHTMLUnsafe', ${M});`;if(g==="items"){let[h,y]=ce(u,"/");if(!y)throw new Error(`Invalid ${p}items spec: ${f}; no import specifier.`);let[$,d,b,j]=h.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!$)throw new Error(`Invalid ${p}items spec: ${f}.`);if(d.startsWith("(")?d=d.trim().slice(1,-1).split(",").map(I=>I.trim()):d=[d],d.length>(b==="in"?3:2))throw new Error(`Invalid ${p}items spec: ${f}.`);let E=b==="in"?d[2]:d[1]||"$index__";return`
1
+ (()=>{function Ae(...n){let e,r={runtimeParams:Ze,compilerParams:Ye,parserParams:Je};for(;e=n.shift();){let{runtimeParams:t={},compilerParams:{globalsNoObserve:i=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:l={}}=e;r={runtimeParams:{...r.runtimeParams,...t},compilerParams:{...r.compilerParams,globalsNoObserve:[...r.compilerParams.globalsNoObserve,...i],globalsOnlyPathsExcept:[...r.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...r.parserParams,...l}},n.devMode}return r}var Je={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Ye={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Ze={apiVersion:3};function Se(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function ie(n,e,r,t=!0){r=(Array.isArray(r)?r:[r]).map(s=>(s+"").replace("(",t?"(.//":"(./")).join("|");let i=[],o;try{let s=n.document.evaluate(r,e,null,n.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)i.push(o)}catch{}return i}function Ee(n,e,r){r=(Array.isArray(r)?r:[r]).map(t=>(t+"").replace("(","(self::")).join("|");try{return n.document.evaluate(`${r}`,e,null,n.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function z(n,e,r,t=!1,i=null){let o=i?.get(e)?.get(r);if(typeof o<"u")return o;let s=a=>(i?.has(e)||i?.set(e,new WeakMap),i?.get(e)?.set(r,a),a),l=e.getRootNode(),c=r.getRootNode();return l===c?s(e.contains(r)):t&&c instanceof n.ShadowRoot?s(z(n,e,c.host,t,i)):s(!1)}function Ie(n,e="|"){return[...n].reduce(([r,t,i,o],s)=>!r&&t===0&&(Array.isArray(e)?e:[e]).includes(s)?[r,t,[""].concat(i)]:(!r&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&t++,!r&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&t--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(r=r===s?null:r||s),i[0]+=s,[r,t,i]),[null,0,[""]])[2].reverse()}function x(n){return!Array.isArray(n)&&typeof n=="object"&&n}function _(n){return Array.isArray(n)}function me(n,e,r=null){return _(e)?n.filter(t=>r?e.filter(i=>r(t,i)).length:e.indexOf(t)!==-1):[]}function T(n,...e){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new J}),!arguments.length)return globalThis.webqit.refs;let r=globalThis.webqit.refs.get(n);r||(r=new J,globalThis.webqit.refs.set(n,r));let t,i;for(;t=e.shift();)(i=r)&&!(r=r.get(t))&&(r=new J,i.set(t,r));return r}var J=class extends Map{constructor(...e){super(...e),this.observers=new Set}set(e,r){let t=super.set(e,r);return this.fire("set",e,r,e),t}delete(e){let r=super.delete(e);return this.fire("delete",e),r}has(e){return this.fire("has",e),super.has(e)}get(e){return this.fire("get",e),super.get(e)}keyNames(){return Array.from(super.keys())}observe(e,r,t){let i={type:e,key:r,callback:t};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(e,r,t){if(Array.isArray(e)||Array.isArray(r))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(oe([e,"*"],i.type)&&oe([r,"*"],i.key)&&i.callback===t)||this.observers.delete(i)}fire(e,r,...t){for(let i of this.observers)!(oe([e,"*"],i.type)&&oe([r,"*"],i.key))||i.callback(...t)}},oe=(n,e)=>Array.isArray(e)?me(n,e).length:n.includes(e);function V(n){return typeof n=="function"}function Y(n){return n===null||n===""}function L(n){return arguments.length&&(n===void 0||typeof n>"u")}function A(n){return Array.isArray(n)||typeof n=="object"&&n||V(n)}function de(n){return Y(n)||L(n)||n===!1||n===0||A(n)&&!Object.keys(n).length}function w(n){return V(n)||n&&{}.toString.call(n)==="[object function]"}function Z(n){return n instanceof Number||typeof n=="number"}function C(n){return Z(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function G(n){return n instanceof String||typeof n=="string"&&n!==null}function pe(n){return!G(n)&&!L(n.length)}function se(n,...e){return e.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function he(t,e){e=e||Object.prototype,e=e&&!_(e)?[e]:e;for(var r=[],t=t;t&&(!e||e.indexOf(t)<0)&&t.name!=="default";)r.push(t),t=t?Object.getPrototypeOf(t):null;return r}function ge(n,e){var r=[];return he(n,e).forEach(t=>{se(r,...Object.getOwnPropertyNames(t))}),r}function q(n,e,r=!1,t=!1,i=!1){var o=0,s=n.shift();if((C(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((l,c)=>{!A(l)&&!w(l)||(r?ge(l):Object.keys(l)).forEach(a=>{if(!!e(a,s,l,c)){var f=s[a],m=l[a];if((_(f)&&_(m)||x(f)&&x(m))&&(o===!0||o>0))s[a]=_(f)&&_(m)?[]:{},q([C(o)?o-1:o,s[a],f,m],e,r,t,i);else if(_(s)&&_(l))t?s[a]=m:s.push(m);else try{i?Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(l,a)):s[a]=l[a]}catch{}}})}),s}function K(...n){return q(n,(e,r,t)=>!0,!1,!1,!1)}function S(n,e=!0){return _(n)?n:!e&&x(n)?[n]:n!==!1&&n!==0&&de(n)?[]:pe(n)?Array.prototype.slice.call(n):x(n)?Object.values(n):[n]}function ee(n,e,r={},t={}){e=S(e).slice();for(var i=n;!L(i)&&!Y(i)&&e.length;){var o=e.shift();if(!(r.get?r.get(i,o):A(i)?o in i:i[o])){t.exists=!1;return}i=r.get?r.get(i,o):i[o]}return t.exists=!0,i}function ye(n,e,r,t={},i={}){let o=(f,m,u)=>i.set?i.set(f,m,u):(C(e[l])&&_(f)?f.push(u):f[m]=u,!0);e=S(e);for(var s=n,l=0;l<e.length;l++)if(l<e.length-1){if(!s||!A(s)&&!w(s))return!1;var c=ee(s,e[l],i);if(!A(c)){if(i.buildTree===!1)return!1;c=w(i.buildTree)?i.buildTree(l):C(e[l+1])?[]:{};var a=o(s,e[l],c);if(!a)return!1}s=c}else return o(s,e[l],r)}var te=class{constructor(e,r=!1){Object.defineProperty(this,"window",{value:e}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!r&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(e){this._synthesis++,this._fulfill();let r=await e();return this._synthesis--,r}_fulfill(){for(let e of this.readCallbacks)e(),this.readCallbacks.delete(e);for(let e of this.writeCallbacks)e(),this.writeCallbacks.delete(e)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(e,r=!1){if(r)return new Promise(t=>{this.synthesis?t(e()):this.readCallbacks.add(()=>{t(e())})});this.synthesis?Promise.resolve().then(e):this.readCallbacks.add(e)}onwrite(e,r=!1){if(r)return new Promise(t=>{this.synthesis?t(e()):this.writeCallbacks.add(()=>{t(e())})});this.synthesis?Promise.resolve().then(e):this.writeCallbacks.add(e)}cycle(e,r,t){this.onread(()=>{let i=e(t),o=s=>{s!==void 0&&this.onwrite(()=>{let l=r(s,t),c=a=>{a!==void 0&&this.cycle(e,r,a)};l instanceof Promise?l.then(c):c(l)})};i instanceof Promise?i.then(o):o(i)})}};var P=class{constructor(e){this.content=e,this.type=typeof e=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Se(e)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ie(e.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var U=class{constructor(e,r,t){this.context=e,this.namespace=r,this.window=e.defaultView||e.ownerDocument?.defaultView||t,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(e){if(w(e[0])?e=[[],...e]:x(e[0])&&!(e[0]instanceof P)&&e.length===1?e=[[],void 0,e[0]]:x(e[1])&&e.length===2?e=[S(e[0],!1),void 0,e[1]]:e[0]=S(e[0],!1),e[0].filter(r=>typeof r!="string"&&!(r instanceof P)&&!(r 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 e[0]=e[0].map(r=>r instanceof P?r:new P(r)),e}registry(...e){return T("realdom.realtime",this.window,this.namespace,...e)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(e,r,t){let{window:i}=this,o=new Set,s=new WeakMap;for(let[l,c]of this.registry(e)){let a=[].concat(r).filter(m=>z(i,l.context,m.target,l.params.subtree==="cross-roots",s));if(!a.length)continue;let f=[l,Array.isArray(r)?a:a[0]];c?o.add(f):t.call(i,...f)}for(let l of o)t.call(i,...l);o.clear()}disconnectables(e,...r){let t={disconnect(){r.forEach(i=>i&&w(i.disconnect)&&i.disconnect()||w(i)&&i()||x(i)&&(i.disconnected=!0))}};return e&&e.addEventListener("abort",()=>t.disconnect()),t}};var B=class extends U{type="attr";constructor(e,...r){super(e,"attr",...r)}get(e,r=void 0,t={}){let i=typeof e=="string"||e instanceof P;[e=[],r=void 0,t={}]=this.resolveArgs(arguments);let{context:o}=this,s=je(o,e);if(!r)return s;let l=t.lifecycleSignals&&this.createSignalGenerator();if(i)for(let c of s){let a=l?l.generate():{};r(c,a,o)}else{let c=l?.generate()||{};r(s,c,o)}if(t.live){l&&(t={...t,signalGenerator:l});let c=this.observe(i?e[0]:e,r,{newValue:!0,...t});return this.disconnectables(t.signal,c)}}observe(e,r,t={}){let i=typeof e=="string"||e instanceof P;if([e=[],r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(i?e[0]:e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:o,window:s,webqit:l}=this;t.eventDetails&&!l.realdom.attrInterceptionHooks?.intercepting&&He.call(s,"intercept",()=>{});let c=new s.MutationObserver(u=>{u=Le(u).map(p=>De.call(s,p)),ke.call(s,m,u,o)}),a={attributes:!0,attributeOldValue:t.oldValue,subtree:t.subtree&&!0};e.length&&(a.attributeFilter=e.map(u=>u+"")),c.observe(o,a);let f=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),m={context:o,spec:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:f,disconnectable:c};return this.disconnectables(t.signal,c,f)}observeSync(e,r,t={}){let i=typeof e=="string"||e instanceof P;[e,r,t={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let l=t.timing==="intercept"?"intercept":"sync";this.registry(l).size||He.call(s,l,u=>{this.forEachMatchingContext(l,u,ke)});let c={disconnect(){m.delete(f)}},a=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),f={context:o,spec:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:a,disconnectable:c},m=this.registry(l);return m.set(f,!!f.params.deferred),this.disconnectables(t.signal,c,a)}};function Le(n){return n.reduce((e,r,t)=>e[t-1]?.attributeName===r.attributeName||T(r.target,"internalAttrInteractions").get(r.attributeName)?e:e.concat(r),[])}function ke(n,e){let{context:r,spec:t,callback:i,params:o,atomics:s,originalFilterIsString:l,signalGenerator:c}=n;if(o.subtree||(e=e.filter(u=>u.target===r)),!e.length)return;let a=t.map(u=>u+"");if(o.atomic&&!s.size?e=je(r,t,e):o.timing!=="async"&&t.length&&(e=e.filter(u=>a.includes(u.name))),!e.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(e=e.map(u=>{let p;return o.eventDetails||({event:p,...u}=u),!o.oldValue&&"oldValue"in u&&({oldValue:p,...u}=u),!o.newValue&&"value"in u?{value:p,...u}=u:o.newValue&&typeof u.value>"u"&&(u={...u,value:ae(u.target,u.name,()=>u.target.getAttribute(u.name))}),u})),o.atomic&&(e.forEach(u=>s.set(u.name,u)),e=Array.from(s.entries()).map(([,u])=>u));let f=l?e[0]:e,m=c?c.generate():{};i(f,m,r)}function ae(n,e,r){let t=T(n,"internalAttrInteractions").get(e);T(n,"internalAttrInteractions").set(e,!0);let i=r();return T(n,"internalAttrInteractions").set(e,t),i}function je(n,e,r=[]){let t={event:null,type:"attribute"};return e.length?e.map(o=>(o=o+"",r.find(s=>s.name===o)||{target:n,name:o,value:ae(n,o,()=>n.getAttribute(o)),...t})):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:ae(n,o.nodeName,()=>o.nodeValue),...t})}function De({target:n,attributeName:e,value:r,oldValue:t}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[e]?.[0]||"mutation";return{target:n,name:e,value:r,oldValue:t,type:"observation",event:s}}function He(n,e){let r=this,{webqit:t,document:i,Element:o}=r;t.realdom.attrInterceptionHooks||Object.defineProperty(t.realdom,"attrInterceptionHooks",{value:new Map}),t.realdom.attrInterceptionHooks.has(n)||t.realdom.attrInterceptionHooks.set(n,new Set),t.realdom.attrInterceptionHooks.get(n).add(e);let s=()=>t.realdom.attrInterceptionHooks.get(n).delete(e);if(t.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),t.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(t.realdom,"attrInterceptionRecords",{value:new Map});let l=(f,m)=>{t.realdom.attrInterceptionRecords.has(f.target)||t.realdom.attrInterceptionRecords.set(f.target,{});let u=t.realdom.attrInterceptionRecords.get(f.target);if(u[f.name]=u[f.name]||[],u[f.name].unshift(f.event),T(f.target,"internalAttrInteractions").get(f.name))return m();t.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([f]));let p=m();return t.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([f])),p};new r.MutationObserver(f=>{f=f.filter(m=>!(r.webqit.realdom.attrInterceptionRecords?.get(m.target)||{})[m.attributeName]?.shift()),f=Le(f).map(m=>De.call(r,m)),f.length&&(t.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m(f)),t.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m(f)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let a=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(f=>{a[f]=o.prototype[f],o.prototype[f]=function(...m){let u,p=ae(this,m[0],()=>this.getAttribute(m[0]));["setAttribute","toggleAttribute"].includes(f)&&(u=m[1]),f==="toggleAttribute"&&u===void 0&&(u=p===null);let g={target:this,name:m[0],value:u,oldValue:p,type:"interception",event:[this,f]};return l(g,()=>a[f].call(this,...m))}}),s}var re=class extends U{constructor(e,...r){super(e,"tree",...r)}attr(e,r=void 0,t={}){let{context:i,window:o}=this;return new B(i,o).get(...arguments)}query(e,r=void 0,t={}){[e,r=void 0,t={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=a=>(o.has(a)||o.set(a,{target:a,entrants:[],exits:[],type:"query",event:null}),o.get(a));if(!t.generation||t.generation==="entrants"){if(!e.length)[...i.children].forEach(a=>s(i).entrants.push(a));else if(e.every(a=>a.type==="selector")){let[a,f]=e.reduce(([u,p],g)=>g.kind==="xpath"?[u,p.concat(g)]:[u.concat(g),p],[[],[]]),m=[];t.subtree?(a.length&&m.push(...i.querySelectorAll(a.join(","))),f.length&&m.push(...ie(this.window,i,f))):(a.length&&m.push(...[...i.children].filter(u=>u.matches(a))),f.length&&m.push(...ie(this.window,i,f,!1))),m.forEach(u=>s(u.parentNode||i).entrants.push(u))}}if(!r)return o;let l={disconnected:!1},c=r&&t.lifecycleSignals&&this.createSignalGenerator();for(let[,a]of o){if(l.disconnected)break;let f=c?.generate()||{};r(a,f,i)}if(t.live){c&&(t={...t,signalGenerator:c});let a=this.observe(e,r,t);return this.disconnectables(t.signal,l,a)}return this.disconnectables(t.signal,l,c)}children(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!1})}subtree(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!0})}observe(e,r,t={}){if([e,r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:i,window:o,webqit:s,document:l}=this;t.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(l.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Re.call(o,"sync",()=>{});let c=new o.MutationObserver(m=>m.forEach(u=>{xe.call(o,f,Be.call(o,u),i)}));c.observe(i,{childList:!0,subtree:t.subtree&&!0});let a=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),f={context:i,spec:e,callback:r,params:t,signalGenerator:a,disconnectable:c};if(t.staticSensitivity){let m=Fe.call(o,f);return this.disconnectables(t.signal,c,a,m)}return this.disconnectables(t.signal,c,a)}observeSync(e,r,t={}){[e,r,t={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let s=t.timing==="intercept"?"intercept":"sync";this.registry(s).size||Re.call(o,s,u=>{this.forEachMatchingContext(s,u,xe)});let l=new o.MutationObserver(u=>u.forEach(p=>{Array.isArray((p=Be.call(o,p)).event)||xe.call(o,f,p,i)}));l.observe(i,{childList:!0,subtree:t.subtree&&!0});let c={disconnect(){m.delete(f),l.disconnect()}},a=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),f={context:i,spec:e,callback:r,params:t,signalGenerator:a,disconnectable:c},m=this.registry(s);if(m.set(f,!!f.params.deferred),t.staticSensitivity){let u=Fe.call(o,f);return this.disconnectables(t.signal,c,a,u)}return this.disconnectables(t.signal,c,a)}track(e,r,t={}){return t={subtree:!0,...t},this.observe(e,i=>{i.entrants.length&&r(!0,Array.isArray(e)?i.entrants:i.entrants[0]),i.exits.length&&r(!1,Array.isArray(e)?i.exits:i.exits[0])},t)}};function Fe(n){let e=this,{context:r,spec:t,callback:i,params:o,signalGenerator:s}=n,l=t.filter(p=>p.kind==="css"),c=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],a=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],f=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(c(p)).concat(a(p));if(!(n.$attrs=Array.from(new Set(l.filter(p=>(p+"").includes("[")).reduce((p,g)=>p.concat(f(g+"")),[])))).length)return;let m=new Set,u=new Set;return m.push=p=>(u.delete(p),m.add(p)),u.push=p=>(m.delete(p),u.add(p)),n.$deliveryCache={entrants:m,exits:u},new B(r,e).observe(n.$attrs,p=>{let g=new Map,v=y=>(g.has(y)||g.set(y,{target:y,entrants:[],exits:[],type:"static",event:null}),g.get(y)),M=new WeakMap,h=y=>(M.has(y)||M.set(y,l.some($=>y.matches($+""))),M.get(y));for(let y of p)["entrants","exits"].forEach($=>{o.generation&&$!==o.generation||n.$deliveryCache[$].has(y.target)||($==="entrants"?!h(y.target):h(y.target))||(n.$deliveryCache[$].push(y.target),v(y.target)[$].push(y.target),v(y.target).event=y.event)});for(let[,y]of g){let $=s?.generate()||{};i(y,$,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function xe(n,e){let{context:r,spec:t,callback:i,params:o,signalGenerator:s,$deliveryCache:l}=n,c={...e,entrants:[],exits:[]};if(o.eventDetails||delete c.event,["entrants","exits"].forEach(f=>{if(!(o.generation&&f!==o.generation)&&(t.length?c[f]=dt.call(this,t,o.subtree==="cross-roots",e[f],e.event!=="parse"):c[f]=[...e[f]],!!l))for(let m of c[f])l[f].push(m)}),!c.entrants.length&&!c.exits.length)return;let a=s?.generate()||{};i(c,a,r)}function dt(n,e,r,t){r=Array.isArray(r)?r:[...r];let i=(o,s)=>{if(s.type==="selector"){let l=s.isXpathAttr?[]:o.filter(c=>s.kind==="xpath"?Ee(this,c,s+""):c.matches&&c.matches(s+""));if((t||s.isXpathAttr)&&(l=o.reduce((c,a)=>s.kind==="xpath"?[...c,...ie(this,a,s,t)]:a.querySelectorAll?[...c,...a.querySelectorAll(s+"")]:c,l)),l.length)return l}else if(o.includes(s.content)||t&&o.some(l=>z(this,l,s.content,e)))return[s.content]};return r.$$searchCache||(r.$$searchCache=new Map),n.reduce((o,s)=>{let l;return r.$$searchCache.has(s.content)?l=r.$$searchCache.get(s.content):(l=i(r,s)||[],s.type==="instance"&&r.$$searchCache.set(s.content,l)),o.concat(l)},[])}function Be({target:n,addedNodes:e,removedNodes:r}){let t=this,i;return i=S(e).reduce((o,s)=>o||t.webqit.realdom.domInterceptionRecords?.get(s),null),i=S(r).reduce((o,s)=>o||t.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||t.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:e,exits:r,type:"observation",event:i}}function Re(n,e){let r=this,{webqit:t,document:i,Node:o,CharacterData:s,Element:l,HTMLElement:c,HTMLTemplateElement:a,DocumentFragment:f}=r;t.realdom.domInterceptionHooks||Object.defineProperty(t.realdom,"domInterceptionHooks",{value:new Map}),t.realdom.domInterceptionNoRecurse||Object.defineProperty(t.realdom,"domInterceptionNoRecurse",{value:new Map}),t.realdom.domInterceptionHooks.has(n)||t.realdom.domInterceptionHooks.set(n,new Set),t.realdom.domInterceptionHooks.get(n).add(e);let m=()=>t.realdom.domInterceptionHooks.get(n).delete(e);if(t.realdom.domInterceptionHooks?.intercepting)return m;console.warn("DOM mutation APIs are now being intercepted."),t.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(t.realdom,"domInterceptionRecords",{value:new Map});let u=(h,y,$)=>{t.realdom.domInterceptionNoRecurse.set(h,y);let d=$();return t.realdom.domInterceptionNoRecurse.delete(h),d},p=(h,y)=>{h.entrants.concat(h.exits).forEach(d=>{clearTimeout(t.realdom.domInterceptionRecords.get(d)?.timeout),t.realdom.domInterceptionRecords.set(d,h.event);let b=setTimeout(()=>{t.realdom.domInterceptionRecords.delete(d)},0);Object.defineProperty(h.event,"timeout",{value:b,configurable:!0})}),t.realdom.domInterceptionHooks.get("intercept")?.forEach(d=>d(h));let $=y();return t.realdom.domInterceptionHooks.get("sync")?.forEach(d=>d(h)),$},g={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},v={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(g).reduce((h,y)=>h.concat(y),[])).forEach(h=>{Object.keys(g).forEach(d=>{if(!g[d].includes(h))return;let b=Object.getOwnPropertyDescriptor(r[d].prototype,h);!b||(Object.defineProperty(r[d].prototype,h,"value"in b?{...b,value:y}:{...b,set:$}),v[d][h]=b)});function y(...d){let b=Object.keys(v).find(N=>this instanceof r[N]&&h in v[N]),j=v[b],E=()=>j[h].value.call(this,...d);if(t.realdom.domInterceptionNoRecurse.get(this)===h)return E();let I=[],O=[],D=this;["insertBefore"].includes(h)?O=[d[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(h)?(O=[d[1]],["beforebegin","afterend"].includes(d[0])&&(D=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(h)?(I=[...this.childNodes],O=h==="replaceChildren"?[...d]:[d[0]]):["replaceWith","remove"].includes(h)?(I=[this],O=h==="replaceWith"?[...d]:[],D=this.parentNode):["replaceChild"].includes(h)?(I=[d[1]],O=[d[0]]):["removeChild"].includes(h)?I=[...d]:(O=[...d],["before","after"].includes(h)&&(D=this.parentNode));let ne=h;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(h)){let N=this.nodeName;if(h==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(d[0])){if(!this.parentNode)return j[h].value.call(this,...d);N=this.parentNode.nodeName}let F=i.createElement(N.includes("-")?"div":N);j.setHTMLUnsafe.value.call(F,O[0],h==="setHTMLUnsafe"?d[1]:{}),O=[...F.childNodes],h==="insertAdjacentHTML"?(ne="insertAdjacentElement",d[1]=new f,u(d[1],"append",()=>d[1].append(...F.childNodes))):(ne="replaceChildren",d=[...F.childNodes])}return p({target:D,entrants:O,exits:I,type:"interception",event:[this,h]},()=>j[ne].value.call(this,...d))}function $(d){let b=Object.keys(v).find(R=>this instanceof r[R]&&h in v[R]),j=v[b],E=()=>j[h].set.call(this,d);if(this instanceof HTMLScriptElement||t.realdom.domInterceptionNoRecurse.get(this)===h)return E();let I=[],O=[],D=this;if(["outerHTML","outerText"].includes(h)?(I=[this],D=this.parentNode):this instanceof a?(D=this.content,I=[...this.content.childNodes]):I=[...this.childNodes],["outerHTML","innerHTML"].includes(h)){let R=this.nodeName;if(h==="outerHTML"){if(!this.parentNode)return E();R=this.parentNode.nodeName}let N=i.createElement(R.includes("-")?"div":R);if(u(N,h,()=>N[h]=d),O=this instanceof a?[...N.content.childNodes]:[...N.childNodes],this instanceof a&&this.hasAttribute("src")||this instanceof ShadowRoot){let F=W=>W.reduce((k,H)=>H instanceof HTMLScriptElement?k.concat(H):H instanceof a?k.concat(F([H.content])):(k=k.concat(F([...H.querySelectorAll?.("template")||[]].map(ze=>ze.content))),k.concat(...H.querySelectorAll?.("script")||[])),[]);for(let W of F(O)){if(this instanceof ShadowRoot){W.setAttribute("data-handling","manual");continue}let k=i.createElement("script");[...W.attributes].forEach(H=>k.setAttribute(H.name,H.value)),k.textContent=W.textContent,u(W,"replaceWith",()=>W.replaceWith(k))}}h==="outerHTML"?(d=new f,u(d,"append",()=>d.append(...O)),E=()=>u(this,"replaceWith",()=>l.prototype.replaceWith.call(this,d))):this instanceof a?E=()=>u(this.content,"replaceChildren",()=>this.content.replaceChildren(...O)):E=()=>u(this,"replaceChildren",()=>l.prototype.replaceChildren.call(this,...O))}return p({target:D,entrants:O,exits:I,type:"interception",event:[this,h]},E)}}),m}function We(){pt.call(this),ht.call(this),gt.call(this)}function pt(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=e=>e.replace(/([\:@\~\$\&])/g,"\\$1"))}function ht(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function gt(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(e){for(var r=(this.document||this.ownerDocument).querySelectorAll(e),t=r.length;--t>=0&&r.item(t)!==this;);return t>-1})}function Ue(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},We.call(n),n.webqit.realdom.meta=(...r)=>_t.call(n,...r),n.webqit.realdom.ready=(...r)=>be.call(n,...r),n.webqit.realdom.realtime=(r,t="dom")=>{if(t==="dom")return new re(r,n);if(t==="attr")return new B(r,n)};let e=new te(n);return n.webqit.realdom.schedule=(r,...t)=>e[`on${r}`](...t),n.webqit.realdom.synthesizeWhile=(...r)=>e.synthesizeWhile(...r),n.webqit.realdom}function be(...n){let e="interactive",r;G(n[0])?(e=n[0],w(n[1])&&(r=n[1])):w(n[0])&&(r=n[0]);let t={interactive:["interactive","complete"],complete:["complete"]};if(!t[e])throw new Error(`Invalid ready-state timing: ${e}.`);let i=this;if(!r)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>be.call(this,"interactive",o)),complete:new Promise(o=>be.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[e];if(t[e].includes(i.document.readyState))return r(i);i.webqit.realdom.readyStateCallbacks||(i.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},i.document.addEventListener("readystatechange",()=>{let o=i.document.readyState;for(let s of i.webqit.realdom.readyStateCallbacks[o].splice(0))s(i)},!1)),i.webqit.realdom.readyStateCallbacks[e].push(r)}function _t(n){let e=this,r={},t;return(t=e.document.querySelector(`meta[name="${n}"]`))&&(r=(t.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(l=>l.trim());return ye(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:C(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return t.content},json(){return JSON.parse(JSON.stringify(r))}}}function fe(n,e){return typeof n!="string"?n:n.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+(typeof e!==void 0&&e?r.substr(1).toLowerCase():r.substr(1))})}var X=(...n)=>T("oohtml",...n),xt={};function Ge(n,e,r){let t=this,i=Ue.call(t);xt.window=t,t.webqitConfig||(t.webqitConfig=i.meta("webqit").json()),t.webqit||(t.webqit={}),t.webqit.oohtml||(t.webqit.oohtml={}),t.webqit.oohtml.configs||(t.webqit.oohtml.configs={});let o=n.toUpperCase().replace("-","_");if(!t.webqit.oohtml.configs[o]){t.webqit.oohtml.configs[o]={};let s=t.webqit.oohtml.configs[o];K(2,s,r,e,i.meta(n).json()),t.webqitConfig.prefix&&Object.keys(s).forEach(l=>{Object.keys(s[l]).forEach(c=>{l==="api"&&typeof s[l][c]=="string"?s[l][c]=`${t.webqitConfig.prefix}${fe(s[l][c])}`:["attr","elements"].includes(l)&&s[l][c]?.startsWith("data-")===!1&&(s[l][c]=`${t.webqitConfig.prefix}-${s[l][c]}`)})})}return{config:t.webqit.oohtml.configs[o],realdom:i,window:t}}function ce(n,e){return[...n].reduce(([r,t,i],o)=>!r&&t===0&&(Array.isArray(e)?e:[e]).includes(o)?[r,t,[""].concat(i)]:(!r&&["(","[","{"].includes(o)&&!i[0].endsWith("\\")&&t++,!r&&[")","]","}"].includes(o)&&!i[0].endsWith("\\")&&t--,['"',"'","`"].includes(o)&&!i[0].endsWith("\\")&&(r=r===o?null:r||o),i[0]+=o,[r,t,i]),[null,0,[""]])[2].reverse()}function Oe(n={}){let{config:e,window:r}=Ge.call(this,"data-binding",n,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:Ae({runtimeParams:{spec:{handler:i=>{}}}})});({CONTEXT_API:e.CONTEXT_API,BINDINGS_API:e.BINDINGS_API,HTML_IMPORTS:e.HTML_IMPORTS}=r.webqit.oohtml.configs),e.attrSelector=`[${r.CSS.escape(e.attr.render)}]`;let t=(i,o)=>{let s=`starts-with(., "${i}")`,l=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${l}`};e.discreteBindingsSelector=`comment()[${t(e.tokens.tagStart,e.tokens.tagEnd)}]`,bt.call(r,e)}function bt(n){let e=this,{webqit:{realdom:r}}=e;r.realtime(e.document).query(n.attrSelector,t=>{Xe.call(this,...t.exits),setTimeout(()=>{At.call(e,n,...t.entrants)},0)},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),r.realtime(e.document).query(`(${n.discreteBindingsSelector})`,t=>{setTimeout(()=>{Xe.call(this,...t.exits),$t.call(e,n,...t.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Qe(n,e){let{webqit:{realdom:r,Observer:t,DOMBindingsContext:i}}=this;if(X(e).has("data-binding"))return X(e).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(c,a,...f)=>{(()=>{try{c[a](...f)}catch(u){throw new Error(`Error executing "${a}()": ${u.message} at ${u.cause}`)}})()},o.$assign__=(c,a,f)=>{(()=>{try{c[a]=f}catch(u){throw new Error(`Error executing "${a} = ${f}": ${u.message} at ${u.cause}`)}})()},t.intercept(o,{get:(c,a,f)=>{if(!(c.key in o)){let m={...i.createRequest(c.key),live:!0,signal:s.signal};e[n.CONTEXT_API.api.contexts].request(m,u=>{t.set(o,c.key,u)})}return f(o[c.key]??(c.key in globalThis?globalThis[c.key]:void 0))},has:(c,a,f)=>f(!0)});let l={scope:o,abortController:s,bindings:new Map};return X(e).set("data-binding",l),l}function Xe(...n){for(let e of n){let r=e.nodeName==="#text"?e.parentNode:e,{bindings:t,abortController:i}=X(r).get("data-binding")||{};if(!t?.has(e))return;t.get(e).state.dispose(),t.get(e).signals?.forEach(o=>o.abort()),t.delete(e),t.size||(i.abort(),X(r).delete("data-binding"))}}function vt(n,e){let r=n.tokens.tagStart.split("").map(a=>`\\${a}`).join(""),t=n.tokens.tagEnd.split("").map(a=>`\\${a}`).join(""),i=n.tokens.stateStart.split("").map(a=>a===" "?"(?:\\s+)?":`\\${a}`).join(""),o=n.tokens.stateEnd.split("").map(a=>`\\${a}`).join(""),s=`^${r}(.*?)(?:${i}(\\d+)${o}(?:\\s+)?)?${t}$`,[,l,c]=e.match(new RegExp(s));return{raw:e,expr:l,span:parseInt(c??0)}}async function $t(n,...e){let r=this,t=e.reduce((i,o)=>{if(o.isBound)return i;let s=vt(n,o.nodeValue),l=o;if(s.span){if(l=o.nextSibling,l?.nodeName!=="#text"||l.nodeValue.length<s.span)return i;l.nodeValue.length>s.span&&l.splitText(s.span)}else l=o.ownerDocument.createTextNode(""),o.after(l);l.isBound=!0;let c=o;return r.webqit.env!=="server"&&(c.remove(),c=null),i.concat({textNode:l,template:s,anchorNode:c})},[]);for(let{textNode:i,template:o,anchorNode:s}of t){let l=Ot.call(r,n,o.expr),{scope:c,bindings:a}=Qe.call(this,n,i.parentNode);Object.defineProperty(i,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{a.set(i,{state:await(await l.bind(i,c)).execute()})}catch(f){console.log(f)}}}var ve=new Map;function Ot(n,e){if(ve.has(e))return ve.get(e);let r=`let content = ((${e}) ?? '') + '';`;r+="$assign__(this, 'nodeValue', content);",r+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${n.tokens.tagStart}${Q(e)}${n.tokens.stateStart}" + content.length + "${n.tokens.stateEnd} ${n.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:t}}=this,{parserParams:i,compilerParams:o,runtimeParams:s}=n.advanced,l=new t(r,{parserParams:i,compilerParams:o,runtimeParams:s});return ve.set(e,l),l}async function At(n,...e){for(let r of e){let t=St.call(this,n,r.getAttribute(n.attr.render)),{scope:i,bindings:o}=Qe.call(this,n,r),s=[];Object.defineProperty(r,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(r,{signals:s,state:await(await t.bind(r,i)).execute()})}catch(l){console.log(l)}}}var $e=new Map;function St(n,e){if($e.has(e))return $e.get(e);let r={},t=-1,i=ce(e,";").map(f=>{let[m,u]=ce(f,":").map(h=>h.trim()),p=m[0],g=m.slice(1).trim(),v=`(${u})`,M=`(${v} ?? '')`;if(p==="&")return g.startsWith("--")?`$exec__(this.style, 'setProperty', "${Q(g)}", ${M});`:`$assign__(this.style, "${Q(g)}", ${M});`;if(p==="%")return`$exec__(this.classList, 'toggle', "${Q(g)}", !!${v});`;if(p==="~")return g.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Q(g.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${Q(g)}", ${M});`;if(p==="#"){if(r[g])throw new Error(`Duplicate binding: ${m}.`);if(r[g]=!0,g==="text")return`$assign__(this, 'textContent', ${M});`;if(g==="html")return`$assign__(this, 'innerHTML', ${M});`;if(g==="items"){let[h,y]=ce(u,"/");if(!y)throw new Error(`Invalid ${p}items spec: ${f}; no import specifier.`);let[$,d,b,j]=h.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!$)throw new Error(`Invalid ${p}items spec: ${f}.`);if(d.startsWith("(")?d=d.trim().slice(1,-1).split(",").map(I=>I.trim()):d=[d],d.length>(b==="in"?3:2))throw new Error(`Invalid ${p}items spec: ${f}.`);let E=b==="in"?d[2]:d[1]||"$index__";return`
2
2
  let $iteratee__ = ${j};
3
3
  let $import__ = this.${n.HTML_IMPORTS.api.import}( ${y.trim()}, true );
4
4
  this.$oohtml_internal_databinding_signals?.push( $import__ );