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