@webjsdev/core 0.7.5 → 0.7.7

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.
@@ -1,4 +1,4 @@
1
- function Gn(e,...t){return{_$webjs:"template",strings:e,values:t}}function w(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var m="w$";function Yn(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 Fe(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Be(e,t){if(!(!t||!t.length))if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){let n=t.map(r=>{let s=new CSSStyleSheet;return s.replaceSync(r.text),s});e.adoptedStyleSheets=n}else{let n=e,r=document.createElement("style");r.textContent=t.map(s=>s.text).join(`
2
- `),n.appendChild(r)}}function Jn(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
- `)}</style>`}function Xn(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qn(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var Mt=Symbol.for("webjs.repeat");function Zn(e,t,n){return{[Mt]:!0,items:[...e],keyFn:t,templateFn:n}}function $e(e){return!!e&&typeof e=="object"&&e[Mt]===!0}function er(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function De(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function tr(e){return{_$webjs:"live",value:e}}function qe(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function He(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ve(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function It(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function We(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function ze(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Ke(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function Ut(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ft(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Ge(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var C=null,x=!1,z=0,W=null,Ye=0,Bt=(e,t)=>Object.is(e,t),ge=()=>{},$t=()=>!1;function Dt(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)Dt(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function X(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)X(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function tt(e){if(x)throw new Error("Signal read during notification phase");if(C===null)return;let t=C,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Qe(t)&&X(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Qe(t)&&Dt(e,t)),t.producerLastReadVersions[n]=e.version}function Qe(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function qt(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=x;x=!0;try{for(let n of e.liveConsumers)n.dirty||nr(n)}finally{x=t}}function nr(e){e.dirty=!0,qt(e),e.consumerMarkedDirty.call(e.wrapper||e)}function ye(e){if(!(!e.dirty&&e.lastCleanEpoch===z)){if(!e.producerMustRecompute()&&!rr(e)){e.dirty=!1,e.lastCleanEpoch=z;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=z}}function rr(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(ye(n),r!==n.version))return!0}return!1}function Ze(e){e&&(e.nextProducerIndex=0);let t=C;return C=e,t}function et(e,t){if(C=t,!!e){if(Qe(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)X(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var be=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=z,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=$t,this.producerRecomputeValue=ge,this.consumerMarkedDirty=ge,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||Bt,this.watched=n?.[nt],this.unwatched=n?.[rt]}get(){return tt(this),this.__value}peek(){return this.__value}set(t){if(x)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,z++,W!==null?Ht(this):qt(this))}};function Ht(e){let t=x;x=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?W.add(n):Ht(n))}finally{x=t}}var Je=Symbol("unset"),Xe=Symbol("computing"),me=Symbol("errored"),Q=class{constructor(t,n){this.__fn=t,this.__value=Je,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||Bt,this.watched=n?.[nt],this.unwatched=n?.[rt];let r=this;this.producerMustRecompute=function(){return r.__value===Je||r.__value===Xe},this.producerRecomputeValue=function(){if(r.__value===Xe)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=Xe;let o=Ze(r),i,c=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=me,r.__error=l,c=!0}finally{et(r,o)}if(!c&&(s!==Je&&s!==me)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=ge}get(){if(ye(this),tt(this),this.__value===me)throw this.__error;return this.__value}peek(){if(ye(this),this.__value===me)throw this.__error;return this.__value}},_e=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=z,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=$t,this.producerRecomputeValue=ge,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=Ze(this);try{for(let r of t)tt(r),r.__isComputed&&ye(r)}finally{et(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(X(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=Ze(this),r;try{r=t()}finally{et(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)X(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},nt=Symbol("watched"),rt=Symbol("unwatched");function or(e){let t=C;C=null;try{return e()}finally{C=t}}function sr(e){return e.producers.slice()}function ir(e){return e.liveConsumers?[...e.liveConsumers]:[]}function cr(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function ar(e){return e.producers.length>0}function lr(){return C&&C.__isComputed?C:null}function ur(e){Ye++,W===null&&(W=new Set);try{e()}finally{if(Ye--,Ye===0){let t=W;W=null;for(let n of t)n.__fire()}}}var Z={State:be,Computed:Q,subtle:{Watcher:_e,untrack:or,introspectSources:sr,introspectSinks:ir,hasSinks:cr,hasSources:ar,currentComputed:lr,watched:nt,unwatched:rt}};function fr(e,t){return new be(e,t)}function dr(e,t){return new Q(e,t)}function hr(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function pr(e){let t=!1,n=!1,r=new Q(e),s=new _e(()=>{t||n||(t=!0,queueMicrotask(()=>{if(t=!1,!n){try{r.get()}catch(o){console.error(o)}s.watch()}}))});s.watch(r);try{r.get()}catch(o){console.error(o)}return()=>{n||(n=!0,s.dispose())}}var mr=`${m}s`,gr=`${m}e`;function Vt(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===mr||t===gr}function yr(e){for(let t of e.addedNodes)if(Vt(t))return!0;for(let t of e.removedNodes)if(Vt(t))return!0;return!1}function Yt(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var te=Yt(),U=Symbol("webjs.slot.state"),R="data-webjs-light",F="data-projection",ne="actual",Jt="fallback",ve=Symbol("webjs.slot.fallbackFrag"),br=64,ee=null,ot=null,we=null,Wt=!1;function _r(){Wt||(te=Yt(),te&&(ee=HTMLSlotElement.prototype.assignedNodes,ot=HTMLSlotElement.prototype.assignedElements,we=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(R)&&!zt(this)?st(this,t):ee?ee.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(R)&&!zt(this)?st(this,t).filter(n=>n.nodeType===1):ot?ot.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=we&&we.get?we.get.call(this):null;return t||wr(this)}}),Wt=!0))}_r();function zt(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function st(e,t){if(e.getAttribute(F)===Jt)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:it(n,new Set,0)}function it(e,t,n){if(n>=br)return e.slice();let r=[];for(let s of e)if(s.nodeType===1&&s.tagName==="SLOT"){let o=s;if(t.has(o))continue;if(t.add(o),o.hasAttribute(R)){let i=st(o,{flatten:!1});if(i.length>0)for(let c of it(i,t,n+1))r.push(c);else for(let c of it(Array.from(o.childNodes),t,n+1))r.push(c)}else if(ee){let i=ee.call(o,{flatten:!0});for(let c of i)r.push(c)}else r.push(s)}else r.push(s);return r}function wr(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(R))return t.getAttribute(F)===ne?t:null;t=t.parentElement}return null}function O(e){let t=e,n=t[U];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[U]=n),n}function ct(e){return!!e[U]}function Xt(e){let t=O(e);for(;e.firstChild;){let n=e.firstChild,r=Se(n);Ae(t.assignedByName,r,n),e.removeChild(n)}}function Qt(e){let t=O(e),n=e.querySelectorAll(`slot[${R}]`);for(let r of n){let s=r;if(s.getAttribute(F)!==ne)continue;let o=s.getAttribute("name")||null;if(!t.assignedByName.has(o)){let i=Array.from(s.childNodes);t.assignedByName.set(o,i),t.lastSnapshot.set(s,i.slice())}}}function Se(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function Ae(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function Zt(e,t,n){if(!n.length)return;let r=e.get(t);r||(r=[],e.set(t,r));for(let s of n)r.push(s)}function en(e){if(!te)return;let t=O(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!yr(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(Ae(t.assignedByName,Se(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||Kt(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(Kt(t,o)||o.parentElement===e)&&(Ae(t.assignedByName,Se(o),o),r=!0)}}r&&Ce(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function tn(e){let t=e[U];if(t){t.childObserver&&(t.childObserver.disconnect(),t.childObserver=null);for(let n of t.ownedSlots){let r=t.nameObservers.get(n);r&&(r.disconnect(),t.nameObservers.delete(n))}}}function Kt(e,t){for(let[n,r]of e.assignedByName){let s=r.indexOf(t);if(s!==-1)return r.splice(s,1),r.length===0&&e.assignedByName.delete(n),!0}return!1}function Ce(e){let t=O(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,Sr(e)}))}function Sr(e){if(!te)return;let t=e[U];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${R}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||Ar(t,i);for(let i of r)t.ownedSlots.has(i)||Er(e,i);t.ownedSlots=r;let s=new Map;for(let i of n){let c=i.getAttribute("name")||null,a=s.get(c);a||(a=[],s.set(c,a)),a.push(i)}for(let i of s.keys()){let c=t.pendingByName.get(i);if(c&&c.length){let a=t.assignedByName.get(i)||[],l=[];for(let f of c)l.push(f);for(let f of a)l.indexOf(f)===-1&&l.push(f);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let o=[];for(let[i,c]of s){let a=t.assignedByName.get(i)||[];for(let l=0;l<c.length;l++){let f=c[l];l===0&&a.length>0?vr(t,f,a)&&o.push(f):Cr(t,f)&&o.push(f)}}for(let i of o)Nr(i)}function Ar(e,t){let n=e.nameObservers.get(t);n&&(n.disconnect(),e.nameObservers.delete(t));let r=e.lastSnapshot.get(t);if(r&&r.length>0){let s=t.getAttribute("name")||null;Zt(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function vr(e,t,n){let r=t.getAttribute(F)!==ne,s=e.lastSnapshot.get(t)||[];if(!r&&Tr(s,n))return!1;let i=t[ve];if(r&&i)for(;t.firstChild;)i.appendChild(t.firstChild);else for(;t.firstChild;)t.removeChild(t.firstChild);for(let c of n)t.appendChild(c);return t.setAttribute(F,ne),e.lastSnapshot.set(t,n.slice()),!0}function Cr(e,t){let n=t.getAttribute(F)===ne;if(t.setAttribute(F,Jt),!n)return Gt(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return Gt(t),!0}function Gt(e){let t=e[ve];!t||t.childNodes.length===0||e.appendChild(t)}function Er(e,t){if(!te)return;let n=O(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>Ce(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function nn(e,t){if(!ct(e))return;let n=O(e),r=n.lastSnapshot.get(t);if(!r||r.length===0)return;let s=t.getAttribute("name")||null;for(let i of r)i.parentNode===t&&t.removeChild(i);Zt(n.pendingByName,s,r),n.lastSnapshot.delete(t);let o=n.nameObservers.get(t);o&&(o.disconnect(),n.nameObservers.delete(t)),n.ownedSlots.delete(t)}function Nr(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function Tr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var rn=new WeakMap,at=Symbol.for("webjs.instance");function Ne(e,t){let n=t,r=n[at];if(w(e)){let s=e;if(r&&r.strings===s.strings){se(r,s.values);return}r&&on(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=Rr(s,t);n[at]=i;return}if(r&&on(r,t),n[at]=null,t.replaceChildren(),!(e==null||e===!1||e===!0)){if(Array.isArray(e)){for(let s of e){let o=document.createTextNode(String(s??""));t.appendChild(o)}return}t.appendChild(document.createTextNode(String(e)))}}function re(e){let{strings:t}=e,n=rn.get(t);if(n)return n;let r=[],s="",o="text",i="",c=0,a="",l=0,f=null,p="",d="";for(let y=0;y<t.length;y++){let J=t[y];for(let b=0;b<J.length;b++){let u=J[b];switch(o){case"text":s+=u,u==="<"&&(o="tag-open");break;case"tag-open":s+=u,u==="!"?o="bang-1":u==="/"?(o="tag-name",p=""):/[a-zA-Z]/.test(u)?(o="tag-name",p=u.toLowerCase()):o="text";break;case"bang-1":s+=u,o=u==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=u,u==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=u,u==="-"?l+=1:(u===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=u,u===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):/\s/.test(u)?o="in-tag":p+=u.toLowerCase();break;case"in-tag":s+=u,u===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(d="")):!/\s/.test(u)&&u!=="/"&&(o="attr-name",i=u,c=s.length-1);break;case"rawtext":s+=u,d=(d+u.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(o="text",d="",p="");break;case"attr-name":u==="="?(o="after-eq",s+=u):/\s/.test(u)?(o="in-tag",i="",s+=u):u===">"?(o="text",i="",s+=u):(i+=u,s+=u);break;case"after-eq":u==='"'||u==="'"?(o="attr-quoted",a=u,s+=u):/\s/.test(u)?(o="in-tag",i="",s+=u):u===">"?(o="text",i="",s+=u):(o="attr-unquoted",s+=u);break;case"attr-unquoted":/\s/.test(u)?(o="in-tag",i="",s+=u):(u===">"&&(o="text",i=""),s+=u);break;case"attr-quoted":s+=u,u===a&&(o="in-tag",i="");break;case"skip-attr":if(u===a){if(f){let H=f.firstPartIdx,_=[];for(let T=H;T<r.length;T++)(r[T].kind==="noop"||r[T].kind==="attr-mixed")&&_.push(T);let V=[],Ie=t[_[0]],Lt=Ie.lastIndexOf(a);V.push(Lt>=0?Ie.slice(Lt+1):Ie);for(let T=1;T<_.length;T++)V.push(t[_[T]]);let Ue=t[_[_.length-1]+1],Pt=Ue.indexOf(a);V.push(Pt>=0?Ue.slice(0,Pt):Ue),r[H]={kind:"attr-mixed",path:[],name:f.name,statics:V,group:_},f=null}o="in-tag",i=""}break}}if(y<t.length-1){let b=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){d="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${m}${b}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let u=`data-${m}${b}`;s+=`${u}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let u=i[0],H=i.slice(1);if(u==="@"||u==="."||u==="?"){s=s.slice(0,c);let _=u==="@"?"event":u==="."?"prop":"bool",V=`data-${m}${b}`;s+=`${V}=""`,r.push({kind:_,path:[],name:H})}else{s=s.slice(0,c);let _=`data-${m}${b}`;s+=`${_}=""`,r.push({kind:"attr",path:[],name:i})}o="in-tag",i=""}else if(o==="attr-quoted"||o==="attr-unquoted"){s=s.slice(0,c);let u=`data-${m}${b}`;s+=`${u}=""`,f={name:i,firstPartIdx:b},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let h=document.createElement("template");return h.innerHTML=s,kr(h.content,r),xr(h.content,r),n={templateEl:h,parts:r},rn.set(t,n),n}function kr(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(R,"");let s=t.length;r.setAttribute(`data-${m}${s}`,""),t.push({kind:"slot",path:[]})}}function xr(e,t){let n=[];function r(s){for(let o=0;o<s.childNodes.length;o++){let i=s.childNodes[o];if(n.push(o),i.nodeType===8){let c=i.data;if(c.startsWith(m)){let a=Number(c.slice(m.length));t[a]&&t[a].kind==="child"&&(t[a].path=n.slice())}}else if(i.nodeType===1){let c=i,a=[];for(let l of c.attributes)if(l.name.startsWith(`data-${m}`)){let f=Number(l.name.slice(`data-${m}`.length));t[f]&&t[f].kind!=="child"&&(t[f].path=n.slice()),a.push(l.name)}for(let l of a)c.removeAttribute(l);r(i)}n.pop()}}r(e)}function Rr(e,t){let{templateEl:n,parts:r}=re(e),s=n.content.cloneNode(!0),o=document.createComment(`${m}s`),i=document.createComment(`${m}e`),c=r.map(l=>oe(l,s)),a=[];for(let l=0;l<e.values.length;l++)j(c[l],e.values[l],void 0,e.values),a.push(e.values[l]);t.replaceChildren(o,...s.childNodes,i);for(let l of c)l.kind==="slot"&&j(l,void 0,void 0,[]);return{strings:e.strings,bound:c,lastValues:a,startNode:o,endNode:i}}function oe(e,t){if(e.kind==="noop")return{kind:"noop"};let n=t;for(let s of e.path)n=n.childNodes[s];if(e.kind==="child")return{kind:"child",marker:n};let r=n;if(e.kind==="event"){let s={kind:"event",el:r,name:e.name||"",handler:null,dispatcher(o){s.handler?.(o)}};return r.addEventListener(s.name,s.dispatcher),s}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 se(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(j(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function on(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=lt(n.slotEl);r&&nn(r,n.slotEl)}}t.replaceChildren()}function j(e,t,n,r){if(qe(t)){let s=t.value;if(e.kind==="prop"&&e.el[e.name]===s||e.kind==="attr"&&e.el.getAttribute(e.name)===String(s)||e.kind==="bool"&&e.el.hasAttribute(e.name)===!!s)return;t=s}switch(e.kind){case"child":Lr(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":jr(e,t);break;case"attr-mixed":{let s=e,o=s.statics[0];for(let i=0;i<s.group.length;i++)o+=String((r?r[s.group[i]]:t)??""),o+=s.statics[i+1]||"";e.el.setAttribute(e.name,o);break}case"slot":{if(e.applied)break;let s=e.slotEl,o=()=>{e.applied=!0;let c=lt(s);if(!c||Or(s))return;let a=document.createDocumentFragment();for(;s.firstChild;)a.appendChild(s.firstChild);s[ve]=a,Ce(c)};lt(s)?o():queueMicrotask(o);break}case"noop":break}}function lt(e){let t=e.parentElement;for(;t;){if(t[U])return t;t=t.parentElement}return null}function Or(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function jr(e,t){let n=e,r=We(t)?t.target:void 0,s=n.__refTarget,o=r!==s;if(o&&s)if(typeof s=="function")try{s(void 0)}catch{}else typeof s=="object"&&(s.value=void 0);if(o||n.__refElement!==e.el){if(n.__refTarget=r,r)if(typeof r=="function"){if(!o&&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 Lr(e,t){return Ur(e,t),E(e,t)}function E(e,t){let n=e.marker;if(De(t)){B(e);let s=String(t.value??""),o=document.createElement("template");o.innerHTML=s;let i=[...o.content.childNodes],c=document.createDocumentFragment();for(let a of i)c.appendChild(a);n.parentNode?.insertBefore(c,n),e.child=i;return}if(He(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&B(e),e.__keyedKey=s.key,E(e,s.value);return}if(Ve(t)){let s=t,o=e.__guardDeps,i=s.deps;if(o!==void 0&&(Array.isArray(o)&&Array.isArray(i)?Ir(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,E(e,s.fn());return}if(It(t)){B(e);let s=t.template;if(s&&s.content){let o=s.content.cloneNode(!0),i=[...o.childNodes];n.parentNode?.insertBefore(o,n),e.child=i}return}if(We(t))return;if(ze(t))return Fr(e,t.value);if(Ke(t))return Br(e,t.args);if(Ge(t))return $r(e,t.signal);if(Ut(t))return Dr(e,t);if(Ft(t))return qr(e,t);if($e(t)){if(e.child&&e.child.kind==="repeat"){Mr(e,t);return}B(e);let s={kind:"repeat",map:new Map};e.child=s,Pr(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")an(s),e.child=void 0;else if(s.kind==="async-stream")dn(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(w(t)&&o.strings===t.strings){se(o,t.values);return}ie(o.startNode,o.endNode),e.child=void 0}else{for(let o of e.child)o.parentNode&&o.parentNode.removeChild(o);e.child=void 0}}if(t==null||t===!1||t===!0)return;if(w(t)){let s=t,{templateEl:o,parts:i}=re(s),c=o.content.cloneNode(!0),a=document.createComment(`${m}s`),l=document.createComment(`${m}e`),f=i.map(h=>oe(h,c)),p=[];for(let h=0;h<s.values.length;h++)j(f[h],s.values[h],void 0,s.values),p.push(s.values[h]);let d=[a,...c.childNodes,l];n.parentNode?.insertBefore(sn(d),n);for(let h of f)h.kind==="slot"&&j(h,void 0,void 0,[]);e.child={strings:s.strings,bound:f,lastValues:p,startNode:a,endNode:l};return}if(Array.isArray(t)){let s=[];for(let i of t)if(w(i)){let c=i,{templateEl:a,parts:l}=re(c),f=a.content.cloneNode(!0),p=l.map(d=>oe(d,f));for(let d=0;d<c.values.length;d++)j(p[d],c.values[d],void 0,c.values);s.push(...f.childNodes)}else i!=null&&i!==!1&&i!==!0&&s.push(document.createTextNode(String(i)));let o=sn(s);n.parentNode?.insertBefore(o,n),e.child=s;return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function sn(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function ie(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 cn(e){let{templateEl:t,parts:n}=re(e),r=t.content.cloneNode(!0),s=document.createComment(`${m}s`),o=document.createComment(`${m}e`),i=n.map(l=>oe(l,r)),c=[];for(let l=0;l<e.values.length;l++)j(i[l],e.values[l],void 0,e.values),c.push(e.values[l]);let a=document.createDocumentFragment();for(a.appendChild(s);r.firstChild;)a.appendChild(r.firstChild);return a.appendChild(o),{inst:{strings:e.strings,bound:i,lastValues:c,startNode:s,endNode:o},frag:a}}function Ee(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 Pr(e,t,n){let{items:r,keyFn:s,templateFn:o}=n,i=e.parentNode;if(!i)return;let c=document.createDocumentFragment();for(let a=0;a<r.length;a++){let l=s(r[a],a),f=o(r[a],a);if(!w(f))continue;let{inst:p,frag:d}=cn(f);t.map.set(l,p),c.appendChild(d)}i.insertBefore(c,e)}function Mr(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,{items:o,keyFn:i,templateFn:c}=t,a=new Map;for(let l=0;l<o.length;l++){let f=i(o[l],l),p=c(o[l],l);if(!w(p))continue;let d=s.map.get(f);if(d&&d.strings===p.strings)se(d,p.values),ut(d.startNode,d.endNode,r,n),a.set(f,d),s.map.delete(f);else{d&&(Ee(d),ie(d.startNode,d.endNode),s.map.delete(f));let{inst:h,frag:y}=cn(p);r.insertBefore(y,n),a.set(f,h)}}for(let l of s.map.values())Ee(l),ie(l.startNode,l.endNode);s.map=a}function an(e){for(let t of e.map.values())Ee(t),ie(t.startNode,t.endNode);e.map.clear()}function ut(e,t,n,r){if(t.nextSibling===r&&e.parentNode===n)return;let s=document.createDocumentFragment(),o=e;for(;o;){let i=o.nextSibling;if(s.appendChild(o),o===t)break;o=i}n.insertBefore(s,r)}function Ir(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 B(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&ln(t),!e.child)return;let n=e.child;if(n.kind==="repeat")an(n);else if(n.kind==="async-stream")dn(n);else if("strings"in n){let r=e.child;Ee(r),ie(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Ur(e,t){let n=e;n.__untilState&&!Ke(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Ve(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!ze(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!He(t)&&(n.__keyedKey=void 0),n.__watchSub&&!Ge(t)&&ln(n)}function Fr(e,t){let n=e.marker,r=e,s=r.__cacheMap;s||(s=new Map,r.__cacheMap=s);let o=e.child;if(o&&"strings"in o){let c=o;if(w(t)&&c.strings===t.strings){se(c,t.values);return}let a=document.createDocumentFragment();ut(c.startNode,c.endNode,a,null),s.set(c.strings,{inst:c,holder:a}),e.child=void 0}if(w(t)){let c=t,a=s.get(c.strings);if(a){s.delete(c.strings),e.child&&B(e),ut(a.inst.startNode,a.inst.endNode,n.parentNode,n),se(a.inst,c.values),e.child=a.inst;return}}E(e,t)}function Br(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(d,h)=>!!(Object.is(d,h)||w(d)&&w(h)&&d.strings===h.strings),c=s&&s.length===t.length&&s.every((d,h)=>o(d,t[h]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let a={aborted:!1,highestResolved:c};n.__untilState=a;let l=-1,f;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,f=h;break}}l!==-1&&l<=a.highestResolved?(E(e,f),a.highestResolved=l):l===-1&&!n.__untilEverRendered&&E(e,""),n.__untilEverRendered=!0;let p=Math.min(l===-1?t.length:l,a.highestResolved);for(let d=0;d<p;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(y=>{a.aborted||d>=a.highestResolved||(a.highestResolved=d,E(e,y))},()=>{})}}function $r(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),E(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new Z.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),E(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),E(e,s)}function ln(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function Dr(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;B(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,un(s,e,t)}function qr(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;B(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,un(s,e,t)}async function un(e,t,n){let r=t.marker,s=0;try{for(;!e.aborted;){let o=await e.iterator.next();if(e.aborted||o.done)break;let i=n.mapper?n.mapper(o.value,s):o.value,c=fn(i);if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let a=document.createDocumentFragment();for(let l of c)a.appendChild(l);r.parentNode?.insertBefore(a,r),e.nodes.push(...c),s++}}catch(o){typeof console<"u"&&console.error("[webjs] asyncStream error:",o)}}function fn(e){if(e==null||e===!1||e===!0)return[];if(w(e)){let t=e,{templateEl:n,parts:r}=re(t),s=n.content.cloneNode(!0),o=r.map(i=>oe(i,s));for(let i=0;i<t.values.length;i++)j(o[i],t.values[i],void 0,t.values);return[...s.childNodes]}if(Array.isArray(e)){let t=[];for(let n of e)t.push(...fn(n));return t}return[document.createTextNode(String(e))]}function dn(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 hn=Symbol.for("webjs:registry"),pn=Symbol.for("webjs:classToTag"),Te=globalThis,N=Te[hn]||(Te[hn]=new Map),mn=Te[pn]||(Te[pn]=new WeakMap),ke=typeof window<"u"&&typeof customElements<"u";function ft(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=N.get(e);r?(r.cls=t,r.lazy=n):N.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),mn.set(t,e)}if(ke){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),ft(t,n)}}if(!ke){let e=globalThis;e.customElements||(e.customElements={define(t,n){ft(t,n)},get(t){return N.get(t)?.cls},upgrade(){},whenDefined(t){let n=N.get(t);return Promise.resolve(n?.cls)}})}function dt(e,t){ke?customElements.define(e,t):ft(e,t)}function Hr(e,t){if(ke)return;let n=N.get(e);if(n){n.moduleUrl=t;return}N.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function Vr(e){return N.get(e)?.cls}function Wr(e){return N.get(e)?.moduleUrl||null}function zr(e){return N.get(e)?.lazy===!0}function xe(e){return mn.get(e)}function Kr(){return[...N.keys()]}var g="_$wj",le="_id";async function ht(e){return JSON.stringify(await gn(e))}function ue(e){return yn(JSON.parse(e))}async function gn(e){let t=Gr();return await Yr(e,t),$(e,t)}function yn(e){return L(e,Zr())}function Gr(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map}}async function Yr(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!to(r))continue;let s=t.refCount.get(r)||0;if(t.refCount.set(r,s+1),!(s>0)){if(typeof Blob<"u"&&r instanceof Blob){let o=new Uint8Array(await r.arrayBuffer());t.blobBytes.set(r,o);continue}if(typeof FormData<"u"&&r instanceof FormData){for(let[,o]of r.entries())typeof o!="string"&&n.push(o);continue}if(Array.isArray(r))for(let o=0;o<r.length;o++)n.push(r[o]);else if(r instanceof Map)for(let[o,i]of r)n.push(o),n.push(i);else if(r instanceof Set)for(let o of r)n.push(o);else if(no(r))for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(r[o])}}for(let[r,s]of t.refCount)s>1&&t.idOf.set(r,t.nextId++)}function $(e,t){if(e===null)return null;if(e===void 0)return{[g]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[g]:"NaN"}:e===1/0?{[g]:"Inf"}:e===-1/0?{[g]:"-Inf"}:Object.is(e,-0)?{[g]:"-0"}:e;if(n==="bigint")return{[g]:"BigInt",v:e.toString()};if(n==="symbol"){let o=Symbol.keyFor(e);if(o===void 0)throw new TypeError("Cannot serialize a local Symbol; only Symbol.for() registered symbols are supported.");return{[g]:"Sym",v:o}}if(n==="function")throw new TypeError("Cannot serialize a function.");let r=t.idOf.get(e);if(r!==void 0&&t.emitted.has(r))return{[g]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[g]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[g]:"Error",v:{name:e.name,message:e.message,stack:e.stack||null}};else if(typeof Blob<"u"&&e instanceof Blob){let o=t.blobBytes.get(e);typeof File<"u"&&e instanceof File?s={[g]:"File",v:ae(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[g]:"Blob",v:ae(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=[];for(let[i,c]of e.entries())o.push([i,$(c,t)]);s={[g]:"FD",v:o}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=Jr(e);else if(e instanceof Map){let o=[];for(let[i,c]of e)o.push([$(i,t),$(c,t)]);s={[g]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push($(i,t));s={[g]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>$(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=ro(o)?"_"+o:o;s[i]=$(e[o],t)}}if(r!==void 0){if(Array.isArray(s))return{[g]:"Arr",[le]:r,v:s};s[le]=r}return s}function Jr(e){if(e instanceof ArrayBuffer)return{[g]:"buf",v:ae(new Uint8Array(e))};if(e instanceof DataView)return{[g]:"dv",v:ae(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=Xr[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[g]:n,v:ae(r)}}var Xr={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},Qr={i8:Int8Array,u8:Uint8Array,u8c:Uint8ClampedArray,i16:Int16Array,u16:Uint16Array,i32:Int32Array,u32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:typeof BigInt64Array<"u"?BigInt64Array:null,bu64:typeof BigUint64Array<"u"?BigUint64Array:null};function Zr(){return{refs:new Map}}function L(e,t){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){let o=[];for(let i=0;i<e.length;i++)o.push(L(e[i],t));return o}let n=e[g];if(typeof n=="string")return eo(e,n,t);let r={},s=e[le];typeof s=="number"&&t.refs.set(s,r);for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o)||o===le)continue;let i=oo(o)?o.slice(1):o;r[i]=L(e[o],t)}return r}function eo(e,t,n){let r=e[le],s=o=>(typeof r=="number"&&n.refs.set(r,o),o);switch(t){case"undef":return;case"NaN":return NaN;case"Inf":return 1/0;case"-Inf":return-1/0;case"-0":return-0;case"BigInt":return s(BigInt(e.v));case"Sym":return s(Symbol.for(e.v));case"Date":return s(e.v==null?new Date(NaN):new Date(e.v));case"Error":{let o=new Error(e.v.message);return o.name=e.v.name,e.v.stack&&(o.stack=e.v.stack),typeof r=="number"&&n.refs.set(r,o),o}case"Map":{let o=new Map;typeof r=="number"&&n.refs.set(r,o);for(let[i,c]of e.v)o.set(L(i,n),L(c,n));return o}case"Set":{let o=new Set;typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.add(L(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(L(i,n));return o}case"Ref":{let o=n.refs.get(e.v);if(o===void 0)throw new TypeError(`Dangling reference: id=${e.v}`);return o}case"Blob":{if(typeof Blob>"u")throw new TypeError("Blob is not available in this environment.");let o=ce(e.v);return s(new Blob([o],{type:e.t||""}))}case"File":{if(typeof File>"u")throw new TypeError("File is not available in this environment.");let o=ce(e.v);return s(new File([o],e.n,{type:e.t||"",lastModified:e.m}))}case"FD":{if(typeof FormData>"u")throw new TypeError("FormData is not available in this environment.");let o=new FormData;s(o);for(let[i,c]of e.v){let a=L(c,n);o.append(i,a)}return o}default:{if(t==="buf"){let i=ce(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=ce(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=Qr[t];if(o){let i=ce(e.v),c=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return s(new o(c))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function to(e){return e!==null&&typeof e=="object"}function no(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ro(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function oo(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}var bn=typeof Buffer<"u"&&typeof Buffer.from=="function";function ae(e){if(bn)return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function ce(e){if(bn){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}var Sn=typeof window<"u"&&typeof HTMLElement<"u";function so(e,t){return e!==t}var io=Sn?HTMLElement:class{},pt=class extends io{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){dt(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(_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._initializeProperties()}_initializeProperties(){let n=this.constructor.properties;if(!(!n||typeof n!="object")){this.__propValues={};for(let[r,s]of Object.entries(n)){let o=typeof s=="object"?s:{type:s},i=this[r];Object.defineProperty(this,r,{configurable:!0,enumerable:!0,get:()=>this.__propValues[r],set:c=>{let a=this.__propValues[r];(o.hasChanged||so)(c,a)&&(this.__propValues[r]=c,o.reflect&&!o.state&&this._connected&&this._reflectAttribute(r,c,o),this.requestUpdate(r,a))}}),i!==void 0&&(this.__propValues[r]=i)}}}_reflectAttribute(t,n,r){let s=_n(t);if(!this.__reflectingAttribute){this.__reflectingAttribute=!0;try{if(r.converter&&r.converter.toAttribute){let o=r.converter.toAttribute(n,r.type);o==null?this.removeAttribute(s):this.setAttribute(s,o)}else r.type===Boolean?n?this.setAttribute(s,""):this.removeAttribute(s):n==null?this.removeAttribute(s):r.type===Object||r.type===Array?this.setAttribute(s,JSON.stringify(n)):this.setAttribute(s,String(n))}finally{this.__reflectingAttribute=!1}}}connectedCallback(){if(!Sn)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 s=n[r].name;s.startsWith("data-webjs-prop-")&&t.push(s)}for(let r of t){let s=this.getAttribute(r);if(this.removeAttribute(r),s==null)continue;let o=wn(r.slice(16));try{this[o]=ue(s)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0;let t=this.constructor;if(t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,s=Array.isArray(r)?r:Fe(r)?[r]:[];if(s.length){if(n){let o=this.shadowRoot.querySelector("style");o&&o.remove()}Be(this._renderRoot,s)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${xe(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().`),ct(this)||(this.__isHydrating()?(O(this),Qt(this)):Xt(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)}this._renderRoot===this&&en(this)})}__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),this._renderRoot===this&&tn(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,o=wn(t),i=s.properties&&(s.properties[o]||s.properties[t]);if(!i)return;let c;if(i.converter&&i.converter.fromAttribute)c=i.converter.fromAttribute(r,i.type);else if(i.type===Number)c=r==null?null:Number(r);else if(i.type===Boolean)c=r!=null&&r!=="false";else if(i.type===Object||i.type===Array)try{c=r==null?null:JSON.parse(r)}catch{c=r}else c=r;this[o]!==c&&(this[o]=c,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;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let r of this.__controllers)r.hostUpdate&&r.hostUpdate();try{this.update(t)}catch(r){console.error(`[webjs] render error in <${xe(this.constructor)||this.tagName?.toLowerCase()}>:`,r);try{let s=this.renderError(r);s!==void 0&&Ne(s,this._renderRoot)}catch(s){console.error("[webjs] renderError() also threw:",s)}}for(let r of this.__controllers)r.hostUpdated&&r.hostUpdated();n=!0}}catch(r){console.error("[webjs] lifecycle hook threw during update phase:",r)}finally{this._isUpdating=!1,n&&(this._changedProperties=new Map)}if(n)try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(r){console.error("[webjs] lifecycle hook threw during post-commit phase:",r)}finally{this._resolveUpdate()}else this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new Z.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;this.__signalWatcher.observe(()=>{n=this.render()}),Ne(n,this._renderRoot)}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){}};function _n(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function wn(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var An=Symbol.for("webjs.notFound"),vn=Symbol.for("webjs.redirect");function co(){let e=new Error("webjs: notFound()");throw e.__webjs=An,e}function ao(e,t=307){let n=new Error(`webjs: redirect(${e})`);throw n.__webjs=vn,n.url=e,n.status=t,n}function lo(e){return!!e&&e.__webjs===An}function uo(e){return!!e&&e.__webjs===vn}var Cn=null;function fo(){if(!Cn)return"";try{return Cn()||""}catch{return""}}var As=Symbol.for("webjs.suspense");function ho(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function po(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function mo(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function c(){s||(o=new WebSocket(go(e),t.protocols),o.onopen=a=>{for(r=0;i.length&&o&&o.readyState===WebSocket.OPEN;)o.send(i.shift());t.onOpen?.(a)},o.onmessage=a=>{let l=a.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,a)},o.onerror=a=>{t.onError?.(a)},o.onclose=a=>{if(t.onClose?.(a),!s&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(c,l)}})}return c(),{send(a){let l=typeof a=="string"||a instanceof ArrayBuffer||ArrayBuffer.isView(a)?a:JSON.stringify(a);o&&o.readyState===WebSocket.OPEN?o.send(l):i.push(l)},close(a,l){s=!0;try{o?.close(a,l)}catch{}},get socket(){return o},get readyState(){return o?.readyState??3}}}function go(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}`}var mt="application/vnd.webjs+json";async function yo(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",mt);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 ht(r),n.has("content-type")||n.set("content-type",mt));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),c=o.includes(mt)?i?ue(i):null:o.includes("application/json")?i?JSON.parse(i):null:i;if(!s.ok){let a=c&&c.error||`richFetch ${e} -> ${s.status}`,l=new Error(a);throw l.status=s.status,l.body=c,l}return c}var gt=typeof HTMLElement<"u"?class extends HTMLElement{}:null;typeof customElements<"u"&&gt&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",gt);function xn(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}var q=!1,M=null,v=0,yt=null;function bo(){yt||typeof MutationObserver>"u"||typeof customElements>"u"||(yt=new MutationObserver(e=>{for(let t of e)for(let n of t.addedNodes){if(n.nodeType!==1)continue;let r=n;r.tagName?.includes("-")&&customElements.upgrade(r);for(let s of r.querySelectorAll("*"))s.tagName?.includes("-")&&customElements.upgrade(s)}}),yt.observe(document.body,{childList:!0,subtree:!0}))}var I=null,Re=null;function Rn(){q||typeof document>"u"||(q=!0,document.addEventListener("click",On,!1),document.addEventListener("submit",Ln,!1),window.addEventListener("popstate",jn),document.addEventListener("pointerover",G,!0),document.addEventListener("focusin",G,!0),document.addEventListener("touchstart",G,{capture:!0,passive:!0}),document.addEventListener("pointerout",$n,!0),document.addEventListener("webjs:navigate",At),bo(),At(),typeof history<"u"&&"scrollRestoration"in history&&(Re=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(I=location.href))}function _o(){q&&(q=!1,document.removeEventListener("click",On,!1),document.removeEventListener("submit",Ln,!1),window.removeEventListener("popstate",jn),document.removeEventListener("pointerover",G,!0),document.removeEventListener("focusin",G,!0),document.removeEventListener("touchstart",G,{capture:!0}),document.removeEventListener("pointerout",$n,!0),document.removeEventListener("webjs:navigate",At),kt(),P&&(P.disconnect(),P=null),typeof history<"u"&&Re!==null&&(history.scrollRestoration=Re,Re=null),I=null)}async function wo(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await Tt(n.href,t?.replace??!1,null)}function So(e){if(!e){S.clear(),A.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;S.delete(n),A.delete(n)}var Nt=/\.(?: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;function On(e){if(!q||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=Eo(e);if(!t||t.hasAttribute("download")||t.hasAttribute("data-no-router")||t.target&&t.target!=="_self")return;let n=t.href;if(!n)return;let r=new URL(n);if(r.origin!==location.origin||r.pathname===location.pathname&&r.search===location.search&&r.hash||Nt.test(r.pathname))return;e.preventDefault();let s=Pn(t);Tt(n,!1,s)}function jn(e){Tt(location.href,!0,null)}function Ln(e){if(!q||e.defaultPrevented)return;let t=e.target;if(!t||t.nodeType!==1||t.tagName!=="FORM"||t.hasAttribute("data-no-router"))return;let n=e.submitter??null;if(n&&n.hasAttribute("data-no-router"))return;let r=n&&n.getAttribute("formtarget")||t.getAttribute("target")||"";if(r&&r!=="_self")return;let s=Ao(t,n);if(s==="dialog")return;let o=vo(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||Nt.test(i.pathname))return;let c=Co(t,n);e.preventDefault();let a=Pn(t);xo(i.href,s,c,a)}function Ao(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function vo(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function Co(e,t){try{return new FormData(e,t||void 0)}catch{let n=new FormData(e);return t&&t.getAttribute("name")&&n.append(t.getAttribute("name"),t.getAttribute("value")||""),n}}function Eo(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function Pn(e){let t=e;for(;t;){let n=t.closest("webjs-frame");if(n&&n.id)return n.id;let r=t.getRootNode();if(r&&r.host)t=r.host;else break}return null}function Le(e){let t=new Map,n=[];function r(s){if(s.nodeType===8){let o=s,i=o.data,c=/^wj:children:(.+)$/.exec(i);if(c){n.push({path:c[1],start:o});return}if(i.trim()==="/wj:children"){let a=n.pop();a&&!t.has(a.path)&&t.set(a.path,{start:a.start,end:o});return}return}if(s.hasChildNodes&&s.hasChildNodes())for(let o=s.firstChild;o;o=o.nextSibling)r(o)}return r(e),t}function No(e,t){let n=null;for(let r of e.keys())t.has(r)&&(n===null||r.length>n.length)&&(n=r);return n}var To=16,S=new Map;function Mn(e){let t=Y(e);S.has(t)&&S.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(S.set(t,n);S.size>To;){let r=S.keys().next().value;S.delete(r)}}function ko(e){let t=Y(e),n=S.get(t);return n==null?null:(S.delete(t),S.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function Y(e){let t=new URL(e,location.href);return t.pathname+t.search}async function Tt(e,t,n){M&&M.abort(),M=new AbortController;let r=M.signal,s=++v;I&&Mn(I);let o=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),o=null},150),i=null;t||(i=Vn());try{if(t){let c=ko(e);if(c){let a=xn(c.html);if(a){qn(a,n,!0,null),typeof window<"u"&&window.scrollTo(c.scrollX,c.scrollY),vt(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await vt(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===v&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(I=location.href))}}async function xo(e,t,n,r){M&&M.abort(),M=new AbortController;let s=M.signal,o=++v,i=t==="get"||t==="head",c=new URL(e,location.href);if(i){c.search="";for(let[f,p]of n)c.searchParams.append(f,typeof p=="string"?p:p.name)}I&&Mn(I);let a=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),a=null},150),l=Vn();try{await vt(c.href,r,!0,l,i?"GET":t.toUpperCase(),i?null:n,s,o),!i&&o===v&&(S.clear(),A.clear())}finally{a&&clearTimeout(a),o===v&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(I=location.href))}}function In(){return[...Le(document.body).keys()].join(",")}var Ro=8,Un=3e4,Fn=3,Oo=24,jo=100,A=new Map,fe=new Set,de=[],Oe=new Set,K=null,he=null,P=null;function Bn(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&e.saveData===!0||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function Lo(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function _t(e){if(!e||!(e instanceof HTMLAnchorElement)||e.hasAttribute("download")||e.hasAttribute("data-no-router")||e.target&&e.target!=="_self")return null;let t=e.href;if(!t)return null;let n;try{n=new URL(t)}catch{return null}return n.origin!==location.origin||n.pathname===location.pathname&&n.search===location.search&&n.hash||Nt.test(n.pathname)?null:t}function Po(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Lo(e);return t.includes("external")||t.includes("no-prefetch")}function wt(e){if(Po(e))return"none";switch((e.getAttribute("data-prefetch")||"").toLowerCase().trim()){case"false":case"none":return"none";case"true":case"render":return"render";case"auto":case"viewport":return"viewport";case"intent":return"intent";default:return"intent"}}function Pe(e){if(typeof fetch!="function"||Bn())return;let t=Y(e);if(fe.has(t)||Oe.has(t))return;let n=A.get(t);if(n&&St()-n.at<Un)return;if(fe.size>=Fn){for(Oe.add(t),de.push(e);de.length>Oo;){let o=de.shift();Oe.delete(Y(o))}return}fe.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=In();s&&(r["x-webjs-have"]=s),fetch(e,{method:"GET",headers:r,credentials:"same-origin"}).then(async o=>{let i=o.headers.get("content-type")||"";if(!/^text\/html\b/i.test(i)||o.status>=400)return;let c=o.headers.get("x-webjs-build"),a=o.redirected&&o.url?o.url:e,l=await o.text();Io(t,{html:l,build:c,finalUrl:a,at:St()})}).catch(()=>{}).finally(()=>{fe.delete(t),Mo()})}function Mo(){for(;de.length&&fe.size<Fn;){let e=de.shift();Oe.delete(Y(e)),Pe(e)}}function Io(e,t){for(A.has(e)&&A.delete(e),A.set(e,t);A.size>Ro;){let n=A.keys().next().value;A.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Uo(e){let t=Y(e),n=A.get(t);return!n||(A.delete(t),St()-n.at>=Un)?null:n}function St(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function G(e){if(!q)return;let t=Dn(e.target);if(!t||wt(t)!=="intent")return;let n=_t(t);n&&(he===t&&K||(kt(),he=t,K=setTimeout(()=>{K=null,he=null,Pe(n)},jo)))}function $n(e){let t=Dn(e.target);t&&t===he&&kt()}function kt(){K&&(clearTimeout(K),K=null),he=null}function Dn(e){let t=e;for(;t;){if(t instanceof HTMLAnchorElement)return t;let n=t.nodeType===1?t:null;if(n){let s=n.closest&&n.closest("a");if(s instanceof HTMLAnchorElement)return s}let r=t.getRootNode?t.getRootNode():null;t=r&&r.host?r.host:null}return null}function At(){if(typeof document>"u"||Bn())return;let e=typeof IntersectionObserver<"u";e&&(P?P.disconnect():P=new IntersectionObserver(t=>{for(let n of t){if(!n.isIntersecting)continue;let r=n.target;P.unobserve(r);let s=_t(r);s&&wt(r)==="viewport"&&Pe(s)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=wt(t);if(n==="render"){let r=_t(t);r&&Pe(r)}else n==="viewport"&&e&&P.observe(t)}}async function vt(e,t,n,r,s,o,i,c){s=s||"GET";let a=typeof c=="number"?c:v,l,f=null,p=e;try{let h=s==="GET"&&!o&&!t?Uo(e):null;if(h)l=h.html,f=h.build,p=h.finalUrl;else{let y={"x-webjs-router":"1"},J=In();J&&(y["x-webjs-have"]=J),t&&(y["x-webjs-frame"]=t);let b={method:s,headers:y,credentials:"same-origin"};i&&(b.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(b.body=o);let u=await fetch(e,b),H=u.headers.get("content-type")||"",_=/^text\/html\b/i.test(H);if(u.redirected&&u.url&&(p=u.url),u.status===204||u.status===205){a===v&&n&&history.pushState(null,"",p);return}if(!_){a===v&&(location.href=e);return}f=u.headers.get("x-webjs-build"),l=await u.text()}}catch(h){if(h&&h.name==="AbortError"||a!==v)return;$o(r),location.href=e;return}if(a!==v)return;let d=xn(l);if(!d){location.href=e;return}if(qn(d,t,!1,p,f),n&&history.pushState(null,"",p),n){let h=new URL(p);if(h.hash){let y=document.getElementById(h.hash.slice(1));y?y.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:p,frameId:t,from:"navigate"}}))}function En(e){if(!e||!e.head)return"";let t=e.head.querySelectorAll('[data-webjs-track="reload"]');if(!t.length)return"";let n="";for(let r of t)n+=D(r);return n}function qn(e,t,n,r,s){try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let f=document.querySelector('script[type="importmap"]'),p=f?f.getAttribute("data-webjs-build"):null,d=!1;if(s&&p&&(d=s!==p),!d&&e.head&&e.head.children.length>0){let h=En(document),y=En(e);h!==y&&(d=!0)}if(d&&typeof location<"u")try{let h="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(h))sessionStorage.removeItem(h);else{sessionStorage&&sessionStorage.setItem(h,"1"),location.href=r;return}}catch{location.href=r;return}else if(!d)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let f=document.querySelector(`webjs-frame#${CSS.escape(t)}`),p=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(f&&p){Tn(e.head),Do(f,p),Et(f),je(f),kn(e.body),bt();return}}let o=Le(document.body),i=Le(e.body),c=No(o,i);if(c){Tn(e.head),Fo(o.get(c),i.get(c),e),kn(e.body),bt();return}qo(e.head);let a=[...e.body.childNodes],l=()=>{document.body.replaceChildren(...a),Et(document.body),je(document.body),bt()};document.startViewTransition?document.startViewTransition(l).finished.then(()=>je(document.body)).catch(()=>{}):l()}function bt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function Fo(e,t,n){if(!e||!t)return;let r=e.start.parentNode;if(!r)return;let s=[];for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)s.push(i);let o=[];for(let i=t.start.nextSibling;i&&i!==t.end;i=i.nextSibling)o.push(document.importNode(i,!0));Bo(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(Et(i),je(i))}function Bo(e,t,n,r,s){let o=new Map;for(let a of r){if(a.nodeType!==1)continue;let l=pe(a);l&&o.set(l,a)}let i=n,c=[];for(let a of s){if(a.nodeType===1){let l=pe(a);if(l&&o.has(l)){let f=o.get(l);Ct(f,a),c.push(f),o.delete(l);continue}}c.push(a)}for(let a of r)if(a.parentNode===e){if(a.nodeType===1&&c.includes(a))continue;e.removeChild(a)}for(let a of c)e.insertBefore(a,i)}function Ct(e,t){if(e.tagName!==t.tagName){e.replaceWith(t);return}let n=new Set;for(let r of t.attributes)n.add(r.name),!Nn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])Nn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Hn(e,t)}function Hn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(c=>document.importNode(c,!0)),s=new Map;for(let c of n){if(c.nodeType!==1)continue;let a=pe(c);a&&s.set(a,c)}let o=[];for(let c=0;c<r.length;c++){let a=r[c];if(a.nodeType===1){let l=pe(a);if(l&&s.has(l)){let p=s.get(l);Ct(p,a),o.push(p),s.delete(l);continue}let f=n[c];if(f&&f.nodeType===1&&!pe(f)&&f.tagName===a.tagName){Ct(f,a),o.push(f);continue}}else if(a.nodeType===3){let l=n[c];if(l&&l.nodeType===3){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}else if(a.nodeType===8){let l=n[c];if(l&&l.nodeType===8){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}o.push(a)}let i=new Set(o);for(let c of n)!i.has(c)&&c.parentNode===e&&e.removeChild(c);for(let c=0;c<o.length;c++){let a=o[c];(a.parentNode!==e||e.childNodes[c]!==a)&&e.insertBefore(a,e.childNodes[c]||null)}}function pe(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}var Nn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);function Vn(){let e=Le(document.body);if(e.size===0)return null;let t=null;for(let i of e.keys())(t===null||i.length>t.length)&&(t=i);if(t===null)return null;let n=document.getElementById(`wj-loading:${t}`);if(!(n instanceof HTMLTemplateElement))return null;let r=e.get(t),s=[];for(let i=r.start.nextSibling;i&&i!==r.end;i=i.nextSibling)s.push(i);let o=document.createRange();return o.setStartAfter(r.start),o.setEndBefore(r.end),o.deleteContents(),r.start.parentNode.insertBefore(n.content.cloneNode(!0),r.end),{slot:r,oldChildren:s,token:v}}function $o(e){if(!e||e.token!==v)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let s of n)t.start.parentNode.insertBefore(s,t.end)}function Do(e,t){Hn(e,t)}function Wn(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function xt(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=Wn();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function zn(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=Wn();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function D(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function Tn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(D(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(D(r))||(r.tagName==="SCRIPT"?document.head.appendChild(xt(r)):document.head.appendChild(zn(r))))}function qo(e){let t=document.head,n=e.querySelector("title");n&&(document.title=n.textContent||"");let r=new Set;for(let o of t.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&r.add(D(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(D(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(D(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(D(o))||(o.tagName==="SCRIPT"?t.appendChild(xt(o)):t.appendChild(zn(o))))}function je(e){typeof customElements>"u"||Kn(e)}function Kn(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&&Kn(n.shadowRoot))}function kn(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}function Et(e){for(let t of e.querySelectorAll("script"))t.replaceWith(xt(t))}Rn();var Ho=Symbol.for("webjs.context");function Vo(e){return{__context__:Ho,name:e}}var Me=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},Rt=class{constructor(t,{context:n,initialValue:r}){this._host=t,this._context=n,this._value=r,this._subscriptions=new Set,this._onRequest=s=>{let o=s;if(o.context===this._context)if(s.stopPropagation(),o.subscribe){let i={callback:o.callback},c=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),o.callback(this._value,c)}else o.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()}},Ot=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 Me(this._context,(n,r)=>{let s=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(s,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};var k={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},jt=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=k.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=k.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=k.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=k.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 k.INITIAL:return t.initial?.();case k.PENDING:return t.pending?.();case k.COMPLETE:return t.complete?.(this._value);case k.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun)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{Ot as ContextConsumer,Rt as ContextProvider,Me as ContextRequestEvent,m as MARKER,Z as Signal,ho as Suspense,jt as Task,k as TaskStatus,pt as WebComponent,gt as WebjsFrame,Be as adoptStyles,Kr as allTags,ur as batch,dr as computed,mo as connectWS,Vo as createContext,fo as cspNonce,Yn as css,yn as deserialize,_o as disableClientRouter,pr as effect,Rn as enableClientRouter,Qn as escapeAttr,Xn as escapeText,Gn as html,Fe as isCSS,zr as isLazy,qe as isLive,lo as isNotFound,uo as isRedirect,$e as isRepeat,hr as isSignal,po as isSuspense,w as isTemplate,De as isUnsafeHTML,tr as live,Vr as lookup,Wr as lookupModuleUrl,wo as navigate,co as notFound,ue as parse,Hr as primeModuleUrl,ao as redirect,dt as register,Ne as render,Zn as repeat,So as revalidate,yo as richFetch,gn as serialize,fr as signal,ht as stringify,Jn as stylesToString,xe as tagOf,er as unsafeHTML};
1
+ function Jn(e,...t){return{_$webjs:"template",strings:e,values:t}}function w(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var m="w$";function Xn(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 ze(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Ke(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(`
2
+ `),n.appendChild(r)}}function Qn(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
+ `)}</style>`}function Zn(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function er(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var Bt=Symbol.for("webjs.repeat");function Dt(e,t,n){return{[Bt]:!0,items:[...e],keyFn:t,templateFn:n}}function me(e){return!!e&&typeof e=="object"&&e[Bt]===!0}function tr(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function Ge(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function nr(e){return{_$webjs:"live",value:e}}function Ye(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function rr(e,t){return{_$webjs:"keyed",key:e,value:t}}function ge(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function sr(e,t){return{_$webjs:"guard",deps:e,fn:t}}function be(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function or(e){return{_$webjs:"template-content",template:e}}function Je(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function ir(e){return{_$webjs:"ref",target:e}}function ye(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function ar(){return{value:void 0}}function cr(e){return{_$webjs:"cache",value:e}}function _e(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function lr(...e){return{_$webjs:"until",args:e}}function we(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function ur(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function Xe(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function fr(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function Qe(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function dr(e){return{_$webjs:"watch",signal:e}}function Se(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var C=null,x=!1,z=0,W=null,Ze=0,$t=(e,t)=>Object.is(e,t),ve=()=>{},qt=()=>!1;function Ht(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)Ht(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function X(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)X(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function ot(e){if(x)throw new Error("Signal read during notification phase");if(C===null)return;let t=C,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&nt(t)&&X(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,nt(t)&&Ht(e,t)),t.producerLastReadVersions[n]=e.version}function nt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function Vt(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=x;x=!0;try{for(let n of e.liveConsumers)n.dirty||hr(n)}finally{x=t}}function hr(e){e.dirty=!0,Vt(e),e.consumerMarkedDirty.call(e.wrapper||e)}function Ce(e){if(!(!e.dirty&&e.lastCleanEpoch===z)){if(!e.producerMustRecompute()&&!pr(e)){e.dirty=!1,e.lastCleanEpoch=z;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=z}}function pr(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(Ce(n),r!==n.version))return!0}return!1}function rt(e){e&&(e.nextProducerIndex=0);let t=C;return C=e,t}function st(e,t){if(C=t,!!e){if(nt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)X(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var Ee=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=z,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=qt,this.producerRecomputeValue=ve,this.consumerMarkedDirty=ve,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||$t,this.watched=n?.[it],this.unwatched=n?.[at]}get(){return ot(this),this.__value}peek(){return this.__value}set(t){if(x)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,z++,W!==null?Wt(this):Vt(this))}};function Wt(e){let t=x;x=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?W.add(n):Wt(n))}finally{x=t}}var et=Symbol("unset"),tt=Symbol("computing"),Ae=Symbol("errored"),Q=class{constructor(t,n){this.__fn=t,this.__value=et,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||$t,this.watched=n?.[it],this.unwatched=n?.[at];let r=this;this.producerMustRecompute=function(){return r.__value===et||r.__value===tt},this.producerRecomputeValue=function(){if(r.__value===tt)throw new Error("Detected cycle in computations.");let o=r.__value;r.__value=tt;let s=rt(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=Ae,r.__error=l,a=!0}finally{st(r,s)}if(!a&&(o!==et&&o!==Ae)&&r.__equal.call(r.wrapper,o,i)){r.__value=o;return}r.__value=i,r.version++},this.consumerMarkedDirty=ve}get(){if(Ce(this),ot(this),this.__value===Ae)throw this.__error;return this.__value}peek(){if(Ce(this),this.__value===Ae)throw this.__error;return this.__value}},Ne=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=z,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=qt,this.producerRecomputeValue=ve,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=rt(this);try{for(let r of t)ot(r),r.__isComputed&&Ce(r)}finally{st(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(X(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=rt(this),r;try{r=t()}finally{st(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)X(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},it=Symbol("watched"),at=Symbol("unwatched");function mr(e){let t=C;C=null;try{return e()}finally{C=t}}function gr(e){return e.producers.slice()}function br(e){return e.liveConsumers?[...e.liveConsumers]:[]}function yr(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function _r(e){return e.producers.length>0}function wr(){return C&&C.__isComputed?C:null}function Sr(e){Ze++,W===null&&(W=new Set);try{e()}finally{if(Ze--,Ze===0){let t=W;W=null;for(let n of t)n.__fire()}}}var Z={State:Ee,Computed:Q,subtle:{Watcher:Ne,untrack:mr,introspectSources:gr,introspectSinks:br,hasSinks:yr,hasSources:_r,currentComputed:wr,watched:it,unwatched:at}};function Ar(e,t){return new Ee(e,t)}function vr(e,t){return new Q(e,t)}function Cr(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Er(e){let t=!1,n=!1,r=new Q(e),o=new Ne(()=>{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())}}var Nr=`${m}s`,Tr=`${m}e`;function zt(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Nr||t===Tr}function kr(e){for(let t of e.addedNodes)if(zt(t))return!0;for(let t of e.removedNodes)if(zt(t))return!0;return!1}function Xt(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var te=Xt(),U=Symbol("webjs.slot.state"),R="data-webjs-light",F="data-projection",ne="actual",Qt="fallback",Re=Symbol("webjs.slot.fallbackFrag"),xr=64,ee=null,ct=null,Te=null,Kt=!1;function Rr(){Kt||(te=Xt(),te&&(ee=HTMLSlotElement.prototype.assignedNodes,ct=HTMLSlotElement.prototype.assignedElements,Te=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(R)&&!Gt(this)?lt(this,t):ee?ee.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(R)&&!Gt(this)?lt(this,t).filter(n=>n.nodeType===1):ct?ct.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=Te&&Te.get?Te.get.call(this):null;return t||Or(this)}}),Kt=!0))}Rr();function Gt(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function lt(e,t){if(e.getAttribute(F)===Qt)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:ut(n,new Set,0)}function ut(e,t,n){if(n>=xr)return e.slice();let r=[];for(let o of e)if(o.nodeType===1&&o.tagName==="SLOT"){let s=o;if(t.has(s))continue;if(t.add(s),s.hasAttribute(R)){let i=lt(s,{flatten:!1});if(i.length>0)for(let a of ut(i,t,n+1))r.push(a);else for(let a of ut(Array.from(s.childNodes),t,n+1))r.push(a)}else if(ee){let i=ee.call(s,{flatten:!0});for(let a of i)r.push(a)}else r.push(o)}else r.push(o);return r}function Or(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(R))return t.getAttribute(F)===ne?t:null;t=t.parentElement}return null}function O(e){let t=e,n=t[U];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[U]=n),n}function ft(e){return!!e[U]}function Zt(e){let t=O(e);for(;e.firstChild;){let n=e.firstChild,r=ke(n);xe(t.assignedByName,r,n),e.removeChild(n)}}function en(e){let t=O(e),n=e.querySelectorAll(`slot[${R}]`);for(let r of n){let o=r;if(o.getAttribute(F)!==ne)continue;let s=o.getAttribute("name")||null;if(!t.assignedByName.has(s)){let i=Array.from(o.childNodes);t.assignedByName.set(s,i),t.lastSnapshot.set(o,i.slice())}}}function ke(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function xe(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function tn(e,t,n){if(!n.length)return;let r=e.get(t);r||(r=[],e.set(t,r));for(let o of n)r.push(o)}function nn(e){if(!te)return;let t=O(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let o of n)if(!kr(o)){if(o.type==="childList"){for(let s of o.addedNodes)s.parentElement===e&&(xe(t.assignedByName,ke(s),s),r=!0);for(let s of o.removedNodes)e.contains(s)||Yt(t,s)&&(r=!0)}else if(o.type==="attributes"&&o.attributeName==="slot"){let s=o.target;(Yt(t,s)||s.parentElement===e)&&(xe(t.assignedByName,ke(s),s),r=!0)}}r&&Oe(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function rn(e){let t=e[U];if(t){t.childObserver&&(t.childObserver.disconnect(),t.childObserver=null);for(let n of t.ownedSlots){let r=t.nameObservers.get(n);r&&(r.disconnect(),t.nameObservers.delete(n))}}}function Yt(e,t){for(let[n,r]of e.assignedByName){let o=r.indexOf(t);if(o!==-1)return r.splice(o,1),r.length===0&&e.assignedByName.delete(n),!0}return!1}function Oe(e){let t=O(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,jr(e)}))}function jr(e){if(!te)return;let t=e[U];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${R}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||Lr(t,i);for(let i of r)t.ownedSlots.has(i)||Ir(e,i);t.ownedSlots=r;let o=new Map;for(let i of n){let a=i.getAttribute("name")||null,c=o.get(a);c||(c=[],o.set(a,c)),c.push(i)}for(let i of o.keys()){let a=t.pendingByName.get(i);if(a&&a.length){let c=t.assignedByName.get(i)||[],l=[];for(let f of a)l.push(f);for(let f of c)l.indexOf(f)===-1&&l.push(f);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let s=[];for(let[i,a]of o){let c=t.assignedByName.get(i)||[];for(let l=0;l<a.length;l++){let f=a[l];l===0&&c.length>0?Pr(t,f,c)&&s.push(f):Mr(t,f)&&s.push(f)}}for(let i of s)Ur(i)}function Lr(e,t){let n=e.nameObservers.get(t);n&&(n.disconnect(),e.nameObservers.delete(t));let r=e.lastSnapshot.get(t);if(r&&r.length>0){let o=t.getAttribute("name")||null;tn(e.pendingByName,o,r)}e.lastSnapshot.delete(t)}function Pr(e,t,n){let r=t.getAttribute(F)!==ne,o=e.lastSnapshot.get(t)||[];if(!r&&Fr(o,n))return!1;let i=t[Re];if(r&&i)for(;t.firstChild;)i.appendChild(t.firstChild);else for(;t.firstChild;)t.removeChild(t.firstChild);for(let a of n)t.appendChild(a);return t.setAttribute(F,ne),e.lastSnapshot.set(t,n.slice()),!0}function Mr(e,t){let n=t.getAttribute(F)===ne;if(t.setAttribute(F,Qt),!n)return Jt(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return Jt(t),!0}function Jt(e){let t=e[Re];!t||t.childNodes.length===0||e.appendChild(t)}function Ir(e,t){if(!te)return;let n=O(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>Oe(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function sn(e,t){if(!ft(e))return;let n=O(e),r=n.lastSnapshot.get(t);if(!r||r.length===0)return;let o=t.getAttribute("name")||null;for(let i of r)i.parentNode===t&&t.removeChild(i);tn(n.pendingByName,o,r),n.lastSnapshot.delete(t);let s=n.nameObservers.get(t);s&&(s.disconnect(),n.nameObservers.delete(t)),n.ownedSlots.delete(t)}function Ur(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function Fr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var on=new WeakMap,dt=Symbol.for("webjs.instance");function Le(e,t){let n=t,r=n[dt];if(w(e)){let o=e;if(r&&r.strings===o.strings){oe(r,o.values);return}r&&an(r,t);let s=t.firstChild;s&&s.nodeType===8&&s.data==="webjs-hydrate"&&s.remove();let i=$r(o,t);n[dt]=i;return}if(r&&an(r,t),n[dt]=null,t.replaceChildren(),!(e==null||e===!1||e===!0)){if(Array.isArray(e)){for(let o of e){let s=document.createTextNode(String(o??""));t.appendChild(s)}return}t.appendChild(document.createTextNode(String(e)))}}function re(e){let{strings:t}=e,n=on.get(t);if(n)return n;let r=[],o="",s="text",i="",a=0,c="",l=0,f=null,p="",d="";for(let b=0;b<t.length;b++){let J=t[b];for(let y=0;y<J.length;y++){let u=J[y];switch(s){case"text":o+=u,u==="<"&&(s="tag-open");break;case"tag-open":o+=u,u==="!"?s="bang-1":u==="/"?(s="tag-name",p=""):/[a-zA-Z]/.test(u)?(s="tag-name",p=u.toLowerCase()):s="text";break;case"bang-1":o+=u,s=u==="-"?"bang-dash":"tag-name";break;case"bang-dash":o+=u,u==="-"?(s="comment",l=0):s="tag-name";break;case"comment":o+=u,u==="-"?l+=1:(u===">"&&l>=2&&(s="text"),l=0);break;case"tag-name":o+=u,u===">"?(s=p==="script"||p==="style"?"rawtext":"text",s==="rawtext"&&(d="")):/\s/.test(u)?s="in-tag":p+=u.toLowerCase();break;case"in-tag":o+=u,u===">"?(s=p==="script"||p==="style"?"rawtext":"text",s==="rawtext"&&(d="")):!/\s/.test(u)&&u!=="/"&&(s="attr-name",i=u,a=o.length-1);break;case"rawtext":o+=u,d=(d+u.toLowerCase()).slice(-9),(d.endsWith("<\/script>")||d.endsWith("</style>"))&&(s="text",d="",p="");break;case"attr-name":u==="="?(s="after-eq",o+=u):/\s/.test(u)?(s="in-tag",i="",o+=u):u===">"?(s="text",i="",o+=u):(i+=u,o+=u);break;case"after-eq":u==='"'||u==="'"?(s="attr-quoted",c=u,o+=u):/\s/.test(u)?(s="in-tag",i="",o+=u):u===">"?(s="text",i="",o+=u):(s="attr-unquoted",o+=u);break;case"attr-unquoted":/\s/.test(u)?(s="in-tag",i="",o+=u):(u===">"&&(s="text",i=""),o+=u);break;case"attr-quoted":o+=u,u===c&&(s="in-tag",i="");break;case"skip-attr":if(u===c){if(f){let H=f.firstPartIdx,_=[];for(let T=H;T<r.length;T++)(r[T].kind==="noop"||r[T].kind==="attr-mixed")&&_.push(T);let V=[],Ve=t[_[0]],Ut=Ve.lastIndexOf(c);V.push(Ut>=0?Ve.slice(Ut+1):Ve);for(let T=1;T<_.length;T++)V.push(t[_[T]]);let We=t[_[_.length-1]+1],Ft=We.indexOf(c);V.push(Ft>=0?We.slice(0,Ft):We),r[H]={kind:"attr-mixed",path:[],name:f.name,statics:V,group:_},f=null}s="in-tag",i=""}break}}if(b<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+=`<!--${m}${y}-->`,r.push({kind:"child",path:[]});else if(s==="in-tag"){let u=`data-${m}${y}`;o+=`${u}=""`,r.push({kind:"element",path:[]})}else if(s==="after-eq"){let u=i[0],H=i.slice(1);if(u==="@"||u==="."||u==="?"){o=o.slice(0,a);let _=u==="@"?"event":u==="."?"prop":"bool",V=`data-${m}${y}`;o+=`${V}=""`,r.push({kind:_,path:[],name:H})}else{o=o.slice(0,a);let _=`data-${m}${y}`;o+=`${_}=""`,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 u=`data-${m}${y}`;o+=`${u}=""`,f={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,Br(h.content,r),Dr(h.content,r),n={templateEl:h,parts:r},on.set(t,n),n}function Br(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(R,"");let o=t.length;r.setAttribute(`data-${m}${o}`,""),t.push({kind:"slot",path:[]})}}function Dr(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(m)){let c=Number(a.slice(m.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-${m}`)){let f=Number(l.name.slice(`data-${m}`.length));t[f]&&t[f].kind!=="child"&&(t[f].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function $r(e,t){let{templateEl:n,parts:r}=re(e),o=n.content.cloneNode(!0),s=document.createComment(`${m}s`),i=document.createComment(`${m}e`),a=r.map(l=>se(l,o)),c=[];for(let l=0;l<e.values.length;l++)j(a[l],e.values[l],void 0,e.values),c.push(e.values[l]);t.replaceChildren(s,...o.childNodes,i);for(let l of a)l.kind==="slot"&&j(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:s,endNode:i}}function se(e,t){if(e.kind==="noop")return{kind:"noop"};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 oe(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(j(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function an(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=ht(n.slotEl);r&&sn(r,n.slotEl)}}t.replaceChildren()}function j(e,t,n,r){if(Ye(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":Vr(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":Hr(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=()=>{e.applied=!0;let a=ht(o);if(!a||qr(o))return;let c=document.createDocumentFragment();for(;o.firstChild;)c.appendChild(o.firstChild);o[Re]=c,Oe(a)};ht(o)?s():queueMicrotask(s);break}case"noop":break}}function ht(e){let t=e.parentElement;for(;t;){if(t[U])return t;t=t.parentElement}return null}function qr(e){let t=e;for(let n=0;n<128;n++){let r=t.parentNode;if(!r||r===t)return!1;if(r.host)return!0;t=r}return!1}function Hr(e,t){let n=e,r=ye(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 Vr(e,t){return Gr(e,t),E(e,t)}function E(e,t){let n=e.marker;if(Ge(t)){B(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(ge(t)){let o=t,s=e.__keyedKey;s!==void 0&&!Object.is(s,o.key)&&B(e),e.__keyedKey=o.key,E(e,o.value);return}if(be(t)){let o=t,s=e.__guardDeps,i=o.deps;if(s!==void 0&&(Array.isArray(s)&&Array.isArray(i)?Kr(s,i):Object.is(s,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,E(e,o.fn());return}if(Je(t)){B(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(ye(t))return;if(_e(t))return Yr(e,t.value);if(we(t))return Jr(e,t.args);if(Se(t))return Xr(e,t.signal);if(Xe(t))return Qr(e,t);if(Qe(t))return Zr(e,t);if(me(t)){if(e.child&&e.child.kind==="repeat"){zr(e,t);return}B(e);let o={kind:"repeat",map:new Map};e.child=o,Wr(n,o,t);return}if(e.child){let o=e.child;if(o.kind==="repeat")un(o),e.child=void 0;else if(o.kind==="async-stream")pn(o),e.child=void 0;else if("strings"in e.child){let s=e.child;if(w(t)&&s.strings===t.strings){oe(s,t.values);return}ie(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(w(t)){let o=t,{templateEl:s,parts:i}=re(o),a=s.content.cloneNode(!0),c=document.createComment(`${m}s`),l=document.createComment(`${m}e`),f=i.map(h=>se(h,a)),p=[];for(let h=0;h<o.values.length;h++)j(f[h],o.values[h],void 0,o.values),p.push(o.values[h]);let d=[c,...a.childNodes,l];n.parentNode?.insertBefore(cn(d),n);for(let h of f)h.kind==="slot"&&j(h,void 0,void 0,[]);e.child={strings:o.strings,bound:f,lastValues:p,startNode:c,endNode:l};return}if(Array.isArray(t)){let o=[];for(let i of t)if(w(i)){let a=i,{templateEl:c,parts:l}=re(a),f=c.content.cloneNode(!0),p=l.map(d=>se(d,f));for(let d=0;d<a.values.length;d++)j(p[d],a.values[d],void 0,a.values);o.push(...f.childNodes)}else i!=null&&i!==!1&&i!==!0&&o.push(document.createTextNode(String(i)));let s=cn(o);n.parentNode?.insertBefore(s,n),e.child=o;return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function cn(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function ie(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 ln(e){let{templateEl:t,parts:n}=re(e),r=t.content.cloneNode(!0),o=document.createComment(`${m}s`),s=document.createComment(`${m}e`),i=n.map(l=>se(l,r)),a=[];for(let l=0;l<e.values.length;l++)j(i[l],e.values[l],void 0,e.values),a.push(e.values[l]);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 je(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 Wr(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),f=s(r[c],c);if(!w(f))continue;let{inst:p,frag:d}=ln(f);t.map.set(l,p),a.appendChild(d)}i.insertBefore(a,e)}function zr(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 f=i(s[l],l),p=a(s[l],l);if(!w(p))continue;let d=o.map.get(f);if(d&&d.strings===p.strings)oe(d,p.values),pt(d.startNode,d.endNode,r,n),c.set(f,d),o.map.delete(f);else{d&&(je(d),ie(d.startNode,d.endNode),o.map.delete(f));let{inst:h,frag:b}=ln(p);r.insertBefore(b,n),c.set(f,h)}}for(let l of o.map.values())je(l),ie(l.startNode,l.endNode);o.map=c}function un(e){for(let t of e.map.values())je(t),ie(t.startNode,t.endNode);e.map.clear()}function pt(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 Kr(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 B(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&fn(t),!e.child)return;let n=e.child;if(n.kind==="repeat")un(n);else if(n.kind==="async-stream")pn(n);else if("strings"in n){let r=e.child;je(r),ie(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Gr(e,t){let n=e;n.__untilState&&!we(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!be(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!_e(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!ge(t)&&(n.__keyedKey=void 0),n.__watchSub&&!Se(t)&&fn(n)}function Yr(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(w(t)&&a.strings===t.strings){oe(a,t.values);return}let c=document.createDocumentFragment();pt(a.startNode,a.endNode,c,null),o.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(w(t)){let a=t,c=o.get(a.strings);if(c){o.delete(a.strings),e.child&&B(e),pt(c.inst.startNode,c.inst.endNode,n.parentNode,n),oe(c.inst,a.values),e.child=c.inst;return}}E(e,t)}function Jr(e,t){let n=e,r=n.__untilState,o=n.__untilArgs,s=(d,h)=>!!(Object.is(d,h)||w(d)&&w(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,f;for(let d=0;d<t.length;d++){let h=t[d];if(!h||typeof h.then!="function"){l=d,f=h;break}}l!==-1&&l<=c.highestResolved?(E(e,f),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&E(e,""),n.__untilEverRendered=!0;let p=Math.min(l===-1?t.length:l,c.highestResolved);for(let d=0;d<p;d++){let h=t[d];!h||typeof h.then!="function"||Promise.resolve(h).then(b=>{c.aborted||d>=c.highestResolved||(c.highestResolved=d,E(e,b))},()=>{})}}function Xr(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let s;n.__watchSub.observe(()=>{s=t.get()}),E(e,s);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new Z.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let s;r.observe(()=>{s=t.get()}),E(e,s)})});n.__watchSub=r;let o;r.observe(()=>{o=t.get()}),E(e,o)}function fn(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function Qr(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;B(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,dn(o,e,t)}function Zr(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;B(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,dn(o,e,t)}async function dn(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=hn(i);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 hn(e){if(e==null||e===!1||e===!0)return[];if(w(e)){let t=e,{templateEl:n,parts:r}=re(t),o=n.content.cloneNode(!0),s=r.map(i=>se(i,o));for(let i=0;i<t.values.length;i++)j(s[i],t.values[i],void 0,t.values);return[...o.childNodes]}if(Array.isArray(e)){let t=[];for(let n of e)t.push(...hn(n));return t}return[document.createTextNode(String(e))]}function pn(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 mn=Symbol.for("webjs:registry"),gn=Symbol.for("webjs:classToTag"),Pe=globalThis,N=Pe[mn]||(Pe[mn]=new Map),bn=Pe[gn]||(Pe[gn]=new WeakMap),Me=typeof window<"u"&&typeof customElements<"u";function mt(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=N.get(e);r?(r.cls=t,r.lazy=n):N.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),bn.set(t,e)}if(Me){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),mt(t,n)}}if(!Me){let e=globalThis;e.customElements||(e.customElements={define(t,n){mt(t,n)},get(t){return N.get(t)?.cls},upgrade(){},whenDefined(t){let n=N.get(t);return Promise.resolve(n?.cls)}})}function gt(e,t){Me?customElements.define(e,t):mt(e,t)}function es(e,t){if(Me)return;let n=N.get(e);if(n){n.moduleUrl=t;return}N.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function ts(e){return N.get(e)?.cls}function ns(e){return N.get(e)?.moduleUrl||null}function rs(e){return N.get(e)?.lazy===!0}function Ie(e){return bn.get(e)}function ss(){return[...N.keys()]}var g="_$wj",le="_id";async function bt(e){return JSON.stringify(await yn(e))}function ue(e){return _n(JSON.parse(e))}async function yn(e){let t=os();return await is(e,t),D(e,t)}function _n(e){return L(e,us())}function os(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map}}async function is(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!ds(r))continue;let o=t.refCount.get(r)||0;if(t.refCount.set(r,o+1),!(o>0)){if(typeof Blob<"u"&&r instanceof Blob){let s=new Uint8Array(await r.arrayBuffer());t.blobBytes.set(r,s);continue}if(typeof FormData<"u"&&r instanceof FormData){for(let[,s]of r.entries())typeof s!="string"&&n.push(s);continue}if(Array.isArray(r))for(let s=0;s<r.length;s++)n.push(r[s]);else if(r instanceof Map)for(let[s,i]of r)n.push(s),n.push(i);else if(r instanceof Set)for(let s of r)n.push(s);else if(hs(r))for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&n.push(r[s])}}for(let[r,o]of t.refCount)o>1&&t.idOf.set(r,t.nextId++)}function D(e,t){if(e===null)return null;if(e===void 0)return{[g]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[g]:"NaN"}:e===1/0?{[g]:"Inf"}:e===-1/0?{[g]:"-Inf"}:Object.is(e,-0)?{[g]:"-0"}:e;if(n==="bigint")return{[g]:"BigInt",v:e.toString()};if(n==="symbol"){let s=Symbol.keyFor(e);if(s===void 0)throw new TypeError("Cannot serialize a local Symbol; only Symbol.for() registered symbols are supported.");return{[g]:"Sym",v:s}}if(n==="function")throw new TypeError("Cannot serialize a function.");let r=t.idOf.get(e);if(r!==void 0&&t.emitted.has(r))return{[g]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let o;if(e instanceof Date)o={[g]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)o={[g]:"Error",v:{name:e.name,message:e.message,stack:e.stack||null}};else if(typeof Blob<"u"&&e instanceof Blob){let s=t.blobBytes.get(e);typeof File<"u"&&e instanceof File?o={[g]:"File",v:ce(s),n:e.name,t:e.type||"",m:e.lastModified}:o={[g]:"Blob",v:ce(s),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let s=[];for(let[i,a]of e.entries())s.push([i,D(a,t)]);o={[g]:"FD",v:s}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)o=as(e);else if(e instanceof Map){let s=[];for(let[i,a]of e)s.push([D(i,t),D(a,t)]);o={[g]:"Map",v:s}}else if(e instanceof Set){let s=[];for(let i of e)s.push(D(i,t));o={[g]:"Set",v:s}}else if(Array.isArray(e))o=e.map(s=>D(s,t));else{o={};for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let i=ps(s)?"_"+s:s;o[i]=D(e[s],t)}}if(r!==void 0){if(Array.isArray(o))return{[g]:"Arr",[le]:r,v:o};o[le]=r}return o}function as(e){if(e instanceof ArrayBuffer)return{[g]:"buf",v:ce(new Uint8Array(e))};if(e instanceof DataView)return{[g]:"dv",v:ce(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=cs[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[g]:n,v:ce(r)}}var cs={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},ls={i8:Int8Array,u8:Uint8Array,u8c:Uint8ClampedArray,i16:Int16Array,u16:Uint16Array,i32:Int32Array,u32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:typeof BigInt64Array<"u"?BigInt64Array:null,bu64:typeof BigUint64Array<"u"?BigUint64Array:null};function us(){return{refs:new Map}}function L(e,t){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){let s=[];for(let i=0;i<e.length;i++)s.push(L(e[i],t));return s}let n=e[g];if(typeof n=="string")return fs(e,n,t);let r={},o=e[le];typeof o=="number"&&t.refs.set(o,r);for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s)||s===le)continue;let i=ms(s)?s.slice(1):s;r[i]=L(e[s],t)}return r}function fs(e,t,n){let r=e[le],o=s=>(typeof r=="number"&&n.refs.set(r,s),s);switch(t){case"undef":return;case"NaN":return NaN;case"Inf":return 1/0;case"-Inf":return-1/0;case"-0":return-0;case"BigInt":return o(BigInt(e.v));case"Sym":return o(Symbol.for(e.v));case"Date":return o(e.v==null?new Date(NaN):new Date(e.v));case"Error":{let s=new Error(e.v.message);return s.name=e.v.name,e.v.stack&&(s.stack=e.v.stack),typeof r=="number"&&n.refs.set(r,s),s}case"Map":{let s=new Map;typeof r=="number"&&n.refs.set(r,s);for(let[i,a]of e.v)s.set(L(i,n),L(a,n));return s}case"Set":{let s=new Set;typeof r=="number"&&n.refs.set(r,s);for(let i of e.v)s.add(L(i,n));return s}case"Arr":{let s=[];typeof r=="number"&&n.refs.set(r,s);for(let i of e.v)s.push(L(i,n));return s}case"Ref":{let s=n.refs.get(e.v);if(s===void 0)throw new TypeError(`Dangling reference: id=${e.v}`);return s}case"Blob":{if(typeof Blob>"u")throw new TypeError("Blob is not available in this environment.");let s=ae(e.v);return o(new Blob([s],{type:e.t||""}))}case"File":{if(typeof File>"u")throw new TypeError("File is not available in this environment.");let s=ae(e.v);return o(new File([s],e.n,{type:e.t||"",lastModified:e.m}))}case"FD":{if(typeof FormData>"u")throw new TypeError("FormData is not available in this environment.");let s=new FormData;o(s);for(let[i,a]of e.v){let c=L(a,n);s.append(i,c)}return s}default:{if(t==="buf"){let i=ae(e.v);return o(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=ae(e.v);return o(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let s=ls[t];if(s){let i=ae(e.v),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return o(new s(a))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function ds(e){return e!==null&&typeof e=="object"}function hs(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ps(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function ms(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}var wn=typeof Buffer<"u"&&typeof Buffer.from=="function";function ce(e){if(wn)return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function ae(e){if(wn){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}var vn=typeof window<"u"&&typeof HTMLElement<"u";function gs(e,t){return e!==t}function bs(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var Ue=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=bs(),this.__internals}},ys=["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 ys){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(Ue.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var _s=vn?HTMLElement:Ue,yt=class extends _s{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){gt(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(Sn)}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._initializeProperties()}_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||gs)(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)}}}_reflectAttribute(t,n,r){let o=Sn(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(!vn)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=An(r.slice(16));try{this[s]=ue(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){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,o=Array.isArray(r)?r:ze(r)?[r]:[];if(o.length){if(n){let s=this.shadowRoot.querySelector("style");s&&s.remove()}Ke(this._renderRoot,o)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${Ie(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().`),ft(this)||(this.__isHydrating()?(O(this),en(this)):Zt(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)}this._renderRoot===this&&nn(this)})}__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),this._renderRoot===this&&rn(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 o=this.constructor,s=An(t),i=o.properties&&(o.properties[s]||o.properties[t]);if(!i)return;let a;if(i.converter&&i.converter.fromAttribute)a=i.converter.fromAttribute(r,i.type);else if(i.type===Number)a=r==null?null:Number(r);else if(i.type===Boolean)a=r!=null&&r!=="false";else if(i.type===Object||i.type===Array)try{a=r==null?null:JSON.parse(r)}catch{a=r}else a=r;this[s]!==a&&(this[s]=a,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;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let r of this.__controllers)r.hostUpdate&&r.hostUpdate();try{this.update(t)}catch(r){console.error(`[webjs] render error in <${Ie(this.constructor)||this.tagName?.toLowerCase()}>:`,r);try{let o=this.renderError(r);o!==void 0&&Le(o,this._renderRoot)}catch(o){console.error("[webjs] renderError() also threw:",o)}}for(let r of this.__controllers)r.hostUpdated&&r.hostUpdated();n=!0}}catch(r){console.error("[webjs] lifecycle hook threw during update phase:",r)}finally{this._isUpdating=!1,n&&(this._changedProperties=new Map)}if(n)try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(r){console.error("[webjs] lifecycle hook threw during post-commit phase:",r)}finally{this._resolveUpdate()}else 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 Z.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;this.__signalWatcher.observe(()=>{n=this.render()}),Le(n,this._renderRoot)}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){}};function Sn(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function An(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var Cn=Symbol.for("webjs.notFound"),En=Symbol.for("webjs.redirect");function ws(){let e=new Error("webjs: notFound()");throw e.__webjs=Cn,e}function Ss(e,t=307){let n=new Error(`webjs: redirect(${e})`);throw n.__webjs=En,n.url=e,n.status=t,n}function As(e){return!!e&&e.__webjs===Cn}function vs(e){return!!e&&e.__webjs===En}var Nn=null;function Cs(){if(!Nn)return"";try{return Nn()||""}catch{return""}}var Io=Symbol.for("webjs.suspense");function Es(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function Ns(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}function Ts(e,t={}){let n=t.reconnect!==!1,r=0,o=!1,s=null,i=[];function a(){o||(s=new WebSocket(ks(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 ks(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}`}var _t="application/vnd.webjs+json";async function xs(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",_t);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 bt(r),n.has("content-type")||n.set("content-type",_t));let o=await fetch(e,{...t,headers:n,body:r}),s=o.headers.get("content-type")||"",i=await o.text(),a=s.includes(_t)?i?ue(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}var wt=typeof HTMLElement<"u"?class extends HTMLElement{}:null;typeof customElements<"u"&&wt&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",wt);function On(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}var q=!1,M=null,v=0,St=null;function Rs(){St||typeof MutationObserver>"u"||typeof customElements>"u"||(St=new MutationObserver(e=>{for(let t of e)for(let n of t.addedNodes){if(n.nodeType!==1)continue;let r=n;r.tagName?.includes("-")&&customElements.upgrade(r);for(let o of r.querySelectorAll("*"))o.tagName?.includes("-")&&customElements.upgrade(o)}}),St.observe(document.body,{childList:!0,subtree:!0}))}var I=null,Fe=null;function jn(){q||typeof document>"u"||(q=!0,document.addEventListener("click",Ln,!1),document.addEventListener("submit",Mn,!1),window.addEventListener("popstate",Pn),document.addEventListener("pointerover",G,!0),document.addEventListener("focusin",G,!0),document.addEventListener("touchstart",G,{capture:!0,passive:!0}),document.addEventListener("pointerout",qn,!0),document.addEventListener("webjs:navigate",Nt),Rs(),Nt(),typeof history<"u"&&"scrollRestoration"in history&&(Fe=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(I=location.href))}function Os(){q&&(q=!1,document.removeEventListener("click",Ln,!1),document.removeEventListener("submit",Mn,!1),window.removeEventListener("popstate",Pn),document.removeEventListener("pointerover",G,!0),document.removeEventListener("focusin",G,!0),document.removeEventListener("touchstart",G,{capture:!0}),document.removeEventListener("pointerout",qn,!0),document.removeEventListener("webjs:navigate",Nt),jt(),P&&(P.disconnect(),P=null),typeof history<"u"&&Fe!==null&&(history.scrollRestoration=Fe,Fe=null),I=null)}async function js(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await Ot(n.href,t?.replace??!1,null)}function Ls(e){if(!e){S.clear(),A.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;S.delete(n),A.delete(n)}var Rt=/\.(?: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;function Ln(e){if(!q||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=Us(e);if(!t||t.hasAttribute("download")||t.hasAttribute("data-no-router")||t.target&&t.target!=="_self")return;let n=t.href;if(!n)return;let r=new URL(n);if(r.origin!==location.origin||r.pathname===location.pathname&&r.search===location.search&&r.hash||Rt.test(r.pathname))return;e.preventDefault();let o=In(t);Ot(n,!1,o)}function Pn(e){Ot(location.href,!0,null)}function Mn(e){if(!q||e.defaultPrevented)return;let t=e.target;if(!t||t.nodeType!==1||t.tagName!=="FORM"||t.hasAttribute("data-no-router"))return;let n=e.submitter??null;if(n&&n.hasAttribute("data-no-router"))return;let r=n&&n.getAttribute("formtarget")||t.getAttribute("target")||"";if(r&&r!=="_self")return;let o=Ps(t,n);if(o==="dialog")return;let s=Ms(t,n),i;try{i=new URL(s,location.href)}catch{return}if(i.origin!==location.origin||Rt.test(i.pathname))return;let a=Is(t,n);e.preventDefault();let c=In(t);$s(i.href,o,a,c)}function Ps(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function Ms(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function Is(e,t){try{return new FormData(e,t||void 0)}catch{let n=new FormData(e);return t&&t.getAttribute("name")&&n.append(t.getAttribute("name"),t.getAttribute("value")||""),n}}function Us(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function In(e){let t=e;for(;t;){let n=t.closest("webjs-frame");if(n&&n.id)return n.id;let r=t.getRootNode();if(r&&r.host)t=r.host;else break}return null}function $e(e){let t=new Map,n=[];function r(o){if(o.nodeType===8){let s=o,i=s.data,a=/^wj:children:(.+)$/.exec(i);if(a){n.push({path:a[1],start:s});return}if(i.trim()==="/wj:children"){let c=n.pop();c&&!t.has(c.path)&&t.set(c.path,{start:c.start,end:s});return}return}if(o.hasChildNodes&&o.hasChildNodes())for(let s=o.firstChild;s;s=s.nextSibling)r(s)}return r(e),t}function Fs(e,t){let n=null;for(let r of e.keys())t.has(r)&&(n===null||r.length>n.length)&&(n=r);return n}var Bs=16,S=new Map;function Un(e){let t=Y(e);S.has(t)&&S.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(S.set(t,n);S.size>Bs;){let r=S.keys().next().value;S.delete(r)}}function Ds(e){let t=Y(e),n=S.get(t);return n==null?null:(S.delete(t),S.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function Y(e){let t=new URL(e,location.href);return t.pathname+t.search}async function Ot(e,t,n){M&&M.abort(),M=new AbortController;let r=M.signal,o=++v;I&&Un(I);let s=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),s=null},150),i=null;t||(i=zn());try{if(t){let a=Ds(e);if(a){let c=On(a.html);if(c){Vn(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),Tt(e,n,!1,i,"GET",null,r,o).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await Tt(e,n,!t,i,"GET",null,r,o)}finally{s&&clearTimeout(s),o===v&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(I=location.href))}}async function $s(e,t,n,r){M&&M.abort(),M=new AbortController;let o=M.signal,s=++v,i=t==="get"||t==="head",a=new URL(e,location.href);if(i){a.search="";for(let[f,p]of n)a.searchParams.append(f,typeof p=="string"?p:p.name)}I&&Un(I);let c=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),c=null},150),l=zn();try{await Tt(a.href,r,!0,l,i?"GET":t.toUpperCase(),i?null:n,o,s),!i&&s===v&&(S.clear(),A.clear())}finally{c&&clearTimeout(c),s===v&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(I=location.href))}}function Fn(){return[...$e(document.body).keys()].join(",")}var qs=8,Bn=3e4,Dn=3,Hs=24,Vs=100,A=new Map,fe=new Set,de=[],Be=new Set,K=null,he=null,P=null;function $n(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&e.saveData===!0||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function Ws(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function vt(e){if(!e||!(e instanceof HTMLAnchorElement)||e.hasAttribute("download")||e.hasAttribute("data-no-router")||e.target&&e.target!=="_self")return null;let t=e.href;if(!t)return null;let n;try{n=new URL(t)}catch{return null}return n.origin!==location.origin||n.pathname===location.pathname&&n.search===location.search&&n.hash||Rt.test(n.pathname)?null:t}function zs(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Ws(e);return t.includes("external")||t.includes("no-prefetch")}function Ct(e){if(zs(e))return"none";switch((e.getAttribute("data-prefetch")||"").toLowerCase().trim()){case"false":case"none":return"none";case"true":case"render":return"render";case"auto":case"viewport":return"viewport";case"intent":return"intent";default:return"intent"}}function qe(e){if(typeof fetch!="function"||$n())return;let t=Y(e);if(fe.has(t)||Be.has(t))return;let n=A.get(t);if(n&&Et()-n.at<Bn)return;if(fe.size>=Dn){for(Be.add(t),de.push(e);de.length>Hs;){let s=de.shift();Be.delete(Y(s))}return}fe.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},o=Fn();o&&(r["x-webjs-have"]=o),fetch(e,{method:"GET",headers:r,credentials:"same-origin"}).then(async s=>{let i=s.headers.get("content-type")||"";if(!/^text\/html\b/i.test(i)||s.status>=400)return;let a=s.headers.get("x-webjs-build"),c=s.redirected&&s.url?s.url:e,l=await s.text();Gs(t,{html:l,build:a,finalUrl:c,at:Et()})}).catch(()=>{}).finally(()=>{fe.delete(t),Ks()})}function Ks(){for(;de.length&&fe.size<Dn;){let e=de.shift();Be.delete(Y(e)),qe(e)}}function Gs(e,t){for(A.has(e)&&A.delete(e),A.set(e,t);A.size>qs;){let n=A.keys().next().value;A.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Ys(e){let t=Y(e),n=A.get(t);return!n||(A.delete(t),Et()-n.at>=Bn)?null:n}function Et(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function G(e){if(!q)return;let t=Hn(e.target);if(!t||Ct(t)!=="intent")return;let n=vt(t);n&&(he===t&&K||(jt(),he=t,K=setTimeout(()=>{K=null,he=null,qe(n)},Vs)))}function qn(e){let t=Hn(e.target);t&&t===he&&jt()}function jt(){K&&(clearTimeout(K),K=null),he=null}function Hn(e){let t=e;for(;t;){if(t instanceof HTMLAnchorElement)return t;let n=t.nodeType===1?t:null;if(n){let o=n.closest&&n.closest("a");if(o instanceof HTMLAnchorElement)return o}let r=t.getRootNode?t.getRootNode():null;t=r&&r.host?r.host:null}return null}function Nt(){if(typeof document>"u"||$n())return;let e=typeof IntersectionObserver<"u";e&&(P?P.disconnect():P=new IntersectionObserver(t=>{for(let n of t){if(!n.isIntersecting)continue;let r=n.target;P.unobserve(r);let o=vt(r);o&&Ct(r)==="viewport"&&qe(o)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=Ct(t);if(n==="render"){let r=vt(t);r&&qe(r)}else n==="viewport"&&e&&P.observe(t)}}async function Tt(e,t,n,r,o,s,i,a){o=o||"GET";let c=typeof a=="number"?a:v,l,f=null,p=e;try{let h=o==="GET"&&!s&&!t?Ys(e):null;if(h)l=h.html,f=h.build,p=h.finalUrl;else{let b={"x-webjs-router":"1"},J=Fn();J&&(b["x-webjs-have"]=J),t&&(b["x-webjs-frame"]=t);let y={method:o,headers:b,credentials:"same-origin"};i&&(y.signal=i),s!=null&&o!=="GET"&&o!=="HEAD"&&(y.body=s);let u=await fetch(e,y),H=u.headers.get("content-type")||"",_=/^text\/html\b/i.test(H);if(u.redirected&&u.url&&(p=u.url),u.status===204||u.status===205){c===v&&n&&history.pushState(null,"",p);return}if(!_){c===v&&(location.href=e);return}f=u.headers.get("x-webjs-build"),l=await u.text()}}catch(h){if(h&&h.name==="AbortError"||c!==v)return;Qs(r),location.href=e;return}if(c!==v)return;let d=On(l);if(!d){location.href=e;return}if(Vn(d,t,!1,p,f),n&&history.pushState(null,"",p),n){let h=new URL(p);if(h.hash){let b=document.getElementById(h.hash.slice(1));b?b.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:p,frameId:t,from:"navigate"}}))}function Tn(e){if(!e||!e.head)return"";let t=e.head.querySelectorAll('[data-webjs-track="reload"]');if(!t.length)return"";let n="";for(let r of t)n+=$(r);return n}function Vn(e,t,n,r,o){try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let f=document.querySelector('script[type="importmap"]'),p=f?f.getAttribute("data-webjs-build"):null,d=!1;if(o&&p&&(d=o!==p),!d&&e.head&&e.head.children.length>0){let h=Tn(document),b=Tn(e);h!==b&&(d=!0)}if(d&&typeof location<"u")try{let h="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(h))sessionStorage.removeItem(h);else{sessionStorage&&sessionStorage.setItem(h,"1"),location.href=r;return}}catch{location.href=r;return}else if(!d)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let f=document.querySelector(`webjs-frame#${CSS.escape(t)}`),p=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(f&&p){xn(e.head),Zs(f,p),xt(f),De(f),Rn(e.body),At();return}}let s=$e(document.body),i=$e(e.body),a=Fs(s,i);if(a){xn(e.head),Js(s.get(a),i.get(a),e),Rn(e.body),At();return}eo(e.head);let c=[...e.body.childNodes],l=()=>{document.body.replaceChildren(...c),xt(document.body),De(document.body),At()};document.startViewTransition?document.startViewTransition(l).finished.then(()=>De(document.body)).catch(()=>{}):l()}function At(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function Js(e,t,n){if(!e||!t)return;let r=e.start.parentNode;if(!r)return;let o=[];for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)o.push(i);let s=[];for(let i=t.start.nextSibling;i&&i!==t.end;i=i.nextSibling)s.push(document.importNode(i,!0));Xs(r,e.start,e.end,o,s);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(xt(i),De(i))}function Xs(e,t,n,r,o){let s=new Map;for(let c of r){if(c.nodeType!==1)continue;let l=pe(c);l&&s.set(l,c)}let i=n,a=[];for(let c of o){if(c.nodeType===1){let l=pe(c);if(l&&s.has(l)){let f=s.get(l);kt(f,c),a.push(f),s.delete(l);continue}}a.push(c)}for(let c of r)if(c.parentNode===e){if(c.nodeType===1&&a.includes(c))continue;e.removeChild(c)}for(let c of a)e.insertBefore(c,i)}function kt(e,t){if(e.tagName!==t.tagName){e.replaceWith(t);return}let n=new Set;for(let r of t.attributes)n.add(r.name),!kn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])kn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Wn(e,t)}function Wn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0)),o=new Map;for(let a of n){if(a.nodeType!==1)continue;let c=pe(a);c&&o.set(c,a)}let s=[];for(let a=0;a<r.length;a++){let c=r[a];if(c.nodeType===1){let l=pe(c);if(l&&o.has(l)){let p=o.get(l);kt(p,c),s.push(p),o.delete(l);continue}let f=n[a];if(f&&f.nodeType===1&&!pe(f)&&f.tagName===c.tagName){kt(f,c),s.push(f);continue}}else if(c.nodeType===3){let l=n[a];if(l&&l.nodeType===3){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),s.push(l);continue}}else if(c.nodeType===8){let l=n[a];if(l&&l.nodeType===8){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),s.push(l);continue}}s.push(c)}let i=new Set(s);for(let a of n)!i.has(a)&&a.parentNode===e&&e.removeChild(a);for(let a=0;a<s.length;a++){let c=s[a];(c.parentNode!==e||e.childNodes[a]!==c)&&e.insertBefore(c,e.childNodes[a]||null)}}function pe(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}var kn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);function zn(){let e=$e(document.body);if(e.size===0)return null;let t=null;for(let i of e.keys())(t===null||i.length>t.length)&&(t=i);if(t===null)return null;let n=document.getElementById(`wj-loading:${t}`);if(!(n instanceof HTMLTemplateElement))return null;let r=e.get(t),o=[];for(let i=r.start.nextSibling;i&&i!==r.end;i=i.nextSibling)o.push(i);let s=document.createRange();return s.setStartAfter(r.start),s.setEndBefore(r.end),s.deleteContents(),r.start.parentNode.insertBefore(n.content.cloneNode(!0),r.end),{slot:r,oldChildren:o,token:v}}function Qs(e){if(!e||e.token!==v)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let o of n)t.start.parentNode.insertBefore(o,t.end)}function Zs(e,t){Wn(e,t)}function Kn(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function Lt(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=Kn();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function Gn(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=Kn();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function $(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function xn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add($(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has($(r))||(r.tagName==="SCRIPT"?document.head.appendChild(Lt(r)):document.head.appendChild(Gn(r))))}function eo(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($(s));let o=new Set;for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&o.add($(s));for(let s of[...t.children])s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(o.has($(s))||s.remove());for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(r.has($(s))||(s.tagName==="SCRIPT"?t.appendChild(Lt(s)):t.appendChild(Gn(s))))}function De(e){typeof customElements>"u"||Yn(e)}function Yn(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&&Yn(n.shadowRoot))}function Rn(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}function xt(e){for(let t of e.querySelectorAll("script"))t.replaceWith(Lt(t))}jn();var to=Symbol.for("webjs.context");function no(e){return{__context__:to,name:e}}var He=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},Pt=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()}},Mt=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 He(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 ro(){return typeof window<"u"}var k={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},It=class{constructor(t,{task:n,args:r,autoRun:o=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=o,this._status=k.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=k.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=k.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=k.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 k.INITIAL:return t.initial?.();case k.PENDING:return t.pending?.();case k.COMPLETE:return t.complete?.(this._value);case k.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!ro())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{Mt as ContextConsumer,Pt as ContextProvider,He as ContextRequestEvent,m as MARKER,Z as Signal,Es as Suspense,It as Task,k as TaskStatus,yt as WebComponent,wt as WebjsFrame,Ke as adoptStyles,ss as allTags,ur as asyncAppend,fr as asyncReplace,Sr as batch,cr as cache,vr as computed,Ts as connectWS,no as createContext,ar as createRef,Cs as cspNonce,Xn as css,_n as deserialize,Os as disableClientRouter,Er as effect,jn as enableClientRouter,er as escapeAttr,Zn as escapeText,sr as guard,Jn as html,Xe as isAsyncAppend,Qe as isAsyncReplace,ze as isCSS,_e as isCache,be as isGuard,ge as isKeyed,rs as isLazy,Ye as isLive,As as isNotFound,vs as isRedirect,ye as isRef,me as isRepeat,Cr as isSignal,Ns as isSuspense,w as isTemplate,Je as isTemplateContent,Ge as isUnsafeHTML,we as isUntil,Se as isWatch,rr as keyed,nr as live,ts as lookup,ns as lookupModuleUrl,js as navigate,ws as notFound,ue as parse,es as primeModuleUrl,Ss as redirect,ir as ref,gt as register,Le as render,Dt as repeat,Ls as revalidate,xs as richFetch,yn as serialize,Ar as signal,bt as stringify,Qn as stylesToString,Ie as tagOf,or as templateContent,tr as unsafeHTML,lr as until,dr as watch};
4
4
  //# sourceMappingURL=webjs-core-browser.js.map