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