@webjsdev/core 0.7.43 → 0.7.44
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.
|
@@ -2,5 +2,5 @@ var gs=Object.defineProperty;var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var br=(e,t)=>{f
|
|
|
2
2
|
`),c=i.map(K).join(`
|
|
3
3
|
`);if(a!==c){if(s.length===1&&i.length===1){let l=i[0];for(let u of[...l.attributes])l.removeAttribute(u.name);for(let u of s[0].attributes)l.setAttribute(u.name,u.value);continue}for(let l of i)l.remove();for(let l of s)document.head.appendChild(fr(l))}}for(let[o,s]of r)if(!n.has(o))for(let i of s)i.remove()}function Zn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(K(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(r.tagName==="META"&&qt(r)||n.has(K(r))||(r.tagName==="SCRIPT"?document.head.appendChild(ur(r)):document.head.appendChild(fr(r))));Ga(e)}function Ja(e){return e.tagName==="STYLE"?!0:e.tagName==="LINK"&&(e.getAttribute("rel")||"").toLowerCase().split(/\s+/).includes("stylesheet")}function ls(e){let t=document.head,n=e.querySelector("title");n&&(document.title=n.textContent||"");let r=new Set;for(let s of t.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&r.add(K(s));let o=new Set;for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&o.add(K(s));for(let s of[...t.children])s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(Ja(s)||s.tagName==="META"&&qt(s)===Qn||o.has(K(s))||s.remove());for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(s.tagName==="META"&&qt(s)===Qn||r.has(K(s))||(s.tagName==="SCRIPT"?t.appendChild(ur(s)):t.appendChild(fr(s))))}function de(e){typeof customElements>"u"||dr(e)}function dr(e){let t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(let n of t)n.tagName&&n.tagName.includes("-")&&(customElements.upgrade(n),n.shadowRoot&&dr(n.shadowRoot))}function Mo(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]")){let n=t.cloneNode(!0);document.body.appendChild(n);let r=n.getAttribute("data-webjs-resolve"),o=window.__webjsResolve;r&&typeof o=="function"&&o(r)}}async function us(e){if(!e.body||typeof e.body.getReader!="function")return{shell:await e.text(),streaming:!1};let t=e.body.getReader(),n=new TextDecoder,r="",o="<template data-webjs-resolve",s="<!--wj-stream-shell-->",i=/<\/html\s*>/i;for(;;){let{value:a,done:c}=await t.read();a&&(r+=n.decode(a,{stream:!0})),c&&(r+=n.decode());let l=r.indexOf(s);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(l+s.length)};let u=r.indexOf(o);if(u!==-1)return{shell:r.slice(0,u),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(u)};if(c)return{shell:r,streaming:!1};let f=i.exec(r);if(f){let d=f.index+f[0].length;return{shell:r.slice(0,d),streaming:!0,reader:t,dec:n,rest:r.slice(d)}}}}function fs(e){let t=/<template\s+data-webjs-resolve="([^"]+)"\s*>/i.exec(e);if(!t)return null;let n=t[1],r=t.index+t[0].length,o=/<(\/?)template\b[^>]*>/gi;o.lastIndex=r;let s=1,i;for(;i=o.exec(e);)if(i[1]==="/"){if(s--,s===0)return{id:n,content:e.slice(r,i.index),rest:e.slice(i.index+i[0].length)}}else s++;return null}function ds(e,t){let n=document.getElementById(e);if(!n){Na(e);return}let r=document.createElement("template");r.innerHTML=t;let o=[...r.content.childNodes];n.replaceWith(r.content);for(let s of o)s.nodeType===1&&dr(s)}async function ps(e,t,n,r){let o=n,s=()=>{let i;for(;i=fs(o);){if(!r())return!1;ds(i.id,i.content),o=i.rest}return!0};if(!e){s();return}try{for(;;){if(!s()){try{await e.cancel()}catch{}return}let{value:i,done:a}=await e.read();if(i&&(o+=t.decode(i,{stream:!0})),a){o+=t.decode(),s();return}}}catch{}}function Je(e){for(let t of e.querySelectorAll("script"))t.replaceWith(ur(t))}function Xa(e){return v.get(pe(e))||null}function Qa(){return fe.size}function Za(){v.clear(),fe.clear(),Ce.length=0,Ke.clear(),zt(),cr()}function ec(){return C}function tc(){return++C}function nc(){return H}function rc(e){H=e}function oc(){zn.clear(),Yn=!1}function sc(e,t){return Wo(e,t)}function ic(e){return Vt.test(e)}var Ro,Ee,ne,M,C,Vn,H,Rt,Vt,Vo,zn,Yn,ka,x,Ra,Yo,Go,Oa,La,Ma,v,fe,Ce,Ke,Te,Ye,te,ve,Ge,Bt,Ut,Lt,Xn,Qn,kt=G(()=>{Un();xt();xt();No();qn();yt();Ro="text/vnd.webjs-stream.html";Ee=null;ne=!1,M=null,C=0,Vn=null;H=null,Rt=null;Vt=/\.(?:pdf|zip|tar|gz|7z|rar|dmg|exe|msi|deb|rpm|apk|ipa|xlsx?|docx?|pptx?|csv|odt|ods|odp|rtf|epub|mobi|xml|json|rss|atom|txt|md|wasm|mp3|mp4|mov|avi|webm|ogg|flac|wav|m4a|m4v|mkv|png|jpe?g|gif|webp|avif|bmp|ico|svg|tiff?|heic)$/i;Vo="_top";zn=new Set;Yn=!1;ka=16,x=new Map;Ra=8,Yo=3e4,Go=3,Oa=24,La=100,Ma=250,v=new Map,fe=new Set,Ce=[],Ke=new Set,Te=null,Ye=null,te=null,ve=new WeakMap,Ge=new Set;Bt=new WeakMap;Ut=new WeakMap;Lt=Promise.resolve();Xn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);Qn="name=csp-nonce";(typeof window>"u"||window.__WEBJS_CLIENT_ROUTER__!==!1)&&tr()});function _s(e,...t){return{_$webjs:"template",strings:e,values:t}}function O(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var A="wjm-";function ws(e,...t){let n=e[0];for(let r=1;r<e.length;r++)n+=String(t[r-1]??"")+e[r];return{_$webjsCss:!0,text:n}}function Qt(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Zt(e,t){if(!(!t||!t.length))if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){let n=t.map(r=>{let o=new CSSStyleSheet;return o.replaceSync(r.text),o});e.adoptedStyleSheets=n}else{let n=e,r=document.createElement("style");r.textContent=t.map(o=>o.text).join(`
|
|
4
4
|
`),n.appendChild(r)}}function Ss(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
|
|
5
|
-
`)}</style>`}var en=Object.freeze({"@":"event",".":"prop","?":"bool"});function gr(e){return Object.prototype.hasOwnProperty.call(en,e)}function As(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Es(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}var _r=Symbol.for("webjs.repeat");function wr(e,t,n){return{[_r]:!0,items:[...e],keyFn:t,templateFn:n}}function Xe(e){return!!e&&typeof e=="object"&&e[_r]===!0}function vs(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function tn(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function Cs(e){return{_$webjs:"live",value:e}}function nn(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function Ts(e,t){return{_$webjs:"keyed",key:e,value:t}}function Qe(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ns(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Ze(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function ks(e){return{_$webjs:"template-content",template:e}}function rn(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function xs(e){return{_$webjs:"ref",target:e}}function et(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function js(){return{value:void 0}}function Rs(e){return{_$webjs:"cache",value:e}}function tt(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Os(...e){return{_$webjs:"until",args:e}}function nt(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function Ls(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function on(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ms(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function sn(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Ps(e){return{_$webjs:"watch",signal:e}}function rt(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var I=null,J=!1,me=0,he=null,an=0,Sr=(e,t)=>Object.is(e,t),st=()=>{},Ar=()=>!1;function Er(e,t){e.liveConsumers||(e.liveConsumers=new Set);let n=e.liveConsumers.size===0;if(e.liveConsumers.add(t),n){if(e.producers&&e.producers.length>0)for(let r of e.producers)Er(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function Le(e,t){if(e.liveConsumers&&(e.liveConsumers.delete(t),e.liveConsumers.size===0)){if(e.producers&&e.producers.length>0)for(let n of e.producers)Le(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function pn(e){if(J)throw new Error("Signal read during notification phase");if(I===null)return;let t=I,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&un(t)&&Le(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,un(t)&&Er(e,t)),t.producerLastReadVersions[n]=e.version}function un(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function vr(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=J;J=!0;try{for(let n of e.liveConsumers)n.dirty||Is(n)}finally{J=t}}function Is(e){e.dirty=!0,vr(e),e.consumerMarkedDirty.call(e.wrapper||e)}function it(e){if(!(!e.dirty&&e.lastCleanEpoch===me)){if(!e.producerMustRecompute()&&!Ds(e)){e.dirty=!1,e.lastCleanEpoch=me;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=me}}function Ds(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(it(n),r!==n.version))return!0}return!1}function fn(e){e&&(e.nextProducerIndex=0);let t=I;return I=e,t}function dn(e,t){if(I=t,!!e){if(un(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)Le(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var at=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=me,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Ar,this.producerRecomputeValue=st,this.consumerMarkedDirty=st,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||Sr,this.watched=n?.[hn],this.unwatched=n?.[mn]}get(){return pn(this),this.__value}peek(){return this.__value}set(t){if(J)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,me++,he!==null?Cr(this):vr(this))}};function Cr(e){let t=J;J=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?he.add(n):Cr(n))}finally{J=t}}var cn=Symbol("unset"),ln=Symbol("computing"),ot=Symbol("errored"),Me=class{constructor(t,n){this.__fn=t,this.__value=cn,this.__error=null,this.version=0,this.lastCleanEpoch=-1,this.dirty=!0,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!1,this.wrapper=this,this.__isSignal=!0,this.__isComputed=!0,this.__equal=n?.equals||Sr,this.watched=n?.[hn],this.unwatched=n?.[mn];let r=this;this.producerMustRecompute=function(){return r.__value===cn||r.__value===ln},this.producerRecomputeValue=function(){if(r.__value===ln)throw new Error("Detected cycle in computations.");let o=r.__value;r.__value=ln;let s=fn(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=ot,r.__error=l,a=!0}finally{dn(r,s)}if(!a&&(o!==cn&&o!==ot)&&r.__equal.call(r.wrapper,o,i)){r.__value=o;return}r.__value=i,r.version++},this.consumerMarkedDirty=st}get(){if(it(this),pn(this),this.__value===ot)throw this.__error;return this.__value}peek(){if(it(this),this.__value===ot)throw this.__error;return this.__value}},ct=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=me,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=Ar,this.producerRecomputeValue=st,this.wrapper=this,this.__isWatcher=!0;let n=this;this.consumerMarkedDirty=function(){n.__fire()}}__fire(){this.__notify&&this.__notify.call(this)}watch(...t){if(t.length===0){this.dirty=!1;return}let n=fn(this);try{for(let r of t)pn(r),r.__isComputed&&it(r)}finally{dn(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(Le(this.producers[n],this),this.producers.splice(n,1),this.producerLastReadVersions.splice(n,1),this.nextProducerIndex=Math.min(this.nextProducerIndex,this.producers.length))}getPending(){return this.producers.filter(t=>t.__isComputed&&t.dirty)}observe(t){let n=fn(this),r;try{r=t()}finally{dn(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)Le(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},hn=Symbol("watched"),mn=Symbol("unwatched");function Fs(e){let t=I;I=null;try{return e()}finally{I=t}}function Bs(e){return e.producers.slice()}function Us(e){return e.liveConsumers?[...e.liveConsumers]:[]}function $s(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Hs(e){return e.producers.length>0}function qs(){return I&&I.__isComputed?I:null}function Vs(e){an++,he===null&&(he=new Set);try{e()}finally{if(an--,an===0){let t=he;he=null;for(let n of t)n.__fire()}}}var Pe={State:at,Computed:Me,subtle:{Watcher:ct,untrack:Fs,introspectSources:Bs,introspectSinks:Us,hasSinks:$s,hasSources:Hs,currentComputed:qs,watched:hn,unwatched:mn}};function Ws(e,t){return new at(e,t)}function zs(e,t){return new Me(e,t)}function Ks(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Ys(e){let t=!1,n=!1,r=new Me(e),o=new ct(()=>{t||n||(t=!0,queueMicrotask(()=>{if(t=!1,!n){try{r.get()}catch(s){console.error(s)}o.watch()}}))});o.watch(r);try{r.get()}catch(s){console.error(s)}return()=>{n||(n=!0,o.dispose())}}yt();function Gr(e,t){let n=e&&e[S]?e:null;return n?pt(n,t):t()}var Kr=new WeakMap,bt=Symbol.for("webjs.instance");function Se(e,t){let n=t,r=n[k];n[k]=!0;try{let o=n[bt];if(O(e)){let s=e;if(o&&o.strings===s.strings){_e(o,s.values);return}o&&Yr(o,t);let i=t.firstChild;i&&i.nodeType===8&&i.data==="webjs-hydrate"&&i.remove(),n[bt]=null;let a=pi(s,t);n[bt]=a;return}if(o&&Yr(o,t),n[bt]=null,t.replaceChildren(),e==null||e===!1||e===!0)return;if(Array.isArray(e)){for(let s of e){let i=document.createTextNode(String(s??""));t.appendChild(i)}return}t.appendChild(document.createTextNode(String(e)))}finally{n[k]=r,r||jn(n)}}function _t(e){let{strings:t}=e,n=Kr.get(t);if(n)return n;let r=[],o="",s="text",i="",a=0,c="",l=0,u=null,f="",d="";for(let m=0;m<t.length;m++){let w=t[m];for(let y=0;y<w.length;y++){let p=w[y];switch(s){case"text":o+=p,p==="<"&&(s="tag-open");break;case"tag-open":o+=p,p==="!"?s="bang-1":p==="/"?(s="tag-name",f=""):/[a-zA-Z]/.test(p)?(s="tag-name",f=p.toLowerCase()):s="text";break;case"bang-1":o+=p,s=p==="-"?"bang-dash":"tag-name";break;case"bang-dash":o+=p,p==="-"?(s="comment",l=0):s="tag-name";break;case"comment":o+=p,p==="-"?l+=1:(p===">"&&l>=2&&(s="text"),l=0);break;case"tag-name":o+=p,p===">"?(s=f==="script"||f==="style"?"rawtext":"text",s==="rawtext"&&(d="")):/\s/.test(p)?s="in-tag":f+=p.toLowerCase();break;case"in-tag":o+=p,p===">"?(s=f==="script"||f==="style"?"rawtext":"text",s==="rawtext"&&(d="")):!/\s/.test(p)&&p!=="/"&&(s="attr-name",i=p,a=o.length-1);break;case"rawtext":o+=p,d=(d+p.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(s="text",d="",f="");break;case"attr-name":p==="="?(s="after-eq",o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(i+=p,o+=p);break;case"after-eq":p==='"'||p==="'"?(s="attr-quoted",c=p,o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(s="attr-unquoted",o+=p);break;case"attr-unquoted":/\s/.test(p)?(s="in-tag",i="",o+=p):(p===">"&&(s="text",i=""),o+=p);break;case"attr-quoted":o+=p,p===c&&(s="in-tag",i="");break;case"skip-attr":if(p===c){if(u){let j=u.firstPartIdx,R=[];for(let N=j;N<r.length;N++)(r[N].kind==="noop"||r[N].kind==="attr-mixed")&&R.push(N);let b=[],P=t[R[0]],Oe=P.lastIndexOf(c);b.push(Oe>=0?P.slice(Oe+1):P);for(let N=1;N<R.length;N++)b.push(t[R[N]]);let re=t[R[R.length-1]+1],T=re.indexOf(c);b.push(T>=0?re.slice(0,T):re),r[j]={kind:"attr-mixed",path:[],name:u.name,statics:b,group:R};for(let N=1;N<R.length;N++)r[R[N]]={kind:"noop",path:[],mixedAnchor:j};u=null}s="in-tag",i=""}break}}if(m<t.length-1){let y=r.length;if(s==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(s==="rawtext"){d="",r.push({kind:"noop",path:[]});continue}if(s==="text")o+=`<!--${A}${y}-->`,r.push({kind:"child",path:[]});else if(s==="in-tag"){let p=`data-${A}${y}`;o+=`${p}=""`,r.push({kind:"element",path:[]})}else if(s==="after-eq"){let p=i[0],j=i.slice(1);if(gr(p)){o=o.slice(0,a);let R=en[p],b=`data-${A}${y}`;o+=`${b}=""`,r.push({kind:R,path:[],name:j})}else{o=o.slice(0,a);let R=`data-${A}${y}`;o+=`${R}=""`,r.push({kind:"attr",path:[],name:i})}s="in-tag",i=""}else if(s==="attr-quoted"||s==="attr-unquoted"){o=o.slice(0,a);let p=`data-${A}${y}`;o+=`${p}=""`,u={name:i,firstPartIdx:y},r.push({kind:"noop",path:[]}),s="skip-attr"}else s==="skip-attr"&&r.push({kind:"noop",path:[]})}}let h=document.createElement("template");return h.innerHTML=o,fi(h.content,r),di(h.content,r),n={templateEl:h,parts:r},Kr.set(t,n),n}function fi(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(E,"");let o=t.length;r.setAttribute(`data-${A}${o}`,""),t.push({kind:"slot",path:[]})}}function di(e,t){let n=[];function r(o){for(let s=0;s<o.childNodes.length;s++){let i=o.childNodes[s];if(n.push(s),i.nodeType===8){let a=i.data;if(a.startsWith(A)){let c=Number(a.slice(A.length));t[c]&&t[c].kind==="child"&&(t[c].path=n.slice())}}else if(i.nodeType===1){let a=i,c=[];for(let l of a.attributes)if(l.name.startsWith(`data-${A}`)){let u=Number(l.name.slice(`data-${A}`.length));t[u]&&t[u].kind!=="child"&&(t[u].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function pi(e,t){let{templateEl:n,parts:r}=_t(e),o=n.content.cloneNode(!0),s=document.createComment(`${A}s`),i=document.createComment(`${A}e`),a=r.map(u=>wt(u,o)),c=[];for(let u=0;u<e.values.length;u++)U(a[u],e.values[u],void 0,e.values),c.push(e.values[u]);t.replaceChildren(s,...o.childNodes,i);let l=t.nodeType===1&&t[S]?t:null;for(let u of a)u.kind==="slot"&&(l&&u.slotEl&&(u.slotEl[dt]=l),U(u,void 0,void 0,[]));return{strings:e.strings,bound:a,lastValues:c,startNode:s,endNode:i}}function wt(e,t){if(e.kind==="noop")return{kind:"noop",mixedAnchor:e.mixedAnchor};let n=t;for(let o of e.path)n=n.childNodes[o];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let o={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(s){o.handler?.(s)}};return r.addEventListener(o.name,o.dispatcher),o}if(e.kind==="attr")return{kind:"attr",el:r,name:e.name||""};if(e.kind==="attr-mixed")return{kind:"attr-mixed",el:r,name:e.name||"",statics:e.statics||[],group:e.group||[]};if(e.kind==="prop")return{kind:"prop",el:r,name:e.name||""};if(e.kind==="bool")return{kind:"bool",el:r,name:e.name||""};if(e.kind==="element")return{kind:"element",el:r};if(e.kind==="slot")return{kind:"slot",slotEl:r,applied:!1};throw new Error(`unknown part kind ${e.kind}`)}function _e(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(Object.is(r,e.lastValues[n]))continue;let o=e.bound[n],s=o.mixedAnchor;o.kind==="noop"&&s!=null?U(e.bound[s],t[s],e.lastValues[s],t):U(o,r,e.lastValues[n],t),e.lastValues[n]=r}}function Yr(e,t){for(let n of e.bound){if(n.kind==="event"&&n.el.removeEventListener(n.name,n.dispatcher),n.kind==="element"){let r=n.lastTarget;if(r){if(typeof r=="function")try{r(void 0)}catch{}else typeof r=="object"&&(r.value=void 0);n.lastTarget=void 0,n.__lastEl=void 0}}if(n.kind==="slot"){let r=Fe(n.slotEl);r&&zr(r,n.slotEl)}}t.replaceChildren()}function U(e,t,n,r){if(nn(t)){let o=t.value;if(e.kind==="prop"&&e.el[e.name]===o||e.kind==="attr"&&e.el.getAttribute(e.name)===String(o)||e.kind==="bool"&&e.el.hasAttribute(e.name)===!!o)return;t=o}switch(e.kind){case"child":yi(e,t);break;case"attr":{t==null||t===!1?e.el.removeAttribute(e.name):e.el.setAttribute(e.name,String(t));break}case"prop":e.el[e.name]=t;break;case"bool":t?e.el.setAttribute(e.name,""):e.el.removeAttribute(e.name);break;case"event":e.handler=typeof t=="function"?t:null;break;case"element":mi(e,t);break;case"attr-mixed":{let o=e,s=o.statics[0];for(let i=0;i<o.group.length;i++)s+=String((r?r[o.group[i]]:t)??""),s+=o.statics[i+1]||"";e.el.setAttribute(e.name,s);break}case"slot":{if(e.applied)break;let o=e.slotEl,s=()=>{let a=Fe(o);if(!a){e.applied=!0;return}if(!a.contains(o)){a.isConnected?queueMicrotask(s):e.applied=!0;return}if(e.applied=!0,hi(o))return;let c=document.createDocumentFragment();for(;o.firstChild;)c.appendChild(o.firstChild);o[De]=c,queueMicrotask(()=>z(a))},i=Fe(o);i&&i.contains(o)?s():queueMicrotask(s);break}case"noop":break}}function Fe(e){let t=e[dt];if(t&&t.isConnected)return t;let n=e.parentElement;for(;n;){if(n[S])return n;n=n.parentElement}return null}function hi(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.nodeType===11&&r.host)return!0;t=r}return!1}function mi(e,t){let n=e,r=et(t)?t.target:void 0,o=n.__refTarget,s=r!==o;if(s&&o)if(typeof o=="function")try{o(void 0)}catch{}else typeof o=="object"&&(o.value=void 0);if(s||n.__refElement!==e.el){if(n.__refTarget=r,r)if(typeof r=="function"){if(!s&&n.__refElement!==void 0)try{r(void 0)}catch{}try{r(e.el)}catch{}}else typeof r=="object"&&(r.value=e.el);n.__refElement=e.el,e.lastTarget=r}}function yi(e,t){return Ti(e,t),B(e,t)}function B(e,t){return Gr(e.marker&&e.marker.parentNode,()=>bi(e,t))}function bi(e,t){let n=e.marker;if(tn(t)){Z(e);let o=String(t.value??""),s=document.createElement("template");s.innerHTML=o;let i=[...s.content.childNodes],a=document.createDocumentFragment();for(let c of i)a.appendChild(c);n.parentNode?.insertBefore(a,n),e.child=i;return}if(Qe(t)){let o=t,s=e.__keyedKey;s!==void 0&&!Object.is(s,o.key)&&Z(e),e.__keyedKey=o.key,B(e,o.value);return}if(Ze(t)){let o=t,s=e.__guardDeps,i=o.deps;if(s!==void 0&&(Array.isArray(s)&&Array.isArray(i)?Ci(s,i):Object.is(s,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,B(e,o.fn());return}if(rn(t)){Z(e);let o=t.template;if(o&&o.content){let s=o.content.cloneNode(!0),i=[...s.childNodes];n.parentNode?.insertBefore(s,n),e.child=i}return}if(et(t))return;if(tt(t))return Ni(e,t.value);if(nt(t))return ki(e,t.args);if(rt(t))return xi(e,t.signal);if(on(t))return ji(e,t);if(sn(t))return Ri(e,t);if(Xe(t)){if(e.child&&e.child.kind==="repeat"){wi(e,t);return}Z(e);let o={kind:"repeat",map:new Map};e.child=o,_i(n,o,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){Ei(e,t);return}Z(e);let o={kind:"array",items:[]};e.child=o,Ai(n,o,t);return}if(e.child){let o=e.child;if(o.kind==="repeat")Jr(o),e.child=void 0;else if(o.kind==="array")Qr(o),e.child=void 0;else if(o.kind==="async-stream")no(o),e.child=void 0;else if("strings"in e.child){let s=e.child;if(O(t)&&s.strings===t.strings){_e(s,t.values);return}we(s.startNode,s.endNode),e.child=void 0}else{for(let s of e.child)s.parentNode&&s.parentNode.removeChild(s);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(O(t)){let o=t,{templateEl:s,parts:i}=_t(o),a=s.content.cloneNode(!0),c=document.createComment(`${A}s`),l=document.createComment(`${A}e`),u=i.map(h=>wt(h,a)),f=[];for(let h=0;h<o.values.length;h++)U(u[h],o.values[h],void 0,o.values),f.push(o.values[h]);let d=[c,...a.childNodes,l];n.parentNode?.insertBefore(gi(d),n);for(let h of u)h.kind==="slot"&&U(h,void 0,void 0,[]);e.child={strings:o.strings,bound:u,lastValues:f,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function gi(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function we(e,t){if(!e.parentNode)return;let n=e;for(;n&&n!==t;){let r=n.nextSibling;n.parentNode?.removeChild(n),n=r}t.parentNode===e.parentNode&&t.parentNode?.removeChild(t)}function On(e){let{templateEl:t,parts:n}=_t(e),r=t.content.cloneNode(!0),o=document.createComment(`${A}s`),s=document.createComment(`${A}e`),i=n.map(l=>wt(l,r)),a=[];for(let l=0;l<e.values.length;l++)U(i[l],e.values[l],void 0,e.values),a.push(e.values[l]);for(let l of i)l.kind==="slot"&&U(l,void 0,void 0,[]);let c=document.createDocumentFragment();for(c.appendChild(o);r.firstChild;)c.appendChild(r.firstChild);return c.appendChild(s),{inst:{strings:e.strings,bound:i,lastValues:a,startNode:o,endNode:s},frag:c}}function Be(e){for(let t of e.bound)if(t.kind==="event"&&t.el.removeEventListener(t.name,t.dispatcher),t.kind==="element"){let n=t.lastTarget;if(n){if(typeof n=="function")try{n(void 0)}catch{}else typeof n=="object"&&(n.value=void 0);t.lastTarget=void 0,t.__lastEl=void 0}}}function _i(e,t,n){let{items:r,keyFn:o,templateFn:s}=n,i=e.parentNode;if(!i)return;let a=document.createDocumentFragment();for(let c=0;c<r.length;c++){let l=o(r[c],c),u=s(r[c],c);if(!O(u))continue;let{inst:f,frag:d}=On(u);t.map.set(l,f),a.appendChild(d)}i.insertBefore(a,e)}function wi(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,{items:s,keyFn:i,templateFn:a}=t,c=new Map;for(let l=0;l<s.length;l++){let u=i(s[l],l),f=a(s[l],l);if(!O(f))continue;let d=o.map.get(u);if(d&&d.strings===f.strings)_e(d,f.values),Rn(d.startNode,d.endNode,r,n),c.set(u,d),o.map.delete(u);else{d&&(Be(d),we(d.startNode,d.endNode),o.map.delete(u));let{inst:h,frag:m}=On(f);r.insertBefore(m,n),c.set(u,h)}}for(let l of o.map.values())Be(l),we(l.startNode,l.endNode);o.map=c}function Jr(e){for(let t of e.map.values())Be(t),we(t.startNode,t.endNode);e.map.clear()}function Si(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function gt(e){e.type==="tpl"?(Be(e.inst),we(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function Xr(e){if(O(e)){let{inst:t,frag:n}=On(e);return{item:{type:"tpl",inst:t},frag:n}}if(e!=null&&e!==!1&&e!==!0){let t=document.createTextNode(String(e));return{item:{type:"text",node:t},frag:t}}return{item:{type:"empty"},frag:null}}function Ai(e,t,n){let r=e.parentNode;if(!r)return;let o=document.createDocumentFragment(),s=[];for(let i of n){let{item:a,frag:c}=Xr(i);c&&o.appendChild(c),s.push(a)}r.insertBefore(o,e),t.items=s}function Ei(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,s=o.items,i=[];for(let a=0;a<t.length;a++){let c=t[a],l=s[a];if(O(c)){let d=c;if(l&&l.type==="tpl"&&l.inst.strings===d.strings){_e(l.inst,d.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let d=String(c);l.node.data!==d&&(l.node.data=d),i.push(l);continue}}else{l&>(l),i.push({type:"empty"});continue}let{item:u,frag:f}=Xr(c);f&&r.insertBefore(f,vi(s,a,n)),l&>(l),i.push(u)}for(let a=t.length;a<s.length;a++)gt(s[a]);o.items=i}function vi(e,t,n){for(let r=t;r<e.length;r++){let o=Si(e[r]);if(o&&o.parentNode)return o}return n}function Qr(e){for(let t of e.items)gt(t);e.items=[]}function Rn(e,t,n,r){if(t.nextSibling===r&&e.parentNode===n)return;let o=document.createDocumentFragment(),s=e;for(;s;){let i=s.nextSibling;if(o.appendChild(s),s===t)break;s=i}n.insertBefore(o,r)}function Ci(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Z(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&Zr(t),!e.child)return;let n=e.child;if(n.kind==="repeat")Jr(n);else if(n.kind==="array")Qr(n);else if(n.kind==="async-stream")no(n);else if("strings"in n){let r=e.child;Be(r),we(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Ti(e,t){let n=e;n.__untilState&&!nt(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Ze(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!tt(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!Qe(t)&&(n.__keyedKey=void 0),n.__watchSub&&!rt(t)&&Zr(n)}function Ni(e,t){let n=e.marker,r=e,o=r.__cacheMap;o||(o=new Map,r.__cacheMap=o);let s=e.child;if(s&&"strings"in s){let a=s;if(O(t)&&a.strings===t.strings){_e(a,t.values);return}let c=document.createDocumentFragment();Rn(a.startNode,a.endNode,c,null),o.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(O(t)){let a=t,c=o.get(a.strings);if(c){o.delete(a.strings),e.child&&Z(e),Rn(c.inst.startNode,c.inst.endNode,n.parentNode,n),_e(c.inst,a.values),e.child=c.inst;let l=new Set;for(let u=c.inst.startNode.nextSibling;u&&u!==c.inst.endNode;u=u.nextSibling){if(u.nodeType!==1)continue;let f=u;if(f.matches("slot[data-webjs-light]")){let d=Fe(f);d&&l.add(d)}for(let d of f.querySelectorAll("slot[data-webjs-light]")){let h=Fe(d);h&&l.add(h)}}for(let u of l)z(u);return}}B(e,t)}function ki(e,t){let n=e,r=n.__untilState,o=n.__untilArgs,s=(d,h)=>!!(Object.is(d,h)||O(d)&&O(h)&&d.strings===h.strings),a=o&&o.length===t.length&&o.every((d,h)=>s(d,t[h]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let c={aborted:!1,highestResolved:a};n.__untilState=c;let l=-1,u;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,u=h;break}}l!==-1&&l<=c.highestResolved?(B(e,u),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&B(e,""),n.__untilEverRendered=!0;let f=Math.min(l===-1?t.length:l,c.highestResolved);for(let d=0;d<f;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(m=>{c.aborted||d>=c.highestResolved||(c.highestResolved=d,B(e,m))},()=>{})}}function xi(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let s;n.__watchSub.observe(()=>{s=t.get()}),B(e,s);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new Pe.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let s;r.observe(()=>{s=t.get()}),B(e,s)})});n.__watchSub=r;let o;r.observe(()=>{o=t.get()}),B(e,o)}function Zr(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function ji(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;Z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,eo(o,e,t)}function Ri(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;Z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,eo(o,e,t)}async function eo(e,t,n){let r=t.marker,o=0;try{for(;!e.aborted;){let s=await e.iterator.next();if(e.aborted||s.done)break;let i=n.mapper?n.mapper(s.value,o):s.value,a=to(i);Gr(r.parentNode,()=>{if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let c=document.createDocumentFragment();for(let l of a)c.appendChild(l);r.parentNode?.insertBefore(c,r),e.nodes.push(...a)}),o++}}catch(s){typeof console<"u"&&console.error("[webjs] asyncStream error:",s)}}function to(e){if(e==null||e===!1||e===!0)return[];if(O(e)){let t=e,{templateEl:n,parts:r}=_t(t),o=n.content.cloneNode(!0),s=r.map(i=>wt(i,o));for(let i=0;i<t.values.length;i++)U(s[i],t.values[i],void 0,t.values);for(let i of s)i.kind==="slot"&&U(i,void 0,void 0,[]);return[...o.childNodes]}if(Array.isArray(e)){let t=[];for(let n of e)t.push(...to(n));return t}return[document.createTextNode(String(e))]}function no(e){e.aborted=!0;for(let t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);e.nodes=[];try{e.iterator.return?.()?.catch?.(()=>{})}catch{}}var ro=null;function St(e){ro=e||null}function Oi(){return ro||void 0}var oo=Symbol.for("webjs:registry"),so=Symbol.for("webjs:classToTag"),At=globalThis,$=At[oo]||(At[oo]=new Map),io=At[so]||(At[so]=new WeakMap),Et=typeof window<"u"&&typeof customElements<"u";function Ln(e,t){if(!e||typeof e!="string"||!e.includes("-"))throw new Error(`customElements.define: tag "${e}" must contain a hyphen (HTML spec)`);let n=t.lazy===!0,r=$.get(e);r?(r.cls=t,r.lazy=n):$.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),io.set(t,e)}if(Et){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),Ln(t,n)}}if(!Et){let e=globalThis;e.customElements||(e.customElements={define(t,n){Ln(t,n)},get(t){return $.get(t)?.cls},upgrade(){},whenDefined(t){let n=$.get(t);return Promise.resolve(n?.cls)}})}function Mn(e,t){Et?customElements.define(e,t):Ln(e,t)}function Li(e,t){if(Et)return;let n=$.get(e);if(n){n.moduleUrl=t;return}$.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function Mi(e){return $.get(e)?.cls}function Pi(e){return $.get(e)?.moduleUrl||null}function Ii(e){return $.get(e)?.lazy===!0}function vt(e){return io.get(e)}function Di(){return[...$.keys()]}He();yt();var ho=typeof window<"u"&&typeof HTMLElement<"u";function Ji(e,t){return e!==t}function Xi(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var Ct=class{constructor(){this.__ssrAttrs=new Map,this.__internals=null}get attributes(){return[...this.__ssrAttrs].map(([t,n])=>({name:t,value:n}))}getAttribute(t){let n=this.__ssrAttrs.get(String(t).toLowerCase());return n===void 0?null:n}setAttribute(t,n){this.__ssrAttrs.set(String(t).toLowerCase(),String(n))}removeAttribute(t){this.__ssrAttrs.delete(String(t).toLowerCase())}hasAttribute(t){return this.__ssrAttrs.has(String(t).toLowerCase())}toggleAttribute(t,n){let r=String(t).toLowerCase(),o=this.__ssrAttrs.has(r);return(n===void 0?!o:n)?(this.__ssrAttrs.set(r,""),!0):(this.__ssrAttrs.delete(r),!1)}getAttributeNames(){return[...this.__ssrAttrs.keys()]}closest(t){let n=String(t).trim().toLowerCase();if(!/^[a-z][a-z0-9-]*$/.test(n))return null;if(this.__ssrTag===n)return this;let r=this.__ssrAncestors;if(!Array.isArray(r))return null;for(let o=r.length-1;o>=0;o--)if(r[o]&&r[o].__ssrTag===n)return r[o];return null}get dataset(){if(this.__dataset)return this.__dataset;let t=this,n=r=>"data-"+String(r).replace(/[A-Z]/g,o=>"-"+o.toLowerCase());return this.__dataset=new Proxy({},{get(r,o){if(typeof o!="string")return;let s=t.getAttribute(n(o));return s===null?void 0:s},set(r,o,s){return typeof o=="string"&&t.setAttribute(n(o),s),!0},has(r,o){return typeof o=="string"&&t.hasAttribute(n(o))},deleteProperty(r,o){return typeof o=="string"&&t.removeAttribute(n(o)),!0},ownKeys(){return t.getAttributeNames().filter(r=>r.startsWith("data-")).map(r=>r.slice(5).replace(/-([a-z])/g,(o,s)=>s.toUpperCase()))},getOwnPropertyDescriptor(r,o){if(typeof o=="string"&&t.hasAttribute(n(o)))return{enumerable:!0,configurable:!0,value:t.getAttribute(n(o))}}}),this.__dataset}get className(){return this.getAttribute("class")??""}set className(t){this.setAttribute("class",t)}get hidden(){return this.hasAttribute("hidden")}set hidden(t){this.toggleAttribute("hidden",!!t)}get id(){return this.getAttribute("id")??""}set id(t){this.setAttribute("id",t)}get title(){return this.getAttribute("title")??""}set title(t){this.setAttribute("title",t)}get slot(){return this.getAttribute("slot")??""}set slot(t){this.setAttribute("slot",t)}get role(){return this.getAttribute("role")}set role(t){t==null?this.removeAttribute("role"):this.setAttribute("role",t)}get tabIndex(){let t=this.getAttribute("tabindex");return t===null?-1:Number.parseInt(t,10)||0}set tabIndex(t){this.setAttribute("tabindex",String(t))}addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return this.__internals=Xi(),this.__internals}},Qi=["ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText"];for(let e of Qi){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(Ct.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Zi=ho?HTMLElement:Ct,mo=Symbol("webjs.factoryProps"),fo=new WeakSet,Ae=class e extends Zi{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Mn(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!(typeof t[n]=="object"&&t[n].state)).map(n=>typeof t[n]=="object"&&t[n].attribute||In(n))}constructor(){super(),this._renderRoot=null,this._scheduled=!1,this._connected=!1,this.__controllers=new Set,this.__firstRendered=!1,this._changedProperties=new Map,this._updateResolve=null,this._updatePromise=Promise.resolve(!0),this._isUpdating=!1,this._assertFactoryProperties(),this._initializeProperties()}_assertFactoryProperties(){let t=this.constructor;if(fo.has(t))return;let n=t;for(;n&&n!==e;){if(Object.hasOwn(n,"properties")&&!Object.hasOwn(n,mo)){let r=n.name||"a component";throw new Error(`${r}: \`static properties\` is no longer supported. Declare reactive properties via the factory instead: \`class ${r} extends WebComponent({ count: Number })\`. Use the \`prop()\` helper for options (\`prop(Number, { reflect: true })\`) and set defaults in the constructor after \`super()\`. See https://docs.webjs.dev/docs/components.`)}n=Object.getPrototypeOf(n)}fo.add(t)}_initializeProperties(){let n=this.constructor.properties;if(!(!n||typeof n!="object")){this.__propValues={};for(let[r,o]of Object.entries(n)){let s=typeof o=="object"?o:{type:o},i=this[r];Object.defineProperty(this,r,{configurable:!0,enumerable:!0,get:()=>this.__propValues[r],set:a=>{let c=this.__propValues[r];(s.hasChanged||Ji)(a,c)&&(this.__propValues[r]=a,s.reflect&&!s.state&&this._connected&&this._reflectAttribute(r,a,s),this.requestUpdate(r,c))}}),i!==void 0?this.__propValues[r]=i:s.default!==void 0&&(this.__propValues[r]=typeof s.default=="function"?s.default():s.default)}}}_reflectAttribute(t,n,r){let o=r.attribute||In(t);if(!this.__reflectingAttribute){this.__reflectingAttribute=!0;try{if(r.converter&&r.converter.toAttribute){let s=r.converter.toAttribute(n,r.type);s==null?this.removeAttribute(o):this.setAttribute(o,s)}else r.type===Boolean?n?this.setAttribute(o,""):this.removeAttribute(o):n==null?this.removeAttribute(o):r.type===Object||r.type===Array?this.setAttribute(o,JSON.stringify(n)):this.setAttribute(o,String(n))}finally{this.__reflectingAttribute=!1}}}connectedCallback(){if(!ho)return;if(this.__webjsPropsHydrated||(this.__webjsPropsHydrated=!0,this._hydratePropAttrs()),this.constructor.hydrate==="visible"&&typeof IntersectionObserver<"u"&&!this.__hydrationActivated){this.__hydrationActivated=!1,this.__hydrationObserver=new IntersectionObserver(n=>{for(let r of n)if(r.isIntersecting){this.__hydrationObserver.unobserve(this),this.__hydrationObserver.disconnect(),this.__hydrationObserver=null,this.__hydrationActivated=!0,this._activate();return}},{rootMargin:"200px"}),this.__hydrationObserver.observe(this);return}this._activate()}_hydratePropAttrs(){let t=[],n=this.attributes;for(let r=0;r<n.length;r++){let o=n[r].name;o.startsWith("data-webjs-prop-")&&t.push(o)}for(let r of t){let o=this.getAttribute(r);if(this.removeAttribute(r),o==null)continue;let s=po(r.slice(16));try{this[s]=le(o)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow!==!0&&!this.hasAttribute("data-wj-host")&&this.setAttribute("data-wj-host",""),t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,o=Array.isArray(r)?r:Qt(r)?[r]:[];if(o.length){if(n){let s=this.shadowRoot.querySelector("style");s&&s.remove()}Zt(this._renderRoot,o)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${vt(t)||this.tagName?.toLowerCase()}> has static shadow = false AND static styles. static styles only works with shadow DOM (adoptedStyleSheets). For light DOM, use global CSS or <style> in render().`),xn(this)?$r(this):this.__isHydrating()||this.hasAttribute("data-wj-serialized")||Wr(this)?(this.removeAttribute("data-wj-serialized"),W(this),Or(this)):Rr(this),Vr(this),Fr(this);for(let n of this.__controllers)n.hostConnected&&n.hostConnected();this._updateResolve===null&&(this._updatePromise=new Promise(n=>{this._updateResolve=n})),this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(n){console.error("[webjs] lifecycle hook threw during initial render:",n)}})}__isHydrating(){let t=this.firstChild,n=t!=null&&t.nodeType===8&&t.data==="webjs-hydrate";return n&&(this.__hydratedAtActivate=!0),n}disconnectedCallback(){this._connected=!1,this.__hydrationObserver&&(this.__hydrationObserver.disconnect(),this.__hydrationObserver=null),Ur(this),this.__signalWatcher&&(this.__signalWatcher.dispose(),this.__signalWatcher=void 0);for(let t of this.__controllers)t.hostDisconnected&&t.hostDisconnected()}attributeChangedCallback(t,n,r){if(this.__reflectingAttribute)return;let s=this.constructor.properties||{},i,a;for(let[u,f]of Object.entries(s))if(((typeof f=="object"?f:{type:f}).attribute||In(u))===t){i=u,a=f;break}if(a===void 0&&(i=po(t),a=s[i]||s[t]),a===void 0)return;let c=typeof a=="object"?a:{type:a},l;if(c.converter&&c.converter.fromAttribute)l=c.converter.fromAttribute(r,c.type);else if(c.type===Number)l=r==null?null:Number(r);else if(c.type===Boolean)l=r!=null&&r!=="false";else if(c.type===Object||c.type===Array)try{l=r==null?null:JSON.parse(r)}catch{l=r}else l=r;this[i]!==l&&(this[i]=l,this._connected&&this.requestUpdate())}requestUpdate(t,n){t!==void 0&&!this._changedProperties.has(t)&&this._changedProperties.set(t,n),this._scheduleUpdate()}_scheduleUpdate(){this._updateResolve===null&&(this._updatePromise=new Promise(t=>{this._updateResolve=t})),!this._isUpdating&&(this._scheduled||!this._connected||(this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(t){console.error("[webjs] lifecycle hook threw during update cycle:",t)}})))}_performRender(){if(!this._renderRoot)return;let t=this._changedProperties;this._isUpdating=!0;let n=!1,r=null;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let o of this.__controllers)o.hostUpdate&&o.hostUpdate();this.__renderToken=(this.__renderToken||0)+1,this.__renderAbort&&this.__renderAbort.abort(),this.__renderAbort=typeof AbortController<"u"?new AbortController:null,St(this.__renderAbort?this.__renderAbort.signal:null);try{let o=this.update(t);o&&typeof o.then=="function"&&(r=o)}catch(o){this._handleRenderError(o)}finally{St(null)}if(!r){for(let o of this.__controllers)o.hostUpdated&&o.hostUpdated();n=!0}}}catch(o){console.error("[webjs] lifecycle hook threw during update phase:",o)}finally{this._isUpdating=!1,(n||r)&&(this._changedProperties=new Map)}if(r){let o=this.__renderToken;this.__pendingAsyncCommits=(this.__pendingAsyncCommits||0)+1,r.then(()=>{if(this.__pendingAsyncCommits--,o===this.__renderToken){for(let s of this.__controllers)s.hostUpdated&&s.hostUpdated();this._postCommit(t)}});return}n?this._postCommit(t):this.__pendingAsyncCommits||this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new Pe.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);Se(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&Se(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&Se(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==Tt.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${vt(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&Se(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function In(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function po(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Tt(e){return new.target?Reflect.construct(Ae,arguments,new.target):class extends Ae{static properties=e;static[mo]=!0}}Object.setPrototypeOf(Tt,Ae);Tt.prototype=Ae.prototype;function ea(e,t={}){return e&&typeof e=="object"&&!("call"in e)&&(t=e,e=void 0),{...e?{type:e}:{},...t}}var yo=Symbol.for("webjs.notFound"),bo=Symbol.for("webjs.redirect"),go=Symbol.for("webjs.forbidden"),_o=Symbol.for("webjs.unauthorized");function ta(){let e=new Error("webjs: notFound()");throw e.__webjs=yo,e}function na(){let e=new Error("webjs: forbidden()");throw e.__webjs=go,e}function ra(){let e=new Error("webjs: unauthorized()");throw e.__webjs=_o,e}function oa(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=bo,r.url=e,r.status=typeof n=="number"?n:void 0,r}function sa(e){return!!e&&e.__webjs===yo}function ia(e){return!!e&&e.__webjs===bo}function aa(e){return!!e&&e.__webjs===go}function ca(e){return!!e&&e.__webjs===_o}var wo=null;function la(){if(!wo)return"";try{return wo()||""}catch{return""}}var il=Symbol.for("webjs.suspense");function ua(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function fa(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function da(e,t={}){let n=t.reconnect!==!1,r=0,o=!1,s=null,i=[];function a(){o||(s=new WebSocket(pa(e),t.protocols),s.onopen=c=>{for(r=0;i.length&&s&&s.readyState===WebSocket.OPEN;)s.send(i.shift());t.onOpen?.(c)},s.onmessage=c=>{let l=c.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,c)},s.onerror=c=>{t.onError?.(c)},s.onclose=c=>{if(t.onClose?.(c),!o&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(a,l)}})}return a(),{send(c){let l=typeof c=="string"||c instanceof ArrayBuffer||ArrayBuffer.isView(c)?c:JSON.stringify(c);s&&s.readyState===WebSocket.OPEN?s.send(l):i.push(l)},close(c,l){o=!0;try{s?.close(c,l)}catch{}},get socket(){return s},get readyState(){return s?.readyState??3}}}function pa(e){if(/^wss?:\/\//i.test(e))return e;let t=typeof location<"u"&&location.protocol==="https:"?"wss:":"ws:",n=typeof location<"u"?location.host:"";return`${t}//${n}${e.startsWith("/")?e:"/"+e}`}He();var Dn="application/vnd.webjs+json";async function ha(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",Dn);let r=t.body;r!=null&&typeof r=="object"&&!(r instanceof FormData)&&!(r instanceof Blob)&&!(r instanceof ArrayBuffer)&&!(r instanceof URLSearchParams)&&!(typeof ReadableStream<"u"&&r instanceof ReadableStream)&&!ArrayBuffer.isView(r)&&(r=await Pn(r),n.has("content-type")||n.set("content-type",Dn));let o=await fetch(e,{...t,headers:n,body:r}),s=o.headers.get("content-type")||"",i=await o.text(),a=s.includes(Dn)?i?le(i):null:s.includes("application/json")?i?JSON.parse(i):null:i;if(!o.ok){let c=a&&a.error||`richFetch ${e} -> ${o.status}`,l=new Error(c);throw l.status=o.status,l.body=a,l}return a}He();kt();kt();Un();xt();var pr=class{constructor(t,n){this.host=t,this.options=n,this.updates=[],this._nextId=0}get value(){let t=this.options.source();if(!this.options.update)return this.updates.length>0?this.updates[this.updates.length-1].payload:t;for(let n of this.updates)t=this.options.update(t,n.payload);return t}add(t,n){let r=`opt-${++this._nextId}`;this.updates.push({id:r,payload:t}),this.host?.requestUpdate?.();let o=()=>{let s=this.updates.findIndex(i=>i.id===r);s!==-1&&(this.updates.splice(s,1),this.host?.requestUpdate?.())};return n&&typeof n.then=="function"&&(typeof n.finally=="function"?n.finally(()=>o()).catch(()=>{}):n.then(()=>o(),()=>o())),o}};async function ac(e,t,n){let r=e.get();e.set(t);let o;try{o=await n()}catch(s){throw e.set(r),s}return o&&o.success===!1&&e.set(r),o}function cc(e,t,n){return e&&typeof e.get=="function"&&typeof e.set=="function"?ac(e,t,n):new pr(e,t)}qn();var Gt=0,hs=new Map,Re=new Map,lc=1e3;function uc(e){if(!(!Array.isArray(e)||!e.length)){Gt+=1;for(let t of e)t&&hs.set(t,Gt)}}function fc(){return Gt}function dc(e,t,n){if(!(!Array.isArray(t)||!t.length)&&(Re.delete(e),Re.set(e,{tags:t.slice(),since:typeof n=="number"?n:Gt}),Re.size>lc)){let r=Re.keys().next().value;r!==void 0&&Re.delete(r)}}function pc(e){let t=Re.get(e);if(!t)return!1;for(let n of t.tags)if((hs.get(n)||0)>t.since)return!0;return!1}function hc(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}var mc="application/vnd.webjs+stream",yc=1,bc=2,gc=3,ms=new Uint8Array(0);function _c(e,t){let n=t||ms,r=n.length,o=new Uint8Array(5+r);return o[0]=e&255,o[1]=r>>>24&255,o[2]=r>>>16&255,o[3]=r>>>8&255,o[4]=r&255,r&&o.set(n,5),o}function wc(){let e=ms;return{push(t){if(t&&t.length){let r=new Uint8Array(e.length+t.length);r.set(e,0),r.set(t,e.length),e=r}let n=[];for(;e.length>=5;){let r=e[0],o=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;if(e.length<5+o)break;let s=e.slice(5,5+o);n.push({type:r,payload:s}),e=e.slice(5+o)}return n}}}var Sc=Symbol.for("webjs.context");function Ac(e){return{__context__:Sc,name:e}}var Jt=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},hr=class{constructor(t,{context:n,initialValue:r}){this._host=t,this._context=n,this._value=r,this._subscriptions=new Set,this._onRequest=o=>{let s=o;if(s.context===this._context)if(o.stopPropagation(),s.subscribe){let i={callback:s.callback},a=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),s.callback(this._value,a)}else s.callback(this._value)},typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}setValue(t){if(!Object.is(this._value,t)){this._value=t;for(let n of this._subscriptions){let r=()=>{this._subscriptions.delete(n)};n.callback(t,r)}}}hostConnected(){this._host.addEventListener("context-request",this._onRequest)}hostDisconnected(){this._host.removeEventListener("context-request",this._onRequest),this._subscriptions.clear()}},mr=class{constructor(t,{context:n,subscribe:r=!0}){this._host=t,this._context=n,this._subscribe=r,this._value=void 0,this._unsubscribe=void 0,typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}hostConnected(){this._dispatchRequest()}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=void 0)}_dispatchRequest(){let t=new Jt(this._context,(n,r)=>{let o=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(o,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};function Ec(){return typeof window<"u"}var Y={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},yr=class{constructor(t,{task:n,args:r,autoRun:o=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=o,this._status=Y.INITIAL,this._value=void 0,this._error=void 0,this._abortController=null,this._prevArgs=null,typeof t.addController=="function"&&t.addController(this)}get status(){return this._status}get value(){return this._value}get error(){return this._error}async run(){this.abort();let t=new AbortController;this._abortController=t;let n=this._argsFn();this._prevArgs=n,this._status=Y.PENDING,this._error=void 0,this._requestHostUpdate();try{let r=await this._taskFn(...n,{signal:t.signal});if(t.signal.aborted)return;this._value=r,this._status=Y.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=Y.ERROR,this._value=void 0}finally{this._abortController===t&&(this._abortController=null)}this._requestHostUpdate()}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}render(t={}){switch(this._status){case Y.INITIAL:return t.initial?.();case Y.PENDING:return t.pending?.();case Y.COMPLETE:return t.complete?.(this._value);case Y.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!Ec())return;let t=this._argsFn();this._argsEqual(this._prevArgs,t)||this.run()}hostUpdated(){}hostConnected(){}hostDisconnected(){this.abort()}_requestHostUpdate(){typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()}_argsEqual(t,n){if(t===null||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r])return!1;return!0}};export{mr as ContextConsumer,hr as ContextProvider,Jt as ContextRequestEvent,yc as FRAME_CHUNK,bc as FRAME_END,gc as FRAME_ERROR,A as MARKER,jo as SEED_MISS,mc as STREAM_CONTENT_TYPE,Pe as Signal,ua as Suspense,yr as Task,Y as TaskStatus,Tt as WebComponent,Bn as WebjsFrame,$n as WebjsStream,Oi as activeActionSignal,Zt as adoptStyles,Di as allTags,Ls as asyncAppend,Ms as asyncReplace,Vs as batch,Rs as cache,zs as computed,da as connectWS,pc as consumeStale,Ac as createContext,wc as createFrameDecoder,js as createRef,la as cspNonce,ws as css,lo as deserialize,Po as disableClientRouter,Ys as effect,tr as enableClientRouter,_c as encodeFrame,Es as escapeAttr,As as escapeText,fc as fetchMark,na as forbidden,Ns as guard,_s as html,on as isAsyncAppend,sn as isAsyncReplace,Qt as isCSS,tt as isCache,aa as isForbidden,Ze as isGuard,Qe as isKeyed,Ii as isLazy,nn as isLive,sa as isNotFound,ia as isRedirect,et as isRef,Xe as isRepeat,Ks as isSignal,fa as isSuspense,O as isTemplate,rn as isTemplateContent,ca as isUnauthorized,tn as isUnsafeHTML,nt as isUntil,rt as isWatch,Ts as keyed,Cs as live,Mi as lookup,Pi as lookupModuleUrl,uc as markStale,Io as navigate,ta as notFound,cc as optimistic,le as parse,hc as parseTagHeader,Li as primeModuleUrl,ea as prop,oa as redirect,xs as ref,Mn as register,dc as registerKeyTags,Se as render,Hn as renderStream,wr as repeat,Do as revalidate,ha as richFetch,jt as scanSeeds,co as serialize,St as setActiveActionSignal,Ws as signal,Pn as stringify,Ss as stylesToString,vt as tagOf,Sa as takeSeed,ks as templateContent,ra as unauthorized,vs as unsafeHTML,Os as until,Ps as watch};
|
|
5
|
+
`)}</style>`}var en=Object.freeze({"@":"event",".":"prop","?":"bool"});function gr(e){return Object.prototype.hasOwnProperty.call(en,e)}function As(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Es(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}var _r=Symbol.for("webjs.repeat");function wr(e,t,n){return{[_r]:!0,items:[...e],keyFn:t,templateFn:n}}function Xe(e){return!!e&&typeof e=="object"&&e[_r]===!0}function vs(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function tn(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function Cs(e){return{_$webjs:"live",value:e}}function nn(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function Ts(e,t){return{_$webjs:"keyed",key:e,value:t}}function Qe(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ns(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Ze(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function ks(e){return{_$webjs:"template-content",template:e}}function rn(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function xs(e){return{_$webjs:"ref",target:e}}function et(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function js(){return{value:void 0}}function Rs(e){return{_$webjs:"cache",value:e}}function tt(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Os(...e){return{_$webjs:"until",args:e}}function nt(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function Ls(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function on(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ms(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function sn(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Ps(e){return{_$webjs:"watch",signal:e}}function rt(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var I=null,J=!1,me=0,he=null,an=0,Sr=(e,t)=>Object.is(e,t),st=()=>{},Ar=()=>!1;function Er(e,t){e.liveConsumers||(e.liveConsumers=new Set);let n=e.liveConsumers.size===0;if(e.liveConsumers.add(t),n){if(e.producers&&e.producers.length>0)for(let r of e.producers)Er(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function Le(e,t){if(e.liveConsumers&&(e.liveConsumers.delete(t),e.liveConsumers.size===0)){if(e.producers&&e.producers.length>0)for(let n of e.producers)Le(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function pn(e){if(J)throw new Error("Signal read during notification phase");if(I===null)return;let t=I,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&un(t)&&Le(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,un(t)&&Er(e,t)),t.producerLastReadVersions[n]=e.version}function un(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function vr(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=J;J=!0;try{for(let n of e.liveConsumers)n.dirty||Is(n)}finally{J=t}}function Is(e){e.dirty=!0,vr(e),e.consumerMarkedDirty.call(e.wrapper||e)}function it(e){if(!(!e.dirty&&e.lastCleanEpoch===me)){if(!e.producerMustRecompute()&&!Ds(e)){e.dirty=!1,e.lastCleanEpoch=me;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=me}}function Ds(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(it(n),r!==n.version))return!0}return!1}function fn(e){e&&(e.nextProducerIndex=0);let t=I;return I=e,t}function dn(e,t){if(I=t,!!e){if(un(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)Le(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var at=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=me,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Ar,this.producerRecomputeValue=st,this.consumerMarkedDirty=st,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||Sr,this.watched=n?.[hn],this.unwatched=n?.[mn]}get(){return pn(this),this.__value}peek(){return this.__value}set(t){if(J)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,me++,he!==null?Cr(this):vr(this))}};function Cr(e){let t=J;J=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?he.add(n):Cr(n))}finally{J=t}}var cn=Symbol("unset"),ln=Symbol("computing"),ot=Symbol("errored"),Me=class{constructor(t,n){this.__fn=t,this.__value=cn,this.__error=null,this.version=0,this.lastCleanEpoch=-1,this.dirty=!0,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!1,this.wrapper=this,this.__isSignal=!0,this.__isComputed=!0,this.__equal=n?.equals||Sr,this.watched=n?.[hn],this.unwatched=n?.[mn];let r=this;this.producerMustRecompute=function(){return r.__value===cn||r.__value===ln},this.producerRecomputeValue=function(){if(r.__value===ln)throw new Error("Detected cycle in computations.");let o=r.__value;r.__value=ln;let s=fn(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=ot,r.__error=l,a=!0}finally{dn(r,s)}if(!a&&(o!==cn&&o!==ot)&&r.__equal.call(r.wrapper,o,i)){r.__value=o;return}r.__value=i,r.version++},this.consumerMarkedDirty=st}get(){if(it(this),pn(this),this.__value===ot)throw this.__error;return this.__value}peek(){if(it(this),this.__value===ot)throw this.__error;return this.__value}},ct=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=me,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=Ar,this.producerRecomputeValue=st,this.wrapper=this,this.__isWatcher=!0;let n=this;this.consumerMarkedDirty=function(){n.__fire()}}__fire(){this.__notify&&this.__notify.call(this)}watch(...t){if(t.length===0){this.dirty=!1;return}let n=fn(this);try{for(let r of t)pn(r),r.__isComputed&&it(r)}finally{dn(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(Le(this.producers[n],this),this.producers.splice(n,1),this.producerLastReadVersions.splice(n,1),this.nextProducerIndex=Math.min(this.nextProducerIndex,this.producers.length))}getPending(){return this.producers.filter(t=>t.__isComputed&&t.dirty)}observe(t){let n=fn(this),r;try{r=t()}finally{dn(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)Le(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},hn=Symbol("watched"),mn=Symbol("unwatched");function Fs(e){let t=I;I=null;try{return e()}finally{I=t}}function Bs(e){return e.producers.slice()}function Us(e){return e.liveConsumers?[...e.liveConsumers]:[]}function $s(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Hs(e){return e.producers.length>0}function qs(){return I&&I.__isComputed?I:null}function Vs(e){an++,he===null&&(he=new Set);try{e()}finally{if(an--,an===0){let t=he;he=null;for(let n of t)n.__fire()}}}var Pe={State:at,Computed:Me,subtle:{Watcher:ct,untrack:Fs,introspectSources:Bs,introspectSinks:Us,hasSinks:$s,hasSources:Hs,currentComputed:qs,watched:hn,unwatched:mn}};function Ws(e,t){return new at(e,t)}function zs(e,t){return new Me(e,t)}function Ks(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Ys(e){let t=!1,n=!1,r=new Me(e),o=new ct(()=>{t||n||(t=!0,queueMicrotask(()=>{if(t=!1,!n){try{r.get()}catch(s){console.error(s)}o.watch()}}))});o.watch(r);try{r.get()}catch(s){console.error(s)}return()=>{n||(n=!0,o.dispose())}}yt();function Gr(e,t){let n=e&&e[S]?e:null;return n?pt(n,t):t()}var Kr=new WeakMap,bt=Symbol.for("webjs.instance");function Se(e,t){let n=t,r=n[k];n[k]=!0;try{let o=n[bt];if(O(e)){let s=e;if(o&&o.strings===s.strings){_e(o,s.values);return}o&&Yr(o,t);let i=t.firstChild;i&&i.nodeType===8&&i.data==="webjs-hydrate"&&i.remove(),n[bt]=null;let a=pi(s,t);n[bt]=a;return}if(o&&Yr(o,t),n[bt]=null,t.replaceChildren(),e==null||e===!1||e===!0)return;if(Array.isArray(e)){for(let s of e){let i=document.createTextNode(String(s??""));t.appendChild(i)}return}t.appendChild(document.createTextNode(String(e)))}finally{n[k]=r,r||jn(n)}}function _t(e){let{strings:t}=e,n=Kr.get(t);if(n)return n;let r=[],o="",s="text",i="",a=0,c="",l=0,u=null,f="",d="";for(let m=0;m<t.length;m++){let w=t[m];for(let y=0;y<w.length;y++){let p=w[y];switch(s){case"text":o+=p,p==="<"&&(s="tag-open");break;case"tag-open":o+=p,p==="!"?s="bang-1":p==="/"?(s="tag-name",f=""):/[a-zA-Z]/.test(p)?(s="tag-name",f=p.toLowerCase()):s="text";break;case"bang-1":o+=p,s=p==="-"?"bang-dash":"tag-name";break;case"bang-dash":o+=p,p==="-"?(s="comment",l=0):s="tag-name";break;case"comment":o+=p,p==="-"?l+=1:(p===">"&&l>=2&&(s="text"),l=0);break;case"tag-name":o+=p,p===">"?(s=f==="script"||f==="style"?"rawtext":"text",s==="rawtext"&&(d="")):/\s/.test(p)?s="in-tag":f+=p.toLowerCase();break;case"in-tag":o+=p,p===">"?(s=f==="script"||f==="style"?"rawtext":"text",s==="rawtext"&&(d="")):!/\s/.test(p)&&p!=="/"&&(s="attr-name",i=p,a=o.length-1);break;case"rawtext":o+=p,d=(d+p.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(s="text",d="",f="");break;case"attr-name":p==="="?(s="after-eq",o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(i+=p,o+=p);break;case"after-eq":p==='"'||p==="'"?(s="attr-quoted",c=p,o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(s="attr-unquoted",o+=p);break;case"attr-unquoted":/\s/.test(p)?(s="in-tag",i="",o+=p):(p===">"&&(s="text",i=""),o+=p);break;case"attr-quoted":o+=p,p===c&&(s="in-tag",i="");break;case"skip-attr":if(p===c){if(u){let j=u.firstPartIdx,R=[];for(let N=j;N<r.length;N++)(r[N].kind==="noop"||r[N].kind==="attr-mixed")&&R.push(N);let b=[],P=t[R[0]],Oe=P.lastIndexOf(c);b.push(Oe>=0?P.slice(Oe+1):P);for(let N=1;N<R.length;N++)b.push(t[R[N]]);let re=t[R[R.length-1]+1],T=re.indexOf(c);b.push(T>=0?re.slice(0,T):re),r[j]={kind:"attr-mixed",path:[],name:u.name,statics:b,group:R};for(let N=1;N<R.length;N++)r[R[N]]={kind:"noop",path:[],mixedAnchor:j};u=null}s="in-tag",i=""}break}}if(m<t.length-1){let y=r.length;if(s==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(s==="rawtext"){d="",r.push({kind:"noop",path:[]});continue}if(s==="text")o+=`<!--${A}${y}-->`,r.push({kind:"child",path:[]});else if(s==="in-tag"){let p=`data-${A}${y}`;o+=`${p}=""`,r.push({kind:"element",path:[]})}else if(s==="after-eq"){let p=i[0],j=i.slice(1);if(gr(p)){o=o.slice(0,a);let R=en[p],b=`data-${A}${y}`;o+=`${b}=""`,r.push({kind:R,path:[],name:j})}else{o=o.slice(0,a);let R=`data-${A}${y}`;o+=`${R}=""`,r.push({kind:"attr",path:[],name:i})}s="in-tag",i=""}else if(s==="attr-quoted"||s==="attr-unquoted"){o=o.slice(0,a);let p=`data-${A}${y}`;o+=`${p}=""`,u={name:i,firstPartIdx:y},r.push({kind:"noop",path:[]}),s="skip-attr"}else s==="skip-attr"&&r.push({kind:"noop",path:[]})}}let h=document.createElement("template");return h.innerHTML=o,fi(h.content,r),di(h.content,r),n={templateEl:h,parts:r},Kr.set(t,n),n}function fi(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(E,"");let o=t.length;r.setAttribute(`data-${A}${o}`,""),t.push({kind:"slot",path:[]})}}function di(e,t){let n=[];function r(o){for(let s=0;s<o.childNodes.length;s++){let i=o.childNodes[s];if(n.push(s),i.nodeType===8){let a=i.data;if(a.startsWith(A)){let c=Number(a.slice(A.length));t[c]&&t[c].kind==="child"&&(t[c].path=n.slice())}}else if(i.nodeType===1){let a=i,c=[];for(let l of a.attributes)if(l.name.startsWith(`data-${A}`)){let u=Number(l.name.slice(`data-${A}`.length));t[u]&&t[u].kind!=="child"&&(t[u].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function pi(e,t){let{templateEl:n,parts:r}=_t(e),o=n.content.cloneNode(!0),s=document.createComment(`${A}s`),i=document.createComment(`${A}e`),a=r.map(u=>wt(u,o)),c=[];for(let u=0;u<e.values.length;u++)U(a[u],e.values[u],void 0,e.values),c.push(e.values[u]);t.replaceChildren(s,...o.childNodes,i);let l=t.nodeType===1&&t[S]?t:null;for(let u of a)u.kind==="slot"&&(l&&u.slotEl&&(u.slotEl[dt]=l),U(u,void 0,void 0,[]));return{strings:e.strings,bound:a,lastValues:c,startNode:s,endNode:i}}function wt(e,t){if(e.kind==="noop")return{kind:"noop",mixedAnchor:e.mixedAnchor};let n=t;for(let o of e.path)n=n.childNodes[o];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let o={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(s){o.handler?.(s)}};return r.addEventListener(o.name,o.dispatcher),o}if(e.kind==="attr")return{kind:"attr",el:r,name:e.name||""};if(e.kind==="attr-mixed")return{kind:"attr-mixed",el:r,name:e.name||"",statics:e.statics||[],group:e.group||[]};if(e.kind==="prop")return{kind:"prop",el:r,name:e.name||""};if(e.kind==="bool")return{kind:"bool",el:r,name:e.name||""};if(e.kind==="element")return{kind:"element",el:r};if(e.kind==="slot")return{kind:"slot",slotEl:r,applied:!1};throw new Error(`unknown part kind ${e.kind}`)}function _e(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(Object.is(r,e.lastValues[n]))continue;let o=e.bound[n],s=o.mixedAnchor;o.kind==="noop"&&s!=null?U(e.bound[s],t[s],e.lastValues[s],t):U(o,r,e.lastValues[n],t),e.lastValues[n]=r}}function Yr(e,t){for(let n of e.bound){if(n.kind==="event"&&n.el.removeEventListener(n.name,n.dispatcher),n.kind==="element"){let r=n.lastTarget;if(r){if(typeof r=="function")try{r(void 0)}catch{}else typeof r=="object"&&(r.value=void 0);n.lastTarget=void 0,n.__lastEl=void 0}}if(n.kind==="slot"){let r=Fe(n.slotEl);r&&zr(r,n.slotEl)}}t.replaceChildren()}function U(e,t,n,r){if(nn(t)){let o=t.value;if(e.kind==="prop"&&e.el[e.name]===o||e.kind==="attr"&&e.el.getAttribute(e.name)===String(o)||e.kind==="bool"&&e.el.hasAttribute(e.name)===!!o)return;t=o}switch(e.kind){case"child":yi(e,t);break;case"attr":{t==null||t===!1?e.el.removeAttribute(e.name):e.el.setAttribute(e.name,String(t));break}case"prop":e.el[e.name]=t;break;case"bool":t?e.el.setAttribute(e.name,""):e.el.removeAttribute(e.name);break;case"event":e.handler=typeof t=="function"?t:null;break;case"element":mi(e,t);break;case"attr-mixed":{let o=e,s=o.statics[0];for(let i=0;i<o.group.length;i++)s+=String((r?r[o.group[i]]:t)??""),s+=o.statics[i+1]||"";e.el.setAttribute(e.name,s);break}case"slot":{if(e.applied)break;let o=e.slotEl,s=()=>{let a=Fe(o);if(!a){e.applied=!0;return}if(!a.contains(o)){a.isConnected?queueMicrotask(s):e.applied=!0;return}if(e.applied=!0,hi(o))return;let c=document.createDocumentFragment();for(;o.firstChild;)c.appendChild(o.firstChild);o[De]=c,queueMicrotask(()=>z(a))},i=Fe(o);i&&i.contains(o)?s():queueMicrotask(s);break}case"noop":break}}function Fe(e){let t=e[dt];if(t&&t.isConnected)return t;let n=e.parentElement;for(;n;){if(n[S])return n;n=n.parentElement}return null}function hi(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.nodeType===11&&r.host)return!0;t=r}return!1}function mi(e,t){let n=e,r=et(t)?t.target:void 0,o=n.__refTarget,s=r!==o;if(s&&o)if(typeof o=="function")try{o(void 0)}catch{}else typeof o=="object"&&(o.value=void 0);if(s||n.__refElement!==e.el){if(n.__refTarget=r,r)if(typeof r=="function"){if(!s&&n.__refElement!==void 0)try{r(void 0)}catch{}try{r(e.el)}catch{}}else typeof r=="object"&&(r.value=e.el);n.__refElement=e.el,e.lastTarget=r}}function yi(e,t){return Ti(e,t),B(e,t)}function B(e,t){return Gr(e.marker&&e.marker.parentNode,()=>bi(e,t))}function bi(e,t){let n=e.marker;if(tn(t)){Z(e);let o=String(t.value??""),s=document.createElement("template");s.innerHTML=o;let i=[...s.content.childNodes],a=document.createDocumentFragment();for(let c of i)a.appendChild(c);n.parentNode?.insertBefore(a,n),e.child=i;return}if(Qe(t)){let o=t,s=e.__keyedKey;s!==void 0&&!Object.is(s,o.key)&&Z(e),e.__keyedKey=o.key,B(e,o.value);return}if(Ze(t)){let o=t,s=e.__guardDeps,i=o.deps;if(s!==void 0&&(Array.isArray(s)&&Array.isArray(i)?Ci(s,i):Object.is(s,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,B(e,o.fn());return}if(rn(t)){Z(e);let o=t.template;if(o&&o.content){let s=o.content.cloneNode(!0),i=[...s.childNodes];n.parentNode?.insertBefore(s,n),e.child=i}return}if(et(t))return;if(tt(t))return Ni(e,t.value);if(nt(t))return ki(e,t.args);if(rt(t))return xi(e,t.signal);if(on(t))return ji(e,t);if(sn(t))return Ri(e,t);if(Xe(t)){if(e.child&&e.child.kind==="repeat"){wi(e,t);return}Z(e);let o={kind:"repeat",map:new Map};e.child=o,_i(n,o,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){Ei(e,t);return}Z(e);let o={kind:"array",items:[]};e.child=o,Ai(n,o,t);return}if(e.child){let o=e.child;if(o.kind==="repeat")Jr(o),e.child=void 0;else if(o.kind==="array")Qr(o),e.child=void 0;else if(o.kind==="async-stream")no(o),e.child=void 0;else if("strings"in e.child){let s=e.child;if(O(t)&&s.strings===t.strings){_e(s,t.values);return}we(s.startNode,s.endNode),e.child=void 0}else{for(let s of e.child)s.parentNode&&s.parentNode.removeChild(s);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(O(t)){let o=t,{templateEl:s,parts:i}=_t(o),a=s.content.cloneNode(!0),c=document.createComment(`${A}s`),l=document.createComment(`${A}e`),u=i.map(h=>wt(h,a)),f=[];for(let h=0;h<o.values.length;h++)U(u[h],o.values[h],void 0,o.values),f.push(o.values[h]);let d=[c,...a.childNodes,l];n.parentNode?.insertBefore(gi(d),n);for(let h of u)h.kind==="slot"&&U(h,void 0,void 0,[]);e.child={strings:o.strings,bound:u,lastValues:f,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function gi(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function we(e,t){if(!e.parentNode)return;let n=e;for(;n&&n!==t;){let r=n.nextSibling;n.parentNode?.removeChild(n),n=r}t.parentNode===e.parentNode&&t.parentNode?.removeChild(t)}function On(e){let{templateEl:t,parts:n}=_t(e),r=t.content.cloneNode(!0),o=document.createComment(`${A}s`),s=document.createComment(`${A}e`),i=n.map(l=>wt(l,r)),a=[];for(let l=0;l<e.values.length;l++)U(i[l],e.values[l],void 0,e.values),a.push(e.values[l]);for(let l of i)l.kind==="slot"&&U(l,void 0,void 0,[]);let c=document.createDocumentFragment();for(c.appendChild(o);r.firstChild;)c.appendChild(r.firstChild);return c.appendChild(s),{inst:{strings:e.strings,bound:i,lastValues:a,startNode:o,endNode:s},frag:c}}function Be(e){for(let t of e.bound)if(t.kind==="event"&&t.el.removeEventListener(t.name,t.dispatcher),t.kind==="element"){let n=t.lastTarget;if(n){if(typeof n=="function")try{n(void 0)}catch{}else typeof n=="object"&&(n.value=void 0);t.lastTarget=void 0,t.__lastEl=void 0}}}function _i(e,t,n){let{items:r,keyFn:o,templateFn:s}=n,i=e.parentNode;if(!i)return;let a=document.createDocumentFragment();for(let c=0;c<r.length;c++){let l=o(r[c],c),u=s(r[c],c);if(!O(u))continue;let{inst:f,frag:d}=On(u);t.map.set(l,f),a.appendChild(d)}i.insertBefore(a,e)}function wi(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,{items:s,keyFn:i,templateFn:a}=t,c=new Map;for(let l=0;l<s.length;l++){let u=i(s[l],l),f=a(s[l],l);if(!O(f))continue;let d=o.map.get(u);if(d&&d.strings===f.strings)_e(d,f.values),Rn(d.startNode,d.endNode,r,n),c.set(u,d),o.map.delete(u);else{d&&(Be(d),we(d.startNode,d.endNode),o.map.delete(u));let{inst:h,frag:m}=On(f);r.insertBefore(m,n),c.set(u,h)}}for(let l of o.map.values())Be(l),we(l.startNode,l.endNode);o.map=c}function Jr(e){for(let t of e.map.values())Be(t),we(t.startNode,t.endNode);e.map.clear()}function Si(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function gt(e){e.type==="tpl"?(Be(e.inst),we(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function Xr(e){if(O(e)){let{inst:t,frag:n}=On(e);return{item:{type:"tpl",inst:t},frag:n}}if(e!=null&&e!==!1&&e!==!0){let t=document.createTextNode(String(e));return{item:{type:"text",node:t},frag:t}}return{item:{type:"empty"},frag:null}}function Ai(e,t,n){let r=e.parentNode;if(!r)return;let o=document.createDocumentFragment(),s=[];for(let i of n){let{item:a,frag:c}=Xr(i);c&&o.appendChild(c),s.push(a)}r.insertBefore(o,e),t.items=s}function Ei(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,s=o.items,i=[];for(let a=0;a<t.length;a++){let c=t[a],l=s[a];if(O(c)){let d=c;if(l&&l.type==="tpl"&&l.inst.strings===d.strings){_e(l.inst,d.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let d=String(c);l.node.data!==d&&(l.node.data=d),i.push(l);continue}}else{l&>(l),i.push({type:"empty"});continue}let{item:u,frag:f}=Xr(c);f&&r.insertBefore(f,vi(s,a,n)),l&>(l),i.push(u)}for(let a=t.length;a<s.length;a++)gt(s[a]);o.items=i}function vi(e,t,n){for(let r=t;r<e.length;r++){let o=Si(e[r]);if(o&&o.parentNode)return o}return n}function Qr(e){for(let t of e.items)gt(t);e.items=[]}function Rn(e,t,n,r){if(t.nextSibling===r&&e.parentNode===n)return;let o=document.createDocumentFragment(),s=e;for(;s;){let i=s.nextSibling;if(o.appendChild(s),s===t)break;s=i}n.insertBefore(o,r)}function Ci(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Z(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&Zr(t),!e.child)return;let n=e.child;if(n.kind==="repeat")Jr(n);else if(n.kind==="array")Qr(n);else if(n.kind==="async-stream")no(n);else if("strings"in n){let r=e.child;Be(r),we(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Ti(e,t){let n=e;n.__untilState&&!nt(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Ze(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!tt(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!Qe(t)&&(n.__keyedKey=void 0),n.__watchSub&&!rt(t)&&Zr(n)}function Ni(e,t){let n=e.marker,r=e,o=r.__cacheMap;o||(o=new Map,r.__cacheMap=o);let s=e.child;if(s&&"strings"in s){let a=s;if(O(t)&&a.strings===t.strings){_e(a,t.values);return}let c=document.createDocumentFragment();Rn(a.startNode,a.endNode,c,null),o.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(O(t)){let a=t,c=o.get(a.strings);if(c){o.delete(a.strings),e.child&&Z(e),Rn(c.inst.startNode,c.inst.endNode,n.parentNode,n),_e(c.inst,a.values),e.child=c.inst;let l=new Set;for(let u=c.inst.startNode.nextSibling;u&&u!==c.inst.endNode;u=u.nextSibling){if(u.nodeType!==1)continue;let f=u;if(f.matches("slot[data-webjs-light]")){let d=Fe(f);d&&l.add(d)}for(let d of f.querySelectorAll("slot[data-webjs-light]")){let h=Fe(d);h&&l.add(h)}}for(let u of l)z(u);return}}B(e,t)}function ki(e,t){let n=e,r=n.__untilState,o=n.__untilArgs,s=(d,h)=>!!(Object.is(d,h)||O(d)&&O(h)&&d.strings===h.strings),a=o&&o.length===t.length&&o.every((d,h)=>s(d,t[h]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let c={aborted:!1,highestResolved:a};n.__untilState=c;let l=-1,u;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,u=h;break}}l!==-1&&l<=c.highestResolved?(B(e,u),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&B(e,""),n.__untilEverRendered=!0;let f=Math.min(l===-1?t.length:l,c.highestResolved);for(let d=0;d<f;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(m=>{c.aborted||d>=c.highestResolved||(c.highestResolved=d,B(e,m))},()=>{})}}function xi(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let s;n.__watchSub.observe(()=>{s=t.get()}),B(e,s);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new Pe.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let s;r.observe(()=>{s=t.get()}),B(e,s)})});n.__watchSub=r;let o;r.observe(()=>{o=t.get()}),B(e,o)}function Zr(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function ji(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;Z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,eo(o,e,t)}function Ri(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;Z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,eo(o,e,t)}async function eo(e,t,n){let r=t.marker,o=0;try{for(;!e.aborted;){let s=await e.iterator.next();if(e.aborted||s.done)break;let i=n.mapper?n.mapper(s.value,o):s.value,a=to(i);Gr(r.parentNode,()=>{if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let c=document.createDocumentFragment();for(let l of a)c.appendChild(l);r.parentNode?.insertBefore(c,r),e.nodes.push(...a)}),o++}}catch(s){typeof console<"u"&&console.error("[webjs] asyncStream error:",s)}}function to(e){if(e==null||e===!1||e===!0)return[];if(O(e)){let t=e,{templateEl:n,parts:r}=_t(t),o=n.content.cloneNode(!0),s=r.map(i=>wt(i,o));for(let i=0;i<t.values.length;i++)U(s[i],t.values[i],void 0,t.values);for(let i of s)i.kind==="slot"&&U(i,void 0,void 0,[]);return[...o.childNodes]}if(Array.isArray(e)){let t=[];for(let n of e)t.push(...to(n));return t}return[document.createTextNode(String(e))]}function no(e){e.aborted=!0;for(let t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);e.nodes=[];try{e.iterator.return?.()?.catch?.(()=>{})}catch{}}var ro=null;function St(e){ro=e||null}function Oi(){return ro||void 0}var oo=Symbol.for("webjs:registry"),so=Symbol.for("webjs:classToTag"),At=globalThis,$=At[oo]||(At[oo]=new Map),io=At[so]||(At[so]=new WeakMap),Et=typeof window<"u"&&typeof customElements<"u";function Ln(e,t){if(!e||typeof e!="string"||!e.includes("-"))throw new Error(`customElements.define: tag "${e}" must contain a hyphen (HTML spec)`);let n=t.lazy===!0,r=$.get(e);r?(r.cls=t,r.lazy=n):$.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),io.set(t,e)}if(Et){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),Ln(t,n)}}if(!Et){let e=globalThis;e.customElements||(e.customElements={define(t,n){Ln(t,n)},get(t){return $.get(t)?.cls},upgrade(){},whenDefined(t){let n=$.get(t);return Promise.resolve(n?.cls)}})}function Mn(e,t){Et?customElements.define(e,t):Ln(e,t)}function Li(e,t){if(Et)return;let n=$.get(e);if(n){n.moduleUrl=t;return}$.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function Mi(e){return $.get(e)?.cls}function Pi(e){return $.get(e)?.moduleUrl||null}function Ii(e){return $.get(e)?.lazy===!0}function vt(e){return io.get(e)}function Di(){return[...$.keys()]}He();yt();var ho=typeof window<"u"&&typeof HTMLElement<"u";function Ji(e,t){return e!==t}function Xi(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var Ct=class{constructor(){this.__ssrAttrs=new Map,this.__internals=null}get attributes(){return[...this.__ssrAttrs].map(([t,n])=>({name:t,value:n}))}getAttribute(t){let n=this.__ssrAttrs.get(String(t).toLowerCase());return n===void 0?null:n}setAttribute(t,n){this.__ssrAttrs.set(String(t).toLowerCase(),String(n))}removeAttribute(t){this.__ssrAttrs.delete(String(t).toLowerCase())}hasAttribute(t){return this.__ssrAttrs.has(String(t).toLowerCase())}toggleAttribute(t,n){let r=String(t).toLowerCase(),o=this.__ssrAttrs.has(r);return(n===void 0?!o:n)?(this.__ssrAttrs.set(r,""),!0):(this.__ssrAttrs.delete(r),!1)}getAttributeNames(){return[...this.__ssrAttrs.keys()]}closest(t){let n=String(t).trim().toLowerCase();if(!/^[a-z][a-z0-9-]*$/.test(n))return null;if(this.__ssrTag===n)return this;let r=this.__ssrAncestors;if(!Array.isArray(r))return null;for(let o=r.length-1;o>=0;o--)if(r[o]&&r[o].__ssrTag===n)return r[o];return null}get dataset(){if(this.__dataset)return this.__dataset;let t=this,n=r=>"data-"+String(r).replace(/[A-Z]/g,o=>"-"+o.toLowerCase());return this.__dataset=new Proxy({},{get(r,o){if(typeof o!="string")return;let s=t.getAttribute(n(o));return s===null?void 0:s},set(r,o,s){return typeof o=="string"&&t.setAttribute(n(o),s),!0},has(r,o){return typeof o=="string"&&t.hasAttribute(n(o))},deleteProperty(r,o){return typeof o=="string"&&t.removeAttribute(n(o)),!0},ownKeys(){return t.getAttributeNames().filter(r=>r.startsWith("data-")).map(r=>r.slice(5).replace(/-([a-z])/g,(o,s)=>s.toUpperCase()))},getOwnPropertyDescriptor(r,o){if(typeof o=="string"&&t.hasAttribute(n(o)))return{enumerable:!0,configurable:!0,value:t.getAttribute(n(o))}}}),this.__dataset}get className(){return this.getAttribute("class")??""}set className(t){this.setAttribute("class",t)}get hidden(){return this.hasAttribute("hidden")}set hidden(t){this.toggleAttribute("hidden",!!t)}get id(){return this.getAttribute("id")??""}set id(t){this.setAttribute("id",t)}get title(){return this.getAttribute("title")??""}set title(t){this.setAttribute("title",t)}get slot(){return this.getAttribute("slot")??""}set slot(t){this.setAttribute("slot",t)}get role(){return this.getAttribute("role")}set role(t){t==null?this.removeAttribute("role"):this.setAttribute("role",t)}get tabIndex(){let t=this.getAttribute("tabindex");return t===null?-1:Number.parseInt(t,10)||0}set tabIndex(t){this.setAttribute("tabindex",String(t))}addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return this.__internals=Xi(),this.__internals}},Qi=["ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText"];for(let e of Qi){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(Ct.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Zi=ho?HTMLElement:Ct,mo=Symbol("webjs.factoryProps"),fo=new WeakSet,Ae=class e extends Zi{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Mn(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!(typeof t[n]=="object"&&t[n].state)).map(n=>typeof t[n]=="object"&&t[n].attribute||In(n))}constructor(){super(),this._renderRoot=null,this._scheduled=!1,this._connected=!1,this.__controllers=new Set,this.__firstRendered=!1,this._changedProperties=new Map,this._updateResolve=null,this._updatePromise=Promise.resolve(!0),this._isUpdating=!1,this._assertFactoryProperties(),this._initializeProperties()}_assertFactoryProperties(){let t=this.constructor;if(fo.has(t))return;let n=t;for(;n&&n!==e;){if(Object.hasOwn(n,"properties")&&!Object.hasOwn(n,mo)){let r=n.name||"a component";throw new Error(`${r}: \`static properties\` is no longer supported. Declare reactive properties via the factory instead: \`class ${r} extends WebComponent({ count: Number })\`. Use the \`prop()\` helper for options (\`prop(Number, { reflect: true })\`) and set defaults in the constructor after \`super()\`. See https://webjs.dev/docs/components.`)}n=Object.getPrototypeOf(n)}fo.add(t)}_initializeProperties(){let n=this.constructor.properties;if(!(!n||typeof n!="object")){this.__propValues={};for(let[r,o]of Object.entries(n)){let s=typeof o=="object"?o:{type:o},i=this[r];Object.defineProperty(this,r,{configurable:!0,enumerable:!0,get:()=>this.__propValues[r],set:a=>{let c=this.__propValues[r];(s.hasChanged||Ji)(a,c)&&(this.__propValues[r]=a,s.reflect&&!s.state&&this._connected&&this._reflectAttribute(r,a,s),this.requestUpdate(r,c))}}),i!==void 0?this.__propValues[r]=i:s.default!==void 0&&(this.__propValues[r]=typeof s.default=="function"?s.default():s.default)}}}_reflectAttribute(t,n,r){let o=r.attribute||In(t);if(!this.__reflectingAttribute){this.__reflectingAttribute=!0;try{if(r.converter&&r.converter.toAttribute){let s=r.converter.toAttribute(n,r.type);s==null?this.removeAttribute(o):this.setAttribute(o,s)}else r.type===Boolean?n?this.setAttribute(o,""):this.removeAttribute(o):n==null?this.removeAttribute(o):r.type===Object||r.type===Array?this.setAttribute(o,JSON.stringify(n)):this.setAttribute(o,String(n))}finally{this.__reflectingAttribute=!1}}}connectedCallback(){if(!ho)return;if(this.__webjsPropsHydrated||(this.__webjsPropsHydrated=!0,this._hydratePropAttrs()),this.constructor.hydrate==="visible"&&typeof IntersectionObserver<"u"&&!this.__hydrationActivated){this.__hydrationActivated=!1,this.__hydrationObserver=new IntersectionObserver(n=>{for(let r of n)if(r.isIntersecting){this.__hydrationObserver.unobserve(this),this.__hydrationObserver.disconnect(),this.__hydrationObserver=null,this.__hydrationActivated=!0,this._activate();return}},{rootMargin:"200px"}),this.__hydrationObserver.observe(this);return}this._activate()}_hydratePropAttrs(){let t=[],n=this.attributes;for(let r=0;r<n.length;r++){let o=n[r].name;o.startsWith("data-webjs-prop-")&&t.push(o)}for(let r of t){let o=this.getAttribute(r);if(this.removeAttribute(r),o==null)continue;let s=po(r.slice(16));try{this[s]=le(o)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow!==!0&&!this.hasAttribute("data-wj-host")&&this.setAttribute("data-wj-host",""),t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,o=Array.isArray(r)?r:Qt(r)?[r]:[];if(o.length){if(n){let s=this.shadowRoot.querySelector("style");s&&s.remove()}Zt(this._renderRoot,o)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${vt(t)||this.tagName?.toLowerCase()}> has static shadow = false AND static styles. static styles only works with shadow DOM (adoptedStyleSheets). For light DOM, use global CSS or <style> in render().`),xn(this)?$r(this):this.__isHydrating()||this.hasAttribute("data-wj-serialized")||Wr(this)?(this.removeAttribute("data-wj-serialized"),W(this),Or(this)):Rr(this),Vr(this),Fr(this);for(let n of this.__controllers)n.hostConnected&&n.hostConnected();this._updateResolve===null&&(this._updatePromise=new Promise(n=>{this._updateResolve=n})),this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(n){console.error("[webjs] lifecycle hook threw during initial render:",n)}})}__isHydrating(){let t=this.firstChild,n=t!=null&&t.nodeType===8&&t.data==="webjs-hydrate";return n&&(this.__hydratedAtActivate=!0),n}disconnectedCallback(){this._connected=!1,this.__hydrationObserver&&(this.__hydrationObserver.disconnect(),this.__hydrationObserver=null),Ur(this),this.__signalWatcher&&(this.__signalWatcher.dispose(),this.__signalWatcher=void 0);for(let t of this.__controllers)t.hostDisconnected&&t.hostDisconnected()}attributeChangedCallback(t,n,r){if(this.__reflectingAttribute)return;let s=this.constructor.properties||{},i,a;for(let[u,f]of Object.entries(s))if(((typeof f=="object"?f:{type:f}).attribute||In(u))===t){i=u,a=f;break}if(a===void 0&&(i=po(t),a=s[i]||s[t]),a===void 0)return;let c=typeof a=="object"?a:{type:a},l;if(c.converter&&c.converter.fromAttribute)l=c.converter.fromAttribute(r,c.type);else if(c.type===Number)l=r==null?null:Number(r);else if(c.type===Boolean)l=r!=null&&r!=="false";else if(c.type===Object||c.type===Array)try{l=r==null?null:JSON.parse(r)}catch{l=r}else l=r;this[i]!==l&&(this[i]=l,this._connected&&this.requestUpdate())}requestUpdate(t,n){t!==void 0&&!this._changedProperties.has(t)&&this._changedProperties.set(t,n),this._scheduleUpdate()}_scheduleUpdate(){this._updateResolve===null&&(this._updatePromise=new Promise(t=>{this._updateResolve=t})),!this._isUpdating&&(this._scheduled||!this._connected||(this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1;try{this._performRender()}catch(t){console.error("[webjs] lifecycle hook threw during update cycle:",t)}})))}_performRender(){if(!this._renderRoot)return;let t=this._changedProperties;this._isUpdating=!0;let n=!1,r=null;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let o of this.__controllers)o.hostUpdate&&o.hostUpdate();this.__renderToken=(this.__renderToken||0)+1,this.__renderAbort&&this.__renderAbort.abort(),this.__renderAbort=typeof AbortController<"u"?new AbortController:null,St(this.__renderAbort?this.__renderAbort.signal:null);try{let o=this.update(t);o&&typeof o.then=="function"&&(r=o)}catch(o){this._handleRenderError(o)}finally{St(null)}if(!r){for(let o of this.__controllers)o.hostUpdated&&o.hostUpdated();n=!0}}}catch(o){console.error("[webjs] lifecycle hook threw during update phase:",o)}finally{this._isUpdating=!1,(n||r)&&(this._changedProperties=new Map)}if(r){let o=this.__renderToken;this.__pendingAsyncCommits=(this.__pendingAsyncCommits||0)+1,r.then(()=>{if(this.__pendingAsyncCommits--,o===this.__renderToken){for(let s of this.__controllers)s.hostUpdated&&s.hostUpdated();this._postCommit(t)}});return}n?this._postCommit(t):this.__pendingAsyncCommits||this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new Pe.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);Se(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&Se(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&Se(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==Tt.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${vt(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&Se(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function In(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function po(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Tt(e){return new.target?Reflect.construct(Ae,arguments,new.target):class extends Ae{static properties=e;static[mo]=!0}}Object.setPrototypeOf(Tt,Ae);Tt.prototype=Ae.prototype;function ea(e,t={}){return e&&typeof e=="object"&&!("call"in e)&&(t=e,e=void 0),{...e?{type:e}:{},...t}}var yo=Symbol.for("webjs.notFound"),bo=Symbol.for("webjs.redirect"),go=Symbol.for("webjs.forbidden"),_o=Symbol.for("webjs.unauthorized");function ta(){let e=new Error("webjs: notFound()");throw e.__webjs=yo,e}function na(){let e=new Error("webjs: forbidden()");throw e.__webjs=go,e}function ra(){let e=new Error("webjs: unauthorized()");throw e.__webjs=_o,e}function oa(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=bo,r.url=e,r.status=typeof n=="number"?n:void 0,r}function sa(e){return!!e&&e.__webjs===yo}function ia(e){return!!e&&e.__webjs===bo}function aa(e){return!!e&&e.__webjs===go}function ca(e){return!!e&&e.__webjs===_o}var wo=null;function la(){if(!wo)return"";try{return wo()||""}catch{return""}}var il=Symbol.for("webjs.suspense");function ua(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function fa(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function da(e,t={}){let n=t.reconnect!==!1,r=0,o=!1,s=null,i=[];function a(){o||(s=new WebSocket(pa(e),t.protocols),s.onopen=c=>{for(r=0;i.length&&s&&s.readyState===WebSocket.OPEN;)s.send(i.shift());t.onOpen?.(c)},s.onmessage=c=>{let l=c.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,c)},s.onerror=c=>{t.onError?.(c)},s.onclose=c=>{if(t.onClose?.(c),!o&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(a,l)}})}return a(),{send(c){let l=typeof c=="string"||c instanceof ArrayBuffer||ArrayBuffer.isView(c)?c:JSON.stringify(c);s&&s.readyState===WebSocket.OPEN?s.send(l):i.push(l)},close(c,l){o=!0;try{s?.close(c,l)}catch{}},get socket(){return s},get readyState(){return s?.readyState??3}}}function pa(e){if(/^wss?:\/\//i.test(e))return e;let t=typeof location<"u"&&location.protocol==="https:"?"wss:":"ws:",n=typeof location<"u"?location.host:"";return`${t}//${n}${e.startsWith("/")?e:"/"+e}`}He();var Dn="application/vnd.webjs+json";async function ha(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",Dn);let r=t.body;r!=null&&typeof r=="object"&&!(r instanceof FormData)&&!(r instanceof Blob)&&!(r instanceof ArrayBuffer)&&!(r instanceof URLSearchParams)&&!(typeof ReadableStream<"u"&&r instanceof ReadableStream)&&!ArrayBuffer.isView(r)&&(r=await Pn(r),n.has("content-type")||n.set("content-type",Dn));let o=await fetch(e,{...t,headers:n,body:r}),s=o.headers.get("content-type")||"",i=await o.text(),a=s.includes(Dn)?i?le(i):null:s.includes("application/json")?i?JSON.parse(i):null:i;if(!o.ok){let c=a&&a.error||`richFetch ${e} -> ${o.status}`,l=new Error(c);throw l.status=o.status,l.body=a,l}return a}He();kt();kt();Un();xt();var pr=class{constructor(t,n){this.host=t,this.options=n,this.updates=[],this._nextId=0}get value(){let t=this.options.source();if(!this.options.update)return this.updates.length>0?this.updates[this.updates.length-1].payload:t;for(let n of this.updates)t=this.options.update(t,n.payload);return t}add(t,n){let r=`opt-${++this._nextId}`;this.updates.push({id:r,payload:t}),this.host?.requestUpdate?.();let o=()=>{let s=this.updates.findIndex(i=>i.id===r);s!==-1&&(this.updates.splice(s,1),this.host?.requestUpdate?.())};return n&&typeof n.then=="function"&&(typeof n.finally=="function"?n.finally(()=>o()).catch(()=>{}):n.then(()=>o(),()=>o())),o}};async function ac(e,t,n){let r=e.get();e.set(t);let o;try{o=await n()}catch(s){throw e.set(r),s}return o&&o.success===!1&&e.set(r),o}function cc(e,t,n){return e&&typeof e.get=="function"&&typeof e.set=="function"?ac(e,t,n):new pr(e,t)}qn();var Gt=0,hs=new Map,Re=new Map,lc=1e3;function uc(e){if(!(!Array.isArray(e)||!e.length)){Gt+=1;for(let t of e)t&&hs.set(t,Gt)}}function fc(){return Gt}function dc(e,t,n){if(!(!Array.isArray(t)||!t.length)&&(Re.delete(e),Re.set(e,{tags:t.slice(),since:typeof n=="number"?n:Gt}),Re.size>lc)){let r=Re.keys().next().value;r!==void 0&&Re.delete(r)}}function pc(e){let t=Re.get(e);if(!t)return!1;for(let n of t.tags)if((hs.get(n)||0)>t.since)return!0;return!1}function hc(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}var mc="application/vnd.webjs+stream",yc=1,bc=2,gc=3,ms=new Uint8Array(0);function _c(e,t){let n=t||ms,r=n.length,o=new Uint8Array(5+r);return o[0]=e&255,o[1]=r>>>24&255,o[2]=r>>>16&255,o[3]=r>>>8&255,o[4]=r&255,r&&o.set(n,5),o}function wc(){let e=ms;return{push(t){if(t&&t.length){let r=new Uint8Array(e.length+t.length);r.set(e,0),r.set(t,e.length),e=r}let n=[];for(;e.length>=5;){let r=e[0],o=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;if(e.length<5+o)break;let s=e.slice(5,5+o);n.push({type:r,payload:s}),e=e.slice(5+o)}return n}}}var Sc=Symbol.for("webjs.context");function Ac(e){return{__context__:Sc,name:e}}var Jt=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},hr=class{constructor(t,{context:n,initialValue:r}){this._host=t,this._context=n,this._value=r,this._subscriptions=new Set,this._onRequest=o=>{let s=o;if(s.context===this._context)if(o.stopPropagation(),s.subscribe){let i={callback:s.callback},a=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),s.callback(this._value,a)}else s.callback(this._value)},typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}setValue(t){if(!Object.is(this._value,t)){this._value=t;for(let n of this._subscriptions){let r=()=>{this._subscriptions.delete(n)};n.callback(t,r)}}}hostConnected(){this._host.addEventListener("context-request",this._onRequest)}hostDisconnected(){this._host.removeEventListener("context-request",this._onRequest),this._subscriptions.clear()}},mr=class{constructor(t,{context:n,subscribe:r=!0}){this._host=t,this._context=n,this._subscribe=r,this._value=void 0,this._unsubscribe=void 0,typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}hostConnected(){this._dispatchRequest()}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=void 0)}_dispatchRequest(){let t=new Jt(this._context,(n,r)=>{let o=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(o,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};function Ec(){return typeof window<"u"}var Y={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},yr=class{constructor(t,{task:n,args:r,autoRun:o=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=o,this._status=Y.INITIAL,this._value=void 0,this._error=void 0,this._abortController=null,this._prevArgs=null,typeof t.addController=="function"&&t.addController(this)}get status(){return this._status}get value(){return this._value}get error(){return this._error}async run(){this.abort();let t=new AbortController;this._abortController=t;let n=this._argsFn();this._prevArgs=n,this._status=Y.PENDING,this._error=void 0,this._requestHostUpdate();try{let r=await this._taskFn(...n,{signal:t.signal});if(t.signal.aborted)return;this._value=r,this._status=Y.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=Y.ERROR,this._value=void 0}finally{this._abortController===t&&(this._abortController=null)}this._requestHostUpdate()}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}render(t={}){switch(this._status){case Y.INITIAL:return t.initial?.();case Y.PENDING:return t.pending?.();case Y.COMPLETE:return t.complete?.(this._value);case Y.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!Ec())return;let t=this._argsFn();this._argsEqual(this._prevArgs,t)||this.run()}hostUpdated(){}hostConnected(){}hostDisconnected(){this.abort()}_requestHostUpdate(){typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()}_argsEqual(t,n){if(t===null||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r])return!1;return!0}};export{mr as ContextConsumer,hr as ContextProvider,Jt as ContextRequestEvent,yc as FRAME_CHUNK,bc as FRAME_END,gc as FRAME_ERROR,A as MARKER,jo as SEED_MISS,mc as STREAM_CONTENT_TYPE,Pe as Signal,ua as Suspense,yr as Task,Y as TaskStatus,Tt as WebComponent,Bn as WebjsFrame,$n as WebjsStream,Oi as activeActionSignal,Zt as adoptStyles,Di as allTags,Ls as asyncAppend,Ms as asyncReplace,Vs as batch,Rs as cache,zs as computed,da as connectWS,pc as consumeStale,Ac as createContext,wc as createFrameDecoder,js as createRef,la as cspNonce,ws as css,lo as deserialize,Po as disableClientRouter,Ys as effect,tr as enableClientRouter,_c as encodeFrame,Es as escapeAttr,As as escapeText,fc as fetchMark,na as forbidden,Ns as guard,_s as html,on as isAsyncAppend,sn as isAsyncReplace,Qt as isCSS,tt as isCache,aa as isForbidden,Ze as isGuard,Qe as isKeyed,Ii as isLazy,nn as isLive,sa as isNotFound,ia as isRedirect,et as isRef,Xe as isRepeat,Ks as isSignal,fa as isSuspense,O as isTemplate,rn as isTemplateContent,ca as isUnauthorized,tn as isUnsafeHTML,nt as isUntil,rt as isWatch,Ts as keyed,Cs as live,Mi as lookup,Pi as lookupModuleUrl,uc as markStale,Io as navigate,ta as notFound,cc as optimistic,le as parse,hc as parseTagHeader,Li as primeModuleUrl,ea as prop,oa as redirect,xs as ref,Mn as register,dc as registerKeyTags,Se as render,Hn as renderStream,wr as repeat,Do as revalidate,ha as richFetch,jt as scanSeeds,co as serialize,St as setActiveActionSignal,Ws as signal,Pn as stringify,Ss as stylesToString,vt as tagOf,Sa as takeSeed,ks as templateContent,ra as unauthorized,vs as unsafeHTML,Os as until,Ps as watch};
|
|
6
6
|
//# sourceMappingURL=webjs-core-browser.js.map
|