jq79 0.4.17 → 0.5.0

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