jq79 0.3.3 → 0.3.5

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
@@ -1,14 +1,16 @@
1
1
 
2
2
  # jq79
3
3
 
4
- <img src="assets/Component79.svg" alt="jq79 logo" width="100" align="right">
4
+ <a href="https://jgermade.github.io/jq79/">
5
+ <img src="assets/Component79.svg" alt="jq79 logo" width="100" align="right">
6
+ </a>
5
7
 
6
8
  [![npm](https://jgermade.github.io/jq79/badges/npm.svg)](https://www.npmjs.com/package/jq79)
7
9
  [![coverage](https://jgermade.github.io/jq79/badges/coverage.svg)](https://jgermade.github.io/jq79/coverage/)
8
10
 
9
11
  A mini reactive component library that ships as a single file. Svelte-style reactive scripts, fine-grained DOM updates via proxy-based dependency tracking
10
12
 
11
- > no compiler, no virtual DOM, no dependencies.
13
+ > no compiler required, no virtual DOM, no dependencies.
12
14
 
13
15
  ## Installation
14
16
 
@@ -102,7 +104,7 @@ When the fetch resolves, the assignments to `firstName`/`lastName` re-run the `$
102
104
  ## Documentation
103
105
 
104
106
  - [Components](docs/components.md) — lifecycle (`mount`, `mountShadow`, `detach`, `destroy`), instance events (`on`/`off`), loading remote components with `Component79.fetch`.
105
- - [Template syntax](docs/template-syntax.md) — `{{ }}` interpolation, `:bind`, `:if`/`:elseif`/`:else`, `:each`/`:key`, `:with`, `@event` listeners and modifiers, nested components.
107
+ - [Template syntax](docs/template-syntax.md) — `{{ }}` interpolation, `:attrs`, `:if`/`:elseif`/`:else`, `:each`/`:key`, `:with`, `@event` listeners and modifiers, nested components.
106
108
  - [Setup scripts](docs/setup-scripts.md) — `<script :setup>` reactive scripts, `$:` declarations, `$emit`, `await $mounted()`, `$self`/`$$self`, and `export default` factory scripts (plain-JS alternative).
107
109
  - [Reactive data](docs/reactive-data.md) — the standalone `$reactive` store: `$on`, `$onAny`, `$effect`.
108
110
  - [DOM helpers](docs/dom-helpers.md) — `$`, `$$` and `$create`.
@@ -1,6 +1,7 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 410 410">
2
- <path fill="#4169e1" d="M0 0h400v400H0z" style="fill:#4169e1;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;,-apple-system,&quot;system-ui&quot;,&quot;Segoe UI&quot;,sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
3
- <text x="365" y="340" font-family="Arial, Helvetica, sans-serif" font-size="96" font-weight="700" style="fill:#000;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:Arial,Helvetica,sans-serif;font-size:96px;font-weight:700;text-anchor:end;dominant-baseline:auto" text-anchor="end">
4
- <tspan fill="#fff" style="fill:#fff;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:Arial,Helvetica,sans-serif;font-size:96px;font-weight:700;text-anchor:end;dominant-baseline:auto">jq</tspan><tspan fill="#f7df1e" style="fill:#f7df1e;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:Arial,Helvetica,sans-serif;font-size:96px;font-weight:700;text-anchor:end;dominant-baseline:auto">79</tspan>
5
- </text>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 410 410">
2
+ <path d="M0 0h410v410H0z" style="fill:#3178c6;fill-rule:nonzero"/>
3
+ <path d="M.001.221C.101.19.166.114.166-.034v-.51H.088v.508c0 .135-.053.171-.114.192zm.066-.924c0 .032.024.056.056.056A.055.055 0 0 0 .18-.703.055.055 0 0 0 .123-.76a.055.055 0 0 0-.056.057" style="fill:#fff;fill-rule:nonzero" transform="matrix(86 0 0 86 209.869 350)"/>
4
+ <path d="M.474-.52a.4.4 0 0 0-.155-.029c-.18 0-.265.123-.265.299 0 .186.094.26.206.26a.22.22 0 0 0 .134-.042h.004v.226h.076zm-.167.039q.055 0 .09.016v.354a.15.15 0 0 1-.115.053C.207-.058.133-.1.133-.26c0-.146.068-.221.174-.221" style="fill:#fff;fill-rule:nonzero" transform="matrix(86 0 0 86 231.627 350)"/>
5
+ <path d="M.33-.677h.029L.114 0H.085zm.07 0h.029L.185 0h-.03zm-.397 0h.286L.044 0H.015l.184-.509H.003v-.027h.205l.016-.043H.003v-.027h.231L.25-.649H.003z" style="fill:#f7df1e;fill-rule:nonzero" transform="matrix(96 0 0 96 279.53 350)"/>
6
+ <path d="M.289-.29a.1.1 0 0 1-.06-.016.1.1 0 0 1-.042-.043.1.1 0 0 1-.017-.06.1.1 0 0 1 .017-.06.1.1 0 0 1 .042-.042.113.113 0 0 1 .12 0q.028.015.043.042a.1.1 0 0 1 .016.06.1.1 0 0 1-.016.06.1.1 0 0 1-.043.043.1.1 0 0 1-.06.016m0-.21a.09.09 0 0 0-.079.045.1.1 0 0 0-.013.046q0 .025.013.047a.1.1 0 0 0 .033.032.1.1 0 0 0 .046.013.1.1 0 0 0 .046-.013.1.1 0 0 0 .034-.032.1.1 0 0 0 0-.093.1.1 0 0 0-.034-.033A.1.1 0 0 0 .289-.5m0 .279a.19.19 0 0 1-.162-.093.2.2 0 0 1-.025-.095.18.18 0 0 1 .093-.161.2.2 0 0 1 .094-.026q.05 0 .095.026a.2.2 0 0 1 .067.067.18.18 0 0 1 0 .189.189.189 0 0 1-.162.093m0-.348a.159.159 0 0 0-.138.08.15.15 0 0 0-.022.08q0 .044.022.081a.16.16 0 0 0 .057.057.15.15 0 0 0 .081.022.15.15 0 0 0 .081-.022.16.16 0 0 0 .057-.057.15.15 0 0 0 .022-.081.15.15 0 0 0-.022-.08.16.16 0 0 0-.138-.08m-.073.407A.26.26 0 0 1 .057-.3a.25.25 0 0 1 .011-.237.25.25 0 0 1 .092-.092.25.25 0 0 1 .259 0 .254.254 0 0 1 .113.304.3.3 0 0 1-.038.072l-.002.002-.001.001-.001.001L.296 0H.262l.137-.176a.3.3 0 0 1-.064.02L.213 0H.179l.118-.152H.29L.247-.155.125 0H.091zM.29-.637q-.063 0-.116.032a.2.2 0 0 0-.082.082.227.227 0 0 0 .198.344.23.23 0 0 0 .197-.344.2.2 0 0 0-.082-.082.2.2 0 0 0-.115-.032" style="fill:#f7df1e;fill-rule:nonzero" transform="matrix(100 0 0 100 316.748 350)"/>
6
7
  </svg>
Binary file
Binary file
Binary file
@@ -1,3 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 410 410" width="410" height="410"><path fill="#4169e1" d="M0 0h400v400H0z" style="fill:#4169e1;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;,-apple-system,&quot;system-ui&quot;,&quot;Segoe UI&quot;,sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"></path><text x="365" y="340" font-family="Arial, Helvetica, sans-serif" font-size="96" font-weight="700" style="fill:#000;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:Arial,Helvetica,sans-serif;font-size:96px;font-weight:700;text-anchor:end;dominant-baseline:auto" text-anchor="end">
2
- <tspan fill="#fff" style="fill:#fff;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:Arial,Helvetica,sans-serif;font-size:96px;font-weight:700;text-anchor:end;dominant-baseline:auto">jq</tspan><tspan fill="#f7df1e" style="fill:#f7df1e;stroke:none;color:#0b0b0b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:Arial,Helvetica,sans-serif;font-size:96px;font-weight:700;text-anchor:end;dominant-baseline:auto">79</tspan>
3
- </text></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 410 410" width="410" height="410"><path d="M0 0h410v410H0z" style="fill:#3178c6;fill-rule:nonzero"></path><path d="M.001.221C.101.19.166.114.166-.034v-.51H.088v.508c0 .135-.053.171-.114.192zm.066-.924c0 .032.024.056.056.056A.055.055 0 0 0 .18-.703.055.055 0 0 0 .123-.76a.055.055 0 0 0-.056.057" style="fill:#fff;fill-rule:nonzero" transform="matrix(86 0 0 86 209.869 350)"></path><path d="M.474-.52a.4.4 0 0 0-.155-.029c-.18 0-.265.123-.265.299 0 .186.094.26.206.26a.22.22 0 0 0 .134-.042h.004v.226h.076zm-.167.039q.055 0 .09.016v.354a.15.15 0 0 1-.115.053C.207-.058.133-.1.133-.26c0-.146.068-.221.174-.221" style="fill:#fff;fill-rule:nonzero" transform="matrix(86 0 0 86 231.627 350)"></path><path d="M.33-.677h.029L.114 0H.085zm.07 0h.029L.185 0h-.03zm-.397 0h.286L.044 0H.015l.184-.509H.003v-.027h.205l.016-.043H.003v-.027h.231L.25-.649H.003z" style="fill:#f7df1e;fill-rule:nonzero" transform="matrix(96 0 0 96 279.53 350)"></path><path d="M.289-.29a.1.1 0 0 1-.06-.016.1.1 0 0 1-.042-.043.1.1 0 0 1-.017-.06.1.1 0 0 1 .017-.06.1.1 0 0 1 .042-.042.113.113 0 0 1 .12 0q.028.015.043.042a.1.1 0 0 1 .016.06.1.1 0 0 1-.016.06.1.1 0 0 1-.043.043.1.1 0 0 1-.06.016m0-.21a.09.09 0 0 0-.079.045.1.1 0 0 0-.013.046q0 .025.013.047a.1.1 0 0 0 .033.032.1.1 0 0 0 .046.013.1.1 0 0 0 .046-.013.1.1 0 0 0 .034-.032.1.1 0 0 0 0-.093.1.1 0 0 0-.034-.033A.1.1 0 0 0 .289-.5m0 .279a.19.19 0 0 1-.162-.093.2.2 0 0 1-.025-.095.18.18 0 0 1 .093-.161.2.2 0 0 1 .094-.026q.05 0 .095.026a.2.2 0 0 1 .067.067.18.18 0 0 1 0 .189.189.189 0 0 1-.162.093m0-.348a.159.159 0 0 0-.138.08.15.15 0 0 0-.022.08q0 .044.022.081a.16.16 0 0 0 .057.057.15.15 0 0 0 .081.022.15.15 0 0 0 .081-.022.16.16 0 0 0 .057-.057.15.15 0 0 0 .022-.081.15.15 0 0 0-.022-.08.16.16 0 0 0-.138-.08m-.073.407A.26.26 0 0 1 .057-.3a.25.25 0 0 1 .011-.237.25.25 0 0 1 .092-.092.25.25 0 0 1 .259 0 .254.254 0 0 1 .113.304.3.3 0 0 1-.038.072l-.002.002-.001.001-.001.001L.296 0H.262l.137-.176a.3.3 0 0 1-.064.02L.213 0H.179l.118-.152H.29L.247-.155.125 0H.091zM.29-.637q-.063 0-.116.032a.2.2 0 0 0-.082.082.227.227 0 0 0 .198.344.23.23 0 0 0 .197-.344.2.2 0 0 0-.082-.082.2.2 0 0 0-.115-.032" style="fill:#f7df1e;fill-rule:nonzero" transform="matrix(100 0 0 100 316.748 350)"></path></svg>
@@ -15,7 +15,7 @@
15
15
  "purpose": "maskable"
16
16
  }
17
17
  ],
18
- "theme_color": "#4169E1",
19
- "background_color": "#4169E1",
18
+ "theme_color": "#ffffff",
19
+ "background_color": "#3178c6",
20
20
  "display": "standalone"
21
21
  }
Binary file
Binary file
package/dist/dom.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export declare const $: (selectorOrEl: string | Element, selector?: string) => Element | null;
2
2
  export declare const $$: (selectorOrEl: string | Element, selector?: string) => Element[];
3
3
  export declare const $create: (tag: string, attrs?: Record<string, any>) => HTMLElement;
4
+ export declare function isSafeUrl(value: string): boolean;
5
+ export declare function sanitizeHTML(html: string): string;
package/dist/jq79.cjs CHANGED
@@ -1,10 +1,10 @@
1
- var L=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var ft=(t,e,n)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ut=(t,e)=>{for(var n in e)L(t,n,{get:e[n],enumerable:!0})},pt=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of lt(e))!dt.call(t,r)&&r!==n&&L(t,r,{get:()=>e[r],enumerable:!(s=at(e,r))||s.enumerable});return t};var ht=t=>pt(L({},"__esModule",{value:!0}),t);var S=(t,e,n)=>ft(t,typeof e!="symbol"?e+"":e,n);var Ft={};ut(Ft,{$:()=>T,$$:()=>A,$create:()=>j,$reactive:()=>O,Component79:()=>C,parseComponent:()=>kt,renderComponent:()=>Tt});module.exports=ht(Ft);var T=(t,e)=>typeof t=="string"?document.querySelector(t):t.querySelector(e||""),A=(t,e)=>Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(e||"")),j=(t,e={})=>{let n=document.createElement(t);for(let[s,r]of Object.entries(e))if(s==="className")n.className=Array.isArray(r)?r.join(" "):r;else if(s==="textContent")n.textContent=r;else if(s==="children")for(let o of r)n.appendChild(o);else n.setAttribute(s,r);return n};var mt=(t,e)=>e.split(".").reduce((n,s)=>n?.[s],t),P=t=>{if(Array.isArray(t))return!0;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},K=(t,e,n)=>{Object.entries(t).forEach(([s,r])=>{let o=e?`${e}.${s}`:s;r&&typeof r=="object"&&P(r)?K(r,o,n):n(o,r)})},gt=(t,e)=>t===e||t.startsWith(`${e}.`)||e.startsWith(`${t}.`),v=[],V=t=>{v.push(new Set);try{return t()}finally{v.pop()}},O=t=>{let e=new Map,n=new Set,s=new Set,r=new WeakSet,o=(a,p,m=!1)=>{e.get(a)?.forEach(h=>h(p,a)),n.forEach(h=>h(a,p)),s.forEach(h=>{(m||Array.from(h.deps).some(g=>gt(g,a)))&&h.run()})},i=(a,p)=>{if(r.has(a))return a;Object.entries(a).forEach(([h,g])=>{g&&typeof g=="object"&&P(g)&&(a[h]=i(g,p?`${p}.${h}`:h))});let m=new Proxy(a,{get(h,g,u){return typeof g=="string"&&v[v.length-1]?.add(p?`${p}.${g}`:g),Reflect.get(h,g,u)},set(h,g,u,y){if(y!==m&&!Object.prototype.hasOwnProperty.call(h,g))return Reflect.set(h,g,u,y);let b=p?`${p}.${g}`:g;u&&typeof u=="object"&&P(u)&&(u=i(u,b));let R=!Object.prototype.hasOwnProperty.call(h,g);return h[g]=u,o(b,u,R),!0}});return r.add(m),m},c=i(t,""),l=(a,p,{immediate:m=!1}={})=>(e.has(a)||e.set(a,new Set),e.get(a).add(p),m&&p(mt(c,a),a),()=>e.get(a)?.delete(p)),d=(a,{immediate:p=!1}={})=>(n.add(a),p&&K(c,"",(m,h)=>a(m,h)),()=>n.delete(a)),f=a=>{let p={deps:new Set,run:()=>{let m=new Set;v.push(m);try{a()}finally{v.pop(),p.deps=m}}};return s.add(p),p.run(),()=>{s.delete(p)}};return Object.defineProperty(c,"$on",{value:l,enumerable:!1}),Object.defineProperty(c,"$onAny",{value:d,enumerable:!1}),Object.defineProperty(c,"$effect",{value:f,enumerable:!1}),c},N=t=>{let e=[];return{effect:n=>{e.push(t.$effect(n))},onDispose:n=>{e.push(n)},dispose:()=>{e.splice(0).forEach(n=>n())}}};var Z=/(?:let|var|const)\s+([A-Za-z_$][\w$]*)/y,G=/\$:\s*/y,D=/import(?=\s*\()/y,J=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,k=(t,e)=>{let n=t[e],s=e+1;for(;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s]===n)return s+1;s++}return t.length},F=(t,e)=>{let n=t.indexOf(`
2
- `,e);return n===-1?t.length:n},B=(t,e)=>{let n=t.indexOf("*/",e+2);return n===-1?t.length:n+2},yt=(t,e)=>{let n=0,s=e;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=k(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=F(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=B(t,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n<=0&&(r===`
3
- `||r===";"))return s;s++}return t.length},Q=t=>{let e=[],n="",s=0,r=0,o=!0;for(;s<t.length;){let i=t[s],c=t[s+1];if(i==="'"||i==='"'||i==="`"){let l=k(t,s);n+=t.slice(s,l),s=l,o=!1;continue}if(i==="/"&&(c==="/"||c==="*")){let l=c==="/"?F(t,s):B(t,s);n+=t.slice(s,l),s=l;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(D.lastIndex=s,D.test(t))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){Z.lastIndex=s;let l=Z.exec(t);if(l){e.push(l[1]),n+=l[1],s+=l[0].length,o=!1;continue}G.lastIndex=s;let d=G.exec(t);if(d){J.lastIndex=s;let f=J.exec(t);f&&e.push(f[1]);let a=s+d[0].length,p=yt(t,a);n+=`$__effect(() => { ${t.slice(a,p)} });`,s=p;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
4
- `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:e,code:n}},X=/export\s+default(?![\w$])/y,Y=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Et=t=>{let e=[],n=0,s=0;for(let r=0;r<=t.length;r++){let o=t[r];if(o==="{")n++;else if(o==="}")n--;else if(r===t.length||o===","&&n===0){let i=t.slice(s,r).trim();i&&e.push(i),s=r+1}}return e},bt=(t,e,n)=>{let s=`await $__import(${JSON.stringify(e)})`;if(t===void 0)return s;let r=Et(t),o=[],i=s;if(r.length>1){let c=`$__mod${n}`;o.push(`${c} = ${s}`),i=c}for(let c of r)c.startsWith("{")?o.push(`${c.replace(/\s+as\s+/g,": ")} = ${i}`):c.startsWith("*")?o.push(`${c.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${c} = $__default(${i})`);return`const ${o.join(", ")}`},tt=t=>{let e="",n=0,s=0,r=!0,o=!1,i=0;for(;n<t.length;){let c=t[n],l=t[n+1],d=n===0||!/[\w$.]/.test(t[n-1]);if(c==="'"||c==='"'||c==="`"){let f=k(t,n);e+=t.slice(n,f),n=f,r=!1;continue}if(c==="/"&&(l==="/"||l==="*")){let f=l==="/"?F(t,n):B(t,n);e+=t.slice(n,f),n=f;continue}if(c==="i"&&d){if(D.lastIndex=n,D.test(t)){e+="$__import",n+=6,r=!1;continue}if(s===0&&r){Y.lastIndex=n;let f=Y.exec(t);if(f){e+=bt(f[1],f[3],i++),n+=f[0].length,r=!1;continue}}}if(c==="e"&&d&&s===0&&r){X.lastIndex=n;let f=X.exec(t);if(f){o=!0,e+="$__exports.default =",n+=f[0].length,r=!1;continue}}"([{".includes(c)?s++:")]}".includes(c)&&(s=Math.max(0,s-1)),c===`
5
- `||c===";"||c==="}"?r=!0:/\s/.test(c)||(r=!1),e+=c,n++}return o?e:null};var rt=t=>Object.fromEntries(Array.from(t.attributes).map(e=>[e.name,e.value])),ot=t=>({tag:t.tagName.toLowerCase(),attrs:rt(t),children:Array.from(t.childNodes).flatMap(e=>{if(e.nodeType===Node.TEXT_NODE){let n=e.textContent?.trim()??"";return n?[n]:[]}return e.nodeType===Node.ELEMENT_NODE?[ot(e)]:[]})}),w=(t,e,n)=>{try{return new Function("$scope",...Object.keys(n??{}),`with ($scope) { return (${t}); }`)(e,...Object.values(n??{}))}catch{return}},St=(t,e)=>t.replace(/{{\s*(.+?)\s*}}/g,(n,s)=>w(s,e)??""),it=new Set([":bind",":if",":elseif",":else",":each",":key",":with"]),$t=/^\s*(\w+)\s+in\s+(.+)$/,wt=(t,e,n,s)=>{let[r,...o]=e.slice(1).split("."),i=new Set(o);t.addEventListener(r,c=>{if(i.has("self")&&c.target!==t)return;i.has("prevent")&&c.preventDefault(),i.has("stop")&&c.stopPropagation();let l=w(n,s,{$event:c});typeof l=="function"&&l.call(t,c)},{once:i.has("once"),capture:i.has("capture")})},et=t=>t.replace(/-(\w)/g,(e,n)=>n.toUpperCase()),nt=(t,e)=>{let n=e.replace(/-/g,"").toLowerCase();for(let s=t;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r;return null},st=(t,e,n,s)=>{let r=document.createComment(t),o=document.createDocumentFragment();o.appendChild(r);let i={};Object.entries(e.attrs).forEach(([f,a])=>{if(!(it.has(f)||f.startsWith("@")))if(f.startsWith(":")){let p=et(f.slice(1));i[p]=a||p}else i[et(f)]=JSON.stringify(a)});let c=null,l=null,d=null;return s.effect(()=>{let f=w(t,n),a=f instanceof C?f:null;if(a===l||(d?.dispose(),d=null,c?.destroy(),c=null,l=a,!a))return;let p=new C({template:a.template,scripts:a.scripts,styles:a.styles,modules:a.modules}),m=V(()=>Object.fromEntries(Object.entries(i).map(([u,y])=>[u,w(y,n)]))),h=document.createDocumentFragment();p.render(m).mount(h),r.parentNode.insertBefore(h,r.nextSibling);let g=N(n);Object.entries(i).forEach(([u,y])=>{g.effect(()=>{p.data[u]=w(y,n)})}),d=g,c=p}),s.onDispose(()=>{d?.dispose(),c?.destroy()}),o},Rt=(t,e)=>{let n=()=>{let s=w(t,e);return s!==null&&typeof s=="object"?s:null};return new Proxy(e,{has(s,r){let o=n();return o!==null&&Reflect.has(o,r)||Reflect.has(s,r)},get(s,r){let o=n();return o!==null&&Reflect.has(o,r)?o[r]:Reflect.get(s,r)},set(s,r,o){let i=n();return i!==null&&Reflect.has(i,r)?(i[r]=o,!0):Reflect.set(s,r,o)}})},W=(t,e,n)=>{let s=t.attrs[":with"],r=s!==void 0?Rt(s,e):e,o=nt(r,t.tag);if(o)return st(o,t,r,n);let i=document.createElement(t.tag);if(i instanceof HTMLUnknownElement||t.tag.includes("-")){let l=!1;n.effect(()=>{if(l)return;let d=nt(r,t.tag);d&&(l=!0,i.replaceWith(st(d,t,r,n)))})}Object.entries(t.attrs).forEach(([l,d])=>{l.startsWith("@")?wt(i,l,d,r):it.has(l)||i.setAttribute(l,d)});let c=t.attrs[":bind"];if(c!==void 0){let l=[];n.effect(()=>{l.forEach(f=>i.removeAttribute(f));let d=w(c,r);l=d&&typeof d=="object"?Object.keys(d):[],l.forEach(f=>{let a=d[f];a!=null&&a!==!1&&i.setAttribute(f,String(a))})})}return i.appendChild(U(t.children,r,n)),i},xt=(t,e,n)=>{let s=document.createComment("if"),r=document.createDocumentFragment();r.appendChild(s);let o=null,i=null,c=null;return n.effect(()=>{let l=t.find(d=>d.expr===void 0||w(d.expr,e))??null;l!==i&&(c?.dispose(),o&&o.parentNode?.removeChild(o),o=null,i=l,l&&(c=N(e),o=W(l.node,e,c),s.parentNode.insertBefore(o,s.nextSibling)))}),r},I=(t,e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})},Ct=(t,e,n)=>{let s=t.attrs[":each"].match($t);if(!s)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,r,o]=s,i=t.attrs[":key"],{[":each"]:c,[":key"]:l,...d}=t.attrs,f={...t,attrs:d},a=document.createComment("each"),p=document.createDocumentFragment();p.appendChild(a);let m=[];return n.effect(()=>{let h=w(o,e),g=Array.isArray(h)?h:[],u=new Map(m.map(E=>[E.key,E])),y=g.map((E,_)=>{let $=Object.create(e);I($,r,E),I($,"$index",_);let H=i!==void 0?w(i,$):_,x=u.get(H);if(x&&Object.is(x.item,E))return I(x.scope,"$index",_),x;x?.fx.dispose(),x?.node.parentNode?.removeChild(x.node);let z=N(e);return{key:H,item:E,scope:$,fx:z,node:W(f,$,z)}}),b=new Set(y.map(E=>E.key));m.forEach(E=>{b.has(E.key)||(E.fx.dispose(),E.node.parentNode?.removeChild(E.node))});let R=a;y.forEach(E=>{R.nextSibling!==E.node&&a.parentNode.insertBefore(E.node,R.nextSibling),R=E.node}),m=y}),p},U=(t,e,n)=>{let s=document.createDocumentFragment(),r=0;for(;r<t.length;){let o=t[r];if(typeof o=="string"){let i=document.createTextNode("");n.effect(()=>{i.textContent=St(o,e)}),s.appendChild(i),r++;continue}if(":each"in o.attrs){s.appendChild(Ct(o,e,n)),r++;continue}if(":if"in o.attrs){let i=[{expr:o.attrs[":if"],node:o}];for(r++;r<t.length&&typeof t[r]!="string"&&":elseif"in t[r].attrs;){let c=t[r];i.push({expr:c.attrs[":elseif"],node:c}),r++}r<t.length&&typeof t[r]!="string"&&":else"in t[r].attrs&&(i.push({node:t[r]}),r++),s.appendChild(xt(i,e,n));continue}s.appendChild(W(o,e,n)),r++}return s},Tt=(t,e)=>U(t.template,e,N(e)),vt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Nt=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,_t=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Ot=t=>t.split(_t).map((e,n)=>n%2===1?e:e.replace(Nt,(s,r,o)=>vt.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),Lt=t=>{let n=new DOMParser().parseFromString(`<template>${Ot(t)}</template>`,"text/html").querySelector("template"),s=[],r=[],o=[];return Array.from(n.content.children).forEach(i=>{let c={attrs:rt(i),content:i.textContent??""};i.tagName==="SCRIPT"?s.push(c):i.tagName==="STYLE"?r.push(c):o.push(ot(i))}),{template:o,scripts:s,styles:r}},q=t=>/\.html?([?#]|$)/.test(t)?C.fetch(t):import(t),M=new Map,At=t=>{let e=M.get(t);if(!e){let n=document.createElement("style");n.textContent=t,document.head.appendChild(n),e={el:n,count:0},M.set(t,e)}e.count++},jt=t=>{let e=M.get(t);e&&--e.count<=0&&(e.el.remove(),M.delete(t))},ct={$:T,$$:A,$create:j,$reactive:O},Dt=(t,e,n,s={},r=q)=>{let o={...ct,...s},i=new Proxy(e,{has:(l,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(l,d)||!(d in globalThis)&&!(d in o))});new Function("$scope","$__effect","$__import",...Object.keys(o),`return (async () => { with ($scope) { ${t} } })()`)(i,n,r,...Object.values(o)).catch(l=>console.error("jq79: error in :setup script",l))},Mt=t=>t&&t.default!==void 0?t.default:t,Pt=(t,e,n,s={},r=q)=>{let o={...ct,...s},i={},c=new Function("$__exports","$__default","$__import",...Object.keys(o),`return (async () => { "use strict";
6
- ${t}
7
- ;$__exports.done = true })()`)(i,Mt,r,...Object.values(o)),l=a=>console.error("jq79: error in factory script",a),d=!1,f=()=>{if(d)return;d=!0;let a=i.default;if(typeof a!="function")return;let p=h=>{h&&typeof h=="object"&&Object.assign(e,h)},m=a({$data:e,$effect:n,...s});m instanceof Promise?m.then(p).catch(l):p(m)};c.then(f,l),i.done&&f()},C=class t{constructor(e,n={}){S(this,"template");S(this,"scripts");S(this,"styles");S(this,"modules");S(this,"data",null);S(this,"fx",null);S(this,"content",null);S(this,"startMarker",null);S(this,"endMarker",null);S(this,"styleEls",[]);S(this,"ownsSharedStyles",!1);S(this,"useShadow",!1);S(this,"mountRoot",null);S(this,"resolveMounted",null);S(this,"emitListeners",new Map);let s=typeof e=="string"?Lt(e):e;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=n.modules??(typeof e=="string"?void 0:e.modules)}static async fetch(e){let n=await fetch(e);if(!n.ok)throw new Error(`failed to fetch component from ${e}: ${n.status}`);return new t(await n.text())}on(e,n){return this.emitListeners.has(e)||this.emitListeners.set(e,new Set),this.emitListeners.get(e).add(n),this}off(e,n){return this.emitListeners.get(e)?.delete(n),this}render(e={}){return this.renderWith(e,!1)}renderShadow(e={}){return this.renderWith(e,!0)}renderWith(e,n){this.destroy();let s=O({...e}),r=N(s);this.data=s,this.fx=r,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let o=this.startMarker,i=(u,y)=>{let b=new CustomEvent(u,{detail:y,bubbles:!0,composed:!0}),R=o.dispatchEvent(b);return o===this.startMarker&&this.emitListeners.get(u)?.forEach(E=>E(b,y)),R},c,l=new Promise(u=>{c=u});this.resolveMounted=c;let d=()=>l,f=this.endMarker,a=u=>{let y=[];for(let b=o.nextSibling;b&&b!==f;b=b.nextSibling)b instanceof Element&&(b.matches(u)&&y.push(b),y.push(...Array.from(b.querySelectorAll(u))));return y},p=u=>a(u)[0]??null,m=this.modules,h=u=>m&&u in m?Promise.resolve(m[u]):q(u);this.scripts.forEach(u=>{let y={$emit:i,$mounted:d,$self:p,$$self:a},b=tt(u.content);if(b!==null){let $=":mounted"in u.attrs?`await $mounted();
8
- ${b}`:b;Pt($,s,r.effect,y,h);return}let{vars:R,code:E}=Q(u.content);R.forEach($=>{$ in s||(s[$]=void 0)});let _=":mounted"in u.attrs?`await $mounted();
9
- ${E}`:E;Dt(_,s,r.effect,y,h)});let g=document.createDocumentFragment();return g.append(this.startMarker,U(this.template,s,r),this.endMarker),this.content=g,n?this.styleEls=this.styles.map(u=>{let y=document.createElement("style");return y.textContent=u.content,y}):(this.styles.forEach(u=>At(u.content)),this.ownsSharedStyles=!0),this}mount(e,n){let s=typeof e=="string"?T(e):e;if(!s)throw new Error(`mount target not found: ${e}`);return(!this.content||n!==void 0)&&this.renderWith(n??{},this.useShadow),this.attach(s)}mountShadow(e,n){let s=typeof e=="string"?T(e):e;if(!s)throw new Error(`mount target not found: ${e}`);return(!this.content||n!==void 0||!this.useShadow)&&this.renderWith(n??{},!0),this.attach(s)}attach(e){this.mountRoot&&this.detach();let n=this.useShadow&&e instanceof Element?e.shadowRoot??e.attachShadow({mode:"open"}):e;return this.useShadow&&this.styleEls.forEach(s=>n.appendChild(s)),n.appendChild(this.content),this.mountRoot=n,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let e=this.startMarker;for(;e;){let n=e.nextSibling;if(this.content.appendChild(e),e===this.endMarker)break;e=n}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.styleEls.forEach(e=>e.parentNode?.removeChild(e)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(e=>jt(e.content)),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},kt=t=>new C(t);0&&(module.exports={$,$$,$create,$reactive,Component79,parseComponent,renderComponent});
1
+ var O=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var fe=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ue=(e,t)=>{for(var n in t)O(e,n,{get:t[n],enumerable:!0})},pe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of le(t))!de.call(e,s)&&s!==n&&O(e,s,{get:()=>t[s],enumerable:!(r=ae(t,s))||r.enumerable});return e};var he=e=>pe(O({},"__esModule",{value:!0}),e);var b=(e,t,n)=>fe(e,typeof t!="symbol"?t+"":t,n);var Fe={};ue(Fe,{$:()=>C,$$:()=>A,$create:()=>D,$reactive:()=>_,Component79:()=>x,parseComponent:()=>ke,renderComponent:()=>Ce});module.exports=he(Fe);var C=(e,t)=>typeof e=="string"?document.querySelector(e):e.querySelector(t||""),A=(e,t)=>Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t||"")),D=(e,t={})=>{let n=document.createElement(e);for(let[r,s]of Object.entries(t))if(r==="className")n.className=Array.isArray(s)?s.join(" "):s;else if(r==="textContent")n.textContent=s;else if(r==="children")for(let o of s)n.appendChild(o);else n.setAttribute(r,s);return n};var me=(e,t)=>t.split(".").reduce((n,r)=>n?.[r],e),P=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},X=(e,t,n)=>{Object.entries(e).forEach(([r,s])=>{let o=t?`${t}.${r}`:r;s&&typeof s=="object"&&P(s)?X(s,o,n):n(o,s)})},ge=(e,t)=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`),N=[],G=e=>{N.push(new Set);try{return e()}finally{N.pop()}},_=e=>{let t=new Map,n=new Set,r=new Set,s=new WeakSet,o=(a,p,m=!1)=>{t.get(a)?.forEach(h=>h(p,a)),n.forEach(h=>h(a,p)),r.forEach(h=>{(m||Array.from(h.deps).some(g=>ge(g,a)))&&h.run()})},i=(a,p)=>{if(s.has(a))return a;Object.entries(a).forEach(([h,g])=>{g&&typeof g=="object"&&P(g)&&(a[h]=i(g,p?`${p}.${h}`:h))});let m=new Proxy(a,{get(h,g,u){return typeof g=="string"&&N[N.length-1]?.add(p?`${p}.${g}`:g),Reflect.get(h,g,u)},set(h,g,u,y){if(y!==m&&!Object.prototype.hasOwnProperty.call(h,g))return Reflect.set(h,g,u,y);let S=p?`${p}.${g}`:g;u&&typeof u=="object"&&P(u)&&(u=i(u,S));let T=!Object.prototype.hasOwnProperty.call(h,g);return h[g]=u,o(S,u,T),!0}});return s.add(m),m},c=i(e,""),l=(a,p,{immediate:m=!1}={})=>(t.has(a)||t.set(a,new Set),t.get(a).add(p),m&&p(me(c,a),a),()=>t.get(a)?.delete(p)),d=(a,{immediate:p=!1}={})=>(n.add(a),p&&X(c,"",(m,h)=>a(m,h)),()=>n.delete(a)),f=a=>{let p={deps:new Set,run:()=>{let m=new Set;N.push(m);try{a()}finally{N.pop(),p.deps=m}}};return r.add(p),p.run(),()=>{r.delete(p)}};return Object.defineProperty(c,"$on",{value:l,enumerable:!1}),Object.defineProperty(c,"$onAny",{value:d,enumerable:!1}),Object.defineProperty(c,"$effect",{value:f,enumerable:!1}),c},v=e=>{let t=[];return{effect:n=>{t.push(e.$effect(n))},onDispose:n=>{t.push(n)},dispose:()=>{t.splice(0).forEach(n=>n())}}};var K=/(?:let|var|const)\s+([A-Za-z_$][\w$]*)/y,V=/\$:\s*/y,M=/import(?=\s*\()/y,Z=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,k=(e,t)=>{let n=e[t],r=t+1;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]===n)return r+1;r++}return e.length},F=(e,t)=>{let n=e.indexOf(`
2
+ `,t);return n===-1?e.length:n},B=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},ye=(e,t)=>{let n=0,r=t;for(;r<e.length;){let s=e[r];if(s==="'"||s==='"'||s==="`"){r=k(e,r);continue}if(s==="/"&&e[r+1]==="/"){r=F(e,r);continue}if(s==="/"&&e[r+1]==="*"){r=B(e,r);continue}if("([{".includes(s))n++;else if(")]}".includes(s))n--;else if(n<=0&&(s===`
3
+ `||s===";"))return r;r++}return e.length},Q=e=>{let t=[],n="",r=0,s=0,o=!0;for(;r<e.length;){let i=e[r],c=e[r+1];if(i==="'"||i==='"'||i==="`"){let l=k(e,r);n+=e.slice(r,l),r=l,o=!1;continue}if(i==="/"&&(c==="/"||c==="*")){let l=c==="/"?F(e,r):B(e,r);n+=e.slice(r,l),r=l;continue}if(i==="i"&&(r===0||!/[\w$.]/.test(e[r-1]))&&(M.lastIndex=r,M.test(e))){n+="$__import",r+=6,o=!1;continue}if(s===0&&o){K.lastIndex=r;let l=K.exec(e);if(l){t.push(l[1]),n+=l[1],r+=l[0].length,o=!1;continue}V.lastIndex=r;let d=V.exec(e);if(d){Z.lastIndex=r;let f=Z.exec(e);f&&t.push(f[1]);let a=r+d[0].length,p=ye(e,a);n+=`$__effect(() => { ${e.slice(a,p)} });`,r=p;continue}}"([{".includes(i)?s++:")]}".includes(i)&&(s=Math.max(0,s-1)),i===`
4
+ `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,r++}return{vars:t,code:n}},J=/export\s+default(?![\w$])/y,Y=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Ee=e=>{let t=[],n=0,r=0;for(let s=0;s<=e.length;s++){let o=e[s];if(o==="{")n++;else if(o==="}")n--;else if(s===e.length||o===","&&n===0){let i=e.slice(r,s).trim();i&&t.push(i),r=s+1}}return t},Se=(e,t,n)=>{let r=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return r;let s=Ee(e),o=[],i=r;if(s.length>1){let c=`$__mod${n}`;o.push(`${c} = ${r}`),i=c}for(let c of s)c.startsWith("{")?o.push(`${c.replace(/\s+as\s+/g,": ")} = ${i}`):c.startsWith("*")?o.push(`${c.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${c} = $__default(${i})`);return`const ${o.join(", ")}`},ee=e=>{let t="",n=0,r=0,s=!0,o=!1,i=0;for(;n<e.length;){let c=e[n],l=e[n+1],d=n===0||!/[\w$.]/.test(e[n-1]);if(c==="'"||c==='"'||c==="`"){let f=k(e,n);t+=e.slice(n,f),n=f,s=!1;continue}if(c==="/"&&(l==="/"||l==="*")){let f=l==="/"?F(e,n):B(e,n);t+=e.slice(n,f),n=f;continue}if(c==="i"&&d){if(M.lastIndex=n,M.test(e)){t+="$__import",n+=6,s=!1;continue}if(r===0&&s){Y.lastIndex=n;let f=Y.exec(e);if(f){t+=Se(f[1],f[3],i++),n+=f[0].length,s=!1;continue}}}if(c==="e"&&d&&r===0&&s){J.lastIndex=n;let f=J.exec(e);if(f){o=!0,t+="$__exports.default =",n+=f[0].length,s=!1;continue}}"([{".includes(c)?r++:")]}".includes(c)&&(r=Math.max(0,r-1)),c===`
5
+ `||c===";"||c==="}"?s=!0:/\s/.test(c)||(s=!1),t+=c,n++}return o?t:null};var se=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),oe=e=>({tag:e.tagName.toLowerCase(),attrs:se(e),children:Array.from(e.childNodes).flatMap(t=>{if(t.nodeType===Node.TEXT_NODE){let n=t.textContent?.trim()??"";return n?[n]:[]}return t.nodeType===Node.ELEMENT_NODE?[oe(t)]:[]})}),w=(e,t,n)=>{try{return new Function("$scope",...Object.keys(n??{}),`with ($scope) { return (${e}); }`)(t,...Object.values(n??{}))}catch{return}},be=(e,t)=>e.replace(/{{\s*(.+?)\s*}}/g,(n,r)=>w(r,t)??""),ie=new Set([":attrs",":if",":elseif",":else",":each",":key",":with"]),$e=/^\s*(\w+)\s+in\s+(.+)$/,we=(e,t,n,r)=>{let[s,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(s,c=>{if(i.has("self")&&c.target!==e)return;i.has("prevent")&&c.preventDefault(),i.has("stop")&&c.stopPropagation();let l=w(n,r,{$event:c});typeof l=="function"&&l.call(e,c)},{once:i.has("once"),capture:i.has("capture")})},te=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),ne=(e,t)=>{let n=t.replace(/-/g,"").toLowerCase();for(let r=e;r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let s of Object.keys(r))if(/^[A-Z]/.test(s)&&s.replace(/-/g,"").toLowerCase()===n)return s;return null},re=(e,t,n,r)=>{let s=document.createComment(e),o=document.createDocumentFragment();o.appendChild(s);let i={};Object.entries(t.attrs).forEach(([f,a])=>{if(!(ie.has(f)||f.startsWith("@")))if(f.startsWith(":")){let p=te(f.slice(1));i[p]=a||p}else i[te(f)]=JSON.stringify(a)});let c=null,l=null,d=null;return r.effect(()=>{let f=w(e,n),a=f instanceof x?f:null;if(a===l||(d?.dispose(),d=null,c?.destroy(),c=null,l=a,!a))return;let p=new x({template:a.template,scripts:a.scripts,styles:a.styles,modules:a.modules}),m=G(()=>Object.fromEntries(Object.entries(i).map(([u,y])=>[u,w(y,n)]))),h=document.createDocumentFragment();p.render(m).mount(h),s.parentNode.insertBefore(h,s.nextSibling);let g=v(n);Object.entries(i).forEach(([u,y])=>{g.effect(()=>{p.data[u]=w(y,n)})}),d=g,c=p}),r.onDispose(()=>{d?.dispose(),c?.destroy()}),o},Te=(e,t)=>{let n=()=>{let r=w(e,t);return r!==null&&typeof r=="object"?r:null};return new Proxy(t,{has(r,s){let o=n();return o!==null&&Reflect.has(o,s)||Reflect.has(r,s)},get(r,s){let o=n();return o!==null&&Reflect.has(o,s)?o[s]:Reflect.get(r,s)},set(r,s,o){let i=n();return i!==null&&Reflect.has(i,s)?(i[s]=o,!0):Reflect.set(r,s,o)}})},W=(e,t,n)=>{let r=e.attrs[":with"],s=r!==void 0?Te(r,t):t,o=ne(s,e.tag);if(o)return re(o,e,s,n);let i=document.createElement(e.tag);if(i instanceof HTMLUnknownElement||e.tag.includes("-")){let l=!1;n.effect(()=>{if(l)return;let d=ne(s,e.tag);d&&(l=!0,i.replaceWith(re(d,e,s,n)))})}Object.entries(e.attrs).forEach(([l,d])=>{l.startsWith("@")?we(i,l,d,s):ie.has(l)||i.setAttribute(l,d)});let c=e.attrs[":attrs"];if(c!==void 0){let l=[];n.effect(()=>{l.forEach(f=>i.removeAttribute(f));let d=w(c,s);l=d&&typeof d=="object"?Object.keys(d):[],l.forEach(f=>{let a=d[f];a!=null&&a!==!1&&i.setAttribute(f,String(a))})})}return i.appendChild(U(e.children,s,n)),i},Re=(e,t,n)=>{let r=document.createComment("if"),s=document.createDocumentFragment();s.appendChild(r);let o=null,i=null,c=null;return n.effect(()=>{let l=e.find(d=>d.expr===void 0||w(d.expr,t))??null;l!==i&&(c?.dispose(),o&&o.parentNode?.removeChild(o),o=null,i=l,l&&(c=v(t),o=W(l.node,t,c),r.parentNode.insertBefore(o,r.nextSibling)))}),s},I=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},xe=(e,t,n)=>{let r=e.attrs[":each"].match($e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,s,o]=r,i=e.attrs[":key"],{[":each"]:c,[":key"]:l,...d}=e.attrs,f={...e,attrs:d},a=document.createComment("each"),p=document.createDocumentFragment();p.appendChild(a);let m=[];return n.effect(()=>{let h=w(o,t),g=Array.isArray(h)?h:[],u=new Map(m.map(E=>[E.key,E])),y=g.map((E,L)=>{let $=Object.create(t);I($,s,E),I($,"$index",L);let H=i!==void 0?w(i,$):L,R=u.get(H);if(R&&Object.is(R.item,E))return I(R.scope,"$index",L),R;R?.fx.dispose(),R?.node.parentNode?.removeChild(R.node);let z=v(t);return{key:H,item:E,scope:$,fx:z,node:W(f,$,z)}}),S=new Set(y.map(E=>E.key));m.forEach(E=>{S.has(E.key)||(E.fx.dispose(),E.node.parentNode?.removeChild(E.node))});let T=a;y.forEach(E=>{T.nextSibling!==E.node&&a.parentNode.insertBefore(E.node,T.nextSibling),T=E.node}),m=y}),p},U=(e,t,n)=>{let r=document.createDocumentFragment(),s=0;for(;s<e.length;){let o=e[s];if(typeof o=="string"){let i=document.createTextNode("");n.effect(()=>{i.textContent=be(o,t)}),r.appendChild(i),s++;continue}if(":each"in o.attrs){r.appendChild(xe(o,t,n)),s++;continue}if(":if"in o.attrs){let i=[{expr:o.attrs[":if"],node:o}];for(s++;s<e.length&&typeof e[s]!="string"&&":elseif"in e[s].attrs;){let c=e[s];i.push({expr:c.attrs[":elseif"],node:c}),s++}s<e.length&&typeof e[s]!="string"&&":else"in e[s].attrs&&(i.push({node:e[s]}),s++),r.appendChild(Re(i,t,n));continue}r.appendChild(W(o,t,n)),s++}return r},Ce=(e,t)=>U(e.template,t,v(t)),Ne=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ve=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Le=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,_e=e=>e.split(Le).map((t,n)=>n%2===1?t:t.replace(ve,(r,s,o)=>Ne.has(s.toLowerCase())?r:`<${s}${o}></${s}>`)).join(""),Oe=e=>{let n=new DOMParser().parseFromString(`<template>${_e(e)}</template>`,"text/html").querySelector("template"),r=[],s=[],o=[];return Array.from(n.content.children).forEach(i=>{let c={attrs:se(i),content:i.textContent??""};i.tagName==="SCRIPT"?r.push(c):i.tagName==="STYLE"?s.push(c):o.push(oe(i))}),{template:o,scripts:r,styles:s}},q=e=>/\.html?([?#]|$)/.test(e)?x.fetch(e):import(e),j=new Map,Ae=e=>{let t=j.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},j.set(e,t)}t.count++},De=e=>{let t=j.get(e);t&&--t.count<=0&&(t.el.remove(),j.delete(e))},ce={$:C,$$:A,$create:D,$reactive:_},Me=(e,t,n,r={},s=q)=>{let o={...ce,...r},i=new Proxy(t,{has:(l,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(l,d)||!(d in globalThis)&&!(d in o))});new Function("$scope","$__effect","$__import",...Object.keys(o),`return (async () => { with ($scope) { ${e} } })()`)(i,n,s,...Object.values(o)).catch(l=>console.error("jq79: error in :setup script",l))},je=e=>e&&e.default!==void 0?e.default:e,Pe=(e,t,n,r={},s=q)=>{let o={...ce,...r},i={},c=new Function("$__exports","$__default","$__import",...Object.keys(o),`return (async () => { "use strict";
6
+ ${e}
7
+ ;$__exports.done = true })()`)(i,je,s,...Object.values(o)),l=a=>console.error("jq79: error in factory script",a),d=!1,f=()=>{if(d)return;d=!0;let a=i.default;if(typeof a!="function")return;let p=h=>{h&&typeof h=="object"&&Object.assign(t,h)},m=a({$data:t,$effect:n,...r});m instanceof Promise?m.then(p).catch(l):p(m)};c.then(f,l),i.done&&f()},x=class e{constructor(t,n={}){b(this,"template");b(this,"scripts");b(this,"styles");b(this,"modules");b(this,"data",null);b(this,"fx",null);b(this,"content",null);b(this,"startMarker",null);b(this,"endMarker",null);b(this,"styleEls",[]);b(this,"ownsSharedStyles",!1);b(this,"useShadow",!1);b(this,"mountRoot",null);b(this,"resolveMounted",null);b(this,"emitListeners",new Map);let r=typeof t=="string"?Oe(t):t;this.template=r.template,this.scripts=r.scripts,this.styles=r.styles,this.modules=n.modules??(typeof t=="string"?void 0:t.modules)}static async fetch(t){let n=await fetch(t);if(!n.ok)throw new Error(`failed to fetch component from ${t}: ${n.status}`);return new e(await n.text())}on(t,n){return this.emitListeners.has(t)||this.emitListeners.set(t,new Set),this.emitListeners.get(t).add(n),this}off(t,n){return this.emitListeners.get(t)?.delete(n),this}render(t={}){return this.renderWith(t,!1)}renderShadow(t={}){return this.renderWith(t,!0)}renderWith(t,n){this.destroy();let r=_({...t}),s=v(r);this.data=r,this.fx=s,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let o=this.startMarker,i=(u,y)=>{let S=new CustomEvent(u,{detail:y,bubbles:!0,composed:!0}),T=o.dispatchEvent(S);return o===this.startMarker&&this.emitListeners.get(u)?.forEach(E=>E(S,y)),T},c,l=new Promise(u=>{c=u});this.resolveMounted=c;let d=()=>l,f=this.endMarker,a=u=>{let y=[];for(let S=o.nextSibling;S&&S!==f;S=S.nextSibling)S instanceof Element&&(S.matches(u)&&y.push(S),y.push(...Array.from(S.querySelectorAll(u))));return y},p=u=>a(u)[0]??null,m=this.modules,h=u=>m&&u in m?Promise.resolve(m[u]):q(u);this.scripts.forEach(u=>{let y={$emit:i,$mounted:d,$self:p,$$self:a},S=ee(u.content);if(S!==null){let $=":mounted"in u.attrs?`await $mounted();
8
+ ${S}`:S;Pe($,r,s.effect,y,h);return}let{vars:T,code:E}=Q(u.content);T.forEach($=>{$ in r||(r[$]=void 0)});let L=":mounted"in u.attrs?`await $mounted();
9
+ ${E}`:E;Me(L,r,s.effect,y,h)});let g=document.createDocumentFragment();return g.append(this.startMarker,U(this.template,r,s),this.endMarker),this.content=g,n?this.styleEls=this.styles.map(u=>{let y=document.createElement("style");return y.textContent=u.content,y}):(this.styles.forEach(u=>Ae(u.content)),this.ownsSharedStyles=!0),this}mount(t,n){let r=typeof t=="string"?C(t):t;if(!r)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0)&&this.renderWith(n??{},this.useShadow),this.attach(r)}mountShadow(t,n){let r=typeof t=="string"?C(t):t;if(!r)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0||!this.useShadow)&&this.renderWith(n??{},!0),this.attach(r)}attach(t){this.mountRoot&&this.detach();let n=this.useShadow&&t instanceof Element?t.shadowRoot??t.attachShadow({mode:"open"}):t;return this.useShadow&&this.styleEls.forEach(r=>n.appendChild(r)),n.appendChild(this.content),this.mountRoot=n,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let t=this.startMarker;for(;t;){let n=t.nextSibling;if(this.content.appendChild(t),t===this.endMarker)break;t=n}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.styleEls.forEach(t=>t.parentNode?.removeChild(t)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(t=>De(t.content)),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},ke=e=>new x(e);0&&(module.exports={$,$$,$create,$reactive,Component79,parseComponent,renderComponent});
10
10
  //# sourceMappingURL=jq79.cjs.map