jq79 0.3.30 → 0.3.32

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.js CHANGED
@@ -1,10 +1,11 @@
1
- var Ce=Object.defineProperty;var _e=(e,t,n)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $=(e,t,n)=>_e(e,typeof t!="symbol"?t+"":t,n);function M(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function U(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var W=(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},Le=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),X={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},ve=new Set(["http:","https:","mailto:"]);function Ne(e){try{let t=new URL(e,"https://example.com");return ve.has(t.protocol)}catch{return!1}}function Q(e,t){for(let n of Array.from(e.childNodes))if(n.nodeType===Node.ELEMENT_NODE){let s=Ae(n);s&&t.appendChild(s)}else n.nodeType===Node.TEXT_NODE&&t.appendChild(n.cloneNode())}function Ae(e){let t=e.tagName.toLowerCase();if(!Le.has(t))return null;let n=document.createElement(t);for(let s of Array.from(e.attributes)){let r=s.name.toLowerCase(),o=X[t]?.has(r),c=X["*"]?.has(r);!o&&!c||(r==="href"||r==="src")&&!Ne(s.value)||n.setAttribute(r,s.value)}return t==="a"&&n.setAttribute("rel","noopener noreferrer"),Q(e,n),n}function Y(e){let t=new DOMParser().parseFromString(e,"text/html"),n=document.createElement("div");return Q(t.body,n),n.innerHTML}var Oe=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),ee=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},te=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&ee(r)?te(r,o,n):n(o,r)})},Me=(e,t)=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`),H=Symbol("jq79.raw"),D=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[H];)t=t[H];return t},ne=Symbol("jq79.store"),j=e=>e!==null&&typeof e=="object"&&e[ne]===!0,N=[],se=e=>{N.push(new Set);try{return e()}finally{N.pop()}},k=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),c=(a,u,g=!1)=>{t.get(a)?.forEach(b=>b(u,a)),n.forEach(b=>b(a,u)),s.forEach(b=>{(g||Array.from(b.deps).some(m=>Me(m,a)))&&b.run()})},i=a=>a!==null&&typeof a=="object"&&ee(a),l=new Map,h=(a,u)=>{let g=l.get(u);g?.store!==a&&(g?.unsubscribe(),l.set(u,{store:a,unsubscribe:a.$onAny((b,m)=>c(`${u}.${b}`,m))}))},f=a=>{l.get(a)?.unsubscribe(),l.delete(a)},p=(a,u)=>{let g=r.get(a);if(g)return g;let b=new Proxy(a,{get(m,S,w){if(S===H)return m;if(S===ne)return u==="";if(typeof S!="string")return Reflect.get(m,S,w);if(u===""&&S in o)return o[S];let C=u?`${u}.${S}`:S;N[N.length-1]?.add(C);let R=Reflect.get(m,S,w);if(j(R))return h(R,C),R;let x=D(R);return i(x)?p(x,C):x},set(m,S,w,C){if(C!==b&&!Object.prototype.hasOwnProperty.call(m,S))return Reflect.set(m,S,w,C);let R=u?`${u}.${S}`:S,x=j(w)?w:D(w),xe=!Object.prototype.hasOwnProperty.call(m,S);m[S]=x,j(x)?h(x,R):f(R);let Te=j(x)||!i(x)?x:p(x,R);return c(R,Te,xe),!0}});return r.set(a,b),b},d=p(D(e),"");Object.entries(D(e)).forEach(([a,u])=>{j(u)&&h(u,a)});let E=(a,u,{immediate:g=!1}={})=>(t.has(a)||t.set(a,new Set),t.get(a).add(u),g&&u(Oe(d,a),a),()=>t.get(a)?.delete(u)),y=(a,{immediate:u=!1}={})=>(n.add(a),u&&te(d,"",(g,b)=>a(g,b)),()=>n.delete(a)),_=a=>{let u={deps:new Set,run:()=>{let g=new Set;N.push(g);try{a()}finally{N.pop(),u.deps=g}}};return s.add(u),u.run(),()=>{s.delete(u)}},L=()=>{l.forEach(({unsubscribe:a})=>a()),l.clear()};return o.$on=E,o.$onAny=y,o.$effect=_,o.$dispose=L,d},A=e=>{let t=[];return{effect:n=>{t.push(e.$effect(n))},onDispose:n=>{t.push(n)},dispose:()=>{t.splice(0).forEach(n=>n())}}};var re=/(?:let|var|const)\s+([A-Za-z_$][\w$]*)/y,oe=/\$:\s*/y,P=/import(?=\s*\()/y,ie=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,q=(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},F=(e,t)=>{let n=e.indexOf(`
2
- `,t);return n===-1?e.length:n},B=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},je=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=F(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=B(e,n);continue}break}return n},De=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,ke=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=q(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=F(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=B(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else{if(n<=0&&r===";")return s;if(n<=0&&r===`
3
- `){let o=je(e,s+1);if(o>=e.length||!De.test(e.slice(o,o+2)))return s;s=o;continue}}s++}return e.length},le=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let c=e[s],i=e[s+1];if(c==="'"||c==='"'||c==="`"){let l=q(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(c==="/"&&(i==="/"||i==="*")){let l=i==="/"?F(e,s):B(e,s);n+=e.slice(s,l),s=l;continue}if(c==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(P.lastIndex=s,P.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){re.lastIndex=s;let l=re.exec(e);if(l){t.push(l[1]),n+=l[1],s+=l[0].length,o=!1;continue}oe.lastIndex=s;let h=oe.exec(e);if(h){ie.lastIndex=s;let f=ie.exec(e);f&&t.push(f[1]);let p=s+h[0].length,d=ke(e,p);n+=`$__effect(() => { ${e.slice(p,d)} });`,s=d;continue}}"([{".includes(c)?r++:")]}".includes(c)&&(r=Math.max(0,r-1)),c===`
4
- `||c===";"||c==="}"?o=!0:/\s/.test(c)||(o=!1),n+=c,s++}return{vars:t,code:n}},ce=/export\s+default(?![\w$])/y,ae=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Pe=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 c=e.slice(s,r).trim();c&&t.push(c),s=r+1}}return t},Fe=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=Pe(e),o=[],c=s;if(r.length>1){let i=`$__mod${n}`;o.push(`${i} = ${s}`),c=i}for(let i of r)i.startsWith("{")?o.push(`${i.replace(/\s+as\s+/g,": ")} = ${c}`):i.startsWith("*")?o.push(`${i.replace(/^\*\s*as\s+/,"")} = ${c}`):o.push(`${i} = $__default(${c})`);return`const ${o.join(", ")}`},fe=e=>{let t="",n=0,s=0,r=!0,o=!1,c=0;for(;n<e.length;){let i=e[n],l=e[n+1],h=n===0||!/[\w$.]/.test(e[n-1]);if(i==="'"||i==='"'||i==="`"){let f=q(e,n);t+=e.slice(n,f),n=f,r=!1;continue}if(i==="/"&&(l==="/"||l==="*")){let f=l==="/"?F(e,n):B(e,n);t+=e.slice(n,f),n=f;continue}if(i==="i"&&h){if(P.lastIndex=n,P.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){ae.lastIndex=n;let f=ae.exec(e);if(f){t+=Fe(f[1],f[3],c++),n+=f[0].length,r=!1;continue}}}if(i==="e"&&h&&s===0&&r){ce.lastIndex=n;let f=ce.exec(e);if(f){o=!0,t+="$__exports.default =",n+=f[0].length,r=!1;continue}}"([{".includes(i)?s++:")]}".includes(i)&&(s=Math.max(0,s-1)),i===`
5
- `||i===";"||i==="}"?r=!0:/\s/.test(i)||(r=!1),t+=i,n++}return o?t:null};var ye=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),Ee=e=>({tag:e.tagName.toLowerCase(),attrs:ye(e),children:Array.from(e.childNodes).flatMap(t=>{if(t.nodeType===Node.TEXT_NODE){let n=t.textContent??"";return n?[n]:[]}return t.nodeType===Node.ELEMENT_NODE?[Ee(t)]:[]})}),ue=new Map,Be=(e,t)=>{let n=`${t.join(",")}|${e}`,s=ue.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}); }`)}catch{s=null}ue.set(n,s)}return s},T=(e,t,n)=>{let s=Be(e,n?Object.keys(n):[]);if(s)try{return s(t,...n?Object.values(n):[])}catch{return}},Ie=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>T(s,t)??""),be=new Set([":attrs",":if",":elseif",":else",":each",":key",":with",":text",":html"]),Ue=/^\s*(\w+)\s+in\s+([\s\S]+)$/,We=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),c=new Set(o);e.addEventListener(r,i=>{if(c.has("self")&&i.target!==e)return;c.has("prevent")&&i.preventDefault(),c.has("stop")&&i.stopPropagation();let l=T(n,s,{$event:i});typeof l=="function"&&l.call(e,i)},{once:c.has("once"),capture:c.has("capture")})},de=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),pe=(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},he=(e,t,n,s,r)=>{let o=document.createComment(e),c=document.createDocumentFragment();c.appendChild(o);let i={};Object.entries(t.attrs).forEach(([p,d])=>{if(!(p===V||be.has(p)||p.startsWith("@")))if(p.startsWith(":")){let E=de(p.slice(1));i[E]=d||E}else i[de(p)]=JSON.stringify(d)});let l=null,h=null,f=null;return s.effect(()=>{let p=T(e,n),d=p instanceof O?p:null;if(d===h||(f?.dispose(),f=null,l?.destroy(),l=null,h=d,!d))return;let E=new O({template:d.template,scripts:d.scripts,styles:d.styles,modules:d.modules,filename:d.filename}),y=se(()=>Object.fromEntries(Object.entries(i).map(([a,u])=>[a,T(u,n)]))),_=document.createDocumentFragment();(r?E.renderShadow(y):E.render(y)).mount(_),o.parentNode.insertBefore(_,o.nextSibling);let L=A(n);Object.entries(i).forEach(([a,u])=>{L.effect(()=>{E.data[a]=T(u,n)})}),f=L,l=E}),s.onDispose(()=>{f?.dispose(),l?.destroy()}),c},He=(e,t)=>{let n=()=>{let s=T(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 c=n();return c!==null&&Reflect.has(c,r)?(c[r]=o,!0):Reflect.set(s,r,o)}})},K=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?He(r,t):t,c=pe(o,e.tag);if(c)return he(c,e,o,n,s);let i=document.createElement(e.tag);if(i instanceof HTMLUnknownElement||e.tag.includes("-")){let p=!1;n.effect(()=>{if(p)return;let d=pe(o,e.tag);d&&(p=!0,i.replaceWith(he(d,e,o,n,s)))})}Object.entries(e.attrs).forEach(([p,d])=>{p.startsWith("@")?We(i,p,d,o):be.has(p)||i.setAttribute(p,d)});let l=e.attrs[":attrs"];if(l!==void 0){let p=[];n.effect(()=>{p.forEach(E=>i.removeAttribute(E));let d=T(l,o);p=d&&typeof d=="object"?Object.keys(d):[],p.forEach(E=>{let y=d[E];y!=null&&y!==!1&&i.setAttribute(E,String(y))})})}let h=e.attrs[":text"],f=e.attrs[":html"];return h!==void 0?n.effect(()=>{i.textContent=String(T(h,o)??"")}):f!==void 0?n.effect(()=>{i.innerHTML=Y(String(T(f,o)??""))}):i.appendChild(J(e.children,o,n,s)),i},qe=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let c=null,i=null,l=null;return n.effect(()=>{let h=e.find(f=>f.expr===void 0||T(f.expr,t))??null;h!==i&&(l?.dispose(),c&&c.parentNode?.removeChild(c),c=null,i=h,h&&(l=A(t),c=K(h.node,t,l,s),r.parentNode.insertBefore(c,r.nextSibling)))}),o},z=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},ze=(e,t,n,s)=>{let r=e.attrs[":each"].match(Ue);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,c]=r,i=e.attrs[":key"],{[":each"]:l,[":key"]:h,...f}=e.attrs,p={...e,attrs:f},d=document.createComment("each"),E=document.createDocumentFragment();E.appendChild(d);let y=[];return n.effect(()=>{let _=T(c,t),L=Array.isArray(_)?_:[],a=new Map(y.map(m=>[m.key,m])),u=L.map((m,S)=>{let w=Object.create(t);z(w,o,m),z(w,"$index",S);let C=i!==void 0?T(i,w):S,R=a.get(C);if(R&&Object.is(R.item,m))return z(R.scope,"$index",S),R;R?.fx.dispose(),R?.node.parentNode?.removeChild(R.node);let x=A(t);return{key:C,item:m,scope:w,fx:x,node:K(p,w,x,s)}}),g=new Set(u.map(m=>m.key));y.forEach(m=>{g.has(m.key)||(m.fx.dispose(),m.node.parentNode?.removeChild(m.node))});let b=d;u.forEach(m=>{b.nextSibling!==m.node&&d.parentNode.insertBefore(m.node,b.nextSibling),b=m.node}),y=u}),E},J=(e,t,n,s=!1)=>{let r=document.createDocumentFragment(),o=0;for(;o<e.length;){let c=e[o];if(typeof c=="string"){let i=document.createTextNode(c);c.includes("{{")&&n.effect(()=>{i.textContent=Ie(c,t)}),r.appendChild(i),o++;continue}if(":each"in c.attrs){r.appendChild(ze(c,t,n,s)),o++;continue}if(":if"in c.attrs){let i=[{expr:c.attrs[":if"],node:c}];o++;let l=f=>{let p=o;for(;p<e.length&&typeof e[p]=="string"&&!e[p].trim();)p++;let d=e[p];if(typeof d=="object"&&f in d.attrs)return o=p+1,d};for(let f=l(":elseif");f;f=l(":elseif"))i.push({expr:f.attrs[":elseif"],node:f});let h=l(":else");h&&i.push({node:h}),r.appendChild(qe(i,t,n,s));continue}r.appendChild(K(c,t,n,s)),o++}return r},gt=(e,t,n=!1)=>J(e.template,t,A(t),n),Ge=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ke=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Je=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Ve=e=>e.split(Je).map((t,n)=>n%2===1?t:t.replace(Ke,(s,r,o)=>Ge.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),V="data-jq79",Ze=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)},Se=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[V]=t,Se(n.children,t))})},Xe=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),c=r===-1?"":s.slice(r);return`${o}[${V}="${t}"]${c}`}).join(", "),Re=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Xe(n.selectorText,t):n instanceof CSSGroupingRule&&Re(n.cssRules,t)})},Qe=(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),Re(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
6
- `)},G=e=>{let n=new DOMParser().parseFromString(`<template>${Ve(e)}</template>`,"text/html").querySelector("template"),s=[],r=[],o=[];Array.from(n.content.children).forEach(i=>{let l={attrs:ye(i),content:i.textContent??""};i.tagName==="SCRIPT"?s.push(l):i.tagName==="STYLE"?r.push(l):o.push(Ee(i))}),r.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 c=i=>"scoped"in i.attrs&&!("lang"in i.attrs);if(r.some(c)){let i=Ze(e);Se(o,i),r.forEach(l=>{c(l)&&(l.scoped=Qe(l.content,i))})}return{template:o,scripts:s,styles:r}},Z=e=>/\.html?([?#]|$)/.test(e)?O.fetch(e):import(e),$e=(e,t)=>e?`
7
- //# sourceURL=${e}?jq79-script=${t}`:"",me=e=>e.scoped??e.content,I=new Map,Ye=e=>{let t=I.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},I.set(e,t)}t.count++},et=e=>{let t=I.get(e);t&&--t.count<=0&&(t.el.remove(),I.delete(e))},we={$:M,$$:U,$create:W,$reactive:k},tt=(e,t,n,s={},r=Z,o={})=>{let c={...we,...s},i=new Proxy(t,{has:(h,f)=>f!=="$__effect"&&f!=="$__import"&&(Reflect.has(h,f)||!(f in globalThis)&&!(f in c))});new Function("$scope","$__effect","$__import",...Object.keys(c),`return (async () => { with ($scope) { ${e} } })()${$e(o.filename,o.index??0)}`)(i,n,r,...Object.values(c)).catch(h=>console.error("jq79: error in :setup script",h))},nt=e=>e&&e.default!==void 0?e.default:e,st=(e,t,n,s={},r=Z,o={})=>{let c={...we,...s},i={},l=new Function("$__exports","$__default","$__import",...Object.keys(c),`return (async () => { "use strict";
1
+ var Oe=Object.defineProperty;var Me=(e,t,n)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var w=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);function P(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function H(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var z=(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},je=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),ee={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},De=new Set(["http:","https:","mailto:"]);function Pe(e){try{let t=new URL(e,"https://example.com");return De.has(t.protocol)}catch{return!1}}function te(e,t){for(let n of Array.from(e.childNodes))if(n.nodeType===Node.ELEMENT_NODE){let s=ke(n);s&&t.appendChild(s)}else n.nodeType===Node.TEXT_NODE&&t.appendChild(n.cloneNode())}function ke(e){let t=e.tagName.toLowerCase();if(!je.has(t))return null;let n=document.createElement(t);for(let s of Array.from(e.attributes)){let r=s.name.toLowerCase(),o=ee[t]?.has(r),c=ee["*"]?.has(r);!o&&!c||(r==="href"||r==="src")&&!Pe(s.value)||n.setAttribute(r,s.value)}return t==="a"&&n.setAttribute("rel","noopener noreferrer"),te(e,n),n}function ne(e){let t=new DOMParser().parseFromString(e,"text/html"),n=document.createElement("div");return te(t.body,n),n.innerHTML}var Fe=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),se=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},re=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&se(r)?re(r,o,n):n(o,r)})},Ie=(e,t)=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`),G=Symbol("jq79.raw"),F=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[G];)t=t[G];return t},oe=Symbol("jq79.store"),k=e=>e!==null&&typeof e=="object"&&e[oe]===!0,M=[],ie=e=>{M.push(new Set);try{return e()}finally{M.pop()}},I=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),c=(a,u,g=!1)=>{t.get(a)?.forEach(b=>b(u,a)),n.forEach(b=>b(a,u)),s.forEach(b=>{(g||Array.from(b.deps).some(m=>Ie(m,a)))&&b.run()})},i=a=>a!==null&&typeof a=="object"&&se(a),l=new Map,h=(a,u)=>{let g=l.get(u);g?.store!==a&&(g?.unsubscribe(),l.set(u,{store:a,unsubscribe:a.$onAny((b,m)=>c(`${u}.${b}`,m))}))},f=a=>{l.get(a)?.unsubscribe(),l.delete(a)},p=(a,u)=>{let g=r.get(a);if(g)return g;let b=new Proxy(a,{get(m,S,R){if(S===G)return m;if(S===oe)return u==="";if(typeof S!="string")return Reflect.get(m,S,R);if(u===""&&S in o)return o[S];let C=u?`${u}.${S}`:S;M[M.length-1]?.add(C);let $=Reflect.get(m,S,R);if(k($))return h($,C),$;let x=F($);return i(x)?p(x,C):x},set(m,S,R,C){if(C!==b&&!Object.prototype.hasOwnProperty.call(m,S))return Reflect.set(m,S,R,C);let $=u?`${u}.${S}`:S,x=k(R)?R:F(R),ve=!Object.prototype.hasOwnProperty.call(m,S);m[S]=x,k(x)?h(x,$):f($);let Ae=k(x)||!i(x)?x:p(x,$);return c($,Ae,ve),!0}});return r.set(a,b),b},d=p(F(e),"");Object.entries(F(e)).forEach(([a,u])=>{k(u)&&h(u,a)});let E=(a,u,{immediate:g=!1}={})=>(t.has(a)||t.set(a,new Set),t.get(a).add(u),g&&u(Fe(d,a),a),()=>t.get(a)?.delete(u)),y=(a,{immediate:u=!1}={})=>(n.add(a),u&&re(d,"",(g,b)=>a(g,b)),()=>n.delete(a)),_=a=>{let u={deps:new Set,run:()=>{let g=new Set;M.push(g);try{a()}finally{M.pop(),u.deps=g}}};return s.add(u),u.run(),()=>{s.delete(u)}},N=()=>{l.forEach(({unsubscribe:a})=>a()),l.clear()};return o.$on=E,o.$onAny=y,o.$effect=_,o.$dispose=N,d},j=e=>{let t=[];return{effect:n=>{t.push(e.$effect(n))},onDispose:n=>{t.push(n)},dispose:()=>{t.splice(0).forEach(n=>n())}}};var ce=/(?:let|var|const)\s+([A-Za-z_$][\w$]*)/y,ae=/\$:\s*/y,B=/import(?=\s*\()/y,le=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,L=(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},v=(e,t)=>{let n=e.indexOf(`
2
+ `,t);return n===-1?e.length:n},A=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},W=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=v(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=A(e,n);continue}break}return n},We=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Be=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=L(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=v(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=A(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else{if(n<=0&&r===";")return s;if(n<=0&&r===`
3
+ `){let o=W(e,s+1);if(o>=e.length||!We.test(e.slice(o,o+2)))return s;s=o;continue}}s++}return e.length},ue=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let c=e[s],i=e[s+1];if(c==="'"||c==='"'||c==="`"){let l=L(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(c==="/"&&(i==="/"||i==="*")){let l=i==="/"?v(e,s):A(e,s);n+=e.slice(s,l),s=l;continue}if(c==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(B.lastIndex=s,B.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){ce.lastIndex=s;let l=ce.exec(e);if(l){t.push(l[1]),n+=l[1],s+=l[0].length,o=!1;continue}ae.lastIndex=s;let h=ae.exec(e);if(h){le.lastIndex=s;let f=le.exec(e);f&&t.push(f[1]);let p=s+h[0].length,d=Be(e,p);n+=`$__effect(() => { ${e.slice(p,d)} });`,s=d;continue}}"([{".includes(c)?r++:")]}".includes(c)&&(r=Math.max(0,r-1)),c===`
4
+ `||c===";"||c==="}"?o=!0:/\s/.test(c)||(o=!1),n+=c,s++}return{vars:t,code:n}},U=/export\s+default(?![\w$])/y,fe=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Ue=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 c=e.slice(s,r).trim();c&&t.push(c),s=r+1}}return t},qe=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=Ue(e),o=[],c=s;if(r.length>1){let i=`$__mod${n}`;o.push(`${i} = ${s}`),c=i}for(let i of r)i.startsWith("{")?o.push(`${i.replace(/\s+as\s+/g,": ")} = ${c}`):i.startsWith("*")?o.push(`${i.replace(/^\*\s*as\s+/,"")} = ${c}`):o.push(`${i} = $__default(${c})`);return`const ${o.join(", ")}`},He=/^[A-Za-z_$][\w$]*$/,de=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=L(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=v(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=A(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},pe=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=L(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=v(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=A(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 c=e.slice(s,r).trim();c&&t.push(c),s=r+1}r++}return t},ze=e=>{let t=0;for(;t<e.length;){let n=de(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},K=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=0,s=0;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=L(t,s);continue}if("([{".includes(o))n++;else if(")]}".includes(o)&&--n===0)break;s++}if(s>=t.length)return null;let r=[];for(let o of pe(t.slice(1,s))){if(o.startsWith("..."))continue;let c=ze(o),i=c===-1?o:o.slice(0,c),l=c===-1?void 0:o.slice(c+1).trim(),h=de(i,":"),f=(h===-1?i:i.slice(0,h)).trim();He.test(f)&&r.push(l===void 0?{name:f}:{name:f,default:l})}return r},Ge=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=L(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=v(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=A(e,t);continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){U.lastIndex=t;let o=U.exec(e);if(o)return t+o[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
5
+ `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},Ke=/^async(?![\w$])/,Ze=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Je=e=>{let t=Ge(e);if(t===-1)return null;let n=W(e,t),s=e.slice(n);Ke.test(s)&&(n=W(e,n+5));let r=Ze.exec(e.slice(n));if(r&&(n=W(e,n+r[0].length)),e[n]!=="(")return null;let o=0,c=n;for(;c<e.length;){let i=e[c];if(i==="'"||i==='"'||i==="`"){c=L(e,c);continue}if("([{".includes(i))o++;else if(")]}".includes(i)&&--o===0)break;c++}return pe(e.slice(n+1,c))[0]??""},he=e=>{let t=Je(e);if(t===null)return null;let n=K(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},me=e=>{let t="",n=0,s=0,r=!0,o=!1,c=0;for(;n<e.length;){let i=e[n],l=e[n+1],h=n===0||!/[\w$.]/.test(e[n-1]);if(i==="'"||i==='"'||i==="`"){let f=L(e,n);t+=e.slice(n,f),n=f,r=!1;continue}if(i==="/"&&(l==="/"||l==="*")){let f=l==="/"?v(e,n):A(e,n);t+=e.slice(n,f),n=f;continue}if(i==="i"&&h){if(B.lastIndex=n,B.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){fe.lastIndex=n;let f=fe.exec(e);if(f){t+=qe(f[1],f[3],c++),n+=f[0].length,r=!1;continue}}}if(i==="e"&&h&&s===0&&r){U.lastIndex=n;let f=U.exec(e);if(f){o=!0,t+="$__exports.default =",n+=f[0].length,r=!1;continue}}"([{".includes(i)?s++:")]}".includes(i)&&(s=Math.max(0,s-1)),i===`
6
+ `||i===";"||i==="}"?r=!0:/\s/.test(i)||(r=!1),t+=i,n++}return o?t:null};var Re=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),xe=e=>({tag:e.tagName.toLowerCase(),attrs:Re(e),children:Array.from(e.childNodes).flatMap(t=>{if(t.nodeType===Node.TEXT_NODE){let n=t.textContent??"";return n?[n]:[]}return t.nodeType===Node.ELEMENT_NODE?[xe(t)]:[]})}),ge=new Map,Ve=(e,t)=>{let n=`${t.join(",")}|${e}`,s=ge.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}); }`)}catch{s=null}ge.set(n,s)}return s},T=(e,t,n)=>{let s=Ve(e,n?Object.keys(n):[]);if(s)try{return s(t,...n?Object.values(n):[])}catch{return}},Xe=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>T(s,t)??""),Te=new Set([":attrs",":if",":elseif",":else",":each",":key",":with",":text",":html"]),Qe=/^\s*(\w+)\s+in\s+([\s\S]+)$/,Ye=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),c=new Set(o);e.addEventListener(r,i=>{if(c.has("self")&&i.target!==e)return;c.has("prevent")&&i.preventDefault(),c.has("stop")&&i.stopPropagation();let l=T(n,s,{$event:i});typeof l=="function"&&l.call(e,i)},{once:c.has("once"),capture:c.has("capture")})},ye=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),Ee=(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},be=(e,t,n,s,r)=>{let o=document.createComment(e),c=document.createDocumentFragment();c.appendChild(o);let i={};Object.entries(t.attrs).forEach(([p,d])=>{if(!(p===Q||Te.has(p)||p.startsWith("@")))if(p.startsWith(":")){let E=ye(p.slice(1));i[E]=d||E}else i[ye(p)]=JSON.stringify(d)});let l=null,h=null,f=null;return s.effect(()=>{let p=T(e,n),d=p instanceof D?p:null;if(d===h||(f?.dispose(),f=null,l?.destroy(),l=null,h=d,!d))return;let E=new D({template:d.template,scripts:d.scripts,styles:d.styles,modules:d.modules,filename:d.filename}),y=ie(()=>Object.fromEntries(Object.entries(i).map(([a,u])=>[a,T(u,n)]))),_=document.createDocumentFragment();(r?E.renderShadow(y):E.render(y)).mount(_),o.parentNode.insertBefore(_,o.nextSibling);let N=j(n);Object.entries(i).forEach(([a,u])=>{N.effect(()=>{E.data[a]=T(u,n)})}),f=N,l=E}),s.onDispose(()=>{f?.dispose(),l?.destroy()}),c},et=(e,t)=>{let n=()=>{let s=T(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 c=n();return c!==null&&Reflect.has(c,r)?(c[r]=o,!0):Reflect.set(s,r,o)}})},V=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?et(r,t):t,c=Ee(o,e.tag);if(c)return be(c,e,o,n,s);let i=document.createElement(e.tag);if(i instanceof HTMLUnknownElement||e.tag.includes("-")){let p=!1;n.effect(()=>{if(p)return;let d=Ee(o,e.tag);d&&(p=!0,i.replaceWith(be(d,e,o,n,s)))})}Object.entries(e.attrs).forEach(([p,d])=>{p.startsWith("@")?Ye(i,p,d,o):Te.has(p)||i.setAttribute(p,d)});let l=e.attrs[":attrs"];if(l!==void 0){let p=[];n.effect(()=>{p.forEach(E=>i.removeAttribute(E));let d=T(l,o);p=d&&typeof d=="object"?Object.keys(d):[],p.forEach(E=>{let y=d[E];y!=null&&y!==!1&&i.setAttribute(E,String(y))})})}let h=e.attrs[":text"],f=e.attrs[":html"];return h!==void 0?n.effect(()=>{i.textContent=String(T(h,o)??"")}):f!==void 0?n.effect(()=>{i.innerHTML=ne(String(T(f,o)??""))}):i.appendChild(X(e.children,o,n,s)),i},tt=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let c=null,i=null,l=null;return n.effect(()=>{let h=e.find(f=>f.expr===void 0||T(f.expr,t))??null;h!==i&&(l?.dispose(),c&&c.parentNode?.removeChild(c),c=null,i=h,h&&(l=j(t),c=V(h.node,t,l,s),r.parentNode.insertBefore(c,r.nextSibling)))}),o},Z=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},nt=(e,t,n,s)=>{let r=e.attrs[":each"].match(Qe);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,c]=r,i=e.attrs[":key"],{[":each"]:l,[":key"]:h,...f}=e.attrs,p={...e,attrs:f},d=document.createComment("each"),E=document.createDocumentFragment();E.appendChild(d);let y=[];return n.effect(()=>{let _=T(c,t),N=Array.isArray(_)?_:[],a=new Map(y.map(m=>[m.key,m])),u=N.map((m,S)=>{let R=Object.create(t);Z(R,o,m),Z(R,"$index",S);let C=i!==void 0?T(i,R):S,$=a.get(C);if($&&Object.is($.item,m))return Z($.scope,"$index",S),$;$?.fx.dispose(),$?.node.parentNode?.removeChild($.node);let x=j(t);return{key:C,item:m,scope:R,fx:x,node:V(p,R,x,s)}}),g=new Set(u.map(m=>m.key));y.forEach(m=>{g.has(m.key)||(m.fx.dispose(),m.node.parentNode?.removeChild(m.node))});let b=d;u.forEach(m=>{b.nextSibling!==m.node&&d.parentNode.insertBefore(m.node,b.nextSibling),b=m.node}),y=u}),E},X=(e,t,n,s=!1)=>{let r=document.createDocumentFragment(),o=0;for(;o<e.length;){let c=e[o];if(typeof c=="string"){let i=document.createTextNode(c);c.includes("{{")&&n.effect(()=>{i.textContent=Xe(c,t)}),r.appendChild(i),o++;continue}if(":each"in c.attrs){r.appendChild(nt(c,t,n,s)),o++;continue}if(":if"in c.attrs){let i=[{expr:c.attrs[":if"],node:c}];o++;let l=f=>{let p=o;for(;p<e.length&&typeof e[p]=="string"&&!e[p].trim();)p++;let d=e[p];if(typeof d=="object"&&f in d.attrs)return o=p+1,d};for(let f=l(":elseif");f;f=l(":elseif"))i.push({expr:f.attrs[":elseif"],node:f});let h=l(":else");h&&i.push({node:h}),r.appendChild(tt(i,t,n,s));continue}r.appendChild(V(c,t,n,s)),o++}return r},_t=(e,t,n=!1)=>X(e.template,t,j(t),n),st=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),rt=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,ot=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,it=e=>e.split(ot).map((t,n)=>n%2===1?t:t.replace(rt,(s,r,o)=>st.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),Q="data-jq79",ct=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)},Ce=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Q]=t,Ce(n.children,t))})},at=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),c=r===-1?"":s.slice(r);return`${o}[${Q}="${t}"]${c}`}).join(", "),_e=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=at(n.selectorText,t):n instanceof CSSGroupingRule&&_e(n.cssRules,t)})},lt=(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),_e(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
7
+ `)},J=e=>{let n=new DOMParser().parseFromString(`<template>${it(e)}</template>`,"text/html").querySelector("template"),s=[],r=[],o=[];Array.from(n.content.children).forEach(i=>{let l={attrs:Re(i),content:i.textContent??""};i.tagName==="SCRIPT"?s.push(l):i.tagName==="STYLE"?r.push(l):o.push(xe(i))}),r.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 c=i=>"scoped"in i.attrs&&!("lang"in i.attrs);if(r.some(c)){let i=ct(e);Ce(o,i),r.forEach(l=>{c(l)&&(l.scoped=lt(l.content,i))})}return{template:o,scripts:s,styles:r}},Y=e=>/\.html?([?#]|$)/.test(e)?D.fetch(e):import(e),Ne=(e,t)=>e?`
8
+ //# sourceURL=${e}?jq79-script=${t}`:"",Se=e=>e.scoped??e.content,q=new Map,ft=e=>{let t=q.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},q.set(e,t)}t.count++},ut=e=>{let t=q.get(e);t&&--t.count<=0&&(t.el.remove(),q.delete(e))},Le={$:P,$$:H,$create:z,$reactive:I},dt=(e,t,n,s={},r=Y,o={})=>{let c={...Le,...s},i=new Proxy(t,{has:(h,f)=>f!=="$__effect"&&f!=="$__import"&&(Reflect.has(h,f)||!(f in globalThis)&&!(f in c))});new Function("$scope","$__effect","$__import",...Object.keys(c),`return (async () => { with ($scope) { ${e} } })()${Ne(o.filename,o.index??0)}`)(i,n,r,...Object.values(c)).catch(h=>console.error("jq79: error in :setup script",h))},$e=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:T(s,e))})},pt=e=>e&&e.default!==void 0?e.default:e,ht=(e,t,n,s={},r=Y,o={})=>{let c={...Le,...s},i={},l=new Function("$__exports","$__default","$__import",...Object.keys(c),`return (async () => { "use strict";
8
9
  ${e}
9
- ;$__exports.done = true })()${$e(o.filename,o.index??0)}`)(i,nt,r,...Object.values(c)),h=d=>console.error("jq79: error in factory script",d),f=!1,p=()=>{if(f)return;f=!0;let d=i.default;if(typeof d!="function")return;let E=y=>{y&&typeof y=="object"&&Object.assign(t,y)};try{let y=d({$data:t,$effect:n,...s});y instanceof Promise?y.then(E).catch(h):E(y)}catch(y){h(y)}};l.then(p,h),i.done&&p()},rt="__JQ79_HMR_ENABLED__",ot="__JQ79_HMR__",v=null,it=e=>{if(!v||!e.filename)return;let t=v.get(e.filename);t||v.set(e.filename,t=new Set),t.add(new WeakRef(e))},ge=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},ct=(e,t)=>{if(!v)return 0;let n=ge(e),s=G(t),r=0;for(let[o,c]of v)if(ge(o)===n){for(let i of c){let l=i.deref();if(!l){c.delete(i);continue}l.hotReplace(s)&&r++}c.size||v.delete(o)}return r},at=()=>{v??(v=new Map),globalThis[ot]={update:ct}},O=class e{constructor(t,n={}){$(this,"template");$(this,"scripts");$(this,"styles");$(this,"modules");$(this,"filename");$(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"?G(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),it(this)}hotReplace(t){let n=typeof t=="string"?G(t):t,s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,c=o?s.parentNode:null,i=o?this.endMarker.nextSibling:null,l={...this.data},h=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,!r||(this.renderWith(l,h),!c)?!1:(h&&this.styleEls.forEach(f=>c.insertBefore(f,i)),c.insertBefore(this.content,i),this.mountRoot=c,this.resolveMounted?.(),!0)}static async fetch(t){let n=await fetch(t);if(!n.ok)throw new Error(`failed to fetch component from ${t}: ${n.status}`);return new e(await n.text(),{filename:t})}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=k({...t}),r=A(s);this.data=s,this.fx=r,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let o=this.startMarker,c=(a,u)=>{let g=new CustomEvent(a,{detail:u,bubbles:!0,composed:!0}),b=o.dispatchEvent(g);return o===this.startMarker&&this.emitListeners.get(a)?.forEach(m=>m(g,u)),b},i,l=new Promise(a=>{i=a});this.resolveMounted=i;let h=()=>l,f=this.endMarker,p=a=>{let u=[];for(let g=o.nextSibling;g&&g!==f;g=g.nextSibling)g instanceof Element&&(g.matches(a)&&u.push(g),u.push(...Array.from(g.querySelectorAll(a))));return u},d=a=>p(a)[0]??null,E=this.modules,y=a=>E&&a in E?Promise.resolve(E[a]):Z(a),_=a=>`await $mounted();${a}`;this.scripts.forEach((a,u)=>{let g={$emit:c,$mounted:h,$self:d,$$self:p},b={filename:this.filename,index:u},m=fe(a.content);if(m!==null){let R=":mounted"in a.attrs?_(m):m;st(R,s,r.effect,g,y,b);return}let{vars:S,code:w}=le(a.content);S.forEach(R=>{R in s||(s[R]=void 0)});let C=":mounted"in a.attrs?_(w):w;tt(C,s,r.effect,g,y,b)});let L=document.createDocumentFragment();return L.append(this.startMarker,J(this.template,s,r,n),this.endMarker),this.content=L,n?this.styleEls=this.styles.map(a=>{let u=document.createElement("style");return u.textContent=a.content,u}):(this.styles.forEach(a=>Ye(me(a))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?M(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"?M(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=>et(me(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},yt=e=>new O(e);typeof globalThis<"u"&&globalThis[rt]&&at();export{M as $,U as $$,W as $create,k as $reactive,O as Component79,at as enableHotReload,ct as hotUpdate,yt as parseComponent,gt as renderComponent};
10
+ ;$__exports.done = true })()${Ne(o.filename,o.index??0)}`)(i,pt,r,...Object.values(c)),h=d=>console.error("jq79: error in factory script",d),f=!1,p=()=>{if(f)return;f=!0;let d=i.default;if(typeof d!="function")return;let E=y=>{y&&typeof y=="object"&&Object.assign(t,y)};try{let y=d(t,{$data:t,$props:t,$effect:n,...s});y instanceof Promise?y.then(E).catch(h):E(y)}catch(y){h(y)}};l.then(p,h),i.done&&p()},mt="__JQ79_HMR_ENABLED__",gt="__JQ79_HMR__",O=null,yt=e=>{if(!O||!e.filename)return;let t=O.get(e.filename);t||O.set(e.filename,t=new Set),t.add(new WeakRef(e))},we=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},Et=(e,t)=>{if(!O)return 0;let n=we(e),s=J(t),r=0;for(let[o,c]of O)if(we(o)===n){for(let i of c){let l=i.deref();if(!l){c.delete(i);continue}l.hotReplace(s)&&r++}c.size||O.delete(o)}return r},bt=()=>{O??(O=new Map),globalThis[gt]={update:Et}},D=class e{constructor(t,n={}){w(this,"template");w(this,"scripts");w(this,"styles");w(this,"modules");w(this,"filename");w(this,"data",null);w(this,"fx",null);w(this,"content",null);w(this,"startMarker",null);w(this,"endMarker",null);w(this,"styleEls",[]);w(this,"ownsSharedStyles",!1);w(this,"useShadow",!1);w(this,"mountRoot",null);w(this,"resolveMounted",null);w(this,"emitListeners",new Map);let s=typeof t=="string"?J(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),yt(this)}hotReplace(t){let n=typeof t=="string"?J(t):t,s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,c=o?s.parentNode:null,i=o?this.endMarker.nextSibling:null,l={...this.data},h=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,!r||(this.renderWith(l,h),!c)?!1:(h&&this.styleEls.forEach(f=>c.insertBefore(f,i)),c.insertBefore(this.content,i),this.mountRoot=c,this.resolveMounted?.(),!0)}static async fetch(t){let n=await fetch(t);if(!n.ok)throw new Error(`failed to fetch component from ${t}: ${n.status}`);return new e(await n.text(),{filename:t})}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=I({...t}),r=j(s);this.data=s,this.fx=r,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let o=this.startMarker,c=(a,u)=>{let g=new CustomEvent(a,{detail:u,bubbles:!0,composed:!0}),b=o.dispatchEvent(g);return o===this.startMarker&&this.emitListeners.get(a)?.forEach(m=>m(g,u)),b},i,l=new Promise(a=>{i=a});this.resolveMounted=i;let h=()=>l,f=this.endMarker,p=a=>{let u=[];for(let g=o.nextSibling;g&&g!==f;g=g.nextSibling)g instanceof Element&&(g.matches(a)&&u.push(g),u.push(...Array.from(g.querySelectorAll(a))));return u},d=a=>p(a)[0]??null,E=this.modules,y=a=>E&&a in E?Promise.resolve(E[a]):Y(a),_=a=>`await $mounted();${a}`;this.scripts.forEach((a,u)=>{let g={$emit:c,$mounted:h,$self:d,$$self:p},b={filename:this.filename,index:u},m=me(a.content);if(m!==null){$e(s,he(a.content));let $=":mounted"in a.attrs?_(m):m;ht($,s,r.effect,g,y,b);return}let{vars:S,code:R}=ue(a.content);$e(s,K(a.attrs[":setup"])),S.forEach($=>{$ in s||(s[$]=void 0)});let C=":mounted"in a.attrs?_(R):R;dt(C,s,r.effect,g,y,b)});let N=document.createDocumentFragment();return N.append(this.startMarker,X(this.template,s,r,n),this.endMarker),this.content=N,n?this.styleEls=this.styles.map(a=>{let u=document.createElement("style");return u.textContent=a.content,u}):(this.styles.forEach(a=>ft(Se(a))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?P(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"?P(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=>ut(Se(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},Nt=e=>new D(e);typeof globalThis<"u"&&globalThis[mt]&&bt();export{P as $,H as $$,z as $create,I as $reactive,D as Component79,bt as enableHotReload,Et as hotUpdate,Nt as parseComponent,_t as renderComponent};
10
11
  //# sourceMappingURL=jq79.js.map