@webjsdev/core 0.7.21 → 0.7.23

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,7 +1,7 @@
1
- var Fs=Object.defineProperty;var X=(e,t)=>()=>(e&&(t=e(e=0)),t);var zn=(e,t)=>{for(var n in t)Fs(e,n,{get:t[n],enumerable:!0})};function vr(e,t,n){Go.has(t)?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}async function He(e){return JSON.stringify(await xr(e))}function D(e){return kr(JSON.parse(e))}async function xr(e){let t=Yo();return await Jo(e,t),ce(e,t)}function kr(e){return G(e,ei())}function Yo(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map,fdEntries:new Map}}async function Jo(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!ni(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){let o=t.fdEntries.get(r)||[...r.entries()];t.fdEntries.set(r,o);for(let[,i]of o)typeof i!="string"&&n.push(i);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(ri(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 ce(e,t){if(e===null)return null;if(e===void 0)return{[x]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[x]:"NaN"}:e===1/0?{[x]:"Inf"}:e===-1/0?{[x]:"-Inf"}:Object.is(e,-0)?{[x]:"-0"}:e;if(n==="bigint")return{[x]:"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{[x]:"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{[x]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[x]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[x]:"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={[x]:"File",v:De(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[x]:"Blob",v:De(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=t.fdEntries.get(e)||[...e.entries()],i=[];for(let[a,c]of o)i.push([a,ce(c,t)]);s={[x]:"FD",v:i}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=Xo(e);else if(e instanceof Map){let o=[];for(let[i,a]of e)o.push([ce(i,t),ce(a,t)]);s={[x]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push(ce(i,t));s={[x]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>ce(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=si(o)?"_"+o:o;vr(s,i,ce(e[o],t))}}if(r!==void 0){if(Array.isArray(s))return{[x]:"Arr",_id:r,v:s};s._id=r}return s}function Xo(e){if(e instanceof ArrayBuffer)return{[x]:"buf",v:De(new Uint8Array(e))};if(e instanceof DataView)return{[x]:"dv",v:De(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=Zo[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[x]:n,v:De(r)}}function ei(){return{refs:new Map}}function G(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(G(e[i],t));return o}let n=e[x];if(typeof n=="string")return ti(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=oi(o)?o.slice(1):o;vr(r,i,G(e[o],t))}return r}function ti(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(G(i,n),G(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(G(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(G(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=qe(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=qe(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=G(a,n);o.append(i,c)}return o}default:{if(t==="buf"){let i=qe(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=qe(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=Qo[t];if(o){let i=qe(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 ni(e){return e!==null&&typeof e=="object"}function ri(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function si(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function oi(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}function De(e){if(Tr)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 qe(e){if(Tr){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 x,Go,Zo,Qo,Tr,xe=X(()=>{x="_$wj",Go=new Set(["__proto__","constructor","prototype"]);Zo={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},Qo={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};Tr=typeof Buffer<"u"&&typeof Buffer.from=="function"});var Br={};zn(Br,{observeLazy:()=>Bi,observeViewportOnce:()=>Di});function Fr(e){let t=yn.get(e);return t||(t=import(e).finally(()=>yn.delete(e)),yn.set(e,t),t)}function Bi(e){for(let[t,n]of Object.entries(e))le.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of le.values())Fr(t);le.clear();return}Ke||(Ke=new IntersectionObserver(Ui,{rootMargin:"200px"})),Pr(),typeof MutationObserver<"u"&&new MutationObserver(()=>Pr()).observe(document.body,{childList:!0,subtree:!0})}function Pr(){if(!(!Ke||!le.size))for(let e of le.keys())for(let t of document.querySelectorAll(e))Ke.observe(t)}function Ui(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=le.get(n);r&&(Fr(r),le.delete(n),Ke?.unobserve(t.target))}}function qi(e){for(let t of e){if(!t.isIntersecting)continue;let n=Ct.get(t.target);Ct.delete(t.target),Ve?.unobserve(t.target),n&&n()}}function Di(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(Ve||(Ve=new IntersectionObserver(qi,{rootMargin:"200px"})),Ct.set(e,t),Ve.observe(e),()=>{Ct.delete(e),Ve?.unobserve(e)})}var le,Ke,yn,Ve,Ct,Ur=X(()=>{le=new Map,Ke=null,yn=new Map;Ve=null,Ct=new WeakMap});var wn,_n=X(()=>{wn=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(()=>(Ur(),Br)).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(()=>(Sn(),qr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&wn&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",wn)});function Wi(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 En(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 Hi,An,vt=X(()=>{Hi=new Set(["append","prepend","before","after","replace","update"]);An=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=Hi.has(t)?this.querySelector("template"):null;try{for(let i of r){let a=o?o.content.cloneNode(!0):null;Wi(t,i,a)}}finally{this.remove()}}}:null;typeof customElements<"u"&&An&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",An)});var Dr,Hr=X(()=>{Dr=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&Dr&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",Dr)});function xt(e){let t=e||(typeof document<"u"?document:null);if(!(!t||typeof t.querySelectorAll!="function")){for(let n of t.querySelectorAll('script[type="application/json"]#__webjs-seeds, script[type="application/json"][data-webjs-seeds]'))zr(n.textContent,n);for(let n of t.querySelectorAll("[data-webjs-seed]"))zr(n.getAttribute("data-webjs-seed"),n,()=>n.removeAttribute("data-webjs-seed"))}}function zr(e,t,n){if(e)try{let r=D(e);if(r&&typeof r=="object")for(let s in r)Ge.has(s)||Ge.set(s,r[s])}catch{}n?n():t.remove?.()}function zi(e,t,n){Wr||(Wr=!0,xt());let r=`${e}/${t}/${n}`;if(Ge.has(r)){let s=Ge.get(r);return Ge.delete(r),s}return Vr}var Ge,Vr,Wr,Cn=X(()=>{xe();Ge=new Map,Vr=Symbol("webjs.seed.miss"),Wr=!1});var qr={};zn(qr,{_FRAME_TOP:()=>as,_LIVE_ATTRS:()=>Nn,_activeFrameId:()=>is,_addNewHeadElements:()=>jn,_applyStreamedResolve:()=>js,_blurOutgoingFocus:()=>Nt,_buildSubmitFormData:()=>ss,_bumpNavToken:()=>pa,_clearFormBusy:()=>_s,_clearFrameBusy:()=>ys,_collectChildrenSlots:()=>Le,_currentPageUrl:()=>ma,_diffElementInPlace:()=>It,_eligibleAnchorHref:()=>jt,_findAnchorInPath:()=>os,_getSubmitAction:()=>rs,_getSubmitMethod:()=>ns,_isNonHtmlPath:()=>ga,_keyOf:()=>Re,_longestSharedPath:()=>cs,_markFormBusy:()=>ws,_markFrameBusy:()=>gs,_mergeHead:()=>ks,_navToken:()=>ha,_onPopState:()=>Ln,_onSubmit:()=>On,_prefetch:()=>Ze,_prefetchInflightSize:()=>fa,_prefetchMode:()=>Rt,_prefetchPeek:()=>ua,_prefetchSaysSaveData:()=>$n,_prefetchSuppressed:()=>hs,_prefetchTake:()=>ps,_reactivateScripts:()=>$t,_readStreamedShell:()=>Ts,_reconcileChildren:()=>Fn,_regraftPermanentElements:()=>As,_regraftPermanentInSlice:()=>Pn,_resetPrefetch:()=>da,_resolveTargetFrameId:()=>Mn,_restoreOptimistic:()=>Ye,_runWithTransition:()=>Tt,_setCurrentPageUrl:()=>ba,_snapshotCache:()=>O,_streamBoundariesProgressively:()=>Rs,_takeResolveUnit:()=>Ns,_viewTransitionsEnabled:()=>Ss,collectChildrenSlots:()=>Le,disableClientRouter:()=>Zr,enableClientRouter:()=>Rn,loadFrame:()=>Ki,longestSharedPath:()=>cs,navigate:()=>Qr,revalidate:()=>es});function Xr(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function Vi(){vn||typeof MutationObserver>"u"||typeof customElements>"u"||(vn=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)}}),vn.observe(document.body,{childList:!0,subtree:!0}))}function Rn(){de||typeof document>"u"||(de=!0,document.addEventListener("click",ts,!1),document.addEventListener("submit",On,!1),window.addEventListener("popstate",Ln),document.addEventListener("pointerover",je,!0),document.addEventListener("focusin",je,!0),document.addEventListener("touchstart",je,{capture:!0,passive:!0}),document.addEventListener("pointerout",ms,!0),document.addEventListener("webjs:navigate",Tn),Vi(),Tn(),typeof history<"u"&&"scrollRestoration"in history&&(kt=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(q=location.href))}function Zr(){de&&(de=!1,document.removeEventListener("click",ts,!1),document.removeEventListener("submit",On,!1),window.removeEventListener("popstate",Ln),document.removeEventListener("pointerover",je,!0),document.removeEventListener("focusin",je,!0),document.removeEventListener("touchstart",je,{capture:!0}),document.removeEventListener("pointerout",ms,!0),document.removeEventListener("webjs:navigate",Tn),Ft(),J&&(J.disconnect(),J=null),typeof history<"u"&&kt!==null&&(history.scrollRestoration=kt,kt=null),q=null)}async function Qr(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await In(n.href,t?.replace??!1,null)}async function Ki(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};M&&M.abort(),M=new AbortController;let s=M.signal,o=++j;return Lt(r.href,n,!1,null,"GET",null,s,o)}function es(e){if(!e){O.clear(),L.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;O.delete(n),L.delete(n)}function ts(e){if(!de||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=os(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||Pt.test(r.pathname))return;e.preventDefault();let s=Mn(t);In(n,!1,s)}function Ln(e){In(location.href,!0,null)}function On(e){if(!de||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=ns(t,n);if(s==="dialog")return;let o=rs(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||Pt.test(i.pathname))return;let a=ss(t,n);e.preventDefault();let c=Mn(n||t);Xi(i.href,s,a,c,t)}function ns(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function rs(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function ss(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 os(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function is(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 Mn(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===as)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(Gi(`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 is(e)}function Gi(e,t){Gr.has(e)||(Gr.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function Le(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 cs(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 ls(e){let t=he(e);O.has(t)&&O.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(O.set(t,n);O.size>Yi;){let r=O.keys().next().value;O.delete(r)}}function Ji(e){let t=he(e),n=O.get(t);return n==null?null:(O.delete(t),O.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function he(e){let t=new URL(e,location.href);return t.pathname+t.search}async function In(e,t,n){M&&M.abort(),M=new AbortController;let r=M.signal,s=++j;q&&ls(q);let o=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),o=null},150),i=null;t||(i=Cs());try{if(t){let a=Ji(e);if(a){let c=Xr(a.html);if(c){Es(c,n,!0,null),typeof window<"u"&&window.scrollTo(a.scrollX,a.scrollY),Lt(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo(0,0)}await Lt(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===j&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(q=location.href))}}async function Xi(e,t,n,r,s){M&&M.abort(),M=new AbortController;let o=M.signal,i=++j,a=t==="get"||t==="head",c=new URL(e,location.href);if(a){c.search="";for(let[b,g]of n)c.searchParams.append(b,typeof g=="string"?g:g.name)}q&&ls(q);let l=setTimeout(()=>{document.documentElement.setAttribute("data-navigating",""),l=null},150),f=Cs(),h=s?ws(s,i,c.href):null,u=!1;try{let b=await Lt(c.href,r,!0,f,a?"GET":t.toUpperCase(),a?null:n,o,i);u=!!(b&&b.ok),!a&&i===j&&(O.clear(),L.clear())}finally{h&&_s(h,i,c.href,u),l&&clearTimeout(l),i===j&&(document.documentElement.removeAttribute("data-navigating"),typeof location<"u"&&(q=location.href))}}function us(){return[...Le(document.body).keys()].join(",")}function $n(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&e.saveData===!0||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function ta(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function jt(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||Pt.test(n.pathname)?null:t}function hs(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=ta(e);return t.includes("external")||t.includes("no-prefetch")}function Rt(e){if(hs(e))return"none";switch((e.getAttribute("data-prefetch")||"").toLowerCase().trim()){case"false":case"none":return"none";case"true":case"render":return"render";case"auto":case"viewport":return"viewport";case"intent":return"intent";default:return"intent"}}function Ze(e){if(typeof fetch!="function"||$n())return;let t=he(e);if(ue.has(t)||Je.has(t))return;let n=L.get(t);if(n&&kn()-n.at<fs)return;if(ue.size>=ds){for(Je.add(t),Te.push(e);Te.length>Qi;){let o=Te.shift();Je.delete(he(o))}return}ue.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=us();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();ra(t,{html:l,build:a,finalUrl:c,at:kn()})}).catch(()=>{}).finally(()=>{ue.delete(t),na()})}function na(){for(;Te.length&&ue.size<ds;){let e=Te.shift();Je.delete(he(e)),Ze(e)}}function ra(e,t){for(L.has(e)&&L.delete(e),L.set(e,t);L.size>Zi;){let n=L.keys().next().value;L.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function ps(e){let t=he(e),n=L.get(t);return!n||(L.delete(t),kn()-n.at>=fs)?null:n}function kn(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function je(e){if(!de)return;let t=bs(e.target);if(!t||Rt(t)!=="intent")return;let n=jt(t);n&&(Xe===t&&Ne||(Ft(),Xe=t,Ne=setTimeout(()=>{Ne=null,Xe=null,Ze(n)},ea)))}function ms(e){let t=bs(e.target);t&&t===Xe&&Ft()}function Ft(){Ne&&(clearTimeout(Ne),Ne=null),Xe=null}function bs(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 Tn(){if(typeof document>"u"||$n())return;let e=typeof IntersectionObserver<"u";e&&(J?J.disconnect():J=new IntersectionObserver(t=>{for(let n of t){if(!n.isIntersecting)continue;let r=n.target;J.unobserve(r);let s=jt(r);s&&Rt(r)==="viewport"&&Ze(s)}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=Rt(t);if(n==="render"){let r=jt(t);r&&Ze(r)}else n==="viewport"&&e&&J.observe(t)}}function sa(e){if(typeof document>"u"||!document.body)return!1;let t=Le(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 xn(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||sa(t)||typeof location<"u"&&(location.href=e)}async function Lt(e,t,n,r,s,o,i,a){s=s||"GET";let c=typeof a=="number"?a:j,l,f=null,h=null,u=null,b=!1,g=e,m=t?gs(t,c):null;try{try{let d=s==="GET"&&!o&&!t?ps(e):null;if(d)l=d.html,h=d.build,g=d.finalUrl,u=200,b=!0;else{let y={"x-webjs-router":"1"},w=us();w&&(y["x-webjs-have"]=w),t&&(y["x-webjs-frame"]=t),o!=null&&s!=="GET"&&s!=="HEAD"&&(y.accept=Kr+", text/html");let S={method:s,headers:y,credentials:"same-origin"};i&&(S.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(S.body=o);let A=await fetch(e,S);u=A.status,b=A.ok;let v=A.headers.get("content-type")||"",T=/^text\/html\b/i.test(v);if(v.toLowerCase().indexOf(Kr)===0){let _=await A.text();return c===j&&(Ye(r),En(_)),{ok:b,status:u,aborted:!1}}if(A.redirected&&A.url&&(g=A.url),A.status===204||A.status===205)return c===j&&n&&history.pushState(null,"",g),{ok:b,status:u,aborted:!1};if(!T)return c===j&&(Ye(r),xn(e,A.status,null)),{ok:!1,status:u,aborted:!1};h=A.headers.get("x-webjs-build");let E=await Ts(A);l=E.shell,E.streaming&&(f=E)}}catch(d){return d&&d.name==="AbortError"?{ok:!1,status:null,aborted:!0}:c!==j?{ok:!1,status:null,aborted:!0}:(Ye(r),xn(e,null,d instanceof Error?d:new Error(String(d))),{ok:!1,status:null,aborted:!1})}if(c!==j){if(f&&f.reader)try{f.reader.cancel()}catch{}return{ok:!1,status:u,aborted:!0}}let p=Xr(l);if(!p)return Ye(r),xn(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:u,aborted:!1};if(Es(p,t,!1,g,h),n&&history.pushState(null,"",g),n){let d=new URL(g);if(d.hash){let y=document.getElementById(d.hash.slice(1));y?y.scrollIntoView():window.scrollTo(0,0)}else window.scrollTo(0,0)}return f&&(f.reader||f.rest)&&Rs(f.reader,f.dec,f.rest,()=>c===j),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:g,frameId:t,from:"navigate"}})),{ok:b,status:u,aborted:!1}}finally{m&&ys(m,c)}}function gs(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 ys(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 ws(e,t,n){let r=Mt.has(e);return Mt.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 _s(e,t,n,r){if(Mt.get(e)!==t)return;Mt.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 Yr(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+=fe(r);return n}function Ss(){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(Ss()&&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 As(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 Pn(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=oa(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 oa(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 ia(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&ke(t)}function Es(e,t,n,r,s){try{xt(e)}catch{}try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let f=document.querySelector('script[type="importmap"]'),h=f?f.getAttribute("data-webjs-build"):null,u=!1;if(s&&h&&(u=s!==h),!u&&e.head&&e.head.children.length>0){let b=Yr(document),g=Yr(e);b!==g&&(u=!0)}if(u&&typeof location<"u")try{let b="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(b))sessionStorage.removeItem(b);else{sessionStorage&&sessionStorage.setItem(b,"1"),location.href=r;return}}catch{location.href=r;return}else if(!u)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let f=document.querySelector(`webjs-frame#${CSS.escape(t)}`),h=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(f&&h){jn(e.head),Tt(()=>{la(f,h),$t(f),ke(f),Nt()},()=>ke(f)),Jr(e.body);return}let u=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(f||document).dispatchEvent(u),u.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let o=Le(document.body),i=Le(e.body),a=cs(o,i);if(a){jn(e.head),Tt(()=>{aa(o.get(a),i.get(a),e),Nt()},()=>ia(o.get(a))),Jr(e.body);return}ks(e.head),As(document.body,e.body);let c=[...e.body.childNodes];Tt(()=>{document.body.replaceChildren(...c),$t(document.body),ke(document.body),Nt()},()=>ke(document.body))}function Nt(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function aa(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));Pn(s,o),ca(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&($t(i),ke(i))}function ca(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 f=o.get(l);It(f,c),a.push(f),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 It(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),!Nn.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])Nn.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Fn(e,t)}function Fn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(a=>document.importNode(a,!0));Pn(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 h=s.get(l);It(h,c),o.push(h),s.delete(l);continue}let f=n[a];if(f&&f.nodeType===1&&!Re(f)&&f.tagName===c.tagName){It(f,c),o.push(f);continue}}else if(c.nodeType===3){let l=n[a];if(l&&l.nodeType===3){l.nodeValue!==c.nodeValue&&(l.nodeValue=c.nodeValue),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 Cs(){let e=Le(document.body);if(e.size===0)return null;let t=null;for(let i of e.keys())(t===null||i.length>t.length)&&(t=i);if(t===null)return null;let n=document.getElementById(`wj-loading:${t}`);if(!(n instanceof HTMLTemplateElement))return null;let r=e.get(t),s=[];for(let i=r.start.nextSibling;i&&i!==r.end;i=i.nextSibling)s.push(i);let o=document.createRange();return o.setStartAfter(r.start),o.setEndBefore(r.end),o.deleteContents(),r.start.parentNode.insertBefore(n.content.cloneNode(!0),r.end),{slot:r,oldChildren:s,token:j}}function Ye(e){if(!e||e.token!==j)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let s of n)t.start.parentNode.insertBefore(s,t.end)}function la(e,t){Fn(e,t)}function vs(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function Bn(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=vs();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function xs(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=vs();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function fe(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function jn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(fe(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(fe(r))||(r.tagName==="SCRIPT"?document.head.appendChild(Bn(r)):document.head.appendChild(xs(r))))}function ks(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(fe(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(fe(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(fe(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(fe(o))||(o.tagName==="SCRIPT"?t.appendChild(Bn(o)):t.appendChild(xs(o))))}function ke(e){typeof customElements>"u"||Un(e)}function Un(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&&Un(n.shadowRoot))}function Jr(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}async function Ts(e){if(!e.body||typeof e.body.getReader!="function")return{shell:await e.text(),streaming:!1};let t=e.body.getReader(),n=new TextDecoder,r="",s="<template data-webjs-resolve",o="<!--wj-stream-shell-->",i=/<\/html\s*>/i;for(;;){let{value:a,done:c}=await t.read();a&&(r+=n.decode(a,{stream:!0})),c&&(r+=n.decode());let l=r.indexOf(o);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(l+o.length)};let f=r.indexOf(s);if(f!==-1)return{shell:r.slice(0,f),streaming:!0,reader:c?null:t,dec:n,rest:r.slice(f)};if(c)return{shell:r,streaming:!1};let h=i.exec(r);if(h){let u=h.index+h[0].length;return{shell:r.slice(0,u),streaming:!0,reader:t,dec:n,rest:r.slice(u)}}}}function Ns(e){let t=/<template\s+data-webjs-resolve="([^"]+)"\s*>/i.exec(e);if(!t)return null;let n=t[1],r=t.index+t[0].length,s=/<(\/?)template\b[^>]*>/gi;s.lastIndex=r;let o=1,i;for(;i=s.exec(e);)if(i[1]==="/"){if(o--,o===0)return{id:n,content:e.slice(r,i.index),rest:e.slice(i.index+i[0].length)}}else o++;return null}function js(e,t){let n=document.getElementById(e);if(!n)return;let r=document.createElement("template");r.innerHTML=t;let s=[...r.content.childNodes];n.replaceWith(r.content);for(let o of s)o.nodeType===1&&Un(o)}async function Rs(e,t,n,r){let s=n,o=()=>{let i;for(;i=Ns(s);){if(!r())return!1;js(i.id,i.content),s=i.rest}return!0};if(!e){o();return}try{for(;;){if(!o()){try{await e.cancel()}catch{}return}let{value:i,done:a}=await e.read();if(i&&(s+=t.decode(i,{stream:!0})),a){s+=t.decode(),o();return}}}catch{}}function $t(e){for(let t of e.querySelectorAll("script"))t.replaceWith(Bn(t))}function ua(e){return L.get(he(e))||null}function fa(){return ue.size}function da(){L.clear(),ue.clear(),Te.length=0,Je.clear(),Ft()}function ha(){return j}function pa(){return++j}function ma(){return q}function ba(e){q=e}function ga(e){return Pt.test(e)}var Kr,de,M,j,vn,q,kt,Pt,as,Gr,Yi,O,Zi,fs,ds,Qi,ea,L,ue,Te,Je,Ne,Xe,J,Ot,Mt,Nn,Sn=X(()=>{_n();vt();vt();Hr();Cn();Kr="text/vnd.webjs-stream.html";de=!1,M=null,j=0,vn=null;q=null,kt=null;Pt=/\.(?: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;as="_top";Gr=new Set;Yi=16,O=new Map;Zi=8,fs=3e4,ds=3,Qi=24,ea=100,L=new Map,ue=new Set,Te=[],Je=new Set,Ne=null,Xe=null,J=null;Ot=new WeakMap;Mt=new WeakMap;Nn=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);Rn()});function Dt(e,...t){return{_$webjs:"template",strings:e,values:t}}function N(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var C="w$";function Bs(e,...t){let n=e[0];for(let r=1;r<e.length;r++)n+=String(t[r-1]??"")+e[r];return{_$webjsCss:!0,text:n}}function me(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 tt(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
- `)}</style>`}function nt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var Vn=Symbol.for("webjs.repeat");function Kn(e,t,n){return{[Vn]:!0,items:[...e],keyFn:t,templateFn:n}}function Z(e){return!!e&&typeof e=="object"&&e[Vn]===!0}function Wt(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function be(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function Us(e){return{_$webjs:"live",value:e}}function ge(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function qs(e,t){return{_$webjs:"keyed",key:e,value:t}}function Q(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Ds(e,t){return{_$webjs:"guard",deps:e,fn:t}}function ee(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function Hs(e){return{_$webjs:"template-content",template:e}}function ye(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function Ws(e){return{_$webjs:"ref",target:e}}function te(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function zs(){return{value:void 0}}function Vs(e){return{_$webjs:"cache",value:e}}function ne(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function Ks(...e){return{_$webjs:"until",args:e}}function re(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function Gs(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function we(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function Ys(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function _e(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function Js(e){return{_$webjs:"watch",signal:e}}function se(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var F=null,W=!1,Ae=0,Se=null,zt=0,Gn=(e,t)=>Object.is(e,t),st=()=>{},Yn=()=>!1;function Jn(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)Jn(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function Me(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)Me(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function Xt(e){if(W)throw new Error("Signal read during notification phase");if(F===null)return;let t=F,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Gt(t)&&Me(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Gt(t)&&Jn(e,t)),t.producerLastReadVersions[n]=e.version}function Gt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function Xn(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=W;W=!0;try{for(let n of e.liveConsumers)n.dirty||Xs(n)}finally{W=t}}function Xs(e){e.dirty=!0,Xn(e),e.consumerMarkedDirty.call(e.wrapper||e)}function ot(e){if(!(!e.dirty&&e.lastCleanEpoch===Ae)){if(!e.producerMustRecompute()&&!Zs(e)){e.dirty=!1,e.lastCleanEpoch=Ae;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=Ae}}function Zs(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(ot(n),r!==n.version))return!0}return!1}function Yt(e){e&&(e.nextProducerIndex=0);let t=F;return F=e,t}function Jt(e,t){if(F=t,!!e){if(Gt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)Me(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var it=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=Ae,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=Yn,this.producerRecomputeValue=st,this.consumerMarkedDirty=st,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||Gn,this.watched=n?.[Zt],this.unwatched=n?.[Qt]}get(){return Xt(this),this.__value}peek(){return this.__value}set(t){if(W)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,Ae++,Se!==null?Zn(this):Xn(this))}};function Zn(e){let t=W;W=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?Se.add(n):Zn(n))}finally{W=t}}var Vt=Symbol("unset"),Kt=Symbol("computing"),rt=Symbol("errored"),Ie=class{constructor(t,n){this.__fn=t,this.__value=Vt,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||Gn,this.watched=n?.[Zt],this.unwatched=n?.[Qt];let r=this;this.producerMustRecompute=function(){return r.__value===Vt||r.__value===Kt},this.producerRecomputeValue=function(){if(r.__value===Kt)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=Kt;let o=Yt(r),i,a=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=rt,r.__error=l,a=!0}finally{Jt(r,o)}if(!a&&(s!==Vt&&s!==rt)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=st}get(){if(ot(this),Xt(this),this.__value===rt)throw this.__error;return this.__value}peek(){if(ot(this),this.__value===rt)throw this.__error;return this.__value}},at=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=Ae,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=st,this.wrapper=this,this.__isWatcher=!0;let n=this;this.consumerMarkedDirty=function(){n.__fire()}}__fire(){this.__notify&&this.__notify.call(this)}watch(...t){if(t.length===0){this.dirty=!1;return}let n=Yt(this);try{for(let r of t)Xt(r),r.__isComputed&&ot(r)}finally{Jt(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&(Me(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=Yt(this),r;try{r=t()}finally{Jt(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)Me(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},Zt=Symbol("watched"),Qt=Symbol("unwatched");function Qs(e){let t=F;F=null;try{return e()}finally{F=t}}function eo(e){return e.producers.slice()}function to(e){return e.liveConsumers?[...e.liveConsumers]:[]}function no(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function ro(e){return e.producers.length>0}function so(){return F&&F.__isComputed?F:null}function oo(e){zt++,Se===null&&(Se=new Set);try{e()}finally{if(zt--,zt===0){let t=Se;Se=null;for(let n of t)n.__fire()}}}var $e={State:it,Computed:Ie,subtle:{Watcher:at,untrack:Qs,introspectSources:eo,introspectSinks:to,hasSinks:no,hasSources:ro,currentComputed:so,watched:Zt,unwatched:Qt}};function io(e,t){return new it(e,t)}function ao(e,t){return new Ie(e,t)}function co(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function lo(e){let t=!1,n=!1,r=new Ie(e),s=new at(()=>{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 uo=`${C}s`,fo=`${C}e`;function Qn(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===uo||t===fo}function ho(e){for(let t of e.addedNodes)if(Qn(t))return!0;for(let t of e.removedNodes)if(Qn(t))return!0;return!1}function sr(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var Fe=sr(),oe=Symbol("webjs.slot.state"),z="data-webjs-light",ie="data-projection",Be="actual",or="fallback",ft=Symbol("webjs.slot.fallbackFrag"),po=64,Pe=null,en=null,ct=null,er=!1;function mo(){er||(Fe=sr(),Fe&&(Pe=HTMLSlotElement.prototype.assignedNodes,en=HTMLSlotElement.prototype.assignedElements,ct=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(z)&&!tr(this)?tn(this,t):Pe?Pe.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(z)&&!tr(this)?tn(this,t).filter(n=>n.nodeType===1):en?en.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=ct&&ct.get?ct.get.call(this):null;return t||bo(this)}}),er=!0))}mo();function tr(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 tn(e,t){if(e.getAttribute(ie)===or)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:nn(n,new Set,0)}function nn(e,t,n){if(n>=po)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(z)){let i=tn(o,{flatten:!1});if(i.length>0)for(let a of nn(i,t,n+1))r.push(a);else for(let a of nn(Array.from(o.childNodes),t,n+1))r.push(a)}else if(Pe){let i=Pe.call(o,{flatten:!0});for(let a of i)r.push(a)}else r.push(s)}else r.push(s);return r}function bo(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(z))return t.getAttribute(ie)===Be?t:null;t=t.parentElement}return null}function V(e){let t=e,n=t[oe];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[oe]=n),n}function rn(e){return!!e[oe]}function ir(e){let t=V(e);for(;e.firstChild;){let n=e.firstChild,r=lt(n);ut(t.assignedByName,r,n),e.removeChild(n)}}function ar(e){let t=V(e),n=e.querySelectorAll(`slot[${z}]`);for(let r of n){let s=r;if(s.getAttribute(ie)!==Be)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 lt(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function ut(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function cr(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 lr(e){if(!Fe)return;let t=V(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!ho(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(ut(t.assignedByName,lt(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||nr(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(nr(t,o)||o.parentElement===e)&&(ut(t.assignedByName,lt(o),o),r=!0)}}r&&dt(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function ur(e){let t=e[oe];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 nr(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 dt(e){let t=V(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,go(e)}))}function go(e){if(!Fe)return;let t=e[oe];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${z}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||yo(t,i);for(let i of r)t.ownedSlots.has(i)||So(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 f of a)l.push(f);for(let f of c)l.indexOf(f)===-1&&l.push(f);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let o=[];for(let[i,a]of s){let c=t.assignedByName.get(i)||[];for(let l=0;l<a.length;l++){let f=a[l];l===0&&c.length>0?wo(t,f,c)&&o.push(f):_o(t,f)&&o.push(f)}}for(let i of o)Ao(i)}function yo(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;cr(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function wo(e,t,n){let r=t.getAttribute(ie)!==Be,s=e.lastSnapshot.get(t)||[];if(!r&&Eo(s,n))return!1;let i=t[ft];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(ie,Be),e.lastSnapshot.set(t,n.slice()),!0}function _o(e,t){let n=t.getAttribute(ie)===Be;if(t.setAttribute(ie,or),!n)return rr(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return rr(t),!0}function rr(e){let t=e[ft];!t||t.childNodes.length===0||e.appendChild(t)}function So(e,t){if(!Fe)return;let n=V(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>dt(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function fr(e,t){if(!rn(e))return;let n=V(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);cr(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 Ao(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function Eo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var dr=new WeakMap,sn=Symbol.for("webjs.instance");function ve(e,t){let n=t,r=n[sn];if(N(e)){let s=e;if(r&&r.strings===s.strings){Ee(r,s.values);return}r&&hr(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=xo(s,t);n[sn]=i;return}if(r&&hr(r,t),n[sn]=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 pt(e){let{strings:t}=e,n=dr.get(t);if(n)return n;let r=[],s="",o="text",i="",a=0,c="",l=0,f=null,h="",u="";for(let g=0;g<t.length;g++){let m=t[g];for(let p=0;p<m.length;p++){let d=m[p];switch(o){case"text":s+=d,d==="<"&&(o="tag-open");break;case"tag-open":s+=d,d==="!"?o="bang-1":d==="/"?(o="tag-name",h=""):/[a-zA-Z]/.test(d)?(o="tag-name",h=d.toLowerCase()):o="text";break;case"bang-1":s+=d,o=d==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=d,d==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=d,d==="-"?l+=1:(d===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=d,d===">"?(o=h==="script"||h==="style"?"rawtext":"text",o==="rawtext"&&(u="")):/\s/.test(d)?o="in-tag":h+=d.toLowerCase();break;case"in-tag":s+=d,d===">"?(o=h==="script"||h==="style"?"rawtext":"text",o==="rawtext"&&(u="")):!/\s/.test(d)&&d!=="/"&&(o="attr-name",i=d,a=s.length-1);break;case"rawtext":s+=d,u=(u+d.toLowerCase()).slice(-9),(u.endsWith("<\/script>")||u.endsWith("</style>"))&&(o="text",u="",h="");break;case"attr-name":d==="="?(o="after-eq",s+=d):/\s/.test(d)?(o="in-tag",i="",s+=d):d===">"?(o="text",i="",s+=d):(i+=d,s+=d);break;case"after-eq":d==='"'||d==="'"?(o="attr-quoted",c=d,s+=d):/\s/.test(d)?(o="in-tag",i="",s+=d):d===">"?(o="text",i="",s+=d):(o="attr-unquoted",s+=d);break;case"attr-unquoted":/\s/.test(d)?(o="in-tag",i="",s+=d):(d===">"&&(o="text",i=""),s+=d);break;case"attr-quoted":s+=d,d===c&&(o="in-tag",i="");break;case"skip-attr":if(d===c){if(f){let y=f.firstPartIdx,w=[];for(let E=y;E<r.length;E++)(r[E].kind==="noop"||r[E].kind==="attr-mixed")&&w.push(E);let S=[],A=t[w[0]],v=A.lastIndexOf(c);S.push(v>=0?A.slice(v+1):A);for(let E=1;E<w.length;E++)S.push(t[w[E]]);let T=t[w[w.length-1]+1],I=T.indexOf(c);S.push(I>=0?T.slice(0,I):T),r[y]={kind:"attr-mixed",path:[],name:f.name,statics:S,group:w},f=null}o="in-tag",i=""}break}}if(g<t.length-1){let p=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){u="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${C}${p}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let d=`data-${C}${p}`;s+=`${d}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let d=i[0],y=i.slice(1);if(d==="@"||d==="."||d==="?"){s=s.slice(0,a);let w=d==="@"?"event":d==="."?"prop":"bool",S=`data-${C}${p}`;s+=`${S}=""`,r.push({kind:w,path:[],name:y})}else{s=s.slice(0,a);let w=`data-${C}${p}`;s+=`${w}=""`,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 d=`data-${C}${p}`;s+=`${d}=""`,f={name:i,firstPartIdx:p},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let b=document.createElement("template");return b.innerHTML=s,Co(b.content,r),vo(b.content,r),n={templateEl:b,parts:r},dr.set(t,n),n}function Co(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(z,"");let s=t.length;r.setAttribute(`data-${C}${s}`,""),t.push({kind:"slot",path:[]})}}function vo(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(C)){let c=Number(a.slice(C.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-${C}`)){let f=Number(l.name.slice(`data-${C}`.length));t[f]&&t[f].kind!=="child"&&(t[f].path=n.slice()),c.push(l.name)}for(let l of c)a.removeAttribute(l);r(i)}n.pop()}}r(e)}function xo(e,t){let{templateEl:n,parts:r}=pt(e),s=n.content.cloneNode(!0),o=document.createComment(`${C}s`),i=document.createComment(`${C}e`),a=r.map(l=>mt(l,s)),c=[];for(let l=0;l<e.values.length;l++)ae(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"&&ae(l,void 0,void 0,[]);return{strings:e.strings,bound:a,lastValues:c,startNode:o,endNode:i}}function mt(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 Ee(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(ae(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function hr(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=on(n.slotEl);r&&fr(r,n.slotEl)}}t.replaceChildren()}function ae(e,t,n,r){if(ge(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":No(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":To(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=on(s);if(!a||ko(s))return;let c=document.createDocumentFragment();for(;s.firstChild;)c.appendChild(s.firstChild);s[ft]=c,dt(a)};on(s)?o():queueMicrotask(o);break}case"noop":break}}function on(e){let t=e.parentElement;for(;t;){if(t[oe])return t;t=t.parentElement}return null}function ko(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 To(e,t){let n=e,r=te(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 No(e,t){return Fo(e,t),B(e,t)}function B(e,t){let n=e.marker;if(be(t)){K(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(Q(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&K(e),e.__keyedKey=s.key,B(e,s.value);return}if(ee(t)){let s=t,o=e.__guardDeps,i=s.deps;if(o!==void 0&&(Array.isArray(o)&&Array.isArray(i)?Po(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,B(e,s.fn());return}if(ye(t)){K(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(te(t))return;if(ne(t))return Bo(e,t.value);if(re(t))return Uo(e,t.args);if(se(t))return qo(e,t.signal);if(we(t))return Do(e,t);if(_e(t))return Ho(e,t);if(Z(t)){if(e.child&&e.child.kind==="repeat"){Lo(e,t);return}K(e);let s={kind:"repeat",map:new Map};e.child=s,Ro(n,s,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){Io(e,t);return}K(e);let s={kind:"array",items:[]};e.child=s,Mo(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")pr(s),e.child=void 0;else if(s.kind==="array")br(s),e.child=void 0;else if(s.kind==="async-stream")_r(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(N(t)&&o.strings===t.strings){Ee(o,t.values);return}Ce(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(N(t)){let s=t,{templateEl:o,parts:i}=pt(s),a=o.content.cloneNode(!0),c=document.createComment(`${C}s`),l=document.createComment(`${C}e`),f=i.map(b=>mt(b,a)),h=[];for(let b=0;b<s.values.length;b++)ae(f[b],s.values[b],void 0,s.values),h.push(s.values[b]);let u=[c,...a.childNodes,l];n.parentNode?.insertBefore(jo(u),n);for(let b of f)b.kind==="slot"&&ae(b,void 0,void 0,[]);e.child={strings:s.strings,bound:f,lastValues:h,startNode:c,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function jo(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function Ce(e,t){if(!e.parentNode)return;let n=e;for(;n&&n!==t;){let r=n.nextSibling;n.parentNode?.removeChild(n),n=r}t.parentNode===e.parentNode&&t.parentNode?.removeChild(t)}function cn(e){let{templateEl:t,parts:n}=pt(e),r=t.content.cloneNode(!0),s=document.createComment(`${C}s`),o=document.createComment(`${C}e`),i=n.map(l=>mt(l,r)),a=[];for(let l=0;l<e.values.length;l++)ae(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 Ue(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 Ro(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),f=o(r[c],c);if(!N(f))continue;let{inst:h,frag:u}=cn(f);t.map.set(l,h),a.appendChild(u)}i.insertBefore(a,e)}function Lo(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 f=i(o[l],l),h=a(o[l],l);if(!N(h))continue;let u=s.map.get(f);if(u&&u.strings===h.strings)Ee(u,h.values),an(u.startNode,u.endNode,r,n),c.set(f,u),s.map.delete(f);else{u&&(Ue(u),Ce(u.startNode,u.endNode),s.map.delete(f));let{inst:b,frag:g}=cn(h);r.insertBefore(g,n),c.set(f,b)}}for(let l of s.map.values())Ue(l),Ce(l.startNode,l.endNode);s.map=c}function pr(e){for(let t of e.map.values())Ue(t),Ce(t.startNode,t.endNode);e.map.clear()}function Oo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function ht(e){e.type==="tpl"?(Ue(e.inst),Ce(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function mr(e){if(N(e)){let{inst:t,frag:n}=cn(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 Mo(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}=mr(i);c&&s.appendChild(c),o.push(a)}r.insertBefore(s,e),t.items=o}function Io(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(N(c)){let u=c;if(l&&l.type==="tpl"&&l.inst.strings===u.strings){Ee(l.inst,u.values),i.push(l);continue}}else if(c!=null&&c!==!1&&c!==!0){if(l&&l.type==="text"){let u=String(c);l.node.data!==u&&(l.node.data=u),i.push(l);continue}}else{l&&ht(l),i.push({type:"empty"});continue}let{item:f,frag:h}=mr(c);h&&r.insertBefore(h,$o(o,a,n)),l&&ht(l),i.push(f)}for(let a=t.length;a<o.length;a++)ht(o[a]);s.items=i}function $o(e,t,n){for(let r=t;r<e.length;r++){let s=Oo(e[r]);if(s&&s.parentNode)return s}return n}function br(e){for(let t of e.items)ht(t);e.items=[]}function an(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 Po(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 K(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&gr(t),!e.child)return;let n=e.child;if(n.kind==="repeat")pr(n);else if(n.kind==="array")br(n);else if(n.kind==="async-stream")_r(n);else if("strings"in n){let r=e.child;Ue(r),Ce(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Fo(e,t){let n=e;n.__untilState&&!re(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!ee(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!ne(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!Q(t)&&(n.__keyedKey=void 0),n.__watchSub&&!se(t)&&gr(n)}function Bo(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(N(t)&&a.strings===t.strings){Ee(a,t.values);return}let c=document.createDocumentFragment();an(a.startNode,a.endNode,c,null),s.set(a.strings,{inst:a,holder:c}),e.child=void 0}if(N(t)){let a=t,c=s.get(a.strings);if(c){s.delete(a.strings),e.child&&K(e),an(c.inst.startNode,c.inst.endNode,n.parentNode,n),Ee(c.inst,a.values),e.child=c.inst;return}}B(e,t)}function Uo(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(u,b)=>!!(Object.is(u,b)||N(u)&&N(b)&&u.strings===b.strings),a=s&&s.length===t.length&&s.every((u,b)=>o(u,t[b]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let c={aborted:!1,highestResolved:a};n.__untilState=c;let l=-1,f;for(let u=0;u<t.length;u++){let b=t[u];if(!b||typeof b.then!="function"){l=u,f=b;break}}l!==-1&&l<=c.highestResolved?(B(e,f),c.highestResolved=l):l===-1&&!n.__untilEverRendered&&B(e,""),n.__untilEverRendered=!0;let h=Math.min(l===-1?t.length:l,c.highestResolved);for(let u=0;u<h;u++){let b=t[u];!b||typeof b.then!="function"||Promise.resolve(b).then(g=>{c.aborted||u>=c.highestResolved||(c.highestResolved=u,B(e,g))},()=>{})}}function qo(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),B(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new $e.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),B(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),B(e,s)}function gr(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function Do(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;K(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,yr(s,e,t)}function Ho(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;K(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,yr(s,e,t)}async function yr(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=wr(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 wr(e){if(e==null||e===!1||e===!0)return[];if(N(e)){let t=e,{templateEl:n,parts:r}=pt(t),s=n.content.cloneNode(!0),o=r.map(i=>mt(i,s));for(let i=0;i<t.values.length;i++)ae(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(...wr(n));return t}return[document.createTextNode(String(e))]}function _r(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 Sr=null;function bt(e){Sr=e||null}function Wo(){return Sr||void 0}var Ar=Symbol.for("webjs:registry"),Er=Symbol.for("webjs:classToTag"),gt=globalThis,U=gt[Ar]||(gt[Ar]=new Map),Cr=gt[Er]||(gt[Er]=new WeakMap),yt=typeof window<"u"&&typeof customElements<"u";function ln(e,t){if(!e||typeof e!="string"||!e.includes("-"))throw new Error(`customElements.define: tag "${e}" must contain a hyphen (HTML spec)`);let n=t.lazy===!0,r=U.get(e);r?(r.cls=t,r.lazy=n):U.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),Cr.set(t,e)}if(yt){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),ln(t,n)}}if(!yt){let e=globalThis;e.customElements||(e.customElements={define(t,n){ln(t,n)},get(t){return U.get(t)?.cls},upgrade(){},whenDefined(t){let n=U.get(t);return Promise.resolve(n?.cls)}})}function un(e,t){yt?customElements.define(e,t):ln(e,t)}function zo(e,t){if(yt)return;let n=U.get(e);if(n){n.moduleUrl=t;return}U.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function fn(e){return U.get(e)?.cls}function Vo(e){return U.get(e)?.moduleUrl||null}function Ko(e){return U.get(e)?.lazy===!0}function wt(e){return Cr.get(e)}function dn(){return[...U.keys()]}xe();var Rr=typeof window<"u"&&typeof HTMLElement<"u";function ii(e,t){return e!==t}function ai(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var _t=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=ai(),this.__internals}},ci=["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 ci){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(_t.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var li=Rr?HTMLElement:_t,hn=class e extends li{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){un(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map(Nr)}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||ii)(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=Nr(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(!Rr)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=jr(r.slice(16));try{this[o]=D(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:me(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] <${wt(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().`),rn(this)||(this.__isHydrating()?(V(this),ar(this)):ir(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&&lr(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&&ur(this),this.__signalWatcher&&(this.__signalWatcher.dispose(),this.__signalWatcher=void 0);for(let t of this.__controllers)t.hostDisconnected&&t.hostDisconnected()}attributeChangedCallback(t,n,r){if(this.__reflectingAttribute)return;let s=this.constructor,o=jr(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,r=null;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let s of this.__controllers)s.hostUpdate&&s.hostUpdate();this.__renderToken=(this.__renderToken||0)+1,this.__renderAbort&&this.__renderAbort.abort(),this.__renderAbort=typeof AbortController<"u"?new AbortController:null,bt(this.__renderAbort?this.__renderAbort.signal:null);try{let s=this.update(t);s&&typeof s.then=="function"&&(r=s)}catch(s){this._handleRenderError(s)}finally{bt(null)}if(!r){for(let s of this.__controllers)s.hostUpdated&&s.hostUpdated();n=!0}}}catch(s){console.error("[webjs] lifecycle hook threw during update phase:",s)}finally{this._isUpdating=!1,(n||r)&&(this._changedProperties=new Map)}if(r){let s=this.__renderToken;this.__pendingAsyncCommits=(this.__pendingAsyncCommits||0)+1,r.then(()=>{if(this.__pendingAsyncCommits--,s===this.__renderToken){for(let o of this.__controllers)o.hostUpdated&&o.hostUpdated();this._postCommit(t)}});return}n?this._postCommit(t):this.__pendingAsyncCommits||this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new $e.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);ve(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&ve(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&ve(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==e.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${wt(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&ve(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function Nr(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function jr(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var dc=Symbol.for("webjs.suspense");function ui(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function St(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}xe();var pn=null;function fi(e){pn=e}function mn(){if(!pn)return"";try{return pn()||""}catch{return""}}async function di(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;n&&n.dev===void 0&&r!==void 0&&(n.dev=r);let s=await k(e,n);return t&&t.ssr===!1?s:await Y(s,n,[],r)}async function k(e,t){if(e==null||e===!1||e===!0)return"";if(e&&typeof e.then=="function")return e=await e,k(e,t);if(be(e))return String(e.value??"");if(ge(e))return k(e.value,t);if(se(e))return k(e.signal.get(),t);if(Q(e))return k(e.value,t);if(ee(e))return k(e.fn(),t);if(ye(e)){let n=e.template;return String(n?.innerHTML??"")}if(te(e))return"";if(ne(e))return k(e.value,t);if(re(e)){let n=e.args;for(let r of n)if(!r||typeof r.then!="function")return k(r,t);if(n.length>0)try{let r=await Promise.race(n.map(s=>Promise.resolve(s).catch(()=>{})));return k(r,t)}catch{return""}return""}if(we(e)||_e(e))return"";if(Array.isArray(e))return(await Promise.all(e.map(r=>k(r,t)))).join("");if(Z(e)){let n=e;return(await Promise.all(n.items.map((s,o)=>k(n.templateFn(s,o),t)))).join("")}if(St(e)){let n=e,r=await k(n.fallback,t);if(t){let s=`s${t.nextId++}`;return t.pending.push({id:s,promise:Promise.resolve(n.children)}),`<webjs-boundary id="${s}">${r}</webjs-boundary>`}return r}return N(e)?hi(e,t):nt(String(e))}async function hi(e,t){let{strings:n,values:r}=e,s="",o="text",i="",a=0,c="",l=0,f="",h="";for(let u=0;u<n.length;u++){let b=n[u];for(let g=0;g<b.length;g++){let m=b[g];switch(o){case"text":s+=m,m==="<"&&(o="tag-open");break;case"tag-open":s+=m,m==="!"?o="bang-1":m==="/"?(o="tag-name",f=""):/[a-zA-Z]/.test(m)?(o="tag-name",f=m.toLowerCase()):o="text";break;case"bang-1":s+=m,o=m==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=m,m==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=m,m==="-"?l+=1:(m===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=m,m===">"?(o=At(f)?"rawtext":"text",o==="rawtext"&&(h="")):/\s/.test(m)?o="in-tag":f+=m.toLowerCase();break;case"in-tag":s+=m,m===">"?(o=At(f)?"rawtext":"text",o==="rawtext"&&(h="")):!/\s/.test(m)&&m!=="/"&&(o="attr-name",i=m,a=s.length-1);break;case"rawtext":s+=m,h=(h+m.toLowerCase()).slice(-9),(h.endsWith("<\/script>")||h.endsWith("</style>"))&&(o="text",h="",f="");break;case"attr-name":m==="="?(o="after-eq",s+=m):/\s/.test(m)?(o="in-tag",i="",s+=m):m===">"?(o="text",i="",s+=m):(i+=m,s+=m);break;case"after-eq":m==='"'||m==="'"?(o="attr-quoted",c=m,s+=m):/\s/.test(m)?(o="in-tag",i="",s+=m):m===">"?(o="text",i="",s+=m):(o="attr-unquoted",s+=m);break;case"attr-unquoted":/\s/.test(m)?(o="in-tag",i="",s+=m):(m===">"&&(o="text",i=""),s+=m);break;case"attr-quoted":s+=m,m===c&&(o="in-tag",i="");break}}if(u<r.length){let g=r[u];if(g&&typeof g.then=="function"&&(g=await g),o==="comment")s+=String(g??""),l=0;else if(o==="rawtext")s+=String(g??""),h="";else if(o==="text")s+=await k(g,t);else if(o==="after-eq"){let m=i[0],p=i.slice(1);if(m==="@")s=s.slice(0,a),o="in-tag",i="";else if(m==="."){if(s=s.slice(0,a),f==="webjs-suspense"&&p==="fallback"){let d=await k(g,t);s+=`data-webjs-fallback="${P(d)}"`,o="in-tag",i="";continue}if(!f.includes("-")){o="in-tag",i="";continue}if(g===void 0){o="in-tag",i="";continue}try{let d=await He(g);s+=`data-webjs-prop-${ki(p)}="${P(d)}"`}catch(d){console.warn(`[webjs] property binding .${p} has an unserializable value during SSR. Dropping. The browser will see the property as undefined. Detail: ${d&&d.message}`)}o="in-tag",i=""}else m==="?"?(s=s.slice(0,a),g&&(s+=`${p}=""`),o="in-tag",i=""):(s+=`"${P(String(g??""))}"`,o="in-tag",i="")}else(o==="attr-quoted"||o==="attr-unquoted")&&(s+=P(String(g??"")))}}return s}var pi=new Set(["document","window","localStorage","sessionStorage","navigator","matchMedia","requestAnimationFrame","getComputedStyle","IntersectionObserver","MutationObserver","ResizeObserver"]),mi=new Set(["attachShadow","querySelector","querySelectorAll","getBoundingClientRect","focus","blur","scrollIntoView"]);function bi(e){let t=e&&typeof e.message=="string"?e.message:"",n=/^(\w+) is not defined\b/.exec(t);return e instanceof ReferenceError&&n&&pi.has(n[1])?`\`${n[1]}\` is a browser-only global and is undefined during SSR.`:(n=/\.(\w+) is not a function\b/.exec(t),e instanceof TypeError&&n&&mi.has(n[1])?`\`${n[1]}\` is an HTMLElement method that does not exist on the server-side component instance during SSR.`:null)}function gi(){return typeof process<"u"&&process.env&&!0}function Mr(e,t,n){if(!(n===void 0?!gi():!!n))return"";let s=t&&t.message?t.message:String(t);return Dt`<div data-webjs-error="${e}" style="border:1px solid #f5c2c7;background:#f8d7da;color:#842029;padding:8px 12px;border-radius:6px;font:13px/1.4 system-ui,sans-serif">
1
+ var Ys=Object.defineProperty;var Z=(e,t)=>()=>(e&&(t=e(e=0)),t);var Zn=(e,t)=>{for(var n in t)Ys(e,n,{get:t[n],enumerable:!0})};function Lr(e,t,n){oi.has(t)?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}async function ze(e){return JSON.stringify(await Or(e))}function D(e){return Mr(JSON.parse(e))}async function Or(e){let t=ii();return await ai(e,t),le(e,t)}function Mr(e){return G(e,fi())}function ii(){return{refCount:new Map,idOf:new Map,emitted:new Set,nextId:0,blobBytes:new Map,fdEntries:new Map}}async function ai(e,t){let n=[e];for(;n.length;){let r=n.pop();if(!pi(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){let o=t.fdEntries.get(r)||[...r.entries()];t.fdEntries.set(r,o);for(let[,i]of o)typeof i!="string"&&n.push(i);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(hi(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 le(e,t){if(e===null)return null;if(e===void 0)return{[k]:"undef"};let n=typeof e;if(n==="string"||n==="boolean")return e;if(n==="number")return Number.isNaN(e)?{[k]:"NaN"}:e===1/0?{[k]:"Inf"}:e===-1/0?{[k]:"-Inf"}:Object.is(e,-0)?{[k]:"-0"}:e;if(n==="bigint")return{[k]:"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{[k]:"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{[k]:"Ref",v:r};r!==void 0&&t.emitted.add(r);let s;if(e instanceof Date)s={[k]:"Date",v:Number.isNaN(e.getTime())?null:e.toISOString()};else if(e instanceof Error)s={[k]:"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={[k]:"File",v:Ve(o),n:e.name,t:e.type||"",m:e.lastModified}:s={[k]:"Blob",v:Ve(o),t:e.type||""}}else if(typeof FormData<"u"&&e instanceof FormData){let o=t.fdEntries.get(e)||[...e.entries()],i=[];for(let[c,a]of o)i.push([c,le(a,t)]);s={[k]:"FD",v:i}}else if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)s=ci(e);else if(e instanceof Map){let o=[];for(let[i,c]of e)o.push([le(i,t),le(c,t)]);s={[k]:"Map",v:o}}else if(e instanceof Set){let o=[];for(let i of e)o.push(le(i,t));s={[k]:"Set",v:o}}else if(Array.isArray(e))s=e.map(o=>le(o,t));else{s={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i=mi(o)?"_"+o:o;Lr(s,i,le(e[o],t))}}if(r!==void 0){if(Array.isArray(s))return{[k]:"Arr",_id:r,v:s};s._id=r}return s}function ci(e){if(e instanceof ArrayBuffer)return{[k]:"buf",v:Ve(new Uint8Array(e))};if(e instanceof DataView)return{[k]:"dv",v:Ve(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))};let t=e.constructor.name,n=li[t];if(!n)throw new TypeError(`Unsupported typed array: ${t}`);let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return{[k]:n,v:Ve(r)}}function fi(){return{refs:new Map}}function G(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(G(e[i],t));return o}let n=e[k];if(typeof n=="string")return di(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=bi(o)?o.slice(1):o;Lr(r,i,G(e[o],t))}return r}function di(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,c]of e.v)o.set(G(i,n),G(c,n));return o}case"Set":{let o=new Set;typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.add(G(i,n));return o}case"Arr":{let o=[];typeof r=="number"&&n.refs.set(r,o);for(let i of e.v)o.push(G(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=We(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=We(e.v);return s(new File([o],e.n,{type:e.t||"",lastModified:e.m}))}case"FD":{if(typeof FormData>"u")throw new TypeError("FormData is not available in this environment.");let o=new FormData;s(o);for(let[i,c]of e.v){let a=G(c,n);o.append(i,a)}return o}default:{if(t==="buf"){let i=We(e.v);return s(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))}if(t==="dv"){let i=We(e.v);return s(new DataView(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}let o=ui[t];if(o){let i=We(e.v),c=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return s(new o(c))}throw new TypeError(`Unknown serialization tag: ${t}`)}}}function pi(e){return e!==null&&typeof e=="object"}function hi(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function mi(e){return/^_+\$wj$/.test(e)||/^_+id$/.test(e)}function bi(e){return/^__+\$wj$/.test(e)||/^__+id$/.test(e)}function Ve(e){if(Ir)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 We(e){if(Ir){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 k,oi,li,ui,Ir,ke=Z(()=>{k="_$wj",oi=new Set(["__proto__","constructor","prototype"]);li={Int8Array:"i8",Uint8Array:"u8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"bi64",BigUint64Array:"bu64"},ui={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};Ir=typeof Buffer<"u"&&typeof Buffer.from=="function"});var Gr={};Zn(Gr,{observeLazy:()=>Xi,observeViewportOnce:()=>ea});function Kr(e){let t=An.get(e);return t||(t=import(e).finally(()=>An.delete(e)),An.set(e,t),t)}function Xi(e){for(let[t,n]of Object.entries(e))ue.set(t.toLowerCase(),n);if(typeof IntersectionObserver>"u"){for(let t of ue.values())Kr(t);ue.clear();return}Je||(Je=new IntersectionObserver(Zi,{rootMargin:"200px"})),zr(),typeof MutationObserver<"u"&&new MutationObserver(()=>zr()).observe(document.body,{childList:!0,subtree:!0})}function zr(){if(!(!Je||!ue.size))for(let e of ue.keys())for(let t of document.querySelectorAll(e))Je.observe(t)}function Zi(e){for(let t of e){if(!t.isIntersecting)continue;let n=t.target.tagName.toLowerCase(),r=ue.get(n);r&&(Kr(r),ue.delete(n),Je?.unobserve(t.target))}}function Qi(e){for(let t of e){if(!t.isIntersecting)continue;let n=Tt.get(t.target);Tt.delete(t.target),Ye?.unobserve(t.target),n&&n()}}function ea(e,t){return typeof IntersectionObserver>"u"?(t(),()=>{}):(Ye||(Ye=new IntersectionObserver(Qi,{rootMargin:"200px"})),Tt.set(e,t),Ye.observe(e),()=>{Tt.delete(e),Ye?.unobserve(e)})}var ue,Je,An,Ye,Tt,Yr=Z(()=>{ue=new Map,Je=null,An=new Map;Ye=null,Tt=new WeakMap});var En,vn=Z(()=>{En=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(()=>(Yr(),Gr)).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(()=>(Cn(),Jr)).then(({loadFrame:n})=>{this._webjsLoadedSrc!==t||!this.isConnected||n(this,t)})}}:null;typeof customElements<"u"&&En&&!customElements.get("webjs-frame")&&customElements.define("webjs-frame",En)});function na(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 xn(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 ta,kn,Nt=Z(()=>{ta=new Set(["append","prepend","before","after","replace","update"]);kn=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=ta.has(t)?this.querySelector("template"):null;try{for(let i of r){let c=o?o.content.cloneNode(!0):null;na(t,i,c)}}finally{this.remove()}}}:null;typeof customElements<"u"&&kn&&!customElements.get("webjs-stream")&&customElements.define("webjs-stream",kn)});var Xr,Zr=Z(()=>{Xr=typeof HTMLElement<"u"?class extends HTMLElement{connectedCallback(){this.style.display||(this.style.display="contents")}}:null;typeof customElements<"u"&&Xr&&!customElements.get("webjs-suspense")&&customElements.define("webjs-suspense",Xr)});function jt(e){let t=e||(typeof document<"u"?document:null);if(!(!t||typeof t.querySelectorAll!="function")){for(let n of t.querySelectorAll('script[type="application/json"]#__webjs-seeds, script[type="application/json"][data-webjs-seeds]'))es(n.textContent,n);for(let n of t.querySelectorAll("[data-webjs-seed]"))es(n.getAttribute("data-webjs-seed"),n,()=>n.removeAttribute("data-webjs-seed"))}}function es(e,t,n){if(e)try{let r=D(e);if(r&&typeof r=="object")for(let s in r)Xe.has(s)||Xe.set(s,r[s])}catch{}n?n():t.remove?.()}function ra(e,t,n){Qr||(Qr=!0,jt());let r=`${e}/${t}/${n}`;if(Xe.has(r)){let s=Xe.get(r);return Xe.delete(r),s}return ts}var Xe,ts,Qr,Tn=Z(()=>{ke();Xe=new Map,ts=Symbol("webjs.seed.miss"),Qr=!1});var Jr={};Zn(Jr,{_FRAME_TOP:()=>bs,_LIVE_ATTRS:()=>In,_activeFrameId:()=>ms,_addNewHeadElements:()=>Pn,_applyStreamedResolve:()=>qs,_blurOutgoingFocus:()=>Ot,_buildSubmitFormData:()=>ps,_bumpNavToken:()=>ka,_clearFormBusy:()=>Rs,_clearFrameBusy:()=>Ns,_collectChildrenSlots:()=>Me,_currentPageUrl:()=>xa,_diffElementInPlace:()=>Ut,_eligibleAnchorHref:()=>It,_findAnchorInPath:()=>hs,_getSubmitAction:()=>ds,_getSubmitMethod:()=>fs,_isNonHtmlPath:()=>ja,_keyOf:()=>Oe,_longestSharedPath:()=>ys,_markFormBusy:()=>js,_markFrameBusy:()=>Ts,_mergeHead:()=>Fs,_navToken:()=>Ca,_onPopState:()=>Fn,_onSubmit:()=>Bn,_prefetch:()=>Ie,_prefetchHasHoverPointer:()=>Es,_prefetchInflightSize:()=>Ea,_prefetchMode:()=>Pt,_prefetchPeek:()=>Aa,_prefetchSaysSaveData:()=>Dn,_prefetchSuppressed:()=>vs,_prefetchTake:()=>Cs,_reactivateScripts:()=>qt,_readStreamedShell:()=>Bs,_reconcileChildren:()=>Vn,_regraftPermanentElements:()=>Os,_regraftPermanentInSlice:()=>Wn,_resetPrefetch:()=>va,_resetWarnOnce:()=>Na,_resolveTargetFrameId:()=>Un,_restoreOptimistic:()=>Ze,_runWithTransition:()=>Lt,_setCurrentPageUrl:()=>Ta,_snapshotCache:()=>O,_streamBoundariesProgressively:()=>Ds,_takeResolveUnit:()=>Us,_viewTransitionsEnabled:()=>Ls,collectChildrenSlots:()=>Me,disableClientRouter:()=>as,enableClientRouter:()=>$n,loadFrame:()=>oa,longestSharedPath:()=>ys,navigate:()=>cs,revalidate:()=>ls});function is(e){return typeof Document<"u"&&typeof Document.parseHTMLUnsafe=="function"?Document.parseHTMLUnsafe(e):typeof DOMParser<"u"?new DOMParser().parseFromString(e,"text/html"):null}function sa(){Nn||typeof MutationObserver>"u"||typeof customElements>"u"||(Nn=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)}}),Nn.observe(document.body,{childList:!0,subtree:!0}))}function $n(){X||typeof document>"u"||(X=!0,document.addEventListener("click",us,!1),document.addEventListener("submit",Bn,!1),window.addEventListener("popstate",Fn),document.addEventListener("pointerover",Le,!0),document.addEventListener("focusin",Le,!0),document.addEventListener("touchstart",Le,{capture:!0,passive:!0}),document.addEventListener("pointerout",ks,!0),document.addEventListener("webjs:navigate",Mn),sa(),Mn(),typeof history<"u"&&"scrollRestoration"in history&&(Rt=history.scrollRestoration,history.scrollRestoration="manual"),typeof location<"u"&&(q=location.href))}function as(){X&&(X=!1,document.removeEventListener("click",us,!1),document.removeEventListener("submit",Bn,!1),window.removeEventListener("popstate",Fn),document.removeEventListener("pointerover",Le,!0),document.removeEventListener("focusin",Le,!0),document.removeEventListener("touchstart",Le,{capture:!0}),document.removeEventListener("pointerout",ks,!0),document.removeEventListener("webjs:navigate",Mn),Ht(),Hn(),J&&(J.disconnect(),J=null),typeof history<"u"&&Rt!==null&&(history.scrollRestoration=Rt,Rt=null),q=null)}async function cs(e,t){let n=new URL(e,location.href);if(n.origin!==location.origin){location.href=e;return}await qn(n.href,t?.replace??!1,null)}async function oa(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};M&&M.abort(),M=new AbortController;let s=M.signal,o=++j;return $t(r.href,n,!1,null,"GET",null,s,o)}function ls(e){if(!e){O.clear(),L.clear();return}let t=new URL(e,location.href),n=t.pathname+t.search;O.delete(n),L.delete(n)}function us(e){if(!X||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=hs(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||Dt.test(r.pathname))return;e.preventDefault();let s=Un(t);qn(n,!1,s)}function Fn(e){qn(location.href,!0,null)}function Bn(e){if(!X||e.defaultPrevented)return;let t=e.target;if(!t||t.nodeType!==1||t.tagName!=="FORM"||t.hasAttribute("data-no-router"))return;let n=e.submitter??null;if(n&&n.hasAttribute("data-no-router"))return;let r=n&&n.getAttribute("formtarget")||t.getAttribute("target")||"";if(r&&r!=="_self")return;let s=fs(t,n);if(s==="dialog")return;let o=ds(t,n),i;try{i=new URL(o,location.href)}catch{return}if(i.origin!==location.origin||Dt.test(i.pathname))return;let c=ps(t,n);e.preventDefault();let a=Un(n||t);ca(i.href,s,c,a,t)}function fs(e,t){return(t&&t.getAttribute("formmethod")||e.getAttribute("method")||"get").toLowerCase()}function ds(e,t){return t&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||e.action||location.href}function ps(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 hs(e){for(let t of e.composedPath())if(t instanceof HTMLAnchorElement)return t;return null}function ms(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 Un(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===bs)return null;let r=typeof document<"u"?document.getElementById(n):null;return r&&r.tagName&&r.tagName.toLowerCase()==="webjs-frame"?n:(gs(`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 ms(e)}function gs(e,t){Rn.has(e)||(Rn.add(e),typeof console<"u"&&console.warn&&console.warn(t))}function rs(){if(typeof process<"u"&&process.env||Ln||typeof document>"u"||typeof getComputedStyle!="function")return;let e=document.documentElement;if(!e)return;Ln=!0;let t;try{t=getComputedStyle(e).scrollBehavior}catch{return}t==="smooth"&&gs("scroll-behavior-smooth-html","[webjs] Detected `scroll-behavior: smooth` on <html>. The client router scrolls to the top instantly on navigation (like a native page load), so route transitions are not affected by it. It still applies to in-page #anchor links. Pairing it with a sticky `backdrop-filter` header can also flash on iOS during navigation.")}function Mt(e){if(typeof document>"u")return;let t=document.documentElement;if(!(!t||!t.hasAttribute("data-webjs-nav-progress")))try{e?t.setAttribute("data-navigating",""):t.removeAttribute("data-navigating")}catch{}}function Me(e){let t=new Map,n=[];function r(s){if(s.nodeType===8){let o=s,i=o.data,c=/^wj:children:(.+)$/.exec(i);if(c){n.push({path:c[1],start:o});return}if(i.trim()==="/wj:children"){let a=n.pop();a&&!t.has(a.path)&&t.set(a.path,{start:a.start,end:o});return}return}if(s.hasChildNodes&&s.hasChildNodes())for(let o=s.firstChild;o;o=o.nextSibling)r(o)}return r(e),t}function ys(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 ws(e){let t=pe(e);O.has(t)&&O.delete(t);let n={html:document.documentElement.outerHTML,scrollX:typeof window<"u"&&window.scrollX||0,scrollY:typeof window<"u"&&window.scrollY||0};for(O.set(t,n);O.size>ia;){let r=O.keys().next().value;O.delete(r)}}function aa(e){let t=pe(e),n=O.get(t);return n==null?null:(O.delete(t),O.set(t,n),typeof n=="string"?{html:n,scrollX:0,scrollY:0}:n)}function pe(e){let t=new URL(e,location.href);return t.pathname+t.search}async function qn(e,t,n){M&&M.abort(),M=new AbortController;let r=M.signal,s=++j;q&&ws(q);let o=setTimeout(()=>{Mt(!0),o=null},150),i=null;t||(i=Is());try{if(t){let c=aa(e);if(c){let a=is(c.html);if(a){Ms(a,n,!0,null),typeof window<"u"&&window.scrollTo({left:c.scrollX,top:c.scrollY,behavior:"instant"}),$t(e,n,!1,i,"GET",null,r,s).catch(()=>{});return}}typeof window<"u"&&window.scrollTo({left:0,top:0,behavior:"instant"})}await $t(e,n,!t,i,"GET",null,r,s)}finally{o&&clearTimeout(o),s===j&&(Mt(!1),typeof location<"u"&&(q=location.href))}}async function ca(e,t,n,r,s){M&&M.abort(),M=new AbortController;let o=M.signal,i=++j,c=t==="get"||t==="head",a=new URL(e,location.href);if(c){a.search="";for(let[b,g]of n)a.searchParams.append(b,typeof g=="string"?g:g.name)}q&&ws(q);let l=setTimeout(()=>{Mt(!0),l=null},150),f=Is(),p=s?js(s,i,a.href):null,u=!1;try{let b=await $t(a.href,r,!0,f,c?"GET":t.toUpperCase(),c?null:n,o,i);u=!!(b&&b.ok),!c&&i===j&&(O.clear(),L.clear())}finally{p&&Rs(p,i,a.href,u),l&&clearTimeout(l),i===j&&(Mt(!1),typeof location<"u"&&(q=location.href))}}function _s(){return[...Me(document.body).keys()].join(",")}function Dn(){try{let e=typeof navigator<"u"?navigator.connection:null;if(e&&(e.saveData===!0||typeof e.effectiveType=="string"&&/2g$/.test(e.effectiveType))||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-data: reduce)").matches)return!0}catch{}return!1}function Es(){try{if(typeof matchMedia=="function")return matchMedia("(hover: hover) and (pointer: fine)").matches}catch{}return!0}function pa(e){let t=e.getAttribute("rel");return t?t.toLowerCase().split(/\s+/).filter(Boolean):[]}function It(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||Dt.test(n.pathname)?null:t}function vs(e){if(e.hasAttribute("data-no-prefetch"))return!0;let t=pa(e);return t.includes("external")||t.includes("no-prefetch")}function Pt(e){if(vs(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 Es()?"intent":"viewport"}}function Ie(e){if(!X||typeof fetch!="function"||Dn())return;let t=pe(e);if(fe.has(t)||Qe.has(t))return;let n=L.get(t);if(n&&On()-n.at<Ss)return;if(fe.size>=As){for(Qe.add(t),je.push(e);je.length>ua;){let o=je.shift();Qe.delete(pe(o))}return}fe.add(t);let r={"x-webjs-router":"1","x-webjs-prefetch":"1"},s=_s();s&&(r["x-webjs-have"]=s),fetch(e,{method:"GET",headers:r,credentials:"same-origin"}).then(async o=>{let i=o.headers.get("content-type")||"";if(!/^text\/html\b/i.test(i)||o.status>=400)return;let c=o.headers.get("x-webjs-build"),a=o.redirected&&o.url?o.url:e,l=await o.text();ma(t,{html:l,build:c,finalUrl:a,at:On()})}).catch(()=>{}).finally(()=>{fe.delete(t),ha()})}function ha(){for(;je.length&&fe.size<As;){let e=je.shift();Qe.delete(pe(e)),Ie(e)}}function ma(e,t){for(L.has(e)&&L.delete(e),L.set(e,t);L.size>la;){let n=L.keys().next().value;L.delete(n)}typeof document<"u"&&document.dispatchEvent(new CustomEvent("webjs:prefetch",{detail:{url:t.finalUrl,key:e,from:"prefetch"}}))}function Cs(e){let t=pe(e),n=L.get(t);return!n||(L.delete(t),On()-n.at>=Ss)?null:n}function On(){try{if(typeof performance<"u"&&typeof performance.now=="function")return performance.now()}catch{}return 0}function Le(e){if(!X)return;let t=xs(e.target);if(!t)return;let n=Pt(t);if(n==="none"||n==="render")return;let r=It(t);if(r){if(e.type==="touchstart"){Ie(r);return}n==="intent"&&(et===t&&Re||(Ht(),et=t,Re=setTimeout(()=>{Re=null,et=null,Ie(r)},fa)))}}function ks(e){let t=xs(e.target);t&&t===et&&Ht()}function Ht(){Re&&(clearTimeout(Re),Re=null),et=null}function Hn(){for(let e of tt)clearTimeout(e);tt.clear(),Te=new WeakMap}function xs(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 Mn(){if(typeof document>"u"||Dn())return;let e=typeof IntersectionObserver<"u";e&&(J?(J.disconnect(),Hn()):J=new IntersectionObserver(t=>{for(let n of t){let r=n.target;if(n.isIntersecting){if(Te.has(r))continue;let s=setTimeout(()=>{tt.delete(s),Te.delete(r),J.unobserve(r);let o=It(r);o&&Pt(r)==="viewport"&&Ie(o)},da);Te.set(r,s),tt.add(s)}else{let s=Te.get(r);s&&(clearTimeout(s),tt.delete(s),Te.delete(r))}}},{threshold:.5}));for(let t of document.querySelectorAll("a[href]")){let n=Pt(t);if(n==="render"){let r=It(t);r&&Ie(r)}else n==="viewport"&&e&&J.observe(t)}}function ba(e){if(typeof document>"u"||!document.body)return!1;let t=Me(document.body),n,r=-1;for(let[a,l]of t)a.length>r&&(r=a.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 c=document.createRange();return c.setStartAfter(n.start),c.setEndBefore(n.end),c.deleteContents(),s.insertBefore(o,n.end),!0}function jn(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||ba(t)||typeof location<"u"&&(location.href=e)}async function $t(e,t,n,r,s,o,i,c){s=s||"GET";let a=typeof c=="number"?c:j,l,f=null,p=null,u=null,b=!1,g=e,m=t?Ts(t,a):null;try{try{let d=s==="GET"&&!o&&!t?Cs(e):null;if(d)l=d.html,p=d.build,g=d.finalUrl,u=200,b=!0;else{let y={"x-webjs-router":"1"},w=_s();w&&(y["x-webjs-have"]=w),t&&(y["x-webjs-frame"]=t),o!=null&&s!=="GET"&&s!=="HEAD"&&(y.accept=ns+", text/html");let S={method:s,headers:y,credentials:"same-origin"};i&&(S.signal=i),o!=null&&s!=="GET"&&s!=="HEAD"&&(S.body=o);let A=await fetch(e,S);u=A.status,b=A.ok;let C=A.headers.get("content-type")||"",T=/^text\/html\b/i.test(C);if(C.toLowerCase().indexOf(ns)===0){let _=await A.text();return a===j&&(Ze(r),xn(_)),{ok:b,status:u,aborted:!1}}if(A.redirected&&A.url&&(g=A.url),A.status===204||A.status===205)return a===j&&n&&history.pushState(null,"",g),{ok:b,status:u,aborted:!1};if(!T)return a===j&&(Ze(r),jn(e,A.status,null)),{ok:!1,status:u,aborted:!1};p=A.headers.get("x-webjs-build");let E=await Bs(A);l=E.shell,E.streaming&&(f=E)}}catch(d){return d&&d.name==="AbortError"?{ok:!1,status:null,aborted:!0}:a!==j?{ok:!1,status:null,aborted:!0}:(Ze(r),jn(e,null,d instanceof Error?d:new Error(String(d))),{ok:!1,status:null,aborted:!1})}if(a!==j){if(f&&f.reader)try{f.reader.cancel()}catch{}return{ok:!1,status:u,aborted:!0}}let h=is(l);if(!h)return Ze(r),jn(e,null,new Error("navigation response did not parse as HTML")),{ok:!1,status:u,aborted:!1};if(Ms(h,t,!1,g,p),n&&history.pushState(null,"",g),n){let d=new URL(g);if(d.hash){let y=document.getElementById(d.hash.slice(1));y?y.scrollIntoView():(rs(),window.scrollTo({left:0,top:0,behavior:"instant"}))}else rs(),window.scrollTo({left:0,top:0,behavior:"instant"})}return f&&(f.reader||f.rest)&&Ds(f.reader,f.dec,f.rest,()=>a===j),document.dispatchEvent(new CustomEvent("webjs:navigate",{detail:{url:g,frameId:t,from:"navigate"}})),{ok:b,status:u,aborted:!1}}finally{m&&Ns(m,a)}}function Ts(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=Ft.has(n);return Ft.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 Ns(e,t){if(Ft.get(e)!==t)return;Ft.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 js(e,t,n){let r=Bt.has(e);return Bt.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 Rs(e,t,n,r){if(Bt.get(e)!==t)return;Bt.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 ss(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+=de(r);return n}function Ls(){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 Lt(e,t){let n=typeof document<"u"?document.startViewTransition:void 0;if(Ls()&&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 Os(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 Wn(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=ga(t,s);if(!o||o===r)continue;let i=o.parentNode;if(i)i.replaceChild(r,o);else{let c=t.indexOf(o);c!==-1&&(t[c]=r)}}}function ga(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 ya(e){if(!(!e||!e.start))for(let t=e.start.nextSibling;t&&t!==e.end;t=t.nextSibling)t.nodeType===1&&Ne(t)}function Ms(e,t,n,r,s){try{jt(e)}catch{}try{typeof sessionStorage<"u"&&(!r||t||n)&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}if(r&&!t&&!n){let f=document.querySelector('script[type="importmap"]'),p=f?f.getAttribute("data-webjs-build"):null,u=!1;if(s&&p&&(u=s!==p),!u&&e.head&&e.head.children.length>0){let b=ss(document),g=ss(e);b!==g&&(u=!0)}if(u&&typeof location<"u")try{let b="webjs:importmap-reload";if(sessionStorage&&sessionStorage.getItem(b))sessionStorage.removeItem(b);else{sessionStorage&&sessionStorage.setItem(b,"1"),location.href=r;return}}catch{location.href=r;return}else if(!u)try{typeof sessionStorage<"u"&&sessionStorage.removeItem("webjs:importmap-reload")}catch{}}if(t){let f=document.querySelector(`webjs-frame#${CSS.escape(t)}`),p=e.querySelector(`webjs-frame#${CSS.escape(t)}`);if(f&&p){Pn(e.head),Lt(()=>{Sa(f,p),qt(f),Ne(f),Ot()},()=>Ne(f)),os(e.body);return}let u=new CustomEvent("webjs:frame-missing",{bubbles:!0,cancelable:!0,detail:{frameId:t,url:r||(typeof location<"u"?location.href:null),document:e}});(f||document).dispatchEvent(u),u.defaultPrevented||console.warn(`[webjs] frame "${t}" was not in the navigation response, leaving it unchanged. Handle "webjs:frame-missing" (preventDefault) to override.`);return}let o=Me(document.body),i=Me(e.body),c=ys(o,i);if(c){Pn(e.head),Lt(()=>{wa(o.get(c),i.get(c),e),Ot()},()=>ya(o.get(c))),os(e.body);return}Fs(e.head),Os(document.body,e.body);let a=[...e.body.childNodes];Lt(()=>{document.body.replaceChildren(...a),qt(document.body),Ne(document.body),Ot()},()=>Ne(document.body))}function Ot(){let e=document.activeElement;!e||e===document.body||e===document.documentElement||typeof e.blur=="function"&&e.blur()}function wa(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));Wn(s,o),_a(r,e.start,e.end,s,o);for(let i=e.start.nextSibling;i&&i!==e.end;i=i.nextSibling)i.nodeType===1&&(qt(i),Ne(i))}function _a(e,t,n,r,s){let o=new Map;for(let a of r){if(a.nodeType!==1)continue;let l=Oe(a);l&&o.set(l,a)}let i=n,c=[];for(let a of s){if(a.nodeType===1){let l=Oe(a);if(l&&o.has(l)){let f=o.get(l);Ut(f,a),c.push(f),o.delete(l);continue}}c.push(a)}for(let a of r)if(a.parentNode===e){if(a.nodeType===1&&c.includes(a))continue;e.removeChild(a)}for(let a of c)e.insertBefore(a,i)}function Ut(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),!In.has(r.name)&&e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);for(let r of[...e.attributes])In.has(r.name)||n.has(r.name)||e.removeAttribute(r.name);Vn(e,t)}function Vn(e,t){let n=[...e.childNodes],r=[...t.childNodes].map(c=>document.importNode(c,!0));Wn(n,r);let s=new Map;for(let c of n){if(c.nodeType!==1)continue;let a=Oe(c);a&&s.set(a,c)}let o=[];for(let c=0;c<r.length;c++){let a=r[c];if(a.nodeType===1){let l=Oe(a);if(l&&s.has(l)){let p=s.get(l);Ut(p,a),o.push(p),s.delete(l);continue}let f=n[c];if(f&&f.nodeType===1&&!Oe(f)&&f.tagName===a.tagName){Ut(f,a),o.push(f);continue}}else if(a.nodeType===3){let l=n[c];if(l&&l.nodeType===3){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}else if(a.nodeType===8){let l=n[c];if(l&&l.nodeType===8){l.nodeValue!==a.nodeValue&&(l.nodeValue=a.nodeValue),o.push(l);continue}}o.push(a)}let i=new Set(o);for(let c of n)!i.has(c)&&c.parentNode===e&&e.removeChild(c);for(let c=0;c<o.length;c++){let a=o[c];(a.parentNode!==e||e.childNodes[c]!==a)&&e.insertBefore(a,e.childNodes[c]||null)}}function Oe(e){let t=e.getAttribute("data-key");return t?`${e.tagName}:k:${t}`:e.id?`${e.tagName}:i:${e.id}`:null}function Is(){let e=Me(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:j}}function Ze(e){if(!e||e.token!==j)return;let{slot:t,oldChildren:n}=e;if(t.start.parentNode!==t.end.parentNode)return;let r=document.createRange();r.setStartAfter(t.start),r.setEndBefore(t.end),r.deleteContents();for(let s of n)t.start.parentNode.insertBefore(s,t.end)}function Sa(e,t){Vn(e,t)}function Ps(){if(typeof document>"u")return"";let e=document.querySelector('meta[name="csp-nonce"]');return e&&e.getAttribute("content")||""}function zn(e){let t=document.createElement("script");for(let r of e.attributes)r.name!=="nonce"&&t.setAttribute(r.name,r.value);let n=Ps();return n&&t.setAttribute("nonce",n),t.textContent=e.textContent,t}function $s(e){if(!e.hasAttribute("nonce"))return e.cloneNode(!0);let t=e.cloneNode(!0),n=Ps();return n?t.setAttribute("nonce",n):t.removeAttribute("nonce"),t}function de(e){if(!e.hasAttribute("nonce"))return e.outerHTML;let t=e.cloneNode(!0);return t.removeAttribute("nonce"),t.outerHTML}function Pn(e){let t=e.querySelector("title");t&&(document.title=t.textContent||"");let n=new Set;for(let r of document.head.children)n.add(de(r));for(let r of e.children)r.tagName==="SCRIPT"&&r.getAttribute("type")==="importmap"||r.tagName!=="BASE"&&r.tagName!=="TITLE"&&(n.has(de(r))||(r.tagName==="SCRIPT"?document.head.appendChild(zn(r)):document.head.appendChild($s(r))))}function Fs(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(de(o));let s=new Set;for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&s.add(de(o));for(let o of[...t.children])o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(s.has(de(o))||o.remove());for(let o of e.children)o.tagName==="SCRIPT"&&o.getAttribute("type")==="importmap"||o.tagName!=="BASE"&&o.tagName!=="TITLE"&&(r.has(de(o))||(o.tagName==="SCRIPT"?t.appendChild(zn(o)):t.appendChild($s(o))))}function Ne(e){typeof customElements>"u"||Kn(e)}function Kn(e){let t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(let n of t)n.tagName&&n.tagName.includes("-")&&(customElements.upgrade(n),n.shadowRoot&&Kn(n.shadowRoot))}function os(e){for(let t of e.querySelectorAll("template[data-webjs-resolve]"))document.body.appendChild(t.cloneNode(!0))}async function Bs(e){if(!e.body||typeof e.body.getReader!="function")return{shell:await e.text(),streaming:!1};let t=e.body.getReader(),n=new TextDecoder,r="",s="<template data-webjs-resolve",o="<!--wj-stream-shell-->",i=/<\/html\s*>/i;for(;;){let{value:c,done:a}=await t.read();c&&(r+=n.decode(c,{stream:!0})),a&&(r+=n.decode());let l=r.indexOf(o);if(l!==-1)return{shell:r.slice(0,l),streaming:!0,reader:a?null:t,dec:n,rest:r.slice(l+o.length)};let f=r.indexOf(s);if(f!==-1)return{shell:r.slice(0,f),streaming:!0,reader:a?null:t,dec:n,rest:r.slice(f)};if(a)return{shell:r,streaming:!1};let p=i.exec(r);if(p){let u=p.index+p[0].length;return{shell:r.slice(0,u),streaming:!0,reader:t,dec:n,rest:r.slice(u)}}}}function Us(e){let t=/<template\s+data-webjs-resolve="([^"]+)"\s*>/i.exec(e);if(!t)return null;let n=t[1],r=t.index+t[0].length,s=/<(\/?)template\b[^>]*>/gi;s.lastIndex=r;let o=1,i;for(;i=s.exec(e);)if(i[1]==="/"){if(o--,o===0)return{id:n,content:e.slice(r,i.index),rest:e.slice(i.index+i[0].length)}}else o++;return null}function qs(e,t){let n=document.getElementById(e);if(!n)return;let r=document.createElement("template");r.innerHTML=t;let s=[...r.content.childNodes];n.replaceWith(r.content);for(let o of s)o.nodeType===1&&Kn(o)}async function Ds(e,t,n,r){let s=n,o=()=>{let i;for(;i=Us(s);){if(!r())return!1;qs(i.id,i.content),s=i.rest}return!0};if(!e){o();return}try{for(;;){if(!o()){try{await e.cancel()}catch{}return}let{value:i,done:c}=await e.read();if(i&&(s+=t.decode(i,{stream:!0})),c){s+=t.decode(),o();return}}}catch{}}function qt(e){for(let t of e.querySelectorAll("script"))t.replaceWith(zn(t))}function Aa(e){return L.get(pe(e))||null}function Ea(){return fe.size}function va(){L.clear(),fe.clear(),je.length=0,Qe.clear(),Ht(),Hn()}function Ca(){return j}function ka(){return++j}function xa(){return q}function Ta(e){q=e}function Na(){Rn.clear(),Ln=!1}function ja(e){return Dt.test(e)}var ns,X,M,j,Nn,q,Rt,Dt,bs,Rn,Ln,ia,O,la,Ss,As,ua,fa,da,L,fe,je,Qe,Re,et,J,Te,tt,Ft,Bt,In,Cn=Z(()=>{vn();Nt();Nt();Zr();Tn();ns="text/vnd.webjs-stream.html";X=!1,M=null,j=0,Nn=null;q=null,Rt=null;Dt=/\.(?: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;bs="_top";Rn=new Set;Ln=!1;ia=16,O=new Map;la=8,Ss=3e4,As=3,ua=24,fa=100,da=250,L=new Map,fe=new Set,je=[],Qe=new Set,Re=null,et=null,J=null,Te=new WeakMap,tt=new Set;Ft=new WeakMap;Bt=new WeakMap;In=new Set(["value","checked","selected","indeterminate","disabled","open","popover"]);(typeof window>"u"||window.__WEBJS_CLIENT_ROUTER__!==!1)&&$n()});function Kt(e,...t){return{_$webjs:"template",strings:e,values:t}}function N(e){return!!e&&typeof e=="object"&&e._$webjs==="template"}var v="w$";function Js(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 me(e){return!!e&&typeof e=="object"&&e._$webjsCss===!0}function Gt(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 st(e){return!e||!e.length?"":`<style>${e.map(t=>t.text).join(`
3
+ `)}</style>`}function ot(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var Qn=Symbol.for("webjs.repeat");function er(e,t,n){return{[Qn]:!0,items:[...e],keyFn:t,templateFn:n}}function Q(e){return!!e&&typeof e=="object"&&e[Qn]===!0}function Yt(e){return{_$webjs:"unsafe-html",value:String(e??"")}}function be(e){return!!e&&typeof e=="object"&&e._$webjs==="unsafe-html"}function Xs(e){return{_$webjs:"live",value:e}}function ge(e){return!!e&&typeof e=="object"&&e._$webjs==="live"}function Zs(e,t){return{_$webjs:"keyed",key:e,value:t}}function ee(e){return!!e&&typeof e=="object"&&e._$webjs==="keyed"}function Qs(e,t){return{_$webjs:"guard",deps:e,fn:t}}function te(e){return!!e&&typeof e=="object"&&e._$webjs==="guard"}function eo(e){return{_$webjs:"template-content",template:e}}function ye(e){return!!e&&typeof e=="object"&&e._$webjs==="template-content"}function to(e){return{_$webjs:"ref",target:e}}function ne(e){return!!e&&typeof e=="object"&&e._$webjs==="ref"}function no(){return{value:void 0}}function ro(e){return{_$webjs:"cache",value:e}}function re(e){return!!e&&typeof e=="object"&&e._$webjs==="cache"}function so(...e){return{_$webjs:"until",args:e}}function se(e){return!!e&&typeof e=="object"&&e._$webjs==="until"}function oo(e,t){return{_$webjs:"async-append",iterable:e,mapper:t}}function we(e){return!!e&&typeof e=="object"&&e._$webjs==="async-append"}function io(e,t){return{_$webjs:"async-replace",iterable:e,mapper:t}}function _e(e){return!!e&&typeof e=="object"&&e._$webjs==="async-replace"}function ao(e){return{_$webjs:"watch",signal:e}}function oe(e){return!!e&&typeof e=="object"&&e._$webjs==="watch"}var F=null,W=!1,Ae=0,Se=null,Jt=0,tr=(e,t)=>Object.is(e,t),at=()=>{},nr=()=>!1;function rr(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)rr(r,e);if(e.watched)try{e.watched.call(e.wrapper)}catch(r){console.error(r)}}}function $e(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)$e(n,e);if(e.unwatched)try{e.unwatched.call(e.wrapper)}catch(n){console.error(n)}}}function nn(e){if(W)throw new Error("Signal read during notification phase");if(F===null)return;let t=F,n=t.nextProducerIndex++;n<t.producers.length&&t.producers[n]!==e&&Qt(t)&&$e(t.producers[n],t),t.producers[n]!==e&&(t.producers[n]=e,Qt(t)&&rr(e,t)),t.producerLastReadVersions[n]=e.version}function Qt(e){return e.consumerIsAlwaysLive||e.liveConsumers&&e.liveConsumers.size>0}function sr(e){if(!e.liveConsumers||e.liveConsumers.size===0)return;let t=W;W=!0;try{for(let n of e.liveConsumers)n.dirty||co(n)}finally{W=t}}function co(e){e.dirty=!0,sr(e),e.consumerMarkedDirty.call(e.wrapper||e)}function ct(e){if(!(!e.dirty&&e.lastCleanEpoch===Ae)){if(!e.producerMustRecompute()&&!lo(e)){e.dirty=!1,e.lastCleanEpoch=Ae;return}e.producerRecomputeValue(),e.dirty=!1,e.lastCleanEpoch=Ae}}function lo(e){for(let t=0;t<e.producers.length;t++){let n=e.producers[t],r=e.producerLastReadVersions[t];if(r!==n.version||(ct(n),r!==n.version))return!0}return!1}function en(e){e&&(e.nextProducerIndex=0);let t=F;return F=e,t}function tn(e,t){if(F=t,!!e){if(Qt(e))for(let n=e.nextProducerIndex;n<e.producers.length;n++)$e(e.producers[n],e);for(;e.producers.length>e.nextProducerIndex;)e.producers.pop(),e.producerLastReadVersions.pop()}}var lt=class{constructor(t,n){this.__value=t,this.version=0,this.lastCleanEpoch=Ae,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.liveConsumers=void 0,this.consumerAllowSignalWrites=!0,this.consumerIsAlwaysLive=!1,this.producerMustRecompute=nr,this.producerRecomputeValue=at,this.consumerMarkedDirty=at,this.wrapper=this,this.__isSignal=!0,this.__equal=n?.equals||tr,this.watched=n?.[rn],this.unwatched=n?.[sn]}get(){return nn(this),this.__value}peek(){return this.__value}set(t){if(W)throw new Error("Signal write during notification phase");this.__equal.call(this,this.__value,t)||(this.__value=t,this.version++,Ae++,Se!==null?or(this):sr(this))}};function or(e){let t=W;W=!0;try{if(!e.liveConsumers)return;for(let n of e.liveConsumers)n.dirty||(n.dirty=!0,n.__isWatcher?Se.add(n):or(n))}finally{W=t}}var Xt=Symbol("unset"),Zt=Symbol("computing"),it=Symbol("errored"),Fe=class{constructor(t,n){this.__fn=t,this.__value=Xt,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||tr,this.watched=n?.[rn],this.unwatched=n?.[sn];let r=this;this.producerMustRecompute=function(){return r.__value===Xt||r.__value===Zt},this.producerRecomputeValue=function(){if(r.__value===Zt)throw new Error("Detected cycle in computations.");let s=r.__value;r.__value=Zt;let o=en(r),i,c=!1;try{i=r.__fn.call(r.wrapper)}catch(l){i=it,r.__error=l,c=!0}finally{tn(r,o)}if(!c&&(s!==Xt&&s!==it)&&r.__equal.call(r.wrapper,s,i)){r.__value=s;return}r.__value=i,r.version++},this.consumerMarkedDirty=at}get(){if(ct(this),nn(this),this.__value===it)throw this.__error;return this.__value}peek(){if(ct(this),this.__value===it)throw this.__error;return this.__value}},ut=class{constructor(t){this.__notify=t,this.version=0,this.lastCleanEpoch=Ae,this.dirty=!1,this.producers=[],this.producerLastReadVersions=[],this.nextProducerIndex=0,this.liveConsumers=void 0,this.consumerAllowSignalWrites=!1,this.consumerIsAlwaysLive=!0,this.producerMustRecompute=nr,this.producerRecomputeValue=at,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=en(this);try{for(let r of t)nn(r),r.__isComputed&&ct(r)}finally{tn(this,n)}this.dirty=!1}unwatch(...t){for(let n=this.producers.length-1;n>=0;n--)t.includes(this.producers[n])&&($e(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=en(this),r;try{r=t()}finally{tn(this,n)}return this.dirty=!1,r}dispose(){for(let t of this.producers)$e(t,this);this.producers=[],this.producerLastReadVersions=[],this.__notify=null}},rn=Symbol("watched"),sn=Symbol("unwatched");function uo(e){let t=F;F=null;try{return e()}finally{F=t}}function fo(e){return e.producers.slice()}function po(e){return e.liveConsumers?[...e.liveConsumers]:[]}function ho(e){return!!e.liveConsumers&&e.liveConsumers.size>0}function mo(e){return e.producers.length>0}function bo(){return F&&F.__isComputed?F:null}function go(e){Jt++,Se===null&&(Se=new Set);try{e()}finally{if(Jt--,Jt===0){let t=Se;Se=null;for(let n of t)n.__fire()}}}var Be={State:lt,Computed:Fe,subtle:{Watcher:ut,untrack:uo,introspectSources:fo,introspectSinks:po,hasSinks:ho,hasSources:mo,currentComputed:bo,watched:rn,unwatched:sn}};function yo(e,t){return new lt(e,t)}function wo(e,t){return new Fe(e,t)}function _o(e){return!!(e&&typeof e=="object"&&e.__isSignal===!0)}function So(e){let t=!1,n=!1,r=new Fe(e),s=new ut(()=>{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 Ao=`${v}s`,Eo=`${v}e`;function ir(e){if(!e||e.nodeType!==8)return!1;let t=e.nodeValue;return t===Ao||t===Eo}function vo(e){for(let t of e.addedNodes)if(ir(t))return!0;for(let t of e.removedNodes)if(ir(t))return!0;return!1}function fr(){return typeof HTMLElement<"u"&&typeof HTMLSlotElement<"u"}var qe=fr(),ie=Symbol("webjs.slot.state"),V="data-webjs-light",ae="data-projection",De="actual",dr="fallback",ht=Symbol("webjs.slot.fallbackFrag"),Co=64,Ue=null,on=null,ft=null,ar=!1;function ko(){ar||(qe=fr(),qe&&(Ue=HTMLSlotElement.prototype.assignedNodes,on=HTMLSlotElement.prototype.assignedElements,ft=Object.getOwnPropertyDescriptor(Element.prototype,"assignedSlot"),HTMLSlotElement.prototype.assignedNodes=function(t){return this.hasAttribute(V)&&!cr(this)?an(this,t):Ue?Ue.call(this,t):[]},HTMLSlotElement.prototype.assignedElements=function(t){return this.hasAttribute(V)&&!cr(this)?an(this,t).filter(n=>n.nodeType===1):on?on.call(this,t):[]},Object.defineProperty(Element.prototype,"assignedSlot",{configurable:!0,enumerable:!0,get:function(){let t=ft&&ft.get?ft.get.call(this):null;return t||xo(this)}}),ar=!0))}ko();function cr(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 an(e,t){if(e.getAttribute(ae)===dr)return[];let n=Array.from(e.childNodes);return!t||!t.flatten?n:cn(n,new Set,0)}function cn(e,t,n){if(n>=Co)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(V)){let i=an(o,{flatten:!1});if(i.length>0)for(let c of cn(i,t,n+1))r.push(c);else for(let c of cn(Array.from(o.childNodes),t,n+1))r.push(c)}else if(Ue){let i=Ue.call(o,{flatten:!0});for(let c of i)r.push(c)}else r.push(s)}else r.push(s);return r}function xo(e){let t=e.parentElement;for(;t;){if(t.tagName==="SLOT"&&t.hasAttribute(V))return t.getAttribute(ae)===De?t:null;t=t.parentElement}return null}function z(e){let t=e,n=t[ie];return n||(n={assignedByName:new Map,pendingByName:new Map,lastSnapshot:new WeakMap,nameObservers:new WeakMap,childObserver:null,scheduled:!1,ownedSlots:new Set},t[ie]=n),n}function ln(e){return!!e[ie]}function pr(e){let t=z(e);for(;e.firstChild;){let n=e.firstChild,r=dt(n);pt(t.assignedByName,r,n),e.removeChild(n)}}function hr(e){let t=z(e),n=e.querySelectorAll(`slot[${V}]`);for(let r of n){let s=r;if(s.getAttribute(ae)!==De)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 dt(e){if(e.nodeType!==1)return null;let n=e.getAttribute("slot");return n||null}function pt(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}function mr(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 br(e){if(!qe)return;let t=z(e);t.childObserver||(t.childObserver=new MutationObserver(n=>{let r=!1;for(let s of n)if(!vo(s)){if(s.type==="childList"){for(let o of s.addedNodes)o.parentElement===e&&(pt(t.assignedByName,dt(o),o),r=!0);for(let o of s.removedNodes)e.contains(o)||lr(t,o)&&(r=!0)}else if(s.type==="attributes"&&s.attributeName==="slot"){let o=s.target;(lr(t,o)||o.parentElement===e)&&(pt(t.assignedByName,dt(o),o),r=!0)}}r&&mt(e)}),t.childObserver.observe(e,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0}))}function gr(e){let t=e[ie];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 lr(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 mt(e){let t=z(e);t.scheduled||(t.scheduled=!0,queueMicrotask(()=>{t.scheduled=!1,To(e)}))}function To(e){if(!qe)return;let t=e[ie];if(!t)return;let n=Array.from(e.querySelectorAll(`slot[${V}]`)),r=new Set(n);for(let i of t.ownedSlots)r.has(i)||No(t,i);for(let i of r)t.ownedSlots.has(i)||Lo(e,i);t.ownedSlots=r;let s=new Map;for(let i of n){let c=i.getAttribute("name")||null,a=s.get(c);a||(a=[],s.set(c,a)),a.push(i)}for(let i of s.keys()){let c=t.pendingByName.get(i);if(c&&c.length){let a=t.assignedByName.get(i)||[],l=[];for(let f of c)l.push(f);for(let f of a)l.indexOf(f)===-1&&l.push(f);t.assignedByName.set(i,l),t.pendingByName.delete(i)}}let o=[];for(let[i,c]of s){let a=t.assignedByName.get(i)||[];for(let l=0;l<c.length;l++){let f=c[l];l===0&&a.length>0?jo(t,f,a)&&o.push(f):Ro(t,f)&&o.push(f)}}for(let i of o)Oo(i)}function No(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;mr(e.pendingByName,s,r)}e.lastSnapshot.delete(t)}function jo(e,t,n){let r=t.getAttribute(ae)!==De,s=e.lastSnapshot.get(t)||[];if(!r&&Mo(s,n))return!1;let i=t[ht];if(r&&i)for(;t.firstChild;)i.appendChild(t.firstChild);else for(;t.firstChild;)t.removeChild(t.firstChild);for(let c of n)t.appendChild(c);return t.setAttribute(ae,De),e.lastSnapshot.set(t,n.slice()),!0}function Ro(e,t){let n=t.getAttribute(ae)===De;if(t.setAttribute(ae,dr),!n)return ur(t),!1;for(e.lastSnapshot.delete(t);t.firstChild;)t.removeChild(t.firstChild);return ur(t),!0}function ur(e){let t=e[ht];!t||t.childNodes.length===0||e.appendChild(t)}function Lo(e,t){if(!qe)return;let n=z(e);if(n.nameObservers.has(t))return;let r=new MutationObserver(()=>mt(e));r.observe(t,{attributes:!0,attributeFilter:["name"]}),n.nameObservers.set(t,r)}function yr(e,t){if(!ln(e))return;let n=z(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);mr(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 Oo(e){e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1}))}function Mo(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 wr=new WeakMap,un=Symbol.for("webjs.instance");function Ce(e,t){let n=t,r=n[un];if(N(e)){let s=e;if(r&&r.strings===s.strings){Ee(r,s.values);return}r&&_r(r,t);let o=t.firstChild;o&&o.nodeType===8&&o.data==="webjs-hydrate"&&o.remove();let i=$o(s,t);n[un]=i;return}if(r&&_r(r,t),n[un]=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 gt(e){let{strings:t}=e,n=wr.get(t);if(n)return n;let r=[],s="",o="text",i="",c=0,a="",l=0,f=null,p="",u="";for(let g=0;g<t.length;g++){let m=t[g];for(let h=0;h<m.length;h++){let d=m[h];switch(o){case"text":s+=d,d==="<"&&(o="tag-open");break;case"tag-open":s+=d,d==="!"?o="bang-1":d==="/"?(o="tag-name",p=""):/[a-zA-Z]/.test(d)?(o="tag-name",p=d.toLowerCase()):o="text";break;case"bang-1":s+=d,o=d==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=d,d==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=d,d==="-"?l+=1:(d===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=d,d===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(u="")):/\s/.test(d)?o="in-tag":p+=d.toLowerCase();break;case"in-tag":s+=d,d===">"?(o=p==="script"||p==="style"?"rawtext":"text",o==="rawtext"&&(u="")):!/\s/.test(d)&&d!=="/"&&(o="attr-name",i=d,c=s.length-1);break;case"rawtext":s+=d,u=(u+d.toLowerCase()).slice(-9),(u.endsWith("<\/script>")||u.endsWith("</style>"))&&(o="text",u="",p="");break;case"attr-name":d==="="?(o="after-eq",s+=d):/\s/.test(d)?(o="in-tag",i="",s+=d):d===">"?(o="text",i="",s+=d):(i+=d,s+=d);break;case"after-eq":d==='"'||d==="'"?(o="attr-quoted",a=d,s+=d):/\s/.test(d)?(o="in-tag",i="",s+=d):d===">"?(o="text",i="",s+=d):(o="attr-unquoted",s+=d);break;case"attr-unquoted":/\s/.test(d)?(o="in-tag",i="",s+=d):(d===">"&&(o="text",i=""),s+=d);break;case"attr-quoted":s+=d,d===a&&(o="in-tag",i="");break;case"skip-attr":if(d===a){if(f){let y=f.firstPartIdx,w=[];for(let E=y;E<r.length;E++)(r[E].kind==="noop"||r[E].kind==="attr-mixed")&&w.push(E);let S=[],A=t[w[0]],C=A.lastIndexOf(a);S.push(C>=0?A.slice(C+1):A);for(let E=1;E<w.length;E++)S.push(t[w[E]]);let T=t[w[w.length-1]+1],I=T.indexOf(a);S.push(I>=0?T.slice(0,I):T),r[y]={kind:"attr-mixed",path:[],name:f.name,statics:S,group:w},f=null}o="in-tag",i=""}break}}if(g<t.length-1){let h=r.length;if(o==="comment"){l=0,r.push({kind:"noop",path:[]});continue}if(o==="rawtext"){u="",r.push({kind:"noop",path:[]});continue}if(o==="text")s+=`<!--${v}${h}-->`,r.push({kind:"child",path:[]});else if(o==="in-tag"){let d=`data-${v}${h}`;s+=`${d}=""`,r.push({kind:"element",path:[]})}else if(o==="after-eq"){let d=i[0],y=i.slice(1);if(d==="@"||d==="."||d==="?"){s=s.slice(0,c);let w=d==="@"?"event":d==="."?"prop":"bool",S=`data-${v}${h}`;s+=`${S}=""`,r.push({kind:w,path:[],name:y})}else{s=s.slice(0,c);let w=`data-${v}${h}`;s+=`${w}=""`,r.push({kind:"attr",path:[],name:i})}o="in-tag",i=""}else if(o==="attr-quoted"||o==="attr-unquoted"){s=s.slice(0,c);let d=`data-${v}${h}`;s+=`${d}=""`,f={name:i,firstPartIdx:h},r.push({kind:"noop",path:[]}),o="skip-attr"}else o==="skip-attr"&&r.push({kind:"noop",path:[]})}}let b=document.createElement("template");return b.innerHTML=s,Io(b.content,r),Po(b.content,r),n={templateEl:b,parts:r},wr.set(t,n),n}function Io(e,t){let n=e.querySelectorAll("slot");for(let r of n){r.setAttribute(V,"");let s=t.length;r.setAttribute(`data-${v}${s}`,""),t.push({kind:"slot",path:[]})}}function Po(e,t){let n=[];function r(s){for(let o=0;o<s.childNodes.length;o++){let i=s.childNodes[o];if(n.push(o),i.nodeType===8){let c=i.data;if(c.startsWith(v)){let a=Number(c.slice(v.length));t[a]&&t[a].kind==="child"&&(t[a].path=n.slice())}}else if(i.nodeType===1){let c=i,a=[];for(let l of c.attributes)if(l.name.startsWith(`data-${v}`)){let f=Number(l.name.slice(`data-${v}`.length));t[f]&&t[f].kind!=="child"&&(t[f].path=n.slice()),a.push(l.name)}for(let l of a)c.removeAttribute(l);r(i)}n.pop()}}r(e)}function $o(e,t){let{templateEl:n,parts:r}=gt(e),s=n.content.cloneNode(!0),o=document.createComment(`${v}s`),i=document.createComment(`${v}e`),c=r.map(l=>yt(l,s)),a=[];for(let l=0;l<e.values.length;l++)ce(c[l],e.values[l],void 0,e.values),a.push(e.values[l]);t.replaceChildren(o,...s.childNodes,i);for(let l of c)l.kind==="slot"&&ce(l,void 0,void 0,[]);return{strings:e.strings,bound:c,lastValues:a,startNode:o,endNode:i}}function yt(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 Ee(e,t){for(let n=0;n<t.length;n++){let r=t[n];Object.is(r,e.lastValues[n])||(ce(e.bound[n],r,e.lastValues[n],t),e.lastValues[n]=r)}}function _r(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=fn(n.slotEl);r&&yr(r,n.slotEl)}}t.replaceChildren()}function ce(e,t,n,r){if(ge(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":Uo(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":Bo(e,t);break;case"attr-mixed":{let s=e,o=s.statics[0];for(let i=0;i<s.group.length;i++)o+=String((r?r[s.group[i]]:t)??""),o+=s.statics[i+1]||"";e.el.setAttribute(e.name,o);break}case"slot":{if(e.applied)break;let s=e.slotEl,o=()=>{e.applied=!0;let c=fn(s);if(!c||Fo(s))return;let a=document.createDocumentFragment();for(;s.firstChild;)a.appendChild(s.firstChild);s[ht]=a,mt(c)};fn(s)?o():queueMicrotask(o);break}case"noop":break}}function fn(e){let t=e.parentElement;for(;t;){if(t[ie])return t;t=t.parentElement}return null}function Fo(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 Bo(e,t){let n=e,r=ne(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 Uo(e,t){return Yo(e,t),B(e,t)}function B(e,t){let n=e.marker;if(be(t)){K(e);let s=String(t.value??""),o=document.createElement("template");o.innerHTML=s;let i=[...o.content.childNodes],c=document.createDocumentFragment();for(let a of i)c.appendChild(a);n.parentNode?.insertBefore(c,n),e.child=i;return}if(ee(t)){let s=t,o=e.__keyedKey;o!==void 0&&!Object.is(o,s.key)&&K(e),e.__keyedKey=s.key,B(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)?Go(o,i):Object.is(o,i)))return;e.__guardDeps=Array.isArray(i)?i.slice():i,B(e,s.fn());return}if(ye(t)){K(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(ne(t))return;if(re(t))return Jo(e,t.value);if(se(t))return Xo(e,t.args);if(oe(t))return Zo(e,t.signal);if(we(t))return Qo(e,t);if(_e(t))return ei(e,t);if(Q(t)){if(e.child&&e.child.kind==="repeat"){Ho(e,t);return}K(e);let s={kind:"repeat",map:new Map};e.child=s,Do(n,s,t);return}if(Array.isArray(t)){if(e.child&&e.child.kind==="array"){zo(e,t);return}K(e);let s={kind:"array",items:[]};e.child=s,Vo(n,s,t);return}if(e.child){let s=e.child;if(s.kind==="repeat")Sr(s),e.child=void 0;else if(s.kind==="array")Er(s),e.child=void 0;else if(s.kind==="async-stream")xr(s),e.child=void 0;else if("strings"in e.child){let o=e.child;if(N(t)&&o.strings===t.strings){Ee(o,t.values);return}ve(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(N(t)){let s=t,{templateEl:o,parts:i}=gt(s),c=o.content.cloneNode(!0),a=document.createComment(`${v}s`),l=document.createComment(`${v}e`),f=i.map(b=>yt(b,c)),p=[];for(let b=0;b<s.values.length;b++)ce(f[b],s.values[b],void 0,s.values),p.push(s.values[b]);let u=[a,...c.childNodes,l];n.parentNode?.insertBefore(qo(u),n);for(let b of f)b.kind==="slot"&&ce(b,void 0,void 0,[]);e.child={strings:s.strings,bound:f,lastValues:p,startNode:a,endNode:l};return}let r=document.createTextNode(String(t));n.parentNode?.insertBefore(r,n),e.child=[r]}function qo(e){let t=document.createDocumentFragment();for(let n of e)t.appendChild(n);return t}function ve(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 pn(e){let{templateEl:t,parts:n}=gt(e),r=t.content.cloneNode(!0),s=document.createComment(`${v}s`),o=document.createComment(`${v}e`),i=n.map(l=>yt(l,r)),c=[];for(let l=0;l<e.values.length;l++)ce(i[l],e.values[l],void 0,e.values),c.push(e.values[l]);let a=document.createDocumentFragment();for(a.appendChild(s);r.firstChild;)a.appendChild(r.firstChild);return a.appendChild(o),{inst:{strings:e.strings,bound:i,lastValues:c,startNode:s,endNode:o},frag:a}}function He(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 Do(e,t,n){let{items:r,keyFn:s,templateFn:o}=n,i=e.parentNode;if(!i)return;let c=document.createDocumentFragment();for(let a=0;a<r.length;a++){let l=s(r[a],a),f=o(r[a],a);if(!N(f))continue;let{inst:p,frag:u}=pn(f);t.map.set(l,p),c.appendChild(u)}i.insertBefore(c,e)}function Ho(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,{items:o,keyFn:i,templateFn:c}=t,a=new Map;for(let l=0;l<o.length;l++){let f=i(o[l],l),p=c(o[l],l);if(!N(p))continue;let u=s.map.get(f);if(u&&u.strings===p.strings)Ee(u,p.values),dn(u.startNode,u.endNode,r,n),a.set(f,u),s.map.delete(f);else{u&&(He(u),ve(u.startNode,u.endNode),s.map.delete(f));let{inst:b,frag:g}=pn(p);r.insertBefore(g,n),a.set(f,b)}}for(let l of s.map.values())He(l),ve(l.startNode,l.endNode);s.map=a}function Sr(e){for(let t of e.map.values())He(t),ve(t.startNode,t.endNode);e.map.clear()}function Wo(e){return e.type==="tpl"?e.inst.startNode:e.type==="text"?e.node:null}function bt(e){e.type==="tpl"?(He(e.inst),ve(e.inst.startNode,e.inst.endNode)):e.type==="text"&&e.node.parentNode?.removeChild(e.node)}function Ar(e){if(N(e)){let{inst:t,frag:n}=pn(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 Vo(e,t,n){let r=e.parentNode;if(!r)return;let s=document.createDocumentFragment(),o=[];for(let i of n){let{item:c,frag:a}=Ar(i);a&&s.appendChild(a),o.push(c)}r.insertBefore(s,e),t.items=o}function zo(e,t){let n=e.marker,r=n.parentNode;if(!r)return;let s=e.child,o=s.items,i=[];for(let c=0;c<t.length;c++){let a=t[c],l=o[c];if(N(a)){let u=a;if(l&&l.type==="tpl"&&l.inst.strings===u.strings){Ee(l.inst,u.values),i.push(l);continue}}else if(a!=null&&a!==!1&&a!==!0){if(l&&l.type==="text"){let u=String(a);l.node.data!==u&&(l.node.data=u),i.push(l);continue}}else{l&&bt(l),i.push({type:"empty"});continue}let{item:f,frag:p}=Ar(a);p&&r.insertBefore(p,Ko(o,c,n)),l&&bt(l),i.push(f)}for(let c=t.length;c<o.length;c++)bt(o[c]);s.items=i}function Ko(e,t,n){for(let r=t;r<e.length;r++){let s=Wo(e[r]);if(s&&s.parentNode)return s}return n}function Er(e){for(let t of e.items)bt(t);e.items=[]}function dn(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 Go(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function K(e){let t=e;if(t.__untilState&&(t.__untilState.aborted=!0,t.__untilState=void 0),t.__watchSub&&vr(t),!e.child)return;let n=e.child;if(n.kind==="repeat")Sr(n);else if(n.kind==="array")Er(n);else if(n.kind==="async-stream")xr(n);else if("strings"in n){let r=e.child;He(r),ve(r.startNode,r.endNode)}else for(let r of e.child)r.parentNode&&r.parentNode.removeChild(r);e.child=void 0}function Yo(e,t){let n=e;n.__untilState&&!se(t)&&(n.__untilState.aborted=!0,n.__untilState=void 0),n.__guardDeps!==void 0&&!te(t)&&(n.__guardDeps=void 0),n.__cacheMap&&!re(t)&&(n.__cacheMap=void 0),n.__keyedKey!==void 0&&!ee(t)&&(n.__keyedKey=void 0),n.__watchSub&&!oe(t)&&vr(n)}function Jo(e,t){let n=e.marker,r=e,s=r.__cacheMap;s||(s=new Map,r.__cacheMap=s);let o=e.child;if(o&&"strings"in o){let c=o;if(N(t)&&c.strings===t.strings){Ee(c,t.values);return}let a=document.createDocumentFragment();dn(c.startNode,c.endNode,a,null),s.set(c.strings,{inst:c,holder:a}),e.child=void 0}if(N(t)){let c=t,a=s.get(c.strings);if(a){s.delete(c.strings),e.child&&K(e),dn(a.inst.startNode,a.inst.endNode,n.parentNode,n),Ee(a.inst,c.values),e.child=a.inst;return}}B(e,t)}function Xo(e,t){let n=e,r=n.__untilState,s=n.__untilArgs,o=(u,b)=>!!(Object.is(u,b)||N(u)&&N(b)&&u.strings===b.strings),c=s&&s.length===t.length&&s.every((u,b)=>o(u,t[b]))&&r?r.highestResolved:1/0;r&&(r.aborted=!0),n.__untilArgs=t.slice();let a={aborted:!1,highestResolved:c};n.__untilState=a;let l=-1,f;for(let u=0;u<t.length;u++){let b=t[u];if(!b||typeof b.then!="function"){l=u,f=b;break}}l!==-1&&l<=a.highestResolved?(B(e,f),a.highestResolved=l):l===-1&&!n.__untilEverRendered&&B(e,""),n.__untilEverRendered=!0;let p=Math.min(l===-1?t.length:l,a.highestResolved);for(let u=0;u<p;u++){let b=t[u];!b||typeof b.then!="function"||Promise.resolve(b).then(g=>{a.aborted||u>=a.highestResolved||(a.highestResolved=u,B(e,g))},()=>{})}}function Zo(e,t){let n=e;if(n.__watchSig===t&&n.__watchSub){let o;n.__watchSub.observe(()=>{o=t.get()}),B(e,o);return}n.__watchSub&&(n.__watchSub.dispose(),n.__watchSub=void 0),n.__watchSig=t;let r=new Be.subtle.Watcher(()=>{queueMicrotask(()=>{if(n.__watchSub!==r)return;let o;r.observe(()=>{o=t.get()}),B(e,o)})});n.__watchSub=r;let s;r.observe(()=>{s=t.get()}),B(e,s)}function vr(e){e.__watchSub&&(e.__watchSub.dispose(),e.__watchSub=void 0,e.__watchSig=void 0)}function Qo(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="append"&&n.iterable===t.iterable)return;K(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"append",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Cr(s,e,t)}function ei(e,t){let n=e.child;if(n&&n.kind==="async-stream"&&n.mode==="replace"&&n.iterable===t.iterable)return;K(e);let r=t.iterable[Symbol.asyncIterator](),s={kind:"async-stream",mode:"replace",aborted:!1,iterable:t.iterable,iterator:r,nodes:[]};e.child=s,Cr(s,e,t)}async function Cr(e,t,n){let r=t.marker,s=0;try{for(;!e.aborted;){let o=await e.iterator.next();if(e.aborted||o.done)break;let i=n.mapper?n.mapper(o.value,s):o.value,c=kr(i);if(e.mode==="replace"){for(let l of e.nodes)l.parentNode&&l.parentNode.removeChild(l);e.nodes=[]}let a=document.createDocumentFragment();for(let l of c)a.appendChild(l);r.parentNode?.insertBefore(a,r),e.nodes.push(...c),s++}}catch(o){typeof console<"u"&&console.error("[webjs] asyncStream error:",o)}}function kr(e){if(e==null||e===!1||e===!0)return[];if(N(e)){let t=e,{templateEl:n,parts:r}=gt(t),s=n.content.cloneNode(!0),o=r.map(i=>yt(i,s));for(let i=0;i<t.values.length;i++)ce(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(...kr(n));return t}return[document.createTextNode(String(e))]}function xr(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 Tr=null;function wt(e){Tr=e||null}function ti(){return Tr||void 0}var Nr=Symbol.for("webjs:registry"),jr=Symbol.for("webjs:classToTag"),_t=globalThis,U=_t[Nr]||(_t[Nr]=new Map),Rr=_t[jr]||(_t[jr]=new WeakMap),St=typeof window<"u"&&typeof customElements<"u";function hn(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=U.get(e);r?(r.cls=t,r.lazy=n):U.set(e,{cls:t,moduleUrl:null,lazy:n,tag:e}),Rr.set(t,e)}if(St){let e=customElements.define.bind(customElements);customElements.define=function(t,n,r){customElements.get(t)||e(t,n,r),hn(t,n)}}if(!St){let e=globalThis;e.customElements||(e.customElements={define(t,n){hn(t,n)},get(t){return U.get(t)?.cls},upgrade(){},whenDefined(t){let n=U.get(t);return Promise.resolve(n?.cls)}})}function mn(e,t){St?customElements.define(e,t):hn(e,t)}function ni(e,t){if(St)return;let n=U.get(e);if(n){n.moduleUrl=t;return}U.set(e,{cls:null,moduleUrl:t,lazy:!1,tag:e})}function bn(e){return U.get(e)?.cls}function ri(e){return U.get(e)?.moduleUrl||null}function si(e){return U.get(e)?.lazy===!0}function At(e){return Rr.get(e)}function gn(){return[...U.keys()]}ke();var Br=typeof window<"u"&&typeof HTMLElement<"u";function gi(e,t){return e!==t}function yi(){return{states:new Set,shadowRoot:null,form:null,labels:[],role:"",willValidate:!0,validity:{},validationMessage:"",setFormValue(){},setValidity(){},checkValidity(){return!0},reportValidity(){return!0}}}var Et=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=yi(),this.__internals}},wi=["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 wi){let t="aria-"+e.slice(4).toLowerCase();Object.defineProperty(Et.prototype,e,{configurable:!0,get(){return this.getAttribute(t)},set(n){n==null?this.removeAttribute(t):this.setAttribute(t,String(n))}})}var _i=Br?HTMLElement:Et,Ur=Symbol("webjs.factoryProps"),Pr=new WeakSet,xe=class e extends _i{static shadow=!1;static hydrate=void 0;static properties={};static styles=null;static register(t){mn(t,this)}static get observedAttributes(){let t=this.properties||{};return Object.keys(t).filter(n=>!t[n].state).map($r)}constructor(){super(),this._renderRoot=null,this._scheduled=!1,this._connected=!1,this.__controllers=new Set,this.__firstRendered=!1,this._changedProperties=new Map,this._updateResolve=null,this._updatePromise=Promise.resolve(!0),this._isUpdating=!1,this._assertFactoryProperties(),this._initializeProperties()}_assertFactoryProperties(){let t=this.constructor;if(Pr.has(t))return;let n=t;for(;n&&n!==e;){if(Object.hasOwn(n,"properties")&&!Object.hasOwn(n,Ur)){let r=n.name||"a component";throw new Error(`${r}: \`static properties\` is no longer supported. Declare reactive properties via the factory instead: \`class ${r} extends WebComponent({ count: Number })\`. Use the \`prop()\` helper for options (\`prop(Number, { reflect: true })\`) and set defaults via the \`default\` option or in the constructor. See https://docs.webjs.com/docs/components.`)}n=Object.getPrototypeOf(n)}Pr.add(t)}_initializeProperties(){let n=this.constructor.properties;if(!(!n||typeof n!="object")){this.__propValues={};for(let[r,s]of Object.entries(n)){let o=typeof s=="object"?s:{type:s},i=this[r];Object.defineProperty(this,r,{configurable:!0,enumerable:!0,get:()=>this.__propValues[r],set:c=>{let a=this.__propValues[r];(o.hasChanged||gi)(c,a)&&(this.__propValues[r]=c,o.reflect&&!o.state&&this._connected&&this._reflectAttribute(r,c,o),this.requestUpdate(r,a))}}),i!==void 0&&(this.__propValues[r]=i)}}}_reflectAttribute(t,n,r){let s=$r(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(!Br)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=Fr(r.slice(16));try{this[o]=D(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:me(r)?[r]:[];if(s.length){if(n){let o=this.shadowRoot.querySelector("style");o&&o.remove()}Gt(this._renderRoot,s)}}else this._renderRoot=this,t.styles&&console.warn(`[webjs] <${At(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().`),ln(this)||(this.__isHydrating()?(z(this),hr(this)):pr(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&&br(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&&gr(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=Fr(t),i=s.properties&&(s.properties[o]||s.properties[t]);if(!i)return;let c=typeof i=="object"?i:{type:i},a;if(c.converter&&c.converter.fromAttribute)a=c.converter.fromAttribute(r,c.type);else if(c.type===Number)a=r==null?null:Number(r);else if(c.type===Boolean)a=r!=null&&r!=="false";else if(c.type===Object||c.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,r=null;try{if(this.shouldUpdate(t)){this.willUpdate(t);for(let s of this.__controllers)s.hostUpdate&&s.hostUpdate();this.__renderToken=(this.__renderToken||0)+1,this.__renderAbort&&this.__renderAbort.abort(),this.__renderAbort=typeof AbortController<"u"?new AbortController:null,wt(this.__renderAbort?this.__renderAbort.signal:null);try{let s=this.update(t);s&&typeof s.then=="function"&&(r=s)}catch(s){this._handleRenderError(s)}finally{wt(null)}if(!r){for(let s of this.__controllers)s.hostUpdated&&s.hostUpdated();n=!0}}}catch(s){console.error("[webjs] lifecycle hook threw during update phase:",s)}finally{this._isUpdating=!1,(n||r)&&(this._changedProperties=new Map)}if(r){let s=this.__renderToken;this.__pendingAsyncCommits=(this.__pendingAsyncCommits||0)+1,r.then(()=>{if(this.__pendingAsyncCommits--,s===this.__renderToken){for(let o of this.__controllers)o.hostUpdated&&o.hostUpdated();this._postCommit(t)}});return}n?this._postCommit(t):this.__pendingAsyncCommits||this._resolveUpdate()}_resolveUpdate(){if(this._updateResolve){let t=this._changedProperties.size===0;this._updateResolve(t),this._updateResolve=null}}performServerUpdate(){let t=this._changedProperties;this._isUpdating=!0;try{this.willUpdate(t);for(let n of this.__controllers)n.hostUpdate&&n.hostUpdate();this._reflectDeclaredAttributes()}finally{this._isUpdating=!1}}_reflectDeclaredAttributes(){let t=this.constructor.properties||{};for(let n of Object.keys(t)){let r=t[n];!r||!r.reflect||r.state||this._reflectAttribute(n,this[n],r)}}shouldUpdate(t){return!0}willUpdate(t){}update(t){this.__signalWatcher||(this.__signalWatcher=new Be.subtle.Watcher(()=>{this._connected&&this.requestUpdate()}));let n;if(this.__signalWatcher.observe(()=>{n=this.render()}),n&&typeof n.then=="function")return this._commitAsync(n);Ce(n,this._renderRoot)}_commitAsync(t){let n=this.__renderToken;if(this.__firstRendered&&this._overridesRenderFallback())try{let r=this.renderFallback();r!==void 0&&Ce(r,this._renderRoot)}catch(r){console.error("[webjs] renderFallback() threw:",r)}return Promise.resolve(t).then(r=>{n===this.__renderToken&&Ce(r,this._renderRoot)},r=>{n===this.__renderToken&&this._handleRenderError(r instanceof Error?r:new Error(String(r)))})}_overridesRenderFallback(){return this.renderFallback!==vt.prototype.renderFallback}_handleRenderError(t){console.error(`[webjs] render error in <${At(this.constructor)||this.tagName?.toLowerCase()}>:`,t);try{let n=this.renderError(t);n!==void 0&&Ce(n,this._renderRoot)}catch(n){console.error("[webjs] renderError() also threw:",n)}}_postCommit(t){try{this.__firstRendered||(this.__firstRendered=!0,this.firstUpdated(t)),this.updated(t)}catch(n){console.error("[webjs] lifecycle hook threw during post-commit phase:",n)}finally{this._resolveUpdate()}}updated(t){}firstUpdated(t){}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}addController(t){this.__controllers.add(t),this._connected&&t.hostConnected&&t.hostConnected()}removeController(t){this.__controllers.delete(t)}render(){return""}renderError(t){}renderFallback(){}};function $r(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Fr(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function vt(e){return new.target?Reflect.construct(xe,arguments,new.target):class extends xe{static properties=e;static[Ur]=!0}}Object.setPrototypeOf(vt,xe);vt.prototype=xe.prototype;function Si(e,t={}){return e&&typeof e=="object"&&!("call"in e)&&(t=e,e=void 0),{...e?{type:e}:{},...t}}var kc=Symbol.for("webjs.suspense");function Ai(e){return{_$webjsSuspense:!0,fallback:e.fallback,children:e.children}}function Ct(e){return!!e&&typeof e=="object"&&e._$webjsSuspense===!0}ke();var yn=null;function Ei(e){yn=e}function wn(){if(!yn)return"";try{return yn()||""}catch{return""}}async function vi(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;n&&n.dev===void 0&&r!==void 0&&(n.dev=r);let s=await x(e,n);return t&&t.ssr===!1?s:await Y(s,n,[],r)}async function x(e,t){if(e==null||e===!1||e===!0)return"";if(e&&typeof e.then=="function")return e=await e,x(e,t);if(be(e))return String(e.value??"");if(ge(e))return x(e.value,t);if(oe(e))return x(e.signal.get(),t);if(ee(e))return x(e.value,t);if(te(e))return x(e.fn(),t);if(ye(e)){let n=e.template;return String(n?.innerHTML??"")}if(ne(e))return"";if(re(e))return x(e.value,t);if(se(e)){let n=e.args;for(let r of n)if(!r||typeof r.then!="function")return x(r,t);if(n.length>0)try{let r=await Promise.race(n.map(s=>Promise.resolve(s).catch(()=>{})));return x(r,t)}catch{return""}return""}if(we(e)||_e(e))return"";if(Array.isArray(e))return(await Promise.all(e.map(r=>x(r,t)))).join("");if(Q(e)){let n=e;return(await Promise.all(n.items.map((s,o)=>x(n.templateFn(s,o),t)))).join("")}if(Ct(e)){let n=e,r=await x(n.fallback,t);if(t){let s=`s${t.nextId++}`;return t.pending.push({id:s,promise:Promise.resolve(n.children)}),`<webjs-boundary id="${s}">${r}</webjs-boundary>`}return r}return N(e)?Ci(e,t):ot(String(e))}async function Ci(e,t){let{strings:n,values:r}=e,s="",o="text",i="",c=0,a="",l=0,f="",p="";for(let u=0;u<n.length;u++){let b=n[u];for(let g=0;g<b.length;g++){let m=b[g];switch(o){case"text":s+=m,m==="<"&&(o="tag-open");break;case"tag-open":s+=m,m==="!"?o="bang-1":m==="/"?(o="tag-name",f=""):/[a-zA-Z]/.test(m)?(o="tag-name",f=m.toLowerCase()):o="text";break;case"bang-1":s+=m,o=m==="-"?"bang-dash":"tag-name";break;case"bang-dash":s+=m,m==="-"?(o="comment",l=0):o="tag-name";break;case"comment":s+=m,m==="-"?l+=1:(m===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":s+=m,m===">"?(o=kt(f)?"rawtext":"text",o==="rawtext"&&(p="")):/\s/.test(m)?o="in-tag":f+=m.toLowerCase();break;case"in-tag":s+=m,m===">"?(o=kt(f)?"rawtext":"text",o==="rawtext"&&(p="")):!/\s/.test(m)&&m!=="/"&&(o="attr-name",i=m,c=s.length-1);break;case"rawtext":s+=m,p=(p+m.toLowerCase()).slice(-9),(p.endsWith("<\/script>")||p.endsWith("</style>"))&&(o="text",p="",f="");break;case"attr-name":m==="="?(o="after-eq",s+=m):/\s/.test(m)?(o="in-tag",i="",s+=m):m===">"?(o="text",i="",s+=m):(i+=m,s+=m);break;case"after-eq":m==='"'||m==="'"?(o="attr-quoted",a=m,s+=m):/\s/.test(m)?(o="in-tag",i="",s+=m):m===">"?(o="text",i="",s+=m):(o="attr-unquoted",s+=m);break;case"attr-unquoted":/\s/.test(m)?(o="in-tag",i="",s+=m):(m===">"&&(o="text",i=""),s+=m);break;case"attr-quoted":s+=m,m===a&&(o="in-tag",i="");break}}if(u<r.length){let g=r[u];if(g&&typeof g.then=="function"&&(g=await g),o==="comment")s+=String(g??""),l=0;else if(o==="rawtext")s+=String(g??""),p="";else if(o==="text")s+=await x(g,t);else if(o==="after-eq"){let m=i[0],h=i.slice(1);if(m==="@")s=s.slice(0,c),o="in-tag",i="";else if(m==="."){if(s=s.slice(0,c),f==="webjs-suspense"&&h==="fallback"){let d=await x(g,t);s+=`data-webjs-fallback="${$(d)}"`,o="in-tag",i="";continue}if(!f.includes("-")){o="in-tag",i="";continue}if(g===void 0){o="in-tag",i="";continue}try{let d=await ze(g);s+=`data-webjs-prop-${Bi(h)}="${$(d)}"`}catch(d){console.warn(`[webjs] property binding .${h} has an unserializable value during SSR. Dropping. The browser will see the property as undefined. Detail: ${d&&d.message}`)}o="in-tag",i=""}else m==="?"?(s=s.slice(0,c),g&&(s+=`${h}=""`),o="in-tag",i=""):(s+=`"${$(String(g??""))}"`,o="in-tag",i="")}else(o==="attr-quoted"||o==="attr-unquoted")&&(s+=$(String(g??"")))}}return s}var ki=new Set(["document","window","localStorage","sessionStorage","navigator","matchMedia","requestAnimationFrame","getComputedStyle","IntersectionObserver","MutationObserver","ResizeObserver"]),xi=new Set(["attachShadow","querySelector","querySelectorAll","getBoundingClientRect","focus","blur","scrollIntoView"]);function Ti(e){let t=e&&typeof e.message=="string"?e.message:"",n=/^(\w+) is not defined\b/.exec(t);return e instanceof ReferenceError&&n&&ki.has(n[1])?`\`${n[1]}\` is a browser-only global and is undefined during SSR.`:(n=/\.(\w+) is not a function\b/.exec(t),e instanceof TypeError&&n&&xi.has(n[1])?`\`${n[1]}\` is an HTMLElement method that does not exist on the server-side component instance during SSR.`:null)}function Ni(){return typeof process<"u"&&process.env&&!0}function Hr(e,t,n){if(!(n===void 0?!Ni():!!n))return"";let s=t&&t.message?t.message:String(t);return Kt`<div data-webjs-error="${e}" style="border:1px solid #f5c2c7;background:#f8d7da;color:#842029;padding:8px 12px;border-radius:6px;font:13px/1.4 system-ui,sans-serif">
4
4
  <strong>&lt;${e}&gt; failed to render</strong>
5
5
  <div style="margin-top:4px;white-space:pre-wrap">${s}</div>
6
- </div>`}async function Y(e,t,n=[],r){e=await _i(e,t,n,r);let s=dn();if(!s.length)return e;let o=[...s].sort((h,u)=>u.length-h.length),i=new RegExp(`<(${o.map(We).join("|")})(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^>])*?)(/?)>`,"g"),a=[];for(let h of e.matchAll(i)){let[u,b,g,m]=h,p=fn(b);if(!p)continue;t&&t.usedComponents&&t.usedComponents.add(b);let d=m?`<${b}${g}>`:u,y=null;try{let w=p.shadow===!0;y=new p,y.__ssrTag=b,y.__ssrAncestors=n;let S=Or(g),A=Ti(S),v=new Set(Object.keys(Or(g)).map(E=>E.toLowerCase()));Ci(y,S),xi(y,S,p);for(let[E,_]of Object.entries(A))y[E]=_;typeof y.performServerUpdate=="function"&&y.performServerUpdate();let T=y.render?y.render():"";T&&typeof T.then=="function"&&(T=await T),d=vi(d,y,v);let I=await k(T,t);if(w){let E=await Y(I,t,[...n,y],r),_=p.styles,$=Array.isArray(_)?_:_&&me(_)?[_]:[],pe=tt($);a.push({start:h.index,end:h.index+u.length,text:`${d}<template shadowrootmode="open">${pe}${E}</template>`})}else{if(I.trim()===""){a.push({start:h.index,end:h.index+u.length,text:`${d}<!--webjs-hydrate-->`});continue}let _="",$=h.index+u.length;if(!m){let qt=h.index+u.length,et=ze(e,qt,b);if(et!==-1){_=e.slice(qt,et);let Is=new RegExp(`</${We(b)}\\s*>`,"i"),$s=e.slice(et),Wn=Is.exec($s),Ps=Wn?Wn[0].length:`</${b}>`.length;$=et+Ps}else _=e.slice(qt),$=e.length}let pe=Ai(_),Qe=Ei(I,pe),Ms=await Y(Qe,t,[...n,y],r);a.push({start:h.index,end:$,text:`${d}<!--webjs-hydrate-->${Ms}</${b}>`})}}catch(w){let S=bi(w);console.error(S?`[webjs] SSR failed for <${b}>: ${S} It was touched in the component's constructor or render(), which run during SSR. Move browser-only work to connectedCallback() or a lifecycle hook (firstUpdated/updated), which SSR never calls; seed first-paint defaults in the constructor only from server-known inputs (attributes / props).`:`[webjs] SSR failed for <${b}>:`,w);let A=w instanceof Error?w:new Error(String(w)),v="";try{let _;y&&typeof y.renderError=="function"&&(_=y.renderError(A)),_===void 0&&(_=Mr(b,A,r)),v=await k(_,t),v.trim()&&(v=await Y(v,t,y?[...n,y]:n,r))}catch(_){console.error(`[webjs] renderError() for <${b}> also threw:`,_),v=""}let T=h.index+u.length;if(!m){let _=h.index+u.length,$=ze(e,_,b);if($!==-1){let Qe=new RegExp(`</${We(b)}\\s*>`,"i").exec(e.slice($));T=$+(Qe?Qe[0].length:`</${b}>`.length)}else T=e.length}let I=p.shadow===!0,E;if(I){let _=p.styles,$=Array.isArray(_)?_:_&&me(_)?[_]:[],pe=tt($);E=`${d}<template shadowrootmode="open">${pe}${v}</template>`}else E=`${d}<!--webjs-hydrate-->${v}</${b}>`;a.push({start:h.index,end:T,text:E})}}if(!a.length)return e;a.sort((h,u)=>h.start-u.start);let c=[],l=-1;for(let h of a)h.start>=l&&(c.push(h),l=h.end);let f=e;for(let h=c.length-1;h>=0;h--){let{start:u,end:b,text:g}=c[h];f=f.slice(0,u)+g+f.slice(b)}return f}var yi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function wi(e){return yi.has(e.toLowerCase())}async function _i(e,t,n=[],r){if(e.indexOf("<webjs-suspense")===-1)return e;let s=/<webjs-suspense((?:"[^"]*"|'[^']*'|[^>])*?)>/i,o="",i=e;for(let a=0;a<1e4;a++){let c=s.exec(i);if(!c){o+=i;break}let l=c.index,f=c.index+c[0].length;o+=i.slice(0,l);let h=c[1]||"",u=/data-webjs-fallback="([^"]*)"/i.exec(h),b=u?Et(u[1]):"",g=ze(i,f,"webjs-suspense"),m,p;if(g===-1)m=i.slice(f),p="";else{m=i.slice(f,g);let d=/<\/webjs-suspense\s*>/i.exec(i.slice(g));p=i.slice(g+(d?d[0].length:17))}if(t){let d=`s${t.nextId++}`;t.pending.push({id:d,promise:Promise.resolve(Wt(m))}),o+=`<webjs-suspense id="${d}">${b}</webjs-suspense>`}else{let d=await Y(m,t,n,r);o+=`<webjs-suspense>${d}</webjs-suspense>`}i=p}return o}function ze(e,t,n){let r=We(n),s=new RegExp(`<${r}(?:[\\s>/])`,"gi"),o=new RegExp(`</${r}\\s*>`,"gi");s.lastIndex=t,o.lastIndex=t;let i=1;for(;i>0;){let a=s.exec(e),c=o.exec(e);if(!c)return-1;if(a&&a.index<c.index)i++,o.lastIndex=a.index+1;else{if(i--,i===0)return c.index;s.lastIndex=c.index+1}}return-1}function Si(e){let t=/\bslot\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(e);if(!t)return null;let n=t[1]??t[2]??t[3]??"";return n===""?null:n}function Ai(e){let t=new Map,n="",r=0;for(;r<e.length;){let s=e.indexOf("<",r);if(s===-1){n+=e.slice(r);break}s>r&&(n+=e.slice(r,s));let o=e.slice(s);if(o.startsWith("<!--")){let p=e.indexOf("-->",s+4);if(p===-1){n+=o,r=e.length;break}n+=e.slice(s,p+3),r=p+3;continue}if(o.startsWith("<!")||o.startsWith("</")){let p=e.indexOf(">",s);if(p===-1){n+=o,r=e.length;break}n+=e.slice(s,p+1),r=p+1;continue}let i=/^<([a-zA-Z][\w-]*)((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/.exec(o);if(!i){n+="<",r=s+1;continue}let[a,c,l,f]=i,h=c.toLowerCase(),u=!!f||wi(h),b=Si(l),g;if(u)g=s+a.length;else{let p=s+a.length,d=ze(e,p,h);if(d===-1){let v=e.slice(s);b!==null?Lr(t,b,v):n+=v,r=e.length;continue}let y=new RegExp(`</${We(h)}\\s*>`,"i"),w=e.slice(d),S=y.exec(w),A=S?S[0].length:`</${h}>`.length;g=d+A}let m=e.slice(s,g);b!==null?Lr(t,b,m):n+=m,r=g}return n.length>0&&t.set(null,n),t}function Lr(e,t,n){let r=e.get(t);r!==void 0?e.set(t,r+n):e.set(t,n)}function Ei(e,t){let n=new Set,r="",s=0,o=/<slot((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/gi,i;for(;(i=o.exec(e))!==null;){r+=e.slice(s,i.index);let[a,c,l]=i,f=!!l,h=/\bname\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(c),u=h?h[1]??h[2]??h[3]:null,b=c.replace(/\bname\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,"").trim(),g="",m;if(f)m=i.index+a.length;else{let w=i.index+a.length,S=ze(e,w,"slot");if(S===-1)g=e.slice(w),m=e.length;else{g=e.slice(w,S);let A=/<\/slot\s*>/i,v=e.slice(S),T=A.exec(v),I=T?T[0].length:7;m=S+I}}let p=t.get(u),d=u!==null?` name="${P(u)}"`:"",y=b?` ${b}`:"";p!==void 0&&!n.has(u)?(n.add(u),r+=`<slot data-webjs-light data-projection="actual"${d}${y}>${p}</slot>`):r+=`<slot data-webjs-light data-projection="fallback"${d}${y}>${g}</slot>`,s=m,o.lastIndex=m}return r+=e.slice(s),r}function We(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function At(e){return e==="script"||e==="style"}function Or(e){let t={},n=/([a-zA-Z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2]??r[3]??r[4]??"";return t}function Ci(e,t){if(!(!e||typeof e.setAttribute!="function"))for(let[n,r]of Object.entries(t))e.setAttribute(n,Et(r))}function vi(e,t,n){if(!t||typeof t.getAttributeNames!="function")return e;let r="";for(let s of t.getAttributeNames()){let o=String(s).toLowerCase();if(n.has(o))continue;let i=t.getAttribute(s);r+=i===""?` ${o}`:` ${o}="${P(String(i))}"`}return r?`${e.slice(0,-1)}${r}>`:e}function xi(e,t,n){let r=n.properties||{};for(let[s,o]of Object.entries(t)){let i=r[s]||r[bn(s)],a=r[s]?s:bn(s);if(!i){e[a]=o;continue}if(i.type===Number)e[a]=Number(o);else if(i.type===Boolean)e[a]=o!=="false";else if(i.type===Object||i.type===Array)try{e[a]=JSON.parse(Et(o))}catch{e[a]=o}else e[a]=o}}function bn(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ki(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Et(e){return e.replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function Ti(e){let t={};for(let n of Object.keys(e)){if(!n.startsWith("data-webjs-prop-"))continue;let r=bn(n.slice(16));try{t[r]=D(Et(e[n]))}catch{}delete e[n]}return t}function Ni(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;return n&&n.dev===void 0&&r!==void 0&&(n.dev=r),new ReadableStream({async start(s){try{if(t&&t.ssr===!1)await R(e,n,s);else{let o=await k(e,n),i=await Y(o,n,[],r);s.enqueue(i)}n&&n.pending.length&&await Ri(n,s,r),s.close()}catch(o){s.error(o)}}})}async function R(e,t,n){if(!(e==null||e===!1||e===!0)){if(e&&typeof e.then=="function")return e=await e,R(e,t,n);if(be(e)){n.enqueue(String(e.value??""));return}if(ge(e))return R(e.value,t,n);if(se(e))return R(e.signal.get(),t,n);if(Q(e))return R(e.value,t,n);if(ee(e))return R(e.fn(),t,n);if(ye(e)){let r=e.template;n.enqueue(String(r?.innerHTML??""));return}if(!te(e)){if(ne(e))return R(e.value,t,n);if(re(e)){let r=e.args;for(let s of r)if(!s||typeof s.then!="function")return R(s,t,n);if(r.length>0)try{let s=await Promise.race(r.map(o=>Promise.resolve(o).catch(()=>{})));return R(s,t,n)}catch{return}return}if(!(we(e)||_e(e))){if(Array.isArray(e)){for(let r of e)await R(r,t,n);return}if(Z(e)){let r=e;for(let s=0;s<r.items.length;s++)await R(r.templateFn(r.items[s],s),t,n);return}if(St(e)){let r=e;if(t){let s=`s${t.nextId++}`;n.enqueue(`<webjs-boundary id="${s}">`),await R(r.fallback,t,n),n.enqueue("</webjs-boundary>"),t.pending.push({id:s,promise:Promise.resolve(r.children)})}else await R(r.fallback,t,n);return}if(N(e)){await ji(e,t,n);return}n.enqueue(nt(String(e)))}}}}async function ji(e,t,n){let{strings:r,values:s}=e,o="text",i="",a=0,c="",l=0,f="",h="",u="";for(let b=0;b<r.length;b++){let g=r[b];for(let m=0;m<g.length;m++){let p=g[m];switch(o){case"text":u+=p,p==="<"&&(o="tag-open");break;case"tag-open":u+=p,p==="!"?o="bang-1":p==="/"?(o="tag-name",f=""):/[a-zA-Z]/.test(p)?(o="tag-name",f=p.toLowerCase()):o="text";break;case"bang-1":u+=p,o=p==="-"?"bang-dash":"tag-name";break;case"bang-dash":u+=p,p==="-"?(o="comment",l=0):o="tag-name";break;case"comment":u+=p,p==="-"?l+=1:(p===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":u+=p,p===">"?(o=At(f)?"rawtext":"text",o==="rawtext"&&(h="")):/\s/.test(p)?o="in-tag":f+=p.toLowerCase();break;case"in-tag":u+=p,p===">"?(o=At(f)?"rawtext":"text",o==="rawtext"&&(h="")):!/\s/.test(p)&&p!=="/"&&(o="attr-name",i=p,a=u.length-1);break;case"rawtext":u+=p,h=(h+p.toLowerCase()).slice(-9),(h.endsWith("<\/script>")||h.endsWith("</style>"))&&(o="text",h="",f="");break;case"attr-name":p==="="?(o="after-eq",u+=p):/\s/.test(p)?(o="in-tag",i="",u+=p):p===">"?(o="text",i="",u+=p):(i+=p,u+=p);break;case"after-eq":p==='"'||p==="'"?(o="attr-quoted",c=p,u+=p):/\s/.test(p)?(o="in-tag",i="",u+=p):p===">"?(o="text",i="",u+=p):(o="attr-unquoted",u+=p);break;case"attr-unquoted":/\s/.test(p)?(o="in-tag",i="",u+=p):(p===">"&&(o="text",i=""),u+=p);break;case"attr-quoted":u+=p,p===c&&(o="in-tag",i="");break}}if(b<s.length){let m=s[b];if(m&&typeof m.then=="function"&&(m=await m),o==="comment")u+=String(m??""),l=0;else if(o==="rawtext")u+=String(m??""),h="";else if(o==="text")u&&(n.enqueue(u),u=""),await R(m,t,n);else if(o==="after-eq"){let p=i[0],d=i.slice(1);p==="@"||p==="."?(u=u.slice(0,a),o="in-tag",i=""):p==="?"?(u=u.slice(0,a),m&&(u+=`${d}=""`),o="in-tag",i=""):(u+=`"${P(String(m??""))}"`,o="in-tag",i="")}else(o==="attr-quoted"||o==="attr-unquoted")&&(u+=P(String(m??"")))}}u&&n.enqueue(u)}async function Ri(e,t,n){let r=mn(),s=r?` nonce="${P(r)}"`:"";for(;e.pending.length;){let o=e.pending.splice(0);await Promise.all(o.map(async({id:i,promise:a})=>{try{let c=await a,l=await k(c,e),f=await Y(l,e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${s}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(c){console.error(`[webjs] Suspense boundary "${i}" rejected:`,c);try{let l=c instanceof Error?c:new Error(String(c)),f=await Y(await k(Mr("webjs-suspense",l,n),e),e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${s}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(l){console.error(`[webjs] Suspense boundary "${i}" error render also threw:`,l)}}}))}}var Ir=Symbol.for("webjs.notFound"),$r=Symbol.for("webjs.redirect");function Li(){let e=new Error("webjs: notFound()");throw e.__webjs=Ir,e}function Oi(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=$r,r.url=e,r.status=typeof n=="number"?n:void 0,r}function Mi(e){return!!e&&e.__webjs===Ir}function Ii(e){return!!e&&e.__webjs===$r}function $i(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function a(){s||(o=new WebSocket(Pi(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 Pi(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}`}xe();var gn="application/vnd.webjs+json";async function Fi(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",gn);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 He(r),n.has("content-type")||n.set("content-type",gn));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),a=o.includes(gn)?i?D(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}xe();Sn();_n();vt();async function ya(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}Cn();var Bt=0,Ls=new Map,Oe=new Map,wa=1e3;function _a(e){if(!(!Array.isArray(e)||!e.length)){Bt+=1;for(let t of e)t&&Ls.set(t,Bt)}}function Sa(){return Bt}function Aa(e,t,n){if(!(!Array.isArray(t)||!t.length)&&(Oe.delete(e),Oe.set(e,{tags:t.slice(),since:typeof n=="number"?n:Bt}),Oe.size>wa)){let r=Oe.keys().next().value;r!==void 0&&Oe.delete(r)}}function Ea(e){let t=Oe.get(e);if(!t)return!1;for(let n of t.tags)if((Ls.get(n)||0)>t.since)return!0;return!1}function Ca(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}var va="application/vnd.webjs+stream",xa=1,ka=2,Ta=3,Os=new Uint8Array(0);function Na(e,t){let n=t||Os,r=n.length,s=new Uint8Array(5+r);return s[0]=e&255,s[1]=r>>>24&255,s[2]=r>>>16&255,s[3]=r>>>8&255,s[4]=r&255,r&&s.set(n,5),s}function ja(){let e=Os;return{push(t){if(t&&t.length){let r=new Uint8Array(e.length+t.length);r.set(e,0),r.set(t,e.length),e=r}let n=[];for(;e.length>=5;){let r=e[0],s=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;if(e.length<5+s)break;let o=e.slice(5,5+s);n.push({type:r,payload:o}),e=e.slice(5+s)}return n}}}var Ra=Symbol.for("webjs.context");function La(e){return{__context__:Ra,name:e}}var Ut=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},qn=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()}},Dn=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 Ut(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 Oa(){return typeof window<"u"}var H={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},Hn=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=H.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=H.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=H.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=H.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 H.INITIAL:return t.initial?.();case H.PENDING:return t.pending?.();case H.COMPLETE:return t.complete?.(this._value);case H.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!Oa())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{Dn as ContextConsumer,qn as ContextProvider,Ut as ContextRequestEvent,xa as FRAME_CHUNK,ka as FRAME_END,Ta as FRAME_ERROR,C as MARKER,Vr as SEED_MISS,va as STREAM_CONTENT_TYPE,$e as Signal,ui as Suspense,Hn as Task,H as TaskStatus,hn as WebComponent,wn as WebjsFrame,An as WebjsStream,Wo as activeActionSignal,Ht as adoptStyles,dn as allTags,Gs as asyncAppend,Ys as asyncReplace,oo as batch,Vs as cache,ao as computed,$i as connectWS,Ea as consumeStale,La as createContext,ja as createFrameDecoder,zs as createRef,mn as cspNonce,Bs as css,kr as deserialize,Zr as disableClientRouter,lo as effect,Rn as enableClientRouter,Na as encodeFrame,P as escapeAttr,nt as escapeText,Sa as fetchMark,Ds as guard,Dt as html,we as isAsyncAppend,_e as isAsyncReplace,me as isCSS,ne as isCache,ee as isGuard,Q as isKeyed,Ko as isLazy,ge as isLive,Mi as isNotFound,Ii as isRedirect,te as isRef,Z as isRepeat,co as isSignal,St as isSuspense,N as isTemplate,ye as isTemplateContent,be as isUnsafeHTML,re as isUntil,se as isWatch,qs as keyed,Us as live,fn as lookup,Vo as lookupModuleUrl,_a as markStale,Qr as navigate,Li as notFound,ya as optimistic,D as parse,Ca as parseTagHeader,zo as primeModuleUrl,Oi as redirect,Ws as ref,un as register,Aa as registerKeyTags,ve as render,En as renderStream,Ni as renderToStream,di as renderToString,Kn as repeat,es as revalidate,Fi as richFetch,xt as scanSeeds,xr as serialize,bt as setActiveActionSignal,fi as setCspNonceProvider,io as signal,He as stringify,tt as stylesToString,wt as tagOf,zi as takeSeed,Hs as templateContent,Wt as unsafeHTML,Ks as until,Js as watch};
6
+ </div>`}async function Y(e,t,n=[],r){e=await Li(e,t,n,r);let s=gn();if(!s.length)return e;let o=[...s].sort((p,u)=>u.length-p.length),i=new RegExp(`<(${o.map(Ke).join("|")})(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^>])*?)(/?)>`,"g"),c=[];for(let p of e.matchAll(i)){let[u,b,g,m]=p,h=bn(b);if(!h)continue;t&&t.usedComponents&&t.usedComponents.add(b);let d=m?`<${b}${g}>`:u,y=null;try{let w=h.shadow===!0;y=new h,y.__ssrTag=b,y.__ssrAncestors=n;let S=Dr(g),A=Ui(S),C=new Set(Object.keys(Dr(g)).map(E=>E.toLowerCase()));Pi(y,S),Fi(y,S,h);for(let[E,_]of Object.entries(A))y[E]=_;typeof y.performServerUpdate=="function"&&y.performServerUpdate();let T=y.render?y.render():"";T&&typeof T.then=="function"&&(T=await T),d=$i(d,y,C);let I=await x(T,t);if(w){let E=await Y(I,t,[...n,y],r),_=h.styles,P=Array.isArray(_)?_:_&&me(_)?[_]:[],he=st(P);c.push({start:p.index,end:p.index+u.length,text:`${d}<template shadowrootmode="open">${he}${E}</template>`})}else{if(I.trim()===""){c.push({start:p.index,end:p.index+u.length,text:`${d}<!--webjs-hydrate-->`});continue}let _="",P=p.index+u.length;if(!m){let zt=p.index+u.length,rt=Ge(e,zt,b);if(rt!==-1){_=e.slice(zt,rt);let zs=new RegExp(`</${Ke(b)}\\s*>`,"i"),Ks=e.slice(rt),Xn=zs.exec(Ks),Gs=Xn?Xn[0].length:`</${b}>`.length;P=rt+Gs}else _=e.slice(zt),P=e.length}let he=Mi(_),nt=Ii(I,he),Vs=await Y(nt,t,[...n,y],r);c.push({start:p.index,end:P,text:`${d}<!--webjs-hydrate-->${Vs}</${b}>`})}}catch(w){let S=Ti(w);console.error(S?`[webjs] SSR failed for <${b}>: ${S} It was touched in the component's constructor or render(), which run during SSR. Move browser-only work to connectedCallback() or a lifecycle hook (firstUpdated/updated), which SSR never calls; seed first-paint defaults in the constructor only from server-known inputs (attributes / props).`:`[webjs] SSR failed for <${b}>:`,w);let A=w instanceof Error?w:new Error(String(w)),C="";try{let _;y&&typeof y.renderError=="function"&&(_=y.renderError(A)),_===void 0&&(_=Hr(b,A,r)),C=await x(_,t),C.trim()&&(C=await Y(C,t,y?[...n,y]:n,r))}catch(_){console.error(`[webjs] renderError() for <${b}> also threw:`,_),C=""}let T=p.index+u.length;if(!m){let _=p.index+u.length,P=Ge(e,_,b);if(P!==-1){let nt=new RegExp(`</${Ke(b)}\\s*>`,"i").exec(e.slice(P));T=P+(nt?nt[0].length:`</${b}>`.length)}else T=e.length}let I=h.shadow===!0,E;if(I){let _=h.styles,P=Array.isArray(_)?_:_&&me(_)?[_]:[],he=st(P);E=`${d}<template shadowrootmode="open">${he}${C}</template>`}else E=`${d}<!--webjs-hydrate-->${C}</${b}>`;c.push({start:p.index,end:T,text:E})}}if(!c.length)return e;c.sort((p,u)=>p.start-u.start);let a=[],l=-1;for(let p of c)p.start>=l&&(a.push(p),l=p.end);let f=e;for(let p=a.length-1;p>=0;p--){let{start:u,end:b,text:g}=a[p];f=f.slice(0,u)+g+f.slice(b)}return f}var ji=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ri(e){return ji.has(e.toLowerCase())}async function Li(e,t,n=[],r){if(e.indexOf("<webjs-suspense")===-1)return e;let s=/<webjs-suspense((?:"[^"]*"|'[^']*'|[^>])*?)>/i,o="",i=e;for(let c=0;c<1e4;c++){let a=s.exec(i);if(!a){o+=i;break}let l=a.index,f=a.index+a[0].length;o+=i.slice(0,l);let p=a[1]||"",u=/data-webjs-fallback="([^"]*)"/i.exec(p),b=u?xt(u[1]):"",g=Ge(i,f,"webjs-suspense"),m,h;if(g===-1)m=i.slice(f),h="";else{m=i.slice(f,g);let d=/<\/webjs-suspense\s*>/i.exec(i.slice(g));h=i.slice(g+(d?d[0].length:17))}if(t){let d=`s${t.nextId++}`;t.pending.push({id:d,promise:Promise.resolve(Yt(m))}),o+=`<webjs-suspense id="${d}">${b}</webjs-suspense>`}else{let d=await Y(m,t,n,r);o+=`<webjs-suspense>${d}</webjs-suspense>`}i=h}return o}function Ge(e,t,n){let r=Ke(n),s=new RegExp(`<${r}(?:[\\s>/])`,"gi"),o=new RegExp(`</${r}\\s*>`,"gi");s.lastIndex=t,o.lastIndex=t;let i=1;for(;i>0;){let c=s.exec(e),a=o.exec(e);if(!a)return-1;if(c&&c.index<a.index)i++,o.lastIndex=c.index+1;else{if(i--,i===0)return a.index;s.lastIndex=a.index+1}}return-1}function Oi(e){let t=/\bslot\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(e);if(!t)return null;let n=t[1]??t[2]??t[3]??"";return n===""?null:n}function Mi(e){let t=new Map,n="",r=0;for(;r<e.length;){let s=e.indexOf("<",r);if(s===-1){n+=e.slice(r);break}s>r&&(n+=e.slice(r,s));let o=e.slice(s);if(o.startsWith("<!--")){let h=e.indexOf("-->",s+4);if(h===-1){n+=o,r=e.length;break}n+=e.slice(s,h+3),r=h+3;continue}if(o.startsWith("<!")||o.startsWith("</")){let h=e.indexOf(">",s);if(h===-1){n+=o,r=e.length;break}n+=e.slice(s,h+1),r=h+1;continue}let i=/^<([a-zA-Z][\w-]*)((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/.exec(o);if(!i){n+="<",r=s+1;continue}let[c,a,l,f]=i,p=a.toLowerCase(),u=!!f||Ri(p),b=Oi(l),g;if(u)g=s+c.length;else{let h=s+c.length,d=Ge(e,h,p);if(d===-1){let C=e.slice(s);b!==null?qr(t,b,C):n+=C,r=e.length;continue}let y=new RegExp(`</${Ke(p)}\\s*>`,"i"),w=e.slice(d),S=y.exec(w),A=S?S[0].length:`</${p}>`.length;g=d+A}let m=e.slice(s,g);b!==null?qr(t,b,m):n+=m,r=g}return n.length>0&&t.set(null,n),t}function qr(e,t,n){let r=e.get(t);r!==void 0?e.set(t,r+n):e.set(t,n)}function Ii(e,t){let n=new Set,r="",s=0,o=/<slot((?:"[^"]*"|'[^']*'|[^>])*?)(\/?)>/gi,i;for(;(i=o.exec(e))!==null;){r+=e.slice(s,i.index);let[c,a,l]=i,f=!!l,p=/\bname\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(a),u=p?p[1]??p[2]??p[3]:null,b=a.replace(/\bname\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i,"").trim(),g="",m;if(f)m=i.index+c.length;else{let w=i.index+c.length,S=Ge(e,w,"slot");if(S===-1)g=e.slice(w),m=e.length;else{g=e.slice(w,S);let A=/<\/slot\s*>/i,C=e.slice(S),T=A.exec(C),I=T?T[0].length:7;m=S+I}}let h=t.get(u),d=u!==null?` name="${$(u)}"`:"",y=b?` ${b}`:"";h!==void 0&&!n.has(u)?(n.add(u),r+=`<slot data-webjs-light data-projection="actual"${d}${y}>${h}</slot>`):r+=`<slot data-webjs-light data-projection="fallback"${d}${y}>${g}</slot>`,s=m,o.lastIndex=m}return r+=e.slice(s),r}function Ke(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kt(e){return e==="script"||e==="style"}function Dr(e){let t={},n=/([a-zA-Z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2]??r[3]??r[4]??"";return t}function Pi(e,t){if(!(!e||typeof e.setAttribute!="function"))for(let[n,r]of Object.entries(t))e.setAttribute(n,xt(r))}function $i(e,t,n){if(!t||typeof t.getAttributeNames!="function")return e;let r="";for(let s of t.getAttributeNames()){let o=String(s).toLowerCase();if(n.has(o))continue;let i=t.getAttribute(s);r+=i===""?` ${o}`:` ${o}="${$(String(i))}"`}return r?`${e.slice(0,-1)}${r}>`:e}function Fi(e,t,n){let r=n.properties||{};for(let[s,o]of Object.entries(t)){let i=r[s]||r[_n(s)],c=r[s]?s:_n(s);if(!i){e[c]=o;continue}let a=typeof i=="object"?i:{type:i};if(a.type===Number)e[c]=Number(o);else if(a.type===Boolean)e[c]=o!=="false";else if(a.type===Object||a.type===Array)try{e[c]=JSON.parse(xt(o))}catch{e[c]=o}else e[c]=o}}function _n(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Bi(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function xt(e){return e.replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function Ui(e){let t={};for(let n of Object.keys(e)){if(!n.startsWith("data-webjs-prop-"))continue;let r=_n(n.slice(16));try{t[r]=D(xt(e[n]))}catch{}delete e[n]}return t}function qi(e,t={ssr:!0}){let n=t&&t.suspenseCtx,r=t&&t.dev!==void 0?t.dev:n&&n.dev;return n&&n.dev===void 0&&r!==void 0&&(n.dev=r),new ReadableStream({async start(s){try{if(t&&t.ssr===!1)await R(e,n,s);else{let o=await x(e,n),i=await Y(o,n,[],r);s.enqueue(i)}n&&n.pending.length&&await Hi(n,s,r),s.close()}catch(o){s.error(o)}}})}async function R(e,t,n){if(!(e==null||e===!1||e===!0)){if(e&&typeof e.then=="function")return e=await e,R(e,t,n);if(be(e)){n.enqueue(String(e.value??""));return}if(ge(e))return R(e.value,t,n);if(oe(e))return R(e.signal.get(),t,n);if(ee(e))return R(e.value,t,n);if(te(e))return R(e.fn(),t,n);if(ye(e)){let r=e.template;n.enqueue(String(r?.innerHTML??""));return}if(!ne(e)){if(re(e))return R(e.value,t,n);if(se(e)){let r=e.args;for(let s of r)if(!s||typeof s.then!="function")return R(s,t,n);if(r.length>0)try{let s=await Promise.race(r.map(o=>Promise.resolve(o).catch(()=>{})));return R(s,t,n)}catch{return}return}if(!(we(e)||_e(e))){if(Array.isArray(e)){for(let r of e)await R(r,t,n);return}if(Q(e)){let r=e;for(let s=0;s<r.items.length;s++)await R(r.templateFn(r.items[s],s),t,n);return}if(Ct(e)){let r=e;if(t){let s=`s${t.nextId++}`;n.enqueue(`<webjs-boundary id="${s}">`),await R(r.fallback,t,n),n.enqueue("</webjs-boundary>"),t.pending.push({id:s,promise:Promise.resolve(r.children)})}else await R(r.fallback,t,n);return}if(N(e)){await Di(e,t,n);return}n.enqueue(ot(String(e)))}}}}async function Di(e,t,n){let{strings:r,values:s}=e,o="text",i="",c=0,a="",l=0,f="",p="",u="";for(let b=0;b<r.length;b++){let g=r[b];for(let m=0;m<g.length;m++){let h=g[m];switch(o){case"text":u+=h,h==="<"&&(o="tag-open");break;case"tag-open":u+=h,h==="!"?o="bang-1":h==="/"?(o="tag-name",f=""):/[a-zA-Z]/.test(h)?(o="tag-name",f=h.toLowerCase()):o="text";break;case"bang-1":u+=h,o=h==="-"?"bang-dash":"tag-name";break;case"bang-dash":u+=h,h==="-"?(o="comment",l=0):o="tag-name";break;case"comment":u+=h,h==="-"?l+=1:(h===">"&&l>=2&&(o="text"),l=0);break;case"tag-name":u+=h,h===">"?(o=kt(f)?"rawtext":"text",o==="rawtext"&&(p="")):/\s/.test(h)?o="in-tag":f+=h.toLowerCase();break;case"in-tag":u+=h,h===">"?(o=kt(f)?"rawtext":"text",o==="rawtext"&&(p="")):!/\s/.test(h)&&h!=="/"&&(o="attr-name",i=h,c=u.length-1);break;case"rawtext":u+=h,p=(p+h.toLowerCase()).slice(-9),(p.endsWith("<\/script>")||p.endsWith("</style>"))&&(o="text",p="",f="");break;case"attr-name":h==="="?(o="after-eq",u+=h):/\s/.test(h)?(o="in-tag",i="",u+=h):h===">"?(o="text",i="",u+=h):(i+=h,u+=h);break;case"after-eq":h==='"'||h==="'"?(o="attr-quoted",a=h,u+=h):/\s/.test(h)?(o="in-tag",i="",u+=h):h===">"?(o="text",i="",u+=h):(o="attr-unquoted",u+=h);break;case"attr-unquoted":/\s/.test(h)?(o="in-tag",i="",u+=h):(h===">"&&(o="text",i=""),u+=h);break;case"attr-quoted":u+=h,h===a&&(o="in-tag",i="");break}}if(b<s.length){let m=s[b];if(m&&typeof m.then=="function"&&(m=await m),o==="comment")u+=String(m??""),l=0;else if(o==="rawtext")u+=String(m??""),p="";else if(o==="text")u&&(n.enqueue(u),u=""),await R(m,t,n);else if(o==="after-eq"){let h=i[0],d=i.slice(1);h==="@"||h==="."?(u=u.slice(0,c),o="in-tag",i=""):h==="?"?(u=u.slice(0,c),m&&(u+=`${d}=""`),o="in-tag",i=""):(u+=`"${$(String(m??""))}"`,o="in-tag",i="")}else(o==="attr-quoted"||o==="attr-unquoted")&&(u+=$(String(m??"")))}}u&&n.enqueue(u)}async function Hi(e,t,n){let r=wn(),s=r?` nonce="${$(r)}"`:"";for(;e.pending.length;){let o=e.pending.splice(0);await Promise.all(o.map(async({id:i,promise:c})=>{try{let a=await c,l=await x(a,e),f=await Y(l,e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${s}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(a){console.error(`[webjs] Suspense boundary "${i}" rejected:`,a);try{let l=a instanceof Error?a:new Error(String(a)),f=await Y(await x(Hr("webjs-suspense",l,n),e),e,[],n);t.enqueue(`<template data-webjs-resolve="${i}">${f}</template><script${s}>(function(){var t=document.currentScript.previousElementSibling;var b=document.getElementById("${i}");if(b&&t){b.replaceWith(t.content.cloneNode(true));t.remove()}document.currentScript.remove()})()<\/script>`)}catch(l){console.error(`[webjs] Suspense boundary "${i}" error render also threw:`,l)}}}))}}var Wr=Symbol.for("webjs.notFound"),Vr=Symbol.for("webjs.redirect");function Wi(){let e=new Error("webjs: notFound()");throw e.__webjs=Wr,e}function Vi(e,t){let n=typeof t=="object"&&t!==null?t.status:t,r=new Error(`webjs: redirect(${e})`);throw r.__webjs=Vr,r.url=e,r.status=typeof n=="number"?n:void 0,r}function zi(e){return!!e&&e.__webjs===Wr}function Ki(e){return!!e&&e.__webjs===Vr}function Gi(e,t={}){let n=t.reconnect!==!1,r=0,s=!1,o=null,i=[];function c(){s||(o=new WebSocket(Yi(e),t.protocols),o.onopen=a=>{for(r=0;i.length&&o&&o.readyState===WebSocket.OPEN;)o.send(i.shift());t.onOpen?.(a)},o.onmessage=a=>{let l=a.data;if(typeof l=="string")try{l=JSON.parse(l)}catch{}t.onMessage?.(l,a)},o.onerror=a=>{t.onError?.(a)},o.onclose=a=>{if(t.onClose?.(a),!s&&n){let l=Math.min(1e3*2**r++,3e4);setTimeout(c,l)}})}return c(),{send(a){let l=typeof a=="string"||a instanceof ArrayBuffer||ArrayBuffer.isView(a)?a:JSON.stringify(a);o&&o.readyState===WebSocket.OPEN?o.send(l):i.push(l)},close(a,l){s=!0;try{o?.close(a,l)}catch{}},get socket(){return o},get readyState(){return o?.readyState??3}}}function Yi(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}`}ke();var Sn="application/vnd.webjs+json";async function Ji(e,t={}){let n=new Headers(t.headers||{});n.has("accept")||n.set("accept",Sn);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 ze(r),n.has("content-type")||n.set("content-type",Sn));let s=await fetch(e,{...t,headers:n,body:r}),o=s.headers.get("content-type")||"",i=await s.text(),c=o.includes(Sn)?i?D(i):null:o.includes("application/json")?i?JSON.parse(i):null:i;if(!s.ok){let a=c&&c.error||`richFetch ${e} -> ${s.status}`,l=new Error(a);throw l.status=s.status,l.body=c,l}return c}ke();Cn();vn();Nt();async function Ra(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}Tn();var Wt=0,Hs=new Map,Pe=new Map,La=1e3;function Oa(e){if(!(!Array.isArray(e)||!e.length)){Wt+=1;for(let t of e)t&&Hs.set(t,Wt)}}function Ma(){return Wt}function Ia(e,t,n){if(!(!Array.isArray(t)||!t.length)&&(Pe.delete(e),Pe.set(e,{tags:t.slice(),since:typeof n=="number"?n:Wt}),Pe.size>La)){let r=Pe.keys().next().value;r!==void 0&&Pe.delete(r)}}function Pa(e){let t=Pe.get(e);if(!t)return!1;for(let n of t.tags)if((Hs.get(n)||0)>t.since)return!0;return!1}function $a(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}var Fa="application/vnd.webjs+stream",Ba=1,Ua=2,qa=3,Ws=new Uint8Array(0);function Da(e,t){let n=t||Ws,r=n.length,s=new Uint8Array(5+r);return s[0]=e&255,s[1]=r>>>24&255,s[2]=r>>>16&255,s[3]=r>>>8&255,s[4]=r&255,r&&s.set(n,5),s}function Ha(){let e=Ws;return{push(t){if(t&&t.length){let r=new Uint8Array(e.length+t.length);r.set(e,0),r.set(t,e.length),e=r}let n=[];for(;e.length>=5;){let r=e[0],s=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;if(e.length<5+s)break;let o=e.slice(5,5+s);n.push({type:r,payload:o}),e=e.slice(5+s)}return n}}}var Wa=Symbol.for("webjs.context");function Va(e){return{__context__:Wa,name:e}}var Vt=class extends Event{constructor(t,n,r=!1){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=n,this.subscribe=r}},Gn=class{constructor(t,{context:n,initialValue:r}){this._host=t,this._context=n,this._value=r,this._subscriptions=new Set,this._onRequest=s=>{let o=s;if(o.context===this._context)if(s.stopPropagation(),o.subscribe){let i={callback:o.callback},c=()=>{this._subscriptions.delete(i)};this._subscriptions.add(i),o.callback(this._value,c)}else o.callback(this._value)},typeof t.addController=="function"&&t.addController(this)}get value(){return this._value}setValue(t){if(!Object.is(this._value,t)){this._value=t;for(let n of this._subscriptions){let r=()=>{this._subscriptions.delete(n)};n.callback(t,r)}}}hostConnected(){this._host.addEventListener("context-request",this._onRequest)}hostDisconnected(){this._host.removeEventListener("context-request",this._onRequest),this._subscriptions.clear()}},Yn=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 Vt(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 za(){return typeof window<"u"}var H={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},Jn=class{constructor(t,{task:n,args:r,autoRun:s=!0}){this._host=t,this._taskFn=n,this._argsFn=r||(()=>[]),this._autoRun=s,this._status=H.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=H.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=H.COMPLETE,this._error=void 0}catch(r){if(t.signal.aborted)return;this._error=r,this._status=H.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 H.INITIAL:return t.initial?.();case H.PENDING:return t.pending?.();case H.COMPLETE:return t.complete?.(this._value);case H.ERROR:return t.error?.(this._error);default:return}}hostUpdate(){if(!this._autoRun||!za())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{Yn as ContextConsumer,Gn as ContextProvider,Vt as ContextRequestEvent,Ba as FRAME_CHUNK,Ua as FRAME_END,qa as FRAME_ERROR,v as MARKER,ts as SEED_MISS,Fa as STREAM_CONTENT_TYPE,Be as Signal,Ai as Suspense,Jn as Task,H as TaskStatus,vt as WebComponent,En as WebjsFrame,kn as WebjsStream,ti as activeActionSignal,Gt as adoptStyles,gn as allTags,oo as asyncAppend,io as asyncReplace,go as batch,ro as cache,wo as computed,Gi as connectWS,Pa as consumeStale,Va as createContext,Ha as createFrameDecoder,no as createRef,wn as cspNonce,Js as css,Mr as deserialize,as as disableClientRouter,So as effect,$n as enableClientRouter,Da as encodeFrame,$ as escapeAttr,ot as escapeText,Ma as fetchMark,Qs as guard,Kt as html,we as isAsyncAppend,_e as isAsyncReplace,me as isCSS,re as isCache,te as isGuard,ee as isKeyed,si as isLazy,ge as isLive,zi as isNotFound,Ki as isRedirect,ne as isRef,Q as isRepeat,_o as isSignal,Ct as isSuspense,N as isTemplate,ye as isTemplateContent,be as isUnsafeHTML,se as isUntil,oe as isWatch,Zs as keyed,Xs as live,bn as lookup,ri as lookupModuleUrl,Oa as markStale,cs as navigate,Wi as notFound,Ra as optimistic,D as parse,$a as parseTagHeader,ni as primeModuleUrl,Si as prop,Vi as redirect,to as ref,mn as register,Ia as registerKeyTags,Ce as render,xn as renderStream,qi as renderToStream,vi as renderToString,er as repeat,ls as revalidate,Ji as richFetch,jt as scanSeeds,Or as serialize,wt as setActiveActionSignal,Ei as setCspNonceProvider,yo as signal,ze as stringify,st as stylesToString,At as tagOf,ra as takeSeed,eo as templateContent,Yt as unsafeHTML,so as until,ao as watch};
7
7
  //# sourceMappingURL=webjs-core.js.map