jq79 0.4.16 → 0.4.18

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
@@ -127,7 +127,7 @@ When the fetch resolves, the assignments to `firstName`/`lastName` re-run the `$
127
127
  ## Documentation
128
128
 
129
129
  - [Tutorial](https://jgermade.github.io/jq79/tutorial/) — learn it by doing, in the browser.
130
- - [Components](docs/components.md) — lifecycle (`mount`, `mountShadow`, `detach`, `destroy`), instance events (`on`/`off`), `<style scoped>`, several components in one file with `<template name>`, loading remote components with `Component79.fetch` (chainable — fetch and mount in one expression) and `fetchAll`.
130
+ - [Components](docs/components.md) — lifecycle (`mount`, `mountShadow`, `detach`, `destroy`), instance events (`on`/`off`), `<style scoped>`, several components in one file with `<template name>`, loading remote components with `Component79.fetch` (chainable — fetch and mount in one expression) and `fetchAll`, and `Component79.version`.
131
131
  - [Template syntax](docs/template-syntax.md) — `{{ }}` interpolation, `:attrs`, `:text`/`:html`, `:if`/`:elseif`/`:else`, `:each`/`:key`, `:with`, `@event` listeners and modifiers, nested components.
132
132
  - [Setup scripts](docs/setup-scripts.md) — `<script :setup>` reactive scripts, `$:` declarations, `$emit`, `await $mounted()`, `$self`/`$$self`, and `export default` factory scripts (plain-JS alternative).
133
133
  - [Reactive data](docs/reactive-data.md) — the standalone `$reactive` store: `$on`, `$onAny`, `$effect`.
package/dist/jq79.cjs CHANGED
@@ -1,14 +1,14 @@
1
- var Q=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var me=(t,n,e)=>n in t?Q(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var ge=(t,n)=>{for(var e in n)Q(t,e,{get:n[e],enumerable:!0})},ye=(t,n,e,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of pe(n))!he.call(t,o)&&o!==e&&Q(t,o,{get:()=>n[o],enumerable:!(s=de(n,o))||s.enumerable});return t};var be=t=>ye(Q({},"__esModule",{value:!0}),t);var _=(t,n,e)=>me(t,typeof n!="symbol"?n+"":n,e);var jn={};ge(jn,{$:()=>B,$$:()=>tt,$create:()=>et,$reactive:()=>X,C79:()=>F,Component79:()=>F,PendingComponent79:()=>ft,enableHotReload:()=>ue,hotUpdate:()=>ce,parseComponent:()=>An,renderComponent:()=>rn});module.exports=be(jn);function B(t,n){return typeof t=="string"?document.querySelector(t):t.querySelector(n)}function tt(t,n){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(n))}var et=(t,n={})=>{let e=document.createElement(t);for(let[s,o]of Object.entries(n))if(s==="className")e.className=Array.isArray(o)?o.join(" "):o;else if(s==="textContent")e.textContent=o;else if(s==="children")for(let i of o)e.appendChild(i);else e.setAttribute(s,o);return e},Ee=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),Nt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},we=new Set(["http:","https:","mailto:"]);function Se(t){try{let n=new URL(t,"https://example.com");return we.has(n.protocol)}catch{return!1}}var Re={"https:":"443","http:":"80"};function $e(t){let n=t.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!n)return null;let[,e,s]=n,o=e.split(".");return o.some(r=>r!=="*"&&!/^[a-z\d-]+$/.test(r))?null:{host:new RegExp(`^${o.map(r=>r==="*"?"[^.]+":r).join("\\.")}$`),port:!s||s==="*"?null:s}}var _t=t=>{let n=(Array.isArray(t)?t:t.split(",")).map($e).filter(e=>e!==null);return e=>{let s=e.hostname.toLowerCase(),o=e.port||Re[e.protocol]||"";return n.some(i=>i.host.test(s)&&(i.port===null||i.port===o))}};function Te(t,n,e,s){try{return!!t(new URL(n,document.baseURI),e,s)}catch{return!1}}var Ot=512;function Lt(t,n,e,s){if(e>Ot)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${Ot} elements`);for(let o of Array.from(t.childNodes))if(o.nodeType===Node.ELEMENT_NODE){let i=xe(o,e,s);i&&n.appendChild(i)}else o.nodeType===Node.TEXT_NODE&&n.appendChild(o.cloneNode())}function xe(t,n,e){let s=t.tagName.toLowerCase();if(!Ee.has(s))return null;let o=document.createElement(s);for(let i of Array.from(t.attributes)){let r=i.name.toLowerCase(),a=Nt[s]?.has(r),u=Nt["*"]?.has(r);!a&&!u||(r==="href"||r==="src")&&(!Se(i.value)||e&&!Te(e,i.value,s,r))||o.setAttribute(r,i.value)}return s==="a"&&o.setAttribute("rel","noopener noreferrer"),Lt(t,o,n+1,e),o}function vt(t,n){let e=document.createElement("template");e.innerHTML=t;let s=document.createElement("div");return Lt(e.content,s,0,n?.allowUrl),s.innerHTML}var Ce=(t,n)=>n.split(".").reduce((e,s)=>e?.[s],t),Mt=t=>{if(Array.isArray(t))return!0;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Dt=(t,n,e)=>{Object.entries(t).forEach(([s,o])=>{let i=n?`${n}.${s}`:s;o&&typeof o=="object"&&Mt(o)?Dt(o,i,e):e(i,o)})},Ae=(t,n)=>t===n||t.startsWith(`${n}.`)||n.startsWith(`${t}.`),ht=Symbol("jq79.raw"),nt=t=>{let n=t;for(;n!==null&&typeof n=="object"&&n[ht];)n=n[ht];return n},qt=Symbol("jq79.store"),G=t=>t!==null&&typeof t=="object"&&t[qt]===!0,z=[],K=t=>{z.push(new Set);try{return t()}finally{z.pop()}},Pt="$__attach",st=Symbol("jq79.alsoWakenBy"),X=t=>{let n=new Map,e=new Set,s=new Set,o=new WeakMap,i=Object.create(null),r=(h,g,$=!1)=>{n.get(h)?.forEach(w=>w(g,h)),e.forEach(w=>w(h,g)),s.forEach(w=>{($||Array.from(w.deps).some(c=>Ae(c,h)))&&w.run()})},a=h=>h!==null&&typeof h=="object"&&Mt(h),u=new Map,p=(h,g)=>{let $=u.get(g);$?.store!==h&&($?.unsubscribe(),u.set(g,{store:h,unsubscribe:h.$onAny((w,c)=>r(`${g}.${w}`,c))}))},d=h=>{u.get(h)?.unsubscribe(),u.delete(h)},m=(h,g)=>{let $=o.get(h);if($)return $;let w=null,c=new Proxy(h,{has(f,l){return Reflect.has(f,l)||typeof l=="string"&&w?.has(l)===!0},get(f,l,T){if(l===ht)return f;if(l===qt)return g==="";if(typeof l!="string")return Reflect.get(f,l,T);if(g===""&&l in i)return i[l];let j=g?`${g}.${l}`:l;z[z.length-1]?.add(j);let N=Reflect.get(f,l,T);if(G(N))return p(N,j),N;let b=nt(N);return a(b)?m(b,j):b},set(f,l,T,j){if(j!==c&&!Object.prototype.hasOwnProperty.call(f,l))return Reflect.set(f,l,T,j);let N=g?`${g}.${l}`:l,b=G(T)?T:nt(T),L=!Object.prototype.hasOwnProperty.call(f,l);if(!L&&Object.is(f[l],b)&&(b===null||typeof b!="object"))return!0;f[l]=b,w?.delete(l),G(b)?p(b,N):d(N);let v=G(b)||!a(b)?b:m(b,N);return r(N,v,L),!0},deleteProperty(f,l){if(typeof l!="string")return Reflect.deleteProperty(f,l);let T=Object.prototype.hasOwnProperty.call(f,l),j=Reflect.deleteProperty(f,l);if(j&&T){let N=g?`${g}.${l}`:l;(w??(w=new Set)).add(l),d(N),r(N,void 0)}return j}});return o.set(h,c),c},E=m(nt(t),"");Object.entries(nt(t)).forEach(([h,g])=>{G(g)&&p(g,h)});let O=(h,g,{immediate:$=!1}={})=>(n.has(h)||n.set(h,new Set),n.get(h).add(g),$&&g(Ce(E,h),h),()=>n.get(h)?.delete(g)),x=(h,{immediate:g=!1}={})=>(e.add(h),g&&Dt(E,"",($,w)=>h($,w)),()=>e.delete(h)),y=(h,g)=>{let $=!1,w=!1,c={deps:new Set,run:()=>{if($){w=!0;return}$=!0;try{let f=0;do{w=!1;let l=new Set;z.push(l);try{h()}finally{z.pop(),c.deps=l}}while(w&&++f<100);w&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{$=!1}}};return s.add(c),g?.length?S(c,g):(c.run(),()=>{s.delete(c)})},S=(h,g)=>{let $=g.map(w=>w?.[Pt]?.(h)).filter(Boolean);return h.run(),()=>{s.delete(h),$.forEach(w=>w())}},R=h=>(s.add(h),()=>{s.delete(h)}),A=()=>{u.forEach(({unsubscribe:h})=>h()),u.clear()};return i.$on=O,i.$onAny=x,i.$effect=y,i.$dispose=A,i[Pt]=R,E},k=t=>{let n=[],e=[],s=t[st];return{effect:o=>{n.push(t.$effect(o,s)),e.push(o)},onDispose:o=>{n.push(o)},refresh:()=>{e.forEach(o=>o())},dispose:()=>{n.splice(0).forEach(o=>o()),e.length=0}}};var Wt=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Ut=/\$:\s*/y,rt=/import(?=\s*\()/y,Ft=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,q=(t,n)=>{let e=t[n],s=n+1;for(;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s]===e)return s+1;s++}return t.length},M=(t,n)=>{let e=t.indexOf(`
2
- `,n);return e===-1?t.length:e},D=(t,n)=>{let e=t.indexOf("*/",n+2);return e===-1?t.length:e+2},ot=(t,n)=>{let e=n;for(;e<t.length;){if(/\s/.test(t[e])){e++;continue}if(t[e]==="/"&&t[e+1]==="/"){e=M(t,e);continue}if(t[e]==="/"&&t[e+1]==="*"){e=D(t,e);continue}break}return e},je=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),W=(t,n)=>{let e=n-1;for(;e>=0;){let o=t[e];if(/\s/.test(o)){e--;continue}if(o==="/"&&t[e-1]==="*"){let i=t.lastIndexOf("/*",e-2);if(i===-1)return!0;e=i-1;continue}break}if(e<0)return!0;let s=t[e];if(/[\w$]/.test(s)){let o=e;for(;o>0&&/[\w$]/.test(t[o-1]);)o--;return je.has(t.slice(o,e+1))}return(s==="+"||s==="-")&&t[e-1]===s?!1:!")]}\"'`.".includes(s)},U=(t,n)=>{let e=n+1,s=!1;for(;e<t.length;){let o=t[e];if(o==="\\"){e+=2;continue}if(o===`
3
- `)return e;if(o==="[")s=!0;else if(o==="]")s=!1;else if(o==="/"&&!s){for(e++;e<t.length&&/[a-z]/i.test(t[e]);)e++;return e}e++}return t.length},Ne=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Oe=(t,n)=>{let e=n-1;for(;e>=0;){let s=t[e];if(/\s/.test(s)){e--;continue}if(s==="/"&&t[e-1]==="*"){let o=t.lastIndexOf("/*",e-2);if(o===-1)return"";e=o-1;continue}return s}return""},kt=(t,n)=>{let e=0,s=n;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=q(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(o==="/"&&W(t,s)){s=U(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else{if(e<=0&&o===";")return s;if(e<=0&&o===`
4
- `){let i=ot(t,s+1);if(!(i<t.length&&(Ne.test(t.slice(i,i+2))||[",","="].includes(Oe(t,s)))))return s;s=i;continue}}s++}return t.length},_e=t=>{let n=[],e=0,s=0,o=0,i=a=>{n.push({raw:t.slice(s,a),codeEnd:Math.max(0,o-s)}),s=a+1,o=s},r=0;for(;r<t.length;){let a=t[r];if(a==="'"||a==='"'||a==="`"){r=q(t,r),o=r;continue}if(a==="/"&&t[r+1]==="/"){r=M(t,r);continue}if(a==="/"&&t[r+1]==="*"){r=D(t,r);continue}if(a==="/"&&W(t,r)){r=U(t,r),o=r;continue}if("([{".includes(a))e++;else if(")]}".includes(a))e--;else if(a===","&&e<=0){i(r),r++;continue}/\s/.test(a)||(o=r+1),r++}return i(t.length),n},mt=t=>{let n=t.trim();if(!n.startsWith("{")&&!n.startsWith("["))return at.test(n)?[n]:[];let e=[];for(let s of yt(n.slice(1,Ht(n)))){s.startsWith("...")&&(s=s.slice(3).trim());let o=bt(s);if(o!==-1&&(s=s.slice(0,o).trim()),n.startsWith("{")){let i=gt(s,":");if(i!==-1){e.push(...mt(s.slice(i+1)));continue}}e.push(...mt(s))}return e},Le=t=>{let n=[],e=_e(t).map(({raw:i,codeEnd:r})=>{let a=i.match(/^\s*/)[0];if(r<=a.length)return{text:i,empty:!0};let u=i.slice(a.length,r),p=i.slice(r),d=bt(u),m=(d===-1?u:u.slice(0,d)).trim(),E=u[0]==="{"||u[0]==="[";E?n.push(...mt(m)):at.test(m)&&n.push(m);let O=lt(u).code;return{text:`${a}${E?`(${O})`:O}${p}`,empty:!1}}),s=[];for(;e.length&&e[e.length-1].empty;)s.unshift(e.pop().text);let o=e.map(i=>i.text).join(",")+s.join("");return o.trimStart().startsWith("(")&&(o=`;${o}`),{vars:n,code:o}},lt=t=>{let n=[],e="",s=0,o=0,i=!0;for(;s<t.length;){let r=t[s],a=t[s+1];if(r==="'"||r==='"'||r==="`"){let u=q(t,s);e+=t.slice(s,u),s=u,i=!1;continue}if(r==="/"&&(a==="/"||a==="*")){let u=a==="/"?M(t,s):D(t,s);e+=t.slice(s,u),s=u;continue}if(r==="/"&&W(t,s)){let u=U(t,s);e+=t.slice(s,u),s=u,i=!1;continue}if(r==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(rt.lastIndex=s,rt.test(t))){e+="$__import",s+=6,i=!1;continue}if(o===0&&i){Wt.lastIndex=s;let u=Wt.exec(t);if(u){let d=s+u[0].length,m=kt(t,d),{vars:E,code:O}=Le(t.slice(d,m));n.push(...E),e+=O,s=m,i=!1;continue}Ut.lastIndex=s;let p=Ut.exec(t);if(p){Ft.lastIndex=s;let d=Ft.exec(t);d&&n.push(d[1]);let m=s+p[0].length,E=kt(t,m);e+=`$__effect(() => { ${lt(t.slice(m,E)).code} });`,s=E;continue}}"([{".includes(r)?o++:")]}".includes(r)&&(o=Math.max(0,o-1)),r===`
5
- `||r===";"||r==="}"?i=!0:/\s/.test(r)||(i=!1),e+=r,s++}return{vars:n,code:e}},it=/export\s+default(?![\w$])/y,It=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,ve=t=>{let n=[],e=0,s=0;for(let o=0;o<=t.length;o++){let i=t[o];if(i==="{")e++;else if(i==="}")e--;else if(o===t.length||i===","&&e===0){let r=t.slice(s,o).trim();r&&n.push(r),s=o+1}}return n},Pe=(t,n,e)=>{let s=`await $__import(${JSON.stringify(n)})`;if(t===void 0)return s;let o=ve(t),i=[],r=s;if(o.length>1){let a=`$__mod${e}`;i.push(`${a} = ${s}`),r=a}for(let a of o)a.startsWith("{")?i.push(`${a.replace(/\s+as\s+/g,": ")} = ${r}`):a.startsWith("*")?i.push(`${a.replace(/^\*\s*as\s+/,"")} = ${r}`):i.push(`${a} = $__default(${r})`);return`const ${i.join(", ")}`},at=/^[A-Za-z_$][\w$]*$/,Ht=t=>{let n=0,e=0;for(;e<t.length;){let s=t[e];if(s==="'"||s==='"'||s==="`"){e=q(t,e);continue}if(s==="/"&&t[e+1]==="/"){e=M(t,e);continue}if(s==="/"&&t[e+1]==="*"){e=D(t,e);continue}if(s==="/"&&W(t,e)){e=U(t,e);continue}if("([{".includes(s))n++;else if(")]}".includes(s)&&--n===0)return e;e++}return t.length},gt=(t,n)=>{let e=0,s=0;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=q(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(o==="/"&&o!==n&&W(t,s)){s=U(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else if(e===0&&o===n)return s;s++}return-1},yt=t=>{let n=[],e=0,s=0,o=0;for(;o<=t.length;){let i=t[o];if(i==="'"||i==='"'||i==="`"){o=q(t,o);continue}if(i==="/"&&t[o+1]==="/"){o=M(t,o);continue}if(i==="/"&&t[o+1]==="*"){o=D(t,o);continue}if(i==="/"&&W(t,o)){o=U(t,o);continue}if(i!==void 0&&"([{".includes(i))e++;else if(i!==void 0&&")]}".includes(i))e--;else if(o===t.length||i===","&&e===0){let r=t.slice(s,o).trim();r&&n.push(r),s=o+1}o++}return n},bt=t=>{let n=0;for(;n<t.length;){let e=gt(t.slice(n),"=");if(e===-1)return-1;let s=n+e;if(t[s+1]!=="="&&t[s+1]!==">"&&t[s-1]!=="="&&t[s-1]!=="!")return s;n=s+1}return-1},J=t=>{let n=(t??"").trim();if(!n.startsWith("{"))return null;let e=Ht(n);if(e>=n.length)return null;let s=[];for(let o of yt(n.slice(1,e))){if(o.startsWith("..."))continue;let i=bt(o),r=i===-1?o:o.slice(0,i),a=i===-1?void 0:o.slice(i+1).trim(),u=gt(r,":"),p=(u===-1?r:r.slice(0,u)).trim();if(!at.test(p))continue;let d={name:p};a!==void 0&&(d.default=a);let m=u===-1?"":r.slice(u+1).trim();at.test(m)&&(d.as=m),s.push(d)}return s},Me=t=>{let n=0,e=0,s=!0;for(;n<t.length;){let o=t[n];if(o==="'"||o==='"'||o==="`"){n=q(t,n),s=!1;continue}if(o==="/"&&t[n+1]==="/"){n=M(t,n);continue}if(o==="/"&&t[n+1]==="*"){n=D(t,n);continue}if(o==="/"&&W(t,n)){n=U(t,n),s=!1;continue}if(o==="e"&&e===0&&s&&(n===0||!/[\w$.]/.test(t[n-1]))){it.lastIndex=n;let i=it.exec(t);if(i)return n+i[0].length}"([{".includes(o)?e++:")]}".includes(o)&&(e=Math.max(0,e-1)),o===`
6
- `||o===";"||o==="}"?s=!0:/\s/.test(o)||(s=!1),n++}return-1},De=/^async(?![\w$])/,qe=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,We=t=>{let n=Me(t);if(n===-1)return null;let e=ot(t,n),s=t.slice(e);De.test(s)&&(e=ot(t,e+5));let o=qe.exec(t.slice(e));if(o&&(e=ot(t,e+o[0].length)),t[e]!=="(")return null;let i=0,r=e;for(;r<t.length;){let a=t[r];if(a==="'"||a==='"'||a==="`"){r=q(t,r);continue}if(a==="/"&&t[r+1]==="/"){r=M(t,r);continue}if(a==="/"&&t[r+1]==="*"){r=D(t,r);continue}if(a==="/"&&W(t,r)){r=U(t,r);continue}if("([{".includes(a))i++;else if(")]}".includes(a)&&--i===0)break;r++}return yt(t.slice(e+1,r))[0]??""},Et=t=>{let n=We(t);if(n===null)return null;let e=J(n),s=e?.find(o=>o.name.startsWith("$"))?.name;if(s)throw new Error(`jq79: the factory signature is (props, ctx), so \`${s}\` can't be destructured from the first parameter. Write \`export default (props, { ${s} }) => \u2026\`, or \`_\` in place of props if the component takes none.`);return e},Bt=t=>{let n="",e=0,s=0,o=!0,i=!1,r=0;for(;e<t.length;){let a=t[e],u=t[e+1],p=e===0||!/[\w$.]/.test(t[e-1]);if(a==="'"||a==='"'||a==="`"){let d=q(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(a==="/"&&(u==="/"||u==="*")){let d=u==="/"?M(t,e):D(t,e);n+=t.slice(e,d),e=d;continue}if(a==="/"&&W(t,e)){let d=U(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(a==="i"&&p){if(rt.lastIndex=e,rt.test(t)){n+="$__import",e+=6,o=!1;continue}if(s===0&&o){It.lastIndex=e;let d=It.exec(t);if(d){n+=Pe(d[1],d[3],r++),e+=d[0].length,o=!1;continue}}}if(a==="e"&&p&&s===0&&o){it.lastIndex=e;let d=it.exec(t);if(d){i=!0,n+="$__exports.default =",e+=d[0].length,o=!1;continue}}"([{".includes(a)?s++:")]}".includes(a)&&(s=Math.max(0,s-1)),a===`
7
- `||a===";"||a==="}"?o=!0:/\s/.test(a)||(o=!1),n+=a,e++}return i?n:null};var Qt=t=>Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value])),te=t=>({tag:t.tagName.toLowerCase(),attrs:Qt(t),children:Array.from((t instanceof HTMLTemplateElement?t.content:t).childNodes).flatMap(n=>{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";return e?[e]:[]}return n.nodeType===Node.ELEMENT_NODE?[te(n)]:[]})}),zt=new Map,ee=(t,n)=>{let e=`${n.join(",")}|${t}`,s=zt.get(e);if(s===void 0){try{s=new Function("$scope",...n,`with ($scope) { return (${t}
8
- ); }`)}catch{s=null}zt.set(e,s)}return s},C=(t,n,e)=>{let s=ee(t,e?Object.keys(e):[]);if(s)try{return s(n,...e?Object.values(e):[])}catch{return}},Ue=(t,n)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(e,s)=>C(s,n)??""),Fe=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),$t=t=>Fe.has(t)||t.startsWith(":class.")||t.startsWith(":props.")||t===":slot"||t.startsWith(":slot."),ke=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Ie=(t,n,e,s)=>{let[o,...i]=n.slice(1).split("."),r=new Set(i);t.addEventListener(o,a=>{if(r.has("self")&&a.target!==t)return;r.has("prevent")&&a.preventDefault(),r.has("stop")&&a.stopPropagation();let u=C(e,s,{$event:a});typeof u=="function"&&u.call(t,a)},{once:r.has("once"),capture:r.has("capture")})},He=(t,n,e,s)=>{let[o,...i]=n.slice(1).split("."),r=new Set(i),a=u=>{r.has("prevent")&&u.preventDefault(),r.has("stop")&&u.stopPropagation(),r.has("once")&&t.off(o,a),K(()=>{let p=C(e,s,{$event:u});typeof p=="function"&&p(u)})};t.on(o,a)},I=t=>t.replace(/-(\w)/g,(n,e)=>e.toUpperCase()),Tt=t=>t instanceof DocumentFragment?{first:t.firstChild,last:t.lastChild}:{first:t,last:t},ct=({first:t,last:n})=>{for(let e=t;e;){let s=e===n?null:e.nextSibling;e.parentNode?.removeChild(e),e=s}},Be=({first:t,last:n},e)=>{let s=e.nextSibling;for(let o=t;o;){let i=o===n?null:o.nextSibling;e.parentNode.insertBefore(o,s),o=i}},Zt=(t,n)=>{let e=n.replace(/-/g,"").toLowerCase();for(let s=t;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let o of Object.keys(s))if(/^[A-Z]/.test(o)&&o.replace(/-/g,"").toLowerCase()===e)return o;return null},Gt=200,wt=0,ne=Symbol("jq79.slots"),ze=t=>t==="slot"||t.startsWith("slot."),se=t=>t?I(t):"default",xt=t=>Object.keys(t.attrs).find(n=>n===":slot"||n.startsWith(":slot.")),Ze=t=>t==="default"?":slot":`:slot.${t}`,Ge=t=>typeof t!="string"||t.trim()!=="",Ke=t=>{let n={},e=[];t.children.forEach(o=>{let i=typeof o=="object"&&o.tag==="template"?xt(o):void 0;if(typeof o=="string"||i===void 0){e.push(o);return}let r=se(i.slice(6));if(r in n){console.warn(`jq79: two <template ${Ze(r)}> in <${t.tag}>; the second was ignored`);return}n[r]={nodes:o.children,binder:o.attrs[i]||void 0}});let s=e.some(Ge);return s&&"default"in n?console.warn(`jq79: <${t.tag}> has both a <template :slot> and content outside it - the <template> is the default slot's content, and the rest was ignored`):s&&(n.default={nodes:e,binder:t.attrs[":slot"]||void 0}),n},Xe=(t,n,e)=>{J(n)?.forEach(({name:s,as:o,default:i})=>{let r=o??s;Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>{let a=e[s]?.();return a===void 0&&i!==void 0?C(i,t):a},set:()=>console.warn(`jq79: "${r}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},Je=t=>{let n=xt(t);return console.warn(`jq79: <template ${n}> fills a slot only as a direct child of a component tag; here it rendered nothing`),document.createComment(`misplaced ${n}`)},Ve=(t,n)=>{let e=Object.entries(Ke(t));if(!e.length)return null;let s={};return e.forEach(([o,i])=>{s[o]=Ye(i,n)}),s},Ye=(t,n)=>(e,s,o,i)=>{let r=Object.create(n);Xe(r,t.binder,e);let a=r[st]??[];Object.defineProperty(r,st,{value:[...a,s]});let u=k(r);return o.onDispose(()=>u.dispose()),Z(t.nodes,r,u,i)},Qe=(t,n,e,s)=>{let o=se(t.tag.slice(5)),i=document.createDocumentFragment(),r=document.createComment(t.tag),a=document.createComment(`/${t.tag}`);i.append(r,a);let u=n[ne]?.[o];if(!u)return i.insertBefore(Z(t.children,n,e,s),a),i;let p={};return Object.entries(t.attrs).forEach(([d,m])=>{if(!(d===dt||$t(d)||d.startsWith("@")))if(d.startsWith(":")){let E=m||d.slice(1);p[I(d.slice(1))]=()=>C(E,n)}else p[I(d)]=()=>m}),i.insertBefore(u(p,n,e,s),a),i},Kt=(t,n,e,s,o)=>{let i=document.createComment(t),r=document.createComment(`/${t}`),a=document.createDocumentFragment();a.append(i,r);let u=Ve(n,e),p={},d={},m=[],E=[],O=!1;Object.entries(n.attrs).forEach(([c,f])=>{if(c!==dt){if(c===":props"||c.startsWith(":props.")){O=!0,E.push({expr:f});return}if(!$t(c))if(c.startsWith("@"))m.push([c,f]);else if(c===":model"||c.startsWith(":model.")){let l=c===":model"?"default":I(c.slice(7));d[l]=f||(c===":model"?"model":l)}else if(c.startsWith(":")){let l=I(c.slice(1));p[l]=f||l,E.push({name:l,expr:f||l})}else{let l=I(c),T=JSON.stringify(f);p[l]=T,E.push({name:l,expr:T})}}});let x=c=>c==="default"?":model":`:model.${c}`,y=c=>c==="default"?"model":c,S=c=>`${c}
9
- = $value`;Object.entries(d).forEach(([c,f])=>{let l=y(c);p[l]!==void 0&&console.warn(`jq79: <${n.tag}> binds prop "${l}" through both :${l} and ${x(c)} - ${x(c)} wins`),p[l]=f,ee(S(f),["$value"])===null&&console.warn(`jq79: ${x(c)}="${f}" is not assignable - updates from <${n.tag}> will be dropped`)});let R=()=>{let c={};return E.forEach(({name:f,expr:l})=>{if(f!==void 0)c[f]=C(l,e);else{let T=C(l,e);T!==null&&typeof T=="object"&&Object.assign(c,T)}}),Object.entries(d).forEach(([f,l])=>{c[y(f)]=C(l,e)}),c},A=null,h=null,g=null,$=new Set,w=c=>{if(c==null){if(!e[le]?.has(t)||$.has("unfilled"))return;$.add("unfilled"),console.error(`jq79: <${n.tag}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${t}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}$.has("type")||($.add("type"),console.error(`jq79: <${n.tag}> is ${typeof c}, not a component - nothing renders here`))};return s.effect(()=>{let c=C(t,e),f=c instanceof F?c:null;if(f||w(c),f===h||(g?.dispose(),g=null,A?.destroy(),A=null,h=f,!f))return;let l=new F({template:f.template,scripts:f.scripts,styles:f.styles,modules:f.modules,filename:f.filename,siblings:f.siblings,name:f.name});if(u&&(l.slots=u),Object.keys(d).length){let b=new Set,L=(v,P)=>{b.has(v)||(b.add(v),console.warn(P))};l.on("model:update",(v,P)=>{if(P===null||typeof P!="object"){L("payload",`jq79: model:update expects a { name?, value } payload, got ${P===null?"null":typeof P}`);return}let pt=P.name==null?"default":I(String(P.name)),jt=d[pt];if(jt===void 0){L(pt,`jq79: <${n.tag}> has no ${x(pt)} - bound: ${Object.keys(d).map(x).join(", ")}`);return}K(()=>C(S(jt),e,{$value:P.value}))})}m.forEach(([b,L])=>He(l,b,L,e));let T=K(R),j=document.createDocumentFragment();if(wt>=Gt){console.error(`jq79: <${n.tag}> is ${Gt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}wt++;try{(o?l.renderShadow(T):l.render(T)).mount(j)}finally{wt--}r.parentNode.insertBefore(j,r);let N=k(e);if(O){let b=[];N.effect(()=>{let L=R(),v=Object.keys(L);b.forEach(P=>{P in L||(l.data[P]=void 0)}),v.forEach(P=>{l.data[P]=L[P]}),b=v})}else Object.entries(p).forEach(([b,L])=>{N.effect(()=>{l.data[b]=C(L,e)})});g=N,A=l}),s.onDispose(()=>{g?.dispose(),A?.destroy()}),a},tn=(t,n)=>{let e=()=>{let s=C(t,n);return s!==null&&typeof s=="object"?s:null};return new Proxy(n,{has(s,o){let i=e();return i!==null&&Reflect.has(i,o)||Reflect.has(s,o)},get(s,o){let i=e();return i!==null&&Reflect.has(i,o)?i[o]:Reflect.get(s,o)},set(s,o,i){let r=e();return r!==null&&Reflect.has(r,o)?(r[o]=i,!0):Reflect.set(s,o,i)}})},Y=t=>typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t.flatMap(Y):t!==null&&typeof t=="object"?Object.entries(t).flatMap(([n,e])=>e?Y(n):[]):[],en=t=>typeof t=="function"?(n,e,s)=>{try{return!!t(n,e,s)}catch{return!1}}:typeof t=="string"||Array.isArray(t)?_t(t):()=>!1,Ct=(t,n,e,s)=>{let o=t.attrs[":with"],i=o!==void 0?tn(o,n):n;if(ze(t.tag))return Qe(t,i,e,s);if(t.tag==="template"&&xt(t)!==void 0)return Je(t);let r=Zt(i,t.tag);if(r)return Kt(r,t,i,e,s);let a=document.createElement(t.tag);if(a instanceof HTMLUnknownElement||t.tag.includes("-")){let y=!1;e.effect(()=>{if(y)return;let S=Zt(i,t.tag);if(!S)return;y=!0;let R=Kt(S,t,i,e,s),A=Tt(R);e.onDispose(()=>ct(A)),a.replaceWith(R)})}Object.entries(t.attrs).forEach(([y,S])=>{y.startsWith("@")?Ie(a,y,S,i):y===":model"||y.startsWith(":model.")?a instanceof HTMLUnknownElement||t.tag.includes("-")||console.warn(`jq79: ${y} on <${t.tag}> does nothing - :model binds component tags only (for now)`):$t(y)||a.setAttribute(y,S)});let u=t.attrs[":attrs"];if(u!==void 0){let y=[];e.effect(()=>{y.forEach(R=>a.removeAttribute(R));let S=C(u,i);y=S&&typeof S=="object"?Object.keys(S):[],y.forEach(R=>{let A=S[R];A!=null&&A!==!1&&a.setAttribute(R,String(A))})})}let p=t.attrs[":class"],d=Object.entries(t.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,S])=>[y.slice(7),S]);if(p!==void 0||d.length){let y=new Set(Y(t.attrs.class??"")),S=[];e.effect(()=>{let R=p!==void 0?Y(C(p,i)):[];d.forEach(([A,h])=>{C(h,i)&&R.push(...Y(A))}),S.forEach(A=>{!R.includes(A)&&!y.has(A)&&a.classList.remove(A)}),a.classList.add(...R),S=R})}let m=t.attrs[":text"],E=t.attrs[":html"],O=t.attrs[":html.allowed"];O!==void 0&&E===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),m!==void 0?e.effect(()=>{a.textContent=String(C(m,i)??"")}):E!==void 0?e.effect(()=>{let y=O!==void 0?{allowUrl:en(C(O,i))}:void 0;a.innerHTML=vt(String(C(E,i)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(Z(t.children,i,e,s)):a.appendChild(Z(t.children,i,e,s));let x=t.attrs[":value"];return x!==void 0&&e.effect(()=>{let y=String(C(x,i)??"");a.value!==y&&(a.value=y)}),[":checked",":selected"].forEach(y=>{let S=t.attrs[y];if(S===void 0)return;let R=y.slice(1);e.effect(()=>{a[R]=!!C(S,i)})}),a},nn=(t,n,e,s)=>{let o=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(o);let r=null,a=null,u=null;return e.effect(()=>{let p=t.find(m=>m.expr===void 0||C(m.expr,n))??null;if(p===a||(u?.dispose(),r&&ct(r),r=null,a=p,!p))return;u=k(n);let d=Ct(p.node,n,u,s);r=Tt(d),o.parentNode.insertBefore(d,o.nextSibling)}),i},V=(t,n,e)=>{Object.defineProperty(t,n,{value:e,writable:!0,enumerable:!0,configurable:!0})},sn=t=>{if(t===null||typeof t!="object"||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},on=(t,n,e,s)=>{let o=t.attrs[":each"].match(ke);if(!o)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,i,r,a]=o,u=t.attrs[":key"],{[":each"]:p,[":key"]:d,...m}=t.attrs,E={...t,attrs:m},O=document.createComment("each"),x=document.createDocumentFragment();x.appendChild(O),(":if"in t.attrs||":elseif"in t.attrs||":else"in t.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let y=[],S=!1;return e.effect(()=>{let R=C(a,n),A=Array.isArray(R)?R.map((f,l)=>[l,f]):sn(R)?Object.entries(R):[],h=new Map;y.forEach(f=>{let l=h.get(f.key);l?l.push(f):h.set(f.key,[f])});let g=new Set,$=[],w=A.map(([f,l],T)=>{let j=Object.create(n);V(j,i,l),r&&V(j,r,f),V(j,"$index",T);let N=u!==void 0?C(u,j):f;g.has(N)&&!S&&(S=!0,console.warn(`jq79: duplicate :key in :each "${t.attrs[":each"]}"; duplicates pair up by position`)),g.add(N);let b=h.get(N)?.shift();if(b&&Object.is(b.item,l))return b.scope.$index!==T&&$.push(b),V(b.scope,"$index",T),r&&V(b.scope,r,f),b;b&&(b.fx.dispose(),ct(b.range));let L=k(n),v=Tt(Ct(E,j,L,s));return{key:N,item:l,scope:j,fx:L,range:v}});h.forEach(f=>f.forEach(l=>{l.fx.dispose(),ct(l.range)}));let c=O;w.forEach(f=>{c.nextSibling!==f.range.first&&Be(f.range,c),c=f.range.last}),$.forEach(f=>K(()=>f.fx.refresh())),y=w}),x},Z=(t,n,e,s=!1)=>{let o=document.createDocumentFragment(),i=0;for(;i<t.length;){let r=t[i];if(typeof r=="string"){let a=document.createTextNode(r);r.includes("{{")&&e.effect(()=>{a.textContent=Ue(r,n)}),o.appendChild(a),i++;continue}if(":each"in r.attrs){o.appendChild(on(r,n,e,s)),i++;continue}if(":if"in r.attrs){let a=[{expr:r.attrs[":if"],node:r}];i++;let u=d=>{let m=i;for(;m<t.length&&typeof t[m]=="string"&&!t[m].trim();)m++;let E=t[m];if(typeof E=="object"&&d in E.attrs)return i=m+1,E};for(let d=u(":elseif");d;d=u(":elseif"))a.push({expr:d.attrs[":elseif"],node:d});let p=u(":else");p&&a.push({node:p}),o.appendChild(nn(a,n,e,s));continue}o.appendChild(Ct(r,n,e,s)),i++}return o},rn=(t,n,e=!1)=>Z(t.template,n,k(n),e),an=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ln=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,oe=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,cn=t=>t.split(oe).map((n,e)=>e%2===1?n:n.replace(ln,(s,o,i)=>an.has(o.toLowerCase())?s:`<${o}${i}></${o}>`)).join(""),un=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,fn=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,dn=t=>t.split(oe).map((n,e)=>e%2===1?n:n.replace(un,(s,o,i)=>{let r=0,a=i.replace(fn,(u,p,d)=>d===void 0?u:`${p}:props.${r++}="${d}"`);return`<${o}${a}>`})).join(""),dt="data-jq79",pn=t=>{let n=2166136261;for(let e=0;e<t.length;e++)n=Math.imul(n^t.charCodeAt(e),16777619);return(n>>>0).toString(36)},re=(t,n)=>{t.forEach(e=>{typeof e!="string"&&(e.attrs[dt]=n,re(e.children,n))})},hn=(t,n)=>t.split(",").map(e=>{let s=e.trim(),o=s.indexOf("::"),i=o===-1?s:s.slice(0,o),r=o===-1?"":s.slice(o);return`${i}[${dt}="${n}"]${r}`}).join(", "),ie=(t,n)=>{Array.from(t).forEach(e=>{e instanceof CSSStyleRule?e.selectorText=hn(e.selectorText,n):e instanceof CSSGroupingRule&&ie(e.cssRules,n)})},mn=(t,n)=>{/:deep\(|::v-deep|>>>/.test(t)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let e=new CSSStyleSheet;return e.replaceSync(t),ie(e.cssRules,n),Array.from(e.cssRules).map(s=>s.cssText).join(`
10
- `)},gn=/^[A-Z][A-Za-z0-9]*$/,St=t=>{let n=cn(dn(t)),s=new DOMParser().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template"),o=[],i=[];Array.from(s.content.children).forEach(u=>{u.tagName==="TEMPLATE"?i.push(u):o.push(u)});let r=Xt(o,t),a={};return i.forEach(u=>{let p=u.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!gn.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in a){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}a[p]=new F({...Xt(Array.from(u.content.children),u.innerHTML),siblings:a,name:p})}),Object.keys(a).length&&(r.siblings=a),r},Xt=(t,n)=>{let e=[],s=[],o=[];t.forEach(r=>{let a={attrs:Qt(r),content:r.textContent??""};r.tagName==="SCRIPT"?e.push(a):r.tagName==="STYLE"?s.push(a):o.push(te(r))}),s.forEach(r=>{"lang"in r.attrs&&console.warn(`jq79: <style lang="${r.attrs.lang}"> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its styles were left uncompiled and the browser will ignore them.`)});let i=r=>"scoped"in r.attrs&&!("lang"in r.attrs);if(s.some(i)){let r=pn(n);re(o,r),s.forEach(a=>{i(a)&&(a.scoped=mn(a.content,r))})}return{template:o,scripts:e,styles:s}},At=t=>/\.html?([?#]|$)/.test(t)?Rt(t):import(t),ae=(t,n)=>t?`
11
- //# sourceURL=${t}?jq79-script=${n}`:"",Jt=t=>t.scoped??t.content,ut=new Map,yn=t=>{let n=ut.get(t);if(!n){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e),n={el:e,count:0},ut.set(t,n)}n.count++},bn=t=>{let n=ut.get(t);n&&--n.count<=0&&(n.el.remove(),ut.delete(t))},En=(t,n,e,s={},o=At,i={})=>{let r={...fe,...s},a=new Proxy(n,{has:(p,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(p,d)||!(d in globalThis)&&!(d in r))});new Function("$scope","$__effect","$__import",...Object.keys(r),`return (async () => { with ($scope) { ${t} } })()${ae(i.filename,i.index??0)}`)(a,e,o,...Object.values(r)).catch(p=>console.error("jq79: error in :setup script",p))},Vt=(t,n)=>{n?.forEach(({name:e,default:s})=>{t[e]===void 0&&(t[e]=s===void 0?void 0:C(s,t))})},wn=t=>{let n=new Set;return t.forEach(e=>{(Et(e.content)??J(e.attrs[":setup"]))?.forEach(({name:o})=>n.add(o))}),n},Sn=(t,n)=>{if(!t)return null;let e=Object.create(null),s=!1;return Object.entries(t).forEach(([o,i])=>{n.has(o)||(e[o]=i,s=!0)}),s?e:null},le=Symbol("jq79.unfilledProps"),Rn=t=>t&&t.default!==void 0?t.default:t,$n=(t,n,e,s={},o=At,i={})=>{let r={...fe,...s},a={},u=new Function("$__exports","$__default","$__import",...Object.keys(r),`return (async () => { "use strict";
1
+ var tt=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var Ee=(t,e,n)=>e in t?tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Se=(t,e)=>{for(var n in e)tt(t,n,{get:e[n],enumerable:!0})},we=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ye(e))!be.call(t,r)&&r!==n&&tt(t,r,{get:()=>e[r],enumerable:!(s=me(e,r))||s.enumerable});return t};var Re=t=>we(tt({},"__esModule",{value:!0}),t);var N=(t,e,n)=>Ee(t,typeof e!="symbol"?e+"":e,n);var Wn={};Se(Wn,{$:()=>z,$$:()=>et,$create:()=>nt,$reactive:()=>X,C79:()=>q,Component79:()=>q,PendingComponent79:()=>pt,enableHotReload:()=>he,hotUpdate:()=>pe,parseComponent:()=>qn,renderComponent:()=>fn});module.exports=Re(Wn);function z(t,e){return typeof t=="string"?document.querySelector(t):t.querySelector(e)}function et(t,e){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(e))}var nt=(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},$e=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),Lt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Te=new Set(["http:","https:","mailto:"]);function xe(t){try{let e=new URL(t,"https://example.com");return Te.has(e.protocol)}catch{return!1}}var Ce={"https:":"443","http:":"80"};function _e(t){let e=t.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!e)return null;let[,n,s]=e,r=n.split(".");return r.some(i=>i!=="*"&&!/^[a-z\d-]+$/.test(i))?null:{host:new RegExp(`^${r.map(i=>i==="*"?"[^.]+":i).join("\\.")}$`),port:!s||s==="*"?null:s}}var Pt=t=>{let e=(Array.isArray(t)?t:t.split(",")).map(_e).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||Ce[n.protocol]||"";return e.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function Ae(t,e,n,s){try{return!!t(new URL(e,document.baseURI),n,s)}catch{return!1}}var vt=512;function Mt(t,e,n,s){if(n>vt)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${vt} elements`);for(let r of Array.from(t.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=je(r,n,s);o&&e.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&e.appendChild(r.cloneNode())}function je(t,e,n){let s=t.tagName.toLowerCase();if(!$e.has(s))return null;let r=document.createElement(s);for(let o of Array.from(t.attributes)){let i=o.name.toLowerCase(),l=Lt[s]?.has(i),u=Lt["*"]?.has(i);!l&&!u||(i==="href"||i==="src")&&(!xe(o.value)||n&&!Ae(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),Mt(t,r,e+1,n),r}function Dt(t,e){let n=document.createElement("template");n.innerHTML=t;let s=document.createElement("div");return Mt(n.content,s,0,e?.allowUrl),s.innerHTML}var Ne=(t,e)=>e.split(".").reduce((n,s)=>n?.[s],t),Wt=t=>{if(Array.isArray(t))return!0;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},Ut=(t,e,n)=>{Object.entries(t).forEach(([s,r])=>{let o=e?`${e}.${s}`:s;r&&typeof r=="object"&&Wt(r)?Ut(r,o,n):n(o,r)})},Oe=(t,e)=>t===e||t.startsWith(`${e}.`)||e.startsWith(`${t}.`),mt=Symbol("jq79.raw"),st=t=>{let e=t;for(;e!==null&&typeof e=="object"&&e[mt];)e=e[mt];return e},Ft=Symbol("jq79.store"),V=t=>t!==null&&typeof t=="object"&&t[Ft]===!0,Z=[],J=t=>{Z.push(new Set);try{return t()}finally{Z.pop()}},qt="$__attach",rt=Symbol("jq79.alsoWakenBy"),X=t=>{let e=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=(h,m,T=!1)=>{e.get(h)?.forEach(S=>S(m,h)),n.forEach(S=>S(h,m)),s.forEach(S=>{(T||Array.from(S.deps).some(c=>Oe(c,h)))&&S.run()})},l=h=>h!==null&&typeof h=="object"&&Wt(h),u=new Map,p=(h,m)=>{let T=u.get(m);T?.store!==h&&(T?.unsubscribe(),u.set(m,{store:h,unsubscribe:h.$onAny((S,c)=>i(`${m}.${S}`,c))}))},d=h=>{u.get(h)?.unsubscribe(),u.delete(h)},g=(h,m)=>{let T=r.get(h);if(T)return T;let S=null,c=new Proxy(h,{has(f,a){return Reflect.has(f,a)||typeof a=="string"&&S?.has(a)===!0},get(f,a,w){if(a===mt)return f;if(a===Ft)return m==="";if(typeof a!="string")return Reflect.get(f,a,w);if(m===""&&a in o)return o[a];let A=m?`${m}.${a}`:a;Z[Z.length-1]?.add(A);let j=Reflect.get(f,a,w);if(V(j))return p(j,A),j;let E=st(j);return l(E)?g(E,A):E},set(f,a,w,A){if(A!==c&&!Object.prototype.hasOwnProperty.call(f,a))return Reflect.set(f,a,w,A);let j=m?`${m}.${a}`:a,E=V(w)?w:st(w),v=!Object.prototype.hasOwnProperty.call(f,a);if(!v&&Object.is(f[a],E)&&(E===null||typeof E!="object"))return!0;f[a]=E,S?.delete(a),V(E)?p(E,j):d(j);let L=V(E)||!l(E)?E:g(E,j);return i(j,L,v),!0},deleteProperty(f,a){if(typeof a!="string")return Reflect.deleteProperty(f,a);let w=Object.prototype.hasOwnProperty.call(f,a),A=Reflect.deleteProperty(f,a);if(A&&w){let j=m?`${m}.${a}`:a;(S??(S=new Set)).add(a),d(j),i(j,void 0)}return A}});return r.set(h,c),c},b=g(st(t),"");Object.entries(st(t)).forEach(([h,m])=>{V(m)&&p(m,h)});let O=(h,m,{immediate:T=!1}={})=>(e.has(h)||e.set(h,new Set),e.get(h).add(m),T&&m(Ne(b,h),h),()=>e.get(h)?.delete(m)),x=(h,{immediate:m=!1}={})=>(n.add(h),m&&Ut(b,"",(T,S)=>h(T,S)),()=>n.delete(h)),y=(h,m)=>{let T=!1,S=!1,c={deps:new Set,run:()=>{if(T){S=!0;return}T=!0;try{let f=0;do{S=!1;let a=new Set;Z.push(a);try{h()}finally{Z.pop(),c.deps=a}}while(S&&++f<100);S&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{T=!1}}};return s.add(c),m?.length?R(c,m):(c.run(),()=>{s.delete(c)})},R=(h,m)=>{let T=m.map(S=>S?.[qt]?.(h)).filter(Boolean);return h.run(),()=>{s.delete(h),T.forEach(S=>S())}},$=h=>(s.add(h),()=>{s.delete(h)}),_=()=>{u.forEach(({unsubscribe:h})=>h()),u.clear()};return o.$on=O,o.$onAny=x,o.$effect=y,o.$dispose=_,o[qt]=$,b},I=t=>{let e=[],n=[],s=t[rt];return{effect:r=>{e.push(t.$effect(r,s)),n.push(r)},onDispose:r=>{e.push(r)},refresh:()=>{n.forEach(r=>r())},dispose:()=>{e.splice(0).forEach(r=>r()),n.length=0}}};var It=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,kt=/\$:\s*/y,it=/import(?=\s*\()/y,Bt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,W=(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},M=(t,e)=>{let n=t.indexOf(`
2
+ `,e);return n===-1?t.length:n},D=(t,e)=>{let n=t.indexOf("*/",e+2);return n===-1?t.length:n+2},ot=(t,e)=>{let n=e;for(;n<t.length;){if(/\s/.test(t[n])){n++;continue}if(t[n]==="/"&&t[n+1]==="/"){n=M(t,n);continue}if(t[n]==="/"&&t[n+1]==="*"){n=D(t,n);continue}break}return n},Le=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),U=(t,e)=>{let n=e-1;for(;n>=0;){let r=t[n];if(/\s/.test(r)){n--;continue}if(r==="/"&&t[n-1]==="*"){let o=t.lastIndexOf("/*",n-2);if(o===-1)return!0;n=o-1;continue}break}if(n<0)return!0;let s=t[n];if(/[\w$]/.test(s)){let r=n;for(;r>0&&/[\w$]/.test(t[r-1]);)r--;return Le.has(t.slice(r,n+1))}return(s==="+"||s==="-")&&t[n-1]===s?!1:!")]}\"'`.".includes(s)},F=(t,e)=>{let n=e+1,s=!1;for(;n<t.length;){let r=t[n];if(r==="\\"){n+=2;continue}if(r===`
3
+ `)return n;if(r==="[")s=!0;else if(r==="]")s=!1;else if(r==="/"&&!s){for(n++;n<t.length&&/[a-z]/i.test(t[n]);)n++;return n}n++}return t.length},ve=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Pe=(t,e)=>{let n=e-1;for(;n>=0;){let s=t[n];if(/\s/.test(s)){n--;continue}if(s==="/"&&t[n-1]==="*"){let r=t.lastIndexOf("/*",n-2);if(r===-1)return"";n=r-1;continue}return s}return""},Ht=(t,e)=>{let n=0,s=e;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=W(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(r==="/"&&U(t,s)){s=F(t,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else{if(n<=0&&r===";")return s;if(n<=0&&r===`
4
+ `){let o=ot(t,s+1);if(!(o<t.length&&(ve.test(t.slice(o,o+2))||[",","="].includes(Pe(t,s)))))return s;s=o;continue}}s++}return t.length},Me=t=>{let e=[],n=0,s=0,r=0,o=l=>{e.push({raw:t.slice(s,l),codeEnd:Math.max(0,r-s)}),s=l+1,r=s},i=0;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=W(t,i),r=i;continue}if(l==="/"&&t[i+1]==="/"){i=M(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=D(t,i);continue}if(l==="/"&&U(t,i)){i=F(t,i),r=i;continue}if("([{".includes(l))n++;else if(")]}".includes(l))n--;else if(l===","&&n<=0){o(i),i++;continue}/\s/.test(l)||(r=i+1),i++}return o(t.length),e},yt=t=>{let e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return at.test(e)?[e]:[];let n=[];for(let s of Et(e.slice(1,Zt(e)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=St(s);if(r!==-1&&(s=s.slice(0,r).trim()),e.startsWith("{")){let o=bt(s,":");if(o!==-1){n.push(...yt(s.slice(o+1)));continue}}n.push(...yt(s))}return n},De=t=>{let e=[],n=Me(t).map(({raw:o,codeEnd:i})=>{let l=o.match(/^\s*/)[0];if(i<=l.length)return{text:o,empty:!0};let u=o.slice(l.length,i),p=o.slice(i),d=St(u),g=(d===-1?u:u.slice(0,d)).trim(),b=u[0]==="{"||u[0]==="[";b?e.push(...yt(g)):at.test(g)&&e.push(g);let O=ct(u).code;return{text:`${l}${b?`(${O})`:O}${p}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:e,code:r}},ct=t=>{let e=[],n="",s=0,r=0,o=!0;for(;s<t.length;){let i=t[s],l=t[s+1];if(i==="'"||i==='"'||i==="`"){let u=W(t,s);n+=t.slice(s,u),s=u,o=!1;continue}if(i==="/"&&(l==="/"||l==="*")){let u=l==="/"?M(t,s):D(t,s);n+=t.slice(s,u),s=u;continue}if(i==="/"&&U(t,s)){let u=F(t,s);n+=t.slice(s,u),s=u,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(it.lastIndex=s,it.test(t))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){It.lastIndex=s;let u=It.exec(t);if(u){let d=s+u[0].length,g=Ht(t,d),{vars:b,code:O}=De(t.slice(d,g));e.push(...b),n+=O,s=g,o=!1;continue}kt.lastIndex=s;let p=kt.exec(t);if(p){Bt.lastIndex=s;let d=Bt.exec(t);d&&e.push(d[1]);let g=s+p[0].length,b=Ht(t,g);n+=`$__effect(() => { ${ct(t.slice(g,b)).code} });`,s=b;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
5
+ `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:e,code:n}},lt=/export\s+default(?![\w$])/y,zt=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,qe=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},We=(t,e,n)=>{let s=`await $__import(${JSON.stringify(e)})`;if(t===void 0)return s;let r=qe(t),o=[],i=s;if(r.length>1){let l=`$__mod${n}`;o.push(`${l} = ${s}`),i=l}for(let l of r)l.startsWith("{")?o.push(`${l.replace(/\s+as\s+/g,": ")} = ${i}`):l.startsWith("*")?o.push(`${l.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${l} = $__default(${i})`);return`const ${o.join(", ")}`},at=/^[A-Za-z_$][\w$]*$/,Zt=t=>{let e=0,n=0;for(;n<t.length;){let s=t[n];if(s==="'"||s==='"'||s==="`"){n=W(t,n);continue}if(s==="/"&&t[n+1]==="/"){n=M(t,n);continue}if(s==="/"&&t[n+1]==="*"){n=D(t,n);continue}if(s==="/"&&U(t,n)){n=F(t,n);continue}if("([{".includes(s))e++;else if(")]}".includes(s)&&--e===0)return n;n++}return t.length},bt=(t,e)=>{let n=0,s=0;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=W(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(r==="/"&&r!==e&&U(t,s)){s=F(t,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===e)return s;s++}return-1},Et=t=>{let e=[],n=0,s=0,r=0;for(;r<=t.length;){let o=t[r];if(o==="'"||o==='"'||o==="`"){r=W(t,r);continue}if(o==="/"&&t[r+1]==="/"){r=M(t,r);continue}if(o==="/"&&t[r+1]==="*"){r=D(t,r);continue}if(o==="/"&&U(t,r)){r=F(t,r);continue}if(o!==void 0&&"([{".includes(o))n++;else if(o!==void 0&&")]}".includes(o))n--;else if(r===t.length||o===","&&n===0){let i=t.slice(s,r).trim();i&&e.push(i),s=r+1}r++}return e},St=t=>{let e=0;for(;e<t.length;){let n=bt(t.slice(e),"=");if(n===-1)return-1;let s=e+n;if(t[s+1]!=="="&&t[s+1]!==">"&&t[s-1]!=="="&&t[s-1]!=="!")return s;e=s+1}return-1},G=t=>{let e=(t??"").trim();if(!e.startsWith("{"))return null;let n=Zt(e);if(n>=e.length)return null;let s=[];for(let r of Et(e.slice(1,n))){if(r.startsWith("..."))continue;let o=St(r),i=o===-1?r:r.slice(0,o),l=o===-1?void 0:r.slice(o+1).trim(),u=bt(i,":"),p=(u===-1?i:i.slice(0,u)).trim();if(!at.test(p))continue;let d={name:p};l!==void 0&&(d.default=l);let g=u===-1?"":i.slice(u+1).trim();at.test(g)&&(d.as=g),s.push(d)}return s},Ue=t=>{let e=0,n=0,s=!0;for(;e<t.length;){let r=t[e];if(r==="'"||r==='"'||r==="`"){e=W(t,e),s=!1;continue}if(r==="/"&&t[e+1]==="/"){e=M(t,e);continue}if(r==="/"&&t[e+1]==="*"){e=D(t,e);continue}if(r==="/"&&U(t,e)){e=F(t,e),s=!1;continue}if(r==="e"&&n===0&&s&&(e===0||!/[\w$.]/.test(t[e-1]))){lt.lastIndex=e;let o=lt.exec(t);if(o)return e+o[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
6
+ `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),e++}return-1},Fe=/^async(?![\w$])/,Ie=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,ke=t=>{let e=Ue(t);if(e===-1)return null;let n=ot(t,e),s=t.slice(n);Fe.test(s)&&(n=ot(t,n+5));let r=Ie.exec(t.slice(n));if(r&&(n=ot(t,n+r[0].length)),t[n]!=="(")return null;let o=0,i=n;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=W(t,i);continue}if(l==="/"&&t[i+1]==="/"){i=M(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=D(t,i);continue}if(l==="/"&&U(t,i)){i=F(t,i);continue}if("([{".includes(l))o++;else if(")]}".includes(l)&&--o===0)break;i++}return Et(t.slice(n+1,i))[0]??""},ut=t=>{let e=ke(t);if(e===null)return null;let n=G(e),s=n?.find(r=>r.name.startsWith("$"))?.name;if(s)throw new Error(`jq79: the factory signature is (props, ctx), so \`${s}\` can't be destructured from the first parameter. Write \`export default (props, { ${s} }) => \u2026\`, or \`_\` in place of props if the component takes none.`);return n},Gt=t=>{let e="",n=0,s=0,r=!0,o=!1,i=0;for(;n<t.length;){let l=t[n],u=t[n+1],p=n===0||!/[\w$.]/.test(t[n-1]);if(l==="'"||l==='"'||l==="`"){let d=W(t,n);e+=t.slice(n,d),n=d,r=!1;continue}if(l==="/"&&(u==="/"||u==="*")){let d=u==="/"?M(t,n):D(t,n);e+=t.slice(n,d),n=d;continue}if(l==="/"&&U(t,n)){let d=F(t,n);e+=t.slice(n,d),n=d,r=!1;continue}if(l==="i"&&p){if(it.lastIndex=n,it.test(t)){e+="$__import",n+=6,r=!1;continue}if(s===0&&r){zt.lastIndex=n;let d=zt.exec(t);if(d){e+=We(d[1],d[3],i++),n+=d[0].length,r=!1;continue}}}if(l==="e"&&p&&s===0&&r){lt.lastIndex=n;let d=lt.exec(t);if(d){o=!0,e+="$__exports.default =",n+=d[0].length,r=!1;continue}}"([{".includes(l)?s++:")]}".includes(l)&&(s=Math.max(0,s-1)),l===`
7
+ `||l===";"||l==="}"?r=!0:/\s/.test(l)||(r=!1),e+=l,n++}return o?e:null};var Be="0.4.18",se=t=>Object.fromEntries(Array.from(t.attributes).map(e=>[e.name,e.value])),re=t=>({tag:t.tagName.toLowerCase(),attrs:se(t),children:Array.from((t instanceof HTMLTemplateElement?t.content:t).childNodes).flatMap(e=>{if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??"";return n?[n]:[]}return e.nodeType===Node.ELEMENT_NODE?[re(e)]:[]})}),Kt=new Map,oe=(t,e)=>{let n=`${e.join(",")}|${t}`,s=Kt.get(n);if(s===void 0){try{s=new Function("$scope",...e,`with ($scope) { return (${t}
8
+ ); }`)}catch{s=null}Kt.set(n,s)}return s},C=(t,e,n)=>{let s=oe(t,n?Object.keys(n):[]);if(s)try{return s(e,...n?Object.values(n):[])}catch{return}},He=(t,e)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>C(s,e)??""),ze=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),xt=t=>ze.has(t)||t.startsWith(":class.")||t.startsWith(":props.")||t===":slot"||t.startsWith(":slot."),Ze=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Ge=(t,e,n,s)=>{let[r,...o]=e.slice(1).split("."),i=new Set(o);t.addEventListener(r,l=>{if(i.has("self")&&l.target!==t)return;i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation();let u=C(n,s,{$event:l});typeof u=="function"&&u.call(t,l)},{once:i.has("once"),capture:i.has("capture")})},Ke=(t,e,n,s)=>{let[r,...o]=e.slice(1).split("."),i=new Set(o),l=u=>{i.has("prevent")&&u.preventDefault(),i.has("stop")&&u.stopPropagation(),i.has("once")&&t.off(r,l),J(()=>{let p=C(n,s,{$event:u});typeof p=="function"&&p(u)})};t.on(r,l)},k=t=>t.replace(/-(\w)/g,(e,n)=>n.toUpperCase()),Rt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ct=t=>t instanceof DocumentFragment?{first:t.firstChild,last:t.lastChild}:{first:t,last:t},ft=({first:t,last:e})=>{for(let n=t;n;){let s=n===e?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Ve=({first:t,last:e},n)=>{let s=n.nextSibling;for(let r=t;r;){let o=r===e?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=o}},Vt=(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},Jt=200,wt=0,ie=Symbol("jq79.slots"),Je=t=>t==="slot"||t.startsWith("slot."),le=t=>t?k(t):"default",_t=t=>Object.keys(t.attrs).find(e=>e===":slot"||e.startsWith(":slot.")),Xe=t=>t==="default"?":slot":`:slot.${t}`,Qe=t=>typeof t!="string"||t.trim()!=="",Ye=t=>{let e={},n=[];t.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?_t(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=le(o.slice(6));if(i in e){console.warn(`jq79: two <template ${Xe(i)}> in <${t.tag}>; the second was ignored`);return}e[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(Qe);return s&&"default"in e?console.warn(`jq79: <${t.tag}> has both a <template :slot> and content outside it - the <template> is the default slot's content, and the rest was ignored`):s&&(e.default={nodes:n,binder:t.attrs[":slot"]||void 0}),e},tn=(t,e,n)=>{G(e)?.forEach(({name:s,as:r,default:o})=>{let i=r??s;Object.defineProperty(t,i,{enumerable:!0,configurable:!0,get:()=>{let l=n[s]?.();return l===void 0&&o!==void 0?C(o,t):l},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},en=t=>{let e=_t(t);return console.warn(`jq79: <template ${e}> fills a slot only as a direct child of a component tag; here it rendered nothing`),document.createComment(`misplaced ${e}`)},nn=(t,e)=>{let n=Object.entries(Ye(t));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=sn(o,e)}),s},sn=(t,e)=>(n,s,r,o)=>{let i=Object.create(e);tn(i,t.binder,n);let l=i[rt]??[];Object.defineProperty(i,rt,{value:[...l,s]});let u=I(i);return r.onDispose(()=>u.dispose()),K(t.nodes,i,u,o)},rn=(t,e,n,s)=>{let r=le(t.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(t.tag),l=document.createComment(`/${t.tag}`);o.append(i,l);let u=e[ie]?.[r];if(!u)return o.insertBefore(K(t.children,e,n,s),l),o;let p={};return Object.entries(t.attrs).forEach(([d,g])=>{if(!(d===ht||xt(d)||d.startsWith("@")))if(d.startsWith(":")){let b=g||d.slice(1);p[k(d.slice(1))]=()=>C(b,e)}else p[k(d)]=()=>g}),o.insertBefore(u(p,e,n,s),l),o},Xt=(t,e,n,s,r)=>{let o=document.createComment(t),i=document.createComment(`/${t}`),l=document.createDocumentFragment();l.append(o,i);let u=nn(e,n),p={},d={},g=[],b=[],O=!1;Object.entries(e.attrs).forEach(([c,f])=>{if(c!==ht){if(c===":props"||c.startsWith(":props.")){O=!0,b.push({expr:f});return}if(!xt(c))if(c.startsWith("@"))g.push([c,f]);else if(c===":model"||c.startsWith(":model.")){let a=c===":model"?"default":k(c.slice(7));d[a]=f||(c===":model"?"model":a)}else if(c.startsWith(":")){let a=k(c.slice(1));p[a]=f||a,b.push({name:a,expr:f||a})}else{let a=k(c),w=JSON.stringify(f);p[a]=w,b.push({name:a,expr:w})}}});let x=c=>c==="default"?":model":`:model.${c}`,y=c=>c==="default"?"model":c,R=c=>`${c}
9
+ = $value`;Object.entries(d).forEach(([c,f])=>{let a=y(c);p[a]!==void 0&&console.warn(`jq79: <${e.tag}> binds prop "${a}" through both :${a} and ${x(c)} - ${x(c)} wins`),p[a]=f,oe(R(f),["$value"])===null&&console.warn(`jq79: ${x(c)}="${f}" is not assignable - updates from <${e.tag}> will be dropped`)});let $=()=>{let c={};return b.forEach(({name:f,expr:a})=>{if(f!==void 0)c[f]=C(a,n);else{let w=C(a,n);w!==null&&typeof w=="object"&&Object.assign(c,w)}}),Object.entries(d).forEach(([f,a])=>{c[y(f)]=C(a,n)}),c},_=null,h=null,m=null,T=new Set,S=c=>{if(c==null){if(!n[de]?.has(t)||T.has("unfilled"))return;T.add("unfilled"),console.error(`jq79: <${e.tag}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${t}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}T.has("type")||(T.add("type"),console.error(`jq79: <${e.tag}> is ${typeof c}, not a component - nothing renders here`))};return s.effect(()=>{let c=C(t,n),f=c instanceof q?c:null;if(f||S(c),f===h||(m?.dispose(),m=null,_?.destroy(),_=null,h=f,!f))return;let a=new q({template:f.template,scripts:f.scripts,styles:f.styles,modules:f.modules,filename:f.filename,siblings:f.siblings,name:f.name});if(u&&(a.slots=u),Object.keys(d).length){let v=new Set,L=(H,P)=>{v.has(H)||(v.add(H),console.warn(P))};a.on("model:update",(H,P)=>{if(P===null||typeof P!="object"){L("payload",`jq79: model:update expects a { name?, value } payload, got ${P===null?"null":typeof P}`);return}let gt=P.name==null?"default":k(String(P.name)),Ot=d[gt];if(Ot===void 0){L(gt,`jq79: <${e.tag}> has no ${x(gt)} - bound: ${Object.keys(d).map(x).join(", ")}`);return}J(()=>C(R(Ot),n,{$value:P.value}))})}g.forEach(([v,L])=>Ke(a,v,L,n));let w=Nn(a.scripts),A=ee(J($),w),j=document.createDocumentFragment();if(wt>=Jt){console.error(`jq79: <${e.tag}> is ${Jt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}wt++;try{(r?a.renderShadow(A):a.render(A)).mount(j)}finally{wt--}i.parentNode.insertBefore(j,i);let E=I(n);if(O){let v=[];E.effect(()=>{let L=ee($(),w),H=Object.keys(L);v.forEach(P=>{P in L||(a.data[P]=void 0)}),H.forEach(P=>{a.data[P]=L[P]}),v=H})}else Object.entries(p).forEach(([v,L])=>{w!==null&&!w.has(v)||E.effect(()=>{a.data[v]=C(L,n)})});m=E,_=a}),s.onDispose(()=>{m?.dispose(),_?.destroy()}),l},on=(t,e)=>{let n=()=>{let s=C(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)}})},Y=t=>typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t.flatMap(Y):t!==null&&typeof t=="object"?Object.entries(t).flatMap(([e,n])=>n?Y(e):[]):[],ln=t=>typeof t=="function"?(e,n,s)=>{try{return!!t(e,n,s)}catch{return!1}}:typeof t=="string"||Array.isArray(t)?Pt(t):()=>!1,At=(t,e,n,s)=>{let r=t.attrs[":with"],o=r!==void 0?on(r,e):e;if(Je(t.tag))return rn(t,o,n,s);if(t.tag==="template"&&_t(t)!==void 0)return en(t);let i=Vt(o,t.tag);if(i)return Xt(i,t,o,n,s);let l=document.createElement(t.tag);if(l instanceof HTMLUnknownElement||t.tag.includes("-")){let y=!1;n.effect(()=>{if(y)return;let R=Vt(o,t.tag);if(!R)return;y=!0;let $=Xt(R,t,o,n,s),_=Ct($);n.onDispose(()=>ft(_)),l.replaceWith($)})}Object.entries(t.attrs).forEach(([y,R])=>{y.startsWith("@")?Ge(l,y,R,o):y===":model"||y.startsWith(":model.")?l instanceof HTMLUnknownElement||t.tag.includes("-")||console.warn(`jq79: ${y} on <${t.tag}> does nothing - :model binds component tags only (for now)`):xt(y)||l.setAttribute(y,R)});let u=t.attrs[":attrs"];if(u!==void 0){let y=[];n.effect(()=>{y.forEach($=>l.removeAttribute($));let R=C(u,o);y=R&&typeof R=="object"?Object.keys(R):[],y.forEach($=>{let _=R[$];_!=null&&_!==!1&&l.setAttribute($,String(_))})})}let p=t.attrs[":class"],d=Object.entries(t.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,R])=>[y.slice(7),R]);if(p!==void 0||d.length){let y=new Set(Y(t.attrs.class??"")),R=[];n.effect(()=>{let $=p!==void 0?Y(C(p,o)):[];d.forEach(([_,h])=>{C(h,o)&&$.push(...Y(_))}),R.forEach(_=>{!$.includes(_)&&!y.has(_)&&l.classList.remove(_)}),l.classList.add(...$),R=$})}let g=t.attrs[":text"],b=t.attrs[":html"],O=t.attrs[":html.allowed"];O!==void 0&&b===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),g!==void 0?n.effect(()=>{l.textContent=String(C(g,o)??"")}):b!==void 0?n.effect(()=>{let y=O!==void 0?{allowUrl:ln(C(O,o))}:void 0;l.innerHTML=Dt(String(C(b,o)??""),y)}):l instanceof HTMLTemplateElement?l.content.appendChild(K(t.children,o,n,s)):l.appendChild(K(t.children,o,n,s));let x=t.attrs[":value"];return x!==void 0&&n.effect(()=>{let y=String(C(x,o)??"");l.value!==y&&(l.value=y)}),[":checked",":selected"].forEach(y=>{let R=t.attrs[y];if(R===void 0)return;let $=y.slice(1);n.effect(()=>{l[$]=!!C(R,o)})}),l},an=(t,e,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,l=null,u=null;return n.effect(()=>{let p=t.find(g=>g.expr===void 0||C(g.expr,e))??null;if(p===l||(u?.dispose(),i&&ft(i),i=null,l=p,!p))return;u=I(e);let d=At(p.node,e,u,s);i=Ct(d),r.parentNode.insertBefore(d,r.nextSibling)}),o},Q=(t,e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})},cn=t=>{if(t===null||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},un=(t,e,n,s)=>{let r=t.attrs[":each"].match(Ze);if(!r)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,o,i,l]=r,u=t.attrs[":key"],{[":each"]:p,[":key"]:d,...g}=t.attrs,b={...t,attrs:g},O=document.createComment("each"),x=document.createDocumentFragment();x.appendChild(O),(":if"in t.attrs||":elseif"in t.attrs||":else"in t.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let y=[],R=!1;return n.effect(()=>{let $=C(l,e),_=Array.isArray($)?$.map((f,a)=>[a,f]):cn($)?Object.entries($):[],h=new Map;y.forEach(f=>{let a=h.get(f.key);a?a.push(f):h.set(f.key,[f])});let m=new Set,T=[],S=_.map(([f,a],w)=>{let A=Object.create(e);Q(A,o,a),i&&Q(A,i,f),Q(A,"$index",w);let j=u!==void 0?C(u,A):f;m.has(j)&&!R&&(R=!0,console.warn(`jq79: duplicate :key in :each "${t.attrs[":each"]}"; duplicates pair up by position`)),m.add(j);let E=h.get(j)?.shift();if(E&&Object.is(E.item,a))return E.scope.$index!==w&&T.push(E),Q(E.scope,"$index",w),i&&Q(E.scope,i,f),E;E&&(E.fx.dispose(),ft(E.range));let v=I(e),L=Ct(At(b,A,v,s));return{key:j,item:a,scope:A,fx:v,range:L}});h.forEach(f=>f.forEach(a=>{a.fx.dispose(),ft(a.range)}));let c=O;S.forEach(f=>{c.nextSibling!==f.range.first&&Ve(f.range,c),c=f.range.last}),T.forEach(f=>J(()=>f.fx.refresh())),y=S}),x},K=(t,e,n,s=!1)=>{let r=document.createDocumentFragment(),o=0;for(;o<t.length;){let i=t[o];if(typeof i=="string"){let l=document.createTextNode(i);i.includes("{{")&&n.effect(()=>{l.textContent=He(i,e)}),r.appendChild(l),o++;continue}if(":each"in i.attrs){r.appendChild(un(i,e,n,s)),o++;continue}if(":if"in i.attrs){let l=[{expr:i.attrs[":if"],node:i}];o++;let u=d=>{let g=o;for(;g<t.length&&typeof t[g]=="string"&&!t[g].trim();)g++;let b=t[g];if(typeof b=="object"&&d in b.attrs)return o=g+1,b};for(let d=u(":elseif");d;d=u(":elseif"))l.push({expr:d.attrs[":elseif"],node:d});let p=u(":else");p&&l.push({node:p}),r.appendChild(an(l,e,n,s));continue}r.appendChild(At(i,e,n,s)),o++}return r},fn=(t,e,n=!1)=>K(t.template,e,I(e),n),dn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),pn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,jt=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,hn=t=>t.split(jt).map((e,n)=>n%2===1?e:e.replace(pn,(s,r,o)=>dn.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),ae=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,gn=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,mn=t=>t.split(jt).map((e,n)=>n%2===1?e:e.replace(ae,(s,r,o)=>{let i=0,l=o.replace(gn,(u,p,d)=>d===void 0?u:`${p}:props.${i++}="${d}"`);return`<${r}${l}>`})).join(""),yn=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,bn=/<\/slot\.([\w.$-]+)(\s*)>/gi,En=/^slot\./i,Sn=t=>En.test(t)?`slot.${Rt(t.slice(5))}`:t,wn=t=>t.split(jt).map((e,n)=>n%2===1?e:e.replace(ae,(s,r,o)=>{let i=o.replace(yn,(l,u,p)=>p===void 0?l:`${u}${Rt(p)}`);return`<${Sn(r)}${i}>`}).replace(bn,(s,r,o)=>`</slot.${Rt(r)}${o}>`)).join(""),ht="data-jq79",Rn=t=>{let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return(e>>>0).toString(36)},ce=(t,e)=>{t.forEach(n=>{typeof n!="string"&&(n.attrs[ht]=e,ce(n.children,e))})},$n=(t,e)=>t.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),i=r===-1?"":s.slice(r);return`${o}[${ht}="${e}"]${i}`}).join(", "),ue=(t,e)=>{Array.from(t).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=$n(n.selectorText,e):n instanceof CSSGroupingRule&&ue(n.cssRules,e)})},Tn=(t,e)=>{/:deep\(|::v-deep|>>>/.test(t)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let n=new CSSStyleSheet;return n.replaceSync(t),ue(n.cssRules,e),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
+ `)},xn=/^[A-Z][A-Za-z0-9]*$/,$t=t=>{let e=hn(mn(wn(t))),s=new DOMParser().parseFromString(`<template>${e}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(u=>{u.tagName==="TEMPLATE"?o.push(u):r.push(u)});let i=Qt(r,t),l={};return o.forEach(u=>{let p=u.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!xn.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in l){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}l[p]=new q({...Qt(Array.from(u.content.children),u.innerHTML),siblings:l,name:p})}),Object.keys(l).length&&(i.siblings=l),i},Qt=(t,e)=>{let n=[],s=[],r=[];t.forEach(i=>{let l={attrs:se(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(l):i.tagName==="STYLE"?s.push(l):r.push(re(i))}),s.forEach(i=>{"lang"in i.attrs&&console.warn(`jq79: <style lang="${i.attrs.lang}"> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its styles were left uncompiled and the browser will ignore them.`)});let o=i=>"scoped"in i.attrs&&!("lang"in i.attrs);if(s.some(o)){let i=Rn(e);ce(r,i),s.forEach(l=>{o(l)&&(l.scoped=Tn(l.content,i))})}return{template:r,scripts:n,styles:s}},Nt=t=>/\.html?([?#]|$)/.test(t)?Tt(t):import(t),fe=(t,e)=>t?`
11
+ //# sourceURL=${t}?jq79-script=${e}`:"",Yt=t=>t.scoped??t.content,dt=new Map,Cn=t=>{let e=dt.get(t);if(!e){let n=document.createElement("style");n.textContent=t,document.head.appendChild(n),e={el:n,count:0},dt.set(t,e)}e.count++},_n=t=>{let e=dt.get(t);e&&--e.count<=0&&(e.el.remove(),dt.delete(t))},An=(t,e,n,s={},r=Nt,o={})=>{let i={...ge,...s},l=new Proxy(e,{has:(p,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(p,d)||!(d in globalThis)&&!(d in i))});new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${t} } })()${fe(o.filename,o.index??0)}`)(l,n,r,...Object.values(i)).catch(p=>console.error("jq79: error in :setup script",p))},te=(t,e)=>{e?.forEach(({name:n,default:s})=>{t[n]===void 0&&(t[n]=s===void 0?void 0:C(s,t))})},jn=t=>{let e=new Set;return t.forEach(n=>{(ut(n.content)??G(n.attrs[":setup"]))?.forEach(({name:r})=>e.add(r))}),e},Nn=t=>{let e=null;return t.forEach(n=>{let s=ut(n.content)??G(n.attrs[":setup"]);if(!s)return;let r=e??(e=new Set);s.forEach(({name:o})=>r.add(o))}),e},ee=(t,e)=>{if(e===null)return t;let n={};return Object.keys(t).forEach(s=>{e.has(s)&&(n[s]=t[s])}),n},On=(t,e)=>{if(!t)return null;let n=Object.create(null),s=!1;return Object.entries(t).forEach(([r,o])=>{e.has(r)||(n[r]=o,s=!0)}),s?n:null},de=Symbol("jq79.unfilledProps"),Ln=t=>t&&t.default!==void 0?t.default:t,vn=(t,e,n,s={},r=Nt,o={})=>{let i={...ge,...s},l={},u=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
12
12
  ${t}
13
- ;$__exports.done = true })()${ae(i.filename,i.index??0)}`)(a,Rn,o,...Object.values(r)),p=E=>console.error("jq79: error in factory script",E),d=!1,m=()=>{if(d)return;d=!0;let E=a.default;if(typeof E!="function")return;let O=x=>{x&&typeof x=="object"&&Object.assign(n,x)};try{let x=E(n,{$data:n,$props:n,$effect:e,...s});x instanceof Promise?x.then(O).catch(p):O(x)}catch(x){p(x)}};u.then(m,p),a.done&&m()},Tn="__JQ79_HMR_ENABLED__",xn="__JQ79_HMR__",H=null,Cn=t=>{if(!H||!t.filename)return;let n=H.get(t.filename);n||H.set(t.filename,n=new Set),n.add(new WeakRef(t))},Yt=t=>{try{return new URL(t,document.baseURI).pathname}catch{return t}},ce=(t,n)=>{if(!H)return 0;let e=Yt(t),s=St(n),o=!1,i=a=>a.name===void 0?s:s.siblings?.[a.name]??null,r=0;for(let[a,u]of H)if(Yt(a)===e){for(let p of u){let d=p.deref();if(!d){u.delete(p);continue}let m=i(d);if(!m){o=!0;continue}d.hotReplace(m)&&r++}u.size||H.delete(a)}return o?0:r},ue=()=>{H??(H=new Map),globalThis[xn]={update:ce}},Rt=async t=>{let n=await fetch(t);if(!n.ok)throw new Error(`failed to fetch component from ${t}: ${n.status}`);return new F(await n.text(),{filename:t})},F=class{constructor(n,e={}){_(this,"template");_(this,"scripts");_(this,"styles");_(this,"modules");_(this,"filename");_(this,"siblings");_(this,"name");_(this,"slots");_(this,"data",null);_(this,"fx",null);_(this,"content",null);_(this,"startMarker",null);_(this,"endMarker",null);_(this,"styleEls",[]);_(this,"ownsSharedStyles",!1);_(this,"useShadow",!1);_(this,"mountRoot",null);_(this,"resolveMounted",null);_(this,"emitListeners",new Map);let s=typeof n=="string"?St(n):n;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=e.modules??(typeof n=="string"?void 0:n.modules),this.filename=e.filename??(typeof n=="string"?void 0:n.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),Cn(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([n,e])=>{e.filename??(e.filename=this.filename),e.modules??(e.modules=this.modules),this.name||(this[n]=e)})}hotReplace(n){let e=typeof n=="string"?St(n):n,s=this.startMarker,o=!!(s&&this.content),i=o&&s.isConnected,r=i?s.parentNode:null,a=i?this.endMarker.nextSibling:null,u={...this.data},p=this.useShadow;return o&&this.destroy(),this.template=e.template,this.scripts=e.scripts,this.styles=e.styles,this.siblings=e.siblings,this.adoptSiblings(),!o||(this.renderWith(u,p),!r)?!1:(p&&this.styleEls.forEach(d=>r.insertBefore(d,a)),r.insertBefore(this.content,a),this.mountRoot=r,this.resolveMounted?.(),!0)}static fetch(n){if(Array.isArray(n))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new ft(Rt(n))}static fetchAll(n){return Promise.all(n.map(Rt))}on(n,e){return this.emitListeners.has(n)||this.emitListeners.set(n,new Set),this.emitListeners.get(n).add(e),this}off(n,e){return this.emitListeners.get(n)?.delete(e),this}render(n={}){return this.renderWith(n,!1)}renderShadow(n={}){return this.renderWith(n,!0)}renderWith(n,e){this.destroy();let s=wn(this.scripts),o=Sn(this.siblings,s),i=o?Object.assign(Object.create(o),n):{...n},r=new Set([...s].filter(c=>!(c in n)));r.size&&Object.defineProperty(i,le,{value:r}),this.slots&&Object.defineProperty(i,ne,{value:this.slots});let a=X(i),u=k(a);this.data=a,this.fx=u,this.useShadow=e,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let p=this.startMarker,d=(c,f)=>{let l=new CustomEvent(c,{detail:f,bubbles:!0,composed:!0,cancelable:!0});return p===this.startMarker&&this.emitListeners.get(c)?.forEach(T=>T(l,f)),l.cancelBubble||p.dispatchEvent(l),!l.defaultPrevented},m,E=new Promise(c=>{m=c});this.resolveMounted=m;let O=()=>E,x=this.endMarker,y=c=>{let f=[];for(let l=p.nextSibling;l&&l!==x;l=l.nextSibling)l instanceof Element&&(l.matches(c)&&f.push(l),f.push(...Array.from(l.querySelectorAll(c))));return f},S=c=>y(c)[0]??null,R=this.modules,A=c=>R&&c in R?Promise.resolve(R[c]):At(c),h=Object.assign(Object.create(null),{$emit:d,$slots:Object.fromEntries(Object.keys(this.slots??{}).map(c=>[c,!0]))}),g=c=>`await $mounted();${c}`;this.scripts.forEach((c,f)=>{let l={$mounted:O,$self:S,$$self:y,...h,...o},T={filename:this.filename,index:f},j=Bt(c.content);if(j!==null){Vt(a,Et(c.content));let v=":mounted"in c.attrs?g(j):j;$n(v,a,u.effect,l,A,T);return}let{vars:N,code:b}=lt(c.content);Vt(a,J(c.attrs[":setup"])),N.forEach(v=>{v in a||(a[v]=void 0)});let L=":mounted"in c.attrs?g(b):b;En(L,a,u.effect,l,A,T)});let $=document.createDocumentFragment(),w=new Proxy(a,{has:(c,f)=>typeof f=="string"&&f in h||Reflect.has(c,f),get:(c,f,l)=>typeof f=="string"&&f in h&&!Reflect.has(c,f)?h[f]:Reflect.get(c,f,l)});return $.append(this.startMarker,Z(this.template,w,u,e),this.endMarker),this.content=$,e?this.styleEls=this.styles.map(c=>{let f=document.createElement("style");return f.textContent=c.content,f}):(this.styles.forEach(c=>yn(Jt(c))),this.ownsSharedStyles=!0),this}mount(n,e){let s=typeof n=="string"?B(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0)&&this.renderWith(e??{},this.useShadow),this.attach(s)}mountShadow(n,e){let s=typeof n=="string"?B(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0||!this.useShadow)&&this.renderWith(e??{},!0),this.attach(s)}attach(n){this.mountRoot&&this.detach();let e=this.useShadow&&n instanceof Element?n.shadowRoot??n.attachShadow({mode:"open"}):n;return this.useShadow&&this.styleEls.forEach(s=>e.appendChild(s)),e.appendChild(this.content),this.mountRoot=e,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let n=this.startMarker;for(;n;){let e=n.nextSibling;if(this.content.appendChild(n),n===this.endMarker)break;n=e}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(n=>n.parentNode?.removeChild(n)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(n=>bn(Jt(n))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},ft=class{constructor(n){_(this,"chain");this.chain=n}queue(n){return this.chain=this.chain.then(e=>(n(e),e)),this}then(n,e){return this.chain.then(n,e)}catch(n){return this.chain.catch(n)}finally(n){return this.chain.finally(n)}mount(n,e){return this.queue(s=>s.mount(n,e))}mountShadow(n,e){return this.queue(s=>s.mountShadow(n,e))}render(n={}){return this.queue(e=>e.render(n))}renderShadow(n={}){return this.queue(e=>e.renderShadow(n))}on(n,e){return this.queue(s=>s.on(n,e))}off(n,e){return this.queue(s=>s.off(n,e))}detach(){return this.queue(n=>n.detach())}destroy(){return this.queue(n=>n.destroy())}};var An=t=>new F(t),fe={$:B,$$:tt,$create:et,$reactive:X,Component79:F};typeof globalThis<"u"&&globalThis[Tn]&&ue();0&&(module.exports={$,$$,$create,$reactive,C79,Component79,PendingComponent79,enableHotReload,hotUpdate,parseComponent,renderComponent});
13
+ ;$__exports.done = true })()${fe(o.filename,o.index??0)}`)(l,Ln,r,...Object.values(i)),p=b=>console.error("jq79: error in factory script",b),d=!1,g=()=>{if(d)return;d=!0;let b=l.default;if(typeof b!="function")return;let O=x=>{x&&typeof x=="object"&&Object.assign(e,x)};try{let x=b(e,{$data:e,$props:e,$effect:n,...s});x instanceof Promise?x.then(O).catch(p):O(x)}catch(x){p(x)}};u.then(g,p),l.done&&g()},Pn="__JQ79_HMR_ENABLED__",Mn="__JQ79_HMR__",B=null,Dn=t=>{if(!B||!t.filename)return;let e=B.get(t.filename);e||B.set(t.filename,e=new Set),e.add(new WeakRef(t))},ne=t=>{try{return new URL(t,document.baseURI).pathname}catch{return t}},pe=(t,e)=>{if(!B)return 0;let n=ne(t),s=$t(e),r=!1,o=l=>l.name===void 0?s:s.siblings?.[l.name]??null,i=0;for(let[l,u]of B)if(ne(l)===n){for(let p of u){let d=p.deref();if(!d){u.delete(p);continue}let g=o(d);if(!g){r=!0;continue}d.hotReplace(g)&&i++}u.size||B.delete(l)}return r?0:i},he=()=>{B??(B=new Map),globalThis[Mn]={update:pe}},Tt=async t=>{let e=await fetch(t);if(!e.ok)throw new Error(`failed to fetch component from ${t}: ${e.status}`);return new q(await e.text(),{filename:t})},q=class{constructor(e,n={}){N(this,"template");N(this,"scripts");N(this,"styles");N(this,"modules");N(this,"filename");N(this,"siblings");N(this,"name");N(this,"slots");N(this,"data",null);N(this,"fx",null);N(this,"content",null);N(this,"startMarker",null);N(this,"endMarker",null);N(this,"styleEls",[]);N(this,"ownsSharedStyles",!1);N(this,"useShadow",!1);N(this,"mountRoot",null);N(this,"resolveMounted",null);N(this,"emitListeners",new Map);let s=typeof e=="string"?$t(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),this.filename=n.filename??(typeof e=="string"?void 0:e.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),Dn(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([e,n])=>{n.filename??(n.filename=this.filename),n.modules??(n.modules=this.modules),this.name||(this[e]=n)})}hotReplace(e){let n=typeof e=="string"?$t(e):e,s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,l=o?this.endMarker.nextSibling:null,u={...this.data},p=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,this.siblings=n.siblings,this.adoptSiblings(),!r||(this.renderWith(u,p),!i)?!1:(p&&this.styleEls.forEach(d=>i.insertBefore(d,l)),i.insertBefore(this.content,l),this.mountRoot=i,this.resolveMounted?.(),!0)}static fetch(e){if(Array.isArray(e))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new pt(Tt(e))}static fetchAll(e){return Promise.all(e.map(Tt))}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=jn(this.scripts),r=On(this.siblings,s),o=r?Object.assign(Object.create(r),e):{...e},i=new Set([...s].filter(c=>!(c in e)));i.size&&Object.defineProperty(o,de,{value:i}),this.slots&&Object.defineProperty(o,ie,{value:this.slots});let l=X(o),u=I(l);this.data=l,this.fx=u,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let p=this.startMarker,d=(c,f)=>{let a=new CustomEvent(c,{detail:f,bubbles:!0,composed:!0,cancelable:!0});return p===this.startMarker&&this.emitListeners.get(c)?.forEach(w=>w(a,f)),a.cancelBubble||p.dispatchEvent(a),!a.defaultPrevented},g,b=new Promise(c=>{g=c});this.resolveMounted=g;let O=()=>b,x=this.endMarker,y=c=>{let f=[];for(let a=p.nextSibling;a&&a!==x;a=a.nextSibling)a instanceof Element&&(a.matches(c)&&f.push(a),f.push(...Array.from(a.querySelectorAll(c))));return f},R=c=>y(c)[0]??null,$=this.modules,_=c=>$&&c in $?Promise.resolve($[c]):Nt(c),h=Object.assign(Object.create(null),{$emit:d,$slots:Object.fromEntries(Object.keys(this.slots??{}).map(c=>[c,!0]))}),m=c=>`await $mounted();${c}`;this.scripts.forEach((c,f)=>{let a={$mounted:O,$self:R,$$self:y,...h,...r},w={filename:this.filename,index:f},A=Gt(c.content);if(A!==null){te(l,ut(c.content));let L=":mounted"in c.attrs?m(A):A;vn(L,l,u.effect,a,_,w);return}let{vars:j,code:E}=ct(c.content);te(l,G(c.attrs[":setup"])),j.forEach(L=>{L in l||(l[L]=void 0)});let v=":mounted"in c.attrs?m(E):E;An(v,l,u.effect,a,_,w)});let T=document.createDocumentFragment(),S=new Proxy(l,{has:(c,f)=>typeof f=="string"&&f in h||Reflect.has(c,f),get:(c,f,a)=>typeof f=="string"&&f in h&&!Reflect.has(c,f)?h[f]:Reflect.get(c,f,a)});return T.append(this.startMarker,K(this.template,S,u,n),this.endMarker),this.content=T,n?this.styleEls=this.styles.map(c=>{let f=document.createElement("style");return f.textContent=c.content,f}):(this.styles.forEach(c=>Cn(Yt(c))),this.ownsSharedStyles=!0),this}mount(e,n){let s=typeof e=="string"?z(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"?z(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.data?.$dispose(),this.styleEls.forEach(e=>e.parentNode?.removeChild(e)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(e=>_n(Yt(e))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}};N(q,"version",Be);var pt=class{constructor(e){N(this,"chain");this.chain=e}queue(e){return this.chain=this.chain.then(n=>(e(n),n)),this}then(e,n){return this.chain.then(e,n)}catch(e){return this.chain.catch(e)}finally(e){return this.chain.finally(e)}mount(e,n){return this.queue(s=>s.mount(e,n))}mountShadow(e,n){return this.queue(s=>s.mountShadow(e,n))}render(e={}){return this.queue(n=>n.render(e))}renderShadow(e={}){return this.queue(n=>n.renderShadow(e))}on(e,n){return this.queue(s=>s.on(e,n))}off(e,n){return this.queue(s=>s.off(e,n))}detach(){return this.queue(e=>e.detach())}destroy(){return this.queue(e=>e.destroy())}};var qn=t=>new q(t),ge={$:z,$$:et,$create:nt,$reactive:X,Component79:q};typeof globalThis<"u"&&globalThis[Pn]&&he();0&&(module.exports={$,$$,$create,$reactive,C79,Component79,PendingComponent79,enableHotReload,hotUpdate,parseComponent,renderComponent});
14
14
  //# sourceMappingURL=jq79.cjs.map