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