jq79 0.5.0 → 0.5.2

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