@webjsdev/core 0.7.4 → 0.7.5

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