jq79 0.7.7 → 0.7.8

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.
@@ -14,7 +14,7 @@ ${e}
14
14
  ;$__exports.done = true })()`,Cn=e=>{let t=e.attrs[":setup"];return t===void 0?null:t.trim()===""?[]:ke(t)},Mn=(e,t)=>{let n=new Set;return e.forEach(s=>{(Ae(s.content)??t(s))?.forEach(({name:i})=>n.add(i))}),n};var kn="__jq79precompiled",An="jq79-precompiled",On=(e,t)=>`function anonymous(${e.join(",")}
15
15
  ) {
16
16
  ${t}
17
- }`;var $i={};var qr="0.7.7",ns=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),ss="http://www.w3.org/1999/xhtml",rs=e=>{let t=ns(e),n=e.namespaceURI,s=t[Oe];delete t[Oe];let r=n!==null&&n!==ss;return{tag:r?e.tagName:e.tagName.toLowerCase(),attrs:t,...s===void 0?{}:{component:s},...r?{ns:n}:{},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(i=>{if(i.nodeType===Node.TEXT_NODE){let o=i.textContent??"";return o?[o]:[]}return i.nodeType===Node.ELEMENT_NODE?[rs(i)]:[]})}},Je=new Map,Ye=new Map,Ut=!1,jt,Pe=class extends Error{constructor(n,s){super(`${n}. ${s}`);k(this,"reason",n);k(this,"hint",s)}},Hr=()=>new Pe("was not precompiled","Safe mode never builds code at runtime: the component's precompiled functions did not reach the page."),Wr=(e,t)=>{let n=globalThis[kn];if(Array.isArray(n)&&n.length>0)for(let[s,r,i]of n.splice(0))Ye.set(Qe(s,r),i);return Ye.size===0?void 0:Ye.get(Qe(e,t))},Bt=(e,t,n="")=>{let s=Wr(e,t);if(s===null)throw new SyntaxError("jq79: this code did not compile when it was precompiled");if(s!==void 0)return s;if(jt!==void 0)return Fr(e,t,n,jt);if(Ut)throw Hr();return new Function(...e,t+n)},os=()=>{if(!(typeof document>"u"))for(let e of Array.from(document.querySelectorAll("script[nonce]"))){let t=e.nonce||e.getAttribute("nonce");if(t)return t}},_n="__jq79built",Fr=(e,t,n,s)=>{let r=document.createElement("script");r.setAttribute("nonce",s),r.textContent=`document.currentScript.${_n} = ${On(e,t)}${n}`;let i,o=l=>{i=l.error??new SyntaxError(l.message),l.preventDefault()};window.addEventListener("error",o);try{(document.head??document.documentElement).append(r)}finally{window.removeEventListener("error",o),r.remove()}let a=r[_n];if(typeof a=="function")return Ye.set(Qe(e,t),a),a;throw i!==void 0?i:new Pe("could not be built","The page's CSP refused a <script> carrying the nonce jq79 read from the page.")},jn=new Set,Ur=(e,t)=>{jn.has(e)||(jn.add(e),console.error(`jq79: safeEval() is on, and "${e}" ${t.reason}, so it rendered as nothing. ${t.hint}`))},Pt=(e,t)=>{if(!(t in e)){if(t in globalThis)return globalThis[t];throw new ReferenceError(`${t} is not defined`)}},is=(e,t)=>{try{return Bt([...Nt,...t],$n(e))}catch(n){return n instanceof Pe&&Ur(e,n),null}},Br=(e,t)=>{if(!le.scopedNames)return null;let n=Rn(e,t);if(n===null)return null;try{return Bt([...Nt,...t],n)}catch{return null}},as=(e,t,n)=>{let s=Je.get(e);if(s===void 0){let r=Br(t,n);s=r?{fn:r,scoped:!0}:{fn:is(t,n),scoped:!1},Je.set(e,s)}return s},ls=(e,t)=>`${t.join(",")}|${e}`,Kr=(e,t)=>as(ls(e,t),e,t).fn,zr=(e,t,n)=>{let s=is(t,n);return Je.set(e,{fn:s,scoped:!1}),s},Gr=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Vr=100,we=new Map,Kt=new Set,et=0,Lt=!1,Dt=new Set,Zr=()=>{Lt=!1,!(et>0)&&(we.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Kt.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 = () => {}".`))}),we.clear())},cs=()=>{Lt||et>0||!we.size||(Lt=!0,queueMicrotask(Zr))},ds=e=>{et++;let t=()=>{et--,cs()};e.then(t,t)},Qr=(e,t)=>{if(Dt.has(e))return;Dt.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.`)},us=(e,t,n)=>{if(!(n instanceof ReferenceError))return Qr(e,n);let s=Gr.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let i=`${r}|${e}`;Kt.has(i)||we.has(i)||we.size>=Vr||(we.set(i,{name:r,expr:e,scope:t}),cs())},fs=(e,t,n)=>{let s=n?Object.keys(n):[],r=ls(e,s),{fn:i,scoped:o}=as(r,e,s);if(!i)return;let a=n?Object.values(n):[];if(!o)return i(t,Pt,...a);try{return i(t,Pt,...a)}catch(l){if(!(l instanceof ReferenceError))throw l;let f=zr(r,e,s);if(!f)throw l;return f(t,Pt,...a)}},_=(e,t,n)=>{try{return fs(e,t,n)}catch(s){us(e,t,s);return}},ps=(e,t,n)=>{try{return fs(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;us(e,t,s);return}},hs=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(_(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(_(s.expr,t)??"");return n},gs=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i);e.addEventListener(r,a=>{if(o.has("self")&&a.target!==e)return;o.has("prevent")&&a.preventDefault(),o.has("stop")&&a.stopPropagation();let l=ps(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:o.has("once"),capture:o.has("capture")})},Xr=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i),a=l=>{o.has("prevent")&&l.preventDefault(),o.has("stop")&&l.stopPropagation(),o.has("once")&&e.off(r,a),Re(()=>{let f=ps(n,s,{$event:l});typeof f=="function"&&f(l)})};e.on(r,a)},zt=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},it=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Yr=e=>{e.forEach(t=>{if(t.first===t.last)return it(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},Jr=(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},eo=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let i=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=i}},Ln=(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},Ee=null,tt=null,ms=new WeakSet,to=e=>{let t={memo:Ee,base:tt};return Ee=new Map,tt=e,t},no=e=>{Ee=e.memo,tt=e.base},Dn=(e,t)=>e.component!==void 0?In(t,e.component):e.tag.includes("-")?In(t,e.tag):null,X=e=>e.component??e.tag,In=(e,t)=>{if(!Ee)return Ln(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===tt){if(Ee.has(t))return Ee.get(t);let r=Ln(s,t);return Ee.set(t,r),r}if(!ms.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},so=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()},ro=(e,t)=>{let n=so(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)"}.`)},qn=100,Ct=0,ys=Symbol("jq79.slots"),Le=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),oo=e=>e==="default"?":slot":`:slot.${e}`,io=e=>typeof e!="string"||e.trim()!=="",ao=e=>{let t={},n=[];e.children.forEach(r=>{let i=typeof r=="object"&&r.tag==="template"?Le(r):void 0;if(typeof r=="string"||i===void 0){n.push(r);return}let o=Rt(i.slice(6));if(o in t){console.warn(`jq79: two <template ${oo(o)}> in <${X(e)}>; the second was ignored`);return}t[o]={nodes:r.children,binder:r.attrs[i]||void 0}});let s=n.some(io);return s&&"default"in t?console.warn(`jq79: <${X(e)}> 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},lo=(e,t,n)=>{ke(t)?.forEach(({name:s,as:r,default:i})=>{let o=r??s;Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&i!==void 0?_(i,e):a},set:()=>console.warn(`jq79: "${o}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},co=e=>{let t=Le(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}`)},uo=(e,t)=>{let n=Object.entries(ao(e));if(!n.length)return null;let s={};return n.forEach(([r,i])=>{s[r]=fo(i,t)}),s},fo=(e,t)=>(n,s,r,i)=>{let o=Object.create(t);lo(o,e.binder,n);let a=o[We]??[];Object.defineProperty(o,We,{value:[...a,s]});let l=me(o);return l.ownedBy(s),r.onDispose(()=>l.dispose()),be(e.nodes,o,l,i)},po=(e,t,n,s)=>{let r=Rt(e.tag.slice(5)),i=document.createDocumentFragment(),o=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);i.append(o,a);let l=t[ys]?.[r];if(!l)return i.insertBefore(be(e.children,t,n,s),a),i;let f={};return Object.entries(e.attrs).forEach(([u,h])=>{if(!(u===Ce||ye(u)||u.startsWith("@")))if(u.startsWith(":")){let w=h||u.slice(1);f[ie(u.slice(1))]=()=>_(w,t)}else f[ie(u)]=()=>h}),i.insertBefore(l(f,t,n,s),a),i},Es="data-c79-box",ho=(e,t,n)=>{if(t.ns!==void 0)return document.createDocumentFragment();let s=document.createElement(_e(e));s.setAttribute(Es,"");let r=t.attrs[Ce];return r!==void 0&&s.setAttribute(Ce,r),n||ti(),s},Hn=new WeakSet,go=(e,t)=>{if(e.ns===void 0||Hn.has(e))return;let n=t.template.find(r=>typeof r=="object");if(n===void 0||n.ns!==void 0)return;Hn.add(e);let s=e.ns==="http://www.w3.org/1998/Math/MathML"?"<math>":"<svg>";console.warn(`jq79: <${X(e)}> is used inside ${s} and its template starts with <${n.tag.toLowerCase()}>, which is parsed as HTML - it renders and never draws. A component's template decides its own namespace, so root it at ${s}`)},Wn=(e,t,n,s,r)=>{let i=ho(e,t,r),o=!(i instanceof DocumentFragment),a=o?null:document.createComment(`/${e}`);o||i.append(document.createComment(e),a);let l=uo(t,n),f={},u={},h=[],w=[],O=!1;Object.entries(t.attrs).forEach(([v,P])=>{if(v!==Ce){if(v===":props"||v.startsWith(":props.")){O=!0,w.push({expr:P});return}if(!ye(v))if(v.startsWith("@"))h.push([v,P]);else if(v===":model"||v.startsWith(":model.")){let x=v===":model"?"default":ie(v.slice(7));u[x]=P||(v===":model"?"model":x)}else if(v.startsWith(":")){let x=ie(v.slice(1));f[x]=P||x,w.push({name:x,expr:P||x})}else{let x=ie(v),W=JSON.stringify(P);f[x]=W,w.push({name:x,expr:W})}}});let I=v=>v==="default"?":model":`:model.${v}`,G=v=>v==="default"?"model":v,j=new Set;Object.entries(u).forEach(([v,P])=>{let x=G(v);f[x]!==void 0&&console.warn(`jq79: <${X(t)}> binds prop "${x}" through both :${x} and ${I(v)} - ${I(v)} wins`),f[x]=P,Kr(xt(P),["$value"])===null&&(j.add(v),console.warn(`jq79: ${I(v)}="${P}" is not assignable - updates from <${X(t)}> will be dropped`))});let b=()=>{let v={};return w.forEach(({name:P,expr:x})=>{if(P!==void 0)v[P]=_(x,n);else{let W=_(x,n);W!==null&&typeof W=="object"&&Object.assign(v,W)}}),Object.entries(u).forEach(([P,x])=>{v[G(P)]=_(x,n)}),v},H=null,D=null,L=null,B=new Set,ae=v=>{if(v==null){if(!n[Os]?.has(e)||B.has("unfilled"))return;B.add("unfilled"),console.error(`jq79: <${X(t)}> 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: <${X(t)}> is ${typeof v}, not a component - nothing renders here`))};return s.effect(()=>{let v=_(e,n),P=v instanceof de?v:null;if(P||ae(v),P===D||(L?.dispose(),L=null,H?.destroy(),H=null,D=P,!P))return;go(t,P);let x=new de({template:P.template,scripts:P.scripts,styles:P.styles,modules:P.modules,filename:P.filename,siblings:P.siblings,name:P.name});if(l&&(x.slots=l),Object.keys(u).length){let M=new Set;x.modelWriteback=(U,Q)=>{let $=U==null?"default":ie(String(U)),q=u[$];return q===void 0?(M.has($)||(M.add($),console.warn(`jq79: <${X(t)}> has no ${I($)} - bound: ${Object.keys(u).map(I).join(", ")}`)),!1):j.has($)?!1:(Re(()=>_(xt(q),n,{$value:Q})),!0)}}h.forEach(([M,U])=>Xr(x,M,U,n));let W=ii(x.scripts);ai(t,e,Object.keys(f),W);let J=Yn(Re(b),W),V=document.createDocumentFragment();if(Ct>=qn){console.error(`jq79: <${X(t)}> is ${qn} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Ct++;try{(r?x.renderShadow(J):x.render(J)).mount(V)}finally{Ct--}let E=n[rt];E&&x.holdOwner(E.owner),a?a.parentNode.insertBefore(V,a):i.appendChild(V);let C=me(n,!0);if(O){let M=[];C.effect(()=>{let U=Yn(b(),W),Q=Object.keys(U);M.forEach($=>{$ in U||(x.data[$]=void 0)}),Q.forEach($=>{x.data[$]=U[$]}),M=Q})}else Object.entries(f).forEach(([M,U])=>{W!==null&&!W.has(M)||C.effect(()=>{x.data[M]=_(U,n)})});L=C,H=x}),s.onDispose(()=>{L?.dispose(),H?.destroy()}),i},mo=(e,t)=>{let n=()=>{let s=_(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let i=n();return i!==null&&Reflect.has(i,r)||Reflect.has(s,r)},get(s,r){let i=n();return i!==null&&Reflect.has(i,r)?i[r]:Reflect.get(s,r)},set(s,r,i){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=i,!0):Reflect.set(s,r,i)}})},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):[]):[],yo=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Jt(e):()=>!1,Eo=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"]),ws=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),wo={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},Fn=new Map,So=(e,t)=>{let n=`${e} ${t}`,s=Fn.get(n);if(s!==void 0)return s;let r=wo[e],i=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,a]=r;i=new DOMParser().parseFromString(`<${o}><${a} ${t}="x"/></${o}>`,"text/html").querySelector(a)?.getAttributeNames().find(f=>f.toLowerCase()===t)??t}return Fn.set(n,i),i},Ss=(e,t)=>{let n=e.namespaceURI;if(n===null||n===ss)return t;let s=t.replace(/-/g,"").toLowerCase(),r=So(n,s);return r===s?t:r},bs=(e,t,n)=>{let s=Eo.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},le={cloneSkeletons:!0,scopedNames:!0},bo=new Set([":text",":html",":value",":checked",":selected"]),To=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||bo.has(e)?!0:e.startsWith(":")?e===":model"?!1:!ye(e)&&!e.includes("."):e!==Oe,Ts=e=>{if(e.component||e.tag.includes("-")||Ze(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!To(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||Ts(t))},$s=(e,t,n)=>{let s=ws(e),r,i=null;for(let h in e.attrs){let w=e.attrs[h];if(h.startsWith("@"))n.push({kind:"event",path:t,attr:h,expr:w});else if(h===":class")r=w;else if(h.startsWith(":class."))(i??(i=[])).push([h.slice(7),w]);else if(!ye(h))if(h.startsWith(":")){let O=h.slice(1);n.push({kind:"attr",path:t,name:Ss(s,O),expr:w||ie(O)})}else s.setAttribute(h,w)}(r!==void 0||i)&&n.push({kind:"class",path:t,classExpr:r,toggles:i,staticClasses:new Set(pe(e.attrs.class??""))});let o=e.attrs[":text"],a=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):a!==void 0?n.push({kind:"html",path:t,expr:a}):e.children.forEach((h,w)=>{if(typeof h=="string"){h.includes("{{")?(n.push({kind:"text",path:[...t,w],parts:Tt(h)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(h));return}s.appendChild($s(h,[...t,w],n))});let l=e.attrs[":value"];l!==void 0&&n.push({kind:"value",path:t,expr:l});let f=e.attrs[":checked"];f!==void 0&&n.push({kind:"checked",path:t,expr:f});let u=e.attrs[":selected"];return u!==void 0&&n.push({kind:"selected",path:t,expr:u}),s},$o=3,Rs=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:Rs(n)),0),Un=new WeakMap,Bn=new WeakSet,Ro=e=>{let t=Un.get(e);if(t!==void 0)return t;if(!Bn.has(e))return Bn.add(e),null;let n=null;if(Ts(e)&&Rs(e)>=$o){let s=[];n={skeleton:$s(e,[],s),ops:s}}return Un.set(e,n),n},xo=(e,t)=>{let n=e;for(let s=0;s<t.length;s++)n=n.childNodes[t[s]];return n},No=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);for(let r of e.ops){let i=r.path.length===0?s:xo(s,r.path);if(r.kind==="text"){let o=i,a=r.parts;n.effect(()=>{let l=hs(a,t);o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="event")gs(i,r.attr,r.expr,t);else if(r.kind==="attr"){let o=i,{name:a,expr:l}=r;n.effect(()=>bs(o,a,_(l,t)))}else if(r.kind==="class"){let o=i,{classExpr:a,toggles:l,staticClasses:f}=r,u=[];n.effect(()=>{let h=a!==void 0?pe(_(a,t)):[];l?.forEach(([w,O])=>{_(O,t)&&h.push(...pe(w))}),u.forEach(w=>{!h.includes(w)&&!f.has(w)&&o.classList.remove(w)}),o.classList.add(...h),u=h})}else if(r.kind==="textContent"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="html"){let o=i,{expr:a}=r;n.effect(()=>{o.innerHTML=lt(String(_(a,t)??""))})}else if(r.kind==="value"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.value!==l&&(o.value=l)})}else if(r.kind==="checked"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.checked!==l&&(o.checked=l)})}else if(r.kind==="selected"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.selected!==l&&(o.selected=l)})}else{let o=r}}return s},Gt=(e,t,n,s)=>{let r=e.attrs[":with"],i=r!==void 0?mo(r,t):t;if(Ze(e.tag))return po(e,i,n,s);if(e.tag==="template"&&Le(e)!==void 0)return co(e);let o=Dn(e,i);if(o)return Wn(o,e,i,n,s);if(le.cloneSkeletons){let b=Ro(e);if(b)return No(b,i,n)}let a=ws(e);if(e.component!==void 0&&i[rt]?.count===0)throw ro(e.component,i);let l=e.ns===void 0&&(e.component!==void 0||e.tag.includes("-"));if(l){let b=!1;n.effect(()=>{if(b)return;let H=Dn(e,i);if(!H)return;b=!0;let D=Wn(H,e,i,n,s),L=zt(D);n.onDispose(()=>it(L)),a.replaceWith(D)})}for(let b in e.attrs){let H=e.attrs[b];if(b.startsWith("@"))gs(a,b,H,i);else if(b===":model"||b.startsWith(":model."))l||console.warn(`jq79: ${b} on <${X(e)}> does nothing - :model binds component tags only (for now)`);else if(!ye(b))if(b.startsWith(":"))if(l)a.setAttribute(b,H);else{let D=b.slice(1),L=H||ie(D),B=Ss(a,D);n.effect(()=>bs(a,B,_(L,i)))}else a.setAttribute(b,H)}let f=e.attrs[":class"],u=null;for(let b in e.attrs)b.startsWith(":class.")&&(u??(u=[])).push([b.slice(7),e.attrs[b]]);if(f!==void 0||u){let b=new Set(pe(e.attrs.class??"")),H=[];n.effect(()=>{let D=f!==void 0?pe(_(f,i)):[];u?.forEach(([L,B])=>{_(B,i)&&D.push(...pe(L))}),H.forEach(L=>{!D.includes(L)&&!b.has(L)&&a.classList.remove(L)}),a.classList.add(...D),H=D})}let h=e.attrs[":text"],w=e.attrs[":html"],O=e.attrs[":html.allowed"];O!==void 0&&w===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),h!==void 0?n.effect(()=>{let b=String(_(h,i)??"");a.textContent!==b&&(a.textContent=b)}):w!==void 0?n.effect(()=>{let b=O!==void 0?{allowUrl:yo(_(O,i))}:void 0;a.innerHTML=lt(String(_(w,i)??""),b)}):a instanceof HTMLTemplateElement?be(e.children,i,n,s,a.content):be(e.children,i,n,s,a);let I=e.attrs[":value"];I!==void 0&&n.effect(()=>{let b=String(_(I,i)??"");a.value!==b&&(a.value=b)});let G=e.attrs[":checked"];G!==void 0&&n.effect(()=>{let b=!!_(G,i);a.checked!==b&&(a.checked=b)});let j=e.attrs[":selected"];return j!==void 0&&n.effect(()=>{let b=!!_(j,i);a.selected!==b&&(a.selected=b)}),a},vo=(e,t,n,s)=>{let r=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(r);let o=null,a=null,l=null;return n.effect(()=>{let f=e.find(h=>h.expr===void 0||_(h.expr,t))??null;if(f===a||(l?.dispose(),o&&it(o),o=null,a=f,!f))return;l=me(t);let u=Gt(f.node,t,l,s);o=zt(u),r.parentNode.insertBefore(u,r.nextSibling)}),n.onDispose(()=>l?.dispose()),i},Ne=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},Po=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let i=e[r];if(i<0)continue;let o=0,a=n.length;for(;o<a;){let l=o+a>>1;e[n[l]]<i?o=l+1:a=l}o>0&&(s[r]=n[o-1]),n[o]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},Co=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},xs=(e,t)=>typeof e=="string"?t.some(n=>zn(e,n)):Object.values(e.attrs).some(n=>t.some(s=>zn(n,s)))||e.children.some(n=>xs(n,t)),Ns=e=>typeof e!="string"&&(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs||":each"in e.attrs||e.component!==void 0||e.tag.includes("-")||Ze(e.tag)||e.children.some(Ns)),Kn=/[A-Za-z0-9_$]/,Mo=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,zn=(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(!Kn.test(s)&&!Kn.test(r))return!0}return!1},Mt=new WeakMap,ko=e=>{let t=Mt.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(Tn);if(!n)return Mt.set(e,null),null;let[,s,r,i]=n,o=e.attrs[":key"],a=o===s,l=o!==void 0&&!a&&Mo.test(o)&&o.startsWith(`${s}.`)?o.slice(s.length+1):void 0,{[":each"]:f,[":key"]:u,...h}=e.attrs,w={...e,attrs:h},O=["$index",...r?[r]:[]],I=xs(w,O),G=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),j=o!==void 0&&Ns(w),b={itemName:s,atName:r,listExpr:i,keyExpr:o,keyIsItem:a,keyProp:l,itemNode:w,readsPosition:I,namesComponent:G,nestsScopes:j};return Mt.set(e,b),b},Ao=(e,t,n,s)=>{let r=ko(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:i,atName:o,listExpr:a,keyExpr:l,keyIsItem:f,keyProp:u,itemNode:h,readsPosition:w,namesComponent:O,nestsScopes:I}=r,G=document.createComment("each"),j=document.createDocumentFragment();j.appendChild(G),(":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 b=[],H=!1;return n.effect(()=>{let D=to(t);try{let L=_(a,t),B=Array.isArray(L),ae=B?null:Co(L)?Object.keys(L):[],v=B?L.length:ae.length,P=new Map;b.forEach(($,q)=>{$.pos=q;let K=P.get($.key);K?K.push($):P.set($.key,[$])});let x=new Set,W=[],J=[],V=[],E=[],C;for(let $=0;$<v;$++){let q=B?$:ae[$],K=B?L[$]:L[q],c=q;f?c=K:u!==void 0&&K!==null&&typeof K=="object"?c=K[u]:l!==void 0&&(C===void 0?(C=Object.create(t),Ne(C,i,K),o&&Ne(C,o,q),Ne(C,"$index",$)):(C[i]=K,o&&(C[o]=q),C.$index=$),c=_(l,C)),x.has(c)&&!H&&(H=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),x.add(c);let d=P.get(c)?.shift();if(d&&Object.is(d.item,K)){let m=d.scope;m.$index!==$&&(w&&W.push(d),m.$index=$),o&&m[o]!==q&&(m[o]=q),V.push(d),E.push(d.pos);continue}if(d&&l!==void 0){let m=d.scope;m[i]=K,m.$index!==$&&(m.$index=$),o&&m[o]!==q&&(m[o]=q),d.item=K,J.push(d),V.push(d),E.push(d.pos);continue}d&&(d.fx.dispose(),it(d.range));let g=Object.create(t);Ne(g,i,K),o&&Ne(g,o,q),Ne(g,"$index",$),O||ms.add(g);let p=me(t);I&&Object.defineProperty(g,ht,{value:p});let S=zt(Gt(h,g,p,s));V.push({key:c,item:K,scope:g,fx:p,range:S,pos:$}),E.push(-1)}let M=new Set;P.forEach($=>$.forEach(q=>M.add(q))),M.size&&(M.forEach($=>{$.dead=!0,$.fx.dispose()}),Yr(Jr(b,$=>$.dead===!0)));let U=G,Q=Po(E);V.forEach(($,q)=>{!Q[q]&&U.nextSibling!==$.range.first&&eo($.range,U),U=$.range.last}),W.forEach($=>Re(()=>$.fx.refresh())),J.forEach($=>Re(()=>$.fx.rerun())),b=V}finally{no(D)}}),n.onDispose(()=>b.forEach(D=>D.fx.dispose())),j},vs=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},kt=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${X(e)}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},Oo=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${X(e)}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${X(e)}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},_o=[":if",":elseif",":else",":each"],jo=(e,t)=>{if(e.tag!=="template"||e.ns!==void 0)return;let n=_o.find(s=>s in e.attrs);if(n!==void 0){if(Le(e)!==void 0){if(t?.component===void 0)return;console.warn(`jq79: ${n} on <template ${Le(e)}> is ignored - a slot is filled with its children as written. Put ${n} on the elements inside it, or on the component's tag`);return}console.warn(`jq79: ${n} on a nested <template> shows nothing - a <template>'s children live in its .content and never reach the page. Put ${n} on the elements themselves`)}},Lo=[...$t,":model",":slot"].map(e=>e.slice(1)),Do={":attrs":':attrs was removed in 0.7 - it now binds an attribute called "attrs". Bind them one at a time (:disabled="x", :title="y"), or :class for classes'},Io=e=>{for(let t in e.attrs){let n=Do[t];n!==void 0&&console.warn(`jq79: ${n}`)}},qo=e=>{if(!(e.component!==void 0||e.tag.includes("-")))for(let t in e.attrs){if(!t.startsWith(":")||ye(t)||t===":model"||t.startsWith(":model."))continue;let n=t.slice(1);if(n.includes(".")){console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". Dotted modifiers belong to an event: if you meant @${n}, that is the spelling`);continue}let s=Lo.find(r=>n!==r&&n.startsWith(r));s!==void 0&&console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". A ":name" jq79 does not recognize binds that attribute (which is what :src and :disabled are). If you meant :${s}, that is the spelling`)}},Ps=(e,t)=>{e.forEach(s=>{typeof s!="string"&&(jo(s,t),Io(s),qo(s),Ps(s.children,s))});let n=!1;for(let s=0;s<e.length;){let r=e[s];if(typeof r=="string"){r.trim()&&(n=!1),s++;continue}if(":each"in r.attrs){n=!1,s++;continue}if(kt(r),":if"in r.attrs){s++;let i=a=>{let l=vs(e,s),f=e[l];if(typeof f=="object"&&a in f.attrs)return s=l+1,f};for(let a=i(":elseif");a;a=i(":elseif"))kt(a);let o=i(":else");o&&kt(o),n=o!==void 0;continue}(":elseif"in r.attrs||":else"in r.attrs)&&Oo(r,n),n=!1,s++}},Gn=new WeakMap,Ho=(e,t,n)=>{let s=Gn.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],i=n+1,o=f=>{let u=vs(e,i),h=e[u];if(typeof h=="object"&&f in h.attrs)return i=u+1,h};for(let f=o(":elseif");f;f=o(":elseif"))r.push({expr:f.attrs[":elseif"],node:f});let a=o(":else");a&&r.push({node:a});let l={branches:r,next:i};return Gn.set(t,l),l},be=(e,t,n,s=!1,r)=>{let i=r??document.createDocumentFragment(),o=0;for(;o<e.length;){let a=e[o];if(typeof a=="string"){let l=document.createTextNode(a);if(a.includes("{{")){let f=Tt(a);n.effect(()=>{let u=hs(f,t);l.textContent!==u&&(l.textContent=u)})}i.appendChild(l),o++;continue}if(":each"in a.attrs){i.appendChild(Ao(a,t,n,s)),o++;continue}if(":if"in a.attrs){let l=Ho(e,a,o);i.appendChild(vo(l.branches,t,n,s)),o=l.next;continue}i.appendChild(Gt(a,t,n,s)),o++}return i},Wo=(e,t,n=!1)=>be(e.template,t,me(t),n),Ce="data-jq79",Fo=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)},Cs=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Ce]=t,Cs(n.children,t))})},Uo=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),i=r===-1?s:s.slice(0,r),o=r===-1?"":s.slice(r);return`${i}[${Ce}="${t}"]${o}`}).join(", "),Ms=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Uo(n.selectorText,t):n instanceof CSSGroupingRule&&Ms(n.cssRules,t)})},Bo=/(^|[\s>+~,(])([A-Z][A-Za-z0-9]*)(?![\w-])/g,Ko=/[a-z]/,zo=e=>e.replace(Bo,(t,n,s)=>Ko.test(s)?`${n}${_e(s)}`:t),Go=/^\s*@(media|supports|container|layer|scope|document)\b/i,Vo=/^\s*@/,Zo=e=>{let t="",n="",s="",r=[],i=()=>r.length===0||r[r.length-1],o=()=>{t+=i()&&!Vo.test(s)?zo(n):n,n=""},a=f=>{o(),t+=f,s+=f},l=(f,u)=>{o(),t+=f,s="",u!==void 0?r.push(u):f==="}"&&r.pop()};for(let f=0;f<e.length;){let u=e[f];if(u==="/"&&e[f+1]==="*"){let h=e.indexOf("*/",f+2),w=h===-1?e.length:h+2;a(e.slice(f,w)),f=w}else if(u==='"'||u==="'"){let h=f+1;for(;h<e.length&&e[h]!==u;)h+=e[h]==="\\"?2:1;a(e.slice(f,Math.min(h+1,e.length))),f=h+1}else u==="{"?(l("{",Go.test(s)),f++):u==="}"||u===";"?(l(u),f++):(n+=u,s+=u,f++)}return o(),t},Qo=(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),Ms(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
17
+ }`;var $i={};var qr="0.7.8",ns=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),ss="http://www.w3.org/1999/xhtml",rs=e=>{let t=ns(e),n=e.namespaceURI,s=t[Oe];delete t[Oe];let r=n!==null&&n!==ss;return{tag:r?e.tagName:e.tagName.toLowerCase(),attrs:t,...s===void 0?{}:{component:s},...r?{ns:n}:{},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(i=>{if(i.nodeType===Node.TEXT_NODE){let o=i.textContent??"";return o?[o]:[]}return i.nodeType===Node.ELEMENT_NODE?[rs(i)]:[]})}},Je=new Map,Ye=new Map,Ut=!1,jt,Pe=class extends Error{constructor(n,s){super(`${n}. ${s}`);k(this,"reason",n);k(this,"hint",s)}},Hr=()=>new Pe("was not precompiled","Safe mode never builds code at runtime: the component's precompiled functions did not reach the page."),Wr=(e,t)=>{let n=globalThis[kn];if(Array.isArray(n)&&n.length>0)for(let[s,r,i]of n.splice(0))Ye.set(Qe(s,r),i);return Ye.size===0?void 0:Ye.get(Qe(e,t))},Bt=(e,t,n="")=>{let s=Wr(e,t);if(s===null)throw new SyntaxError("jq79: this code did not compile when it was precompiled");if(s!==void 0)return s;if(jt!==void 0)return Fr(e,t,n,jt);if(Ut)throw Hr();return new Function(...e,t+n)},os=()=>{if(!(typeof document>"u"))for(let e of Array.from(document.querySelectorAll("script[nonce]"))){let t=e.nonce||e.getAttribute("nonce");if(t)return t}},_n="__jq79built",Fr=(e,t,n,s)=>{let r=document.createElement("script");r.setAttribute("nonce",s),r.textContent=`document.currentScript.${_n} = ${On(e,t)}${n}`;let i,o=l=>{i=l.error??new SyntaxError(l.message),l.preventDefault()};window.addEventListener("error",o);try{(document.head??document.documentElement).append(r)}finally{window.removeEventListener("error",o),r.remove()}let a=r[_n];if(typeof a=="function")return Ye.set(Qe(e,t),a),a;throw i!==void 0?i:new Pe("could not be built","The page's CSP refused a <script> carrying the nonce jq79 read from the page.")},jn=new Set,Ur=(e,t)=>{jn.has(e)||(jn.add(e),console.error(`jq79: safeEval() is on, and "${e}" ${t.reason}, so it rendered as nothing. ${t.hint}`))},Pt=(e,t)=>{if(!(t in e)){if(t in globalThis)return globalThis[t];throw new ReferenceError(`${t} is not defined`)}},is=(e,t)=>{try{return Bt([...Nt,...t],$n(e))}catch(n){return n instanceof Pe&&Ur(e,n),null}},Br=(e,t)=>{if(!le.scopedNames)return null;let n=Rn(e,t);if(n===null)return null;try{return Bt([...Nt,...t],n)}catch{return null}},as=(e,t,n)=>{let s=Je.get(e);if(s===void 0){let r=Br(t,n);s=r?{fn:r,scoped:!0}:{fn:is(t,n),scoped:!1},Je.set(e,s)}return s},ls=(e,t)=>`${t.join(",")}|${e}`,Kr=(e,t)=>as(ls(e,t),e,t).fn,zr=(e,t,n)=>{let s=is(t,n);return Je.set(e,{fn:s,scoped:!1}),s},Gr=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Vr=100,we=new Map,Kt=new Set,et=0,Lt=!1,Dt=new Set,Zr=()=>{Lt=!1,!(et>0)&&(we.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Kt.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 = () => {}".`))}),we.clear())},cs=()=>{Lt||et>0||!we.size||(Lt=!0,queueMicrotask(Zr))},ds=e=>{et++;let t=()=>{et--,cs()};e.then(t,t)},Qr=(e,t)=>{if(Dt.has(e))return;Dt.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.`)},us=(e,t,n)=>{if(!(n instanceof ReferenceError))return Qr(e,n);let s=Gr.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let i=`${r}|${e}`;Kt.has(i)||we.has(i)||we.size>=Vr||(we.set(i,{name:r,expr:e,scope:t}),cs())},fs=(e,t,n)=>{let s=n?Object.keys(n):[],r=ls(e,s),{fn:i,scoped:o}=as(r,e,s);if(!i)return;let a=n?Object.values(n):[];if(!o)return i(t,Pt,...a);try{return i(t,Pt,...a)}catch(l){if(!(l instanceof ReferenceError))throw l;let f=zr(r,e,s);if(!f)throw l;return f(t,Pt,...a)}},_=(e,t,n)=>{try{return fs(e,t,n)}catch(s){us(e,t,s);return}},ps=(e,t,n)=>{try{return fs(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;us(e,t,s);return}},hs=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(_(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(_(s.expr,t)??"");return n},gs=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i);e.addEventListener(r,a=>{if(o.has("self")&&a.target!==e)return;o.has("prevent")&&a.preventDefault(),o.has("stop")&&a.stopPropagation();let l=ps(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:o.has("once"),capture:o.has("capture")})},Xr=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i),a=l=>{o.has("prevent")&&l.preventDefault(),o.has("stop")&&l.stopPropagation(),o.has("once")&&e.off(r,a),Re(()=>{let f=ps(n,s,{$event:l});typeof f=="function"&&f(l)})};e.on(r,a)},zt=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},it=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Yr=e=>{e.forEach(t=>{if(t.first===t.last)return it(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},Jr=(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},eo=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let i=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=i}},Ln=(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},Ee=null,tt=null,ms=new WeakSet,to=e=>{let t={memo:Ee,base:tt};return Ee=new Map,tt=e,t},no=e=>{Ee=e.memo,tt=e.base},Dn=(e,t)=>e.component!==void 0?In(t,e.component):e.tag.includes("-")?In(t,e.tag):null,X=e=>e.component??e.tag,In=(e,t)=>{if(!Ee)return Ln(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===tt){if(Ee.has(t))return Ee.get(t);let r=Ln(s,t);return Ee.set(t,r),r}if(!ms.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},so=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()},ro=(e,t)=>{let n=so(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)"}.`)},qn=100,Ct=0,ys=Symbol("jq79.slots"),Le=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),oo=e=>e==="default"?":slot":`:slot.${e}`,io=e=>typeof e!="string"||e.trim()!=="",ao=e=>{let t={},n=[];e.children.forEach(r=>{let i=typeof r=="object"&&r.tag==="template"?Le(r):void 0;if(typeof r=="string"||i===void 0){n.push(r);return}let o=Rt(i.slice(6));if(o in t){console.warn(`jq79: two <template ${oo(o)}> in <${X(e)}>; the second was ignored`);return}t[o]={nodes:r.children,binder:r.attrs[i]||void 0}});let s=n.some(io);return s&&"default"in t?console.warn(`jq79: <${X(e)}> 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},lo=(e,t,n)=>{ke(t)?.forEach(({name:s,as:r,default:i})=>{let o=r??s;Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&i!==void 0?_(i,e):a},set:()=>console.warn(`jq79: "${o}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},co=e=>{let t=Le(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}`)},uo=(e,t)=>{let n=Object.entries(ao(e));if(!n.length)return null;let s={};return n.forEach(([r,i])=>{s[r]=fo(i,t)}),s},fo=(e,t)=>(n,s,r,i)=>{let o=Object.create(t);lo(o,e.binder,n);let a=o[We]??[];Object.defineProperty(o,We,{value:[...a,s]});let l=me(o);return l.ownedBy(s),r.onDispose(()=>l.dispose()),be(e.nodes,o,l,i)},po=(e,t,n,s)=>{let r=Rt(e.tag.slice(5)),i=document.createDocumentFragment(),o=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);i.append(o,a);let l=t[ys]?.[r];if(!l)return i.insertBefore(be(e.children,t,n,s),a),i;let f={};return Object.entries(e.attrs).forEach(([u,h])=>{if(!(u===Ce||ye(u)||u.startsWith("@")))if(u.startsWith(":")){let w=h||u.slice(1);f[ie(u.slice(1))]=()=>_(w,t)}else f[ie(u)]=()=>h}),i.insertBefore(l(f,t,n,s),a),i},Es="data-c79-box",ho=(e,t,n)=>{if(t.ns!==void 0)return document.createDocumentFragment();let s=document.createElement(_e(e));s.setAttribute(Es,"");let r=t.attrs[Ce];return r!==void 0&&s.setAttribute(Ce,r),n||ti(),s},Hn=new WeakSet,go=(e,t)=>{if(e.ns===void 0||Hn.has(e))return;let n=t.template.find(r=>typeof r=="object");if(n===void 0||n.ns!==void 0)return;Hn.add(e);let s=e.ns==="http://www.w3.org/1998/Math/MathML"?"<math>":"<svg>";console.warn(`jq79: <${X(e)}> is used inside ${s} and its template starts with <${n.tag.toLowerCase()}>, which is parsed as HTML - it renders and never draws. A component's template decides its own namespace, so root it at ${s}`)},Wn=(e,t,n,s,r)=>{let i=ho(e,t,r),o=!(i instanceof DocumentFragment),a=o?null:document.createComment(`/${e}`);o||i.append(document.createComment(e),a);let l=uo(t,n),f={},u={},h=[],w=[],O=!1;Object.entries(t.attrs).forEach(([v,P])=>{if(v!==Ce){if(v===":props"||v.startsWith(":props.")){O=!0,w.push({expr:P});return}if(!ye(v))if(v.startsWith("@"))h.push([v,P]);else if(v===":model"||v.startsWith(":model.")){let x=v===":model"?"default":ie(v.slice(7));u[x]=P||(v===":model"?"model":x)}else if(v.startsWith(":")){let x=ie(v.slice(1));f[x]=P||x,w.push({name:x,expr:P||x})}else{let x=ie(v),W=JSON.stringify(P);f[x]=W,w.push({name:x,expr:W})}}});let I=v=>v==="default"?":model":`:model.${v}`,G=v=>v==="default"?"model":v,j=new Set;Object.entries(u).forEach(([v,P])=>{let x=G(v);f[x]!==void 0&&console.warn(`jq79: <${X(t)}> binds prop "${x}" through both :${x} and ${I(v)} - ${I(v)} wins`),f[x]=P,Kr(xt(P),["$value"])===null&&(j.add(v),console.warn(`jq79: ${I(v)}="${P}" is not assignable - updates from <${X(t)}> will be dropped`))});let b=()=>{let v={};return w.forEach(({name:P,expr:x})=>{if(P!==void 0)v[P]=_(x,n);else{let W=_(x,n);W!==null&&typeof W=="object"&&Object.assign(v,W)}}),Object.entries(u).forEach(([P,x])=>{v[G(P)]=_(x,n)}),v},H=null,D=null,L=null,B=new Set,ae=v=>{if(v==null){if(!n[Os]?.has(e)||B.has("unfilled"))return;B.add("unfilled"),console.error(`jq79: <${X(t)}> 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: <${X(t)}> is ${typeof v}, not a component - nothing renders here`))};return s.effect(()=>{let v=_(e,n),P=v instanceof de?v:null;if(P||ae(v),P===D||(L?.dispose(),L=null,H?.destroy(),H=null,D=P,!P))return;go(t,P);let x=new de({template:P.template,scripts:P.scripts,styles:P.styles,modules:P.modules,filename:P.filename,siblings:P.siblings,name:P.name});if(l&&(x.slots=l),Object.keys(u).length){let M=new Set;x.modelWriteback=(U,Q)=>{let $=U==null?"default":ie(String(U)),q=u[$];return q===void 0?(M.has($)||(M.add($),console.warn(`jq79: <${X(t)}> has no ${I($)} - bound: ${Object.keys(u).map(I).join(", ")}`)),!1):j.has($)?!1:(Re(()=>_(xt(q),n,{$value:Q})),!0)}}h.forEach(([M,U])=>Xr(x,M,U,n));let W=ii(x.scripts);ai(t,e,Object.keys(f),W);let J=Yn(Re(b),W),V=document.createDocumentFragment();if(Ct>=qn){console.error(`jq79: <${X(t)}> is ${qn} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Ct++;try{(r?x.renderShadow(J):x.render(J)).mount(V)}finally{Ct--}let E=n[rt];E&&x.holdOwner(E.owner),a?a.parentNode.insertBefore(V,a):i.appendChild(V);let C=me(n,!0);if(O){let M=[];C.effect(()=>{let U=Yn(b(),W),Q=Object.keys(U);M.forEach($=>{$ in U||(x.data[$]=void 0)}),Q.forEach($=>{x.data[$]=U[$]}),M=Q})}else Object.entries(f).forEach(([M,U])=>{W!==null&&!W.has(M)||C.effect(()=>{x.data[M]=_(U,n)})});L=C,H=x}),s.onDispose(()=>{L?.dispose(),H?.destroy()}),i},mo=(e,t)=>{let n=()=>{let s=_(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let i=n();return i!==null&&Reflect.has(i,r)||Reflect.has(s,r)},get(s,r){let i=n();return i!==null&&Reflect.has(i,r)?i[r]:Reflect.get(s,r)},set(s,r,i){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=i,!0):Reflect.set(s,r,i)}})},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):[]):[],yo=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Jt(e):()=>!1,Eo=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"]),ws=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),wo={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},Fn=new Map,So=(e,t)=>{let n=`${e} ${t}`,s=Fn.get(n);if(s!==void 0)return s;let r=wo[e],i=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,a]=r;i=new DOMParser().parseFromString(`<${o}><${a} ${t}="x"/></${o}>`,"text/html").querySelector(a)?.getAttributeNames().find(f=>f.toLowerCase()===t)??t}return Fn.set(n,i),i},Ss=(e,t)=>{let n=e.namespaceURI;if(n===null||n===ss)return t;let s=t.replace(/-/g,"").toLowerCase(),r=So(n,s);return r===s?t:r},bs=(e,t,n)=>{let s=Eo.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},le={cloneSkeletons:!0,scopedNames:!0},bo=new Set([":text",":html",":value",":checked",":selected"]),To=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||bo.has(e)?!0:e.startsWith(":")?e===":model"?!1:!ye(e)&&!e.includes("."):e!==Oe,Ts=e=>{if(e.component||e.tag.includes("-")||Ze(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!To(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||Ts(t))},$s=(e,t,n)=>{let s=ws(e),r,i=null;for(let h in e.attrs){let w=e.attrs[h];if(h.startsWith("@"))n.push({kind:"event",path:t,attr:h,expr:w});else if(h===":class")r=w;else if(h.startsWith(":class."))(i??(i=[])).push([h.slice(7),w]);else if(!ye(h))if(h.startsWith(":")){let O=h.slice(1);n.push({kind:"attr",path:t,name:Ss(s,O),expr:w||ie(O)})}else s.setAttribute(h,w)}(r!==void 0||i)&&n.push({kind:"class",path:t,classExpr:r,toggles:i,staticClasses:new Set(pe(e.attrs.class??""))});let o=e.attrs[":text"],a=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):a!==void 0?n.push({kind:"html",path:t,expr:a}):e.children.forEach((h,w)=>{if(typeof h=="string"){h.includes("{{")?(n.push({kind:"text",path:[...t,w],parts:Tt(h)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(h));return}s.appendChild($s(h,[...t,w],n))});let l=e.attrs[":value"];l!==void 0&&n.push({kind:"value",path:t,expr:l});let f=e.attrs[":checked"];f!==void 0&&n.push({kind:"checked",path:t,expr:f});let u=e.attrs[":selected"];return u!==void 0&&n.push({kind:"selected",path:t,expr:u}),s},$o=3,Rs=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:Rs(n)),0),Un=new WeakMap,Bn=new WeakSet,Ro=e=>{let t=Un.get(e);if(t!==void 0)return t;if(!Bn.has(e))return Bn.add(e),null;let n=null;if(Ts(e)&&Rs(e)>=$o){let s=[];n={skeleton:$s(e,[],s),ops:s}}return Un.set(e,n),n},xo=(e,t)=>{let n=e;for(let s=0;s<t.length;s++)n=n.childNodes[t[s]];return n},No=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);for(let r of e.ops){let i=r.path.length===0?s:xo(s,r.path);if(r.kind==="text"){let o=i,a=r.parts;n.effect(()=>{let l=hs(a,t);o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="event")gs(i,r.attr,r.expr,t);else if(r.kind==="attr"){let o=i,{name:a,expr:l}=r;n.effect(()=>bs(o,a,_(l,t)))}else if(r.kind==="class"){let o=i,{classExpr:a,toggles:l,staticClasses:f}=r,u=[];n.effect(()=>{let h=a!==void 0?pe(_(a,t)):[];l?.forEach(([w,O])=>{_(O,t)&&h.push(...pe(w))}),u.forEach(w=>{!h.includes(w)&&!f.has(w)&&o.classList.remove(w)}),o.classList.add(...h),u=h})}else if(r.kind==="textContent"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="html"){let o=i,{expr:a}=r;n.effect(()=>{o.innerHTML=lt(String(_(a,t)??""))})}else if(r.kind==="value"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.value!==l&&(o.value=l)})}else if(r.kind==="checked"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.checked!==l&&(o.checked=l)})}else if(r.kind==="selected"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.selected!==l&&(o.selected=l)})}else{let o=r}}return s},Gt=(e,t,n,s)=>{let r=e.attrs[":with"],i=r!==void 0?mo(r,t):t;if(Ze(e.tag))return po(e,i,n,s);if(e.tag==="template"&&Le(e)!==void 0)return co(e);let o=Dn(e,i);if(o)return Wn(o,e,i,n,s);if(le.cloneSkeletons){let b=Ro(e);if(b)return No(b,i,n)}let a=ws(e);if(e.component!==void 0&&i[rt]?.count===0)throw ro(e.component,i);let l=e.ns===void 0&&(e.component!==void 0||e.tag.includes("-"));if(l){let b=!1;n.effect(()=>{if(b)return;let H=Dn(e,i);if(!H)return;b=!0;let D=Wn(H,e,i,n,s),L=zt(D);n.onDispose(()=>it(L)),a.replaceWith(D)})}for(let b in e.attrs){let H=e.attrs[b];if(b.startsWith("@"))gs(a,b,H,i);else if(b===":model"||b.startsWith(":model."))l||console.warn(`jq79: ${b} on <${X(e)}> does nothing - :model binds component tags only (for now)`);else if(!ye(b))if(b.startsWith(":"))if(l)a.setAttribute(b,H);else{let D=b.slice(1),L=H||ie(D),B=Ss(a,D);n.effect(()=>bs(a,B,_(L,i)))}else a.setAttribute(b,H)}let f=e.attrs[":class"],u=null;for(let b in e.attrs)b.startsWith(":class.")&&(u??(u=[])).push([b.slice(7),e.attrs[b]]);if(f!==void 0||u){let b=new Set(pe(e.attrs.class??"")),H=[];n.effect(()=>{let D=f!==void 0?pe(_(f,i)):[];u?.forEach(([L,B])=>{_(B,i)&&D.push(...pe(L))}),H.forEach(L=>{!D.includes(L)&&!b.has(L)&&a.classList.remove(L)}),a.classList.add(...D),H=D})}let h=e.attrs[":text"],w=e.attrs[":html"],O=e.attrs[":html.allowed"];O!==void 0&&w===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),h!==void 0?n.effect(()=>{let b=String(_(h,i)??"");a.textContent!==b&&(a.textContent=b)}):w!==void 0?n.effect(()=>{let b=O!==void 0?{allowUrl:yo(_(O,i))}:void 0;a.innerHTML=lt(String(_(w,i)??""),b)}):a instanceof HTMLTemplateElement?be(e.children,i,n,s,a.content):be(e.children,i,n,s,a);let I=e.attrs[":value"];I!==void 0&&n.effect(()=>{let b=String(_(I,i)??"");a.value!==b&&(a.value=b)});let G=e.attrs[":checked"];G!==void 0&&n.effect(()=>{let b=!!_(G,i);a.checked!==b&&(a.checked=b)});let j=e.attrs[":selected"];return j!==void 0&&n.effect(()=>{let b=!!_(j,i);a.selected!==b&&(a.selected=b)}),a},vo=(e,t,n,s)=>{let r=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(r);let o=null,a=null,l=null;return n.effect(()=>{let f=e.find(h=>h.expr===void 0||_(h.expr,t))??null;if(f===a||(l?.dispose(),o&&it(o),o=null,a=f,!f))return;l=me(t);let u=Gt(f.node,t,l,s);o=zt(u),r.parentNode.insertBefore(u,r.nextSibling)}),n.onDispose(()=>l?.dispose()),i},Ne=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},Po=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let i=e[r];if(i<0)continue;let o=0,a=n.length;for(;o<a;){let l=o+a>>1;e[n[l]]<i?o=l+1:a=l}o>0&&(s[r]=n[o-1]),n[o]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},Co=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},xs=(e,t)=>typeof e=="string"?t.some(n=>zn(e,n)):Object.values(e.attrs).some(n=>t.some(s=>zn(n,s)))||e.children.some(n=>xs(n,t)),Ns=e=>typeof e!="string"&&(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs||":each"in e.attrs||e.component!==void 0||e.tag.includes("-")||Ze(e.tag)||e.children.some(Ns)),Kn=/[A-Za-z0-9_$]/,Mo=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,zn=(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(!Kn.test(s)&&!Kn.test(r))return!0}return!1},Mt=new WeakMap,ko=e=>{let t=Mt.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(Tn);if(!n)return Mt.set(e,null),null;let[,s,r,i]=n,o=e.attrs[":key"],a=o===s,l=o!==void 0&&!a&&Mo.test(o)&&o.startsWith(`${s}.`)?o.slice(s.length+1):void 0,{[":each"]:f,[":key"]:u,...h}=e.attrs,w={...e,attrs:h},O=["$index",...r?[r]:[]],I=xs(w,O),G=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),j=o!==void 0&&Ns(w),b={itemName:s,atName:r,listExpr:i,keyExpr:o,keyIsItem:a,keyProp:l,itemNode:w,readsPosition:I,namesComponent:G,nestsScopes:j};return Mt.set(e,b),b},Ao=(e,t,n,s)=>{let r=ko(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:i,atName:o,listExpr:a,keyExpr:l,keyIsItem:f,keyProp:u,itemNode:h,readsPosition:w,namesComponent:O,nestsScopes:I}=r,G=document.createComment("each"),j=document.createDocumentFragment();j.appendChild(G),(":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 b=[],H=!1;return n.effect(()=>{let D=to(t);try{let L=_(a,t),B=Array.isArray(L),ae=B?null:Co(L)?Object.keys(L):[],v=B?L.length:ae.length,P=new Map;b.forEach(($,q)=>{$.pos=q;let K=P.get($.key);K?K.push($):P.set($.key,[$])});let x=new Set,W=[],J=[],V=[],E=[],C;for(let $=0;$<v;$++){let q=B?$:ae[$],K=B?L[$]:L[q],c=q;f?c=K:u!==void 0&&K!==null&&typeof K=="object"?c=K[u]:l!==void 0&&(C===void 0?(C=Object.create(t),Ne(C,i,K),o&&Ne(C,o,q),Ne(C,"$index",$)):(C[i]=K,o&&(C[o]=q),C.$index=$),c=_(l,C)),x.has(c)&&!H&&(H=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),x.add(c);let d=P.get(c)?.shift();if(d&&Object.is(d.item,K)){let m=d.scope;m.$index!==$&&(w&&W.push(d),m.$index=$),o&&m[o]!==q&&(m[o]=q),V.push(d),E.push(d.pos);continue}if(d&&l!==void 0){let m=d.scope;m[i]=K,m.$index!==$&&(m.$index=$),o&&m[o]!==q&&(m[o]=q),d.item=K,J.push(d),V.push(d),E.push(d.pos);continue}d&&(d.fx.dispose(),it(d.range));let g=Object.create(t);Ne(g,i,K),o&&Ne(g,o,q),Ne(g,"$index",$),O||ms.add(g);let p=me(t);I&&Object.defineProperty(g,ht,{value:p});let S=zt(Gt(h,g,p,s));V.push({key:c,item:K,scope:g,fx:p,range:S,pos:$}),E.push(-1)}let M=new Set;P.forEach($=>$.forEach(q=>M.add(q))),M.size&&(M.forEach($=>{$.dead=!0,$.fx.dispose()}),Yr(Jr(b,$=>$.dead===!0)));let U=G,Q=Po(E);V.forEach(($,q)=>{!Q[q]&&U.nextSibling!==$.range.first&&eo($.range,U),U=$.range.last}),W.forEach($=>Re(()=>$.fx.refresh())),J.forEach($=>Re(()=>$.fx.rerun())),b=V}finally{no(D)}}),n.onDispose(()=>b.forEach(D=>D.fx.dispose())),j},vs=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},kt=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${X(e)}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},Oo=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${X(e)}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${X(e)}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},_o=[":if",":elseif",":else",":each"],jo=(e,t)=>{if(e.tag!=="template"||e.ns!==void 0)return;let n=_o.find(s=>s in e.attrs);if(n!==void 0){if(Le(e)!==void 0){if(t?.component===void 0)return;console.warn(`jq79: ${n} on <template ${Le(e)}> is ignored - a slot is filled with its children as written. Put ${n} on the elements inside it, or on the component's tag`);return}console.warn(`jq79: ${n} on a nested <template> shows nothing - a <template>'s children live in its .content and never reach the page. Put ${n} on the elements themselves`)}},Lo=[...$t,":model",":slot"].map(e=>e.slice(1)),Do={":attrs":':attrs was removed in 0.7 - it now binds an attribute called "attrs". Bind them one at a time (:disabled="x", :title="y"), or :class for classes'},Io=e=>{for(let t in e.attrs){let n=Do[t];n!==void 0&&console.warn(`jq79: ${n}`)}},qo=e=>{if(!(e.component!==void 0||e.tag.includes("-")))for(let t in e.attrs){if(!t.startsWith(":")||ye(t)||t===":model"||t.startsWith(":model."))continue;let n=t.slice(1);if(n.includes(".")){console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". Dotted modifiers belong to an event: if you meant @${n}, that is the spelling`);continue}let s=Lo.find(r=>n!==r&&n.startsWith(r));s!==void 0&&console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". A ":name" jq79 does not recognize binds that attribute (which is what :src and :disabled are). If you meant :${s}, that is the spelling`)}},Ps=(e,t)=>{e.forEach(s=>{typeof s!="string"&&(jo(s,t),Io(s),qo(s),Ps(s.children,s))});let n=!1;for(let s=0;s<e.length;){let r=e[s];if(typeof r=="string"){r.trim()&&(n=!1),s++;continue}if(":each"in r.attrs){n=!1,s++;continue}if(kt(r),":if"in r.attrs){s++;let i=a=>{let l=vs(e,s),f=e[l];if(typeof f=="object"&&a in f.attrs)return s=l+1,f};for(let a=i(":elseif");a;a=i(":elseif"))kt(a);let o=i(":else");o&&kt(o),n=o!==void 0;continue}(":elseif"in r.attrs||":else"in r.attrs)&&Oo(r,n),n=!1,s++}},Gn=new WeakMap,Ho=(e,t,n)=>{let s=Gn.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],i=n+1,o=f=>{let u=vs(e,i),h=e[u];if(typeof h=="object"&&f in h.attrs)return i=u+1,h};for(let f=o(":elseif");f;f=o(":elseif"))r.push({expr:f.attrs[":elseif"],node:f});let a=o(":else");a&&r.push({node:a});let l={branches:r,next:i};return Gn.set(t,l),l},be=(e,t,n,s=!1,r)=>{let i=r??document.createDocumentFragment(),o=0;for(;o<e.length;){let a=e[o];if(typeof a=="string"){let l=document.createTextNode(a);if(a.includes("{{")){let f=Tt(a);n.effect(()=>{let u=hs(f,t);l.textContent!==u&&(l.textContent=u)})}i.appendChild(l),o++;continue}if(":each"in a.attrs){i.appendChild(Ao(a,t,n,s)),o++;continue}if(":if"in a.attrs){let l=Ho(e,a,o);i.appendChild(vo(l.branches,t,n,s)),o=l.next;continue}i.appendChild(Gt(a,t,n,s)),o++}return i},Wo=(e,t,n=!1)=>be(e.template,t,me(t),n),Ce="data-jq79",Fo=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)},Cs=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Ce]=t,Cs(n.children,t))})},Uo=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),i=r===-1?s:s.slice(0,r),o=r===-1?"":s.slice(r);return`${i}[${Ce}="${t}"]${o}`}).join(", "),Ms=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Uo(n.selectorText,t):n instanceof CSSGroupingRule&&Ms(n.cssRules,t)})},Bo=/(^|[\s>+~,(])([A-Z][A-Za-z0-9]*)(?![\w-])/g,Ko=/[a-z]/,zo=e=>e.replace(Bo,(t,n,s)=>Ko.test(s)?`${n}${_e(s)}`:t),Go=/^\s*@(media|supports|container|layer|scope|document)\b/i,Vo=/^\s*@/,Zo=e=>{let t="",n="",s="",r=[],i=()=>r.length===0||r[r.length-1],o=()=>{t+=i()&&!Vo.test(s)?zo(n):n,n=""},a=f=>{o(),t+=f,s+=f},l=(f,u)=>{o(),t+=f,s="",u!==void 0?r.push(u):f==="}"&&r.pop()};for(let f=0;f<e.length;){let u=e[f];if(u==="/"&&e[f+1]==="*"){let h=e.indexOf("*/",f+2),w=h===-1?e.length:h+2;a(e.slice(f,w)),f=w}else if(u==='"'||u==="'"){let h=f+1;for(;h<e.length&&e[h]!==u;)h+=e[h]==="\\"?2:1;a(e.slice(f,Math.min(h+1,e.length))),f=h+1}else u==="{"?(l("{",Go.test(s)),f++):u==="}"||u===";"?(l(u),f++):(n+=u,s+=u,f++)}return o(),t},Qo=(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),Ms(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
18
18
  `)},It=e=>{let t=Sn(e),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],i=[];Array.from(s.content.children).forEach(l=>{l.tagName==="TEMPLATE"?i.push(l):r.push(l)});let o=Vn(r,e),a={};return i.forEach(l=>{let f=l.getAttribute("name");if(f===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!bn.test(f)){console.warn(`jq79: <template name="${f}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(f in a){console.warn(`jq79: two <template name="${f}"> in one file; the second was ignored`);return}a[f]=new de({...Vn(Array.from(l.content.children),l.innerHTML),siblings:a,name:f})}),Object.keys(a).length&&(o.siblings=a),o},Xo=/^(?:text|application)\/(?:x-)?typescript$/i,Yo=e=>"lang"in e?`lang="${e.lang}"`:Xo.test(e.type?.trim()??"")?`type="${e.type}"`:null,Vn=(e,t)=>{let n=[],s=[],r=[];e.forEach(o=>{let a={attrs:ns(o),content:o.textContent??""};o.tagName==="SCRIPT"?n.push(a):o.tagName==="STYLE"?s.push(a):r.push(rs(o))}),n.forEach(o=>{let a=Yo(o.attrs);a&&console.warn(`jq79: <script ${a}> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its types were never stripped: the script will throw, or - for a plain \`let x: T = ...\` - silently fail to declare x.`)}),s.forEach(o=>{"lang"in o.attrs&&console.warn(`jq79: <style lang="${o.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.`)}),s.forEach(o=>{"lang"in o.attrs||(o.content=Zo(o.content))});let i=o=>"scoped"in o.attrs&&!("lang"in o.attrs);if(s.some(i)){let o=Fo(t);Cs(r,o),s.forEach(a=>{i(a)&&(a.scoped=Qo(a.content,o))})}return Ps(r),{template:r,scripts:n,styles:s}},Vt=e=>/\.html?([?#]|$)/.test(e)?Ft(e):import(e),ks=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,Jo=(e,t)=>{if(!ks.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},ei=(e,t)=>e?`
19
19
  //# sourceURL=${e}?jq79-script=${t}`:"",As=(e,t,n)=>{try{return Bt(e,t,ei(n.filename,n.index??0))}catch(s){throw s instanceof Pe?new Error(`jq79: safeEval() is on, and script ${n.index??0} of ${n.filename??"a component built from a string"} ${s.reason}. ${s.hint}`):s}},Zn=e=>e.scoped??e.content,je=`:where([${Es}]) { display: contents }`,Zt=()=>Ut&&typeof Document<"u"&&"adoptedStyleSheets"in Document.prototype,nt=e=>{let t=new CSSStyleSheet;return t.replaceSync(e),t},Qt=(e,t)=>{e.adoptedStyleSheets.includes(t)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,t])},qt=(e,t)=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(n=>n!==t)},Xe=null,Ht=null,ti=()=>{if(Zt()){Qt(document,Ht??(Ht=nt(je)));return}Xe?.isConnected||(Xe=document.createElement("style"),Xe.textContent=je,document.head.appendChild(Xe))},st=new Map,ni=e=>{let t=st.get(e);if(!t){if(Zt()){let n=nt(e);Qt(document,n),t={sheet:n,count:0}}else{let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0}}st.set(e,t)}t.count++},si=e=>{let t=st.get(e);t&&--t.count<=0&&(t.sheet?qt(document,t.sheet):t.el?.remove(),st.delete(e))},ri=(e,t,n,s={},r=Vt,i={})=>{let o={...Ds,...s},a=new Proxy(t,{has:(u,h)=>h!=="$__effect"&&h!=="$__import"&&h!=="$__state"&&(Reflect.has(u,h)||!(h in globalThis)&&!(h in o))}),l={},f=As(xn(Object.keys(o)),Nn(e),i)(a,n,r,l,...Object.values(o));return f.catch(u=>console.error("jq79: error in :setup script",u)),ds(f),{settled:f,sync:l.done===!0}},Qn=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:_(s,e))})},Wt=e=>{let t=Cn(e);return!t&&e.attrs[":setup"]!==void 0&&oi(e,e.attrs[":setup"]),t},Xn=new WeakSet,oi=(e,t)=>{t.trim()==="_"||Xn.has(e)||(Xn.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`))},ii=e=>{let t=null;return e.forEach(n=>{let s=Ae(n.content)??Wt(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:i})=>r.add(i))}),t},Yn=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},Jn=new WeakMap,ai=(e,t,n,s)=>{if(s===null)return;let r=Jn.get(e)??new Set;Jn.set(e,r),n.forEach(i=>{s.has(i)||r.has(i)||(r.add(i),console.warn(`jq79: :${i} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},li=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,i])=>{t.has(r)||(n[r]=i,s=!0)}),s?n:null},Os=Symbol("jq79.unfilledProps"),rt=Symbol("jq79.pendingScripts"),ci=e=>e&&e.default!==void 0?e.default:e,di=(e,t,n,s={},r=Vt,i={})=>{let o={...Ds,...s},a={},l=As(vn(Object.keys(o)),Pn(e),i)(a,ci,r,...Object.values(o)),f=I=>console.error("jq79: error in factory script",I),u=!1,h,w=()=>{if(u)return h;u=!0;let I=a.default;if(typeof I!="function")return;let G=j=>{j&&typeof j=="object"&&Object.assign(t,j)};try{let j=I(t,{$data:t,$props:t,$effect:n,...s});j instanceof Promise?h=j.then(G).catch(f):G(j)}catch(j){f(j)}return h},O=l.then(w,f);return ds(O),a.done&&w(),{settled:O,sync:a.done===!0&&h===void 0}},ui="__JQ79_HMR_ENABLED__",fi="__JQ79_HMR__",Se=null,pi=e=>{if(!Se||!e.filename)return;let t=Se.get(e.filename);t||Se.set(e.filename,t=new Set),t.add(new WeakRef(e))},At=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},_s=(e,t)=>{if(!Se)return 0;let n=At(e),s=It(t);ne?.forEach((a,l)=>{At(l)===n&&ne.set(l,Promise.resolve(t))});let r=!1,i=a=>a.name===void 0?s:s.siblings?.[a.name]??null,o=0;for(let[a,l]of Se)if(At(a)===n){for(let f of l){let u=f.deref();if(!u){l.delete(f);continue}let h=i(u);if(!h){r=!0;continue}u.hotReplace(h)&&o++}l.size||Se.delete(a)}return r?0:o},js=()=>{Se??(Se=new Map),globalThis[fi]={update:_s}},es=3e3,hi=(e,t)=>{let n=setTimeout(()=>{console.warn(`jq79: ${e.name?`<${e.name}>`:"a component"}${e.filename?` (${e.filename})`:""} has been waiting ${es/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.`)},es);n?.unref?.(),Promise.all(t).then(()=>clearTimeout(n))},gi=e=>{if(ks.test(e))return e;let t=$i.resolve;if(typeof t!="function")return e;try{return t(e)}catch{return e}},ne=new Map,mi=e=>{try{return new URL(e,document.baseURI).href.replace(/#.*$/,"")}catch{return e}},ts=e=>Promise.all([fetch(e).then(t=>{if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return t.text()}),Ls?.then(()=>Si(e))]).then(([t])=>t),yi=e=>{if(!ne)return ts(e);let t=mi(e),n=ne.get(t);if(!n){n=ts(e),ne.set(t,n);let s=n;s.catch(()=>{ne?.get(t)===s&&ne.delete(t)})}return n},Ft=async e=>{let t=gi(e),n=await yi(t);return new de(n,{filename:t})},Ls,Ei="/jq79-sw.js",wi=async e=>{let t=typeof navigator>"u"?void 0:navigator.serviceWorker;if(!t)throw new Error("jq79: safeEval() compiles components in a service worker, and this page can't have one - service workers need https (or localhost). Precompile with the jq79/vite plugin instead, or use safeEval({ nonce: true }) on a page whose server issues a nonce.");let n;try{n=await t.register(e)}catch(s){throw new Error(`jq79: safeEval() couldn't register its service worker at ${e} (${s.message}). Serve jq79-sw.js from the jq79 package at your site's root, or pass its URL: safeEval({ worker: "/path/jq79-sw.js" }).`)}await t.ready,!t.controller&&await new Promise(s=>{t.addEventListener("controllerchange",()=>s(),{once:!0}),t.controller?s():n.active?.postMessage("jq79:claim")})},Si=e=>{let t=new URL(e,document.baseURI);return t.hash="",t.searchParams.set(An,""),new Promise((n,s)=>{let r=document.createElement("script"),i=os();i&&r.setAttribute("nonce",i),r.src=t.href,r.onload=()=>{r.remove(),n()},r.onerror=()=>{r.remove(),s(new Error(`jq79: the precompiled functions of ${e} did not load, and safeEval() can't render it without them`))},document.head.append(r)})},ce=class ce{constructor(t,n={}){k(this,"template");k(this,"scripts");k(this,"styles");k(this,"modules");k(this,"filename");k(this,"siblings");k(this,"name");k(this,"slots");k(this,"modelWriteback");k(this,"data",null);k(this,"fx",null);k(this,"content",null);k(this,"startMarker",null);k(this,"endMarker",null);k(this,"styleEls",[]);k(this,"shadowCss",null);k(this,"shadowSheets",[]);k(this,"sheetRoot",null);k(this,"ownsSharedStyles",!1);k(this,"useShadow",!1);k(this,"mountRoot",null);k(this,"resolveMounted",null);k(this,"renderDone",!1);k(this,"held",0);k(this,"onPaint",null);k(this,"destroyHooks",null);k(this,"attachHooks",null);k(this,"detachHooks",null);k(this,"onPage",!1);k(this,"emitListeners",new Map);let s=typeof t=="string"?It(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(),pi(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"?It(t):t;Kt.clear(),we.clear(),Dt.clear();let s=this.startMarker,r=!!(s&&this.content),i=r&&s.isConnected,o=i?s.parentNode:null,a=i?this.endMarker.nextSibling:null,l={...this.data},f=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(l,f),!o)?!1:(f&&this.placeShadowStyles(o,a),o.insertBefore(this.content,a),this.mountRoot=o,this.settleMounted(),!0)}static debug(t){if(t){let n=le.scopedNames;for(let s in t){let r=t[s];Object.prototype.hasOwnProperty.call(le,s)?typeof r=="boolean"?le[s]=r:console.warn(`jq79: Component79.debug ignored "${s}" - the flags are booleans, and the ones it knows are: ${Object.keys(le).join(", ")}`):console.warn(`jq79: Component79.debug does not know "${s}" - the flags it has are: ${Object.keys(le).join(", ")}`)}le.scopedNames!==n&&Je.clear()}return{...le}}static safeEval(t={}){Ut=!0;let n=[];if(t.nonce){let r=os();r===void 0?n.push(Promise.reject(new Error("jq79: safeEval({ nonce: true }) found no nonce on this page - no <script> carries one. The nonce belongs on the script that loads the page, the one the CSP names."))):jt=r}let s=t.worker??(t.nonce?!1:Ei);return s!==!1&&n.push(Ls??(Ls=wi(s))),Promise.all(n).then(()=>{})}static cache(t){return t===!1?ne=null:t===!0&&(ne??(ne=new Map)),!!ne}static clearCache(){ne?.clear()}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new ot(Ft(t))}static fetchAll(t){return Promise.all(t.map(Ft))}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=Mn(this.scripts,Wt),r=li(this.siblings,s),i=r?Object.assign(Object.create(r),t):{...t},o=new Set([...s].filter(E=>!(E in t)));o.size&&Object.defineProperty(i,Os,{value:o}),this.slots&&Object.defineProperty(i,ys,{value:this.slots}),Object.defineProperty(i,rt,{value:{count:0,owner:this}});let a=xe(i),l=me(a);this.data=a,this.fx=l,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let f=this.startMarker,u=!1,h=(E,C)=>{E==="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 M=new CustomEvent(E,{detail:C,bubbles:!0,composed:!0,cancelable:!0});return f===this.startMarker&&this.emitListeners.get(E)?.forEach(U=>U(M,C)),M.cancelBubble||f.dispatchEvent(M),!M.defaultPrevented},w,O=new Promise(E=>{w=E});this.resolveMounted=w,this.renderDone=!1,this.held=0;let I=E=>{if(typeof E!="function")throw new TypeError("jq79: $destroyed expects a function");return f!==this.startMarker?(ve(E,"$destroyed"),()=>{}):Ot(this.destroyHooks??(this.destroyHooks=[]),E)},G=(E,{immediate:C=!0}={})=>{if(typeof E!="function")throw new TypeError("jq79: $attached expects a function");if(f!==this.startMarker)return()=>{};this.watchPage();let M=Ot(this.attachHooks??(this.attachHooks=[]),E);return C&&this.onPage&&ve(E,"$attached"),M},j=E=>{if(typeof E!="function")throw new TypeError("jq79: $detached expects a function");return f!==this.startMarker?(ve(E,"$detached"),()=>{}):(this.watchPage(),Ot(this.detachHooks??(this.detachHooks=[]),E))},b=E=>{let C=Fe(E);return I(()=>C.$dispose()),C},H=this.endMarker,D=(E=>{let C=[];for(let M=f.nextSibling;M&&M!==H;M=M.nextSibling)M instanceof Element&&(M.matches(E)&&C.push(M),C.push(...Array.from(M.querySelectorAll(E))));return C}),L=(E=>D(E)[0]??null),B=this.modules,ae=E=>B&&E in B?Promise.resolve(B[E]):Vt(Jo(E,this.filename)),P=Object.assign(Object.create(null),{$emit:h,$updateModel:(...E)=>{let[C,M]=E.length>1?E:[void 0,E[0]];return f!==this.startMarker?!1:this.modelWriteback?.(C,M)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(E=>[E,!0]))}),x=[],W=!0;this.scripts.forEach((E,C)=>{let M;x.push(new Promise(p=>{M=p}));let U=!1,Q=()=>{U=!0,M()},q={$mounted:()=>(Q(),O),$destroyed:I,$attached:G,$detached:j,$computed:b,$self:L,$$self:D,...P,...r},K={filename:this.filename,index:C},c=":mounted"in E.attrs,d=mn(E.content),g=(()=>{if(d!==null){c&&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."),Qn(a,Ae(E.content));let y=c?vt(d):d;return di(y,a,R=>l.effect(R),q,ae,K)}let{vars:p,code:S}=Ge(E.content);Qn(a,Wt(E)),p.forEach(y=>{y in a||(a[y]=void 0)});let m=c?vt(S):S;return ri(m,a,y=>l.effect(y),q,ae,K)})();if(g.sync)g.settled.then(Q,Q);else{let p=i[rt];p.count++;let S=()=>{p.count--,Q()};g.settled.then(S,S)}!g.sync&&!U&&(W=!1)});let J=document.createDocumentFragment(),V=new Proxy(a,{has:(E,C)=>typeof C=="string"&&C in P||Reflect.has(E,C),get:(E,C,M)=>typeof C=="string"&&C in P&&!Reflect.has(E,C)?P[C]:Reflect.get(E,C,M)});if(J.append(this.startMarker,this.endMarker),this.content=J,W?(this.endMarker.parentNode.insertBefore(be(this.template,V,l,n),this.endMarker),this.renderDone=!0,this.settleMounted()):(Promise.all(x).then(()=>{f===this.startMarker&&(this.endMarker.parentNode.insertBefore(be(this.template,V,l,n),this.endMarker),this.renderDone=!0,this.settleMounted(),ce.settleAttached())}),hi(this,x)),n)if(Zt())this.shadowCss=[...this.styles.map(E=>E.content),je];else{let E=document.createElement("style");E.textContent=je,this.styleEls=[...this.styles.map(C=>{let M=document.createElement("style");return M.textContent=C.content,M}),E]}else this.styles.forEach(E=>ni(Zn(E))),this.ownsSharedStyles=!0;return this}mount(t,n){let s=typeof t=="string"?Te(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"?Te(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.placeShadowStyles(n,null),n.appendChild(this.content),this.mountRoot=n,this.settleMounted(),ce.settleAttached(),this}isOnPage(){return this.renderDone&&this.startMarker?.isConnected===!0}watchPage(){fe.has(this)||(fe.add(this),this.onPage=this.isOnPage(),this.onPage||ce.queueSettle())}static queueSettle(){_t||(_t=!0,queueMicrotask(()=>{_t=!1,ce.settleAttached()}))}static settleAttached(){if(fe.size===0)return;let t=[...fe].filter(n=>!n.onPage&&n.isOnPage());ce.inDocumentOrder(t).forEach(n=>{n.onPage||!fe.has(n)||(n.onPage=!0,n.attachHooks?.slice().forEach(s=>ve(s,"$attached")))})}notifyDetached(){if(fe.size===0)return;let t=[];if(this.startMarker?.isConnected){let n=new Set;for(let r=this.startMarker;r&&(n.add(r),r!==this.endMarker);r=r.nextSibling);let s=r=>{for(;r;r=r.parentNode)if(n.has(r))return!0;return!1};t=ce.inDocumentOrder([...fe].filter(r=>r.onPage&&s(r.startMarker)))}else this.onPage&&(t=[this]);t.forEach(n=>{n.onPage&&(n.onPage=!1,n.detachHooks?.slice().forEach(s=>ve(s,"$detached")))})}static inDocumentOrder(t){return t.sort((n,s)=>n.startMarker.compareDocumentPosition(s.startMarker)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)}placeShadowStyles(t,n){if(this.shadowCss&&typeof ShadowRoot<"u"&&t instanceof ShadowRoot){this.sheetRoot&&this.sheetRoot!==t&&this.shadowSheets.forEach(s=>qt(this.sheetRoot,s)),this.shadowSheets.length===0&&(this.shadowSheets=this.shadowCss.map(s=>s===je?Ht??(Ht=nt(s)):nt(s))),this.shadowSheets.forEach(s=>Qt(t,s)),this.sheetRoot=t;return}this.shadowCss&&this.styleEls.length===0&&(this.styleEls=this.shadowCss.map(s=>{let r=document.createElement("style");return r.textContent=s,r})),this.styleEls.forEach(s=>t.insertBefore(s,n))}settleMounted(){if(!this.renderDone||this.held>0)return;let t=this.onPaint;this.onPaint=null,t?.(),this.mountRoot&&this.resolveMounted?.()}holdOwner(t){this.renderDone&&this.held===0||(t.held++,this.onPaint=()=>{t.held--,t.settleMounted()})}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;this.notifyDetached();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(){this.notifyDetached(),fe.delete(this),this.attachHooks=null,this.detachHooks=null,this.onPage=!1;let t=this.destroyHooks;this.destroyHooks=null,t?.forEach(s=>ve(s,"$destroyed")),this.resolveMounted=null;let n=this.onPaint;return this.onPaint=null,n?.(),this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(s=>s.parentNode?.removeChild(s)),this.styleEls=[],this.sheetRoot&&this.shadowSheets.forEach(s=>{s!==Ht&&qt(this.sheetRoot,s)}),this.shadowCss=null,this.shadowSheets=[],this.sheetRoot=null,this.ownsSharedStyles&&(this.styles.forEach(s=>si(Zn(s))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.renderDone=!1,this.data=null,this.resolveMounted=null,this}};k(ce,"version",qr);var de=ce,ot=class{constructor(t){k(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 bi=e=>new de(e),ve=(e,t)=>{try{e()}catch(n){console.error(`jq79: error in a ${t} hook`,n)}},Ot=(e,t)=>(e.push(t),()=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)}),fe=new Set,_t=!1,Ds={$:Te,$$:Ie,$create:qe,$reactive:xe,$toRaw:Z,Component79:de};typeof globalThis<"u"&&globalThis[ui]&&js();return Bs(Ti);})();
20
20
  //# sourceMappingURL=jq79.global.js.map
package/dist/jq79.js CHANGED
@@ -14,7 +14,7 @@ ${e}
14
14
  ;$__exports.done = true })()`,Pn=e=>{let t=e.attrs[":setup"];return t===void 0?null:t.trim()===""?[]:ke(t)},Cn=(e,t)=>{let n=new Set;return e.forEach(s=>{(Ae(s.content)??t(s))?.forEach(({name:i})=>n.add(i))}),n};var Mn="__jq79precompiled",kn="jq79-precompiled",An=(e,t)=>`function anonymous(${e.join(",")}
15
15
  ) {
16
16
  ${t}
17
- }`;var kr="0.7.7",ts=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),ns="http://www.w3.org/1999/xhtml",ss=e=>{let t=ts(e),n=e.namespaceURI,s=t[Oe];delete t[Oe];let r=n!==null&&n!==ns;return{tag:r?e.tagName:e.tagName.toLowerCase(),attrs:t,...s===void 0?{}:{component:s},...r?{ns:n}:{},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(i=>{if(i.nodeType===Node.TEXT_NODE){let o=i.textContent??"";return o?[o]:[]}return i.nodeType===Node.ELEMENT_NODE?[ss(i)]:[]})}},Ze=new Map,Ve=new Map,Ft=!1,Ot,Ne=class extends Error{constructor(n,s){super(`${n}. ${s}`);k(this,"reason",n);k(this,"hint",s)}},Ar=()=>new Ne("was not precompiled","Safe mode never builds code at runtime: the component's precompiled functions did not reach the page."),Or=(e,t)=>{let n=globalThis[Mn];if(Array.isArray(n)&&n.length>0)for(let[s,r,i]of n.splice(0))Ve.set(ze(s,r),i);return Ve.size===0?void 0:Ve.get(ze(e,t))},Ut=(e,t,n="")=>{let s=Or(e,t);if(s===null)throw new SyntaxError("jq79: this code did not compile when it was precompiled");if(s!==void 0)return s;if(Ot!==void 0)return _r(e,t,n,Ot);if(Ft)throw Ar();return new Function(...e,t+n)},rs=()=>{if(!(typeof document>"u"))for(let e of Array.from(document.querySelectorAll("script[nonce]"))){let t=e.nonce||e.getAttribute("nonce");if(t)return t}},On="__jq79built",_r=(e,t,n,s)=>{let r=document.createElement("script");r.setAttribute("nonce",s),r.textContent=`document.currentScript.${On} = ${An(e,t)}${n}`;let i,o=l=>{i=l.error??new SyntaxError(l.message),l.preventDefault()};window.addEventListener("error",o);try{(document.head??document.documentElement).append(r)}finally{window.removeEventListener("error",o),r.remove()}let a=r[On];if(typeof a=="function")return Ve.set(ze(e,t),a),a;throw i!==void 0?i:new Ne("could not be built","The page's CSP refused a <script> carrying the nonce jq79 read from the page.")},_n=new Set,jr=(e,t)=>{_n.has(e)||(_n.add(e),console.error(`jq79: safeEval() is on, and "${e}" ${t.reason}, so it rendered as nothing. ${t.hint}`))},Nt=(e,t)=>{if(!(t in e)){if(t in globalThis)return globalThis[t];throw new ReferenceError(`${t} is not defined`)}},os=(e,t)=>{try{return Ut([...Rt,...t],Tn(e))}catch(n){return n instanceof Ne&&jr(e,n),null}},Lr=(e,t)=>{if(!le.scopedNames)return null;let n=$n(e,t);if(n===null)return null;try{return Ut([...Rt,...t],n)}catch{return null}},is=(e,t,n)=>{let s=Ze.get(e);if(s===void 0){let r=Lr(t,n);s=r?{fn:r,scoped:!0}:{fn:os(t,n),scoped:!1},Ze.set(e,s)}return s},as=(e,t)=>`${t.join(",")}|${e}`,Dr=(e,t)=>is(as(e,t),e,t).fn,Ir=(e,t,n)=>{let s=os(t,n);return Ze.set(e,{fn:s,scoped:!1}),s},qr=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Hr=100,we=new Map,Bt=new Set,Qe=0,_t=!1,jt=new Set,Wr=()=>{_t=!1,!(Qe>0)&&(we.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Bt.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 = () => {}".`))}),we.clear())},ls=()=>{_t||Qe>0||!we.size||(_t=!0,queueMicrotask(Wr))},cs=e=>{Qe++;let t=()=>{Qe--,ls()};e.then(t,t)},Fr=(e,t)=>{if(jt.has(e))return;jt.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.`)},ds=(e,t,n)=>{if(!(n instanceof ReferenceError))return Fr(e,n);let s=qr.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let i=`${r}|${e}`;Bt.has(i)||we.has(i)||we.size>=Hr||(we.set(i,{name:r,expr:e,scope:t}),ls())},us=(e,t,n)=>{let s=n?Object.keys(n):[],r=as(e,s),{fn:i,scoped:o}=is(r,e,s);if(!i)return;let a=n?Object.values(n):[];if(!o)return i(t,Nt,...a);try{return i(t,Nt,...a)}catch(l){if(!(l instanceof ReferenceError))throw l;let f=Ir(r,e,s);if(!f)throw l;return f(t,Nt,...a)}},_=(e,t,n)=>{try{return us(e,t,n)}catch(s){ds(e,t,s);return}},fs=(e,t,n)=>{try{return us(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;ds(e,t,s);return}},ps=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(_(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(_(s.expr,t)??"");return n},hs=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i);e.addEventListener(r,a=>{if(o.has("self")&&a.target!==e)return;o.has("prevent")&&a.preventDefault(),o.has("stop")&&a.stopPropagation();let l=fs(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:o.has("once"),capture:o.has("capture")})},Ur=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i),a=l=>{o.has("prevent")&&l.preventDefault(),o.has("stop")&&l.stopPropagation(),o.has("once")&&e.off(r,a),$e(()=>{let f=fs(n,s,{$event:l});typeof f=="function"&&f(l)})};e.on(r,a)},Kt=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},tt=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Br=e=>{e.forEach(t=>{if(t.first===t.last)return tt(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},Kr=(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},zr=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let i=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=i}},jn=(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},Ee=null,Xe=null,gs=new WeakSet,Gr=e=>{let t={memo:Ee,base:Xe};return Ee=new Map,Xe=e,t},Vr=e=>{Ee=e.memo,Xe=e.base},Ln=(e,t)=>e.component!==void 0?Dn(t,e.component):e.tag.includes("-")?Dn(t,e.tag):null,X=e=>e.component??e.tag,Dn=(e,t)=>{if(!Ee)return jn(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===Xe){if(Ee.has(t))return Ee.get(t);let r=jn(s,t);return Ee.set(t,r),r}if(!gs.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},Zr=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()},Qr=(e,t)=>{let n=Zr(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)"}.`)},In=100,vt=0,ms=Symbol("jq79.slots"),Le=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),Xr=e=>e==="default"?":slot":`:slot.${e}`,Yr=e=>typeof e!="string"||e.trim()!=="",Jr=e=>{let t={},n=[];e.children.forEach(r=>{let i=typeof r=="object"&&r.tag==="template"?Le(r):void 0;if(typeof r=="string"||i===void 0){n.push(r);return}let o=Tt(i.slice(6));if(o in t){console.warn(`jq79: two <template ${Xr(o)}> in <${X(e)}>; the second was ignored`);return}t[o]={nodes:r.children,binder:r.attrs[i]||void 0}});let s=n.some(Yr);return s&&"default"in t?console.warn(`jq79: <${X(e)}> 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},eo=(e,t,n)=>{ke(t)?.forEach(({name:s,as:r,default:i})=>{let o=r??s;Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&i!==void 0?_(i,e):a},set:()=>console.warn(`jq79: "${o}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},to=e=>{let t=Le(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}`)},no=(e,t)=>{let n=Object.entries(Jr(e));if(!n.length)return null;let s={};return n.forEach(([r,i])=>{s[r]=so(i,t)}),s},so=(e,t)=>(n,s,r,i)=>{let o=Object.create(t);eo(o,e.binder,n);let a=o[Ie]??[];Object.defineProperty(o,Ie,{value:[...a,s]});let l=me(o);return l.ownedBy(s),r.onDispose(()=>l.dispose()),be(e.nodes,o,l,i)},ro=(e,t,n,s)=>{let r=Tt(e.tag.slice(5)),i=document.createDocumentFragment(),o=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);i.append(o,a);let l=t[ms]?.[r];if(!l)return i.insertBefore(be(e.children,t,n,s),a),i;let f={};return Object.entries(e.attrs).forEach(([u,h])=>{if(!(u===ve||ye(u)||u.startsWith("@")))if(u.startsWith(":")){let w=h||u.slice(1);f[ie(u.slice(1))]=()=>_(w,t)}else f[ie(u)]=()=>h}),i.insertBefore(l(f,t,n,s),a),i},ys="data-c79-box",oo=(e,t,n)=>{if(t.ns!==void 0)return document.createDocumentFragment();let s=document.createElement(_e(e));s.setAttribute(ys,"");let r=t.attrs[ve];return r!==void 0&&s.setAttribute(ve,r),n||zo(),s},qn=new WeakSet,io=(e,t)=>{if(e.ns===void 0||qn.has(e))return;let n=t.template.find(r=>typeof r=="object");if(n===void 0||n.ns!==void 0)return;qn.add(e);let s=e.ns==="http://www.w3.org/1998/Math/MathML"?"<math>":"<svg>";console.warn(`jq79: <${X(e)}> is used inside ${s} and its template starts with <${n.tag.toLowerCase()}>, which is parsed as HTML - it renders and never draws. A component's template decides its own namespace, so root it at ${s}`)},Hn=(e,t,n,s,r)=>{let i=oo(e,t,r),o=!(i instanceof DocumentFragment),a=o?null:document.createComment(`/${e}`);o||i.append(document.createComment(e),a);let l=no(t,n),f={},u={},h=[],w=[],O=!1;Object.entries(t.attrs).forEach(([v,P])=>{if(v!==ve){if(v===":props"||v.startsWith(":props.")){O=!0,w.push({expr:P});return}if(!ye(v))if(v.startsWith("@"))h.push([v,P]);else if(v===":model"||v.startsWith(":model.")){let x=v===":model"?"default":ie(v.slice(7));u[x]=P||(v===":model"?"model":x)}else if(v.startsWith(":")){let x=ie(v.slice(1));f[x]=P||x,w.push({name:x,expr:P||x})}else{let x=ie(v),W=JSON.stringify(P);f[x]=W,w.push({name:x,expr:W})}}});let I=v=>v==="default"?":model":`:model.${v}`,G=v=>v==="default"?"model":v,j=new Set;Object.entries(u).forEach(([v,P])=>{let x=G(v);f[x]!==void 0&&console.warn(`jq79: <${X(t)}> binds prop "${x}" through both :${x} and ${I(v)} - ${I(v)} wins`),f[x]=P,Dr($t(P),["$value"])===null&&(j.add(v),console.warn(`jq79: ${I(v)}="${P}" is not assignable - updates from <${X(t)}> will be dropped`))});let b=()=>{let v={};return w.forEach(({name:P,expr:x})=>{if(P!==void 0)v[P]=_(x,n);else{let W=_(x,n);W!==null&&typeof W=="object"&&Object.assign(v,W)}}),Object.entries(u).forEach(([P,x])=>{v[G(P)]=_(x,n)}),v},H=null,D=null,L=null,B=new Set,ae=v=>{if(v==null){if(!n[As]?.has(e)||B.has("unfilled"))return;B.add("unfilled"),console.error(`jq79: <${X(t)}> 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: <${X(t)}> is ${typeof v}, not a component - nothing renders here`))};return s.effect(()=>{let v=_(e,n),P=v instanceof pe?v:null;if(P||ae(v),P===D||(L?.dispose(),L=null,H?.destroy(),H=null,D=P,!P))return;io(t,P);let x=new pe({template:P.template,scripts:P.scripts,styles:P.styles,modules:P.modules,filename:P.filename,siblings:P.siblings,name:P.name});if(l&&(x.slots=l),Object.keys(u).length){let M=new Set;x.modelWriteback=(U,Q)=>{let $=U==null?"default":ie(String(U)),q=u[$];return q===void 0?(M.has($)||(M.add($),console.warn(`jq79: <${X(t)}> has no ${I($)} - bound: ${Object.keys(u).map(I).join(", ")}`)),!1):j.has($)?!1:($e(()=>_($t(q),n,{$value:Q})),!0)}}h.forEach(([M,U])=>Ur(x,M,U,n));let W=Xo(x.scripts);Yo(t,e,Object.keys(f),W);let J=Xn($e(b),W),V=document.createDocumentFragment();if(vt>=In){console.error(`jq79: <${X(t)}> is ${In} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}vt++;try{(r?x.renderShadow(J):x.render(J)).mount(V)}finally{vt--}let E=n[et];E&&x.holdOwner(E.owner),a?a.parentNode.insertBefore(V,a):i.appendChild(V);let C=me(n,!0);if(O){let M=[];C.effect(()=>{let U=Xn(b(),W),Q=Object.keys(U);M.forEach($=>{$ in U||(x.data[$]=void 0)}),Q.forEach($=>{x.data[$]=U[$]}),M=Q})}else Object.entries(f).forEach(([M,U])=>{W!==null&&!W.has(M)||C.effect(()=>{x.data[M]=_(U,n)})});L=C,H=x}),s.onDispose(()=>{L?.dispose(),H?.destroy()}),i},ao=(e,t)=>{let n=()=>{let s=_(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let i=n();return i!==null&&Reflect.has(i,r)||Reflect.has(s,r)},get(s,r){let i=n();return i!==null&&Reflect.has(i,r)?i[r]:Reflect.get(s,r)},set(s,r,i){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=i,!0):Reflect.set(s,r,i)}})},fe=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(fe):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?fe(t):[]):[],lo=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Yt(e):()=>!1,co=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"]),Es=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),uo={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},Wn=new Map,fo=(e,t)=>{let n=`${e} ${t}`,s=Wn.get(n);if(s!==void 0)return s;let r=uo[e],i=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,a]=r;i=new DOMParser().parseFromString(`<${o}><${a} ${t}="x"/></${o}>`,"text/html").querySelector(a)?.getAttributeNames().find(f=>f.toLowerCase()===t)??t}return Wn.set(n,i),i},ws=(e,t)=>{let n=e.namespaceURI;if(n===null||n===ns)return t;let s=t.replace(/-/g,"").toLowerCase(),r=fo(n,s);return r===s?t:r},Ss=(e,t,n)=>{let s=co.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},le={cloneSkeletons:!0,scopedNames:!0},po=new Set([":text",":html",":value",":checked",":selected"]),ho=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||po.has(e)?!0:e.startsWith(":")?e===":model"?!1:!ye(e)&&!e.includes("."):e!==Oe,bs=e=>{if(e.component||e.tag.includes("-")||Ke(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!ho(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||bs(t))},Ts=(e,t,n)=>{let s=Es(e),r,i=null;for(let h in e.attrs){let w=e.attrs[h];if(h.startsWith("@"))n.push({kind:"event",path:t,attr:h,expr:w});else if(h===":class")r=w;else if(h.startsWith(":class."))(i??(i=[])).push([h.slice(7),w]);else if(!ye(h))if(h.startsWith(":")){let O=h.slice(1);n.push({kind:"attr",path:t,name:ws(s,O),expr:w||ie(O)})}else s.setAttribute(h,w)}(r!==void 0||i)&&n.push({kind:"class",path:t,classExpr:r,toggles:i,staticClasses:new Set(fe(e.attrs.class??""))});let o=e.attrs[":text"],a=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):a!==void 0?n.push({kind:"html",path:t,expr:a}):e.children.forEach((h,w)=>{if(typeof h=="string"){h.includes("{{")?(n.push({kind:"text",path:[...t,w],parts:St(h)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(h));return}s.appendChild(Ts(h,[...t,w],n))});let l=e.attrs[":value"];l!==void 0&&n.push({kind:"value",path:t,expr:l});let f=e.attrs[":checked"];f!==void 0&&n.push({kind:"checked",path:t,expr:f});let u=e.attrs[":selected"];return u!==void 0&&n.push({kind:"selected",path:t,expr:u}),s},go=3,$s=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:$s(n)),0),Fn=new WeakMap,Un=new WeakSet,mo=e=>{let t=Fn.get(e);if(t!==void 0)return t;if(!Un.has(e))return Un.add(e),null;let n=null;if(bs(e)&&$s(e)>=go){let s=[];n={skeleton:Ts(e,[],s),ops:s}}return Fn.set(e,n),n},yo=(e,t)=>{let n=e;for(let s=0;s<t.length;s++)n=n.childNodes[t[s]];return n},Eo=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);for(let r of e.ops){let i=r.path.length===0?s:yo(s,r.path);if(r.kind==="text"){let o=i,a=r.parts;n.effect(()=>{let l=ps(a,t);o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="event")hs(i,r.attr,r.expr,t);else if(r.kind==="attr"){let o=i,{name:a,expr:l}=r;n.effect(()=>Ss(o,a,_(l,t)))}else if(r.kind==="class"){let o=i,{classExpr:a,toggles:l,staticClasses:f}=r,u=[];n.effect(()=>{let h=a!==void 0?fe(_(a,t)):[];l?.forEach(([w,O])=>{_(O,t)&&h.push(...fe(w))}),u.forEach(w=>{!h.includes(w)&&!f.has(w)&&o.classList.remove(w)}),o.classList.add(...h),u=h})}else if(r.kind==="textContent"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="html"){let o=i,{expr:a}=r;n.effect(()=>{o.innerHTML=ot(String(_(a,t)??""))})}else if(r.kind==="value"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.value!==l&&(o.value=l)})}else if(r.kind==="checked"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.checked!==l&&(o.checked=l)})}else if(r.kind==="selected"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.selected!==l&&(o.selected=l)})}else{let o=r}}return s},zt=(e,t,n,s)=>{let r=e.attrs[":with"],i=r!==void 0?ao(r,t):t;if(Ke(e.tag))return ro(e,i,n,s);if(e.tag==="template"&&Le(e)!==void 0)return to(e);let o=Ln(e,i);if(o)return Hn(o,e,i,n,s);if(le.cloneSkeletons){let b=mo(e);if(b)return Eo(b,i,n)}let a=Es(e);if(e.component!==void 0&&i[et]?.count===0)throw Qr(e.component,i);let l=e.ns===void 0&&(e.component!==void 0||e.tag.includes("-"));if(l){let b=!1;n.effect(()=>{if(b)return;let H=Ln(e,i);if(!H)return;b=!0;let D=Hn(H,e,i,n,s),L=Kt(D);n.onDispose(()=>tt(L)),a.replaceWith(D)})}for(let b in e.attrs){let H=e.attrs[b];if(b.startsWith("@"))hs(a,b,H,i);else if(b===":model"||b.startsWith(":model."))l||console.warn(`jq79: ${b} on <${X(e)}> does nothing - :model binds component tags only (for now)`);else if(!ye(b))if(b.startsWith(":"))if(l)a.setAttribute(b,H);else{let D=b.slice(1),L=H||ie(D),B=ws(a,D);n.effect(()=>Ss(a,B,_(L,i)))}else a.setAttribute(b,H)}let f=e.attrs[":class"],u=null;for(let b in e.attrs)b.startsWith(":class.")&&(u??(u=[])).push([b.slice(7),e.attrs[b]]);if(f!==void 0||u){let b=new Set(fe(e.attrs.class??"")),H=[];n.effect(()=>{let D=f!==void 0?fe(_(f,i)):[];u?.forEach(([L,B])=>{_(B,i)&&D.push(...fe(L))}),H.forEach(L=>{!D.includes(L)&&!b.has(L)&&a.classList.remove(L)}),a.classList.add(...D),H=D})}let h=e.attrs[":text"],w=e.attrs[":html"],O=e.attrs[":html.allowed"];O!==void 0&&w===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),h!==void 0?n.effect(()=>{let b=String(_(h,i)??"");a.textContent!==b&&(a.textContent=b)}):w!==void 0?n.effect(()=>{let b=O!==void 0?{allowUrl:lo(_(O,i))}:void 0;a.innerHTML=ot(String(_(w,i)??""),b)}):a instanceof HTMLTemplateElement?be(e.children,i,n,s,a.content):be(e.children,i,n,s,a);let I=e.attrs[":value"];I!==void 0&&n.effect(()=>{let b=String(_(I,i)??"");a.value!==b&&(a.value=b)});let G=e.attrs[":checked"];G!==void 0&&n.effect(()=>{let b=!!_(G,i);a.checked!==b&&(a.checked=b)});let j=e.attrs[":selected"];return j!==void 0&&n.effect(()=>{let b=!!_(j,i);a.selected!==b&&(a.selected=b)}),a},wo=(e,t,n,s)=>{let r=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(r);let o=null,a=null,l=null;return n.effect(()=>{let f=e.find(h=>h.expr===void 0||_(h.expr,t))??null;if(f===a||(l?.dispose(),o&&tt(o),o=null,a=f,!f))return;l=me(t);let u=zt(f.node,t,l,s);o=Kt(u),r.parentNode.insertBefore(u,r.nextSibling)}),n.onDispose(()=>l?.dispose()),i},Re=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},So=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let i=e[r];if(i<0)continue;let o=0,a=n.length;for(;o<a;){let l=o+a>>1;e[n[l]]<i?o=l+1:a=l}o>0&&(s[r]=n[o-1]),n[o]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},bo=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Rs=(e,t)=>typeof e=="string"?t.some(n=>Kn(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Kn(n,s)))||e.children.some(n=>Rs(n,t)),xs=e=>typeof e!="string"&&(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs||":each"in e.attrs||e.component!==void 0||e.tag.includes("-")||Ke(e.tag)||e.children.some(xs)),Bn=/[A-Za-z0-9_$]/,To=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Kn=(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(!Bn.test(s)&&!Bn.test(r))return!0}return!1},Pt=new WeakMap,$o=e=>{let t=Pt.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(bn);if(!n)return Pt.set(e,null),null;let[,s,r,i]=n,o=e.attrs[":key"],a=o===s,l=o!==void 0&&!a&&To.test(o)&&o.startsWith(`${s}.`)?o.slice(s.length+1):void 0,{[":each"]:f,[":key"]:u,...h}=e.attrs,w={...e,attrs:h},O=["$index",...r?[r]:[]],I=Rs(w,O),G=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),j=o!==void 0&&xs(w),b={itemName:s,atName:r,listExpr:i,keyExpr:o,keyIsItem:a,keyProp:l,itemNode:w,readsPosition:I,namesComponent:G,nestsScopes:j};return Pt.set(e,b),b},Ro=(e,t,n,s)=>{let r=$o(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:i,atName:o,listExpr:a,keyExpr:l,keyIsItem:f,keyProp:u,itemNode:h,readsPosition:w,namesComponent:O,nestsScopes:I}=r,G=document.createComment("each"),j=document.createDocumentFragment();j.appendChild(G),(":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 b=[],H=!1;return n.effect(()=>{let D=Gr(t);try{let L=_(a,t),B=Array.isArray(L),ae=B?null:bo(L)?Object.keys(L):[],v=B?L.length:ae.length,P=new Map;b.forEach(($,q)=>{$.pos=q;let K=P.get($.key);K?K.push($):P.set($.key,[$])});let x=new Set,W=[],J=[],V=[],E=[],C;for(let $=0;$<v;$++){let q=B?$:ae[$],K=B?L[$]:L[q],c=q;f?c=K:u!==void 0&&K!==null&&typeof K=="object"?c=K[u]:l!==void 0&&(C===void 0?(C=Object.create(t),Re(C,i,K),o&&Re(C,o,q),Re(C,"$index",$)):(C[i]=K,o&&(C[o]=q),C.$index=$),c=_(l,C)),x.has(c)&&!H&&(H=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),x.add(c);let d=P.get(c)?.shift();if(d&&Object.is(d.item,K)){let m=d.scope;m.$index!==$&&(w&&W.push(d),m.$index=$),o&&m[o]!==q&&(m[o]=q),V.push(d),E.push(d.pos);continue}if(d&&l!==void 0){let m=d.scope;m[i]=K,m.$index!==$&&(m.$index=$),o&&m[o]!==q&&(m[o]=q),d.item=K,J.push(d),V.push(d),E.push(d.pos);continue}d&&(d.fx.dispose(),tt(d.range));let g=Object.create(t);Re(g,i,K),o&&Re(g,o,q),Re(g,"$index",$),O||gs.add(g);let p=me(t);I&&Object.defineProperty(g,ut,{value:p});let S=Kt(zt(h,g,p,s));V.push({key:c,item:K,scope:g,fx:p,range:S,pos:$}),E.push(-1)}let M=new Set;P.forEach($=>$.forEach(q=>M.add(q))),M.size&&(M.forEach($=>{$.dead=!0,$.fx.dispose()}),Br(Kr(b,$=>$.dead===!0)));let U=G,Q=So(E);V.forEach(($,q)=>{!Q[q]&&U.nextSibling!==$.range.first&&zr($.range,U),U=$.range.last}),W.forEach($=>$e(()=>$.fx.refresh())),J.forEach($=>$e(()=>$.fx.rerun())),b=V}finally{Vr(D)}}),n.onDispose(()=>b.forEach(D=>D.fx.dispose())),j},Ns=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},Ct=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${X(e)}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},xo=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${X(e)}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${X(e)}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},No=[":if",":elseif",":else",":each"],vo=(e,t)=>{if(e.tag!=="template"||e.ns!==void 0)return;let n=No.find(s=>s in e.attrs);if(n!==void 0){if(Le(e)!==void 0){if(t?.component===void 0)return;console.warn(`jq79: ${n} on <template ${Le(e)}> is ignored - a slot is filled with its children as written. Put ${n} on the elements inside it, or on the component's tag`);return}console.warn(`jq79: ${n} on a nested <template> shows nothing - a <template>'s children live in its .content and never reach the page. Put ${n} on the elements themselves`)}},Po=[...bt,":model",":slot"].map(e=>e.slice(1)),Co={":attrs":':attrs was removed in 0.7 - it now binds an attribute called "attrs". Bind them one at a time (:disabled="x", :title="y"), or :class for classes'},Mo=e=>{for(let t in e.attrs){let n=Co[t];n!==void 0&&console.warn(`jq79: ${n}`)}},ko=e=>{if(!(e.component!==void 0||e.tag.includes("-")))for(let t in e.attrs){if(!t.startsWith(":")||ye(t)||t===":model"||t.startsWith(":model."))continue;let n=t.slice(1);if(n.includes(".")){console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". Dotted modifiers belong to an event: if you meant @${n}, that is the spelling`);continue}let s=Po.find(r=>n!==r&&n.startsWith(r));s!==void 0&&console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". A ":name" jq79 does not recognize binds that attribute (which is what :src and :disabled are). If you meant :${s}, that is the spelling`)}},vs=(e,t)=>{e.forEach(s=>{typeof s!="string"&&(vo(s,t),Mo(s),ko(s),vs(s.children,s))});let n=!1;for(let s=0;s<e.length;){let r=e[s];if(typeof r=="string"){r.trim()&&(n=!1),s++;continue}if(":each"in r.attrs){n=!1,s++;continue}if(Ct(r),":if"in r.attrs){s++;let i=a=>{let l=Ns(e,s),f=e[l];if(typeof f=="object"&&a in f.attrs)return s=l+1,f};for(let a=i(":elseif");a;a=i(":elseif"))Ct(a);let o=i(":else");o&&Ct(o),n=o!==void 0;continue}(":elseif"in r.attrs||":else"in r.attrs)&&xo(r,n),n=!1,s++}},zn=new WeakMap,Ao=(e,t,n)=>{let s=zn.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],i=n+1,o=f=>{let u=Ns(e,i),h=e[u];if(typeof h=="object"&&f in h.attrs)return i=u+1,h};for(let f=o(":elseif");f;f=o(":elseif"))r.push({expr:f.attrs[":elseif"],node:f});let a=o(":else");a&&r.push({node:a});let l={branches:r,next:i};return zn.set(t,l),l},be=(e,t,n,s=!1,r)=>{let i=r??document.createDocumentFragment(),o=0;for(;o<e.length;){let a=e[o];if(typeof a=="string"){let l=document.createTextNode(a);if(a.includes("{{")){let f=St(a);n.effect(()=>{let u=ps(f,t);l.textContent!==u&&(l.textContent=u)})}i.appendChild(l),o++;continue}if(":each"in a.attrs){i.appendChild(Ro(a,t,n,s)),o++;continue}if(":if"in a.attrs){let l=Ao(e,a,o);i.appendChild(wo(l.branches,t,n,s)),o=l.next;continue}i.appendChild(zt(a,t,n,s)),o++}return i},xi=(e,t,n=!1)=>be(e.template,t,me(t),n),ve="data-jq79",Oo=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)},Ps=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[ve]=t,Ps(n.children,t))})},_o=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),i=r===-1?s:s.slice(0,r),o=r===-1?"":s.slice(r);return`${i}[${ve}="${t}"]${o}`}).join(", "),Cs=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=_o(n.selectorText,t):n instanceof CSSGroupingRule&&Cs(n.cssRules,t)})},jo=/(^|[\s>+~,(])([A-Z][A-Za-z0-9]*)(?![\w-])/g,Lo=/[a-z]/,Do=e=>e.replace(jo,(t,n,s)=>Lo.test(s)?`${n}${_e(s)}`:t),Io=/^\s*@(media|supports|container|layer|scope|document)\b/i,qo=/^\s*@/,Ho=e=>{let t="",n="",s="",r=[],i=()=>r.length===0||r[r.length-1],o=()=>{t+=i()&&!qo.test(s)?Do(n):n,n=""},a=f=>{o(),t+=f,s+=f},l=(f,u)=>{o(),t+=f,s="",u!==void 0?r.push(u):f==="}"&&r.pop()};for(let f=0;f<e.length;){let u=e[f];if(u==="/"&&e[f+1]==="*"){let h=e.indexOf("*/",f+2),w=h===-1?e.length:h+2;a(e.slice(f,w)),f=w}else if(u==='"'||u==="'"){let h=f+1;for(;h<e.length&&e[h]!==u;)h+=e[h]==="\\"?2:1;a(e.slice(f,Math.min(h+1,e.length))),f=h+1}else u==="{"?(l("{",Io.test(s)),f++):u==="}"||u===";"?(l(u),f++):(n+=u,s+=u,f++)}return o(),t},Wo=(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),Cs(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
17
+ }`;var kr="0.7.8",ts=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),ns="http://www.w3.org/1999/xhtml",ss=e=>{let t=ts(e),n=e.namespaceURI,s=t[Oe];delete t[Oe];let r=n!==null&&n!==ns;return{tag:r?e.tagName:e.tagName.toLowerCase(),attrs:t,...s===void 0?{}:{component:s},...r?{ns:n}:{},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(i=>{if(i.nodeType===Node.TEXT_NODE){let o=i.textContent??"";return o?[o]:[]}return i.nodeType===Node.ELEMENT_NODE?[ss(i)]:[]})}},Ze=new Map,Ve=new Map,Ft=!1,Ot,Ne=class extends Error{constructor(n,s){super(`${n}. ${s}`);k(this,"reason",n);k(this,"hint",s)}},Ar=()=>new Ne("was not precompiled","Safe mode never builds code at runtime: the component's precompiled functions did not reach the page."),Or=(e,t)=>{let n=globalThis[Mn];if(Array.isArray(n)&&n.length>0)for(let[s,r,i]of n.splice(0))Ve.set(ze(s,r),i);return Ve.size===0?void 0:Ve.get(ze(e,t))},Ut=(e,t,n="")=>{let s=Or(e,t);if(s===null)throw new SyntaxError("jq79: this code did not compile when it was precompiled");if(s!==void 0)return s;if(Ot!==void 0)return _r(e,t,n,Ot);if(Ft)throw Ar();return new Function(...e,t+n)},rs=()=>{if(!(typeof document>"u"))for(let e of Array.from(document.querySelectorAll("script[nonce]"))){let t=e.nonce||e.getAttribute("nonce");if(t)return t}},On="__jq79built",_r=(e,t,n,s)=>{let r=document.createElement("script");r.setAttribute("nonce",s),r.textContent=`document.currentScript.${On} = ${An(e,t)}${n}`;let i,o=l=>{i=l.error??new SyntaxError(l.message),l.preventDefault()};window.addEventListener("error",o);try{(document.head??document.documentElement).append(r)}finally{window.removeEventListener("error",o),r.remove()}let a=r[On];if(typeof a=="function")return Ve.set(ze(e,t),a),a;throw i!==void 0?i:new Ne("could not be built","The page's CSP refused a <script> carrying the nonce jq79 read from the page.")},_n=new Set,jr=(e,t)=>{_n.has(e)||(_n.add(e),console.error(`jq79: safeEval() is on, and "${e}" ${t.reason}, so it rendered as nothing. ${t.hint}`))},Nt=(e,t)=>{if(!(t in e)){if(t in globalThis)return globalThis[t];throw new ReferenceError(`${t} is not defined`)}},os=(e,t)=>{try{return Ut([...Rt,...t],Tn(e))}catch(n){return n instanceof Ne&&jr(e,n),null}},Lr=(e,t)=>{if(!le.scopedNames)return null;let n=$n(e,t);if(n===null)return null;try{return Ut([...Rt,...t],n)}catch{return null}},is=(e,t,n)=>{let s=Ze.get(e);if(s===void 0){let r=Lr(t,n);s=r?{fn:r,scoped:!0}:{fn:os(t,n),scoped:!1},Ze.set(e,s)}return s},as=(e,t)=>`${t.join(",")}|${e}`,Dr=(e,t)=>is(as(e,t),e,t).fn,Ir=(e,t,n)=>{let s=os(t,n);return Ze.set(e,{fn:s,scoped:!1}),s},qr=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Hr=100,we=new Map,Bt=new Set,Qe=0,_t=!1,jt=new Set,Wr=()=>{_t=!1,!(Qe>0)&&(we.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Bt.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 = () => {}".`))}),we.clear())},ls=()=>{_t||Qe>0||!we.size||(_t=!0,queueMicrotask(Wr))},cs=e=>{Qe++;let t=()=>{Qe--,ls()};e.then(t,t)},Fr=(e,t)=>{if(jt.has(e))return;jt.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.`)},ds=(e,t,n)=>{if(!(n instanceof ReferenceError))return Fr(e,n);let s=qr.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let i=`${r}|${e}`;Bt.has(i)||we.has(i)||we.size>=Hr||(we.set(i,{name:r,expr:e,scope:t}),ls())},us=(e,t,n)=>{let s=n?Object.keys(n):[],r=as(e,s),{fn:i,scoped:o}=is(r,e,s);if(!i)return;let a=n?Object.values(n):[];if(!o)return i(t,Nt,...a);try{return i(t,Nt,...a)}catch(l){if(!(l instanceof ReferenceError))throw l;let f=Ir(r,e,s);if(!f)throw l;return f(t,Nt,...a)}},_=(e,t,n)=>{try{return us(e,t,n)}catch(s){ds(e,t,s);return}},fs=(e,t,n)=>{try{return us(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;ds(e,t,s);return}},ps=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(_(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(_(s.expr,t)??"");return n},hs=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i);e.addEventListener(r,a=>{if(o.has("self")&&a.target!==e)return;o.has("prevent")&&a.preventDefault(),o.has("stop")&&a.stopPropagation();let l=fs(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:o.has("once"),capture:o.has("capture")})},Ur=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i),a=l=>{o.has("prevent")&&l.preventDefault(),o.has("stop")&&l.stopPropagation(),o.has("once")&&e.off(r,a),$e(()=>{let f=fs(n,s,{$event:l});typeof f=="function"&&f(l)})};e.on(r,a)},Kt=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},tt=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Br=e=>{e.forEach(t=>{if(t.first===t.last)return tt(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},Kr=(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},zr=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let i=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=i}},jn=(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},Ee=null,Xe=null,gs=new WeakSet,Gr=e=>{let t={memo:Ee,base:Xe};return Ee=new Map,Xe=e,t},Vr=e=>{Ee=e.memo,Xe=e.base},Ln=(e,t)=>e.component!==void 0?Dn(t,e.component):e.tag.includes("-")?Dn(t,e.tag):null,X=e=>e.component??e.tag,Dn=(e,t)=>{if(!Ee)return jn(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===Xe){if(Ee.has(t))return Ee.get(t);let r=jn(s,t);return Ee.set(t,r),r}if(!gs.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},Zr=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()},Qr=(e,t)=>{let n=Zr(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)"}.`)},In=100,vt=0,ms=Symbol("jq79.slots"),Le=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),Xr=e=>e==="default"?":slot":`:slot.${e}`,Yr=e=>typeof e!="string"||e.trim()!=="",Jr=e=>{let t={},n=[];e.children.forEach(r=>{let i=typeof r=="object"&&r.tag==="template"?Le(r):void 0;if(typeof r=="string"||i===void 0){n.push(r);return}let o=Tt(i.slice(6));if(o in t){console.warn(`jq79: two <template ${Xr(o)}> in <${X(e)}>; the second was ignored`);return}t[o]={nodes:r.children,binder:r.attrs[i]||void 0}});let s=n.some(Yr);return s&&"default"in t?console.warn(`jq79: <${X(e)}> 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},eo=(e,t,n)=>{ke(t)?.forEach(({name:s,as:r,default:i})=>{let o=r??s;Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&i!==void 0?_(i,e):a},set:()=>console.warn(`jq79: "${o}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},to=e=>{let t=Le(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}`)},no=(e,t)=>{let n=Object.entries(Jr(e));if(!n.length)return null;let s={};return n.forEach(([r,i])=>{s[r]=so(i,t)}),s},so=(e,t)=>(n,s,r,i)=>{let o=Object.create(t);eo(o,e.binder,n);let a=o[Ie]??[];Object.defineProperty(o,Ie,{value:[...a,s]});let l=me(o);return l.ownedBy(s),r.onDispose(()=>l.dispose()),be(e.nodes,o,l,i)},ro=(e,t,n,s)=>{let r=Tt(e.tag.slice(5)),i=document.createDocumentFragment(),o=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);i.append(o,a);let l=t[ms]?.[r];if(!l)return i.insertBefore(be(e.children,t,n,s),a),i;let f={};return Object.entries(e.attrs).forEach(([u,h])=>{if(!(u===ve||ye(u)||u.startsWith("@")))if(u.startsWith(":")){let w=h||u.slice(1);f[ie(u.slice(1))]=()=>_(w,t)}else f[ie(u)]=()=>h}),i.insertBefore(l(f,t,n,s),a),i},ys="data-c79-box",oo=(e,t,n)=>{if(t.ns!==void 0)return document.createDocumentFragment();let s=document.createElement(_e(e));s.setAttribute(ys,"");let r=t.attrs[ve];return r!==void 0&&s.setAttribute(ve,r),n||zo(),s},qn=new WeakSet,io=(e,t)=>{if(e.ns===void 0||qn.has(e))return;let n=t.template.find(r=>typeof r=="object");if(n===void 0||n.ns!==void 0)return;qn.add(e);let s=e.ns==="http://www.w3.org/1998/Math/MathML"?"<math>":"<svg>";console.warn(`jq79: <${X(e)}> is used inside ${s} and its template starts with <${n.tag.toLowerCase()}>, which is parsed as HTML - it renders and never draws. A component's template decides its own namespace, so root it at ${s}`)},Hn=(e,t,n,s,r)=>{let i=oo(e,t,r),o=!(i instanceof DocumentFragment),a=o?null:document.createComment(`/${e}`);o||i.append(document.createComment(e),a);let l=no(t,n),f={},u={},h=[],w=[],O=!1;Object.entries(t.attrs).forEach(([v,P])=>{if(v!==ve){if(v===":props"||v.startsWith(":props.")){O=!0,w.push({expr:P});return}if(!ye(v))if(v.startsWith("@"))h.push([v,P]);else if(v===":model"||v.startsWith(":model.")){let x=v===":model"?"default":ie(v.slice(7));u[x]=P||(v===":model"?"model":x)}else if(v.startsWith(":")){let x=ie(v.slice(1));f[x]=P||x,w.push({name:x,expr:P||x})}else{let x=ie(v),W=JSON.stringify(P);f[x]=W,w.push({name:x,expr:W})}}});let I=v=>v==="default"?":model":`:model.${v}`,G=v=>v==="default"?"model":v,j=new Set;Object.entries(u).forEach(([v,P])=>{let x=G(v);f[x]!==void 0&&console.warn(`jq79: <${X(t)}> binds prop "${x}" through both :${x} and ${I(v)} - ${I(v)} wins`),f[x]=P,Dr($t(P),["$value"])===null&&(j.add(v),console.warn(`jq79: ${I(v)}="${P}" is not assignable - updates from <${X(t)}> will be dropped`))});let b=()=>{let v={};return w.forEach(({name:P,expr:x})=>{if(P!==void 0)v[P]=_(x,n);else{let W=_(x,n);W!==null&&typeof W=="object"&&Object.assign(v,W)}}),Object.entries(u).forEach(([P,x])=>{v[G(P)]=_(x,n)}),v},H=null,D=null,L=null,B=new Set,ae=v=>{if(v==null){if(!n[As]?.has(e)||B.has("unfilled"))return;B.add("unfilled"),console.error(`jq79: <${X(t)}> 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: <${X(t)}> is ${typeof v}, not a component - nothing renders here`))};return s.effect(()=>{let v=_(e,n),P=v instanceof pe?v:null;if(P||ae(v),P===D||(L?.dispose(),L=null,H?.destroy(),H=null,D=P,!P))return;io(t,P);let x=new pe({template:P.template,scripts:P.scripts,styles:P.styles,modules:P.modules,filename:P.filename,siblings:P.siblings,name:P.name});if(l&&(x.slots=l),Object.keys(u).length){let M=new Set;x.modelWriteback=(U,Q)=>{let $=U==null?"default":ie(String(U)),q=u[$];return q===void 0?(M.has($)||(M.add($),console.warn(`jq79: <${X(t)}> has no ${I($)} - bound: ${Object.keys(u).map(I).join(", ")}`)),!1):j.has($)?!1:($e(()=>_($t(q),n,{$value:Q})),!0)}}h.forEach(([M,U])=>Ur(x,M,U,n));let W=Xo(x.scripts);Yo(t,e,Object.keys(f),W);let J=Xn($e(b),W),V=document.createDocumentFragment();if(vt>=In){console.error(`jq79: <${X(t)}> is ${In} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}vt++;try{(r?x.renderShadow(J):x.render(J)).mount(V)}finally{vt--}let E=n[et];E&&x.holdOwner(E.owner),a?a.parentNode.insertBefore(V,a):i.appendChild(V);let C=me(n,!0);if(O){let M=[];C.effect(()=>{let U=Xn(b(),W),Q=Object.keys(U);M.forEach($=>{$ in U||(x.data[$]=void 0)}),Q.forEach($=>{x.data[$]=U[$]}),M=Q})}else Object.entries(f).forEach(([M,U])=>{W!==null&&!W.has(M)||C.effect(()=>{x.data[M]=_(U,n)})});L=C,H=x}),s.onDispose(()=>{L?.dispose(),H?.destroy()}),i},ao=(e,t)=>{let n=()=>{let s=_(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let i=n();return i!==null&&Reflect.has(i,r)||Reflect.has(s,r)},get(s,r){let i=n();return i!==null&&Reflect.has(i,r)?i[r]:Reflect.get(s,r)},set(s,r,i){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=i,!0):Reflect.set(s,r,i)}})},fe=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(fe):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?fe(t):[]):[],lo=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Yt(e):()=>!1,co=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"]),Es=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),uo={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},Wn=new Map,fo=(e,t)=>{let n=`${e} ${t}`,s=Wn.get(n);if(s!==void 0)return s;let r=uo[e],i=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,a]=r;i=new DOMParser().parseFromString(`<${o}><${a} ${t}="x"/></${o}>`,"text/html").querySelector(a)?.getAttributeNames().find(f=>f.toLowerCase()===t)??t}return Wn.set(n,i),i},ws=(e,t)=>{let n=e.namespaceURI;if(n===null||n===ns)return t;let s=t.replace(/-/g,"").toLowerCase(),r=fo(n,s);return r===s?t:r},Ss=(e,t,n)=>{let s=co.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},le={cloneSkeletons:!0,scopedNames:!0},po=new Set([":text",":html",":value",":checked",":selected"]),ho=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||po.has(e)?!0:e.startsWith(":")?e===":model"?!1:!ye(e)&&!e.includes("."):e!==Oe,bs=e=>{if(e.component||e.tag.includes("-")||Ke(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!ho(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||bs(t))},Ts=(e,t,n)=>{let s=Es(e),r,i=null;for(let h in e.attrs){let w=e.attrs[h];if(h.startsWith("@"))n.push({kind:"event",path:t,attr:h,expr:w});else if(h===":class")r=w;else if(h.startsWith(":class."))(i??(i=[])).push([h.slice(7),w]);else if(!ye(h))if(h.startsWith(":")){let O=h.slice(1);n.push({kind:"attr",path:t,name:ws(s,O),expr:w||ie(O)})}else s.setAttribute(h,w)}(r!==void 0||i)&&n.push({kind:"class",path:t,classExpr:r,toggles:i,staticClasses:new Set(fe(e.attrs.class??""))});let o=e.attrs[":text"],a=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):a!==void 0?n.push({kind:"html",path:t,expr:a}):e.children.forEach((h,w)=>{if(typeof h=="string"){h.includes("{{")?(n.push({kind:"text",path:[...t,w],parts:St(h)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(h));return}s.appendChild(Ts(h,[...t,w],n))});let l=e.attrs[":value"];l!==void 0&&n.push({kind:"value",path:t,expr:l});let f=e.attrs[":checked"];f!==void 0&&n.push({kind:"checked",path:t,expr:f});let u=e.attrs[":selected"];return u!==void 0&&n.push({kind:"selected",path:t,expr:u}),s},go=3,$s=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:$s(n)),0),Fn=new WeakMap,Un=new WeakSet,mo=e=>{let t=Fn.get(e);if(t!==void 0)return t;if(!Un.has(e))return Un.add(e),null;let n=null;if(bs(e)&&$s(e)>=go){let s=[];n={skeleton:Ts(e,[],s),ops:s}}return Fn.set(e,n),n},yo=(e,t)=>{let n=e;for(let s=0;s<t.length;s++)n=n.childNodes[t[s]];return n},Eo=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);for(let r of e.ops){let i=r.path.length===0?s:yo(s,r.path);if(r.kind==="text"){let o=i,a=r.parts;n.effect(()=>{let l=ps(a,t);o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="event")hs(i,r.attr,r.expr,t);else if(r.kind==="attr"){let o=i,{name:a,expr:l}=r;n.effect(()=>Ss(o,a,_(l,t)))}else if(r.kind==="class"){let o=i,{classExpr:a,toggles:l,staticClasses:f}=r,u=[];n.effect(()=>{let h=a!==void 0?fe(_(a,t)):[];l?.forEach(([w,O])=>{_(O,t)&&h.push(...fe(w))}),u.forEach(w=>{!h.includes(w)&&!f.has(w)&&o.classList.remove(w)}),o.classList.add(...h),u=h})}else if(r.kind==="textContent"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="html"){let o=i,{expr:a}=r;n.effect(()=>{o.innerHTML=ot(String(_(a,t)??""))})}else if(r.kind==="value"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(_(a,t)??"");o.value!==l&&(o.value=l)})}else if(r.kind==="checked"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.checked!==l&&(o.checked=l)})}else if(r.kind==="selected"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!_(a,t);o.selected!==l&&(o.selected=l)})}else{let o=r}}return s},zt=(e,t,n,s)=>{let r=e.attrs[":with"],i=r!==void 0?ao(r,t):t;if(Ke(e.tag))return ro(e,i,n,s);if(e.tag==="template"&&Le(e)!==void 0)return to(e);let o=Ln(e,i);if(o)return Hn(o,e,i,n,s);if(le.cloneSkeletons){let b=mo(e);if(b)return Eo(b,i,n)}let a=Es(e);if(e.component!==void 0&&i[et]?.count===0)throw Qr(e.component,i);let l=e.ns===void 0&&(e.component!==void 0||e.tag.includes("-"));if(l){let b=!1;n.effect(()=>{if(b)return;let H=Ln(e,i);if(!H)return;b=!0;let D=Hn(H,e,i,n,s),L=Kt(D);n.onDispose(()=>tt(L)),a.replaceWith(D)})}for(let b in e.attrs){let H=e.attrs[b];if(b.startsWith("@"))hs(a,b,H,i);else if(b===":model"||b.startsWith(":model."))l||console.warn(`jq79: ${b} on <${X(e)}> does nothing - :model binds component tags only (for now)`);else if(!ye(b))if(b.startsWith(":"))if(l)a.setAttribute(b,H);else{let D=b.slice(1),L=H||ie(D),B=ws(a,D);n.effect(()=>Ss(a,B,_(L,i)))}else a.setAttribute(b,H)}let f=e.attrs[":class"],u=null;for(let b in e.attrs)b.startsWith(":class.")&&(u??(u=[])).push([b.slice(7),e.attrs[b]]);if(f!==void 0||u){let b=new Set(fe(e.attrs.class??"")),H=[];n.effect(()=>{let D=f!==void 0?fe(_(f,i)):[];u?.forEach(([L,B])=>{_(B,i)&&D.push(...fe(L))}),H.forEach(L=>{!D.includes(L)&&!b.has(L)&&a.classList.remove(L)}),a.classList.add(...D),H=D})}let h=e.attrs[":text"],w=e.attrs[":html"],O=e.attrs[":html.allowed"];O!==void 0&&w===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),h!==void 0?n.effect(()=>{let b=String(_(h,i)??"");a.textContent!==b&&(a.textContent=b)}):w!==void 0?n.effect(()=>{let b=O!==void 0?{allowUrl:lo(_(O,i))}:void 0;a.innerHTML=ot(String(_(w,i)??""),b)}):a instanceof HTMLTemplateElement?be(e.children,i,n,s,a.content):be(e.children,i,n,s,a);let I=e.attrs[":value"];I!==void 0&&n.effect(()=>{let b=String(_(I,i)??"");a.value!==b&&(a.value=b)});let G=e.attrs[":checked"];G!==void 0&&n.effect(()=>{let b=!!_(G,i);a.checked!==b&&(a.checked=b)});let j=e.attrs[":selected"];return j!==void 0&&n.effect(()=>{let b=!!_(j,i);a.selected!==b&&(a.selected=b)}),a},wo=(e,t,n,s)=>{let r=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(r);let o=null,a=null,l=null;return n.effect(()=>{let f=e.find(h=>h.expr===void 0||_(h.expr,t))??null;if(f===a||(l?.dispose(),o&&tt(o),o=null,a=f,!f))return;l=me(t);let u=zt(f.node,t,l,s);o=Kt(u),r.parentNode.insertBefore(u,r.nextSibling)}),n.onDispose(()=>l?.dispose()),i},Re=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},So=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let i=e[r];if(i<0)continue;let o=0,a=n.length;for(;o<a;){let l=o+a>>1;e[n[l]]<i?o=l+1:a=l}o>0&&(s[r]=n[o-1]),n[o]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},bo=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Rs=(e,t)=>typeof e=="string"?t.some(n=>Kn(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Kn(n,s)))||e.children.some(n=>Rs(n,t)),xs=e=>typeof e!="string"&&(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs||":each"in e.attrs||e.component!==void 0||e.tag.includes("-")||Ke(e.tag)||e.children.some(xs)),Bn=/[A-Za-z0-9_$]/,To=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Kn=(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(!Bn.test(s)&&!Bn.test(r))return!0}return!1},Pt=new WeakMap,$o=e=>{let t=Pt.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(bn);if(!n)return Pt.set(e,null),null;let[,s,r,i]=n,o=e.attrs[":key"],a=o===s,l=o!==void 0&&!a&&To.test(o)&&o.startsWith(`${s}.`)?o.slice(s.length+1):void 0,{[":each"]:f,[":key"]:u,...h}=e.attrs,w={...e,attrs:h},O=["$index",...r?[r]:[]],I=Rs(w,O),G=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),j=o!==void 0&&xs(w),b={itemName:s,atName:r,listExpr:i,keyExpr:o,keyIsItem:a,keyProp:l,itemNode:w,readsPosition:I,namesComponent:G,nestsScopes:j};return Pt.set(e,b),b},Ro=(e,t,n,s)=>{let r=$o(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:i,atName:o,listExpr:a,keyExpr:l,keyIsItem:f,keyProp:u,itemNode:h,readsPosition:w,namesComponent:O,nestsScopes:I}=r,G=document.createComment("each"),j=document.createDocumentFragment();j.appendChild(G),(":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 b=[],H=!1;return n.effect(()=>{let D=Gr(t);try{let L=_(a,t),B=Array.isArray(L),ae=B?null:bo(L)?Object.keys(L):[],v=B?L.length:ae.length,P=new Map;b.forEach(($,q)=>{$.pos=q;let K=P.get($.key);K?K.push($):P.set($.key,[$])});let x=new Set,W=[],J=[],V=[],E=[],C;for(let $=0;$<v;$++){let q=B?$:ae[$],K=B?L[$]:L[q],c=q;f?c=K:u!==void 0&&K!==null&&typeof K=="object"?c=K[u]:l!==void 0&&(C===void 0?(C=Object.create(t),Re(C,i,K),o&&Re(C,o,q),Re(C,"$index",$)):(C[i]=K,o&&(C[o]=q),C.$index=$),c=_(l,C)),x.has(c)&&!H&&(H=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),x.add(c);let d=P.get(c)?.shift();if(d&&Object.is(d.item,K)){let m=d.scope;m.$index!==$&&(w&&W.push(d),m.$index=$),o&&m[o]!==q&&(m[o]=q),V.push(d),E.push(d.pos);continue}if(d&&l!==void 0){let m=d.scope;m[i]=K,m.$index!==$&&(m.$index=$),o&&m[o]!==q&&(m[o]=q),d.item=K,J.push(d),V.push(d),E.push(d.pos);continue}d&&(d.fx.dispose(),tt(d.range));let g=Object.create(t);Re(g,i,K),o&&Re(g,o,q),Re(g,"$index",$),O||gs.add(g);let p=me(t);I&&Object.defineProperty(g,ut,{value:p});let S=Kt(zt(h,g,p,s));V.push({key:c,item:K,scope:g,fx:p,range:S,pos:$}),E.push(-1)}let M=new Set;P.forEach($=>$.forEach(q=>M.add(q))),M.size&&(M.forEach($=>{$.dead=!0,$.fx.dispose()}),Br(Kr(b,$=>$.dead===!0)));let U=G,Q=So(E);V.forEach(($,q)=>{!Q[q]&&U.nextSibling!==$.range.first&&zr($.range,U),U=$.range.last}),W.forEach($=>$e(()=>$.fx.refresh())),J.forEach($=>$e(()=>$.fx.rerun())),b=V}finally{Vr(D)}}),n.onDispose(()=>b.forEach(D=>D.fx.dispose())),j},Ns=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},Ct=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${X(e)}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},xo=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${X(e)}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${X(e)}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},No=[":if",":elseif",":else",":each"],vo=(e,t)=>{if(e.tag!=="template"||e.ns!==void 0)return;let n=No.find(s=>s in e.attrs);if(n!==void 0){if(Le(e)!==void 0){if(t?.component===void 0)return;console.warn(`jq79: ${n} on <template ${Le(e)}> is ignored - a slot is filled with its children as written. Put ${n} on the elements inside it, or on the component's tag`);return}console.warn(`jq79: ${n} on a nested <template> shows nothing - a <template>'s children live in its .content and never reach the page. Put ${n} on the elements themselves`)}},Po=[...bt,":model",":slot"].map(e=>e.slice(1)),Co={":attrs":':attrs was removed in 0.7 - it now binds an attribute called "attrs". Bind them one at a time (:disabled="x", :title="y"), or :class for classes'},Mo=e=>{for(let t in e.attrs){let n=Co[t];n!==void 0&&console.warn(`jq79: ${n}`)}},ko=e=>{if(!(e.component!==void 0||e.tag.includes("-")))for(let t in e.attrs){if(!t.startsWith(":")||ye(t)||t===":model"||t.startsWith(":model."))continue;let n=t.slice(1);if(n.includes(".")){console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". Dotted modifiers belong to an event: if you meant @${n}, that is the spelling`);continue}let s=Po.find(r=>n!==r&&n.startsWith(r));s!==void 0&&console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". A ":name" jq79 does not recognize binds that attribute (which is what :src and :disabled are). If you meant :${s}, that is the spelling`)}},vs=(e,t)=>{e.forEach(s=>{typeof s!="string"&&(vo(s,t),Mo(s),ko(s),vs(s.children,s))});let n=!1;for(let s=0;s<e.length;){let r=e[s];if(typeof r=="string"){r.trim()&&(n=!1),s++;continue}if(":each"in r.attrs){n=!1,s++;continue}if(Ct(r),":if"in r.attrs){s++;let i=a=>{let l=Ns(e,s),f=e[l];if(typeof f=="object"&&a in f.attrs)return s=l+1,f};for(let a=i(":elseif");a;a=i(":elseif"))Ct(a);let o=i(":else");o&&Ct(o),n=o!==void 0;continue}(":elseif"in r.attrs||":else"in r.attrs)&&xo(r,n),n=!1,s++}},zn=new WeakMap,Ao=(e,t,n)=>{let s=zn.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],i=n+1,o=f=>{let u=Ns(e,i),h=e[u];if(typeof h=="object"&&f in h.attrs)return i=u+1,h};for(let f=o(":elseif");f;f=o(":elseif"))r.push({expr:f.attrs[":elseif"],node:f});let a=o(":else");a&&r.push({node:a});let l={branches:r,next:i};return zn.set(t,l),l},be=(e,t,n,s=!1,r)=>{let i=r??document.createDocumentFragment(),o=0;for(;o<e.length;){let a=e[o];if(typeof a=="string"){let l=document.createTextNode(a);if(a.includes("{{")){let f=St(a);n.effect(()=>{let u=ps(f,t);l.textContent!==u&&(l.textContent=u)})}i.appendChild(l),o++;continue}if(":each"in a.attrs){i.appendChild(Ro(a,t,n,s)),o++;continue}if(":if"in a.attrs){let l=Ao(e,a,o);i.appendChild(wo(l.branches,t,n,s)),o=l.next;continue}i.appendChild(zt(a,t,n,s)),o++}return i},xi=(e,t,n=!1)=>be(e.template,t,me(t),n),ve="data-jq79",Oo=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)},Ps=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[ve]=t,Ps(n.children,t))})},_o=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),i=r===-1?s:s.slice(0,r),o=r===-1?"":s.slice(r);return`${i}[${ve}="${t}"]${o}`}).join(", "),Cs=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=_o(n.selectorText,t):n instanceof CSSGroupingRule&&Cs(n.cssRules,t)})},jo=/(^|[\s>+~,(])([A-Z][A-Za-z0-9]*)(?![\w-])/g,Lo=/[a-z]/,Do=e=>e.replace(jo,(t,n,s)=>Lo.test(s)?`${n}${_e(s)}`:t),Io=/^\s*@(media|supports|container|layer|scope|document)\b/i,qo=/^\s*@/,Ho=e=>{let t="",n="",s="",r=[],i=()=>r.length===0||r[r.length-1],o=()=>{t+=i()&&!qo.test(s)?Do(n):n,n=""},a=f=>{o(),t+=f,s+=f},l=(f,u)=>{o(),t+=f,s="",u!==void 0?r.push(u):f==="}"&&r.pop()};for(let f=0;f<e.length;){let u=e[f];if(u==="/"&&e[f+1]==="*"){let h=e.indexOf("*/",f+2),w=h===-1?e.length:h+2;a(e.slice(f,w)),f=w}else if(u==='"'||u==="'"){let h=f+1;for(;h<e.length&&e[h]!==u;)h+=e[h]==="\\"?2:1;a(e.slice(f,Math.min(h+1,e.length))),f=h+1}else u==="{"?(l("{",Io.test(s)),f++):u==="}"||u===";"?(l(u),f++):(n+=u,s+=u,f++)}return o(),t},Wo=(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),Cs(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
18
18
  `)},Lt=e=>{let t=wn(e),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],i=[];Array.from(s.content.children).forEach(l=>{l.tagName==="TEMPLATE"?i.push(l):r.push(l)});let o=Gn(r,e),a={};return i.forEach(l=>{let f=l.getAttribute("name");if(f===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!Sn.test(f)){console.warn(`jq79: <template name="${f}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(f in a){console.warn(`jq79: two <template name="${f}"> in one file; the second was ignored`);return}a[f]=new pe({...Gn(Array.from(l.content.children),l.innerHTML),siblings:a,name:f})}),Object.keys(a).length&&(o.siblings=a),o},Fo=/^(?:text|application)\/(?:x-)?typescript$/i,Uo=e=>"lang"in e?`lang="${e.lang}"`:Fo.test(e.type?.trim()??"")?`type="${e.type}"`:null,Gn=(e,t)=>{let n=[],s=[],r=[];e.forEach(o=>{let a={attrs:ts(o),content:o.textContent??""};o.tagName==="SCRIPT"?n.push(a):o.tagName==="STYLE"?s.push(a):r.push(ss(o))}),n.forEach(o=>{let a=Uo(o.attrs);a&&console.warn(`jq79: <script ${a}> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its types were never stripped: the script will throw, or - for a plain \`let x: T = ...\` - silently fail to declare x.`)}),s.forEach(o=>{"lang"in o.attrs&&console.warn(`jq79: <style lang="${o.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.`)}),s.forEach(o=>{"lang"in o.attrs||(o.content=Ho(o.content))});let i=o=>"scoped"in o.attrs&&!("lang"in o.attrs);if(s.some(i)){let o=Oo(t);Ps(r,o),s.forEach(a=>{i(a)&&(a.scoped=Wo(a.content,o))})}return vs(r),{template:r,scripts:n,styles:s}},Gt=e=>/\.html?([?#]|$)/.test(e)?Ht(e):import(e),Ms=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,Bo=(e,t)=>{if(!Ms.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},Ko=(e,t)=>e?`
19
19
  //# sourceURL=${e}?jq79-script=${t}`:"",ks=(e,t,n)=>{try{return Ut(e,t,Ko(n.filename,n.index??0))}catch(s){throw s instanceof Ne?new Error(`jq79: safeEval() is on, and script ${n.index??0} of ${n.filename??"a component built from a string"} ${s.reason}. ${s.hint}`):s}},Vn=e=>e.scoped??e.content,je=`:where([${ys}]) { display: contents }`,Vt=()=>Ft&&typeof Document<"u"&&"adoptedStyleSheets"in Document.prototype,Ye=e=>{let t=new CSSStyleSheet;return t.replaceSync(e),t},Zt=(e,t)=>{e.adoptedStyleSheets.includes(t)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,t])},Dt=(e,t)=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(n=>n!==t)},Ge=null,It=null,zo=()=>{if(Vt()){Zt(document,It??(It=Ye(je)));return}Ge?.isConnected||(Ge=document.createElement("style"),Ge.textContent=je,document.head.appendChild(Ge))},Je=new Map,Go=e=>{let t=Je.get(e);if(!t){if(Vt()){let n=Ye(e);Zt(document,n),t={sheet:n,count:0}}else{let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0}}Je.set(e,t)}t.count++},Vo=e=>{let t=Je.get(e);t&&--t.count<=0&&(t.sheet?Dt(document,t.sheet):t.el?.remove(),Je.delete(e))},Zo=(e,t,n,s={},r=Gt,i={})=>{let o={..._s,...s},a=new Proxy(t,{has:(u,h)=>h!=="$__effect"&&h!=="$__import"&&h!=="$__state"&&(Reflect.has(u,h)||!(h in globalThis)&&!(h in o))}),l={},f=ks(Rn(Object.keys(o)),xn(e),i)(a,n,r,l,...Object.values(o));return f.catch(u=>console.error("jq79: error in :setup script",u)),cs(f),{settled:f,sync:l.done===!0}},Zn=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:_(s,e))})},qt=e=>{let t=Pn(e);return!t&&e.attrs[":setup"]!==void 0&&Qo(e,e.attrs[":setup"]),t},Qn=new WeakSet,Qo=(e,t)=>{t.trim()==="_"||Qn.has(e)||(Qn.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`))},Xo=e=>{let t=null;return e.forEach(n=>{let s=Ae(n.content)??qt(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:i})=>r.add(i))}),t},Xn=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},Yn=new WeakMap,Yo=(e,t,n,s)=>{if(s===null)return;let r=Yn.get(e)??new Set;Yn.set(e,r),n.forEach(i=>{s.has(i)||r.has(i)||(r.add(i),console.warn(`jq79: :${i} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},Jo=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,i])=>{t.has(r)||(n[r]=i,s=!0)}),s?n:null},As=Symbol("jq79.unfilledProps"),et=Symbol("jq79.pendingScripts"),ei=e=>e&&e.default!==void 0?e.default:e,ti=(e,t,n,s={},r=Gt,i={})=>{let o={..._s,...s},a={},l=ks(Nn(Object.keys(o)),vn(e),i)(a,ei,r,...Object.values(o)),f=I=>console.error("jq79: error in factory script",I),u=!1,h,w=()=>{if(u)return h;u=!0;let I=a.default;if(typeof I!="function")return;let G=j=>{j&&typeof j=="object"&&Object.assign(t,j)};try{let j=I(t,{$data:t,$props:t,$effect:n,...s});j instanceof Promise?h=j.then(G).catch(f):G(j)}catch(j){f(j)}return h},O=l.then(w,f);return cs(O),a.done&&w(),{settled:O,sync:a.done===!0&&h===void 0}},ni="__JQ79_HMR_ENABLED__",si="__JQ79_HMR__",Se=null,ri=e=>{if(!Se||!e.filename)return;let t=Se.get(e.filename);t||Se.set(e.filename,t=new Set),t.add(new WeakRef(e))},Mt=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},oi=(e,t)=>{if(!Se)return 0;let n=Mt(e),s=Lt(t);ne?.forEach((a,l)=>{Mt(l)===n&&ne.set(l,Promise.resolve(t))});let r=!1,i=a=>a.name===void 0?s:s.siblings?.[a.name]??null,o=0;for(let[a,l]of Se)if(Mt(a)===n){for(let f of l){let u=f.deref();if(!u){l.delete(f);continue}let h=i(u);if(!h){r=!0;continue}u.hotReplace(h)&&o++}l.size||Se.delete(a)}return r?0:o},ii=()=>{Se??(Se=new Map),globalThis[si]={update:oi}},Jn=3e3,ai=(e,t)=>{let n=setTimeout(()=>{console.warn(`jq79: ${e.name?`<${e.name}>`:"a component"}${e.filename?` (${e.filename})`:""} has been waiting ${Jn/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.`)},Jn);n?.unref?.(),Promise.all(t).then(()=>clearTimeout(n))},li=e=>{if(Ms.test(e))return e;let t=import.meta.resolve;if(typeof t!="function")return e;try{return t(e)}catch{return e}},ne=new Map,ci=e=>{try{return new URL(e,document.baseURI).href.replace(/#.*$/,"")}catch{return e}},es=e=>Promise.all([fetch(e).then(t=>{if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return t.text()}),Os?.then(()=>pi(e))]).then(([t])=>t),di=e=>{if(!ne)return es(e);let t=ci(e),n=ne.get(t);if(!n){n=es(e),ne.set(t,n);let s=n;s.catch(()=>{ne?.get(t)===s&&ne.delete(t)})}return n},Ht=async e=>{let t=li(e),n=await di(t);return new pe(n,{filename:t})},Os,ui="/jq79-sw.js",fi=async e=>{let t=typeof navigator>"u"?void 0:navigator.serviceWorker;if(!t)throw new Error("jq79: safeEval() compiles components in a service worker, and this page can't have one - service workers need https (or localhost). Precompile with the jq79/vite plugin instead, or use safeEval({ nonce: true }) on a page whose server issues a nonce.");let n;try{n=await t.register(e)}catch(s){throw new Error(`jq79: safeEval() couldn't register its service worker at ${e} (${s.message}). Serve jq79-sw.js from the jq79 package at your site's root, or pass its URL: safeEval({ worker: "/path/jq79-sw.js" }).`)}await t.ready,!t.controller&&await new Promise(s=>{t.addEventListener("controllerchange",()=>s(),{once:!0}),t.controller?s():n.active?.postMessage("jq79:claim")})},pi=e=>{let t=new URL(e,document.baseURI);return t.hash="",t.searchParams.set(kn,""),new Promise((n,s)=>{let r=document.createElement("script"),i=rs();i&&r.setAttribute("nonce",i),r.src=t.href,r.onload=()=>{r.remove(),n()},r.onerror=()=>{r.remove(),s(new Error(`jq79: the precompiled functions of ${e} did not load, and safeEval() can't render it without them`))},document.head.append(r)})},ce=class ce{constructor(t,n={}){k(this,"template");k(this,"scripts");k(this,"styles");k(this,"modules");k(this,"filename");k(this,"siblings");k(this,"name");k(this,"slots");k(this,"modelWriteback");k(this,"data",null);k(this,"fx",null);k(this,"content",null);k(this,"startMarker",null);k(this,"endMarker",null);k(this,"styleEls",[]);k(this,"shadowCss",null);k(this,"shadowSheets",[]);k(this,"sheetRoot",null);k(this,"ownsSharedStyles",!1);k(this,"useShadow",!1);k(this,"mountRoot",null);k(this,"resolveMounted",null);k(this,"renderDone",!1);k(this,"held",0);k(this,"onPaint",null);k(this,"destroyHooks",null);k(this,"attachHooks",null);k(this,"detachHooks",null);k(this,"onPage",!1);k(this,"emitListeners",new Map);let s=typeof t=="string"?Lt(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(),ri(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"?Lt(t):t;Bt.clear(),we.clear(),jt.clear();let s=this.startMarker,r=!!(s&&this.content),i=r&&s.isConnected,o=i?s.parentNode:null,a=i?this.endMarker.nextSibling:null,l={...this.data},f=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(l,f),!o)?!1:(f&&this.placeShadowStyles(o,a),o.insertBefore(this.content,a),this.mountRoot=o,this.settleMounted(),!0)}static debug(t){if(t){let n=le.scopedNames;for(let s in t){let r=t[s];Object.prototype.hasOwnProperty.call(le,s)?typeof r=="boolean"?le[s]=r:console.warn(`jq79: Component79.debug ignored "${s}" - the flags are booleans, and the ones it knows are: ${Object.keys(le).join(", ")}`):console.warn(`jq79: Component79.debug does not know "${s}" - the flags it has are: ${Object.keys(le).join(", ")}`)}le.scopedNames!==n&&Ze.clear()}return{...le}}static safeEval(t={}){Ft=!0;let n=[];if(t.nonce){let r=rs();r===void 0?n.push(Promise.reject(new Error("jq79: safeEval({ nonce: true }) found no nonce on this page - no <script> carries one. The nonce belongs on the script that loads the page, the one the CSP names."))):Ot=r}let s=t.worker??(t.nonce?!1:ui);return s!==!1&&n.push(Os??(Os=fi(s))),Promise.all(n).then(()=>{})}static cache(t){return t===!1?ne=null:t===!0&&(ne??(ne=new Map)),!!ne}static clearCache(){ne?.clear()}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new Wt(Ht(t))}static fetchAll(t){return Promise.all(t.map(Ht))}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=Cn(this.scripts,qt),r=Jo(this.siblings,s),i=r?Object.assign(Object.create(r),t):{...t},o=new Set([...s].filter(E=>!(E in t)));o.size&&Object.defineProperty(i,As,{value:o}),this.slots&&Object.defineProperty(i,ms,{value:this.slots}),Object.defineProperty(i,et,{value:{count:0,owner:this}});let a=Me(i),l=me(a);this.data=a,this.fx=l,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let f=this.startMarker,u=!1,h=(E,C)=>{E==="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 M=new CustomEvent(E,{detail:C,bubbles:!0,composed:!0,cancelable:!0});return f===this.startMarker&&this.emitListeners.get(E)?.forEach(U=>U(M,C)),M.cancelBubble||f.dispatchEvent(M),!M.defaultPrevented},w,O=new Promise(E=>{w=E});this.resolveMounted=w,this.renderDone=!1,this.held=0;let I=E=>{if(typeof E!="function")throw new TypeError("jq79: $destroyed expects a function");return f!==this.startMarker?(xe(E,"$destroyed"),()=>{}):kt(this.destroyHooks??(this.destroyHooks=[]),E)},G=(E,{immediate:C=!0}={})=>{if(typeof E!="function")throw new TypeError("jq79: $attached expects a function");if(f!==this.startMarker)return()=>{};this.watchPage();let M=kt(this.attachHooks??(this.attachHooks=[]),E);return C&&this.onPage&&xe(E,"$attached"),M},j=E=>{if(typeof E!="function")throw new TypeError("jq79: $detached expects a function");return f!==this.startMarker?(xe(E,"$detached"),()=>{}):(this.watchPage(),kt(this.detachHooks??(this.detachHooks=[]),E))},b=E=>{let C=ft(E);return I(()=>C.$dispose()),C},H=this.endMarker,D=(E=>{let C=[];for(let M=f.nextSibling;M&&M!==H;M=M.nextSibling)M instanceof Element&&(M.matches(E)&&C.push(M),C.push(...Array.from(M.querySelectorAll(E))));return C}),L=(E=>D(E)[0]??null),B=this.modules,ae=E=>B&&E in B?Promise.resolve(B[E]):Gt(Bo(E,this.filename)),P=Object.assign(Object.create(null),{$emit:h,$updateModel:(...E)=>{let[C,M]=E.length>1?E:[void 0,E[0]];return f!==this.startMarker?!1:this.modelWriteback?.(C,M)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(E=>[E,!0]))}),x=[],W=!0;this.scripts.forEach((E,C)=>{let M;x.push(new Promise(p=>{M=p}));let U=!1,Q=()=>{U=!0,M()},q={$mounted:()=>(Q(),O),$destroyed:I,$attached:G,$detached:j,$computed:b,$self:L,$$self:D,...P,...r},K={filename:this.filename,index:C},c=":mounted"in E.attrs,d=gn(E.content),g=(()=>{if(d!==null){c&&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."),Zn(a,Ae(E.content));let y=c?xt(d):d;return ti(y,a,R=>l.effect(R),q,ae,K)}let{vars:p,code:S}=Ue(E.content);Zn(a,qt(E)),p.forEach(y=>{y in a||(a[y]=void 0)});let m=c?xt(S):S;return Zo(m,a,y=>l.effect(y),q,ae,K)})();if(g.sync)g.settled.then(Q,Q);else{let p=i[et];p.count++;let S=()=>{p.count--,Q()};g.settled.then(S,S)}!g.sync&&!U&&(W=!1)});let J=document.createDocumentFragment(),V=new Proxy(a,{has:(E,C)=>typeof C=="string"&&C in P||Reflect.has(E,C),get:(E,C,M)=>typeof C=="string"&&C in P&&!Reflect.has(E,C)?P[C]:Reflect.get(E,C,M)});if(J.append(this.startMarker,this.endMarker),this.content=J,W?(this.endMarker.parentNode.insertBefore(be(this.template,V,l,n),this.endMarker),this.renderDone=!0,this.settleMounted()):(Promise.all(x).then(()=>{f===this.startMarker&&(this.endMarker.parentNode.insertBefore(be(this.template,V,l,n),this.endMarker),this.renderDone=!0,this.settleMounted(),ce.settleAttached())}),ai(this,x)),n)if(Vt())this.shadowCss=[...this.styles.map(E=>E.content),je];else{let E=document.createElement("style");E.textContent=je,this.styleEls=[...this.styles.map(C=>{let M=document.createElement("style");return M.textContent=C.content,M}),E]}else this.styles.forEach(E=>Go(Vn(E))),this.ownsSharedStyles=!0;return this}mount(t,n){let s=typeof t=="string"?Pe(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"?Pe(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.placeShadowStyles(n,null),n.appendChild(this.content),this.mountRoot=n,this.settleMounted(),ce.settleAttached(),this}isOnPage(){return this.renderDone&&this.startMarker?.isConnected===!0}watchPage(){ue.has(this)||(ue.add(this),this.onPage=this.isOnPage(),this.onPage||ce.queueSettle())}static queueSettle(){At||(At=!0,queueMicrotask(()=>{At=!1,ce.settleAttached()}))}static settleAttached(){if(ue.size===0)return;let t=[...ue].filter(n=>!n.onPage&&n.isOnPage());ce.inDocumentOrder(t).forEach(n=>{n.onPage||!ue.has(n)||(n.onPage=!0,n.attachHooks?.slice().forEach(s=>xe(s,"$attached")))})}notifyDetached(){if(ue.size===0)return;let t=[];if(this.startMarker?.isConnected){let n=new Set;for(let r=this.startMarker;r&&(n.add(r),r!==this.endMarker);r=r.nextSibling);let s=r=>{for(;r;r=r.parentNode)if(n.has(r))return!0;return!1};t=ce.inDocumentOrder([...ue].filter(r=>r.onPage&&s(r.startMarker)))}else this.onPage&&(t=[this]);t.forEach(n=>{n.onPage&&(n.onPage=!1,n.detachHooks?.slice().forEach(s=>xe(s,"$detached")))})}static inDocumentOrder(t){return t.sort((n,s)=>n.startMarker.compareDocumentPosition(s.startMarker)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)}placeShadowStyles(t,n){if(this.shadowCss&&typeof ShadowRoot<"u"&&t instanceof ShadowRoot){this.sheetRoot&&this.sheetRoot!==t&&this.shadowSheets.forEach(s=>Dt(this.sheetRoot,s)),this.shadowSheets.length===0&&(this.shadowSheets=this.shadowCss.map(s=>s===je?It??(It=Ye(s)):Ye(s))),this.shadowSheets.forEach(s=>Zt(t,s)),this.sheetRoot=t;return}this.shadowCss&&this.styleEls.length===0&&(this.styleEls=this.shadowCss.map(s=>{let r=document.createElement("style");return r.textContent=s,r})),this.styleEls.forEach(s=>t.insertBefore(s,n))}settleMounted(){if(!this.renderDone||this.held>0)return;let t=this.onPaint;this.onPaint=null,t?.(),this.mountRoot&&this.resolveMounted?.()}holdOwner(t){this.renderDone&&this.held===0||(t.held++,this.onPaint=()=>{t.held--,t.settleMounted()})}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;this.notifyDetached();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(){this.notifyDetached(),ue.delete(this),this.attachHooks=null,this.detachHooks=null,this.onPage=!1;let t=this.destroyHooks;this.destroyHooks=null,t?.forEach(s=>xe(s,"$destroyed")),this.resolveMounted=null;let n=this.onPaint;return this.onPaint=null,n?.(),this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(s=>s.parentNode?.removeChild(s)),this.styleEls=[],this.sheetRoot&&this.shadowSheets.forEach(s=>{s!==It&&Dt(this.sheetRoot,s)}),this.shadowCss=null,this.shadowSheets=[],this.sheetRoot=null,this.ownsSharedStyles&&(this.styles.forEach(s=>Vo(Vn(s))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.renderDone=!1,this.data=null,this.resolveMounted=null,this}};k(ce,"version",kr);var pe=ce,Wt=class{constructor(t){k(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 Ni=e=>new pe(e),xe=(e,t)=>{try{e()}catch(n){console.error(`jq79: error in a ${t} hook`,n)}},kt=(e,t)=>(e.push(t),()=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)}),ue=new Set,At=!1,_s={$:Pe,$$:st,$create:rt,$reactive:Me,$toRaw:Z,Component79:pe};typeof globalThis<"u"&&globalThis[ni]&&ii();export{Pe as $,st as $$,ft as $computed,rt as $create,Me as $reactive,Z as $toRaw,pe as C79,pe as Component79,Wt as PendingComponent79,ii as enableHotReload,oi as hotUpdate,Ni as parseComponent,xi as renderComponent};
20
20
  //# sourceMappingURL=jq79.js.map
package/dist/vite.cjs CHANGED
@@ -71,20 +71,60 @@ export const safeEval = (Component79, url) => {
71
71
  }
72
72
  `;
73
73
  var PRECOMPILED_PATH = "/@jq79/precompiled.js";
74
+ var PRECOMPILED_ASSET = "jq79-precompiled.js";
75
+ var PRECOMPILED_URL_PLACEHOLDER = "__JQ79_PRECOMPILED_URL__";
76
+ var PRECOMPILED_URL_PLACEHOLDER_RE = /(["'`])__JQ79_PRECOMPILED_URL__\1/g;
74
77
  var safeEvalOptions = (option) => {
75
78
  if (option === void 0 || option === false) return null;
76
79
  return typeof option === "object" && option !== null && option.nonce === true ? { nonce: true } : {};
77
80
  };
78
81
  var SCOPED_BODY_RE = /^(?:let \$t;| return \()/;
79
- var componentScript = (source, warn) => (0, import_precompile.precompiledScript)((0, import_precompile.precompile)(source), (params, body) => {
82
+ var componentFunctions = (source, warn) => (0, import_precompile.precompile)(source).map(([params, body]) => {
80
83
  try {
81
84
  new Function(...params, body);
82
- return true;
85
+ return [params, body, true];
83
86
  } catch (error) {
84
87
  if (!SCOPED_BODY_RE.test(body)) warn(`${error.message}, in: ${body.length > 120 ? `${body.slice(0, 120)}\u2026` : body}`);
85
- return false;
88
+ return [params, body, false];
86
89
  }
87
90
  });
91
+ var registeringScript = (functions) => {
92
+ const unique = /* @__PURE__ */ new Map();
93
+ for (const fn of functions) {
94
+ const key = JSON.stringify([fn[0], fn[1]]);
95
+ if (!unique.has(key)) unique.set(key, fn);
96
+ }
97
+ return (0, import_precompile.precompiledScript)(
98
+ [...unique.values()].map(([params, body]) => [params, body]),
99
+ (params, body) => unique.get(JSON.stringify([params, body]))?.[2] ?? false
100
+ );
101
+ };
102
+ var reachesComponent = (entry, bundle) => {
103
+ const seen = /* @__PURE__ */ new Set();
104
+ const visit = (chunk) => {
105
+ if (!chunk || chunk.type !== "chunk" || seen.has(chunk.fileName)) return false;
106
+ seen.add(chunk.fileName);
107
+ return (chunk.moduleIds ?? []).some((id) => id.endsWith(COMPONENT_QUERY)) || (chunk.imports ?? []).some((file) => visit(bundle[file]));
108
+ };
109
+ return visit(entry);
110
+ };
111
+ var SCRIPT_SRC_RE = /<script\b(?:"[^"]*"|'[^']*'|[^>"'])*?\ssrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi;
112
+ var precompiledHref = (html, bundle, file) => {
113
+ const chunks = Object.values(bundle).filter((out) => out.type === "chunk").map((out) => out.fileName);
114
+ for (const match of html.matchAll(SCRIPT_SRC_RE)) {
115
+ const src = (match[1] ?? match[2] ?? match[3]).replace(/[?#].*$/, "");
116
+ const chunk = chunks.find((name) => src === name || src.endsWith(`/${name}`));
117
+ if (chunk === void 0) continue;
118
+ const path = import_node_path.posix.relative(import_node_path.posix.dirname(chunk), file);
119
+ if (/^(?:[a-z][a-z\d+.-]*:)?\/\//i.test(src)) {
120
+ const scheme = src.startsWith("//") ? "https:" : "";
121
+ return new URL(path, scheme + src).href.slice(scheme.length);
122
+ }
123
+ const href = import_node_path.posix.join(import_node_path.posix.dirname(src), path);
124
+ return src.startsWith("/") || href.startsWith(".") ? href : `./${href}`;
125
+ }
126
+ return null;
127
+ };
88
128
  var SCRIPT_BLOCK_RE = /<script((?:"[^"]*"|'[^']*'|[^>"'])*)>([\s\S]*?)<\/script\s*>/gi;
89
129
  var IMPORT_CALL_RE = /import\s*\(\s*(["'])([^"'\n]+?)\1\s*\)/y;
90
130
  var STATIC_IMPORT_RE = /import\s*(?:[\w$\s,{}*]+?\s*from\s*)?(["'])([^"'\n]+)\1/y;
@@ -319,6 +359,9 @@ function jq79(options = {}) {
319
359
  const safeEval = safeEvalOptions(options.safeEval);
320
360
  const devScripts = /* @__PURE__ */ new Map();
321
361
  const devIds = /* @__PURE__ */ new Map();
362
+ const buildFunctions = /* @__PURE__ */ new Map();
363
+ let precompiledRef;
364
+ let precompiledFile;
322
365
  let config = null;
323
366
  return {
324
367
  name: "jq79",
@@ -357,18 +400,63 @@ function jq79(options = {}) {
357
400
  if (config) source = await compileStyleBlocks(source, file, config, (dep) => this.addWatchFile(dep));
358
401
  const filename = config ? (0, import_node_path.relative)(config.root, file) : file;
359
402
  if (!safeEval) return { code: componentModule(source, include, filename), map: null };
360
- const script = componentScript(source, (message) => this.warn(`jq79: ${filename}: ${message}`));
403
+ const functions = componentFunctions(source, (message) => this.warn(`jq79: ${filename}: ${message}`));
361
404
  let url;
362
405
  if (config?.command === "serve") {
363
406
  let devId = devIds.get(file);
364
407
  if (devId === void 0) devIds.set(file, devId = devIds.size);
365
- devScripts.set(String(devId), script);
408
+ devScripts.set(String(devId), registeringScript(functions));
366
409
  url = JSON.stringify(`${config.base}${PRECOMPILED_PATH.slice(1)}?id=${devId}&v=${Date.now()}`);
367
410
  } else {
368
- const ref = this.emitFile({ type: "asset", name: `${(0, import_node_path.basename)(file)}.jq79.js`, source: script });
369
- url = `import.meta.ROLLUP_FILE_URL_${ref}`;
411
+ buildFunctions.set(file, functions);
412
+ url = JSON.stringify(PRECOMPILED_URL_PLACEHOLDER);
370
413
  }
371
414
  return { code: componentModule(source, include, filename, url), map: null };
415
+ },
416
+ buildStart() {
417
+ precompiledRef = void 0;
418
+ precompiledFile = void 0;
419
+ },
420
+ // the build's one precompiled script, from every component still in the
421
+ // module graph. What earlier builds recorded is kept and pruned rather than
422
+ // cleared in buildStart, so a watch rebuild that doesn't load a module again
423
+ // keeps its functions. Sorted by file, so the same sources make the same
424
+ // bytes, and the same hash
425
+ buildEnd(error) {
426
+ if (!safeEval || error || config?.command === "serve") return;
427
+ const inGraph = /* @__PURE__ */ new Set();
428
+ for (const id of this.getModuleIds()) if (id.endsWith(COMPONENT_QUERY)) inGraph.add(id.slice(0, -COMPONENT_QUERY.length));
429
+ for (const file of buildFunctions.keys()) if (!inGraph.has(file)) buildFunctions.delete(file);
430
+ if (buildFunctions.size === 0) return;
431
+ const functions = [...buildFunctions.keys()].sort().flatMap((file) => buildFunctions.get(file));
432
+ precompiledRef = this.emitFile({ type: "asset", name: PRECOMPILED_ASSET, source: registeringScript(functions) });
433
+ },
434
+ // the placeholder, as what import.meta.ROLLUP_FILE_URL_<ref> renders to:
435
+ // the asset's path relative to the chunk, against the chunk's own URL - so
436
+ // `base` doesn't matter. Before minification, and part of the chunk's hash.
437
+ // The source map is left as it is: the placeholder sits on a line of its
438
+ // own with only `)` after it
439
+ renderChunk(code, chunk) {
440
+ if (precompiledRef === void 0 || !code.includes(PRECOMPILED_URL_PLACEHOLDER)) return null;
441
+ precompiledFile = this.getFileName(precompiledRef);
442
+ const path = JSON.stringify(import_node_path.posix.relative(import_node_path.posix.dirname(chunk.fileName), precompiledFile));
443
+ return { code: code.replace(PRECOMPILED_URL_PLACEHOLDER_RE, () => `new URL(${path}, import.meta.url).href`), map: null };
444
+ },
445
+ // a page that waits for the script asks for it as it parses, rather than
446
+ // once its entry has loaded and run. Same URL as the module's
447
+ // (precompiledHref), and no crossorigin, as the <script> has none: a
448
+ // preload is only reused by a request that matches it. Vite's html.cspNonce
449
+ // stamps it with the nonce, after this hook - without it,
450
+ // `script-src 'nonce-…'` refuses a preload. Build only: dev has one script
451
+ // per component, versioned per edit. Vite writes the page's <script> tags
452
+ // before it runs this hook, in every version the plugin supports
453
+ transformIndexHtml(html, ctx) {
454
+ if (!safeEval || !precompiledFile || !ctx.bundle || !ctx.chunk) return;
455
+ const bundle = ctx.bundle;
456
+ if (!reachesComponent(ctx.chunk, bundle)) return;
457
+ const href = precompiledHref(html, bundle, precompiledFile);
458
+ if (href === null) return;
459
+ return [{ tag: "link", attrs: { rel: "preload", as: "script", href }, injectTo: "head" }];
372
460
  }
373
461
  };
374
462
  }