jq79 0.4.18 → 0.5.1

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