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