jq79 0.5.1 → 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 ee=Object.defineProperty;var Et=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var wt=Object.prototype.hasOwnProperty;var Rt=(e,t,n)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $t=(e,t)=>{for(var n in t)ee(e,n,{get:t[n],enumerable:!0})},Tt=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of St(t))!wt.call(e,r)&&r!==n&&ee(e,r,{get:()=>t[r],enumerable:!(s=Et(t,r))||s.enumerable});return e};var xt=e=>Tt(ee({},"__esModule",{value:!0}),e);var _=(e,t,n)=>Rt(e,typeof t!="symbol"?t+"":t,n);var Bn={};$t(Bn,{$:()=>Z,$$:()=>te,$create:()=>ne,$reactive:()=>X,C79:()=>W,Component79:()=>W,PendingComponent79:()=>he,enableHotReload:()=>yt,hotUpdate:()=>mt,parseComponent:()=>In,renderComponent:()=>gn});module.exports=xt(Bn);function Z(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function te(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var ne=(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},Ct=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),ve={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},At=new Set(["http:","https:","mailto:"]);function _t(e){try{let t=new URL(e,"https://example.com");return At.has(t.protocol)}catch{return!1}}var jt={"https:":"443","http:":"80"};function Nt(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 Me=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(Nt).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||jt[n.protocol]||"";return t.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function Ot(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var Pe=512;function De(e,t,n,s){if(n>Pe)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${Pe} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=Lt(r,n,s);o&&t.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function Lt(e,t,n){let s=e.tagName.toLowerCase();if(!Ct.has(s))return null;let r=document.createElement(s);for(let o of Array.from(e.attributes)){let i=o.name.toLowerCase(),a=ve[s]?.has(i),c=ve["*"]?.has(i);!a&&!c||(i==="href"||i==="src")&&(!_t(o.value)||n&&!Ot(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),De(e,r,t+1,n),r}function qe(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return De(n.content,s,0,t?.allowUrl),s.innerHTML}var vt=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),Ue=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ke=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&Ue(r)?ke(r,o,n):n(o,r)})},Pt=(e,t)=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`),me=Symbol("jq79.raw"),se=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[me];)t=t[me];return t},Fe=Symbol("jq79.store"),V=e=>e!==null&&typeof e=="object"&&e[Fe]===!0,G=[],J=e=>{G.push(new Set);try{return e()}finally{G.pop()}},We="$__attach",re=Symbol("jq79.alsoWakenBy"),X=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(S=>S(b,h)),n.forEach(S=>S(h,b)),s.forEach(S=>{($||Array.from(S.deps).some(j=>Pt(j,h)))&&S.run()})},a=h=>h!==null&&typeof h=="object"&&Ue(h),c=new Map,d=(h,b)=>{let $=c.get(b);$?.store!==h&&($?.unsubscribe(),c.set(b,{store:h,unsubscribe:h.$onAny((S,j)=>i(`${b}.${S}`,j))}))},u=h=>{c.get(h)?.unsubscribe(),c.delete(h)},m=(h,b)=>{let $=r.get(h);if($)return $;let S=null,j=new Proxy(h,{has(f,l){return Reflect.has(f,l)||typeof l=="string"&&S?.has(l)===!0},get(f,l,p){if(l===me)return f;if(l===Fe)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;G[G.length-1]?.add(g);let C=Reflect.get(f,l,p);if(V(C))return d(C,g),C;let R=se(C);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 C=b?`${b}.${l}`:l,R=V(p)?p:se(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,S?.delete(l),V(R)?d(R,C):u(C);let O=V(R)||!a(R)?R:m(R,C);return i(C,O,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=b?`${b}.${l}`:l;(S??(S=new Set)).add(l),u(C),i(C,void 0)}return g}});return r.set(h,j),j},E=m(se(e),"");Object.entries(se(e)).forEach(([h,b])=>{V(b)&&d(b,h)});let N=(h,b,{immediate:$=!1}={})=>(t.has(h)||t.set(h,new Set),t.get(h).add(b),$&&b(vt(E,h),h),()=>t.get(h)?.delete(b)),x=(h,{immediate:b=!1}={})=>(n.add(h),b&&ke(E,"",($,S)=>h($,S)),()=>n.delete(h)),L=(h,b)=>{let $=!1,S=!1,j={deps:new Set,run:()=>{if($){S=!0;return}$=!0;try{let f=0;do{S=!1;let l=new Set;G.push(l);try{h()}finally{G.pop(),j.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{$=!1}}};return s.add(j),b?.length?y(j,b):(j.run(),()=>{s.delete(j)})},y=(h,b)=>{let $=b.map(S=>S?.[We]?.(h)).filter(Boolean);return h.run(),()=>{s.delete(h),$.forEach(S=>S())}},w=h=>(s.add(h),()=>{s.delete(h)}),T=()=>{c.forEach(({unsubscribe:h})=>h()),c.clear()};return o.$on=N,o.$onAny=x,o.$effect=L,o.$dispose=T,o[We]=w,E},H=e=>{let t=[],n=[],s=e[re];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 Ie=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Be=/\$:\s*/y,ie=/import(?=\s*\()/y,He=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,k=(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},oe=(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},Mt=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),F=(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 Mt.has(e.slice(r,n+1))}return(s==="+"||s==="-")&&e[n-1]===s?!1:!")]}\"'`.".includes(s)},I=(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},Dt=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,qt=(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""},ze=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=k(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==="/"&&F(e,s)){s=I(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=oe(e,s+1);if(!(o<e.length&&(Dt.test(e.slice(o,o+2))||[",","="].includes(qt(e,s)))))return s;s=o;continue}}s++}return e.length},Wt=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=k(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==="/"&&F(e,i)){i=I(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},ye=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return le.test(t)?[t]:[];let n=[];for(let s of Ee(t.slice(1,Ge(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=Se(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=be(s,":");if(o!==-1){n.push(...ye(s.slice(o+1)));continue}}n.push(...ye(s))}return n},Ut=e=>{let t=[],n=Wt(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=Se(c),m=(u===-1?c:c.slice(0,u)).trim(),E=c[0]==="{"||c[0]==="[";E?t.push(...ye(m)):le.test(m)&&t.push(m);let N=ce(c).code;return{text:`${a}${E?`(${N})`:N}${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}},ce=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=k(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==="/"&&F(e,s)){let c=I(e,s);n+=e.slice(s,c),s=c,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(ie.lastIndex=s,ie.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){Ie.lastIndex=s;let c=Ie.exec(e);if(c){let u=s+c[0].length,m=ze(e,u),{vars:E,code:N}=Ut(e.slice(u,m));t.push(...E),n+=N,s=m,o=!1;continue}Be.lastIndex=s;let d=Be.exec(e);if(d){He.lastIndex=s;let u=He.exec(e);u&&t.push(u[1]);let m=s+d[0].length,E=ze(e,m);n+=`$__effect(() => { ${ce(e.slice(m,E)).code} });`,s=E;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}},ae=/export\s+default(?![\w$])/y,Ze=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,kt=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},Ft=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=kt(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(", ")}`},le=/^[A-Za-z_$][\w$]*$/,Ge=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=k(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==="/"&&F(e,n)){n=I(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},be=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=k(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&&F(e,s)){s=I(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},Ee=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=k(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==="/"&&F(e,r)){r=I(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},Se=e=>{let t=0;for(;t<e.length;){let n=be(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},ue=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=Ge(t);if(n>=t.length)return null;let s=[];for(let r of Ee(t.slice(1,n))){if(r.startsWith("..."))continue;let o=Se(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),c=be(i,":"),d=(c===-1?i:i.slice(0,c)).trim();if(!le.test(d))continue;let u={name:d};a!==void 0&&(u.default=a);let m=c===-1?"":i.slice(c+1).trim();le.test(m)&&(u.as=m),s.push(u)}return s},It=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=k(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==="/"&&F(e,t)){t=I(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){ae.lastIndex=t;let o=ae.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},Bt=/^async(?![\w$])/,Ht=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,zt=e=>{let t=It(e);if(t===-1)return null;let n=oe(e,t),s=e.slice(n);Bt.test(s)&&(n=oe(e,n+5));let r=Ht.exec(e.slice(n));if(r&&(n=oe(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=k(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==="/"&&F(e,i)){i=I(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return Ee(e.slice(n+1,i))[0]??""},fe=e=>{let t=zt(e);if(t===null)return null;let n=ue(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},Ke=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=k(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==="/"&&F(e,n)){let u=I(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="i"&&d){if(ie.lastIndex=n,ie.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){Ze.lastIndex=n;let u=Ze.exec(e);if(u){t+=Ft(u[1],u[3],i++),n+=u[0].length,r=!1;continue}}}if(a==="e"&&d&&s===0&&r){ae.lastIndex=n;let u=ae.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 Zt="0.5.1",it=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),at=e=>({tag:e.tagName.toLowerCase(),attrs:it(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?[at(t)]:[]})}),Ve=new Map,lt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=Ve.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
- ); }`)}catch{s=null}Ve.set(n,s)}return s},A=(e,t,n)=>{let s=lt(e,n?Object.keys(n):[]);if(s)try{return s(t,...n?Object.values(n):[])}catch{return}},Gt=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>A(s,t)??""),Kt=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),xe=e=>Kt.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),Vt=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Jt=(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=A(n,s,{$event:a});typeof c=="function"&&c.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},Xt=(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),J(()=>{let d=A(n,s,{$event:c});typeof d=="function"&&d(c)})};e.on(r,a)},B=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),Re=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Ce=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},de=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Qt=({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}},Je=(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},Xe=200,we=0,ct=Symbol("jq79.slots"),Yt=e=>e==="slot"||e.startsWith("slot."),ut=e=>e?B(e):"default",Ae=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),en=e=>e==="default"?":slot":`:slot.${e}`,tn=e=>typeof e!="string"||e.trim()!=="",nn=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?Ae(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=ut(o.slice(6));if(i in t){console.warn(`jq79: two <template ${en(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(tn);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},sn=(e,t,n)=>{ue(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?A(o,e):a},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},rn=e=>{let t=Ae(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}`)},on=(e,t)=>{let n=Object.entries(nn(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=an(o,t)}),s},an=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);sn(i,e.binder,n);let a=i[re]??[];Object.defineProperty(i,re,{value:[...a,s]});let c=H(i);return r.onDispose(()=>c.dispose()),K(e.nodes,i,c,o)},ln=(e,t,n,s)=>{let r=ut(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let c=t[ct]?.[r];if(!c)return o.insertBefore(K(e.children,t,n,s),a),o;let d={};return Object.entries(e.attrs).forEach(([u,m])=>{if(!(u===ge||xe(u)||u.startsWith("@")))if(u.startsWith(":")){let E=m||u.slice(1);d[B(u.slice(1))]=()=>A(E,t)}else d[B(u)]=()=>m}),o.insertBefore(c(d,t,n,s),a),o},Qe=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let c=on(t,n),d={},u={},m=[],E=[],N=!1;Object.entries(t.attrs).forEach(([f,l])=>{if(f!==ge){if(f===":props"||f.startsWith(":props.")){N=!0,E.push({expr:l});return}if(!xe(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,E.push({name:p,expr:l||p})}else{let p=B(f),g=JSON.stringify(l);d[p]=g,E.push({name:p,expr:g})}}});let x=f=>f==="default"?":model":`:model.${f}`,L=f=>f==="default"?"model":f,y=f=>`${f}
9
- = $value`,w=new Set;Object.entries(u).forEach(([f,l])=>{let p=L(f);d[p]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${p}" through both :${p} and ${x(f)} - ${x(f)} wins`),d[p]=l,lt(y(l),["$value"])===null&&(w.add(f),console.warn(`jq79: ${x(f)}="${l}" is not assignable - updates from <${t.tag}> will be dropped`))});let T=()=>{let f={};return E.forEach(({name:l,expr:p})=>{if(l!==void 0)f[l]=A(p,n);else{let g=A(p,n);g!==null&&typeof g=="object"&&Object.assign(f,g)}}),Object.entries(u).forEach(([l,p])=>{f[L(l)]=A(p,n)}),f},h=null,b=null,$=null,S=new Set,j=f=>{if(f==null){if(!n[gt]?.has(e)||S.has("unfilled"))return;S.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}S.has("type")||(S.add("type"),console.error(`jq79: <${t.tag}> is ${typeof f}, not a component - nothing renders here`))};return s.effect(()=>{let f=A(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 O=new Set;p.modelWriteback=(v,U)=>{let M=v==null?"default":B(String(v)),Le=u[M];return Le===void 0?(O.has(M)||(O.add(M),console.warn(`jq79: <${t.tag}> has no ${x(M)} - bound: ${Object.keys(u).map(x).join(", ")}`)),!1):w.has(M)?!1:(J(()=>A(y(Le),n,{$value:U})),!0)}}m.forEach(([O,v])=>Xt(p,O,v,n));let g=Pn(p.scripts);Mn(t,e,Object.keys(d),g);let C=st(J(T),g),R=document.createDocumentFragment();if(we>=Xe){console.error(`jq79: <${t.tag}> is ${Xe} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}we++;try{(r?p.renderShadow(C):p.render(C)).mount(R)}finally{we--}i.parentNode.insertBefore(R,i);let P=H(n);if(N){let O=[];P.effect(()=>{let v=st(T(),g),U=Object.keys(v);O.forEach(M=>{M in v||(p.data[M]=void 0)}),U.forEach(M=>{p.data[M]=v[M]}),O=U})}else Object.entries(d).forEach(([O,v])=>{g!==null&&!g.has(O)||P.effect(()=>{p.data[O]=A(v,n)})});$=P,h=p}),s.onDispose(()=>{$?.dispose(),h?.destroy()}),a},cn=(e,t)=>{let n=()=>{let s=A(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)}})},Y=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(Y):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?Y(t):[]):[],un=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Me(e):()=>!1,fn=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"]),Ye=(e,t,n)=>{let s=fn.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},_e=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?cn(r,t):t;if(Yt(e.tag))return ln(e,o,n,s);if(e.tag==="template"&&Ae(e)!==void 0)return rn(e);let i=Je(o,e.tag);if(i)return Qe(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=Je(o,e.tag);if(!w)return;y=!0;let T=Qe(w,e,o,n,s),h=Ce(T);n.onDispose(()=>de(h)),a.replaceWith(T)})}Object.entries(e.attrs).forEach(([y,w])=>{if(y.startsWith("@"))Jt(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(!xe(y))if(y.startsWith(":"))if(c)a.setAttribute(y,w);else{let T=y.slice(1),h=w||B(T);n.effect(()=>Ye(a,T,A(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=A(d,o);y=w&&typeof w=="object"?Object.keys(w):[],y.forEach(T=>Ye(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(Y(e.attrs.class??"")),w=[];n.effect(()=>{let T=u!==void 0?Y(A(u,o)):[];m.forEach(([h,b])=>{A(b,o)&&T.push(...Y(h))}),w.forEach(h=>{!T.includes(h)&&!y.has(h)&&a.classList.remove(h)}),a.classList.add(...T),w=T})}let E=e.attrs[":text"],N=e.attrs[":html"],x=e.attrs[":html.allowed"];x!==void 0&&N===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),E!==void 0?n.effect(()=>{a.textContent=String(A(E,o)??"")}):N!==void 0?n.effect(()=>{let y=x!==void 0?{allowUrl:un(A(x,o))}:void 0;a.innerHTML=qe(String(A(N,o)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(K(e.children,o,n,s)):a.appendChild(K(e.children,o,n,s));let L=e.attrs[":value"];return L!==void 0&&n.effect(()=>{let y=String(A(L,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]=!!A(w,o)})}),a},dn=(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||A(m.expr,t))??null;if(d===a||(c?.dispose(),i&&de(i),i=null,a=d,!d))return;c=H(t);let u=_e(d.node,t,c,s);i=Ce(u),r.parentNode.insertBefore(u,r.nextSibling)}),o},Q=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},pn=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},hn=(e,t,n,s)=>{let r=e.attrs[":each"].match(Vt);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,E={...e,attrs:m},N=document.createComment("each"),x=document.createDocumentFragment();x.appendChild(N),(":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 L=[],y=!1;return n.effect(()=>{let w=A(a,t),T=Array.isArray(w)?w.map((f,l)=>[l,f]):pn(w)?Object.entries(w):[],h=new Map;L.forEach(f=>{let l=h.get(f.key);l?l.push(f):h.set(f.key,[f])});let b=new Set,$=[],S=T.map(([f,l],p)=>{let g=Object.create(t);Q(g,o,l),i&&Q(g,i,f),Q(g,"$index",p);let C=c!==void 0?A(c,g):f;b.has(C)&&!y&&(y=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),b.add(C);let R=h.get(C)?.shift();if(R&&Object.is(R.item,l))return R.scope.$index!==p&&$.push(R),Q(R.scope,"$index",p),i&&Q(R.scope,i,f),R;R&&(R.fx.dispose(),de(R.range));let P=H(t),O=Ce(_e(E,g,P,s));return{key:C,item:l,scope:g,fx:P,range:O}});h.forEach(f=>f.forEach(l=>{l.fx.dispose(),de(l.range)}));let j=N;S.forEach(f=>{j.nextSibling!==f.range.first&&Qt(f.range,j),j=f.range.last}),$.forEach(f=>J(()=>f.fx.refresh())),L=S}),x},K=(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=Gt(i,t)}),r.appendChild(a),o++;continue}if(":each"in i.attrs){r.appendChild(hn(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 E=e[m];if(typeof E=="object"&&u in E.attrs)return o=m+1,E};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(dn(a,t,n,s));continue}r.appendChild(_e(i,t,n,s)),o++}return r},gn=(e,t,n=!1)=>K(e.template,t,H(t),n),mn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,je=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,bn=e=>e.split(je).map((t,n)=>n%2===1?t:t.replace(yn,(s,r,o)=>mn.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),ft=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,En=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,Sn=e=>e.split(je).map((t,n)=>n%2===1?t:t.replace(ft,(s,r,o)=>{let i=0,a=o.replace(En,(c,d,u)=>u===void 0?c:`${d}:props.${i++}="${u}"`);return`<${r}${a}>`})).join(""),wn=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,Rn=/<\/slot\.([\w.$-]+)(\s*)>/gi,$n=/^slot\./i,Tn=e=>$n.test(e)?`slot.${Re(e.slice(5))}`:e,xn=e=>e.split(je).map((t,n)=>n%2===1?t:t.replace(ft,(s,r,o)=>{let i=o.replace(wn,(a,c,d)=>d===void 0?a:`${c}${Re(d)}`);return`<${Tn(r)}${i}>`}).replace(Rn,(s,r,o)=>`</slot.${Re(r)}${o}>`)).join(""),ge="data-jq79",Cn=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)},dt=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[ge]=t,dt(n.children,t))})},An=(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}[${ge}="${t}"]${i}`}).join(", "),pt=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=An(n.selectorText,t):n instanceof CSSGroupingRule&&pt(n.cssRules,t)})},_n=(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),pt(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
- `)},jn=/^[A-Z][A-Za-z0-9]*$/,$e=e=>{let t=bn(Sn(xn(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=et(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(!jn.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({...et(Array.from(c.content.children),c.innerHTML),siblings:a,name:d})}),Object.keys(a).length&&(i.siblings=a),i},et=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:it(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(at(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=Cn(t);dt(r,i),s.forEach(a=>{o(a)&&(a.scoped=_n(a.content,i))})}return{template:r,scripts:n,styles:s}},Ne=e=>/\.html?([?#]|$)/.test(e)?Te(e):import(e),ht=(e,t)=>e?`
11
- //# sourceURL=${e}?jq79-script=${t}`:"",tt=e=>e.scoped??e.content,pe=new Map,Nn=e=>{let t=pe.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},pe.set(e,t)}t.count++},On=e=>{let t=pe.get(e);t&&--t.count<=0&&(t.el.remove(),pe.delete(e))},Ln=(e,t,n,s={},r=Ne,o={})=>{let i={...bt,...s},a=new Proxy(t,{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) { ${e} } })()${ht(o.filename,o.index??0)}`)(a,n,r,...Object.values(i)).catch(d=>console.error("jq79: error in :setup script",d))},nt=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:A(s,e))})},Oe=e=>{let t=e.attrs[":setup"];return t===void 0?null:t.trim()===""?[]:ue(t)},vn=e=>{let t=new Set;return e.forEach(n=>{(fe(n.content)??Oe(n))?.forEach(({name:r})=>t.add(r))}),t},Pn=e=>{let t=null;return e.forEach(n=>{let s=fe(n.content)??Oe(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:o})=>r.add(o))}),t},st=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},rt=new WeakMap,Mn=(e,t,n,s)=>{if(s===null)return;let r=rt.get(e)??new Set;rt.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`))})},Dn=(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},gt=Symbol("jq79.unfilledProps"),qn=e=>e&&e.default!==void 0?e.default:e,Wn=(e,t,n,s={},r=Ne,o={})=>{let i={...bt,...s},a={},c=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
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
12
  ${e}
13
- ;$__exports.done = true })()${ht(o.filename,o.index??0)}`)(a,qn,r,...Object.values(i)),d=E=>console.error("jq79: error in factory script",E),u=!1,m=()=>{if(u)return;u=!0;let E=a.default;if(typeof E!="function")return;let N=x=>{x&&typeof x=="object"&&Object.assign(t,x)};try{let x=E(t,{$data:t,$props:t,$effect:n,...s});x instanceof Promise?x.then(N).catch(d):N(x)}catch(x){d(x)}};c.then(m,d),a.done&&m()},Un="__JQ79_HMR_ENABLED__",kn="__JQ79_HMR__",z=null,Fn=e=>{if(!z||!e.filename)return;let t=z.get(e.filename);t||z.set(e.filename,t=new Set),t.add(new WeakRef(e))},ot=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},mt=(e,t)=>{if(!z)return 0;let n=ot(e),s=$e(t),r=!1,o=a=>a.name===void 0?s:s.siblings?.[a.name]??null,i=0;for(let[a,c]of z)if(ot(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||z.delete(a)}return r?0:i},yt=()=>{z??(z=new Map),globalThis[kn]={update:mt}},Te=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"?$e(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(),Fn(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"?$e(t):t,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 he(Te(t))}static fetchAll(t){return Promise.all(t.map(Te))}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=vn(this.scripts),r=Dn(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,gt,{value:i}),this.slots&&Object.defineProperty(o,ct,{value:this.slots});let a=X(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(C=>C(g,p)),g.cancelBubble||d.dispatchEvent(g),!g.defaultPrevented},E,N=new Promise(l=>{E=l});this.resolveMounted=E;let x=()=>N,L=this.endMarker,y=l=>{let p=[];for(let g=d.nextSibling;g&&g!==L;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]):Ne(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]))}),S=l=>`await $mounted();${l}`;this.scripts.forEach((l,p)=>{let g={$mounted:x,$self:w,$$self:y,...$,...r},C={filename:this.filename,index:p},R=Ke(l.content);if(R!==null){nt(a,fe(l.content));let U=":mounted"in l.attrs?S(R):R;Wn(U,a,c.effect,g,h,C);return}let{vars:P,code:O}=ce(l.content);nt(a,Oe(l)),P.forEach(U=>{U in a||(a[U]=void 0)});let v=":mounted"in l.attrs?S(O):O;Ln(v,a,c.effect,g,h,C)});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,K(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=>Nn(tt(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=>On(tt(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}};_(W,"version",Zt);var he=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 In=e=>new W(e),bt={$:Z,$$:te,$create:ne,$reactive:X,Component79:W};typeof globalThis<"u"&&globalThis[Un]&&yt();0&&(module.exports={$,$$,$create,$reactive,C79,Component79,PendingComponent79,enableHotReload,hotUpdate,parseComponent,renderComponent});
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