sprae 13.2.2 → 13.3.1
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/core.js +12 -2
- package/directive/class.js +21 -6
- package/directive/each.js +163 -74
- package/dist/sprae-csp.js +10 -10
- package/dist/sprae-csp.js.map +3 -3
- package/dist/sprae-csp.umd.js +10 -10
- package/dist/sprae-csp.umd.js.map +3 -3
- package/dist/sprae-preact.js +4 -4
- package/dist/sprae-preact.js.map +3 -3
- package/dist/sprae-preact.umd.js +4 -4
- package/dist/sprae-preact.umd.js.map +3 -3
- package/dist/sprae.js +4 -4
- package/dist/sprae.js.map +3 -3
- package/dist/sprae.umd.js +4 -4
- package/dist/sprae.umd.js.map +3 -3
- package/package.json +6 -1
- package/readme.md +35 -55
- package/sprae.js +12 -10
- package/store.js +7 -2
- package/types/core.d.ts.map +1 -1
- package/types/directive/class.d.ts.map +1 -1
- package/types/directive/each.d.ts +5 -3
- package/types/directive/each.d.ts.map +1 -1
- package/types/sprae.d.ts.map +1 -1
- package/types/store.d.ts.map +1 -1
package/dist/sprae-preact.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
in ${
|
|
3
|
-
${
|
|
4
|
-
="${i}"`}console.error(o)},ut=(t=document.body,e)=>{if(t[p])return Object.assign(t[p],e);e=Q(e||{});let r=t,o=[],i=[];r[rt]=()=>!i&&(i=o.map(s=>s())),r[C]=()=>(i?.map(s=>s?.()),i=null),r[h]||(r[h]=()=>{r[C]?.(),L?._root===r&&(L.disconnect(),L=null),r[C]=r[rt]=r[h]=r[at]=r[p]=null});let n=r[at]=s=>{let c=s.attributes,f;if(c)for(let a=0;a<c.length;){let{name:l,value:w}=c[a];if(l.startsWith(ft)){s.removeAttribute(l);let N=s[p];if(ot=l,lt=s,o.push(f=Tt(s,l.slice(ft.length),w,e)),i.push(f()),s[p]!==N)return}else a++}if(!(s!==t&&D(s)))if(s.firstChild!==void 0){let a=s.firstChild,l;for(;a;)l=a.nextSibling,a.nodeType==1&&n(a),a=l}else for(let a of s.childNodes)a.nodeType==1&&n(a)};return n(r),ot=lt=null,r[p]===void 0&&!D(t)&&(r[p]=e),e};ut.version="13.2.2";var Tt,jt,y=t=>{let e=Et[t=t.trim()];if(e)return e;try{e=jt(t||"undefined")}catch(r){ct(r,t)}return Et[t]=function(r,o,i){try{let n=e?.call(this,r);return o?n?.then?(n.then(s=>i=o(s)).catch(s=>ct(s,t,this)),()=>typeof i=="function"&&i()):o(n):n}catch(n){ct(n,t,this)}}},Et={},G=t=>(t.compile&&(jt=t.compile),t.prefix&&(ft=t.prefix),t.signal&&(A=t.signal),t.effect&&(B=t.effect),t.computed&&(z=t.computed),t.batch&&(X=t.batch),t.untracked&&(k=t.untracked),t.dir&&(Tt=t.dir)),x=(t,e)=>{for(;e.length;){let[r,...o]=e.pop().split("-"),i=q[r],n;if(i&&(n=i(t,...o))!==t){for(let s in t)n[s]??(n[s]=t[s]);t=n}}return t},L=null,U=t=>{L?.disconnect(),t(),L?.observe(L._root,{childList:!0,subtree:!0})},Lt=(t=document.body,e)=>{let r=Q(e);return ut(t,r),L=new MutationObserver(o=>{for(let i of o){for(let n of i.addedNodes)n.nodeType===1&&n[p]===void 0&&t.contains(n)&&t[at](n);for(let n of i.removedNodes)n.nodeType===1&&!t.contains(n)&&n[h]?.()}}),L._root=t,L.observe(t,{childList:!0,subtree:!0}),r},_=t=>{if(!t.nodeType)return t;let e=t.ownerDocument,r=t.content.cloneNode(!0),o=[...t.attributes],i=e.createTextNode(""),n=(r.append(i),[...r.childNodes]);return{ownerDocument:e,childNodes:n,content:r,remove:()=>r.append(...n),replaceWith(s){s!==i&&(i.before(s),r.append(...n))},attributes:o,removeAttribute(s){o.splice(o.findIndex(c=>c.name===s),1)}}},Dt=t=>t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(e,r)=>(r?"-":"")+e.toLowerCase()),ge=t=>t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase()),E=(t,e,r)=>r==null||r===!1?t.removeAttribute(e):D(t)?t[ge(e)]=r:t.setAttribute(e,r===!0?"":r),dt=t=>t?typeof t=="string"?t:(Array.isArray(t)?t.map(dt):Object.entries(t).reduce((e,[r,o])=>(o&&e.push(r),e),[])).join(" "):"",V=(t,e)=>{let r=0,o=0,i,n=typeof e=="function"?e:e?c=>setTimeout(c,e):queueMicrotask,s=c=>{i=c,r++||(t(i),n(()=>{let f=r>1;if(r=0,f){if(++o>50){o=0,console.error("\u2234 Reactive loop detected");return}s(i)}else o=0}))};return s},kt=(t,e,r)=>{let o=typeof e=="function"?e:e?i=>setTimeout(i,e):queueMicrotask;return r?(i=>n=>!i&&(t(n),i=1,o(()=>i=0)))():((i=0)=>(n,s=++i)=>o(()=>s==i&&t(n)))()},m=ut;var S=Symbol("signals"),$=Symbol("change"),Y=Symbol("set"),pt=!0,T=(t,e)=>{if(!t||t[Symbol.toStringTag]||t[S])return t;if(t.constructor!==Object)return Array.isArray(t)?be(t):t;let r=Object.keys(t).length,o={},i=new Proxy(Object.assign(o,{[$]:A(r),[S]:o}),{get:(s,c)=>c in o?o.hasOwnProperty(c)&&typeof o[c]=="function"&&!o[c].prototype?o[c].bind(i):o[c]?o[c].valueOf():o[c]:e?e[c]:typeof globalThis[c]=="function"&&!globalThis[c].prototype?globalThis[c].bind(globalThis):globalThis[c],set:(s,c,f)=>c in o?($t(o,c,f),1):(pt=!1,e&&c in e?e[c]=f:(it(o,c,f),o[$].value=++r),pt=!0,1),deleteProperty:(s,c)=>(c in o&&(c[0]!="_"&&o[c]?.[Symbol.dispose]?.(),delete o[c],o[$].value=--r),1),ownKeys:()=>(o[$].value,Reflect.ownKeys(o)),has:(s,c)=>c in o?!0:e?c in e:pt}),n=Object.getOwnPropertyDescriptors(t);for(let s in t)n[s]?.get?(o[s]=z(n[s].get.bind(i)))[Y]=n[s].set?.bind(i):it(o,s,t[s]);return i},be=(t,e=globalThis)=>{let r=Array(t.length).fill(null),o=!1,i=c=>function(){return o=!0,c.apply(this,arguments)},n=A(t.length),s=new Proxy(Object.assign(r,{[$]:n,[S]:r,push:i(r.push),pop:i(r.pop),shift:i(r.shift),unshift:i(r.unshift),splice:i(r.splice)}),{get(c,f){return f==="length"?o?(o=!1,r.length):n.value:typeof f=="symbol"||isNaN(f)?r[f]?.valueOf()??e[f]:(r[f]??(r[f]=A(T(t[f])))).valueOf()},set(c,f,a){if(f==="length"){for(let l=a;l<r.length;l++)delete s[l];n.value=r.length=a}else f>=r.length?(it(r,f,a),s.length=+f+1):r[f]?$t(r,f,a):it(r,f,a);return 1},deleteProperty:(c,f)=>(r[f]?.[Symbol.dispose]?.(),delete r[f],1)});return s},it=(t,e,r)=>t[e]=e[0]=="_"||r?.peek||typeof r=="function"?r:A(T(r)),$t=(t,e,r,o,i)=>e[0]==="_"||typeof t[e]=="function"?t[e]=r:r!==(i=(o=t[e]).peek?.()??o)&&(o[Y]?o[Y](r):Array.isArray(r)&&Array.isArray(i)?$ in i?k(()=>X(()=>{for(let n=0;n<r.length;n++)i[n]=r[n];i.length=r.length})):o.value=r:o.value=T(r)),Q=T;var mt={};At(mt,{batch:()=>xe,computed:()=>ve,effect:()=>Wt,signal:()=>Rt,untracked:()=>_e});var R,ht=0,Z,Rt=(t,e,r=new Set,o=()=>e.value)=>e={get value(){return R?.deps.add(r.add(R)),t},set value(i){if(i!==t){t=i;for(let n of r)Z?Z.add(n):n()}},peek(){return t},toJSON:o,toString:o,valueOf:o},Wt=(t,e,r,o)=>(r=i=>{if(!t)return;let n=e;if(e=null,n?.call?.(),i=R,R=r,ht++>50){ht--,R=i,e=t=r.fn=null;for(let s of o)s.delete(r);o.clear(),console.error("\u2234 Reactive loop detected");return}try{e=t()}finally{R=i,ht--}},r.fn=t,o=r.deps=new Set,r(),i=>{e?.call?.(),e=t=r.fn=null;for(i of o)i.delete(r);o.clear()}),ve=(t,e=Rt(),r,o,i=()=>r.value)=>r={get value(){return o||(o=Wt(()=>e.value=t())),e.value},peek:e.peek,toJSON:i,toString:i,valueOf:i},xe=(t,e=!Z,r)=>{Z??(Z=new Set);try{t()}finally{if(e){[Z,r]=[null,Z];for(let o of r)o()}}},_e=(t,e,r)=>(e=R,R=null,r=t(),R=e,r);var Mt=(t,e)=>{var n,s;let r,o;t._holder?m(o=t,e):(t[n=p]??(t[n]=null),o=t.content?_(t):t,o[s=p]??(o[s]=null),U(()=>t.replaceWith(r=t.ownerDocument.createTextNode(""))),o._holder=r._holder=r,r._clauses=[o._clause=[o,!1]],r._match=null,r.update=V(()=>{let c=r._clauses.find(([,f])=>f);c!=r._match&&U(()=>{r._match?.[0].remove(),r._match?.[0][C]?.(),(r._match=c)&&(r.before(r._match[0].content||r._match[0]),r._match[0][p]?r._match[0][rt]?.():(delete r._match[0][p],m(r._match[0],e)))})}));let i=c=>{o._clause[1]=c,o._holder.update()};return i[C]=()=>{o._holder._match?.[0][C]?.(),o._holder._match=null},i};var Pt=t=>{var o;let e,r=t;for(e=t.content?_(t):t,e[o=p]??(e[o]=null);r&&!(e._holder=r._holder);)r=r.previousSibling;return t.remove(),t[p]=null,e._holder._clauses.push(e._clause=[e,!0]),e._holder.update};var qt=t=>(t.content&&t.replaceWith(t=_(t).childNodes[0]),e=>{e=typeof e=="function"?e(t.textContent):e,e=e==null?"":""+e;let r=t.textContent;if(r===e)return;let o=t.firstChild;if(o&&e.startsWith(r)){o.appendData(e.slice(r.length));return}let i=t.getRootNode().getSelection?.(),n=i?.rangeCount&&t.contains(i.anchorNode)?i.getRangeAt(0).startOffset:-1;if(t.textContent=e,n>=0&&t.firstChild){let s=Math.min(n,t.firstChild.textContent.length),c=new Range;c.setStart(t.firstChild,s),c.collapse(!0),i.removeAllRanges(),i.addRange(c)}});var It=(t,e,r,o)=>{let i=new Set,n;return s=>{if(n=new Set,s)for(let c of dt(typeof s=="function"?s(t.className):s).split(" "))c&&n.add(c);for(let c of i)n.has(c)||t.classList.remove(c);for(let c of n)i.has(c)||t.classList.add(c);t.classList.length||t.removeAttribute("class"),i=n}};var Ht=(t,e,r,o)=>{let i;return n=>{if(i===void 0&&(i=t.getAttribute("style")??""),n=typeof n=="function"?n(t.style):n,typeof n=="string")E(t,"style",i?i+"; "+n:n);else{i&&E(t,"style",i);for(let s in n)s[0]=="-"?t.style.setProperty(s,n[s]):s[0]>="A"&&(t.style[s]=n[s])}}};var zt=()=>t=>typeof t=="function"&&t();var Kt=(t,e)=>(t.type?.startsWith("select")&&m(t,e),t.type==="text"||t.type===""||t.tagName==="TEXTAREA"?(r,o,i)=>(o=t.selectionStart,i=t.selectionEnd,t.setAttribute("value",t.value=r??""),o&&t.setSelectionRange(o,i)):t.type==="checkbox"?r=>(t.checked=r,E(t,"checked",r)):t.type==="radio"?r=>(t.checked=t.value===r,E(t,"checked",t.checked||null)):t.type==="select-one"?r=>{for(let o of t.options)o.value==r?o.setAttribute("selected",""):o.removeAttribute("selected");t.value=r}:t.type==="select-multiple"?r=>{for(let o of t.options)r.some(i=>i==o.value)?o.setAttribute("selected",""):o.removeAttribute("selected")}:r=>t.value=r);var we=(t,e=y(`${t}=__`))=>(r,o)=>{r.__=o,e(r),delete r.__},Ut=(t,e,r)=>{let o=y(r).call(t,e);typeof o=="function"?o(t):we(r)(e,t)};var Vt=(t,e)=>{let r=t[p]=T({},e),o=!1,i,n=t.content&&_(t);return n&&t.replaceWith(i=t.ownerDocument.createTextNode("")),s=>{if(s=typeof s=="function"?s(r):s,s!==r)for(let c in s){let f=Object.getOwnPropertyDescriptor(s,c);if(f?.get){(r[S][c]=z(f.get.bind(r)))[Y]=f.set?.bind(r);continue}let a=typeof s[c]=="function"?s[c].bind(r):s[c];c in r[S]?r[c]=a:r[S][c]=c[0]=="_"||a?.peek?a:A(T(a))}return!o&&(o=!0,!i&&delete t[p],k(()=>(i?.before(n.content||t),m(n||t,r))))}};var Zt=(t,e,r)=>{let[o,i]=r.split(/\bin|of\b/),[n,s="$"]=o.trim().replace(/\(|\)/g,"").split(/\s*,\s*/),c=t.ownerDocument,f=t._eachHolder||(t._eachHolder=c.createTextNode("")),a,l,w,N=0,j=V(()=>U(()=>{var W,Nt;let d=0,v=w,g=v.length;if(a&&!a[$]){for(let Ot of a[S]||[])Ot[Symbol.dispose]();a=null,N=0}if(g<N)a.length=g;else{if(!a)a=v;else for(;d<N;)a[d]=v[d++];let F=g-d>1?c.createDocumentFragment():null,Ct=F?[]:null;for(;d<g;d++){a[d]=v[d];let H=d,O=t.content?_(t):t.cloneNode(!0),et=O.content||O;if(F)F.appendChild(et),Ct.push([O,H]);else{f.before(et);let he=T({get[n](){return a?.[H]},[s]:l?l[H]:H},e);m(O,he)}let pe=((Nt=a[W=S]||(a[W]=[]))[d]||(Nt[d]={}))[Symbol.dispose];a[S][d][Symbol.dispose]=()=>{pe?.(),O[Symbol.dispose]?.(),O.remove()}}if(F){f.before(F);for(let[H,O]of Ct){let et=T({get[n](){return a?.[O]},[s]:l?l[O]:O},e);m(H,et)}}}N=g}));t.parentNode&&U(()=>t.replaceWith(f)),t[p]=null;let J=()=>{if(a){for(let d of a[S]||[])d[Symbol.dispose]?.();a=null,N=0}};return Object.assign(d=>{l=null,typeof d=="number"?w=Array.from({length:d},(g,W)=>W+1):d?.constructor===Object?(l=Object.keys(d),w=Object.values(d)):w=d||[];let v=B(()=>{w[$]?.value,j()});return()=>{v(),J()}},{eval:y(i)})};var Jt=(t,e,r,o)=>i=>E(t,o,typeof i=="function"&&!D(t)?i(t.getAttribute(o)):i);var Ft=t=>e=>{let r=D(t);for(let o in e)E(t,r?o:Dt(o),e[o])};var Bt=(t,e,r,o)=>{let[i,...n]=o.slice(2).split("."),s=y(r).bind(t),c=x(Object.assign(f=>s(e,a=>typeof a=="function"?a(f):a),{target:t}),n);return c.target.addEventListener(i,c,c),{[Symbol.dispose](){c.target.removeEventListener(i,c),c[Symbol.dispose]?.()}}};var Xt=(t,e,r,o)=>{let i,n,s=y(r).bind(t),c=o.split("..").map((f,a,{length:l})=>f.split(":").reduce((w,N)=>{let[j,...J]=N.slice(2).split("."),d=(g,W)=>i=typeof g=="function"?g(W):g,v=x(Object.assign(g=>(a?d(i,g):s(e,W=>d(W,g)),n(),n=c[(a+1)%l]()),{target:t}),J);return g=>(g=w?.(),v.target.addEventListener(j,v,v),()=>(g?.(),v.target.removeEventListener(j,v)))},null));return n=c[0](),{[Symbol.dispose](){n?.()}}};var Gt=t=>!!t?.content,Qt=(t,e)=>{if(t.content){let r,o=t.innerHTML,i=t.ownerDocument,n=t._holder;return n||t.replaceWith(n=i.createTextNode("")),s=>{if(typeof s=="function"&&(s=s(o)),t._holder&&(t.remove(),t.content.replaceChildren()),r?.[h]?.(),r?.remove(),s!=null&&s!=="")return r=Gt(s)?(o=s.innerHTML,_(s)):_((r=i.createElement("template"),r.innerHTML=o=s,r)),k(()=>m(r,e)),n.before(r.content),t._holder&&t.childNodes.splice(0,1/0,...r.childNodes),r[h];t._holder&&(t.childNodes.length=0,o="")}}return r=>{var o;return r=typeof r=="function"?r(t.innerHTML):r,Gt(r)?t.replaceChildren(r.content.cloneNode(!0)):t.innerHTML=r??"",t[o=p]&&(t[o]=null),k(()=>m(t,e)),t[h]}};var Yt=(t,e,r)=>{let o=t.ownerDocument,i=o.createComment(":portal"),n=null;return t.before(i),s=>{let c=t.getRootNode(),f=typeof s=="string"?c.querySelector?.(s)||o.querySelector(s):s?.nodeType===1?s:s?o.body:null;if(f!==n)return f?f.appendChild(t):i.after(t),n=f,()=>{n&&(i.after(t),n=null)}}};var te=t=>e=>t.hidden=!!e;var yt=(t,e,r,o)=>{let[,...i]=o.split("."),n=y(r).bind(t),s;return x(Object.assign(()=>{let f=n(e,a=>typeof a=="function"?a(t):a);typeof f=="function"&&(s=f)},{target:t}),i)(),{[h](){s?.(),s=null}}};var gt=(t,e,r,o)=>{let[,...i]=o.split("."),n=y(r).bind(t),s=t.type==="checkbox"?()=>t.checked:t.type==="select-multiple"?()=>[...t.selectedOptions].map(f=>f.value):/^(date|time|month|week)/.test(t.type)?()=>t.value:()=>t.selectedIndex<0?null:isNaN(t.valueAsNumber)?t.value:t.valueAsNumber,c=x(Object.assign(()=>{n(e,f=>typeof f=="function"?f(s()):f)},{target:t}),i);return t.addEventListener("input",c),t.addEventListener("change",c),{[h](){t.removeEventListener("input",c),t.removeEventListener("change",c)}}};var ee=(t,e,r,o)=>{let[,...i]=o.split("."),n=y(r).bind(t),s=i.includes("once"),c=x(Object.assign(a=>{n(e,l=>typeof l=="function"?l(a):l)},{target:t}),i),f=new IntersectionObserver(a=>{for(let l of a)l.isIntersecting&&(c(l),s&&f.disconnect())});return f.observe(t),{[h](){f.disconnect()}}};ee.observer=!0;var re=ee;var oe=(t,e,r,o)=>{let[,...i]=o.split("."),n=y(r).bind(t),s=x(Object.assign(f=>{n(e,a=>typeof a=="function"?a(f):a)},{target:t}),i),c=new ResizeObserver(f=>{for(let a of f){let l=a.contentRect;s({width:l.width,height:l.height,entry:a})}});return c.observe(t),{[h](){c.disconnect()}}};oe.observer=!0;var ie=oe;yt.observer=gt.observer=!0;Object.assign(K,{_:Jt,"":Ft,class:It,text:qt,html:Qt,style:Ht,fx:zt,value:Kt,ref:Ut,scope:Vt,if:Mt,else:Pt,each:Zt,portal:Yt,hidden:te,mount:yt,change:gt,intersect:re,resize:ie});var Se=(t,e,r,o)=>{let[i,...n]=e.split("."),s=K[i]||K._;return()=>{let c=A(0),f=x(Object.assign(()=>c.value++,{target:t}),n),a=f.target??t,l=s(a,o,r,i);if(!l?.call)return l?.[h];let w=0,N=l.eval??y(r).bind(a),j,J=()=>(typeof j=="function"&&j(),j=null);D(a)||(o=a[p]??o);let d=B(()=>{let g=c.value==w?f():(w=c.value,j=N(o,l));return J});if(!(p in a))return d;let v=0;return()=>{v||(v=1,d(),l[C]?l[C]():a[h]?.())}}},Ne=t=>t?typeof t=="number"?t:(([,e,r]=t.match(/^(\d+)(ms|s|m)?$/)||[])=>(e=+e,r==="s"?e*1e3:r==="m"?e*6e4:e))():0,bt=t=>t==="idle"?requestIdleCallback:t==="raf"?requestAnimationFrame:!t||t==="tick"?queueMicrotask:e=>setTimeout(e,Ne(t));Object.assign(q,{debounce:(t,e,r)=>kt(t,bt(e==="immediate"?r:e),e==="immediate"||r==="immediate"),throttle:(t,e)=>V(t,bt(e)),delay:(t,e)=>((r=bt(e))=>o=>r(()=>t(o)))(),tick:t=>e=>queueMicrotask(()=>t(e)),raf:t=>e=>requestAnimationFrame(()=>t(e)),once:(t,e,r)=>(r=o=>!e&&(e=1,t(o)),r.once=!0,r),window:t=>(t.target=t.target.ownerDocument.defaultView,t),document:t=>(t.target=t.target.ownerDocument,t),root:t=>(t.target=t.target.ownerDocument.documentElement,t),body:t=>(t.target=t.target.ownerDocument.body,t),parent:t=>(t.target=t.target.parentNode,t),self:t=>e=>e.target===t.target&&t(e),away:(t,e)=>{let r=t.target.ownerDocument,o=n=>e=n.target,i=r.currentEvent||r.defaultView?.event;return r.addEventListener("pointerdown",o,!0),Object.assign(n=>n!==i&&!t.target.contains(n.type==="click"?e??n.target:n.target)&&n.target.isConnected&&t(n),{target:r,[h]:()=>r.removeEventListener("pointerdown",o,!0)})},prevent:t=>e=>(e?.preventDefault(),t(e)),stop:(t,e)=>r=>(e?.[0]==="i"?r?.stopImmediatePropagation():r?.stopPropagation(),t(r)),passive:t=>(t.passive=!0,t),capture:t=>(t.capture=!0,t)});q.outside=q.away;var vt={ctrl:t=>t.ctrlKey||t.key==="Control"||t.key==="Ctrl",shift:t=>t.shiftKey||t.key==="Shift",alt:t=>t.altKey||t.key==="Alt",meta:t=>t.metaKey||t.key==="Meta",cmd:t=>t.metaKey||t.key==="Command",arrow:t=>t.key?.startsWith("Arrow"),enter:t=>t.key==="Enter",esc:t=>t.key?.startsWith("Esc"),tab:t=>t.key==="Tab",space:t=>t.key==="\xA0"||t.key==="Space"||t.key===" ",delete:t=>t.key==="Delete"||t.key==="Backspace",digit:t=>/^\d$/.test(t.key),letter:t=>/^\p{L}$/gu.test(t.key),char:t=>/^\S$/.test(t.key)},ne=(t,e)=>vt[t]?.(e)||e.key?.toLowerCase()===t||e.keyCode==t;for(let t in vt)q[t]=(e,r,o)=>i=>vt[t](i)&&(!r||ne(r,i))&&(!o||ne(o,i))&&e(i);var Oe=t=>{let e=0,r="",o=0;for(let i of t){if(r){o?o=0:i==="\\"?o=1:i===r&&(r="");continue}if(i===";"&&!e)return!0;i==="{"?e++:i==="}"?e--:(i==='"'||i==="'"||i==="`")&&(r=i)}return!1};G({compile:t=>(/^(if|let|const)\b/.test(t)||Oe(t)||(t=`return ${t}`),/\bawait\s/.test(t)&&(t=`return (async()=>{${t}})()`),m.constructor(`with(arguments[0]){${t}}`)),dir:(t,e,r,o)=>e.includes("..")?()=>Xt(t,o,r,e)[h]:e.split(":").reduce((i,n)=>{let s=n.split(".")[0],c=K[s],f=n.startsWith("on")?()=>Bt(t,o,r,n)[h]:c?.observer?()=>c(t,o,r,n)[h]:Se(t,n,r,o);return i?(a,l)=>(a=i(),l=f(),()=>{a(),l()}):f},null),...mt});m.use=G;m.store=Q;m.directive=K;m.modifier=q;var ro=m.dispose=t=>t[h]?.();m.start=Lt;var se=m;var St={};At(St,{Computed:()=>P,Effect:()=>I,Signal:()=>b,batch:()=>Ae,computed:()=>Te,effect:()=>de,signal:()=>Ee,untracked:()=>_t});var Ce=Symbol.for("preact-signals");function st(){if(M>1)M--;else{for(var t,e=!1;tt!==void 0;){var r=tt;for(tt=void 0,xt++;r!==void 0;){var o=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ae(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=o}}if(xt=0,M--,e)throw t}}function Ae(t){if(M>0)return t();M++;try{return t()}finally{st()}}var u=void 0;function _t(t){var e=u;u=void 0;try{return t()}finally{u=e}}var tt=void 0,M=0,xt=0,nt=0;function ce(t){if(u!==void 0){var e=t.n;if(e===void 0||e.t!==u)return e={i:0,S:t,p:u.s,n:void 0,t:u,e:void 0,x:void 0,r:e},u.s!==void 0&&(u.s.n=e),u.s=e,t.n=e,32&u.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=u.s,e.n=void 0,u.s.n=e,u.s=e),e}}function b(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}b.prototype.brand=Ce;b.prototype.h=function(){return!0};b.prototype.S=function(t){var e=this,r=this.t;r!==t&&t.e===void 0&&(t.x=r,this.t=t,r!==void 0?r.e=t:_t(function(){var o;(o=e.W)==null||o.call(e)}))};b.prototype.U=function(t){var e=this;if(this.t!==void 0){var r=t.e,o=t.x;r!==void 0&&(r.x=o,t.e=void 0),o!==void 0&&(o.e=r,t.x=void 0),t===this.t&&(this.t=o,o===void 0&&_t(function(){var i;(i=e.Z)==null||i.call(e)}))}};b.prototype.subscribe=function(t){var e=this;return de(function(){var r=e.value,o=u;u=void 0;try{t(r)}finally{u=o}},{name:"sub"})};b.prototype.valueOf=function(){return this.value};b.prototype.toString=function(){return this.value+""};b.prototype.toJSON=function(){return this.value};b.prototype.peek=function(){var t=u;u=void 0;try{return this.value}finally{u=t}};Object.defineProperty(b.prototype,"value",{get:function(){var t=ce(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(xt>100)throw new Error("Cycle detected");this.v=t,this.i++,nt++,M++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{st()}}}});function Ee(t,e){return new b(t,e)}function ae(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function fe(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function le(t){for(var e=t.s,r=void 0;e!==void 0;){var o=e.p;e.i===-1?(e.S.U(e),o!==void 0&&(o.n=e.n),e.n!==void 0&&(e.n.p=o)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=o}t.s=r}function P(t,e){b.call(this,void 0),this.x=t,this.s=void 0,this.g=nt-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}P.prototype=new b;P.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===nt))return!0;if(this.g=nt,this.f|=1,this.i>0&&!ae(this))return this.f&=-2,!0;var t=u;try{fe(this),u=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return u=t,le(this),this.f&=-2,!0};P.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}b.prototype.S.call(this,t)};P.prototype.U=function(t){if(this.t!==void 0&&(b.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};P.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(P.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=ce(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Te(t,e){return new P(t,e)}function ue(t){var e=t.u;if(t.u=void 0,typeof e=="function"){M++;var r=u;u=void 0;try{e()}catch(o){throw t.f&=-2,t.f|=8,wt(t),o}finally{u=r,st()}}}function wt(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ue(t)}function je(t){if(u!==this)throw new Error("Out-of-order effect");le(this),u=t,this.f&=-2,8&this.f&&wt(this),st()}function I(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}I.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};I.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ue(this),fe(this),M++;var t=u;return u=this,je.bind(this,t)};I.prototype.N=function(){2&this.f||(this.f|=2,this.o=tt,tt=this)};I.prototype.d=function(){this.f|=8,1&this.f||wt(this)};I.prototype.dispose=function(){this.d()};function de(t,e){var r=new I(t,e);try{r.c()}catch(i){throw r.d(),i}var o=r.d.bind(r);return o[Symbol.dispose]=o,o}G(St);var no=se;export{X as batch,z as computed,kt as debounce,no as default,ro as dispose,B as effect,A as signal,m as sprae,Lt as start,Q as store,V as throttle,k as untracked,G as use};
|
|
1
|
+
var wt=Object.defineProperty;var $e=(e,t)=>{for(var r in t)wt(e,r,{get:t[r],enumerable:!0})};var g=Symbol.dispose||(Symbol.dispose=Symbol("dispose")),m=Symbol("state"),ae=Symbol("on"),M=Symbol("off"),ge=Symbol("init"),be=":",I=e=>e.localName?.includes("-"),W,Q,Y,ne=e=>e(),z=ne,ee={},B={},ue=null,ve=null,St=e=>{if(!e?.tagName)return"";let t=e.tagName.toLowerCase();return e.id?t+="#"+e.id:e.className&&(t+="."+e.className.split(" ")[0]),`<${t}>`},ye=(e,t,r=ve)=>{let o=`\u2234 ${e}`;if(r&&(o+=`
|
|
2
|
+
in ${St(r)}`),t){let i=t.length>100?t.slice(0,80)+`\u2026 (${t.length} chars)`:t;o+=ue?`
|
|
3
|
+
${ue}="${i}"`:`
|
|
4
|
+
="${i}"`}console.error(o)},xe=(e=document.body,t)=>{if(e[m])return Object.assign(e[m],t);t=le(t||{});let r=e,o=[],i=[];r[ae]=()=>{if(i)return i;i=Array(o.length);for(let s=0;s<o.length;s++)i[s]=o[s]();return i},r[M]=()=>{if(!i)return;let s=i;i=null;for(let l=0;l<s.length;l++)s[l]?.()},r[g]||(r[g]=()=>{r[M]?.(),k?._root===r&&(k.disconnect(),k=null),r[M]=r[ae]=r[g]=r[ge]=r[m]=null});let n=r[ge]=s=>{let l=s.attributes,c;if(l)for(let f=0;f<l.length;){let{name:a,value:L}=l[f];if(a.startsWith(be)){s.removeAttribute(a);let D=s[m];if(ue=a,ve=s,o.push(c=qe(s,a.slice(be.length),L,t)),i.push(c()),s[m]!==D)return}else f++}if(!(s!==e&&I(s)))if(s.firstChild!==void 0){let f=s.firstChild,a;for(;f;)a=f.nextSibling,f.nodeType==1&&n(f),f=a}else for(let f of s.childNodes)f.nodeType==1&&n(f)};return n(r),ue=ve=null,r[m]===void 0&&!I(e)&&(r[m]=t),t};xe.version="13.3.1";var qe,He,x=e=>{let t=We[e=e.trim()];if(t)return t;try{t=He(e||"undefined")}catch(r){ye(r,e)}return We[e]=function(r,o,i){try{let n=t?.call(this,r);return o?n?.then?(n.then(s=>i=o(s)).catch(s=>ye(s,e,this)),()=>typeof i=="function"&&i()):o(n):n}catch(n){ye(n,e,this)}}},We={},se=e=>(e.compile&&(He=e.compile),e.prefix&&(be=e.prefix),e.signal&&(W=e.signal),e.effect&&(Q=e.effect),e.computed&&(Y=e.computed),e.batch&&(ne=e.batch),e.untracked&&(z=e.untracked),e.dir&&(qe=e.dir)),j=(e,t)=>{for(;t.length;){let[r,...o]=t.pop().split("-"),i=B[r],n;if(i&&(n=i(e,...o))!==e){for(let s in e)n[s]??(n[s]=e[s]);e=n}}return e},k=null,te=e=>{k?.disconnect(),e(),k?.observe(k._root,{childList:!0,subtree:!0})},ke=(e=document.body,t)=>{let r=le(t);return xe(e,r),k=new MutationObserver(o=>{for(let i of o){for(let n of i.addedNodes)n.nodeType===1&&n[m]===void 0&&e.contains(n)&&e[ge](n);for(let n of i.removedNodes)n.nodeType===1&&!e.contains(n)&&n[g]?.()}}),k._root=e,k.observe(e,{childList:!0,subtree:!0}),r},A=e=>{if(!e.nodeType)return e;let t=e.ownerDocument,r=e.content.cloneNode(!0),o=[...e.attributes],i=t.createTextNode(""),n=(r.append(i),[...r.childNodes]);return{ownerDocument:t,childNodes:n,content:r,remove:()=>r.append(...n),replaceWith(s){s!==i&&(i.before(s),r.append(...n))},attributes:o,removeAttribute(s){o.splice(o.findIndex(l=>l.name===s),1)}}},Ie=e=>e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t,r)=>(r?"-":"")+t.toLowerCase()),Nt=e=>e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase()),q=(e,t,r)=>r==null||r===!1?e.removeAttribute(t):I(e)?e[Nt(t)]=r:e.setAttribute(t,r===!0?"":r),_e=e=>e?typeof e=="string"?e:(Array.isArray(e)?e.map(_e):Object.entries(e).reduce((t,[r,o])=>(o&&t.push(r),t),[])).join(" "):"",re=(e,t)=>{let r=0,o=0,i,n=typeof t=="function"?t:t?l=>setTimeout(l,t):queueMicrotask,s=l=>{i=l,r++||(e(i),n(()=>{let c=r>1;if(r=0,c){if(++o>50){o=0,console.error("\u2234 Reactive loop detected");return}s(i)}else o=0}))};return s},ze=(e,t,r)=>{let o=typeof t=="function"?t:t?i=>setTimeout(i,t):queueMicrotask;return r?(i=>n=>!i&&(e(n),i=1,o(()=>i=0)))():((i=0)=>(n,s=++i)=>o(()=>s==i&&e(n)))()},y=xe;var P=Symbol("signals"),H=Symbol("change"),ce=Symbol("set"),Se=Symbol("parent"),we=!0,X=(e,t)=>{if(!e||e[Symbol.toStringTag]||e[P])return e;if(e.constructor!==Object)return Array.isArray(e)?Ot(e):e;let r=Object.keys(e).length,o={},i=new Proxy(Object.assign(o,{[H]:W(r),[P]:o}),{get:(s,l)=>l in o?o.hasOwnProperty(l)&&typeof o[l]=="function"&&!o[l].prototype?o[l].bind(i):o[l]?o[l].valueOf():o[l]:t?t[l]:typeof globalThis[l]=="function"&&!globalThis[l].prototype?globalThis[l].bind(globalThis):globalThis[l],set:(s,l,c)=>l in o?(Ke(o,l,c),1):(we=!1,t&&l in t?t[l]=c:(de(o,l,c),o[H].value=++r),we=!0,1),deleteProperty:(s,l)=>(l in o&&(l[0]!="_"&&o[l]?.[Symbol.dispose]?.(),delete o[l],o[H].value=--r),1),ownKeys:()=>(o[H].value,Reflect.ownKeys(o).filter(s=>s!==Se)),has:(s,l)=>l in o?!0:t?l in t:we});Object.defineProperty(o,Se,{value:t,configurable:!0});let n=Object.getOwnPropertyDescriptors(e);for(let s in e)n[s]?.get?(o[s]=Y(n[s].get.bind(i)))[ce]=n[s].set?.bind(i):de(o,s,e[s]);return i},Ot=(e,t=globalThis)=>{let r=Array(e.length).fill(null),o=!1,i=l=>function(){return o=!0,l.apply(this,arguments)},n=W(e.length),s=new Proxy(Object.assign(r,{[H]:n,[P]:r,push:i(r.push),pop:i(r.pop),shift:i(r.shift),unshift:i(r.unshift),splice:i(r.splice)}),{get(l,c){return c==="length"?o?(o=!1,r.length):n.value:typeof c=="symbol"||isNaN(c)?r[c]?.valueOf()??t[c]:(r[c]??(r[c]=W(X(e[c])))).valueOf()},set(l,c,f){if(c==="length"){for(let a=f;a<r.length;a++)delete s[a];n.value=r.length=f}else c>=r.length?(de(r,c,f),s.length=+c+1):r[c]?Ke(r,c,f):de(r,c,f);return 1},deleteProperty:(l,c)=>(r[c]?.[Symbol.dispose]?.(),delete r[c],1)});return Object.defineProperty(r,Se,{value:t,configurable:!0}),s},de=(e,t,r)=>e[t]=t[0]=="_"||r?.peek||typeof r=="function"?r:W(X(r)),Ke=(e,t,r,o,i)=>t[0]==="_"||typeof e[t]=="function"?e[t]=r:r!==(i=(o=e[t]).peek?.()??o)&&(o[ce]?o[ce](r):Array.isArray(r)&&Array.isArray(i)?H in i?z(()=>ne(()=>{for(let n=0;n<r.length;n++)i[n]=r[n];i.length=r.length})):o.value=r:o.value=X(r)),le=X;var Oe={};$e(Oe,{batch:()=>At,computed:()=>Ct,effect:()=>Ve,signal:()=>Ue,untracked:()=>Et});var K,Ne=0,oe,Ue=(e,t,r=new Set,o=()=>t.value)=>t={get value(){return K?.deps.add(r.add(K)),e},set value(i){if(i!==e){e=i;for(let n of r)oe?oe.add(n):n()}},peek(){return e},toJSON:o,toString:o,valueOf:o},Ve=(e,t,r,o)=>(r=i=>{if(!e)return;let n=t;if(t=null,n?.call?.(),i=K,K=r,Ne++>50){Ne--,K=i,t=e=r.fn=null;for(let s of o)s.delete(r);o.clear(),console.error("\u2234 Reactive loop detected");return}try{t=e()}finally{K=i,Ne--}},r.fn=e,o=r.deps=new Set,r(),i=>{t?.call?.(),t=e=r.fn=null;for(i of o)i.delete(r);o.clear()}),Ct=(e,t=Ue(),r,o,i=()=>r.value)=>r={get value(){return o||(o=Ve(()=>t.value=e())),t.value},peek:t.peek,toJSON:i,toString:i,valueOf:i},At=(e,t=!oe,r)=>{oe??(oe=new Set);try{e()}finally{if(t){[oe,r]=[null,oe];for(let o of r)o()}}},Et=(e,t,r)=>(t=K,K=null,r=e(),K=t,r);var Fe=(e,t)=>{var n,s;let r,o;e._holder?y(o=e,t):(e[n=m]??(e[n]=null),o=e.content?A(e):e,o[s=m]??(o[s]=null),te(()=>e.replaceWith(r=e.ownerDocument.createTextNode(""))),o._holder=r._holder=r,r._clauses=[o._clause=[o,!1]],r._match=null,r.update=re(()=>{let l=r._clauses.find(([,c])=>c);l!=r._match&&te(()=>{r._match?.[0].remove(),r._match?.[0][M]?.(),(r._match=l)&&(r.before(r._match[0].content||r._match[0]),r._match[0][m]?r._match[0][ae]?.():(delete r._match[0][m],y(r._match[0],t)))})}));let i=l=>{o._clause[1]=l,o._holder.update()};return i[M]=()=>{o._holder._match?.[0][M]?.(),o._holder._match=null},i};var Ze=e=>{var o;let t,r=e;for(t=e.content?A(e):e,t[o=m]??(t[o]=null);r&&!(t._holder=r._holder);)r=r.previousSibling;return e.remove(),e[m]=null,t._holder._clauses.push(t._clause=[t,!0]),t._holder.update};var Je=e=>(e.content&&e.replaceWith(e=A(e).childNodes[0]),t=>{t=typeof t=="function"?t(e.textContent):t,t=t==null?"":""+t;let r=e.textContent;if(r===t)return;let o=e.firstChild;if(o&&t.startsWith(r)){o.appendData(t.slice(r.length));return}let i=e.getRootNode().getSelection?.(),n=i?.rangeCount&&e.contains(i.anchorNode)?i.getRangeAt(0).startOffset:-1;if(e.textContent=t,n>=0&&e.firstChild){let s=Math.min(n,e.firstChild.textContent.length),l=new Range;l.setStart(e.firstChild,s),l.collapse(!0),i.removeAllRanges(),i.addRange(l)}});var Be=(e,t,r,o)=>{let i=null,n,s=null;return l=>{if(l=typeof l=="function"?l(e.className):l,l?.constructor===Object){if(s=null,i)for(let c of i)l[c]||(e.classList.remove(c),i.delete(c));i?.size||(i=null);for(let c in l)l[c]&&!i?.has(c)&&(e.classList.add(c),(i||(i=new Set)).add(c));i||e.removeAttribute("class");return}if(l=_e(l),l!==s){if(s=l,n=null,l)for(let c of l.split(" "))c&&(n||(n=new Set)).add(c);if(i)for(let c of i)n?.has(c)||e.classList.remove(c);if(n)for(let c of n)i?.has(c)||e.classList.add(c);n||e.removeAttribute("class"),i=n}}};var Xe=(e,t,r,o)=>{let i;return n=>{if(i===void 0&&(i=e.getAttribute("style")??""),n=typeof n=="function"?n(e.style):n,typeof n=="string")q(e,"style",i?i+"; "+n:n);else{i&&q(e,"style",i);for(let s in n)s[0]=="-"?e.style.setProperty(s,n[s]):s[0]>="A"&&(e.style[s]=n[s])}}};var Ge=()=>e=>typeof e=="function"&&e();var Qe=(e,t)=>(e.type?.startsWith("select")&&y(e,t),e.type==="text"||e.type===""||e.tagName==="TEXTAREA"?(r,o,i)=>(o=e.selectionStart,i=e.selectionEnd,e.setAttribute("value",e.value=r??""),o&&e.setSelectionRange(o,i)):e.type==="checkbox"?r=>(e.checked=r,q(e,"checked",r)):e.type==="radio"?r=>(e.checked=e.value===r,q(e,"checked",e.checked||null)):e.type==="select-one"?r=>{for(let o of e.options)o.value==r?o.setAttribute("selected",""):o.removeAttribute("selected");e.value=r}:e.type==="select-multiple"?r=>{for(let o of e.options)r.some(i=>i==o.value)?o.setAttribute("selected",""):o.removeAttribute("selected")}:r=>e.value=r);var Tt=(e,t=x(`${e}=__`))=>(r,o)=>{r.__=o,t(r),delete r.__},Ye=(e,t,r)=>{let o=x(r).call(e,t);typeof o=="function"?o(e):Tt(r)(t,e)};var et=(e,t)=>{let r=e[m]=X({},t),o=!1,i,n=e.content&&A(e);return n&&e.replaceWith(i=e.ownerDocument.createTextNode("")),s=>{if(s=typeof s=="function"?s(r):s,s!==r)for(let l in s){let c=Object.getOwnPropertyDescriptor(s,l);if(c?.get){(r[P][l]=Y(c.get.bind(r)))[ce]=c.set?.bind(r);continue}let f=typeof s[l]=="function"?s[l].bind(r):s[l];l in r[P]?r[l]=f:r[P][l]=l[0]=="_"||f?.peek?f:W(X(f))}return!o&&(o=!0,!i&&delete e[m],z(()=>(i?.before(n.content||e),y(n||e,r))))}};var jt={get:(e,t)=>t===e.v?e.c?.[e.i]:t===e.k?e.o?e.o[e.i]:e.i:t===P?e:e.l?.[t]!==void 0?e.l[t]:e.p?.[t],set:(e,t,r)=>(t===e.v?e.c&&(e.c[e.i]=r):t===e.k||(e.l?.[t]!==void 0?e.l[t]=r:t in(e.p?.[P]||{})?e.p[t]=r:(e.l||(e.l={}))[t]=r),1),has:()=>!0},Ce={get:(e,t)=>t===e.v?e.r:t===e.k?e.i:t===P?e:e.l?.[t]!==void 0?e.l[t]:e.p?.[t],set:(e,t,r)=>(t===e.v?e.r=r:t===e.k||(e.l?.[t]!==void 0?e.l[t]=r:t in(e.p?.[P]||{})?e.p[t]=r:(e.l||(e.l={}))[t]=r),1),has:()=>!0},tt=(e,t,r)=>{let[o,i]=r.split(/\bin|of\b/),[n,s="$"]=o.trim().replace(/\(|\)/g,"").split(/\s*,\s*/),l=e.ownerDocument,c=e._eachHolder||(e._eachHolder=l.createTextNode("")),f=new Map,a=[],L,D,U,E=!1,J=re(()=>te(()=>{let h=L,w=h.length,C=a.length;if(E=!1,!h[H])for(let u=0;u<w;u++){let S=h[u];if(S!=null){E=typeof S=="object";break}}if(E&&C)if(w>C&&f.size===C){let u=w-C>1?l.createDocumentFragment():null,S=u?[]:null;for(let _=C;_<w;_++){let T=h[_],$={p:t,v:n,k:s,r:T,i:_,l:null},b=new Proxy($,Ce),d=e.content?A(e):e.cloneNode(!0),v=d.content||d,V={el:d,scope:$,proxy:b};f.set(T,V),a.push(V),u?(u.appendChild(v),S.push([d,b])):(c.before(v),y(d,b))}if(u&&S.length){c.before(u);for(let[_,T]of S)y(_,T)}}else{let u=0;if(w<=C){let b=new Set;for(let d=0;d<w;d++)b.add(h[d]);for(let[d,v]of f)b.has(d)||(v.el[Symbol.dispose]?.(),v.el.remove(),f.delete(d),u++)}let S=[],_=!1,T=null,$=null;w-f.size>1&&(T=l.createDocumentFragment(),$=[]);for(let b=0;b<w;b++){let d=h[b],v=f.get(d);if(v)v.scope.i!==b&&(_=!0),v.scope.i=b,v.scope.r=d,S.push(v);else{let V={p:t,v:n,k:s,r:d,i:b,l:null},me=new Proxy(V,Ce),ie=e.content?A(e):e.cloneNode(!0),Re=ie.content||ie;v={el:ie,scope:V,proxy:me},f.set(d,v),S.push(v),T?(T.appendChild(Re),$.push([ie,me])):(c.before(Re),y(ie,me))}}if(T&&$.length){c.before(T);for(let[b,d]of $)y(b,d)}if(_||u){let b=c;for(let d=S.length-1;d>=0;d--){let v=S[d].el._holder||S[d].el.content||S[d].el;v.nextSibling!==b&&b.before(v),b=v}}a=S}else{if(C&&U!==h&&!h[H]){for(let u of a)u.el[Symbol.dispose]?.(),u.el.remove();a.length=0,C=0,f.clear()}if(U=h,w<C){for(let u=w;u<C;u++)a[u].el[Symbol.dispose]?.(),a[u].el.remove();a.length=w}for(let u=0;u<Math.min(C,w);u++)a[u].scope.c=h,D&&(a[u].scope.o=D);if(w>C){let u=w-C>1?l.createDocumentFragment():null,S=u?[]:null;for(let _=C;_<w;_++){let T=E?Ce:jt,$=E?{p:t,v:n,k:s,r:h[_],i:_,l:null}:{p:t,v:n,k:s,c:h,i:_,o:D,l:null},b=new Proxy($,T),d=e.content?A(e):e.cloneNode(!0),v=d.content||d,V={el:d,scope:$};a.push(V),E&&f.set(h[_],V),u?(u.appendChild(v),S.push([d,b])):(c.before(v),y(d,b))}if(u){c.before(u);for(let[_,T]of S)y(_,T)}}}}));e.parentNode&&te(()=>e.replaceWith(c)),e[m]=null;let R=()=>{for(let h of a)h.el[Symbol.dispose]?.(),h.el.remove();a.length=0,f.clear()},N=h=>{D=null,typeof h=="number"?L=Array.from({length:h},(C,u)=>u+1):h?.constructor===Object?(D=Object.keys(h),L=Object.values(h)):L=h||[];let w=Q(()=>{L[H]?.value,J()});return()=>w()};return N.eval=x(i),N[M]=R,N};var rt=(e,t,r,o)=>i=>q(e,o,typeof i=="function"&&!I(e)?i(e.getAttribute(o)):i);var ot=e=>t=>{let r=I(e);for(let o in t)q(e,r?o:Ie(o),t[o])};var it=(e,t,r,o)=>{let[i,...n]=o.slice(2).split("."),s=x(r).bind(e),l=j(Object.assign(c=>s(t,f=>typeof f=="function"?f(c):f),{target:e}),n);return l.target.addEventListener(i,l,l),{[Symbol.dispose](){l.target.removeEventListener(i,l),l[Symbol.dispose]?.()}}};var nt=(e,t,r,o)=>{let i,n,s=x(r).bind(e),l=o.split("..").map((c,f,{length:a})=>c.split(":").reduce((L,D)=>{let[U,...E]=D.slice(2).split("."),J=(N,h)=>i=typeof N=="function"?N(h):N,R=j(Object.assign(N=>(f?J(i,N):s(t,h=>J(h,N)),n(),n=l[(f+1)%a]()),{target:e}),E);return N=>(N=L?.(),R.target.addEventListener(U,R,R),()=>(N?.(),R.target.removeEventListener(U,R)))},null));return n=l[0](),{[Symbol.dispose](){n?.()}}};var st=e=>!!e?.content,lt=(e,t)=>{if(e.content){let r,o=e.innerHTML,i=e.ownerDocument,n=e._holder;return n||e.replaceWith(n=i.createTextNode("")),s=>{if(typeof s=="function"&&(s=s(o)),e._holder&&(e.remove(),e.content.replaceChildren()),r?.[g]?.(),r?.remove(),s!=null&&s!=="")return r=st(s)?(o=s.innerHTML,A(s)):A((r=i.createElement("template"),r.innerHTML=o=s,r)),z(()=>y(r,t)),n.before(r.content),e._holder&&e.childNodes.splice(0,1/0,...r.childNodes),r[g];e._holder&&(e.childNodes.length=0,o="")}}return r=>{var o;return r=typeof r=="function"?r(e.innerHTML):r,st(r)?e.replaceChildren(r.content.cloneNode(!0)):e.innerHTML=r??"",e[o=m]&&(e[o]=null),z(()=>y(e,t)),e[g]}};var ct=(e,t,r)=>{let o=e.ownerDocument,i=o.createComment(":portal"),n=null;return e.before(i),s=>{let l=e.getRootNode(),c=typeof s=="string"?l.querySelector?.(s)||o.querySelector(s):s?.nodeType===1?s:s?o.body:null;if(c!==n)return c?c.appendChild(e):i.after(e),n=c,()=>{n&&(i.after(e),n=null)}}};var ft=e=>t=>e.hidden=!!t;var Ae=(e,t,r,o)=>{let[,...i]=o.split("."),n=x(r).bind(e),s;return j(Object.assign(()=>{let c=n(t,f=>typeof f=="function"?f(e):f);typeof c=="function"&&(s=c)},{target:e}),i)(),{[g](){s?.(),s=null}}};var Ee=(e,t,r,o)=>{let[,...i]=o.split("."),n=x(r).bind(e),s=e.type==="checkbox"?()=>e.checked:e.type==="select-multiple"?()=>[...e.selectedOptions].map(c=>c.value):/^(date|time|month|week)/.test(e.type)?()=>e.value:()=>e.selectedIndex<0?null:isNaN(e.valueAsNumber)?e.value:e.valueAsNumber,l=j(Object.assign(()=>{n(t,c=>typeof c=="function"?c(s()):c)},{target:e}),i);return e.addEventListener("input",l),e.addEventListener("change",l),{[g](){e.removeEventListener("input",l),e.removeEventListener("change",l)}}};var at=(e,t,r,o)=>{let[,...i]=o.split("."),n=x(r).bind(e),s=i.includes("once"),l=j(Object.assign(f=>{n(t,a=>typeof a=="function"?a(f):a)},{target:e}),i),c=new IntersectionObserver(f=>{for(let a of f)a.isIntersecting&&(l(a),s&&c.disconnect())});return c.observe(e),{[g](){c.disconnect()}}};at.observer=!0;var ut=at;var dt=(e,t,r,o)=>{let[,...i]=o.split("."),n=x(r).bind(e),s=j(Object.assign(c=>{n(t,f=>typeof f=="function"?f(c):f)},{target:e}),i),l=new ResizeObserver(c=>{for(let f of c){let a=f.contentRect;s({width:a.width,height:a.height,entry:f})}});return l.observe(e),{[g](){l.disconnect()}}};dt.observer=!0;var pt=dt;Ae.observer=Ee.observer=!0;Object.assign(ee,{_:rt,"":ot,class:Be,text:Je,html:lt,style:Xe,fx:Ge,value:Qe,ref:Ye,scope:et,if:Fe,else:Ze,each:tt,portal:ct,hidden:ft,mount:Ae,change:Ee,intersect:ut,resize:pt});var Lt=(e,t,r,o)=>{let[i,...n]=t.split("."),s=ee[i]||ee._,l=n.length>0;return()=>{let c=e,f,a,L,D=0;if(l&&(a=W(0),L=j(Object.assign(()=>a.value++,{target:e}),n),c=L.target??e),f=s(c,o,r,i),!f?.call)return f?.[g];let U=f.eval??x(r).bind(c),E,J=()=>(typeof E=="function"&&E(),E=null);I(c)||(o=c[m]??o);let R=l?Q(()=>(a.value==D?L():(D=a.value,E=U(o,f)),J)):Q(()=>(E=U(o,f),J));if(!(m in c))return R;let N=0;return()=>{N||(N=1,R(),f[M]?f[M]():c[g]?.())}}},Dt=e=>e?typeof e=="number"?e:(([,t,r]=e.match(/^(\d+)(ms|s|m)?$/)||[])=>(t=+t,r==="s"?t*1e3:r==="m"?t*6e4:t))():0,Te=e=>e==="idle"?requestIdleCallback:e==="raf"?requestAnimationFrame:!e||e==="tick"?queueMicrotask:t=>setTimeout(t,Dt(e));Object.assign(B,{debounce:(e,t,r)=>ze(e,Te(t==="immediate"?r:t),t==="immediate"||r==="immediate"),throttle:(e,t)=>re(e,Te(t)),delay:(e,t)=>((r=Te(t))=>o=>r(()=>e(o)))(),tick:e=>t=>queueMicrotask(()=>e(t)),raf:e=>t=>requestAnimationFrame(()=>e(t)),once:(e,t,r)=>(r=o=>!t&&(t=1,e(o)),r.once=!0,r),window:e=>(e.target=e.target.ownerDocument.defaultView,e),document:e=>(e.target=e.target.ownerDocument,e),root:e=>(e.target=e.target.ownerDocument.documentElement,e),body:e=>(e.target=e.target.ownerDocument.body,e),parent:e=>(e.target=e.target.parentNode,e),self:e=>t=>t.target===e.target&&e(t),away:(e,t)=>{let r=e.target.ownerDocument,o=n=>t=n.target,i=r.currentEvent||r.defaultView?.event;return r.addEventListener("pointerdown",o,!0),Object.assign(n=>n!==i&&!e.target.contains(n.type==="click"?t??n.target:n.target)&&n.target.isConnected&&e(n),{target:r,[g]:()=>r.removeEventListener("pointerdown",o,!0)})},prevent:e=>t=>(t?.preventDefault(),e(t)),stop:(e,t)=>r=>(t?.[0]==="i"?r?.stopImmediatePropagation():r?.stopPropagation(),e(r)),passive:e=>(e.passive=!0,e),capture:e=>(e.capture=!0,e)});B.outside=B.away;var je={ctrl:e=>e.ctrlKey||e.key==="Control"||e.key==="Ctrl",shift:e=>e.shiftKey||e.key==="Shift",alt:e=>e.altKey||e.key==="Alt",meta:e=>e.metaKey||e.key==="Meta",cmd:e=>e.metaKey||e.key==="Command",arrow:e=>e.key?.startsWith("Arrow"),enter:e=>e.key==="Enter",esc:e=>e.key?.startsWith("Esc"),tab:e=>e.key==="Tab",space:e=>e.key==="\xA0"||e.key==="Space"||e.key===" ",delete:e=>e.key==="Delete"||e.key==="Backspace",digit:e=>/^\d$/.test(e.key),letter:e=>/^\p{L}$/gu.test(e.key),char:e=>/^\S$/.test(e.key)},ht=(e,t)=>je[e]?.(t)||t.key?.toLowerCase()===e||t.keyCode==e;for(let e in je)B[e]=(t,r,o)=>i=>je[e](i)&&(!r||ht(r,i))&&(!o||ht(o,i))&&t(i);var Mt=e=>{let t=0,r="",o=0;for(let i of e){if(r){o?o=0:i==="\\"?o=1:i===r&&(r="");continue}if(i===";"&&!t)return!0;i==="{"?t++:i==="}"?t--:(i==='"'||i==="'"||i==="`")&&(r=i)}return!1};se({compile:e=>(/^(if|let|const)\b/.test(e)||Mt(e)||(e=`return ${e}`),/\bawait\s/.test(e)&&(e=`return (async()=>{${e}})()`),y.constructor(`with(arguments[0]){${e}}`)),dir:(e,t,r,o)=>t.includes("..")?()=>nt(e,o,r,t)[g]:t.split(":").reduce((i,n)=>{let s=n.split(".")[0],l=ee[s],c=n.startsWith("on")?()=>it(e,o,r,n)[g]:l?.observer?()=>l(e,o,r,n)[g]:Lt(e,n,r,o);return i?(f,a)=>(f=i(),a=c(),()=>{f(),a()}):c},null),...Oe});y.use=se;y.store=le;y.directive=ee;y.modifier=B;var fo=y.dispose=e=>e[g]?.();y.start=ke;var mt=y;var Pe={};$e(Pe,{Computed:()=>Z,Effect:()=>G,Signal:()=>O,batch:()=>Rt,computed:()=>Wt,effect:()=>_t,signal:()=>$t,untracked:()=>De});var Pt=Symbol.for("preact-signals");function he(){if(F>1)F--;else{for(var e,t=!1;fe!==void 0;){var r=fe;for(fe=void 0,Le++;r!==void 0;){var o=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&>(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=o}}if(Le=0,F--,t)throw e}}function Rt(e){if(F>0)return e();F++;try{return e()}finally{he()}}var p=void 0;function De(e){var t=p;p=void 0;try{return e()}finally{p=t}}var fe=void 0,F=0,Le=0,pe=0;function yt(e){if(p!==void 0){var t=e.n;if(t===void 0||t.t!==p)return t={i:0,S:e,p:p.s,n:void 0,t:p,e:void 0,x:void 0,r:t},p.s!==void 0&&(p.s.n=t),p.s=t,e.n=t,32&p.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=p.s,t.n=void 0,p.s.n=t,p.s=t),t}}function O(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}O.prototype.brand=Pt;O.prototype.h=function(){return!0};O.prototype.S=function(e){var t=this,r=this.t;r!==e&&e.e===void 0&&(e.x=r,this.t=e,r!==void 0?r.e=e:De(function(){var o;(o=t.W)==null||o.call(t)}))};O.prototype.U=function(e){var t=this;if(this.t!==void 0){var r=e.e,o=e.x;r!==void 0&&(r.x=o,e.e=void 0),o!==void 0&&(o.e=r,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&De(function(){var i;(i=t.Z)==null||i.call(t)}))}};O.prototype.subscribe=function(e){var t=this;return _t(function(){var r=t.value,o=p;p=void 0;try{e(r)}finally{p=o}},{name:"sub"})};O.prototype.valueOf=function(){return this.value};O.prototype.toString=function(){return this.value+""};O.prototype.toJSON=function(){return this.value};O.prototype.peek=function(){var e=p;p=void 0;try{return this.value}finally{p=e}};Object.defineProperty(O.prototype,"value",{get:function(){var e=yt(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Le>100)throw new Error("Cycle detected");this.v=e,this.i++,pe++,F++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{he()}}}});function $t(e,t){return new O(e,t)}function gt(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function bt(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function vt(e){for(var t=e.s,r=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=r}function Z(e,t){O.call(this,void 0),this.x=e,this.s=void 0,this.g=pe-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Z.prototype=new O;Z.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===pe))return!0;if(this.g=pe,this.f|=1,this.i>0&&!gt(this))return this.f&=-2,!0;var e=p;try{bt(this),p=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return p=e,vt(this),this.f&=-2,!0};Z.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}O.prototype.S.call(this,e)};Z.prototype.U=function(e){if(this.t!==void 0&&(O.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Z.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Z.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=yt(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Wt(e,t){return new Z(e,t)}function xt(e){var t=e.u;if(e.u=void 0,typeof t=="function"){F++;var r=p;p=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Me(e),o}finally{p=r,he()}}}function Me(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,xt(e)}function qt(e){if(p!==this)throw new Error("Out-of-order effect");vt(this),p=e,this.f&=-2,8&this.f&&Me(this),he()}function G(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}G.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};G.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,xt(this),bt(this),F++;var e=p;return p=this,qt.bind(this,e)};G.prototype.N=function(){2&this.f||(this.f|=2,this.o=fe,fe=this)};G.prototype.d=function(){this.f|=8,1&this.f||Me(this)};G.prototype.dispose=function(){this.d()};function _t(e,t){var r=new G(e,t);try{r.c()}catch(i){throw r.d(),i}var o=r.d.bind(r);return o[Symbol.dispose]=o,o}se(Pe);var po=mt;export{ne as batch,Y as computed,ze as debounce,po as default,fo as dispose,Q as effect,W as signal,y as sprae,ke as start,le as store,re as throttle,z as untracked,se as use};
|