@webjsdev/core 0.7.14 → 0.7.15

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
- var ms=Object.defineProperty;var Ve=(e,t)=>()=>(e&&(t=e(e=0)),t);var Mn=(e,t)=>{for(var n in t)ms(e,n,{get:t[n],enumerable:!0})};var Er={};Mn(Er,{observeLazy:()=>yi,observeViewportOnce:()=>Si});function vr(e){let t=ln.get(e);return t||(t=import(e).finally(()=>ln.delete(e)),ln.set(e,t),t)}function yi(e){for(let[t,n]of Object.entries(e))oe.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of oe.values())vr(t);oe.clear();return}Fe||(Fe=new IntersectionObserver(wi,{rootMargin:"200px"})),Cr(),typeof MutationObserver<"u"&&new MutationObserver(()=>Cr()).observe(document.body,{childList:!0,subtree:!0})}function Cr(){if(!(!Fe||!oe.size))for(let e of oe.keys())for(let t of document.querySelectorAll(e))Fe.observe(t)}function wi(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=oe.get(n);r&&(vr(r),oe.delete(n),Fe?.unobserve(t.target))}}function _i(e){for(let t of e){if(!t.isIntersecting)continue;let n=mt.get(t.target);mt.delete(t.target),qe?.unobserve(t.target),n&&n()}}function Si(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(qe||(qe=new IntersectionObserver(_i,{rootMargin:"200px"})),mt.set(e,t),qe.observe(e),()=>{mt.delete(e),qe?.unobserve(e)})}var oe,Fe,ln,qe,mt,kr=Ve(()=>{oe=new Map,Fe=null,ln=new Map;qe=null,mt=new WeakMap});var un,fn=Ve(()=>{un=typeof HTMLElement<"u"?class extends HTMLElement{constructor(){super(),this._webjsLoadedSrc=null,this._webjsLazyTeardown=null}static get observedAttributes(){return["src"]}connectedCallback(){this._webjsScheduleLoad()}disconnectedCallback(){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null)}attributeChangedCallback(t,n,r){t==="src"&&this.isConnected&&this._webjsScheduleLoad()}_webjsScheduleLoad(){let t=this.getAttribute("src");if(!t){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),this._webjsLoadedSrc=null;return}let n=t;try{n=new URL(t,location.href).href}catch{}if(n===this._webjsLoadedSrc)return;this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),(this.getAttribute("loading")||"eager").toLowerCase()==="lazy"?(this._webjsLoadedSrc=n,Promise.resolve().then(()=>(kr(),Er)).then(({observeViewportOnce:o})=>{this._webjsLoadedSrc!==n||!this.isConnected||(this._webjsLazyTeardown=o(this,()=>{this._webjsLazyTeardown=null,this._webjsLoad(n)}))})):(this._webjsLoadedSrc=n,this._webjsLoad(n))}_webjsLoad(t){Promise.resolve().then(()=>(dn(),xr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&un&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",un)});function Ci(e,t,n){switch(e){case"append":n&&t.append(n);break;case"prepend":n&&t.prepend(n);break;case"before":n&&t.before(n);break;case"after":n&&t.after(n);break;case"replace":n&&t.replaceWith(n);break;case"update":n&&t.replaceChildren(n);break;case"remove":t.remove();break;default:break}}function pn(e,t){let n=t||(typeof document<"u"?document:null);if(!n)return;let r=null;if(typeof e=="string"){let s=n.createElement("template");s.innerHTML=e,r=s.content}else if(e&&e.nodeType)r=e;else return;let o=r.querySelectorAll?Array.from(r.querySelectorAll("webjs-stream")):[];if(o.length)for(let s of o)n.body.append(s);else n.body.append(r)}var Ai,hn,gt=Ve(()=>{Ai=new Set(["append","prepend","before","after","replace","update"]);hn=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this._webjsApplied||(this._webjsApplied=!0,this._webjsApply())}_webjsApply(){let t=(this.getAttribute("action")||"").toLowerCase(),n=this.ownerDocument||document,r=[],o=this.getAttribute("target");if(o){let i=n.getElementById(o);i&&(r=[i])}else{let i=this.getAttribute("targets");if(i)try{r=Array.from(n.querySelectorAll(i))}catch{r=[]}}let s=Ai.has(t)?this.querySelector("template"):null;try{for(let i of r){let a=s?s.content.cloneNode(!0):null;Ci(t,i,a)}}finally{this.remove()}}}:null;typeof customElements<"u"&&hn&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",hn)});var xr={};Mn(xr,{_FRAME_TOP:()=>Dr,_LIVE_ATTRS:()=>wn,_activeFrameId:()=>Ur,_addNewHeadElements:()=>_n,_blurOutgoingFocus:()=>wt,_buildSubmitFormData:()=>qr,_bumpNavToken:()=>Vi,_clearFormBusy:()=>ts,_clearFrameBusy:()=>Xr,_collectChildrenSlots:()=>ve,_currentPageUrl:()=>Ki,_diffElementInPlace:()=>Et,_eligibleAnchorHref:()=>_t,_findAnchorInPath:()=>Fr,_getSubmitAction:()=>Br,_getSubmitMethod:()=>$r,_isNonHtmlPath:()=>Yi,_keyOf:()=>Ce,_longestSharedPath:()=>Hr,_markFormBusy:()=>es,_markFrameBusy:()=>Qr,_mergeHead:()=>cs,_navToken:()=>Wi,_onPopState:()=>An,_onSubmit:()=>Cn,_prefetch:()=>ze,_prefetchInflightSize:()=>Hi,_prefetchMode:()=>St,_prefetchPeek:()=>Di,_prefetchSaysSaveData:()=>kn,_prefetchSuppressed:()=>Gr,_prefetchTake:()=>Yr,_reactivateScripts:()=>kt,_reconcileChildren:()=>Tn,_regraftPermanentElements:()=>rs,_regraftPermanentInSlice:()=>xn,_resetPrefetch:()=>zi,_resolveTargetFrameId:()=>vn,_restoreOptimistic:()=>Ue,_runWithTransition:()=>yt,_setCurrentPageUrl:()=>Gi,_snapshotCache:()=>R,_viewTransitionsEnabled:()=>ns,collectChildrenSlots:()=>ve,disableClientRouter:()=>Or,enableClientRouter:()=>Sn,loadFrame:()=>Ei,longestSharedPath:()=>Hr,navigate:()=>Mr,revalidate:()=>Ir});function Lr(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function vi(){mn||typeof MutationObserver>"u"||typeof customElements>"u"||(mn=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)}}),mn.observe(document.body,{childList:!0,subtree:!0}))}function Sn(){ce||typeof document>"u"||(ce=!0,document.addEventListener("click",Pr,!1),document.addEventListener("submit",Cn,!1),window.addEventListener("popstate",An),document.addEventListener("pointerover",Ae,!0),document.addEventListener("focusin",Ae,!0),document.addEventListener("touchstart",Ae,{capture:!0,passive:!0}),document.addEventListener("pointerout",Jr,!0),document.addEventListener("webjs:navigate",yn),vi(),yn(),typeof history<"u"&&"scrollRestoration"in history&&(bt=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(q=location.href))}function Or(){ce&&(ce=!1,document.removeEventListener("click",Pr,!1),document.removeEventListener("submit",Cn,!1),window.removeEventListener("popstate",An),document.removeEventListener("pointerover",Ae,!0),document.removeEventListener("focusin",Ae,!0),document.removeEventListener("touchstart",Ae,{capture:!0}),document.removeEventListener("pointerout",Jr,!0),document.removeEventListener("webjs:navigate",yn),Tt(),V&&(V.disconnect(),V=null),typeof history<"u"&&bt!==null&&(history.scrollRestoration=bt,bt=null),q=null)}async function Mr(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await En(n.href,t?.replace??!1,null)}async function Ei(e,t){if(typeof location>"u")return{ok:!1,status:null,aborted:!1};let n=e&&e.id;if(!n)return{ok:!1,status:null,aborted:!1};let r=new URL(t,location.href);if(r.origin!==location.origin)return{ok:!1,status:null,aborted:!1};O&&O.abort(),O=new AbortController;let o=O.signal,s=++k;return At(r.href,n,!1,null,"GET",null,o,s)}function Ir(e){if(!e){R.clear(),N.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;R.delete(n),N.delete(n)}function Pr(e){if(!ce||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=Fr(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||xt.test(r.pathname))return;e.preventDefault();let o=vn(t);En(n,!1,o)}function An(e){En(location.href,!0,null)}function Cn(e){if(!ce||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=$r(t,n);if(o==="dialog")return;let s=Br(t,n),i;try{i=new URL(s,location.href)}catch{return}if(i.origin!==location.origin||xt.test(i.pathname))return;let a=qr(t,n);e.preventDefault();let c=vn(n||t);Ni(i.href,o,a,c,t)}function $r(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function Br(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function qr(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 Fr(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function Ur(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 vn(e){if(!e)return null;let t=e.closest&&e.closest("[data-webjs-frame]"),n=t?t.dataset?t.dataset.webjsFrame:t.getAttribute("data-webjs-frame"):null;if(n!=null&&n!==""){if(n===Dr)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(ki(`webjs:frame-unresolved:${n}`,`[webjs] data-webjs-frame="${n}" did not match a live <webjs-frame id="${n}">; performing a normal navigation instead.`),null)}return Ur(e)}function ki(e,t){Nr.has(e)||(Nr.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function ve(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 Hr(e,t){let n=null;for(let r of e.keys())t.has(r)&&(n===null||r.length>n.length)&&(n=r);return n}function zr(e){let t=le(e);R.has(t)&&R.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(R.set(t,n);R.size>xi;){let r=R.keys().next().value;R.delete(r)}}function Ti(e){let t=le(e),n=R.get(t);return n==null?null:(R.delete(t),R.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function le(e){let t=new URL(e,location.href);return t.pathname+t.search}async function En(e,t,n){O&&O.abort(),O=new AbortController;let r=O.signal,o=++k;q&&zr(q);let s=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),s=null},150),i=null;t||(i=os());try{if(t){let a=Ti(e);if(a){let c=Lr(a.html);if(c){ss(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),At(e,n,!1,i,"GET",null,r,o).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await At(e,n,!t,i,"GET",null,r,o)}finally{s&&clearTimeout(s),o===k&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(q=location.href))}}async function Ni(e,t,n,r,o){O&&O.abort(),O=new AbortController;let s=O.signal,i=++k,a=t==="get"||t==="head",c=new URL(e,location.href);if(a){c.search="";for(let[g,b]of n)c.searchParams.append(g,typeof b=="string"?b:b.name)}q&&zr(q);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),f=os(),m=o?es(o,i,c.href):null,u=!1;try{let g=await At(c.href,r,!0,f,a?"GET":t.toUpperCase(),a?null:n,s,i);u=!!(g&&g.ok),!a&&i===k&&(R.clear(),N.clear())}finally{m&&ts(m,i,c.href,u),l&&clearTimeout(l),i===k&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(q=location.href))}}function Wr(){return[...ve(document.body).keys()].join(",")}function kn(){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 Oi(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function _t(e){if(!e||!(e instanceof HTMLAnchorElement)||e.hasAttribute("download")||e.hasAttribute("data-no-router")||e.target&&e.target!=="_self")return null;let t=e.href;if(!t)return null;let n;try{n=new URL(t)}catch{return null}return n.origin!==location.origin||n.pathname===location.pathname&&n.search===location.search&&n.hash||xt.test(n.pathname)?null:t}function Gr(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Oi(e);return t.includes("external")||t.includes("no-prefetch")}function St(e){if(Gr(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 ze(e){if(typeof fetch!="function"||kn())return;let t=le(e);if(ie.has(t)||De.has(t))return;let n=N.get(t);if(n&&bn()-n.at<Vr)return;if(ie.size>=Kr){for(De.add(t),_e.push(e);_e.length>Ri;){let s=_e.shift();De.delete(le(s))}return}ie.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},o=Wr();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();Ii(t,{html:l,build:a,finalUrl:c,at:bn()})}).catch(()=>{}).finally(()=>{ie.delete(t),Mi()})}function Mi(){for(;_e.length&&ie.size<Kr;){let e=_e.shift();De.delete(le(e)),ze(e)}}function Ii(e,t){for(N.has(e)&&N.delete(e),N.set(e,t);N.size>ji;){let n=N.keys().next().value;N.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Yr(e){let t=le(e),n=N.get(t);return!n||(N.delete(t),bn()-n.at>=Vr)?null:n}function bn(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function Ae(e){if(!ce)return;let t=Zr(e.target);if(!t||St(t)!=="intent")return;let n=_t(t);n&&(He===t&&Se||(Tt(),He=t,Se=setTimeout(()=>{Se=null,He=null,ze(n)},Li)))}function Jr(e){let t=Zr(e.target);t&&t===He&&Tt()}function Tt(){Se&&(clearTimeout(Se),Se=null),He=null}function Zr(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 yn(){if(typeof document>"u"||kn())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=_t(r);o&&St(r)==="viewport"&&ze(o)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=St(t);if(n==="render"){let r=_t(t);r&&ze(r)}else n==="viewport"&&e&&V.observe(t)}}function Pi(e){if(typeof document>"u"||!document.body)return!1;let t=ve(document.body),n,r=-1;for(let[c,l]of t)c.length>r&&(r=c.length,n=l);if(!n)return!1;let o=n.start.parentNode;if(!o||n.start.parentNode!==n.end.parentNode)return!1;let s=document.createElement("div");s.setAttribute("role","alert"),s.setAttribute("data-webjs-nav-error","");let i=e?`This page could not be loaded. (status ${e})`:"This page could not be loaded.";s.textContent=i;let a=document.createRange();return a.setStartAfter(n.start),a.setEndBefore(n.end),a.deleteContents(),o.insertBefore(s,n.end),!0}function gn(e,t,n){let r=new CustomEvent("webjs:navigation-error",{bubbles:!0,cancelable:!0,detail:{url:e,status:t??null,error:n||null}});if(typeof document<"u")try{document.dispatchEvent(r)}catch{}r.defaultPrevented||Pi(t)||typeof location<"u"&&(location.href=e)}async function At(e,t,n,r,o,s,i,a){o=o||"GET";let c=typeof a=="number"?a:k,l,f=null,m=null,u=!1,g=e,b=t?Qr(t,c):null;try{try{let d=o==="GET"&&!s&&!t?Yr(e):null;if(d)l=d.html,f=d.build,g=d.finalUrl,m=200,u=!0;else{let p={"x-webjs-router":"1"},w=Wr();w&&(p["x-webjs-have"]=w),t&&(p["x-webjs-frame"]=t),s!=null&&o!=="GET"&&o!=="HEAD"&&(p.accept=Tr+", text/html");let _={method:o,headers:p,credentials:"same-origin"};i&&(_.signal=i),s!=null&&o!=="GET"&&o!=="HEAD"&&(_.body=s);let y=await fetch(e,_);m=y.status,u=y.ok;let L=y.headers.get("content-type")||"",x=/^text\/html\b/i.test(L);if(L.toLowerCase().indexOf(Tr)===0){let j=await y.text();return c===k&&(Ue(r),pn(j)),{ok:u,status:m,aborted:!1}}if(y.redirected&&y.url&&(g=y.url),y.status===204||y.status===205)return c===k&&n&&history.pushState(null,"",g),{ok:u,status:m,aborted:!1};if(!x)return c===k&&(Ue(r),gn(e,y.status,null)),{ok:!1,status:m,aborted:!1};f=y.headers.get("x-webjs-build"),l=await y.text()}}catch(d){return d&&d.name==="AbortError"?{ok:!1,status:null,aborted:!0}:c!==k?{ok:!1,status:null,aborted:!0}:(Ue(r),gn(e,null,d instanceof Error?d:new Error(String(d))),{ok:!1,status:null,aborted:!1})}if(c!==k)return{ok:!1,status:m,aborted:!0};let h=Lr(l);if(!h)return Ue(r),gn(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:m,aborted:!1};if(ss(h,t,!1,g,f),n&&history.pushState(null,"",g),n){let d=new URL(g);if(d.hash){let p=document.getElementById(d.hash.slice(1));p?p.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:g,frameId:t,from:"navigate"}})),{ok:u,status:m,aborted:!1}}finally{b&&Xr(b,c)}}function Qr(e,t){if(typeof document>"u")return null;let n=null;try{n=document.querySelector(`webjs-frame#${CSS.escape(e)}`)}catch{n=document.getElementById(e)}if(!n)return null;let r=Ct.has(n);return Ct.set(n,t),n.setAttribute("aria-busy","true"),r||n.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:e,busy:!0}})),n}function Xr(e,t){if(Ct.get(e)!==t)return;Ct.delete(e),e.setAttribute("aria-busy","false");let n=e.id||null;e.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:n,busy:!1}}))}function es(e,t,n){let r=vt.has(e);return vt.set(e,t),e.setAttribute("aria-busy","true"),r||e.dispatchEvent(new CustomEvent("webjs:submit-start",{bubbles:!0,detail:{form:e,url:n}})),e}function ts(e,t,n,r){if(vt.get(e)!==t)return;vt.delete(e),e.setAttribute("aria-busy","false");let o=new CustomEvent("webjs:submit-end",{bubbles:!0,detail:{form:e,url:n,ok:!!r}});e.isConnected?e.dispatchEvent(o):typeof document<"u"?document.dispatchEvent(o):e.dispatchEvent(o)}function jr(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+=ae(r);return n}function ns(){if(typeof document>"u")return!1;let e=document.querySelector('meta[name="view-transition"]');return e?(e.getAttribute("content")||"").trim().toLowerCase()==="same-origin":!1}function yt(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(ns()&&typeof n=="function"){let r=n.call(document,e);r&&r.finished&&typeof r.finished.then=="function"?r.finished.then(()=>{t&&t()}).catch(()=>{}):t&&t();return}e(),t&&t()}function rs(e,t){if(!e||!t||typeof e.querySelectorAll!="function")return;let n=e.querySelectorAll("[data-webjs-permanent][id]");for(let r of n){let o=r.id;if(!o)continue;let s=null;try{s=t.querySelector(`#${CSS.escape(o)}`)}catch{s=null}if(!s||!r.hasAttribute||!r.hasAttribute("data-webjs-permanent"))continue;let i=s.parentNode;i&&s!==r&&i.replaceChild(r,s)}}function xn(e,t){let n=[];for(let r of e){if(r.nodeType!==1)continue;let o=r;if(o.hasAttribute&&o.hasAttribute("data-webjs-permanent")&&o.id&&n.push(o),typeof o.querySelectorAll=="function")for(let s of o.querySelectorAll("[data-webjs-permanent][id]"))n.push(s)}if(n.length)for(let r of n){let o=r.id;if(!o)continue;let s=$i(t,o);if(!s||s===r)continue;let i=s.parentNode;if(i)i.replaceChild(r,s);else{let a=t.indexOf(s);a!==-1&&(t[a]=r)}}}function $i(e,t){for(let n of e){if(n.nodeType!==1)continue;let r=n;if(r.id===t)return r;if(typeof r.querySelector=="function"){let o=null;try{o=r.querySelector(`#${CSS.escape(t)}`)}catch{o=null}if(o)return o}}return null}function Bi(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&we(t)}function ss(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=jr(document),b=jr(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){_n(e.head),yt(()=>{Ui(f,m),kt(f),we(f),wt()},()=>we(f)),Rr(e.body);return}let u=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(f||document).dispatchEvent(u),u.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let s=ve(document.body),i=ve(e.body),a=Hr(s,i);if(a){_n(e.head),yt(()=>{qi(s.get(a),i.get(a),e),wt()},()=>Bi(s.get(a))),Rr(e.body);return}cs(e.head),rs(document.body,e.body);let c=[...e.body.childNodes];yt(()=>{document.body.replaceChildren(...c),kt(document.body),we(document.body),wt()},()=>we(document.body))}function wt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function qi(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));xn(o,s),Fi(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),we(i))}function Fi(e,t,n,r,o){let s=new Map;for(let c of r){if(c.nodeType!==1)continue;let l=Ce(c);l&&s.set(l,c)}let i=n,a=[];for(let c of o){if(c.nodeType===1){let l=Ce(c);if(l&&s.has(l)){let f=s.get(l);Et(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 Et(e,t){if(e===t)return;if(e.tagName!==t.tagName){e.replaceWith(t);return}let n=new Set;for(let r of t.attributes)n.add(r.name),!wn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])wn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Tn(e,t)}function Tn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0));xn(n,r);let o=new Map;for(let a of n){if(a.nodeType!==1)continue;let c=Ce(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=Ce(c);if(l&&o.has(l)){let m=o.get(l);Et(m,c),s.push(m),o.delete(l);continue}let f=n[a];if(f&&f.nodeType===1&&!Ce(f)&&f.tagName===c.tagName){Et(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 Ce(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function os(){let e=ve(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:k}}function Ue(e){if(!e||e.token!==k)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 Ui(e,t){Tn(e,t)}function is(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function Nn(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=is();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function as(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=is();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function ae(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function _n(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(ae(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(ae(r))||(r.tagName==="SCRIPT"?document.head.appendChild(Nn(r)):document.head.appendChild(as(r))))}function cs(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(ae(s));let o=new Set;for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&o.add(ae(s));for(let s of[...t.children])s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(o.has(ae(s))||s.remove());for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(r.has(ae(s))||(s.tagName==="SCRIPT"?t.appendChild(Nn(s)):t.appendChild(as(s))))}function we(e){typeof customElements>"u"||ls(e)}function ls(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&&ls(n.shadowRoot))}function Rr(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(Nn(t))}function Di(e){return N.get(le(e))||null}function Hi(){return ie.size}function zi(){N.clear(),ie.clear(),_e.length=0,De.clear(),Tt()}function Wi(){return k}function Vi(){return++k}function Ki(){return q}function Gi(e){q=e}function Yi(e){return xt.test(e)}var Tr,ce,O,k,mn,q,bt,xt,Dr,Nr,xi,R,ji,Vr,Kr,Ri,Li,N,ie,_e,De,Se,He,V,Ct,vt,wn,dn=Ve(()=>{fn();gt();gt();Tr="text/vnd.webjs-stream.html";ce=!1,O=null,k=0,mn=null;q=null,bt=null;xt=/\.(?: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;Dr="_top";Nr=new Set;xi=16,R=new Map;ji=8,Vr=3e4,Kr=3,Ri=24,Li=100,N=new Map,ie=new Set,_e=[],De=new Set,Se=null,He=null,V=null;Ct=new WeakMap;vt=new WeakMap;wn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);Sn()});function gs(e,...t){return{_$webjs:"template",strings:e,values:t}}function v(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var A="w$";function bs(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 ke(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Lt(e,t){if(!(!t||!t.length))if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){let n=t.map(r=>{let o=new CSSStyleSheet;return o.replaceSync(r.text),o});e.adoptedStyleSheets=n}else{let n=e,r=document.createElement("style");r.textContent=t.map(o=>o.text).join(`
2
- `),n.appendChild(r)}}function Ot(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
- `)}</style>`}function Ke(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var In=Symbol.for("webjs.repeat");function Pn(e,t,n){return{[In]:!0,items:[...e],keyFn:t,templateFn:n}}function K(e){return!!e&&typeof e=="object"&&e[In]===!0}function ys(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function ue(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function ws(e){return{_$webjs:"live",value:e}}function fe(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function _s(e,t){return{_$webjs:"keyed",key:e,value:t}}function G(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ss(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Y(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function As(e){return{_$webjs:"template-content",template:e}}function de(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function Cs(e){return{_$webjs:"ref",target:e}}function J(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function vs(){return{value:void 0}}function Es(e){return{_$webjs:"cache",value:e}}function Z(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function ks(...e){return{_$webjs:"until",args:e}}function Q(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function xs(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function he(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ts(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function pe(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Ns(e){return{_$webjs:"watch",signal:e}}function X(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var I=null,U=!1,ge=0,me=null,Mt=0,$n=(e,t)=>Object.is(e,t),Ye=()=>{},Bn=()=>!1;function qn(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)qn(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function xe(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)xe(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function Ft(e){if(U)throw new Error("Signal read during notification phase");if(I===null)return;let t=I,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&$t(t)&&xe(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,$t(t)&&qn(e,t)),t.producerLastReadVersions[n]=e.version}function $t(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function Fn(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=U;U=!0;try{for(let n of e.liveConsumers)n.dirty||js(n)}finally{U=t}}function js(e){e.dirty=!0,Fn(e),e.consumerMarkedDirty.call(e.wrapper||e)}function Je(e){if(!(!e.dirty&&e.lastCleanEpoch===ge)){if(!e.producerMustRecompute()&&!Rs(e)){e.dirty=!1,e.lastCleanEpoch=ge;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=ge}}function Rs(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(Je(n),r!==n.version))return!0}return!1}function Bt(e){e&&(e.nextProducerIndex=0);let t=I;return I=e,t}function qt(e,t){if(I=t,!!e){if($t(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)xe(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var Ze=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=ge,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Bn,this.producerRecomputeValue=Ye,this.consumerMarkedDirty=Ye,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||$n,this.watched=n?.[Ut],this.unwatched=n?.[Dt]}get(){return Ft(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++,ge++,me!==null?Un(this):Fn(this))}};function Un(e){let t=U;U=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?me.add(n):Un(n))}finally{U=t}}var It=Symbol("unset"),Pt=Symbol("computing"),Ge=Symbol("errored"),Te=class{constructor(t,n){this.__fn=t,this.__value=It,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||$n,this.watched=n?.[Ut],this.unwatched=n?.[Dt];let r=this;this.producerMustRecompute=function(){return r.__value===It||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=Bt(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=Ge,r.__error=l,a=!0}finally{qt(r,s)}if(!a&&(o!==It&&o!==Ge)&&r.__equal.call(r.wrapper,o,i)){r.__value=o;return}r.__value=i,r.version++},this.consumerMarkedDirty=Ye}get(){if(Je(this),Ft(this),this.__value===Ge)throw this.__error;return this.__value}peek(){if(Je(this),this.__value===Ge)throw this.__error;return this.__value}},Qe=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=ge,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=Bn,this.producerRecomputeValue=Ye,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=Bt(this);try{for(let r of t)Ft(r),r.__isComputed&&Je(r)}finally{qt(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(xe(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=Bt(this),r;try{r=t()}finally{qt(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)xe(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},Ut=Symbol("watched"),Dt=Symbol("unwatched");function Ls(e){let t=I;I=null;try{return e()}finally{I=t}}function Os(e){return e.producers.slice()}function Ms(e){return e.liveConsumers?[...e.liveConsumers]:[]}function Is(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Ps(e){return e.producers.length>0}function $s(){return I&&I.__isComputed?I:null}function Bs(e){Mt++,me===null&&(me=new Set);try{e()}finally{if(Mt--,Mt===0){let t=me;me=null;for(let n of t)n.__fire()}}}var Ne={State:Ze,Computed:Te,subtle:{Watcher:Qe,untrack:Ls,introspectSources:Os,introspectSinks:Ms,hasSinks:Is,hasSources:Ps,currentComputed:$s,watched:Ut,unwatched:Dt}};function qs(e,t){return new Ze(e,t)}function Fs(e,t){return new Te(e,t)}function Us(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Ds(e){let t=!1,n=!1,r=new Te(e),o=new Qe(()=>{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 Hs=`${A}s`,zs=`${A}e`;function Dn(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Hs||t===zs}function Ws(e){for(let t of e.addedNodes)if(Dn(t))return!0;for(let t of e.removedNodes)if(Dn(t))return!0;return!1}function Kn(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var Re=Kn(),ee=Symbol("webjs.slot.state"),D="data-webjs-light",te="data-projection",Le="actual",Gn="fallback",nt=Symbol("webjs.slot.fallbackFrag"),Vs=64,je=null,Ht=null,Xe=null,Hn=!1;function Ks(){Hn||(Re=Kn(),Re&&(je=HTMLSlotElement.prototype.assignedNodes,Ht=HTMLSlotElement.prototype.assignedElements,Xe=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(D)&&!zn(this)?zt(this,t):je?je.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(D)&&!zn(this)?zt(this,t).filter(n=>n.nodeType===1):Ht?Ht.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=Xe&&Xe.get?Xe.get.call(this):null;return t||Gs(this)}}),Hn=!0))}Ks();function zn(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 zt(e,t){if(e.getAttribute(te)===Gn)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:Wt(n,new Set,0)}function Wt(e,t,n){if(n>=Vs)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(D)){let i=zt(s,{flatten:!1});if(i.length>0)for(let a of Wt(i,t,n+1))r.push(a);else for(let a of Wt(Array.from(s.childNodes),t,n+1))r.push(a)}else if(je){let i=je.call(s,{flatten:!0});for(let a of i)r.push(a)}else r.push(o)}else r.push(o);return r}function Gs(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(D))return t.getAttribute(te)===Le?t:null;t=t.parentElement}return null}function H(e){let t=e,n=t[ee];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[ee]=n),n}function Vt(e){return!!e[ee]}function Yn(e){let t=H(e);for(;e.firstChild;){let n=e.firstChild,r=et(n);tt(t.assignedByName,r,n),e.removeChild(n)}}function Jn(e){let t=H(e),n=e.querySelectorAll(`slot[${D}]`);for(let r of n){let o=r;if(o.getAttribute(te)!==Le)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 et(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function tt(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function Zn(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 Qn(e){if(!Re)return;let t=H(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let o of n)if(!Ws(o)){if(o.type==="childList"){for(let s of o.addedNodes)s.parentElement===e&&(tt(t.assignedByName,et(s),s),r=!0);for(let s of o.removedNodes)e.contains(s)||Wn(t,s)&&(r=!0)}else if(o.type==="attributes"&&o.attributeName==="slot"){let s=o.target;(Wn(t,s)||s.parentElement===e)&&(tt(t.assignedByName,et(s),s),r=!0)}}r&&rt(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function Xn(e){let t=e[ee];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 Wn(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 rt(e){let t=H(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,Ys(e)}))}function Ys(e){if(!Re)return;let t=e[ee];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${D}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||Js(t,i);for(let i of r)t.ownedSlots.has(i)||Xs(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?Zs(t,f,c)&&s.push(f):Qs(t,f)&&s.push(f)}}for(let i of s)eo(i)}function Js(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;Zn(e.pendingByName,o,r)}e.lastSnapshot.delete(t)}function Zs(e,t,n){let r=t.getAttribute(te)!==Le,o=e.lastSnapshot.get(t)||[];if(!r&&to(o,n))return!1;let i=t[nt];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(te,Le),e.lastSnapshot.set(t,n.slice()),!0}function Qs(e,t){let n=t.getAttribute(te)===Le;if(t.setAttribute(te,Gn),!n)return Vn(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return Vn(t),!0}function Vn(e){let t=e[nt];!t||t.childNodes.length===0||e.appendChild(t)}function Xs(e,t){if(!Re)return;let n=H(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>rt(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function er(e,t){if(!Vt(e))return;let n=H(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);Zn(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 eo(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function to(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 tr=new WeakMap,Kt=Symbol.for("webjs.instance");function ot(e,t){let n=t,r=n[Kt];if(v(e)){let o=e;if(r&&r.strings===o.strings){be(r,o.values);return}r&&nr(r,t);let s=t.firstChild;s&&s.nodeType===8&&s.data==="webjs-hydrate"&&s.remove();let i=so(o,t);n[Kt]=i;return}if(r&&nr(r,t),n[Kt]=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 it(e){let{strings:t}=e,n=tr.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 h=t[b];for(let d=0;d<h.length;d++){let p=h[d];switch(s){case"text":o+=p,p==="<"&&(s="tag-open");break;case"tag-open":o+=p,p==="!"?s="bang-1":p==="/"?(s="tag-name",m=""):/[a-zA-Z]/.test(p)?(s="tag-name",m=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=m==="script"||m==="style"?"rawtext":"text",s==="rawtext"&&(u="")):/\s/.test(p)?s="in-tag":m+=p.toLowerCase();break;case"in-tag":o+=p,p===">"?(s=m==="script"||m==="style"?"rawtext":"text",s==="rawtext"&&(u="")):!/\s/.test(p)&&p!=="/"&&(s="attr-name",i=p,a=o.length-1);break;case"rawtext":o+=p,u=(u+p.toLowerCase()).slice(-9),(u.endsWith("<\/script>")||u.endsWith("</style>"))&&(s="text",u="",m="");break;case"attr-name":p==="="?(s="after-eq",o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(i+=p,o+=p);break;case"after-eq":p==='"'||p==="'"?(s="attr-quoted",c=p,o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(s="attr-unquoted",o+=p);break;case"attr-unquoted":/\s/.test(p)?(s="in-tag",i="",o+=p):(p===">"&&(s="text",i=""),o+=p);break;case"attr-quoted":o+=p,p===c&&(s="in-tag",i="");break;case"skip-attr":if(p===c){if(f){let w=f.firstPartIdx,_=[];for(let S=w;S<r.length;S++)(r[S].kind==="noop"||r[S].kind==="attr-mixed")&&_.push(S);let y=[],L=t[_[0]],x=L.lastIndexOf(c);y.push(x>=0?L.slice(x+1):L);for(let S=1;S<_.length;S++)y.push(t[_[S]]);let M=t[_[_.length-1]+1],j=M.indexOf(c);y.push(j>=0?M.slice(0,j):M),r[w]={kind:"attr-mixed",path:[],name:f.name,statics:y,group:_},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+=`<!--${A}${d}-->`,r.push({kind:"child",path:[]});else if(s==="in-tag"){let p=`data-${A}${d}`;o+=`${p}=""`,r.push({kind:"element",path:[]})}else if(s==="after-eq"){let p=i[0],w=i.slice(1);if(p==="@"||p==="."||p==="?"){o=o.slice(0,a);let _=p==="@"?"event":p==="."?"prop":"bool",y=`data-${A}${d}`;o+=`${y}=""`,r.push({kind:_,path:[],name:w})}else{o=o.slice(0,a);let _=`data-${A}${d}`;o+=`${_}=""`,r.push({kind:"attr",path:[],name:i})}s="in-tag",i=""}else if(s==="attr-quoted"||s==="attr-unquoted"){o=o.slice(0,a);let p=`data-${A}${d}`;o+=`${p}=""`,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,no(g.content,r),ro(g.content,r),n={templateEl:g,parts:r},tr.set(t,n),n}function no(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(D,"");let o=t.length;r.setAttribute(`data-${A}${o}`,""),t.push({kind:"slot",path:[]})}}function ro(e,t){let n=[];function r(o){for(let s=0;s<o.childNodes.length;s++){let i=o.childNodes[s];if(n.push(s),i.nodeType===8){let a=i.data;if(a.startsWith(A)){let c=Number(a.slice(A.length));t[c]&&t[c].kind==="child"&&(t[c].path=n.slice())}}else if(i.nodeType===1){let a=i,c=[];for(let l of a.attributes)if(l.name.startsWith(`data-${A}`)){let f=Number(l.name.slice(`data-${A}`.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 so(e,t){let{templateEl:n,parts:r}=it(e),o=n.content.cloneNode(!0),s=document.createComment(`${A}s`),i=document.createComment(`${A}e`),a=r.map(l=>at(l,o)),c=[];for(let l=0;l<e.values.length;l++)ne(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"&&ne(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:s,endNode:i}}function at(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 be(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(ne(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function nr(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=Gt(n.slotEl);r&&er(r,n.slotEl)}}t.replaceChildren()}function ne(e,t,n,r){if(fe(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":ao(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":io(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=Gt(o);if(!a||oo(o))return;let c=document.createDocumentFragment();for(;o.firstChild;)c.appendChild(o.firstChild);o[nt]=c,rt(a)};Gt(o)?s():queueMicrotask(s);break}case"noop":break}}function Gt(e){let t=e.parentElement;for(;t;){if(t[ee])return t;t=t.parentElement}return null}function oo(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 io(e,t){let n=e,r=J(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 ao(e,t){return bo(e,t),$(e,t)}function $(e,t){let n=e.marker;if(ue(t)){z(e);let o=String(t.value??""),s=document.createElement("template");s.innerHTML=o;let i=[...s.content.childNodes],a=document.createDocumentFragment();for(let c of i)a.appendChild(c);n.parentNode?.insertBefore(a,n),e.child=i;return}if(G(t)){let o=t,s=e.__keyedKey;s!==void 0&&!Object.is(s,o.key)&&z(e),e.__keyedKey=o.key,$(e,o.value);return}if(Y(t)){let o=t,s=e.__guardDeps,i=o.deps;if(s!==void 0&&(Array.isArray(s)&&Array.isArray(i)?go(s,i):Object.is(s,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,$(e,o.fn());return}if(de(t)){z(e);let o=t.template;if(o&&o.content){let s=o.content.cloneNode(!0),i=[...s.childNodes];n.parentNode?.insertBefore(s,n),e.child=i}return}if(J(t))return;if(Z(t))return yo(e,t.value);if(Q(t))return wo(e,t.args);if(X(t))return _o(e,t.signal);if(he(t))return So(e,t);if(pe(t))return Ao(e,t);if(K(t)){if(e.child&&e.child.kind==="repeat"){uo(e,t);return}z(e);let o={kind:"repeat",map:new Map};e.child=o,lo(n,o,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){po(e,t);return}z(e);let o={kind:"array",items:[]};e.child=o,ho(n,o,t);return}if(e.child){let o=e.child;if(o.kind==="repeat")rr(o),e.child=void 0;else if(o.kind==="array")or(o),e.child=void 0;else if(o.kind==="async-stream")lr(o),e.child=void 0;else if("strings"in e.child){let s=e.child;if(v(t)&&s.strings===t.strings){be(s,t.values);return}ye(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(v(t)){let o=t,{templateEl:s,parts:i}=it(o),a=s.content.cloneNode(!0),c=document.createComment(`${A}s`),l=document.createComment(`${A}e`),f=i.map(g=>at(g,a)),m=[];for(let g=0;g<o.values.length;g++)ne(f[g],o.values[g],void 0,o.values),m.push(o.values[g]);let u=[c,...a.childNodes,l];n.parentNode?.insertBefore(co(u),n);for(let g of f)g.kind==="slot"&&ne(g,void 0,void 0,[]);e.child={strings:o.strings,bound:f,lastValues:m,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function co(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function ye(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 Jt(e){let{templateEl:t,parts:n}=it(e),r=t.content.cloneNode(!0),o=document.createComment(`${A}s`),s=document.createComment(`${A}e`),i=n.map(l=>at(l,r)),a=[];for(let l=0;l<e.values.length;l++)ne(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 Oe(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 lo(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(!v(f))continue;let{inst:m,frag:u}=Jt(f);t.map.set(l,m),a.appendChild(u)}i.insertBefore(a,e)}function uo(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(!v(m))continue;let u=o.map.get(f);if(u&&u.strings===m.strings)be(u,m.values),Yt(u.startNode,u.endNode,r,n),c.set(f,u),o.map.delete(f);else{u&&(Oe(u),ye(u.startNode,u.endNode),o.map.delete(f));let{inst:g,frag:b}=Jt(m);r.insertBefore(b,n),c.set(f,g)}}for(let l of o.map.values())Oe(l),ye(l.startNode,l.endNode);o.map=c}function rr(e){for(let t of e.map.values())Oe(t),ye(t.startNode,t.endNode);e.map.clear()}function fo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function st(e){e.type==="tpl"?(Oe(e.inst),ye(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function sr(e){if(v(e)){let{inst:t,frag:n}=Jt(e);return{item:{type:"tpl",inst:t},frag:n}}if(e!=null&&e!==!1&&e!==!0){let t=document.createTextNode(String(e));return{item:{type:"text",node:t},frag:t}}return{item:{type:"empty"},frag:null}}function ho(e,t,n){let r=e.parentNode;if(!r)return;let o=document.createDocumentFragment(),s=[];for(let i of n){let{item:a,frag:c}=sr(i);c&&o.appendChild(c),s.push(a)}r.insertBefore(o,e),t.items=s}function po(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,s=o.items,i=[];for(let a=0;a<t.length;a++){let c=t[a],l=s[a];if(v(c)){let u=c;if(l&&l.type==="tpl"&&l.inst.strings===u.strings){be(l.inst,u.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let u=String(c);l.node.data!==u&&(l.node.data=u),i.push(l);continue}}else{l&&st(l),i.push({type:"empty"});continue}let{item:f,frag:m}=sr(c);m&&r.insertBefore(m,mo(s,a,n)),l&&st(l),i.push(f)}for(let a=t.length;a<s.length;a++)st(s[a]);o.items=i}function mo(e,t,n){for(let r=t;r<e.length;r++){let o=fo(e[r]);if(o&&o.parentNode)return o}return n}function or(e){for(let t of e.items)st(t);e.items=[]}function Yt(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 go(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function z(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&ir(t),!e.child)return;let n=e.child;if(n.kind==="repeat")rr(n);else if(n.kind==="array")or(n);else if(n.kind==="async-stream")lr(n);else if("strings"in n){let r=e.child;Oe(r),ye(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function bo(e,t){let n=e;n.__untilState&&!Q(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Y(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!Z(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!G(t)&&(n.__keyedKey=void 0),n.__watchSub&&!X(t)&&ir(n)}function yo(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(v(t)&&a.strings===t.strings){be(a,t.values);return}let c=document.createDocumentFragment();Yt(a.startNode,a.endNode,c,null),o.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(v(t)){let a=t,c=o.get(a.strings);if(c){o.delete(a.strings),e.child&&z(e),Yt(c.inst.startNode,c.inst.endNode,n.parentNode,n),be(c.inst,a.values),e.child=c.inst;return}}$(e,t)}function wo(e,t){let n=e,r=n.__untilState,o=n.__untilArgs,s=(u,g)=>!!(Object.is(u,g)||v(u)&&v(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 _o(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 Ne.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 ir(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function So(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,ar(o,e,t)}function Ao(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,ar(o,e,t)}async function ar(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=cr(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 cr(e){if(e==null||e===!1||e===!0)return[];if(v(e)){let t=e,{templateEl:n,parts:r}=it(t),o=n.content.cloneNode(!0),s=r.map(i=>at(i,o));for(let i=0;i<t.values.length;i++)ne(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(...cr(n));return t}return[document.createTextNode(String(e))]}function lr(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 ur=Symbol.for("webjs:registry"),fr=Symbol.for("webjs:classToTag"),ct=globalThis,B=ct[ur]||(ct[ur]=new Map),dr=ct[fr]||(ct[fr]=new WeakMap),lt=typeof window<"u"&&typeof customElements<"u";function Zt(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=B.get(e);r?(r.cls=t,r.lazy=n):B.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),dr.set(t,e)}if(lt){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),Zt(t,n)}}if(!lt){let e=globalThis;e.customElements||(e.customElements={define(t,n){Zt(t,n)},get(t){return B.get(t)?.cls},upgrade(){},whenDefined(t){let n=B.get(t);return Promise.resolve(n?.cls)}})}function Qt(e,t){lt?customElements.define(e,t):Zt(e,t)}function Co(e,t){if(lt)return;let n=B.get(e);if(n){n.moduleUrl=t;return}B.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function Xt(e){return B.get(e)?.cls}function vo(e){return B.get(e)?.moduleUrl||null}function Eo(e){return B.get(e)?.lazy===!0}function ut(e){return dr.get(e)}function en(){return[...B.keys()]}var C="_$wj",Pe="_id";async function $e(e){return JSON.stringify(await hr(e))}function se(e){return pr(JSON.parse(e))}async function hr(e){let t=ko();return await xo(e,t),re(e,t)}function pr(e){return W(e,Ro())}function ko(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map}}async function xo(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!Oo(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(Mo(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 re(e,t){if(e===null)return null;if(e===void 0)return{[C]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[C]:"NaN"}:e===1/0?{[C]:"Inf"}:e===-1/0?{[C]:"-Inf"}:Object.is(e,-0)?{[C]:"-0"}:e;if(n==="bigint")return{[C]:"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{[C]:"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{[C]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let o;if(e instanceof Date)o={[C]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)o={[C]:"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={[C]:"File",v:Ie(s),n:e.name,t:e.type||"",m:e.lastModified}:o={[C]:"Blob",v:Ie(s),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let s=[];for(let[i,a]of e.entries())s.push([i,re(a,t)]);o={[C]:"FD",v:s}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)o=To(e);else if(e instanceof Map){let s=[];for(let[i,a]of e)s.push([re(i,t),re(a,t)]);o={[C]:"Map",v:s}}else if(e instanceof Set){let s=[];for(let i of e)s.push(re(i,t));o={[C]:"Set",v:s}}else if(Array.isArray(e))o=e.map(s=>re(s,t));else{o={};for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let i=Io(s)?"_"+s:s;o[i]=re(e[s],t)}}if(r!==void 0){if(Array.isArray(o))return{[C]:"Arr",[Pe]:r,v:o};o[Pe]=r}return o}function To(e){if(e instanceof ArrayBuffer)return{[C]:"buf",v:Ie(new Uint8Array(e))};if(e instanceof DataView)return{[C]:"dv",v:Ie(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=No[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[C]:n,v:Ie(r)}}var No={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},jo={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 Ro(){return{refs:new Map}}function W(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(W(e[i],t));return s}let n=e[C];if(typeof n=="string")return Lo(e,n,t);let r={},o=e[Pe];typeof o=="number"&&t.refs.set(o,r);for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s)||s===Pe)continue;let i=Po(s)?s.slice(1):s;r[i]=W(e[s],t)}return r}function Lo(e,t,n){let r=e[Pe],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(W(i,n),W(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(W(i,n));return s}case"Arr":{let s=[];typeof r=="number"&&n.refs.set(r,s);for(let i of e.v)s.push(W(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=Me(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=Me(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=W(a,n);s.append(i,c)}return s}default:{if(t==="buf"){let i=Me(e.v);return o(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=Me(e.v);return o(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let s=jo[t];if(s){let i=Me(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 Oo(e){return e!==null&&typeof e=="object"}function Mo(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Io(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function Po(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}var mr=typeof Buffer<"u"&&typeof Buffer.from=="function";function Ie(e){if(mr)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 Me(e){if(mr){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 yr=typeof window<"u"&&typeof HTMLElement<"u";function $o(e,t){return e!==t}function Bo(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var ft=class{constructor(){this.__ssrAttrs=new Map,this.__internals=null}get attributes(){return[...this.__ssrAttrs].map(([t,n])=>({name:t,value:n}))}getAttribute(t){let n=this.__ssrAttrs.get(String(t).toLowerCase());return n===void 0?null:n}setAttribute(t,n){this.__ssrAttrs.set(String(t).toLowerCase(),String(n))}removeAttribute(t){this.__ssrAttrs.delete(String(t).toLowerCase())}hasAttribute(t){return this.__ssrAttrs.has(String(t).toLowerCase())}toggleAttribute(t,n){let r=String(t).toLowerCase(),o=this.__ssrAttrs.has(r);return(n===void 0?!o:n)?(this.__ssrAttrs.set(r,""),!0):(this.__ssrAttrs.delete(r),!1)}getAttributeNames(){return[...this.__ssrAttrs.keys()]}closest(t){let n=String(t).trim().toLowerCase();if(!/^[a-z][a-z0-9-]*$/.test(n))return null;if(this.__ssrTag===n)return this;let r=this.__ssrAncestors;if(!Array.isArray(r))return null;for(let o=r.length-1;o>=0;o--)if(r[o]&&r[o].__ssrTag===n)return r[o];return null}get dataset(){if(this.__dataset)return this.__dataset;let t=this,n=r=>"data-"+String(r).replace(/[A-Z]/g,o=>"-"+o.toLowerCase());return this.__dataset=new Proxy({},{get(r,o){if(typeof o!="string")return;let s=t.getAttribute(n(o));return s===null?void 0:s},set(r,o,s){return typeof o=="string"&&t.setAttribute(n(o),s),!0},has(r,o){return typeof o=="string"&&t.hasAttribute(n(o))},deleteProperty(r,o){return typeof o=="string"&&t.removeAttribute(n(o)),!0},ownKeys(){return t.getAttributeNames().filter(r=>r.startsWith("data-")).map(r=>r.slice(5).replace(/-([a-z])/g,(o,s)=>s.toUpperCase()))},getOwnPropertyDescriptor(r,o){if(typeof o=="string"&&t.hasAttribute(n(o)))return{enumerable:!0,configurable:!0,value:t.getAttribute(n(o))}}}),this.__dataset}get className(){return this.getAttribute("class")??""}set className(t){this.setAttribute("class",t)}get hidden(){return this.hasAttribute("hidden")}set hidden(t){this.toggleAttribute("hidden",!!t)}get id(){return this.getAttribute("id")??""}set id(t){this.setAttribute("id",t)}get title(){return this.getAttribute("title")??""}set title(t){this.setAttribute("title",t)}get slot(){return this.getAttribute("slot")??""}set slot(t){this.setAttribute("slot",t)}get role(){return this.getAttribute("role")}set role(t){t==null?this.removeAttribute("role"):this.setAttribute("role",t)}get tabIndex(){let t=this.getAttribute("tabindex");return t===null?-1:Number.parseInt(t,10)||0}set tabIndex(t){this.setAttribute("tabindex",String(t))}addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return this.__internals=Bo(),this.__internals}},qo=["ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText"];for(let e of qo){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(ft.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var Fo=yr?HTMLElement:ft,tn=class extends Fo{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Qt(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(gr)}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||$o)(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=gr(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(!yr)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=br(r.slice(16));try{this[s]=se(o)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,o=Array.isArray(r)?r:ke(r)?[r]:[];if(o.length){if(n){let s=this.shadowRoot.querySelector("style");s&&s.remove()}Lt(this._renderRoot,o)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${ut(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().`),Vt(this)||(this.__isHydrating()?(H(this),Jn(this)):Yn(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&&Qn(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&&Xn(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=br(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 <${ut(this.constructor)||this.tagName?.toLowerCase()}>:`,r);try{let o=this.renderError(r);o!==void 0&&ot(o,this._renderRoot)}catch(o){console.error("[webjs] renderError() also threw:",o)}}for(let r of this.__controllers)r.hostUpdated&&r.hostUpdated();n=!0}}catch(r){console.error("[webjs] lifecycle hook threw during update phase:",r)}finally{this._isUpdating=!1,n&&(this._changedProperties=new Map)}if(n)try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(r){console.error("[webjs] lifecycle hook threw during post-commit phase:",r)}finally{this._resolveUpdate()}else this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new Ne.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;this.__signalWatcher.observe(()=>{n=this.render()}),ot(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 gr(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function br(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var ja=Symbol.for("webjs.suspense");function Uo(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function dt(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}var nn=null;function Do(e){nn=e}function rn(){if(!nn)return"";try{return nn()||""}catch{return""}}async function Ho(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=await E(e,n);return t&&t.ssr===!1?r:await Be(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(ue(e))return String(e.value??"");if(fe(e))return E(e.value,t);if(X(e))return E(e.signal.get(),t);if(G(e))return E(e.value,t);if(Y(e))return E(e.fn(),t);if(de(e)){let n=e.template;return String(n?.innerHTML??"")}if(J(e))return"";if(Z(e))return E(e.value,t);if(Q(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(he(e)||pe(e))return"";if(Array.isArray(e))return(await Promise.all(e.map(r=>E(r,t)))).join("");if(K(e)){let n=e;return(await Promise.all(n.items.map((o,s)=>E(n.templateFn(o,s),t)))).join("")}if(dt(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 v(e)?zo(e,t):Ke(String(e))}async function zo(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 h=g[b];switch(s){case"text":o+=h,h==="<"&&(s="tag-open");break;case"tag-open":o+=h,h==="!"?s="bang-1":h==="/"?(s="tag-name",f=""):/[a-zA-Z]/.test(h)?(s="tag-name",f=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=pt(f)?"rawtext":"text",s==="rawtext"&&(m="")):/\s/.test(h)?s="in-tag":f+=h.toLowerCase();break;case"in-tag":o+=h,h===">"?(s=pt(f)?"rawtext":"text",s==="rawtext"&&(m="")):!/\s/.test(h)&&h!=="/"&&(s="attr-name",i=h,a=o.length-1);break;case"rawtext":o+=h,m=(m+h.toLowerCase()).slice(-9),(m.endsWith("<\/script>")||m.endsWith("</style>"))&&(s="text",m="",f="");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}}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 h=i[0],d=i.slice(1);if(h==="@")o=o.slice(0,a),s="in-tag",i="";else if(h==="."){if(o=o.slice(0,a),!f.includes("-")){s="in-tag",i="";continue}if(b===void 0){s="in-tag",i="";continue}try{let p=await $e(b);o+=`data-webjs-prop-${ni(d)}="${P(p)}"`}catch(p){console.warn(`[webjs] property binding .${d} has an unserializable value during SSR. Dropping. The browser will see the property as undefined. Detail: ${p&&p.message}`)}s="in-tag",i=""}else h==="?"?(o=o.slice(0,a),b&&(o+=`${d}=""`),s="in-tag",i=""):(o+=`"${P(String(b??""))}"`,s="in-tag",i="")}else(s==="attr-quoted"||s==="attr-unquoted")&&(o+=P(String(b??"")))}}return o}var Wo=new Set(["document","window","localStorage","sessionStorage","navigator","matchMedia","requestAnimationFrame","getComputedStyle","IntersectionObserver","MutationObserver","ResizeObserver"]),Vo=new Set(["attachShadow","querySelector","querySelectorAll","getBoundingClientRect","focus","blur","scrollIntoView"]);function Ko(e){let t=e&&typeof e.message=="string"?e.message:"",n=/^(\w+) is not defined$/.exec(t);return e instanceof ReferenceError&&n&&Wo.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&&Vo.has(n[1])?`\`${n[1]}\` is an HTMLElement method that does not exist on the server-side component instance during SSR.`:null)}async function Be(e,t,n=[]){let r=en();if(!r.length)return e;let o=[...r].sort((f,m)=>m.length-f.length),s=new RegExp(`<(${o.map(ht).join("|")})(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^>])*?)(/?)>`,"g"),i=[];for(let f of e.matchAll(s)){let[m,u,g,b]=f,h=Xt(u);if(!h)continue;t&&t.usedComponents&&t.usedComponents.add(u);let d=b?`<${u}${g}>`:m;try{let p=h.shadow===!0,w=new h;w.__ssrTag=u,w.__ssrAncestors=n;let _=_r(g),y=ri(_),L=new Set(Object.keys(_r(g)).map(j=>j.toLowerCase()));Xo(w,_),ti(w,_,h);for(let[j,S]of Object.entries(y))w[j]=S;typeof w.performServerUpdate=="function"&&w.performServerUpdate();let x=w.render?w.render():"";x&&typeof x.then=="function"&&(x=await x),d=ei(d,w,L);let M=await E(x,t);if(p){let j=await Be(M,t,[...n,w]),S=h.styles,Ee=Array.isArray(S)?S:S&&ke(S)?[S]:[],jt=Ot(Ee);i.push({start:f.index,end:f.index+m.length,text:`${d}<template shadowrootmode="open">${jt}${j}</template>`})}else{if(M.trim()===""){i.push({start:f.index,end:f.index+m.length,text:`${d}<!--webjs-hydrate-->`});continue}let S="",Ee=f.index+m.length;if(!b){let Rt=f.index+m.length,We=on(e,Rt,u);if(We!==-1){S=e.slice(Rt,We);let ds=new RegExp(`</${ht(u)}\\s*>`,"i"),hs=e.slice(We),On=ds.exec(hs),ps=On?On[0].length:`</${u}>`.length;Ee=We+ps}else S=e.slice(Rt),Ee=e.length}let jt=Zo(S),us=Qo(M,jt),fs=await Be(us,t,[...n,w]);i.push({start:f.index,end:Ee,text:`${d}<!--webjs-hydrate-->${fs}</${u}>`})}}catch(p){let w=Ko(p);console.error(w?`[webjs] SSR failed for <${u}>: ${w} 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 <${u}>:`,p)}}if(!i.length)return e;i.sort((f,m)=>f.start-m.start);let a=[],c=-1;for(let f of i)f.start>=c&&(a.push(f),c=f.end);let l=e;for(let f=a.length-1;f>=0;f--){let{start:m,end:u,text:g}=a[f];l=l.slice(0,m)+g+l.slice(u)}return l}var Go=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Yo(e){return Go.has(e.toLowerCase())}function on(e,t,n){let r=ht(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 Jo(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 Zo(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||Yo(m),g=Jo(l),b;if(u)b=o+a.length;else{let d=o+a.length,p=on(e,d,m);if(p===-1){let x=e.slice(o);g!==null?wr(t,g,x):n+=x,r=e.length;continue}let w=new RegExp(`</${ht(m)}\\s*>`,"i"),_=e.slice(p),y=w.exec(_),L=y?y[0].length:`</${m}>`.length;b=p+L}let h=e.slice(o,b);g!==null?wr(t,g,h):n+=h,r=b}return n.length>0&&t.set(null,n),t}function wr(e,t,n){let r=e.get(t);r!==void 0?e.set(t,r+n):e.set(t,n)}function Qo(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="",h;if(f)h=i.index+a.length;else{let _=i.index+a.length,y=on(e,_,"slot");if(y===-1)b=e.slice(_),h=e.length;else{b=e.slice(_,y);let L=/<\/slot\s*>/i,x=e.slice(y),M=L.exec(x),j=M?M[0].length:7;h=y+j}}let d=t.get(u),p=u!==null?` name="${P(u)}"`:"",w=g?` ${g}`:"";d!==void 0&&!n.has(u)?(n.add(u),r+=`<slot data-webjs-light data-projection="actual"${p}${w}>${d}</slot>`):r+=`<slot data-webjs-light data-projection="fallback"${p}${w}>${b}</slot>`,o=h,s.lastIndex=h}return r+=e.slice(o),r}function ht(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pt(e){return e==="script"||e==="style"}function _r(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 Xo(e,t){if(!(!e||typeof e.setAttribute!="function"))for(let[n,r]of Object.entries(t))e.setAttribute(n,an(r))}function ei(e,t,n){if(!t||typeof t.getAttributeNames!="function")return e;let r="";for(let o of t.getAttributeNames()){let s=String(o).toLowerCase();if(n.has(s))continue;let i=t.getAttribute(o);r+=i===""?` ${s}`:` ${s}="${P(String(i))}"`}return r?`${e.slice(0,-1)}${r}>`:e}function ti(e,t,n){let r=n.properties||{};for(let[o,s]of Object.entries(t)){let i=r[o]||r[sn(o)],a=r[o]?o:sn(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(an(s))}catch{e[a]=s}else e[a]=s}}function sn(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ni(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function an(e){return e.replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function ri(e){let t={};for(let n of Object.keys(e)){if(!n.startsWith("data-webjs-prop-"))continue;let r=sn(n.slice(16));try{t[r]=se(an(e[n]))}catch{}delete e[n]}return t}function si(e,t={ssr:!0}){let n=t&&t.suspenseCtx;return new ReadableStream({async start(r){try{if(t&&t.ssr===!1)await T(e,n,r);else{let o=await E(e,n),s=await Be(o,n);r.enqueue(s)}n&&n.pending.length&&await ii(n,r),r.close()}catch(o){r.error(o)}}})}async function T(e,t,n){if(!(e==null||e===!1||e===!0)){if(e&&typeof e.then=="function")return e=await e,T(e,t,n);if(ue(e)){n.enqueue(String(e.value??""));return}if(fe(e))return T(e.value,t,n);if(X(e))return T(e.signal.get(),t,n);if(G(e))return T(e.value,t,n);if(Y(e))return T(e.fn(),t,n);if(de(e)){let r=e.template;n.enqueue(String(r?.innerHTML??""));return}if(!J(e)){if(Z(e))return T(e.value,t,n);if(Q(e)){let r=e.args;for(let o of r)if(!o||typeof o.then!="function")return T(o,t,n);if(r.length>0)try{let o=await Promise.race(r.map(s=>Promise.resolve(s).catch(()=>{})));return T(o,t,n)}catch{return}return}if(!(he(e)||pe(e))){if(Array.isArray(e)){for(let r of e)await T(r,t,n);return}if(K(e)){let r=e;for(let o=0;o<r.items.length;o++)await T(r.templateFn(r.items[o],o),t,n);return}if(dt(e)){let r=e;if(t){let o=`s${t.nextId++}`;n.enqueue(`<webjs-boundary id="${o}">`),await T(r.fallback,t,n),n.enqueue("</webjs-boundary>"),t.pending.push({id:o,promise:Promise.resolve(r.children)})}else await T(r.fallback,t,n);return}if(v(e)){await oi(e,t,n);return}n.enqueue(Ke(String(e)))}}}}async function oi(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 h=0;h<b.length;h++){let d=b[h];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=pt(f)?"rawtext":"text",s==="rawtext"&&(m="")):/\s/.test(d)?s="in-tag":f+=d.toLowerCase();break;case"in-tag":u+=d,d===">"?(s=pt(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 h=o[g];if(h&&typeof h.then=="function"&&(h=await h),s==="comment")u+=String(h??""),l=0;else if(s==="rawtext")u+=String(h??""),m="";else if(s==="text")u&&(n.enqueue(u),u=""),await T(h,t,n);else if(s==="after-eq"){let d=i[0],p=i.slice(1);d==="@"||d==="."?(u=u.slice(0,a),s="in-tag",i=""):d==="?"?(u=u.slice(0,a),h&&(u+=`${p}=""`),s="in-tag",i=""):(u+=`"${P(String(h??""))}"`,s="in-tag",i="")}else(s==="attr-quoted"||s==="attr-unquoted")&&(u+=P(String(h??"")))}}u&&n.enqueue(u)}async function ii(e,t){let n=rn(),r=n?` nonce="${P(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 Be(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 Sr=Symbol.for("webjs.notFound"),Ar=Symbol.for("webjs.redirect");function ai(){let e=new Error("webjs: notFound()");throw e.__webjs=Sr,e}function ci(e,t=307){let n=new Error(`webjs: redirect(${e})`);throw n.__webjs=Ar,n.url=e,n.status=t,n}function li(e){return!!e&&e.__webjs===Sr}function ui(e){return!!e&&e.__webjs===Ar}function fi(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?di(n.cors):null},t}function di(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 hi(e,t){if(typeof e!="function")throw new Error("validateInput(): first argument must be the action function");if(typeof t!="function")throw new Error("validateInput(): second argument must be a validator function");let n=e.__webjsHttp||{};return e.__webjsHttp={...n,validate:t},e}function pi(e){return e&&typeof e=="function"&&e.__webjsHttp||null}function mi(e,t={}){let n=t.reconnect!==!1,r=0,o=!1,s=null,i=[];function a(){o||(s=new WebSocket(gi(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 gi(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 cn="application/vnd.webjs+json";async function bi(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",cn);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 $e(r),n.has("content-type")||n.set("content-type",cn));let o=await fetch(e,{...t,headers:n,body:r}),s=o.headers.get("content-type")||"",i=await o.text(),a=s.includes(cn)?i?se(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}dn();fn();gt();async function Ji(e,t,n){let r=e.get();e.set(t);let o;try{o=await n()}catch(s){throw e.set(r),s}return o&&o.success===!1&&e.set(r),o}var Zi=Symbol.for("webjs.context");function Qi(e){return{__context__:Zi,name:e}}var Nt=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},jn=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()}},Rn=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 Nt(this._context,(n,r)=>{let o=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(o,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};function Xi(){return typeof window<"u"}var F={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},Ln=class{constructor(t,{task:n,args:r,autoRun:o=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=o,this._status=F.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=F.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=F.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=F.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 F.INITIAL:return t.initial?.();case F.PENDING:return t.pending?.();case F.COMPLETE:return t.complete?.(this._value);case F.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!Xi())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{Rn as ContextConsumer,jn as ContextProvider,Nt as ContextRequestEvent,A as MARKER,Ne as Signal,Uo as Suspense,Ln as Task,F as TaskStatus,tn as WebComponent,un as WebjsFrame,hn as WebjsStream,Lt as adoptStyles,en as allTags,xs as asyncAppend,Ts as asyncReplace,Bs as batch,Es as cache,Fs as computed,mi as connectWS,Qi as createContext,vs as createRef,rn as cspNonce,bs as css,pr as deserialize,Or as disableClientRouter,Ds as effect,Sn as enableClientRouter,P as escapeAttr,Ke as escapeText,fi as expose,pi as getExposed,Ss as guard,gs as html,he as isAsyncAppend,pe as isAsyncReplace,ke as isCSS,Z as isCache,Y as isGuard,G as isKeyed,Eo as isLazy,fe as isLive,li as isNotFound,ui as isRedirect,J as isRef,K as isRepeat,Us as isSignal,dt as isSuspense,v as isTemplate,de as isTemplateContent,ue as isUnsafeHTML,Q as isUntil,X as isWatch,_s as keyed,ws as live,Xt as lookup,vo as lookupModuleUrl,Mr as navigate,ai as notFound,Ji as optimistic,se as parse,Co as primeModuleUrl,ci as redirect,Cs as ref,Qt as register,ot as render,pn as renderStream,si as renderToStream,Ho as renderToString,Pn as repeat,Ir as revalidate,bi as richFetch,hr as serialize,Do as setCspNonceProvider,qs as signal,$e as stringify,Ot as stylesToString,ut as tagOf,As as templateContent,ys as unsafeHTML,ks as until,hi as validateInput,Ns as watch};
1
+ var ps=Object.defineProperty;var We=(e,t)=>()=>(e&&(t=e(e=0)),t);var On=(e,t)=>{for(var n in t)ps(e,n,{get:t[n],enumerable:!0})};var vr={};On(vr,{observeLazy:()=>gi,observeViewportOnce:()=>_i});function Cr(e){let t=cn.get(e);return t||(t=import(e).finally(()=>cn.delete(e)),cn.set(e,t),t)}function gi(e){for(let[t,n]of Object.entries(e))oe.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of oe.values())Cr(t);oe.clear();return}qe||(qe=new IntersectionObserver(yi,{rootMargin:"200px"})),Ar(),typeof MutationObserver<"u"&&new MutationObserver(()=>Ar()).observe(document.body,{childList:!0,subtree:!0})}function Ar(){if(!(!qe||!oe.size))for(let e of oe.keys())for(let t of document.querySelectorAll(e))qe.observe(t)}function yi(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=oe.get(n);r&&(Cr(r),oe.delete(n),qe?.unobserve(t.target))}}function wi(e){for(let t of e){if(!t.isIntersecting)continue;let n=pt.get(t.target);pt.delete(t.target),Be?.unobserve(t.target),n&&n()}}function _i(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(Be||(Be=new IntersectionObserver(wi,{rootMargin:"200px"})),pt.set(e,t),Be.observe(e),()=>{pt.delete(e),Be?.unobserve(e)})}var oe,qe,cn,Be,pt,Er=We(()=>{oe=new Map,qe=null,cn=new Map;Be=null,pt=new WeakMap});var ln,un=We(()=>{ln=typeof HTMLElement<"u"?class extends HTMLElement{constructor(){super(),this._webjsLoadedSrc=null,this._webjsLazyTeardown=null}static get observedAttributes(){return["src"]}connectedCallback(){this._webjsScheduleLoad()}disconnectedCallback(){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null)}attributeChangedCallback(t,n,r){t==="src"&&this.isConnected&&this._webjsScheduleLoad()}_webjsScheduleLoad(){let t=this.getAttribute("src");if(!t){this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),this._webjsLoadedSrc=null;return}let n=t;try{n=new URL(t,location.href).href}catch{}if(n===this._webjsLoadedSrc)return;this._webjsLazyTeardown&&(this._webjsLazyTeardown(),this._webjsLazyTeardown=null),(this.getAttribute("loading")||"eager").toLowerCase()==="lazy"?(this._webjsLoadedSrc=n,Promise.resolve().then(()=>(Er(),vr)).then(({observeViewportOnce:o})=>{this._webjsLoadedSrc!==n||!this.isConnected||(this._webjsLazyTeardown=o(this,()=>{this._webjsLazyTeardown=null,this._webjsLoad(n)}))})):(this._webjsLoadedSrc=n,this._webjsLoad(n))}_webjsLoad(t){Promise.resolve().then(()=>(fn(),kr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&ln&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",ln)});function Ai(e,t,n){switch(e){case"append":n&&t.append(n);break;case"prepend":n&&t.prepend(n);break;case"before":n&&t.before(n);break;case"after":n&&t.after(n);break;case"replace":n&&t.replaceWith(n);break;case"update":n&&t.replaceChildren(n);break;case"remove":t.remove();break;default:break}}function hn(e,t){let n=t||(typeof document<"u"?document:null);if(!n)return;let r=null;if(typeof e=="string"){let s=n.createElement("template");s.innerHTML=e,r=s.content}else if(e&&e.nodeType)r=e;else return;let o=r.querySelectorAll?Array.from(r.querySelectorAll("webjs-stream")):[];if(o.length)for(let s of o)n.body.append(s);else n.body.append(r)}var Si,dn,mt=We(()=>{Si=new Set(["append","prepend","before","after","replace","update"]);dn=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this._webjsApplied||(this._webjsApplied=!0,this._webjsApply())}_webjsApply(){let t=(this.getAttribute("action")||"").toLowerCase(),n=this.ownerDocument||document,r=[],o=this.getAttribute("target");if(o){let i=n.getElementById(o);i&&(r=[i])}else{let i=this.getAttribute("targets");if(i)try{r=Array.from(n.querySelectorAll(i))}catch{r=[]}}let s=Si.has(t)?this.querySelector("template"):null;try{for(let i of r){let a=s?s.content.cloneNode(!0):null;Ai(t,i,a)}}finally{this.remove()}}}:null;typeof customElements<"u"&&dn&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",dn)});var kr={};On(kr,{_FRAME_TOP:()=>Ur,_LIVE_ATTRS:()=>yn,_activeFrameId:()=>Fr,_addNewHeadElements:()=>wn,_blurOutgoingFocus:()=>yt,_buildSubmitFormData:()=>Br,_bumpNavToken:()=>Wi,_clearFormBusy:()=>es,_clearFrameBusy:()=>Qr,_collectChildrenSlots:()=>ve,_currentPageUrl:()=>Vi,_diffElementInPlace:()=>vt,_eligibleAnchorHref:()=>wt,_findAnchorInPath:()=>qr,_getSubmitAction:()=>$r,_getSubmitMethod:()=>Pr,_isNonHtmlPath:()=>Gi,_keyOf:()=>Ce,_longestSharedPath:()=>Dr,_markFormBusy:()=>Xr,_markFrameBusy:()=>Zr,_mergeHead:()=>as,_navToken:()=>zi,_onPopState:()=>Sn,_onSubmit:()=>An,_prefetch:()=>He,_prefetchInflightSize:()=>Di,_prefetchMode:()=>_t,_prefetchPeek:()=>Ui,_prefetchSaysSaveData:()=>En,_prefetchSuppressed:()=>Kr,_prefetchTake:()=>Gr,_reactivateScripts:()=>Et,_reconcileChildren:()=>xn,_regraftPermanentElements:()=>ns,_regraftPermanentInSlice:()=>kn,_resetPrefetch:()=>Hi,_resolveTargetFrameId:()=>Cn,_restoreOptimistic:()=>Fe,_runWithTransition:()=>gt,_setCurrentPageUrl:()=>Ki,_snapshotCache:()=>R,_viewTransitionsEnabled:()=>ts,collectChildrenSlots:()=>ve,disableClientRouter:()=>Lr,enableClientRouter:()=>_n,loadFrame:()=>vi,longestSharedPath:()=>Dr,navigate:()=>Or,revalidate:()=>Mr});function Rr(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function Ci(){pn||typeof MutationObserver>"u"||typeof customElements>"u"||(pn=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)}}),pn.observe(document.body,{childList:!0,subtree:!0}))}function _n(){ce||typeof document>"u"||(ce=!0,document.addEventListener("click",Ir,!1),document.addEventListener("submit",An,!1),window.addEventListener("popstate",Sn),document.addEventListener("pointerover",Ae,!0),document.addEventListener("focusin",Ae,!0),document.addEventListener("touchstart",Ae,{capture:!0,passive:!0}),document.addEventListener("pointerout",Yr,!0),document.addEventListener("webjs:navigate",gn),Ci(),gn(),typeof history<"u"&&"scrollRestoration"in history&&(bt=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(q=location.href))}function Lr(){ce&&(ce=!1,document.removeEventListener("click",Ir,!1),document.removeEventListener("submit",An,!1),window.removeEventListener("popstate",Sn),document.removeEventListener("pointerover",Ae,!0),document.removeEventListener("focusin",Ae,!0),document.removeEventListener("touchstart",Ae,{capture:!0}),document.removeEventListener("pointerout",Yr,!0),document.removeEventListener("webjs:navigate",gn),xt(),V&&(V.disconnect(),V=null),typeof history<"u"&&bt!==null&&(history.scrollRestoration=bt,bt=null),q=null)}async function Or(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await vn(n.href,t?.replace??!1,null)}async function vi(e,t){if(typeof location>"u")return{ok:!1,status:null,aborted:!1};let n=e&&e.id;if(!n)return{ok:!1,status:null,aborted:!1};let r=new URL(t,location.href);if(r.origin!==location.origin)return{ok:!1,status:null,aborted:!1};O&&O.abort(),O=new AbortController;let o=O.signal,s=++k;return St(r.href,n,!1,null,"GET",null,o,s)}function Mr(e){if(!e){R.clear(),N.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;R.delete(n),N.delete(n)}function Ir(e){if(!ce||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=qr(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||kt.test(r.pathname))return;e.preventDefault();let o=Cn(t);vn(n,!1,o)}function Sn(e){vn(location.href,!0,null)}function An(e){if(!ce||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=Pr(t,n);if(o==="dialog")return;let s=$r(t,n),i;try{i=new URL(s,location.href)}catch{return}if(i.origin!==location.origin||kt.test(i.pathname))return;let a=Br(t,n);e.preventDefault();let c=Cn(n||t);Ti(i.href,o,a,c,t)}function Pr(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function $r(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function Br(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 qr(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function Fr(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 Cn(e){if(!e)return null;let t=e.closest&&e.closest("[data-webjs-frame]"),n=t?t.dataset?t.dataset.webjsFrame:t.getAttribute("data-webjs-frame"):null;if(n!=null&&n!==""){if(n===Ur)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(Ei(`webjs:frame-unresolved:${n}`,`[webjs] data-webjs-frame="${n}" did not match a live <webjs-frame id="${n}">; performing a normal navigation instead.`),null)}return Fr(e)}function Ei(e,t){Tr.has(e)||(Tr.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function ve(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 Dr(e,t){let n=null;for(let r of e.keys())t.has(r)&&(n===null||r.length>n.length)&&(n=r);return n}function Hr(e){let t=le(e);R.has(t)&&R.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(R.set(t,n);R.size>ki;){let r=R.keys().next().value;R.delete(r)}}function xi(e){let t=le(e),n=R.get(t);return n==null?null:(R.delete(t),R.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function le(e){let t=new URL(e,location.href);return t.pathname+t.search}async function vn(e,t,n){O&&O.abort(),O=new AbortController;let r=O.signal,o=++k;q&&Hr(q);let s=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),s=null},150),i=null;t||(i=ss());try{if(t){let a=xi(e);if(a){let c=Rr(a.html);if(c){rs(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),St(e,n,!1,i,"GET",null,r,o).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await St(e,n,!t,i,"GET",null,r,o)}finally{s&&clearTimeout(s),o===k&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(q=location.href))}}async function Ti(e,t,n,r,o){O&&O.abort(),O=new AbortController;let s=O.signal,i=++k,a=t==="get"||t==="head",c=new URL(e,location.href);if(a){c.search="";for(let[b,g]of n)c.searchParams.append(b,typeof g=="string"?g:g.name)}q&&Hr(q);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),f=ss(),m=o?Xr(o,i,c.href):null,u=!1;try{let b=await St(c.href,r,!0,f,a?"GET":t.toUpperCase(),a?null:n,s,i);u=!!(b&&b.ok),!a&&i===k&&(R.clear(),N.clear())}finally{m&&es(m,i,c.href,u),l&&clearTimeout(l),i===k&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(q=location.href))}}function zr(){return[...ve(document.body).keys()].join(",")}function En(){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 Li(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function wt(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||kt.test(n.pathname)?null:t}function Kr(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=Li(e);return t.includes("external")||t.includes("no-prefetch")}function _t(e){if(Kr(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 He(e){if(typeof fetch!="function"||En())return;let t=le(e);if(ie.has(t)||Ue.has(t))return;let n=N.get(t);if(n&&bn()-n.at<Wr)return;if(ie.size>=Vr){for(Ue.add(t),_e.push(e);_e.length>ji;){let s=_e.shift();Ue.delete(le(s))}return}ie.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},o=zr();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();Mi(t,{html:l,build:a,finalUrl:c,at:bn()})}).catch(()=>{}).finally(()=>{ie.delete(t),Oi()})}function Oi(){for(;_e.length&&ie.size<Vr;){let e=_e.shift();Ue.delete(le(e)),He(e)}}function Mi(e,t){for(N.has(e)&&N.delete(e),N.set(e,t);N.size>Ni;){let n=N.keys().next().value;N.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Gr(e){let t=le(e),n=N.get(t);return!n||(N.delete(t),bn()-n.at>=Wr)?null:n}function bn(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function Ae(e){if(!ce)return;let t=Jr(e.target);if(!t||_t(t)!=="intent")return;let n=wt(t);n&&(De===t&&Se||(xt(),De=t,Se=setTimeout(()=>{Se=null,De=null,He(n)},Ri)))}function Yr(e){let t=Jr(e.target);t&&t===De&&xt()}function xt(){Se&&(clearTimeout(Se),Se=null),De=null}function Jr(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 gn(){if(typeof document>"u"||En())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=wt(r);o&&_t(r)==="viewport"&&He(o)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=_t(t);if(n==="render"){let r=wt(t);r&&He(r)}else n==="viewport"&&e&&V.observe(t)}}function Ii(e){if(typeof document>"u"||!document.body)return!1;let t=ve(document.body),n,r=-1;for(let[c,l]of t)c.length>r&&(r=c.length,n=l);if(!n)return!1;let o=n.start.parentNode;if(!o||n.start.parentNode!==n.end.parentNode)return!1;let s=document.createElement("div");s.setAttribute("role","alert"),s.setAttribute("data-webjs-nav-error","");let i=e?`This page could not be loaded. (status ${e})`:"This page could not be loaded.";s.textContent=i;let a=document.createRange();return a.setStartAfter(n.start),a.setEndBefore(n.end),a.deleteContents(),o.insertBefore(s,n.end),!0}function mn(e,t,n){let r=new CustomEvent("webjs:navigation-error",{bubbles:!0,cancelable:!0,detail:{url:e,status:t??null,error:n||null}});if(typeof document<"u")try{document.dispatchEvent(r)}catch{}r.defaultPrevented||Ii(t)||typeof location<"u"&&(location.href=e)}async function St(e,t,n,r,o,s,i,a){o=o||"GET";let c=typeof a=="number"?a:k,l,f=null,m=null,u=!1,b=e,g=t?Zr(t,c):null;try{try{let d=o==="GET"&&!s&&!t?Gr(e):null;if(d)l=d.html,f=d.build,b=d.finalUrl,m=200,u=!0;else{let p={"x-webjs-router":"1"},w=zr();w&&(p["x-webjs-have"]=w),t&&(p["x-webjs-frame"]=t),s!=null&&o!=="GET"&&o!=="HEAD"&&(p.accept=xr+", text/html");let _={method:o,headers:p,credentials:"same-origin"};i&&(_.signal=i),s!=null&&o!=="GET"&&o!=="HEAD"&&(_.body=s);let y=await fetch(e,_);m=y.status,u=y.ok;let L=y.headers.get("content-type")||"",x=/^text\/html\b/i.test(L);if(L.toLowerCase().indexOf(xr)===0){let j=await y.text();return c===k&&(Fe(r),hn(j)),{ok:u,status:m,aborted:!1}}if(y.redirected&&y.url&&(b=y.url),y.status===204||y.status===205)return c===k&&n&&history.pushState(null,"",b),{ok:u,status:m,aborted:!1};if(!x)return c===k&&(Fe(r),mn(e,y.status,null)),{ok:!1,status:m,aborted:!1};f=y.headers.get("x-webjs-build"),l=await y.text()}}catch(d){return d&&d.name==="AbortError"?{ok:!1,status:null,aborted:!0}:c!==k?{ok:!1,status:null,aborted:!0}:(Fe(r),mn(e,null,d instanceof Error?d:new Error(String(d))),{ok:!1,status:null,aborted:!1})}if(c!==k)return{ok:!1,status:m,aborted:!0};let h=Rr(l);if(!h)return Fe(r),mn(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:m,aborted:!1};if(rs(h,t,!1,b,f),n&&history.pushState(null,"",b),n){let d=new URL(b);if(d.hash){let p=document.getElementById(d.hash.slice(1));p?p.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:b,frameId:t,from:"navigate"}})),{ok:u,status:m,aborted:!1}}finally{g&&Qr(g,c)}}function Zr(e,t){if(typeof document>"u")return null;let n=null;try{n=document.querySelector(`webjs-frame#${CSS.escape(e)}`)}catch{n=document.getElementById(e)}if(!n)return null;let r=At.has(n);return At.set(n,t),n.setAttribute("aria-busy","true"),r||n.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:e,busy:!0}})),n}function Qr(e,t){if(At.get(e)!==t)return;At.delete(e),e.setAttribute("aria-busy","false");let n=e.id||null;e.dispatchEvent(new CustomEvent("webjs:frame-busy",{bubbles:!0,detail:{frameId:n,busy:!1}}))}function Xr(e,t,n){let r=Ct.has(e);return Ct.set(e,t),e.setAttribute("aria-busy","true"),r||e.dispatchEvent(new CustomEvent("webjs:submit-start",{bubbles:!0,detail:{form:e,url:n}})),e}function es(e,t,n,r){if(Ct.get(e)!==t)return;Ct.delete(e),e.setAttribute("aria-busy","false");let o=new CustomEvent("webjs:submit-end",{bubbles:!0,detail:{form:e,url:n,ok:!!r}});e.isConnected?e.dispatchEvent(o):typeof document<"u"?document.dispatchEvent(o):e.dispatchEvent(o)}function Nr(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+=ae(r);return n}function ts(){if(typeof document>"u")return!1;let e=document.querySelector('meta[name="view-transition"]');return e?(e.getAttribute("content")||"").trim().toLowerCase()==="same-origin":!1}function gt(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(ts()&&typeof n=="function"){let r=n.call(document,e);r&&r.finished&&typeof r.finished.then=="function"?r.finished.then(()=>{t&&t()}).catch(()=>{}):t&&t();return}e(),t&&t()}function ns(e,t){if(!e||!t||typeof e.querySelectorAll!="function")return;let n=e.querySelectorAll("[data-webjs-permanent][id]");for(let r of n){let o=r.id;if(!o)continue;let s=null;try{s=t.querySelector(`#${CSS.escape(o)}`)}catch{s=null}if(!s||!r.hasAttribute||!r.hasAttribute("data-webjs-permanent"))continue;let i=s.parentNode;i&&s!==r&&i.replaceChild(r,s)}}function kn(e,t){let n=[];for(let r of e){if(r.nodeType!==1)continue;let o=r;if(o.hasAttribute&&o.hasAttribute("data-webjs-permanent")&&o.id&&n.push(o),typeof o.querySelectorAll=="function")for(let s of o.querySelectorAll("[data-webjs-permanent][id]"))n.push(s)}if(n.length)for(let r of n){let o=r.id;if(!o)continue;let s=Pi(t,o);if(!s||s===r)continue;let i=s.parentNode;if(i)i.replaceChild(r,s);else{let a=t.indexOf(s);a!==-1&&(t[a]=r)}}}function Pi(e,t){for(let n of e){if(n.nodeType!==1)continue;let r=n;if(r.id===t)return r;if(typeof r.querySelector=="function"){let o=null;try{o=r.querySelector(`#${CSS.escape(t)}`)}catch{o=null}if(o)return o}}return null}function $i(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&we(t)}function rs(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 b=Nr(document),g=Nr(e);b!==g&&(u=!0)}if(u&&typeof location<"u")try{let b="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(b))sessionStorage.removeItem(b);else{sessionStorage&&sessionStorage.setItem(b,"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),gt(()=>{Fi(f,m),Et(f),we(f),yt()},()=>we(f)),jr(e.body);return}let u=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(f||document).dispatchEvent(u),u.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let s=ve(document.body),i=ve(e.body),a=Dr(s,i);if(a){wn(e.head),gt(()=>{Bi(s.get(a),i.get(a),e),yt()},()=>$i(s.get(a))),jr(e.body);return}as(e.head),ns(document.body,e.body);let c=[...e.body.childNodes];gt(()=>{document.body.replaceChildren(...c),Et(document.body),we(document.body),yt()},()=>we(document.body))}function yt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function Bi(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));kn(o,s),qi(r,e.start,e.end,o,s);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(Et(i),we(i))}function qi(e,t,n,r,o){let s=new Map;for(let c of r){if(c.nodeType!==1)continue;let l=Ce(c);l&&s.set(l,c)}let i=n,a=[];for(let c of o){if(c.nodeType===1){let l=Ce(c);if(l&&s.has(l)){let f=s.get(l);vt(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 vt(e,t){if(e===t)return;if(e.tagName!==t.tagName){e.replaceWith(t);return}let n=new Set;for(let r of t.attributes)n.add(r.name),!yn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])yn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);xn(e,t)}function xn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0));kn(n,r);let o=new Map;for(let a of n){if(a.nodeType!==1)continue;let c=Ce(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=Ce(c);if(l&&o.has(l)){let m=o.get(l);vt(m,c),s.push(m),o.delete(l);continue}let f=n[a];if(f&&f.nodeType===1&&!Ce(f)&&f.tagName===c.tagName){vt(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 Ce(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function ss(){let e=ve(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:k}}function Fe(e){if(!e||e.token!==k)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 Fi(e,t){xn(e,t)}function os(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function Tn(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=os();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function is(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=os();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function ae(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(ae(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(ae(r))||(r.tagName==="SCRIPT"?document.head.appendChild(Tn(r)):document.head.appendChild(is(r))))}function as(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(ae(s));let o=new Set;for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&o.add(ae(s));for(let s of[...t.children])s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(o.has(ae(s))||s.remove());for(let s of e.children)s.tagName==="SCRIPT"&&s.getAttribute("type")==="importmap"||s.tagName!=="BASE"&&s.tagName!=="TITLE"&&(r.has(ae(s))||(s.tagName==="SCRIPT"?t.appendChild(Tn(s)):t.appendChild(is(s))))}function we(e){typeof customElements>"u"||cs(e)}function cs(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&&cs(n.shadowRoot))}function jr(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}function Et(e){for(let t of e.querySelectorAll("script"))t.replaceWith(Tn(t))}function Ui(e){return N.get(le(e))||null}function Di(){return ie.size}function Hi(){N.clear(),ie.clear(),_e.length=0,Ue.clear(),xt()}function zi(){return k}function Wi(){return++k}function Vi(){return q}function Ki(e){q=e}function Gi(e){return kt.test(e)}var xr,ce,O,k,pn,q,bt,kt,Ur,Tr,ki,R,Ni,Wr,Vr,ji,Ri,N,ie,_e,Ue,Se,De,V,At,Ct,yn,fn=We(()=>{un();mt();mt();xr="text/vnd.webjs-stream.html";ce=!1,O=null,k=0,pn=null;q=null,bt=null;kt=/\.(?: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;Ur="_top";Tr=new Set;ki=16,R=new Map;Ni=8,Wr=3e4,Vr=3,ji=24,Ri=100,N=new Map,ie=new Set,_e=[],Ue=new Set,Se=null,De=null,V=null;At=new WeakMap;Ct=new WeakMap;yn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);_n()});function ms(e,...t){return{_$webjs:"template",strings:e,values:t}}function v(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var A="w$";function bs(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 ke(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Rt(e,t){if(!(!t||!t.length))if("adoptedStyleSheets"in e&&typeof CSSStyleSheet<"u"){let n=t.map(r=>{let o=new CSSStyleSheet;return o.replaceSync(r.text),o});e.adoptedStyleSheets=n}else{let n=e,r=document.createElement("style");r.textContent=t.map(o=>o.text).join(`
2
+ `),n.appendChild(r)}}function Lt(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
+ `)}</style>`}function Ve(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var Mn=Symbol.for("webjs.repeat");function In(e,t,n){return{[Mn]:!0,items:[...e],keyFn:t,templateFn:n}}function K(e){return!!e&&typeof e=="object"&&e[Mn]===!0}function gs(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function ue(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function ys(e){return{_$webjs:"live",value:e}}function fe(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function ws(e,t){return{_$webjs:"keyed",key:e,value:t}}function G(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function _s(e,t){return{_$webjs:"guard",deps:e,fn:t}}function Y(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function Ss(e){return{_$webjs:"template-content",template:e}}function de(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function As(e){return{_$webjs:"ref",target:e}}function J(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function Cs(){return{value:void 0}}function vs(e){return{_$webjs:"cache",value:e}}function Z(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Es(...e){return{_$webjs:"until",args:e}}function Q(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function ks(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function he(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function xs(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function pe(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Ts(e){return{_$webjs:"watch",signal:e}}function X(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var I=null,U=!1,be=0,me=null,Ot=0,Pn=(e,t)=>Object.is(e,t),Ge=()=>{},$n=()=>!1;function Bn(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)Bn(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function xe(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)xe(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function qt(e){if(U)throw new Error("Signal read during notification phase");if(I===null)return;let t=I,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Pt(t)&&xe(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Pt(t)&&Bn(e,t)),t.producerLastReadVersions[n]=e.version}function Pt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function qn(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=U;U=!0;try{for(let n of e.liveConsumers)n.dirty||Ns(n)}finally{U=t}}function Ns(e){e.dirty=!0,qn(e),e.consumerMarkedDirty.call(e.wrapper||e)}function Ye(e){if(!(!e.dirty&&e.lastCleanEpoch===be)){if(!e.producerMustRecompute()&&!js(e)){e.dirty=!1,e.lastCleanEpoch=be;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=be}}function js(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(Ye(n),r!==n.version))return!0}return!1}function $t(e){e&&(e.nextProducerIndex=0);let t=I;return I=e,t}function Bt(e,t){if(I=t,!!e){if(Pt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)xe(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var Je=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=be,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=$n,this.producerRecomputeValue=Ge,this.consumerMarkedDirty=Ge,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||Pn,this.watched=n?.[Ft],this.unwatched=n?.[Ut]}get(){return qt(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++,be++,me!==null?Fn(this):qn(this))}};function Fn(e){let t=U;U=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?me.add(n):Fn(n))}finally{U=t}}var Mt=Symbol("unset"),It=Symbol("computing"),Ke=Symbol("errored"),Te=class{constructor(t,n){this.__fn=t,this.__value=Mt,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||Pn,this.watched=n?.[Ft],this.unwatched=n?.[Ut];let r=this;this.producerMustRecompute=function(){return r.__value===Mt||r.__value===It},this.producerRecomputeValue=function(){if(r.__value===It)throw new Error("Detected cycle in computations.");let o=r.__value;r.__value=It;let s=$t(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=Ke,r.__error=l,a=!0}finally{Bt(r,s)}if(!a&&(o!==Mt&&o!==Ke)&&r.__equal.call(r.wrapper,o,i)){r.__value=o;return}r.__value=i,r.version++},this.consumerMarkedDirty=Ge}get(){if(Ye(this),qt(this),this.__value===Ke)throw this.__error;return this.__value}peek(){if(Ye(this),this.__value===Ke)throw this.__error;return this.__value}},Ze=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=be,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=$n,this.producerRecomputeValue=Ge,this.wrapper=this,this.__isWatcher=!0;let n=this;this.consumerMarkedDirty=function(){n.__fire()}}__fire(){this.__notify&&this.__notify.call(this)}watch(...t){if(t.length===0){this.dirty=!1;return}let n=$t(this);try{for(let r of t)qt(r),r.__isComputed&&Ye(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])&&(xe(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=$t(this),r;try{r=t()}finally{Bt(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)xe(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},Ft=Symbol("watched"),Ut=Symbol("unwatched");function Rs(e){let t=I;I=null;try{return e()}finally{I=t}}function Ls(e){return e.producers.slice()}function Os(e){return e.liveConsumers?[...e.liveConsumers]:[]}function Ms(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function Is(e){return e.producers.length>0}function Ps(){return I&&I.__isComputed?I:null}function $s(e){Ot++,me===null&&(me=new Set);try{e()}finally{if(Ot--,Ot===0){let t=me;me=null;for(let n of t)n.__fire()}}}var Ne={State:Je,Computed:Te,subtle:{Watcher:Ze,untrack:Rs,introspectSources:Ls,introspectSinks:Os,hasSinks:Ms,hasSources:Is,currentComputed:Ps,watched:Ft,unwatched:Ut}};function Bs(e,t){return new Je(e,t)}function qs(e,t){return new Te(e,t)}function Fs(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function Us(e){let t=!1,n=!1,r=new Te(e),o=new Ze(()=>{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 Ds=`${A}s`,Hs=`${A}e`;function Un(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Ds||t===Hs}function zs(e){for(let t of e.addedNodes)if(Un(t))return!0;for(let t of e.removedNodes)if(Un(t))return!0;return!1}function Vn(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var Re=Vn(),ee=Symbol("webjs.slot.state"),D="data-webjs-light",te="data-projection",Le="actual",Kn="fallback",tt=Symbol("webjs.slot.fallbackFrag"),Ws=64,je=null,Dt=null,Qe=null,Dn=!1;function Vs(){Dn||(Re=Vn(),Re&&(je=HTMLSlotElement.prototype.assignedNodes,Dt=HTMLSlotElement.prototype.assignedElements,Qe=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(D)&&!Hn(this)?Ht(this,t):je?je.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(D)&&!Hn(this)?Ht(this,t).filter(n=>n.nodeType===1):Dt?Dt.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=Qe&&Qe.get?Qe.get.call(this):null;return t||Ks(this)}}),Dn=!0))}Vs();function Hn(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 Ht(e,t){if(e.getAttribute(te)===Kn)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:zt(n,new Set,0)}function zt(e,t,n){if(n>=Ws)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(D)){let i=Ht(s,{flatten:!1});if(i.length>0)for(let a of zt(i,t,n+1))r.push(a);else for(let a of zt(Array.from(s.childNodes),t,n+1))r.push(a)}else if(je){let i=je.call(s,{flatten:!0});for(let a of i)r.push(a)}else r.push(o)}else r.push(o);return r}function Ks(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(D))return t.getAttribute(te)===Le?t:null;t=t.parentElement}return null}function H(e){let t=e,n=t[ee];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[ee]=n),n}function Wt(e){return!!e[ee]}function Gn(e){let t=H(e);for(;e.firstChild;){let n=e.firstChild,r=Xe(n);et(t.assignedByName,r,n),e.removeChild(n)}}function Yn(e){let t=H(e),n=e.querySelectorAll(`slot[${D}]`);for(let r of n){let o=r;if(o.getAttribute(te)!==Le)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 Xe(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function et(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function Jn(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 Zn(e){if(!Re)return;let t=H(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let o of n)if(!zs(o)){if(o.type==="childList"){for(let s of o.addedNodes)s.parentElement===e&&(et(t.assignedByName,Xe(s),s),r=!0);for(let s of o.removedNodes)e.contains(s)||zn(t,s)&&(r=!0)}else if(o.type==="attributes"&&o.attributeName==="slot"){let s=o.target;(zn(t,s)||s.parentElement===e)&&(et(t.assignedByName,Xe(s),s),r=!0)}}r&&nt(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function Qn(e){let t=e[ee];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 zn(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 nt(e){let t=H(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,Gs(e)}))}function Gs(e){if(!Re)return;let t=e[ee];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${D}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||Ys(t,i);for(let i of r)t.ownedSlots.has(i)||Qs(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?Js(t,f,c)&&s.push(f):Zs(t,f)&&s.push(f)}}for(let i of s)Xs(i)}function Ys(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;Jn(e.pendingByName,o,r)}e.lastSnapshot.delete(t)}function Js(e,t,n){let r=t.getAttribute(te)!==Le,o=e.lastSnapshot.get(t)||[];if(!r&&eo(o,n))return!1;let i=t[tt];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(te,Le),e.lastSnapshot.set(t,n.slice()),!0}function Zs(e,t){let n=t.getAttribute(te)===Le;if(t.setAttribute(te,Kn),!n)return Wn(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return Wn(t),!0}function Wn(e){let t=e[tt];!t||t.childNodes.length===0||e.appendChild(t)}function Qs(e,t){if(!Re)return;let n=H(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>nt(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function Xn(e,t){if(!Wt(e))return;let n=H(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);Jn(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 Xs(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function eo(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 er=new WeakMap,Vt=Symbol.for("webjs.instance");function st(e,t){let n=t,r=n[Vt];if(v(e)){let o=e;if(r&&r.strings===o.strings){ge(r,o.values);return}r&&tr(r,t);let s=t.firstChild;s&&s.nodeType===8&&s.data==="webjs-hydrate"&&s.remove();let i=ro(o,t);n[Vt]=i;return}if(r&&tr(r,t),n[Vt]=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 ot(e){let{strings:t}=e,n=er.get(t);if(n)return n;let r=[],o="",s="text",i="",a=0,c="",l=0,f=null,m="",u="";for(let g=0;g<t.length;g++){let h=t[g];for(let d=0;d<h.length;d++){let p=h[d];switch(s){case"text":o+=p,p==="<"&&(s="tag-open");break;case"tag-open":o+=p,p==="!"?s="bang-1":p==="/"?(s="tag-name",m=""):/[a-zA-Z]/.test(p)?(s="tag-name",m=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=m==="script"||m==="style"?"rawtext":"text",s==="rawtext"&&(u="")):/\s/.test(p)?s="in-tag":m+=p.toLowerCase();break;case"in-tag":o+=p,p===">"?(s=m==="script"||m==="style"?"rawtext":"text",s==="rawtext"&&(u="")):!/\s/.test(p)&&p!=="/"&&(s="attr-name",i=p,a=o.length-1);break;case"rawtext":o+=p,u=(u+p.toLowerCase()).slice(-9),(u.endsWith("<\/script>")||u.endsWith("</style>"))&&(s="text",u="",m="");break;case"attr-name":p==="="?(s="after-eq",o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(i+=p,o+=p);break;case"after-eq":p==='"'||p==="'"?(s="attr-quoted",c=p,o+=p):/\s/.test(p)?(s="in-tag",i="",o+=p):p===">"?(s="text",i="",o+=p):(s="attr-unquoted",o+=p);break;case"attr-unquoted":/\s/.test(p)?(s="in-tag",i="",o+=p):(p===">"&&(s="text",i=""),o+=p);break;case"attr-quoted":o+=p,p===c&&(s="in-tag",i="");break;case"skip-attr":if(p===c){if(f){let w=f.firstPartIdx,_=[];for(let S=w;S<r.length;S++)(r[S].kind==="noop"||r[S].kind==="attr-mixed")&&_.push(S);let y=[],L=t[_[0]],x=L.lastIndexOf(c);y.push(x>=0?L.slice(x+1):L);for(let S=1;S<_.length;S++)y.push(t[_[S]]);let M=t[_[_.length-1]+1],j=M.indexOf(c);y.push(j>=0?M.slice(0,j):M),r[w]={kind:"attr-mixed",path:[],name:f.name,statics:y,group:_},f=null}s="in-tag",i=""}break}}if(g<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+=`<!--${A}${d}-->`,r.push({kind:"child",path:[]});else if(s==="in-tag"){let p=`data-${A}${d}`;o+=`${p}=""`,r.push({kind:"element",path:[]})}else if(s==="after-eq"){let p=i[0],w=i.slice(1);if(p==="@"||p==="."||p==="?"){o=o.slice(0,a);let _=p==="@"?"event":p==="."?"prop":"bool",y=`data-${A}${d}`;o+=`${y}=""`,r.push({kind:_,path:[],name:w})}else{o=o.slice(0,a);let _=`data-${A}${d}`;o+=`${_}=""`,r.push({kind:"attr",path:[],name:i})}s="in-tag",i=""}else if(s==="attr-quoted"||s==="attr-unquoted"){o=o.slice(0,a);let p=`data-${A}${d}`;o+=`${p}=""`,f={name:i,firstPartIdx:d},r.push({kind:"noop",path:[]}),s="skip-attr"}else s==="skip-attr"&&r.push({kind:"noop",path:[]})}}let b=document.createElement("template");return b.innerHTML=o,to(b.content,r),no(b.content,r),n={templateEl:b,parts:r},er.set(t,n),n}function to(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(D,"");let o=t.length;r.setAttribute(`data-${A}${o}`,""),t.push({kind:"slot",path:[]})}}function no(e,t){let n=[];function r(o){for(let s=0;s<o.childNodes.length;s++){let i=o.childNodes[s];if(n.push(s),i.nodeType===8){let a=i.data;if(a.startsWith(A)){let c=Number(a.slice(A.length));t[c]&&t[c].kind==="child"&&(t[c].path=n.slice())}}else if(i.nodeType===1){let a=i,c=[];for(let l of a.attributes)if(l.name.startsWith(`data-${A}`)){let f=Number(l.name.slice(`data-${A}`.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 ro(e,t){let{templateEl:n,parts:r}=ot(e),o=n.content.cloneNode(!0),s=document.createComment(`${A}s`),i=document.createComment(`${A}e`),a=r.map(l=>it(l,o)),c=[];for(let l=0;l<e.values.length;l++)ne(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"&&ne(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:s,endNode:i}}function it(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 ge(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(ne(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function tr(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&&Xn(r,n.slotEl)}}t.replaceChildren()}function ne(e,t,n,r){if(fe(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":io(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":oo(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||so(o))return;let c=document.createDocumentFragment();for(;o.firstChild;)c.appendChild(o.firstChild);o[tt]=c,nt(a)};Kt(o)?s():queueMicrotask(s);break}case"noop":break}}function Kt(e){let t=e.parentElement;for(;t;){if(t[ee])return t;t=t.parentElement}return null}function so(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 oo(e,t){let n=e,r=J(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 io(e,t){return bo(e,t),$(e,t)}function $(e,t){let n=e.marker;if(ue(t)){z(e);let o=String(t.value??""),s=document.createElement("template");s.innerHTML=o;let i=[...s.content.childNodes],a=document.createDocumentFragment();for(let c of i)a.appendChild(c);n.parentNode?.insertBefore(a,n),e.child=i;return}if(G(t)){let o=t,s=e.__keyedKey;s!==void 0&&!Object.is(s,o.key)&&z(e),e.__keyedKey=o.key,$(e,o.value);return}if(Y(t)){let o=t,s=e.__guardDeps,i=o.deps;if(s!==void 0&&(Array.isArray(s)&&Array.isArray(i)?mo(s,i):Object.is(s,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,$(e,o.fn());return}if(de(t)){z(e);let o=t.template;if(o&&o.content){let s=o.content.cloneNode(!0),i=[...s.childNodes];n.parentNode?.insertBefore(s,n),e.child=i}return}if(J(t))return;if(Z(t))return go(e,t.value);if(Q(t))return yo(e,t.args);if(X(t))return wo(e,t.signal);if(he(t))return _o(e,t);if(pe(t))return So(e,t);if(K(t)){if(e.child&&e.child.kind==="repeat"){lo(e,t);return}z(e);let o={kind:"repeat",map:new Map};e.child=o,co(n,o,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){ho(e,t);return}z(e);let o={kind:"array",items:[]};e.child=o,fo(n,o,t);return}if(e.child){let o=e.child;if(o.kind==="repeat")nr(o),e.child=void 0;else if(o.kind==="array")sr(o),e.child=void 0;else if(o.kind==="async-stream")cr(o),e.child=void 0;else if("strings"in e.child){let s=e.child;if(v(t)&&s.strings===t.strings){ge(s,t.values);return}ye(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(v(t)){let o=t,{templateEl:s,parts:i}=ot(o),a=s.content.cloneNode(!0),c=document.createComment(`${A}s`),l=document.createComment(`${A}e`),f=i.map(b=>it(b,a)),m=[];for(let b=0;b<o.values.length;b++)ne(f[b],o.values[b],void 0,o.values),m.push(o.values[b]);let u=[c,...a.childNodes,l];n.parentNode?.insertBefore(ao(u),n);for(let b of f)b.kind==="slot"&&ne(b,void 0,void 0,[]);e.child={strings:o.strings,bound:f,lastValues:m,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function ao(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function ye(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 Yt(e){let{templateEl:t,parts:n}=ot(e),r=t.content.cloneNode(!0),o=document.createComment(`${A}s`),s=document.createComment(`${A}e`),i=n.map(l=>it(l,r)),a=[];for(let l=0;l<e.values.length;l++)ne(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 Oe(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 co(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(!v(f))continue;let{inst:m,frag:u}=Yt(f);t.map.set(l,m),a.appendChild(u)}i.insertBefore(a,e)}function lo(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(!v(m))continue;let u=o.map.get(f);if(u&&u.strings===m.strings)ge(u,m.values),Gt(u.startNode,u.endNode,r,n),c.set(f,u),o.map.delete(f);else{u&&(Oe(u),ye(u.startNode,u.endNode),o.map.delete(f));let{inst:b,frag:g}=Yt(m);r.insertBefore(g,n),c.set(f,b)}}for(let l of o.map.values())Oe(l),ye(l.startNode,l.endNode);o.map=c}function nr(e){for(let t of e.map.values())Oe(t),ye(t.startNode,t.endNode);e.map.clear()}function uo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function rt(e){e.type==="tpl"?(Oe(e.inst),ye(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function rr(e){if(v(e)){let{inst:t,frag:n}=Yt(e);return{item:{type:"tpl",inst:t},frag:n}}if(e!=null&&e!==!1&&e!==!0){let t=document.createTextNode(String(e));return{item:{type:"text",node:t},frag:t}}return{item:{type:"empty"},frag:null}}function fo(e,t,n){let r=e.parentNode;if(!r)return;let o=document.createDocumentFragment(),s=[];for(let i of n){let{item:a,frag:c}=rr(i);c&&o.appendChild(c),s.push(a)}r.insertBefore(o,e),t.items=s}function ho(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let o=e.child,s=o.items,i=[];for(let a=0;a<t.length;a++){let c=t[a],l=s[a];if(v(c)){let u=c;if(l&&l.type==="tpl"&&l.inst.strings===u.strings){ge(l.inst,u.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let u=String(c);l.node.data!==u&&(l.node.data=u),i.push(l);continue}}else{l&&rt(l),i.push({type:"empty"});continue}let{item:f,frag:m}=rr(c);m&&r.insertBefore(m,po(s,a,n)),l&&rt(l),i.push(f)}for(let a=t.length;a<s.length;a++)rt(s[a]);o.items=i}function po(e,t,n){for(let r=t;r<e.length;r++){let o=uo(e[r]);if(o&&o.parentNode)return o}return n}function sr(e){for(let t of e.items)rt(t);e.items=[]}function Gt(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 mo(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function z(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&or(t),!e.child)return;let n=e.child;if(n.kind==="repeat")nr(n);else if(n.kind==="array")sr(n);else if(n.kind==="async-stream")cr(n);else if("strings"in n){let r=e.child;Oe(r),ye(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function bo(e,t){let n=e;n.__untilState&&!Q(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!Y(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!Z(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!G(t)&&(n.__keyedKey=void 0),n.__watchSub&&!X(t)&&or(n)}function go(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(v(t)&&a.strings===t.strings){ge(a,t.values);return}let c=document.createDocumentFragment();Gt(a.startNode,a.endNode,c,null),o.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(v(t)){let a=t,c=o.get(a.strings);if(c){o.delete(a.strings),e.child&&z(e),Gt(c.inst.startNode,c.inst.endNode,n.parentNode,n),ge(c.inst,a.values),e.child=c.inst;return}}$(e,t)}function yo(e,t){let n=e,r=n.__untilState,o=n.__untilArgs,s=(u,b)=>!!(Object.is(u,b)||v(u)&&v(b)&&u.strings===b.strings),a=o&&o.length===t.length&&o.every((u,b)=>s(u,t[b]))&&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 b=t[u];if(!b||typeof b.then!="function"){l=u,f=b;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 b=t[u];!b||typeof b.then!="function"||Promise.resolve(b).then(g=>{c.aborted||u>=c.highestResolved||(c.highestResolved=u,$(e,g))},()=>{})}}function wo(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 Ne.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 or(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function _o(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,ir(o,e,t)}function So(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;z(e);let r=t.iterable[Symbol.asyncIterator](),o={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=o,ir(o,e,t)}async function ir(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=ar(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 ar(e){if(e==null||e===!1||e===!0)return[];if(v(e)){let t=e,{templateEl:n,parts:r}=ot(t),o=n.content.cloneNode(!0),s=r.map(i=>it(i,o));for(let i=0;i<t.values.length;i++)ne(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(...ar(n));return t}return[document.createTextNode(String(e))]}function cr(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 lr=Symbol.for("webjs:registry"),ur=Symbol.for("webjs:classToTag"),at=globalThis,B=at[lr]||(at[lr]=new Map),fr=at[ur]||(at[ur]=new WeakMap),ct=typeof window<"u"&&typeof customElements<"u";function Jt(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=B.get(e);r?(r.cls=t,r.lazy=n):B.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),fr.set(t,e)}if(ct){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),Jt(t,n)}}if(!ct){let e=globalThis;e.customElements||(e.customElements={define(t,n){Jt(t,n)},get(t){return B.get(t)?.cls},upgrade(){},whenDefined(t){let n=B.get(t);return Promise.resolve(n?.cls)}})}function Zt(e,t){ct?customElements.define(e,t):Jt(e,t)}function Ao(e,t){if(ct)return;let n=B.get(e);if(n){n.moduleUrl=t;return}B.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function Qt(e){return B.get(e)?.cls}function Co(e){return B.get(e)?.moduleUrl||null}function vo(e){return B.get(e)?.lazy===!0}function lt(e){return fr.get(e)}function Xt(){return[...B.keys()]}var C="_$wj";async function Pe(e){return JSON.stringify(await dr(e))}function se(e){return hr(JSON.parse(e))}async function dr(e){let t=Eo();return await ko(e,t),re(e,t)}function hr(e){return W(e,jo())}function Eo(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map}}async function ko(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!Lo(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(Oo(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 re(e,t){if(e===null)return null;if(e===void 0)return{[C]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[C]:"NaN"}:e===1/0?{[C]:"Inf"}:e===-1/0?{[C]:"-Inf"}:Object.is(e,-0)?{[C]:"-0"}:e;if(n==="bigint")return{[C]:"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{[C]:"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{[C]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let o;if(e instanceof Date)o={[C]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)o={[C]:"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={[C]:"File",v:Ie(s),n:e.name,t:e.type||"",m:e.lastModified}:o={[C]:"Blob",v:Ie(s),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let s=[];for(let[i,a]of e.entries())s.push([i,re(a,t)]);o={[C]:"FD",v:s}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)o=xo(e);else if(e instanceof Map){let s=[];for(let[i,a]of e)s.push([re(i,t),re(a,t)]);o={[C]:"Map",v:s}}else if(e instanceof Set){let s=[];for(let i of e)s.push(re(i,t));o={[C]:"Set",v:s}}else if(Array.isArray(e))o=e.map(s=>re(s,t));else{o={};for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let i=Mo(s)?"_"+s:s;o[i]=re(e[s],t)}}if(r!==void 0){if(Array.isArray(o))return{[C]:"Arr",_id:r,v:o};o._id=r}return o}function xo(e){if(e instanceof ArrayBuffer)return{[C]:"buf",v:Ie(new Uint8Array(e))};if(e instanceof DataView)return{[C]:"dv",v:Ie(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=To[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[C]:n,v:Ie(r)}}var To={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},No={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 jo(){return{refs:new Map}}function W(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(W(e[i],t));return s}let n=e[C];if(typeof n=="string")return Ro(e,n,t);let r={},o=e._id;typeof o=="number"&&t.refs.set(o,r);for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s)||s==="_id")continue;let i=Io(s)?s.slice(1):s;r[i]=W(e[s],t)}return r}function Ro(e,t,n){let r=e._id,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(W(i,n),W(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(W(i,n));return s}case"Arr":{let s=[];typeof r=="number"&&n.refs.set(r,s);for(let i of e.v)s.push(W(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=Me(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=Me(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=W(a,n);s.append(i,c)}return s}default:{if(t==="buf"){let i=Me(e.v);return o(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=Me(e.v);return o(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let s=No[t];if(s){let i=Me(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 Lo(e){return e!==null&&typeof e=="object"}function Oo(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Mo(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function Io(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}var pr=typeof Buffer<"u"&&typeof Buffer.from=="function";function Ie(e){if(pr)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 Me(e){if(pr){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 gr=typeof window<"u"&&typeof HTMLElement<"u";function Po(e,t){return e!==t}function $o(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var ut=class{constructor(){this.__ssrAttrs=new Map,this.__internals=null}get attributes(){return[...this.__ssrAttrs].map(([t,n])=>({name:t,value:n}))}getAttribute(t){let n=this.__ssrAttrs.get(String(t).toLowerCase());return n===void 0?null:n}setAttribute(t,n){this.__ssrAttrs.set(String(t).toLowerCase(),String(n))}removeAttribute(t){this.__ssrAttrs.delete(String(t).toLowerCase())}hasAttribute(t){return this.__ssrAttrs.has(String(t).toLowerCase())}toggleAttribute(t,n){let r=String(t).toLowerCase(),o=this.__ssrAttrs.has(r);return(n===void 0?!o:n)?(this.__ssrAttrs.set(r,""),!0):(this.__ssrAttrs.delete(r),!1)}getAttributeNames(){return[...this.__ssrAttrs.keys()]}closest(t){let n=String(t).trim().toLowerCase();if(!/^[a-z][a-z0-9-]*$/.test(n))return null;if(this.__ssrTag===n)return this;let r=this.__ssrAncestors;if(!Array.isArray(r))return null;for(let o=r.length-1;o>=0;o--)if(r[o]&&r[o].__ssrTag===n)return r[o];return null}get dataset(){if(this.__dataset)return this.__dataset;let t=this,n=r=>"data-"+String(r).replace(/[A-Z]/g,o=>"-"+o.toLowerCase());return this.__dataset=new Proxy({},{get(r,o){if(typeof o!="string")return;let s=t.getAttribute(n(o));return s===null?void 0:s},set(r,o,s){return typeof o=="string"&&t.setAttribute(n(o),s),!0},has(r,o){return typeof o=="string"&&t.hasAttribute(n(o))},deleteProperty(r,o){return typeof o=="string"&&t.removeAttribute(n(o)),!0},ownKeys(){return t.getAttributeNames().filter(r=>r.startsWith("data-")).map(r=>r.slice(5).replace(/-([a-z])/g,(o,s)=>s.toUpperCase()))},getOwnPropertyDescriptor(r,o){if(typeof o=="string"&&t.hasAttribute(n(o)))return{enumerable:!0,configurable:!0,value:t.getAttribute(n(o))}}}),this.__dataset}get className(){return this.getAttribute("class")??""}set className(t){this.setAttribute("class",t)}get hidden(){return this.hasAttribute("hidden")}set hidden(t){this.toggleAttribute("hidden",!!t)}get id(){return this.getAttribute("id")??""}set id(t){this.setAttribute("id",t)}get title(){return this.getAttribute("title")??""}set title(t){this.setAttribute("title",t)}get slot(){return this.getAttribute("slot")??""}set slot(t){this.setAttribute("slot",t)}get role(){return this.getAttribute("role")}set role(t){t==null?this.removeAttribute("role"):this.setAttribute("role",t)}get tabIndex(){let t=this.getAttribute("tabindex");return t===null?-1:Number.parseInt(t,10)||0}set tabIndex(t){this.setAttribute("tabindex",String(t))}addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return this.__internals=$o(),this.__internals}},Bo=["ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText"];for(let e of Bo){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(ut.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var qo=gr?HTMLElement:ut,en=class extends qo{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){Zt(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(mr)}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||Po)(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=mr(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(!gr)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=br(r.slice(16));try{this[s]=se(o)}catch(i){console.warn(`[webjs] failed to decode ${r} on <${this.tagName.toLowerCase()}>: ${i&&i.message}`)}}}_activate(){this._connected=!0,this._reflectDeclaredAttributes();let t=this.constructor;if(t.shadow===!0){let n=!!this.shadowRoot;this.shadowRoot||this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot;let r=t.styles,o=Array.isArray(r)?r:ke(r)?[r]:[];if(o.length){if(n){let s=this.shadowRoot.querySelector("style");s&&s.remove()}Rt(this._renderRoot,o)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${lt(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().`),Wt(this)||(this.__isHydrating()?(H(this),Yn(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&&Zn(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&&Qn(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=br(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 <${lt(this.constructor)||this.tagName?.toLowerCase()}>:`,r);try{let o=this.renderError(r);o!==void 0&&st(o,this._renderRoot)}catch(o){console.error("[webjs] renderError() also threw:",o)}}for(let r of this.__controllers)r.hostUpdated&&r.hostUpdated();n=!0}}catch(r){console.error("[webjs] lifecycle hook threw during update phase:",r)}finally{this._isUpdating=!1,n&&(this._changedProperties=new Map)}if(n)try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(r){console.error("[webjs] lifecycle hook threw during post-commit phase:",r)}finally{this._resolveUpdate()}else this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new Ne.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;this.__signalWatcher.observe(()=>{n=this.render()}),st(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 mr(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function br(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var Na=Symbol.for("webjs.suspense");function Fo(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function ft(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}var tn=null;function Uo(e){tn=e}function nn(){if(!tn)return"";try{return tn()||""}catch{return""}}async function Do(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=await E(e,n);return t&&t.ssr===!1?r:await $e(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(ue(e))return String(e.value??"");if(fe(e))return E(e.value,t);if(X(e))return E(e.signal.get(),t);if(G(e))return E(e.value,t);if(Y(e))return E(e.fn(),t);if(de(e)){let n=e.template;return String(n?.innerHTML??"")}if(J(e))return"";if(Z(e))return E(e.value,t);if(Q(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(he(e)||pe(e))return"";if(Array.isArray(e))return(await Promise.all(e.map(r=>E(r,t)))).join("");if(K(e)){let n=e;return(await Promise.all(n.items.map((o,s)=>E(n.templateFn(o,s),t)))).join("")}if(ft(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 v(e)?Ho(e,t):Ve(String(e))}async function Ho(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 b=n[u];for(let g=0;g<b.length;g++){let h=b[g];switch(s){case"text":o+=h,h==="<"&&(s="tag-open");break;case"tag-open":o+=h,h==="!"?s="bang-1":h==="/"?(s="tag-name",f=""):/[a-zA-Z]/.test(h)?(s="tag-name",f=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=ht(f)?"rawtext":"text",s==="rawtext"&&(m="")):/\s/.test(h)?s="in-tag":f+=h.toLowerCase();break;case"in-tag":o+=h,h===">"?(s=ht(f)?"rawtext":"text",s==="rawtext"&&(m="")):!/\s/.test(h)&&h!=="/"&&(s="attr-name",i=h,a=o.length-1);break;case"rawtext":o+=h,m=(m+h.toLowerCase()).slice(-9),(m.endsWith("<\/script>")||m.endsWith("</style>"))&&(s="text",m="",f="");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}}if(u<r.length){let g=r[u];if(g&&typeof g.then=="function"&&(g=await g),s==="comment")o+=String(g??""),l=0;else if(s==="rawtext")o+=String(g??""),m="";else if(s==="text")o+=await E(g,t);else if(s==="after-eq"){let h=i[0],d=i.slice(1);if(h==="@")o=o.slice(0,a),s="in-tag",i="";else if(h==="."){if(o=o.slice(0,a),!f.includes("-")){s="in-tag",i="";continue}if(g===void 0){s="in-tag",i="";continue}try{let p=await Pe(g);o+=`data-webjs-prop-${ti(d)}="${P(p)}"`}catch(p){console.warn(`[webjs] property binding .${d} has an unserializable value during SSR. Dropping. The browser will see the property as undefined. Detail: ${p&&p.message}`)}s="in-tag",i=""}else h==="?"?(o=o.slice(0,a),g&&(o+=`${d}=""`),s="in-tag",i=""):(o+=`"${P(String(g??""))}"`,s="in-tag",i="")}else(s==="attr-quoted"||s==="attr-unquoted")&&(o+=P(String(g??"")))}}return o}var zo=new Set(["document","window","localStorage","sessionStorage","navigator","matchMedia","requestAnimationFrame","getComputedStyle","IntersectionObserver","MutationObserver","ResizeObserver"]),Wo=new Set(["attachShadow","querySelector","querySelectorAll","getBoundingClientRect","focus","blur","scrollIntoView"]);function Vo(e){let t=e&&typeof e.message=="string"?e.message:"",n=/^(\w+) is not defined$/.exec(t);return e instanceof ReferenceError&&n&&zo.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&&Wo.has(n[1])?`\`${n[1]}\` is an HTMLElement method that does not exist on the server-side component instance during SSR.`:null)}async function $e(e,t,n=[]){let r=Xt();if(!r.length)return e;let o=[...r].sort((f,m)=>m.length-f.length),s=new RegExp(`<(${o.map(dt).join("|")})(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^>])*?)(/?)>`,"g"),i=[];for(let f of e.matchAll(s)){let[m,u,b,g]=f,h=Qt(u);if(!h)continue;t&&t.usedComponents&&t.usedComponents.add(u);let d=g?`<${u}${b}>`:m;try{let p=h.shadow===!0,w=new h;w.__ssrTag=u,w.__ssrAncestors=n;let _=wr(b),y=ni(_),L=new Set(Object.keys(wr(b)).map(j=>j.toLowerCase()));Qo(w,_),ei(w,_,h);for(let[j,S]of Object.entries(y))w[j]=S;typeof w.performServerUpdate=="function"&&w.performServerUpdate();let x=w.render?w.render():"";x&&typeof x.then=="function"&&(x=await x),d=Xo(d,w,L);let M=await E(x,t);if(p){let j=await $e(M,t,[...n,w]),S=h.styles,Ee=Array.isArray(S)?S:S&&ke(S)?[S]:[],Nt=Lt(Ee);i.push({start:f.index,end:f.index+m.length,text:`${d}<template shadowrootmode="open">${Nt}${j}</template>`})}else{if(M.trim()===""){i.push({start:f.index,end:f.index+m.length,text:`${d}<!--webjs-hydrate-->`});continue}let S="",Ee=f.index+m.length;if(!g){let jt=f.index+m.length,ze=sn(e,jt,u);if(ze!==-1){S=e.slice(jt,ze);let fs=new RegExp(`</${dt(u)}\\s*>`,"i"),ds=e.slice(ze),Ln=fs.exec(ds),hs=Ln?Ln[0].length:`</${u}>`.length;Ee=ze+hs}else S=e.slice(jt),Ee=e.length}let Nt=Jo(S),ls=Zo(M,Nt),us=await $e(ls,t,[...n,w]);i.push({start:f.index,end:Ee,text:`${d}<!--webjs-hydrate-->${us}</${u}>`})}}catch(p){let w=Vo(p);console.error(w?`[webjs] SSR failed for <${u}>: ${w} 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 <${u}>:`,p)}}if(!i.length)return e;i.sort((f,m)=>f.start-m.start);let a=[],c=-1;for(let f of i)f.start>=c&&(a.push(f),c=f.end);let l=e;for(let f=a.length-1;f>=0;f--){let{start:m,end:u,text:b}=a[f];l=l.slice(0,m)+b+l.slice(u)}return l}var Ko=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Go(e){return Ko.has(e.toLowerCase())}function sn(e,t,n){let r=dt(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 Yo(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 Jo(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||Go(m),b=Yo(l),g;if(u)g=o+a.length;else{let d=o+a.length,p=sn(e,d,m);if(p===-1){let x=e.slice(o);b!==null?yr(t,b,x):n+=x,r=e.length;continue}let w=new RegExp(`</${dt(m)}\\s*>`,"i"),_=e.slice(p),y=w.exec(_),L=y?y[0].length:`</${m}>`.length;g=p+L}let h=e.slice(o,g);b!==null?yr(t,b,h):n+=h,r=g}return n.length>0&&t.set(null,n),t}function yr(e,t,n){let r=e.get(t);r!==void 0?e.set(t,r+n):e.set(t,n)}function Zo(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,b=c.replace(/\bname\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,"").trim(),g="",h;if(f)h=i.index+a.length;else{let _=i.index+a.length,y=sn(e,_,"slot");if(y===-1)g=e.slice(_),h=e.length;else{g=e.slice(_,y);let L=/<\/slot\s*>/i,x=e.slice(y),M=L.exec(x),j=M?M[0].length:7;h=y+j}}let d=t.get(u),p=u!==null?` name="${P(u)}"`:"",w=b?` ${b}`:"";d!==void 0&&!n.has(u)?(n.add(u),r+=`<slot data-webjs-light data-projection="actual"${p}${w}>${d}</slot>`):r+=`<slot data-webjs-light data-projection="fallback"${p}${w}>${g}</slot>`,o=h,s.lastIndex=h}return r+=e.slice(o),r}function dt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ht(e){return e==="script"||e==="style"}function wr(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 Qo(e,t){if(!(!e||typeof e.setAttribute!="function"))for(let[n,r]of Object.entries(t))e.setAttribute(n,on(r))}function Xo(e,t,n){if(!t||typeof t.getAttributeNames!="function")return e;let r="";for(let o of t.getAttributeNames()){let s=String(o).toLowerCase();if(n.has(s))continue;let i=t.getAttribute(o);r+=i===""?` ${s}`:` ${s}="${P(String(i))}"`}return r?`${e.slice(0,-1)}${r}>`:e}function ei(e,t,n){let r=n.properties||{};for(let[o,s]of Object.entries(t)){let i=r[o]||r[rn(o)],a=r[o]?o:rn(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(on(s))}catch{e[a]=s}else e[a]=s}}function rn(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ti(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function on(e){return e.replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function ni(e){let t={};for(let n of Object.keys(e)){if(!n.startsWith("data-webjs-prop-"))continue;let r=rn(n.slice(16));try{t[r]=se(on(e[n]))}catch{}delete e[n]}return t}function ri(e,t={ssr:!0}){let n=t&&t.suspenseCtx;return new ReadableStream({async start(r){try{if(t&&t.ssr===!1)await T(e,n,r);else{let o=await E(e,n),s=await $e(o,n);r.enqueue(s)}n&&n.pending.length&&await oi(n,r),r.close()}catch(o){r.error(o)}}})}async function T(e,t,n){if(!(e==null||e===!1||e===!0)){if(e&&typeof e.then=="function")return e=await e,T(e,t,n);if(ue(e)){n.enqueue(String(e.value??""));return}if(fe(e))return T(e.value,t,n);if(X(e))return T(e.signal.get(),t,n);if(G(e))return T(e.value,t,n);if(Y(e))return T(e.fn(),t,n);if(de(e)){let r=e.template;n.enqueue(String(r?.innerHTML??""));return}if(!J(e)){if(Z(e))return T(e.value,t,n);if(Q(e)){let r=e.args;for(let o of r)if(!o||typeof o.then!="function")return T(o,t,n);if(r.length>0)try{let o=await Promise.race(r.map(s=>Promise.resolve(s).catch(()=>{})));return T(o,t,n)}catch{return}return}if(!(he(e)||pe(e))){if(Array.isArray(e)){for(let r of e)await T(r,t,n);return}if(K(e)){let r=e;for(let o=0;o<r.items.length;o++)await T(r.templateFn(r.items[o],o),t,n);return}if(ft(e)){let r=e;if(t){let o=`s${t.nextId++}`;n.enqueue(`<webjs-boundary id="${o}">`),await T(r.fallback,t,n),n.enqueue("</webjs-boundary>"),t.pending.push({id:o,promise:Promise.resolve(r.children)})}else await T(r.fallback,t,n);return}if(v(e)){await si(e,t,n);return}n.enqueue(Ve(String(e)))}}}}async function si(e,t,n){let{strings:r,values:o}=e,s="text",i="",a=0,c="",l=0,f="",m="",u="";for(let b=0;b<r.length;b++){let g=r[b];for(let h=0;h<g.length;h++){let d=g[h];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=ht(f)?"rawtext":"text",s==="rawtext"&&(m="")):/\s/.test(d)?s="in-tag":f+=d.toLowerCase();break;case"in-tag":u+=d,d===">"?(s=ht(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(b<o.length){let h=o[b];if(h&&typeof h.then=="function"&&(h=await h),s==="comment")u+=String(h??""),l=0;else if(s==="rawtext")u+=String(h??""),m="";else if(s==="text")u&&(n.enqueue(u),u=""),await T(h,t,n);else if(s==="after-eq"){let d=i[0],p=i.slice(1);d==="@"||d==="."?(u=u.slice(0,a),s="in-tag",i=""):d==="?"?(u=u.slice(0,a),h&&(u+=`${p}=""`),s="in-tag",i=""):(u+=`"${P(String(h??""))}"`,s="in-tag",i="")}else(s==="attr-quoted"||s==="attr-unquoted")&&(u+=P(String(h??"")))}}u&&n.enqueue(u)}async function oi(e,t){let n=nn(),r=n?` nonce="${P(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 $e(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 _r=Symbol.for("webjs.notFound"),Sr=Symbol.for("webjs.redirect");function ii(){let e=new Error("webjs: notFound()");throw e.__webjs=_r,e}function ai(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=Sr,r.url=e,r.status=typeof n=="number"?n:void 0,r}function ci(e){return!!e&&e.__webjs===_r}function li(e){return!!e&&e.__webjs===Sr}function ui(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?fi(n.cors):null},t}function fi(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 di(e,t){if(typeof e!="function")throw new Error("validateInput(): first argument must be the action function");if(typeof t!="function")throw new Error("validateInput(): second argument must be a validator function");let n=e.__webjsHttp||{};return e.__webjsHttp={...n,validate:t},e}function hi(e){return e&&typeof e=="function"&&e.__webjsHttp||null}function pi(e,t={}){let n=t.reconnect!==!1,r=0,o=!1,s=null,i=[];function a(){o||(s=new WebSocket(mi(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 mi(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 an="application/vnd.webjs+json";async function bi(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",an);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 Pe(r),n.has("content-type")||n.set("content-type",an));let o=await fetch(e,{...t,headers:n,body:r}),s=o.headers.get("content-type")||"",i=await o.text(),a=s.includes(an)?i?se(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}fn();un();mt();async function Yi(e,t,n){let r=e.get();e.set(t);let o;try{o=await n()}catch(s){throw e.set(r),s}return o&&o.success===!1&&e.set(r),o}var Ji=Symbol.for("webjs.context");function Zi(e){return{__context__:Ji,name:e}}var Tt=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},Nn=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()}},jn=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 Tt(this._context,(n,r)=>{let o=this._value;this._value=n,r&&(this._unsubscribe=r),!Object.is(o,n)&&typeof this._host.requestUpdate=="function"&&this._host.requestUpdate()},this._subscribe);this._host.dispatchEvent(t)}};function Qi(){return typeof window<"u"}var F={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},Rn=class{constructor(t,{task:n,args:r,autoRun:o=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=o,this._status=F.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=F.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=F.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=F.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 F.INITIAL:return t.initial?.();case F.PENDING:return t.pending?.();case F.COMPLETE:return t.complete?.(this._value);case F.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!Qi())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{jn as ContextConsumer,Nn as ContextProvider,Tt as ContextRequestEvent,A as MARKER,Ne as Signal,Fo as Suspense,Rn as Task,F as TaskStatus,en as WebComponent,ln as WebjsFrame,dn as WebjsStream,Rt as adoptStyles,Xt as allTags,ks as asyncAppend,xs as asyncReplace,$s as batch,vs as cache,qs as computed,pi as connectWS,Zi as createContext,Cs as createRef,nn as cspNonce,bs as css,hr as deserialize,Lr as disableClientRouter,Us as effect,_n as enableClientRouter,P as escapeAttr,Ve as escapeText,ui as expose,hi as getExposed,_s as guard,ms as html,he as isAsyncAppend,pe as isAsyncReplace,ke as isCSS,Z as isCache,Y as isGuard,G as isKeyed,vo as isLazy,fe as isLive,ci as isNotFound,li as isRedirect,J as isRef,K as isRepeat,Fs as isSignal,ft as isSuspense,v as isTemplate,de as isTemplateContent,ue as isUnsafeHTML,Q as isUntil,X as isWatch,ws as keyed,ys as live,Qt as lookup,Co as lookupModuleUrl,Or as navigate,ii as notFound,Yi as optimistic,se as parse,Ao as primeModuleUrl,ai as redirect,As as ref,Zt as register,st as render,hn as renderStream,ri as renderToStream,Do as renderToString,In as repeat,Mr as revalidate,bi as richFetch,dr as serialize,Uo as setCspNonceProvider,Bs as signal,Pe as stringify,Lt as stylesToString,lt as tagOf,Ss as templateContent,gs as unsafeHTML,Es as until,di as validateInput,Ts as watch};
4
4
  //# sourceMappingURL=webjs-core.js.map