@tempots/ui 15.0.1 → 16.0.0

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.
Files changed (3) hide show
  1. package/index.cjs +1 -1
  2. package/index.js +735 -1722
  3. package/package.json +4 -5
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),A=require("@tempots/std"),te=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},ee=(t,e)=>{const n=te(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},De=(t,e,n,o)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const i=s;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:r,search:a,hash:c}=i;if(o){const l=r+a+c,f=i.getAttribute("href");if(!f?.startsWith("#")&&f!==l)return!0}return e?!1:ee(n,r)},ne=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(o=>o.startsWith(".")?o:"."+o):[];return o=>{De(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},oe=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,ft=(t,e)=>{const n=new URL(t,e??u.getWindow()?.location.toString()),o=Object.fromEntries(n.searchParams?.entries()??[]);let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},q=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},Fe=t=>{document.startViewTransition?document.startViewTransition(t):t()},Nt=()=>{const t=u.getWindow(),e=t?.location.hash??"";return{pathname:t?.location.pathname??"",search:Object.fromEntries(new URLSearchParams(t?.location.search??"").entries()),hash:e.startsWith("#")?e.substring(1)||void 0:e===""?void 0:e}},_t=t=>{if(t?.scroll!=="auto")return;const e=u.getWindow();e&&e.requestAnimationFrame(()=>e.scrollTo({top:0,left:0,behavior:"auto"}))},Ut=(t,e)=>{e?.viewTransition?Fe(t):t()},Me=()=>{const t=u.prop(Nt(),oe),e=u.getWindow(),n=()=>{t.set(Nt())};e?.addEventListener("popstate",n),e?.addEventListener("hashchange",n);const o=(c,l,f)=>{Ut(()=>{if(e){const d=q(c),p=l?.state??{};f==="replaceState"||l?.replace?e.history.replaceState(p,"",d):e.history.pushState(p,"",d)}t.set(c)},l),_t(l)},s=(c,l)=>{Ut(()=>{e?.history.go(c)},l),_t(l)};return{location:t,commit:o,go:s,back:c=>s(-1,c),forward:c=>s(1,c),resolve:c=>ft(c),dispose:()=>{e?.removeEventListener("popstate",n),e?.removeEventListener("hashchange",n),t.dispose()}}},He=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Ve=t=>{const e=t.container.currentURL,n=e.iso(r=>ft(r,e.value),r=>{if(He(r.pathname))return q(r);const a=new URL(r.pathname,e.value),c=a.origin+a.pathname;return q({...r,pathname:c})});return{location:n,dispose:()=>{n.dispose()},commit:(r,a,c)=>{n.set(r)},go:(r,a)=>{},back:r=>{},forward:r=>{},resolve:r=>ft(r,e.value)}},et=t=>({pathname:t.pathname,search:{...t.search},hash:t.hash??void 0}),Ot=t=>{if(t==null)return;const e=`${t}`;return e===""?void 0:e},se=(t,e)=>{const n={...t};for(const[o,s]of Object.entries(e))s==null?delete n[o]:n[o]=s;return n},Ne=(t,e)=>{const n=e?.includeSearch??!0,o=e?.includeHash??!0,s=e?.ignoreSearchParams??[];let i;if(!n)i={};else if(s.length===0)i={...t.search};else{const r=new Set(s);i={};for(const[a,c]of Object.entries(t.search))r.has(a)||(i[a]=c)}return{pathname:t.pathname,search:i,hash:o?t.hash:void 0}},St=(t,e,n)=>{const o=Ne(t,n);return typeof e=="string"?q(o)===e:e instanceof RegExp?((e.global||e.sticky)&&(e.lastIndex=0),e.test(q(o))):e(o)};class _e{constructor(e){this.current=e}get location(){return this.current}setLocation(e){return this.current=et(e),this}setPathname(e){return this.current={...this.current,pathname:e},this}setHash(e){const n=Ot(e);if(n==null){const{hash:o,...s}=this.current;this.current=s}else this.current={...this.current,hash:n};return this}clearHash(){const{hash:e,...n}=this.current;return this.current=n,this}setSearch(e){return this.current={...this.current,search:se(this.current.search,e)},this}setSearchParam(e,n){return this.setSearch({[e]:n})}updateSearch(e){return this.current={...this.current,search:{...e({...this.current.search})}},this}}const Ue=(t,e)=>t?.replace?"replaceState":e,$e=t=>{const e=t.location,n=e.map(q),o=e.map(w=>w.pathname),s=e.map(w=>({...w.search})),i=e.map(w=>w.hash),r=(w,b)=>St(t.location.value,w,b),a=(w,b)=>u.computedOf(e,w)((O,k)=>St(O,k,b)),c=(w,b,O)=>{const k=et({...w,hash:Ot(w.hash??void 0)});t.commit(k,b,O)},l=(w,b)=>{const O=Ue(b,"pushState");c(w,b,O)},f=(w,b)=>{const O=w(et(t.location.value));l(O,b)},d=(w,b)=>{const O=t.resolve(w);l(O,b)},p=(w,b)=>{const O={...b,replace:!0};d(w,O)},h=(w,b)=>{t.go(w,b)},m=w=>{t.back(w)},x=w=>{t.forward(w)},g=(w,b)=>f(O=>({...O,pathname:w}),b),v=(w,b)=>f(O=>{const k={...O},$=Ot(w);return $==null?delete k.hash:k.hash=$,k},b),R=w=>v(void 0,w),y=(w,b)=>f(O=>({...O,search:se(O.search,w)}),b);return{handle:{location:e,url:n,pathname:o,search:s,hash:i,setLocation:l,updateLocation:f,navigate:d,replace:p,go:h,back:m,forward:x,setPathname:g,setHash:v,clearHash:R,setSearch:y,setSearchParam:(w,b,O)=>y({[w]:b},O),updateSearch:(w,b)=>f(O=>({...O,search:{...w({...O.search})}}),b),queryParam:w=>e.map(b=>b.search[w]),run:(w,b)=>{const O=new _e(et(t.location.value));w(O),l(et(O.location),b)},match:r,matchSignal:a},dispose:()=>{t.dispose(),n.dispose(),o.dispose(),s.dispose(),i.dispose()}}},ze=t=>{if(t.isBrowser())return Me();if(t.isHeadless())return Ve(t);throw new Error("Unknown context")},wt={mark:u.makeProviderMark("Location"),create:(t,e)=>{const n=ze(e),{handle:o,dispose:s}=$e(n);return{value:o,dispose:s}}},re=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return re({href:t},...e);const{href:n,state:o,scroll:s,viewTransition:i,replace:r,...a}=t;return u.Use(wt,c=>u.html.a(u.on.click(ne(()=>{let l=!1;const f={};return o!==void 0&&(f.state=o,l=!0),s!==void 0&&(f.scroll=s,l=!0),i!==void 0&&(f.viewTransition=i,l=!0),r!==void 0&&(f.replace=r,l=!0),c.navigate(u.Value.get(n),l?f:void 0),!0},a)),u.attr.href(n),...e))},Be={mark:u.makeProviderMark("Appearance"),create:()=>{const t=ie();return{value:t,dispose:t.dispose}}};function ie(){const t=u.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=e?.matches??!1,o=u.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e?.addEventListener("change",s),o.onDispose(()=>e?.removeEventListener("change",s)),o}const Tt=(t,e)=>{if(typeof e=="function")return Tt(t,{success:e});const n=e.failure??(r=>r.map(a=>`Error: ${a}`)),o=e.success,s=e.loading??(()=>u.Empty),i=e.notAsked??(()=>u.Empty);return u.OneOfType(u.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(a=>a.previousValue)),NotAsked:i})},Ke=(t=10)=>u.WithElement(e=>u.OnDispose(A.delayed(()=>e?.focus(),t))),Ie=(t=10)=>u.WithElement(e=>{const n=A.delayed(()=>e.select(),t);return u.OnDispose(n)});function je(t){const e=Object.entries(t);return u.Fragment(...e.map(([n,o])=>u.attr.class(u.Value.map(o,s=>s?n:void 0))))}const qe=u.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),u.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Xe=t=>u.Portal("head > title",u.attr.innerText(t)),Ye={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},ut={partial:new Map,full:new Map},nt={partial:null,full:null};function Qe(t){return nt[t]==null&&(nt[t]=new IntersectionObserver(e=>{e.forEach(n=>{ut[t].get(n.target)?.set(n.isIntersecting)})},Ye[t])),nt[t]}const ae=({mode:t="partial",once:e=!1},n)=>{const o=u.prop(!1);return u.Fragment(u.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Qe(t):null;ut[t].set(s,o),i?.observe(s);function r(){i?.unobserve(s),ut[t].delete(s),ut[t].size===0&&(nt[t]?.disconnect(),nt[t]=null)}let a=null;return e&&(a=o.on(c=>{c&&r()})),u.OnDispose(()=>{o.dispose(),r(),a?.()})}),u.renderableOfTNode(n(o)))},Je=(t,e,n)=>ae(t,o=>u.When(o,e,n??(()=>u.Empty)));function ce(t){return u.WithElement(e=>{const n=o=>{e.contains(o.target)||t(o)};return document.addEventListener("click",n),u.OnDispose(()=>{document.removeEventListener("click",n)})})}const Q=(t,e)=>t===void 0||t===e,$t=(t,e)=>t===void 0||t===e;function le(t,e){return typeof t=="string"?e.key===t:$t(t.key,e.key)&&$t(t.code,e.code)&&Q(t.ctrlKey,e.ctrlKey)&&Q(t.altKey,e.altKey)&&Q(t.shiftKey,e.shiftKey)&&Q(t.metaKey,e.metaKey)&&Q(t.repeat,e.repeat)&&Q(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function Ct({allowedKeys:t,handler:e}){return u.WithElement(n=>{const o=s=>{if(n.contains(s.target)){for(const i of t)if(le(i,s)){e(s);break}}};return document.addEventListener("keydown",o),u.OnDispose(()=>{document.removeEventListener("keydown",o)})})}function Ge(t){return Ct({allowedKeys:["Enter"],handler:t})}function Ze(t){return Ct({allowedKeys:["Escape"],handler:t})}const ue=({mutate:t,convertError:e,onSuccess:n,onError:o,onSettled:s})=>{let i;const r=u.prop(A.AsyncResult.notAsked),a=r.map(m=>A.AsyncResult.isSuccess(m)?m.value:void 0),c=r.map(m=>A.AsyncResult.isFailure(m)?m.error:void 0),l=r.map(m=>A.AsyncResult.isLoading(m)),f=()=>{i?.abort(),i=void 0};return{status:r,value:a,error:c,pending:l,execute:async(m,x)=>{f(),i=new AbortController;const g=i.signal,v=r.get(),R=x?.optimisticValue??(x?.optimisticFromRequest!=null?x.optimisticFromRequest(m):void 0);R!=null?r.set(A.AsyncResult.loading(R)):r.set(A.AsyncResult.loading(A.AsyncResult.getOrUndefined(v)));try{const y=await t({request:m,abortSignal:g,previous:v});i=void 0,r.set(A.AsyncResult.success(y)),n?.(y,m)}catch(y){i=void 0,r.set(A.AsyncResult.failure(e(y))),o?.(e(y),m)}s?.(r.get(),m)},cancel:m=>{f(),r.set(m??A.AsyncResult.notAsked)},dispose:()=>{i?.abort(),i=void 0,r.dispose()}}},fe=(t,e)=>{const{status:n,dispose:o,execute:s,cancel:i,pending:r,error:a,value:c}=t,{content:l}=e,f=u.previousSignal(c);return u.Fragment(u.OnDispose(o),l({previous:f,execute:s,cancel:i,pending:r,error:a,value:c,status:n}))},tn=({mutate:t,convertError:e=r=>r,onSuccess:n,onError:o,onSettled:s,content:i})=>{const r=ue({mutate:t,convertError:e,onSuccess:n,onError:o,onSettled:s});return fe(r,{content:i})},G=Math.min,j=Math.max,ht=Math.round,lt=Math.floor,H=t=>({x:t,y:t}),en={left:"right",right:"left",bottom:"top",top:"bottom"},nn={start:"end",end:"start"};function At(t,e,n){return j(t,G(e,n))}function rt(t,e){return typeof t=="function"?t(e):t}function X(t){return t.split("-")[0]}function it(t){return t.split("-")[1]}function he(t){return t==="x"?"y":"x"}function Wt(t){return t==="y"?"height":"width"}const on=new Set(["top","bottom"]);function B(t){return on.has(X(t))?"y":"x"}function Dt(t){return he(B(t))}function sn(t,e,n){n===void 0&&(n=!1);const o=it(t),s=Dt(t),i=Wt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=dt(r)),[r,dt(r)]}function rn(t){const e=dt(t);return[Et(t),e,Et(e)]}function Et(t){return t.replace(/start|end/g,e=>nn[e])}const zt=["left","right"],Bt=["right","left"],an=["top","bottom"],cn=["bottom","top"];function ln(t,e,n){switch(t){case"top":case"bottom":return n?e?Bt:zt:e?zt:Bt;case"left":case"right":return e?an:cn;default:return[]}}function un(t,e,n,o){const s=it(t);let i=ln(X(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(Et)))),i}function dt(t){return t.replace(/left|right|bottom|top/g,e=>en[e])}function fn(t){return{top:0,right:0,bottom:0,left:0,...t}}function de(t){return typeof t!="number"?fn(t):{top:t,right:t,bottom:t,left:t}}function mt(t){const{x:e,y:n,width:o,height:s}=t;return{width:o,height:s,top:n,left:e,right:e+o,bottom:n+s,x:e,y:n}}function Kt(t,e,n){let{reference:o,floating:s}=t;const i=B(e),r=Dt(e),a=Wt(r),c=X(e),l=i==="y",f=o.x+o.width/2-s.width/2,d=o.y+o.height/2-s.height/2,p=o[a]/2-s[a]/2;let h;switch(c){case"top":h={x:f,y:o.y-s.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:d};break;case"left":h={x:o.x-s.width,y:d};break;default:h={x:o.x,y:o.y}}switch(it(e)){case"start":h[r]-=p*(n&&l?-1:1);break;case"end":h[r]+=p*(n&&l?-1:1);break}return h}async function hn(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:a,strategy:c}=t,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=rt(e,t),m=de(h),g=a[p?d==="floating"?"reference":"floating":d],v=mt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:l,rootBoundary:f,strategy:c})),R=d==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},P=mt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:y,strategy:c}):R);return{top:(v.top-P.top+m.top)/S.y,bottom:(P.bottom-v.bottom+m.bottom)/S.y,left:(v.left-P.left+m.left)/S.x,right:(P.right-v.right+m.right)/S.x}}const dn=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,a=i.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(e));let l=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:f,y:d}=Kt(l,o,c),p=o,h={},m=0;for(let g=0;g<a.length;g++){var x;const{name:v,fn:R}=a[g],{x:y,y:S,data:P,reset:E}=await R({x:f,y:d,initialPlacement:o,placement:p,strategy:s,middlewareData:h,rects:l,platform:{...r,detectOverflow:(x=r.detectOverflow)!=null?x:hn},elements:{reference:t,floating:e}});f=y??f,d=S??d,h={...h,[v]:{...h[v],...P}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(l=E.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):E.rects),{x:f,y:d}=Kt(l,p,c)),g=-1)}return{x:f,y:d,placement:p,strategy:s,middlewareData:h}},mn=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:s,rects:i,platform:r,elements:a,middlewareData:c}=e,{element:l,padding:f=0}=rt(t,e)||{};if(l==null)return{};const d=de(f),p={x:n,y:o},h=Dt(s),m=Wt(h),x=await r.getDimensions(l),g=h==="y",v=g?"top":"left",R=g?"bottom":"right",y=g?"clientHeight":"clientWidth",S=i.reference[m]+i.reference[h]-p[h]-i.floating[m],P=p[h]-i.reference[h],E=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l));let L=E?E[y]:0;(!L||!await(r.isElement==null?void 0:r.isElement(E)))&&(L=a.floating[y]||i.floating[m]);const U=S/2-P/2,w=L/2-x[m]/2-1,b=G(d[v],w),O=G(d[R],w),k=b,$=L-x[m]-O,T=L/2-x[m]/2+U,I=At(k,T,$),_=!c.arrow&&it(s)!=null&&T!==I&&i.reference[m]/2-(T<k?b:O)-x[m]/2<0,W=_?T<k?T-k:T-$:0;return{[h]:p[h]+W,data:{[h]:I,centerOffset:T-I-W,..._&&{alignmentOffset:W}},reset:_}}}),pn=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:a,platform:c,elements:l}=e,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:x=!0,...g}=rt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=X(s),R=B(a),y=X(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(l.floating)),P=p||(y||!x?[dt(a)]:rn(a)),E=m!=="none";!p&&E&&P.push(...un(a,x,m,S));const L=[a,...P],U=await c.detectOverflow(e,g),w=[];let b=((o=i.flip)==null?void 0:o.overflows)||[];if(f&&w.push(U[v]),d){const T=sn(s,r,S);w.push(U[T[0]],U[T[1]])}if(b=[...b,{placement:s,overflows:w}],!w.every(T=>T<=0)){var O,k;const T=(((O=i.flip)==null?void 0:O.index)||0)+1,I=L[T];if(I&&(!(d==="alignment"?R!==B(I):!1)||b.every(D=>B(D.placement)===R?D.overflows[0]>0:!0)))return{data:{index:T,overflows:b},reset:{placement:I}};let _=(k=b.filter(W=>W.overflows[0]<=0).sort((W,D)=>W.overflows[1]-D.overflows[1])[0])==null?void 0:k.placement;if(!_)switch(h){case"bestFit":{var $;const W=($=b.filter(D=>{if(E){const z=B(D.placement);return z===R||z==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(z=>z>0).reduce((z,We)=>z+We,0)]).sort((D,z)=>D[1]-z[1])[0])==null?void 0:$[0];W&&(_=W);break}case"initialPlacement":_=a;break}if(s!==_)return{reset:{placement:_}}}return{}}}},gn=new Set(["left","top"]);async function wn(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=X(n),a=it(n),c=B(n)==="y",l=gn.has(r)?-1:1,f=i&&c?-1:1,d=rt(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),c?{x:h*f,y:p*l}:{x:p*l,y:h*f}}const yn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:s,y:i,placement:r,middlewareData:a}=e,c=await wn(e,t);return r===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:r}}}}},vn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s,platform:i}=e,{mainAxis:r=!0,crossAxis:a=!1,limiter:c={fn:v=>{let{x:R,y}=v;return{x:R,y}}},...l}=rt(t,e),f={x:n,y:o},d=await i.detectOverflow(e,l),p=B(X(s)),h=he(p);let m=f[h],x=f[p];if(r){const v=h==="y"?"top":"left",R=h==="y"?"bottom":"right",y=m+d[v],S=m-d[R];m=At(y,m,S)}if(a){const v=p==="y"?"top":"left",R=p==="y"?"bottom":"right",y=x+d[v],S=x-d[R];x=At(y,x,S)}const g=c.fn({...e,[h]:m,[p]:x});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[h]:r,[p]:a}}}}}};function yt(){return typeof window<"u"}function tt(t){return me(t)?(t.nodeName||"").toLowerCase():"#document"}function C(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function N(t){var e;return(e=(me(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function me(t){return yt()?t instanceof Node||t instanceof C(t).Node:!1}function F(t){return yt()?t instanceof Element||t instanceof C(t).Element:!1}function V(t){return yt()?t instanceof HTMLElement||t instanceof C(t).HTMLElement:!1}function It(t){return!yt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof C(t).ShadowRoot}const xn=new Set(["inline","contents"]);function at(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=M(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!xn.has(s)}const bn=new Set(["table","td","th"]);function Rn(t){return bn.has(tt(t))}const On=[":popover-open",":modal"];function vt(t){return On.some(e=>{try{return t.matches(e)}catch{return!1}})}const Sn=["transform","translate","scale","rotate","perspective"],An=["transform","translate","scale","rotate","perspective","filter"],En=["paint","layout","strict","content"];function Ft(t){const e=Mt(),n=F(t)?M(t):t;return Sn.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||An.some(o=>(n.willChange||"").includes(o))||En.some(o=>(n.contain||"").includes(o))}function Pn(t){let e=K(t);for(;V(e)&&!Z(e);){if(Ft(e))return e;if(vt(e))return null;e=K(e)}return null}function Mt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ln=new Set(["html","body","#document"]);function Z(t){return Ln.has(tt(t))}function M(t){return C(t).getComputedStyle(t)}function xt(t){return F(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function K(t){if(tt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||It(t)&&t.host||N(t);return It(e)?e.host:e}function pe(t){const e=K(t);return Z(e)?t.ownerDocument?t.ownerDocument.body:t.body:V(e)&&at(e)?e:pe(e)}function ot(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=pe(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=C(s);if(i){const a=Pt(r);return e.concat(r,r.visualViewport||[],at(s)?s:[],a&&n?ot(a):[])}return e.concat(s,ot(s,[],n))}function Pt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ge(t){const e=M(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=V(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,a=ht(n)!==i||ht(o)!==r;return a&&(n=i,o=r),{width:n,height:o,$:a}}function Ht(t){return F(t)?t:t.contextElement}function J(t){const e=Ht(t);if(!V(e))return H(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=ge(e);let r=(i?ht(n.width):n.width)/o,a=(i?ht(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}const kn=H(0);function we(t){const e=C(t);return!Mt()||!e.visualViewport?kn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Tn(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==C(t)?!1:e}function Y(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Ht(t);let r=H(1);e&&(o?F(o)&&(r=J(o)):r=J(t));const a=Tn(i,n,o)?we(i):H(0);let c=(s.left+a.x)/r.x,l=(s.top+a.y)/r.y,f=s.width/r.x,d=s.height/r.y;if(i){const p=C(i),h=o&&F(o)?C(o):o;let m=p,x=Pt(m);for(;x&&o&&h!==m;){const g=J(x),v=x.getBoundingClientRect(),R=M(x),y=v.left+(x.clientLeft+parseFloat(R.paddingLeft))*g.x,S=v.top+(x.clientTop+parseFloat(R.paddingTop))*g.y;c*=g.x,l*=g.y,f*=g.x,d*=g.y,c+=y,l+=S,m=C(x),x=Pt(m)}}return mt({width:f,height:d,x:c,y:l})}function bt(t,e){const n=xt(t).scrollLeft;return e?e.left+n:Y(N(t)).left+n}function ye(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-bt(t,n),s=n.top+e.scrollTop;return{x:o,y:s}}function Cn(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=N(o),a=e?vt(e.floating):!1;if(o===r||a&&i)return n;let c={scrollLeft:0,scrollTop:0},l=H(1);const f=H(0),d=V(o);if((d||!d&&!i)&&((tt(o)!=="body"||at(r))&&(c=xt(o)),V(o))){const h=Y(o);l=J(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const p=r&&!d&&!i?ye(r,c):H(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+f.x+p.x,y:n.y*l.y-c.scrollTop*l.y+f.y+p.y}}function Wn(t){return Array.from(t.getClientRects())}function Dn(t){const e=N(t),n=xt(t),o=t.ownerDocument.body,s=j(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=j(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+bt(t);const a=-n.scrollTop;return M(o).direction==="rtl"&&(r+=j(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:a}}const jt=25;function Fn(t,e){const n=C(t),o=N(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,a=0,c=0;if(s){i=s.width,r=s.height;const f=Mt();(!f||f&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const l=bt(o);if(l<=0){const f=o.ownerDocument,d=f.body,p=getComputedStyle(d),h=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-d.clientWidth-h);m<=jt&&(i-=m)}else l<=jt&&(i+=l);return{width:i,height:r,x:a,y:c}}const Mn=new Set(["absolute","fixed"]);function Hn(t,e){const n=Y(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=V(t)?J(t):H(1),r=t.clientWidth*i.x,a=t.clientHeight*i.y,c=s*i.x,l=o*i.y;return{width:r,height:a,x:c,y:l}}function qt(t,e,n){let o;if(e==="viewport")o=Fn(t,n);else if(e==="document")o=Dn(N(t));else if(F(e))o=Hn(e,n);else{const s=we(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return mt(o)}function ve(t,e){const n=K(t);return n===e||!F(n)||Z(n)?!1:M(n).position==="fixed"||ve(n,e)}function Vn(t,e){const n=e.get(t);if(n)return n;let o=ot(t,[],!1).filter(a=>F(a)&&tt(a)!=="body"),s=null;const i=M(t).position==="fixed";let r=i?K(t):t;for(;F(r)&&!Z(r);){const a=M(r),c=Ft(r);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&Mn.has(s.position)||at(r)&&!c&&ve(t,r))?o=o.filter(f=>f!==r):s=a,r=K(r)}return e.set(t,o),o}function Nn(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?vt(e)?[]:Vn(e,this._c):[].concat(n),o],a=r[0],c=r.reduce((l,f)=>{const d=qt(e,f,s);return l.top=j(d.top,l.top),l.right=G(d.right,l.right),l.bottom=G(d.bottom,l.bottom),l.left=j(d.left,l.left),l},qt(e,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function _n(t){const{width:e,height:n}=ge(t);return{width:e,height:n}}function Un(t,e,n){const o=V(e),s=N(e),i=n==="fixed",r=Y(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const c=H(0);function l(){c.x=bt(s)}if(o||!o&&!i)if((tt(e)!=="body"||at(s))&&(a=xt(e)),o){const h=Y(e,!0,i,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else s&&l();i&&!o&&s&&l();const f=s&&!o&&!i?ye(s,a):H(0),d=r.left+a.scrollLeft-c.x-f.x,p=r.top+a.scrollTop-c.y-f.y;return{x:d,y:p,width:r.width,height:r.height}}function Rt(t){return M(t).position==="static"}function Xt(t,e){if(!V(t)||M(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return N(t)===n&&(n=n.ownerDocument.body),n}function xe(t,e){const n=C(t);if(vt(t))return n;if(!V(t)){let s=K(t);for(;s&&!Z(s);){if(F(s)&&!Rt(s))return s;s=K(s)}return n}let o=Xt(t,e);for(;o&&Rn(o)&&Rt(o);)o=Xt(o,e);return o&&Z(o)&&Rt(o)&&!Ft(o)?n:o||Pn(t)||n}const $n=async function(t){const e=this.getOffsetParent||xe,n=this.getDimensions,o=await n(t.floating);return{reference:Un(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function zn(t){return M(t).direction==="rtl"}const Bn={convertOffsetParentRelativeRectToViewportRelativeRect:Cn,getDocumentElement:N,getClippingRect:Nn,getOffsetParent:xe,getElementRects:$n,getClientRects:Wn,getDimensions:_n,getScale:J,isElement:F,isRTL:zn};function be(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Kn(t,e){let n=null,o;const s=N(t);function i(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function r(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const l=t.getBoundingClientRect(),{left:f,top:d,width:p,height:h}=l;if(a||e(),!p||!h)return;const m=lt(d),x=lt(s.clientWidth-(f+p)),g=lt(s.clientHeight-(d+h)),v=lt(f),y={rootMargin:-m+"px "+-x+"px "+-g+"px "+-v+"px",threshold:j(0,G(1,c))||1};let S=!0;function P(E){const L=E[0].intersectionRatio;if(L!==c){if(!S)return r();L?r(!1,L):o=setTimeout(()=>{r(!1,1e-7)},1e3)}L===1&&!be(l,t.getBoundingClientRect())&&r(),S=!1}try{n=new IntersectionObserver(P,{...y,root:s.ownerDocument})}catch{n=new IntersectionObserver(P,y)}n.observe(t)}return r(!0),i}function In(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=Ht(t),f=s||i?[...l?ot(l):[],...ot(e)]:[];f.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const d=l&&a?Kn(l,n):null;let p=-1,h=null;r&&(h=new ResizeObserver(v=>{let[R]=v;R&&R.target===l&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(e)})),n()}),l&&!c&&h.observe(l),h.observe(e));let m,x=c?Y(t):null;c&&g();function g(){const v=Y(t);x&&!be(x,v)&&n(),x=v,m=requestAnimationFrame(g)}return n(),()=>{var v;f.forEach(R=>{s&&R.removeEventListener("scroll",n),i&&R.removeEventListener("resize",n)}),d?.(),(v=h)==null||v.disconnect(),h=null,c&&cancelAnimationFrame(m)}}const jn=yn,qn=vn,Yt=pn,Xn=mn,Yn=(t,e,n)=>{const o=new Map,s={platform:Bn,...n},i={...s.platform,_c:o};return dn(t,e,{...s,platform:i})},Qn=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Jn=(t,e={isOpen:!1})=>{const n=[];let o=null;const s=u.Value.deriveProp(e.isOpen);function i(a){o=a,s.set(!0)}function r(){s.set(!1),n.forEach(a=>a()),n.length=0}return u.Fragment(t(i,r),u.When(s,()=>u.Fragment(o?.onClickOutside!=null?ce(o.onClickOutside):null,u.WithElement(a=>u.Portal("body",u.html.div(u.WithElement(c=>{c.style.position="absolute";const l=typeof o?.target=="string"?a.querySelector(o.target):o?.target??a;if(l==null)throw new Error(`Target not found: ${o?.target}`);let f=null;const d=u.Value.toSignal(o?.mainAxisOffset??0),p=u.Value.toSignal(o?.crossAxisOffset??0),h=u.Value.toSignal(o?.placement??"top"),m=u.Value.toSignal(o?.arrowPadding??0),x=o?.arrow,g=u.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function v(){const y=[Yt(),jn({mainAxis:d.get(),crossAxis:p.get()}),qn(),Yt()];x!=null&&f!=null&&y.push(Xn({element:f,padding:m.get()}));const S=await Yn(l,c,{placement:h.get(),strategy:"absolute",middleware:y}),{x:P,y:E,middlewareData:L}=S;if(c.style.top=`${E}px`,c.style.left=`${P}px`,f!=null&&L.arrow!=null){const{x:U,y:w,centerOffset:b,alignmentOffset:O}=L.arrow;g.set({x:U,y:w,centerOffset:b,alignmentOffset:O,containerWidth:c.offsetWidth,containerHeight:c.offsetHeight})}}const R=u.effectOf(d,p,h)(v);return u.Fragment(o?.content,o?.arrow!=null?u.html.div(o?.arrow(u.computedOf(g,h)((y,S)=>({...y,placement:S}))),u.WithElement(y=>{f=y,v()})):null,u.OnDispose(In(l,c,v),R))})))))))},Re=({request:t,load:e,convertError:n,onSuccess:o,onError:s,onSettled:i})=>{let r;const a=u.prop(A.AsyncResult.notAsked),c=a.map(g=>A.AsyncResult.isSuccess(g)?g.value:void 0),l=a.map(g=>A.AsyncResult.isFailure(g)?g.error:void 0),f=a.map(g=>A.AsyncResult.isLoading(g)),d=()=>{r?.abort(),r=void 0},p=g=>{d(),a.set(g??A.AsyncResult.notAsked)},h=async g=>{d(),r=new AbortController;const v=r.signal,R=a.get();a.set(A.AsyncResult.loading(A.AsyncResult.getOrUndefined(R)));try{const y=await e({request:g,abortSignal:v,previous:R});await Promise.resolve(),r=void 0,a.set(A.AsyncResult.success(y)),o?.(y,g)}catch(y){r=void 0,a.set(A.AsyncResult.failure(n(y))),s?.(n(y),g)}i?.(a.get(),g)},m=()=>h(u.Value.get(t)),x=()=>{r?.abort(),r=void 0,a.dispose()};return a.onDispose(u.Value.on(t,h)),{status:a,value:c,error:l,loading:f,cancel:p,reload:m,dispose:x}},Oe=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{pending:i,failure:r,success:a}=e;return u.Fragment(u.OnDispose(o),Tt(n,{loading:i!=null?c=>i({previous:c,reload:s,cancel:t.cancel}):void 0,failure:r!=null?c=>r({error:c,reload:s}):void 0,success:c=>a({value:c,reload:s})}))},Gn=({request:t,load:e,convertError:n=l=>l,onSuccess:o,onError:s,onSettled:i,success:r,pending:a,failure:c})=>{const l=Re({request:t,load:e,convertError:n,onSuccess:o,onError:s,onSettled:i});return Oe(l,{success:r,pending:a,failure:c})},Se=(t,e)=>{if(typeof e=="function")return Se(t,{success:e});const n=e.failure??(s=>(s.on(console.error),s.map(i=>`Error: ${i}`))),o=e.success;return u.OneOfType(u.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},Zn=()=>u.on.focus(t=>t.target?.select());class ct{constructor(e,n,o,s,i,r){this.left=e,this.top=n,this.width=o,this.height=s,this.localLeft=i,this.localTop=r}static of({left:e=0,top:n=0,width:o=0,height:s=0,localLeft:i=0,localTop:r=0}){return new ct(e,n,o,s,i,r)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get localCenter(){return{x:this.localLeft+this.width/2,y:this.localTop+this.height/2}}get localBottom(){return this.localTop+this.height}get localRight(){return this.localLeft+this.width}get size(){return{width:this.width,height:this.height}}equals=e=>A.nearEqual(this.left,e.left)&&A.nearEqual(this.top,e.top)&&A.nearEqual(this.width,e.width)&&A.nearEqual(this.height,e.height)}function Lt(t){const e=t.getBoundingClientRect();return ct.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height,localLeft:t.offsetLeft,localTop:t.offsetTop})}const to=t=>u.WithBrowserCtx(e=>{const{element:n}=e,o=u.prop(Lt(n),(a,c)=>a.equals(c)),s=u.renderableOfTNode(t(o)).render(e),i=()=>o.set(ct.of(Lt(n)));let r=null;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(i)),r?.observe(n),u.OnDispose(a=>{r?.disconnect(),s(a)})});function Qt(t){return{width:t?.innerWidth??0,height:t?.innerHeight??0}}const eo=t=>u.WithCtx(()=>{const e=u.getWindow(),n=u.prop(Qt(e),(s,i)=>s.width===i.width&&s.height===i.height),o=()=>n.set(Qt(e));return e?.addEventListener("resize",o),u.Fragment(u.OnDispose(()=>{e?.removeEventListener("resize",o)}),t(n))}),Ae=(t,e)=>{const n=e.split("/").filter(i=>i!==""),o=i=>{try{return decodeURIComponent(i)}catch{return i}},s={};for(let i=0;i<t.length;i++){const r=t[i],a=n[i];if(!a&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==a)return null}else if(r.type==="param")s[r.name]=o(a);else if(r.type==="catch-all"){if(r.name){const c=n.slice(i).join("/");s[r.name]=o(c)}return{params:s,path:e}}}return n.length!==t.length?null:{params:s,path:e}},Vt=t=>t.split("/").map(e=>{if(e.startsWith(":"))return{type:"param",name:e.slice(1)};if(e.startsWith("*")){const n=e.slice(1);return n!=""?{type:"catch-all",name:n}:{type:"catch-all"}}else return{type:"literal",value:e}}).filter(e=>e.type!=="literal"||e.value!==""),no=t=>{const e=t.map(n=>{const o=Vt(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=Ae(s,o);if(r)return{...r,route:i}}return null}},oo=t=>{if(t==null)throw new Error("NavigationService: no Location handle attached. Make sure to attach one before calling navigation helpers.");return t};class so{handles=[];attach(e){const n=this.handles.lastIndexOf(e);return n!==-1&&this.handles.splice(n,1),this.handles.push(e),()=>this.detach(e)}detach(e){for(let n=this.handles.length-1;n>=0;n--)if(this.handles[n]===e){this.handles.splice(n,1);break}}get current(){return this.handles[this.handles.length-1]}getHandle(){return oo(this.current)}navigate(e,n){this.getHandle().navigate(e,n)}replace(e,n){this.getHandle().replace(e,n)}go(e,n){this.getHandle().go(e,n)}back(e){this.getHandle().back(e)}forward(e){this.getHandle().forward(e)}setPathname(e,n){this.getHandle().setPathname(e,n)}setSearch(e,n){this.getHandle().setSearch(e,n)}setSearchParam(e,n,o){this.getHandle().setSearchParam(e,n,o)}updateSearch(e,n){this.getHandle().updateSearch(e,n)}setHash(e,n){this.getHandle().setHash(e,n)}clearHash(e){this.getHandle().clearHash(e)}run(e,n){this.getHandle().run(e,n)}}const ro=new so,pt={mark:u.makeProviderMark("RouterContext"),create:()=>{const t=u.prop([]);return{value:t,dispose:()=>t.dispose()}}},io=(t,e,n)=>{const o=n.split("/").filter(r=>r!==""),s={};let i=0;for(let r=0;r<t.length;r++){const a=t[r],c=o[r];if(!c&&a.type!=="catch-all")return null;if(a.type==="literal"){if(a.value!==c)return null;i++}else if(a.type==="param")s[a.name]=c,i++;else if(a.type==="catch-all"){a.name&&(s[a.name]=o.slice(i).join("/"));const l="/"+o.slice(0,i).join("/"),f="/"+o.slice(i).join("/");return{params:s,matchedPath:l==="/"?"":l,remainingPath:f==="/"?"":f,route:e}}}if(o.length===t.length){const r="/"+o.join("/");return{params:s,matchedPath:r==="/"?"":r,remainingPath:"",route:e}}return null},Ee=t=>{const e=t.map(n=>{const o=Vt(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=io(s,i,o);if(r)return r}return null}},ao=t=>{const e=Ee(Object.keys(t));return u.Provide(pt,{},()=>u.Use(wt,n=>u.Use(pt,o=>{const s=n.location.map(i=>{const r=e(i.pathname);if(r==null)throw console.error("No route found for",i),new Error("No route found");const a={matchedPath:r.matchedPath,remainingPath:r.remainingPath,fullPath:i.pathname,params:r.params};return o.value=[...o.value,a],{params:r.params,route:r.route,path:r.matchedPath||i.pathname,search:i.search,hash:i.hash}});return u.OneOfTuple(s.map(i=>[i.route,i]),t)})))},co=t=>{const e=Ee(Object.keys(t));return u.Use(pt,n=>u.Use(wt,o=>{const s=n.map(i=>{const r=i[i.length-1];if(r==null)throw console.error("No router context available for ChildRouter",i),new Error("No router context available for ChildRouter");const a=r.remainingPath??"",c=e(a);if(c==null)throw console.error("No route found for remaining path",a),new Error("No route found");return{params:c.params,route:c.route,path:c.matchedPath,search:o.location.value.search,hash:o.location.value.hash}});return u.OneOfTuple(s.map(i=>[i.route,i]),t)}))},gt=60*1e3,kt=60*gt,st=24*kt,Jt=7*st,Gt=30*st,lo=365*st,uo=[{max:gt*90,value:gt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:kt*36,value:kt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:st*10,value:st,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Jt*6,value:Jt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Gt*18,value:Gt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:lo,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Zt(t,e,n,o){const s=Math.round(t/e);return s<=1?n:o.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const Pe=(t=1e3)=>{const e=u.prop(new Date),n=A.interval(()=>e.set(new Date),t);return e.onDispose(n),e},Le=t=>{const e=Math.abs(t);if(e<gt)return t<0?"just now":"in a moment";for(const n of uo)if(e<n.max)return t<0?Zt(e,n.value,n.past.singular,n.past.plural):Zt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ke=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?u.Signal.is(e)?e.derive():u.prop(e):Pe(n),s=u.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>u.Value.dispose(o)),s},Te=(t,e={})=>{const n=ke(t,e),o=n.map(Le);return o.onDispose(n.dispose),o},fo=(t,e={})=>Te(t,e);class Ce extends u.Prop{tick=()=>this.update(e=>e+1)}const ho=(t=0)=>new Ce(t,(e,n)=>e===n);exports.Anchor=re;exports.Appearance=Be;exports.AsyncResultView=Tt;exports.AutoFocus=Ke;exports.AutoSelect=Ie;exports.ChildRouter=co;exports.ElementRect=to;exports.HTMLTitle=Xe;exports.HiddenWhenEmpty=qe;exports.InViewport=ae;exports.Location=wt;exports.Mutation=tn;exports.MutationDisplay=fe;exports.NavigationService=ro;exports.OnClickOutside=ce;exports.OnEnterKey=Ge;exports.OnEscapeKey=Ze;exports.OnKeyPressed=Ct;exports.PopOver=Jn;exports.Query=Gn;exports.QueryDisplay=Oe;exports.Rect=ct;exports.ResultView=Se;exports.RootRouter=ao;exports.RouterContextProvider=pt;exports.SelectOnFocus=Zn;exports.Ticker=Ce;exports.WhenInViewport=Je;exports.WindowSize=eo;exports._checkExtensionCondition=ee;exports._getExtension=te;exports._makeRouteMatcher=no;exports._parseRouteSegments=Vt;exports.allPlacements=Qn;exports.areLocationsEqual=oe;exports.classes=je;exports.evaluateLocationMatch=St;exports.getAbsoluteRect=Lt;exports.handleAnchorClick=ne;exports.locationFromURL=ft;exports.makeMutationResource=ue;exports.makeQueryResource=Re;exports.matchesKeyCombo=le;exports.matchesRoute=Ae;exports.nowSignal=Pe;exports.relativeTime=fo;exports.relativeTimeMillisSignal=ke;exports.relativeTimeSignal=Te;exports.ticker=ho;exports.timeDiffToString=Le;exports.urlFromLocation=q;exports.useAppearance=ie;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@tempots/dom"),f=require("@tempots/std"),P=require("@floating-ui/dom"),at=e=>{const t=e.split("/").pop();if(t==null||t.startsWith("."))return;const n=t.split(".")||[];return n.length>1?"."+n.pop():void 0},ot=(e,t)=>{const n=at(t);return n!=null&&(e.length===0||!e.some(s=>n==s))},bt=(e,t,n,s)=>{let a=e.target;for(;a!=null&&!(a instanceof HTMLAnchorElement);)a=a.parentElement;if(a==null)return!0;const o=a;if(e.button!==0||e.ctrlKey||e.metaKey||o.target!=="_self"&&o.target!==""||o.getAttribute("download")!=null)return!0;const{pathname:r,search:c,hash:l}=o;if(s){const h=r+c+l,d=o.getAttribute("href");if(!d?.startsWith("#")&&d!==h)return!0}return t?!1:ot(n,r)},it=(e,t={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=t.ignoreUrlWithExtension===!0&&Array.isArray(t.allowedExtensions)?t.allowedExtensions.map(s=>s.startsWith(".")?s:"."+s):[];return s=>{bt(s,t.ignoreUrlWithExtension??!0,n,t.ignoreExternalUrl??!0)||e()&&s.preventDefault()}},ct=(e,t)=>e.pathname===t.pathname&&JSON.stringify(e.search)===JSON.stringify(t.search)&&e.hash===t.hash,V=(e,t)=>{const n=new URL(e,t??i.getWindow()?.location.toString()),s=Object.fromEntries(n.searchParams?.entries()??[]);let a=n.hash;return a.startsWith("#")&&(a=a.substring(1)),{pathname:n.pathname,search:s,hash:a===""?void 0:a}},b=e=>{const n=new URLSearchParams(e.search).toString(),s=e.hash;return`${e.pathname}${n?`?${n}`:""}${s?`#${s}`:""}`},xt=e=>{document.startViewTransition?document.startViewTransition(e):e()},X=()=>{const e=i.getWindow(),t=e?.location.hash??"";return{pathname:e?.location.pathname??"",search:Object.fromEntries(new URLSearchParams(e?.location.search??"").entries()),hash:t.startsWith("#")?t.substring(1)||void 0:t===""?void 0:t}},G=e=>{if(e?.scroll!=="auto")return;const t=i.getWindow();t&&t.requestAnimationFrame(()=>t.scrollTo({top:0,left:0,behavior:"auto"}))},Z=(e,t)=>{t?.viewTransition?xt(e):e()},Lt=()=>{const e=i.prop(X(),ct),t=i.getWindow(),n=()=>{e.set(X())};t?.addEventListener("popstate",n),t?.addEventListener("hashchange",n);const s=(l,h,d)=>{Z(()=>{if(t){const w=b(l),R=h?.state??{};d==="replaceState"||h?.replace?t.history.replaceState(R,"",w):t.history.pushState(R,"",w)}e.set(l)},h),G(h)},a=(l,h)=>{Z(()=>{t?.history.go(l)},h),G(h)};return{location:e,commit:s,go:a,back:l=>a(-1,l),forward:l=>a(1,l),resolve:l=>V(l),dispose:()=>{t?.removeEventListener("popstate",n),t?.removeEventListener("hashchange",n),e.dispose()}}},Wt=e=>e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"),Tt=e=>{const t=e.container.currentURL,n=t.iso(r=>V(r,t.value),r=>{if(Wt(r.pathname))return b(r);const c=new URL(r.pathname,t.value),l=c.origin+c.pathname;return b({...r,pathname:l})});return{location:n,dispose:()=>{n.dispose()},commit:(r,c,l)=>{n.set(r)},go:(r,c)=>{},back:r=>{},forward:r=>{},resolve:r=>V(r,t.value)}},L=e=>({pathname:e.pathname,search:{...e.search},hash:e.hash??void 0}),N=e=>{if(e==null)return;const t=`${e}`;return t===""?void 0:t},lt=(e,t)=>{const n={...e};for(const[s,a]of Object.entries(t))a==null?delete n[s]:n[s]=a;return n},Ht=(e,t)=>{const n=t?.includeSearch??!0,s=t?.includeHash??!0,a=t?.ignoreSearchParams??[];let o;if(!n)o={};else if(a.length===0)o={...e.search};else{const r=new Set(a);o={};for(const[c,l]of Object.entries(e.search))r.has(c)||(o[c]=l)}return{pathname:e.pathname,search:o,hash:s?e.hash:void 0}},z=(e,t,n)=>{const s=Ht(e,n);return typeof t=="string"?b(s)===t:t instanceof RegExp?((t.global||t.sticky)&&(t.lastIndex=0),t.test(b(s))):t(s)};class Dt{constructor(t){this.current=t}get location(){return this.current}setLocation(t){return this.current=L(t),this}setPathname(t){return this.current={...this.current,pathname:t},this}setHash(t){const n=N(t);if(n==null){const{hash:s,...a}=this.current;this.current=a}else this.current={...this.current,hash:n};return this}clearHash(){const{hash:t,...n}=this.current;return this.current=n,this}setSearch(t){return this.current={...this.current,search:lt(this.current.search,t)},this}setSearchParam(t,n){return this.setSearch({[t]:n})}updateSearch(t){return this.current={...this.current,search:{...t({...this.current.search})}},this}}const Mt=(e,t)=>e?.replace?"replaceState":t,Vt=e=>{const t=e.location,n=t.map(b),s=t.map(u=>u.pathname),a=t.map(u=>({...u.search})),o=t.map(u=>u.hash),r=(u,p)=>z(e.location.value,u,p),c=(u,p)=>i.computedOf(t,u)((m,k)=>z(m,k,p)),l=(u,p,m)=>{const k=L({...u,hash:N(u.hash??void 0)});e.commit(k,p,m)},h=(u,p)=>{const m=Mt(p,"pushState");l(u,p,m)},d=(u,p)=>{const m=u(L(e.location.value));h(m,p)},w=(u,p)=>{const m=e.resolve(u);h(m,p)},R=(u,p)=>{const m={...p,replace:!0};w(u,m)},O=(u,p)=>{e.go(u,p)},g=u=>{e.back(u)},E=u=>{e.forward(u)},v=(u,p)=>d(m=>({...m,pathname:u}),p),S=(u,p)=>d(m=>{const k={...m},J=N(u);return J==null?delete k.hash:k.hash=J,k},p),A=u=>S(void 0,u),y=(u,p)=>d(m=>({...m,search:lt(m.search,u)}),p);return{handle:{location:t,url:n,pathname:s,search:a,hash:o,setLocation:h,updateLocation:d,navigate:w,replace:R,go:O,back:g,forward:E,setPathname:v,setHash:S,clearHash:A,setSearch:y,setSearchParam:(u,p,m)=>y({[u]:p},m),updateSearch:(u,p)=>d(m=>({...m,search:{...u({...m.search})}}),p),queryParam:u=>t.map(p=>p.search[u]),run:(u,p)=>{const m=new Dt(L(e.location.value));u(m),h(L(m.location),p)},match:r,matchSignal:c},dispose:()=>{e.dispose(),n.dispose(),s.dispose(),a.dispose(),o.dispose()}}},Ft=e=>{if(e.isBrowser())return Lt();if(e.isHeadless())return Tt(e);throw new Error("Unknown context")},K={mark:i.makeProviderMark("Location"),create:(e,t)=>{const n=Ft(t),{handle:s,dispose:a}=Vt(n);return{value:s,dispose:a}}},ut=(e,...t)=>{if(typeof e=="string"||i.Signal.is(e))return ut({href:e},...t);const{href:n,state:s,scroll:a,viewTransition:o,replace:r,...c}=e;return i.Use(K,l=>i.html.a(i.on.click(it(()=>{let h=!1;const d={};return s!==void 0&&(d.state=s,h=!0),a!==void 0&&(d.scroll=a,h=!0),o!==void 0&&(d.viewTransition=o,h=!0),r!==void 0&&(d.replace=r,h=!0),l.navigate(i.Value.get(n),h?d:void 0),!0},c)),i.attr.href(n),...t))},Ut={mark:i.makeProviderMark("Appearance"),create:()=>{const e=ht();return{value:e,dispose:()=>e.dispose()}}};function ht(){const e=i.getWindow(),t=e!=null&&e.matchMedia!=null?e.matchMedia("(prefers-color-scheme: dark)"):void 0,n=t?.matches??!1,s=i.prop(n?"dark":"light"),a=o=>s.set(o.matches?"dark":"light");return t?.addEventListener("change",a),s.onDispose(()=>t?.removeEventListener("change",a)),s}const j=(e,t)=>{if(typeof t=="function")return j(e,{success:t});const n=t.failure??(r=>r.map(c=>`Error: ${c}`)),s=t.success,a=t.loading??(()=>i.Empty),o=t.notAsked??(()=>i.Empty);return i.OneOfType(i.Value.toSignal(e),{AsyncSuccess:r=>s(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>a(r.map(c=>c.previousValue)),NotAsked:o})},Kt=(e=10)=>i.WithElement(t=>i.OnDispose(f.delayed(()=>t?.focus(),e))),Ct=(e=10)=>i.WithElement(t=>{const n=f.delayed(()=>t.select(),e);return i.OnDispose(n)});function Nt(e){const t=Object.entries(e);return i.Fragment(...t.map(([n,s])=>i.attr.class(i.Value.map(s,a=>a?n:void 0))))}const zt=i.WithElement(e=>{const t=e.style.getPropertyValue(":empty");return e.style.setProperty(":empty","display:none"),i.OnDispose(n=>{n&&e.style.setProperty(":empty",t)})}),_t=e=>i.Portal("head > title",i.attr.innerText(e)),$t={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},M={partial:new Map,full:new Map},W={partial:null,full:null};function jt(e){return W[e]==null&&(W[e]=new IntersectionObserver(t=>{t.forEach(n=>{M[e].get(n.target)?.set(n.isIntersecting)})},$t[e])),W[e]}const pt=({mode:e="partial",once:t=!1},n)=>{const s=i.prop(!1);return i.Fragment(i.WithElement(a=>{const o=typeof IntersectionObserver<"u"?jt(e):null;M[e].set(a,s),o?.observe(a);function r(){o?.unobserve(a),M[e].delete(a),M[e].size===0&&(W[e]?.disconnect(),W[e]=null)}let c=null;return t&&(c=s.on(l=>{l&&r()})),i.OnDispose(()=>{s.dispose(),r(),c?.()})}),i.renderableOfTNode(n(s)))},It=(e,t,n)=>pt(e,s=>i.When(s,t,n??(()=>i.Empty)));function dt(e){return i.WithElement(t=>{const n=s=>{t.contains(s.target)||e(s)};return document.addEventListener("click",n),i.OnDispose(()=>{document.removeEventListener("click",n)})})}const x=(e,t)=>e===void 0||e===t,tt=(e,t)=>e===void 0||e===t;function mt(e,t){return typeof e=="string"?t.key===e:tt(e.key,t.key)&&tt(e.code,t.code)&&x(e.ctrlKey,t.ctrlKey)&&x(e.altKey,t.altKey)&&x(e.shiftKey,t.shiftKey)&&x(e.metaKey,t.metaKey)&&x(e.repeat,t.repeat)&&x(e.commandOrControlKey,t.metaKey||t.ctrlKey)}function I({allowedKeys:e,handler:t}){return i.WithElement(n=>{const s=a=>{if(n.contains(a.target)){for(const o of e)if(mt(o,a)){t(a);break}}};return document.addEventListener("keydown",s),i.OnDispose(()=>{document.removeEventListener("keydown",s)})})}function qt(e){return I({allowedKeys:["Enter"],handler:e})}function Qt(e){return I({allowedKeys:["Escape"],handler:e})}const ft=({mutate:e,convertError:t,onSuccess:n,onError:s,onSettled:a})=>{let o;const r=i.prop(f.AsyncResult.notAsked),c=r.map(g=>f.AsyncResult.isSuccess(g)?g.value:void 0),l=r.map(g=>f.AsyncResult.isFailure(g)?g.error:void 0),h=r.map(g=>f.AsyncResult.isLoading(g)),d=()=>{o?.abort(),o=void 0};return{status:r,value:c,error:l,pending:h,execute:async(g,E)=>{d(),o=new AbortController;const v=o.signal,S=r.get(),A=E?.optimisticValue??(E?.optimisticFromRequest!=null?E.optimisticFromRequest(g):void 0);A!=null?r.set(f.AsyncResult.loading(A)):r.set(f.AsyncResult.loading(f.AsyncResult.getOrUndefined(S)));try{const y=await e({request:g,abortSignal:v,previous:S});o=void 0,r.set(f.AsyncResult.success(y)),n?.(y,g)}catch(y){o=void 0,r.set(f.AsyncResult.failure(t(y))),s?.(t(y),g)}a?.(r.get(),g)},cancel:g=>{d(),r.set(g??f.AsyncResult.notAsked)},dispose:()=>{o?.abort(),o=void 0,r.dispose()}}},gt=(e,t)=>{const{status:n,dispose:s,execute:a,cancel:o,pending:r,error:c,value:l}=e,{content:h}=t,d=i.previousSignal(l);return i.Fragment(i.OnDispose(s),h({previous:d,execute:a,cancel:o,pending:r,error:c,value:l,status:n}))},Bt=({mutate:e,convertError:t=r=>r,onSuccess:n,onError:s,onSettled:a,content:o})=>{const r=ft({mutate:e,convertError:t,onSuccess:n,onError:s,onSettled:a});return gt(r,{content:o})},Yt=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Jt=(e,t={isOpen:!1})=>{const n=[];let s=null;const a=i.Value.deriveProp(t.isOpen);function o(c){s=c,a.set(!0)}function r(){a.set(!1),n.forEach(c=>c()),n.length=0}return i.Fragment(e(o,r),i.When(a,()=>i.Fragment(s?.onClickOutside!=null?dt(s.onClickOutside):null,i.WithElement(c=>i.Portal("body",i.html.div(i.WithElement(l=>{l.style.position="absolute";const h=typeof s?.target=="string"?c.querySelector(s.target):s?.target??c;if(h==null)throw new Error(`Target not found: ${s?.target}`);let d=null;const w=i.Value.toSignal(s?.mainAxisOffset??0),R=i.Value.toSignal(s?.crossAxisOffset??0),O=i.Value.toSignal(s?.placement??"top"),g=i.Value.toSignal(s?.arrowPadding??0),E=s?.arrow,v=i.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function S(){const y=[P.flip(),P.offset({mainAxis:w.get(),crossAxis:R.get()}),P.shift(),P.flip()];E!=null&&d!=null&&y.push(P.arrow({element:d,padding:g.get()}));const D=await P.computePosition(h,l,{placement:O.get(),strategy:"absolute",middleware:y}),{x:Q,y:B,middlewareData:C}=D;if(l.style.top=`${B}px`,l.style.left=`${Q}px`,d!=null&&C.arrow!=null){const{x:Y,y:u,centerOffset:p,alignmentOffset:m}=C.arrow;v.set({x:Y,y:u,centerOffset:p,alignmentOffset:m,containerWidth:l.offsetWidth,containerHeight:l.offsetHeight})}}const A=i.effectOf(w,R,O)(S);return i.Fragment(s?.content,s?.arrow!=null?i.html.div(s?.arrow(i.computedOf(v,O)((y,D)=>({...y,placement:D}))),i.WithElement(y=>{d=y,S()})):null,i.OnDispose(P.autoUpdate(h,l,S),A))})))))))},vt=({request:e,load:t,convertError:n,onSuccess:s,onError:a,onSettled:o})=>{let r;const c=i.prop(f.AsyncResult.notAsked),l=c.map(v=>f.AsyncResult.isSuccess(v)?v.value:void 0),h=c.map(v=>f.AsyncResult.isFailure(v)?v.error:void 0),d=c.map(v=>f.AsyncResult.isLoading(v)),w=()=>{r?.abort(),r=void 0},R=v=>{w(),c.set(v??f.AsyncResult.notAsked)},O=async v=>{w(),r=new AbortController;const S=r.signal,A=c.get();c.set(f.AsyncResult.loading(f.AsyncResult.getOrUndefined(A)));try{const y=await t({request:v,abortSignal:S,previous:A});await Promise.resolve(),r=void 0,c.set(f.AsyncResult.success(y)),s?.(y,v)}catch(y){r=void 0,c.set(f.AsyncResult.failure(n(y))),a?.(n(y),v)}o?.(c.get(),v)},g=()=>O(i.Value.get(e)),E=()=>{r?.abort(),r=void 0,c.dispose()};return c.onDispose(i.Value.on(e,O)),{status:c,value:l,error:h,loading:d,cancel:R,reload:g,dispose:E}},yt=(e,t)=>{const{status:n,dispose:s,reload:a}=e,{pending:o,failure:r,success:c}=t;return i.Fragment(i.OnDispose(s),j(n,{loading:o!=null?l=>o({previous:l,reload:a,cancel:e.cancel}):void 0,failure:r!=null?l=>r({error:l,reload:a}):void 0,success:l=>c({value:l,reload:a})}))},Xt=({request:e,load:t,convertError:n=h=>h,onSuccess:s,onError:a,onSettled:o,success:r,pending:c,failure:l})=>{const h=vt({request:e,load:t,convertError:n,onSuccess:s,onError:a,onSettled:o});return yt(h,{success:r,pending:c,failure:l})},wt=(e,t)=>{if(typeof t=="function")return wt(e,{success:t});const n=t.failure??(a=>(a.on(console.error),a.map(o=>`Error: ${o}`))),s=t.success;return i.OneOfType(i.Value.toSignal(e),{Success:a=>s(a.$.value),Failure:a=>n(a.$.error)})},Gt=()=>i.on.focus(e=>e.target?.select());class H{constructor(t,n,s,a,o,r){this.left=t,this.top=n,this.width=s,this.height=a,this.localLeft=o,this.localTop=r}static of({left:t=0,top:n=0,width:s=0,height:a=0,localLeft:o=0,localTop:r=0}){return new H(t,n,s,a,o,r)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get localCenter(){return{x:this.localLeft+this.width/2,y:this.localTop+this.height/2}}get localBottom(){return this.localTop+this.height}get localRight(){return this.localLeft+this.width}get size(){return{width:this.width,height:this.height}}equals=t=>f.nearEqual(this.left,t.left)&&f.nearEqual(this.top,t.top)&&f.nearEqual(this.width,t.width)&&f.nearEqual(this.height,t.height)}function _(e){const t=e.getBoundingClientRect();return H.of({top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height,localLeft:e.offsetLeft,localTop:e.offsetTop})}const Zt=e=>i.WithBrowserCtx(t=>{const{element:n}=t,s=i.prop(_(n),(c,l)=>c.equals(l)),a=i.renderableOfTNode(e(s)).render(t),o=()=>s.set(H.of(_(n)));let r=null;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(o)),r?.observe(n),i.OnDispose(c=>{r?.disconnect(),a(c)})});function et(e){return{width:e?.innerWidth??0,height:e?.innerHeight??0}}const te=e=>i.WithCtx(()=>{const t=i.getWindow(),n=i.prop(et(t),(a,o)=>a.width===o.width&&a.height===o.height),s=()=>n.set(et(t));return t?.addEventListener("resize",s),i.Fragment(i.OnDispose(()=>{t?.removeEventListener("resize",s)}),e(n))}),St=(e,t)=>{const n=t.split("/").filter(o=>o!==""),s=o=>{try{return decodeURIComponent(o)}catch{return o}},a={};for(let o=0;o<e.length;o++){const r=e[o],c=n[o];if(!c&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==c)return null}else if(r.type==="param")a[r.name]=s(c);else if(r.type==="catch-all"){if(r.name){const l=n.slice(o).join("/");a[r.name]=s(l)}return{params:a,path:t}}}return n.length!==e.length?null:{params:a,path:t}},q=e=>e.split("/").map(t=>{if(t.startsWith(":"))return{type:"param",name:t.slice(1)};if(t.startsWith("*")){const n=t.slice(1);return n!=""?{type:"catch-all",name:n}:{type:"catch-all"}}else return{type:"literal",value:t}}).filter(t=>t.type!=="literal"||t.value!==""),ee=e=>{const t=e.map(n=>{const s=q(n);return{route:n,segments:s}});return function(s){for(const{segments:a,route:o}of t){const r=St(a,s);if(r)return{...r,route:o}}return null}},ne=e=>{if(e==null)throw new Error("NavigationService: no Location handle attached. Make sure to attach one before calling navigation helpers.");return e};class se{handles=[];attach(t){const n=this.handles.lastIndexOf(t);return n!==-1&&this.handles.splice(n,1),this.handles.push(t),()=>this.detach(t)}detach(t){for(let n=this.handles.length-1;n>=0;n--)if(this.handles[n]===t){this.handles.splice(n,1);break}}get current(){return this.handles[this.handles.length-1]}getHandle(){return ne(this.current)}navigate(t,n){this.getHandle().navigate(t,n)}replace(t,n){this.getHandle().replace(t,n)}go(t,n){this.getHandle().go(t,n)}back(t){this.getHandle().back(t)}forward(t){this.getHandle().forward(t)}setPathname(t,n){this.getHandle().setPathname(t,n)}setSearch(t,n){this.getHandle().setSearch(t,n)}setSearchParam(t,n,s){this.getHandle().setSearchParam(t,n,s)}updateSearch(t,n){this.getHandle().updateSearch(t,n)}setHash(t,n){this.getHandle().setHash(t,n)}clearHash(t){this.getHandle().clearHash(t)}run(t,n){this.getHandle().run(t,n)}}const re=new se,F={mark:i.makeProviderMark("RouterContext"),create:()=>{const e=i.prop([]);return{value:e,dispose:()=>e.dispose()}}},ae=(e,t,n)=>{const s=n.split("/").filter(r=>r!==""),a={};let o=0;for(let r=0;r<e.length;r++){const c=e[r],l=s[r];if(!l&&c.type!=="catch-all")return null;if(c.type==="literal"){if(c.value!==l)return null;o++}else if(c.type==="param")a[c.name]=l,o++;else if(c.type==="catch-all"){c.name&&(a[c.name]=s.slice(o).join("/"));const h="/"+s.slice(0,o).join("/"),d="/"+s.slice(o).join("/");return{params:a,matchedPath:h==="/"?"":h,remainingPath:d==="/"?"":d,route:t}}}if(s.length===e.length){const r="/"+s.join("/");return{params:a,matchedPath:r==="/"?"":r,remainingPath:"",route:t}}return null},Rt=e=>{const t=e.map(n=>{const s=q(n);return{route:n,segments:s}});return function(s){for(const{segments:a,route:o}of t){const r=ae(a,o,s);if(r)return r}return null}},oe=e=>{const t=Rt(Object.keys(e));return i.Provide(F,{},()=>i.Use(K,n=>i.Use(F,s=>{const a=n.location.map(o=>{const r=t(o.pathname);if(r==null)throw console.error("No route found for",o),new Error("No route found");const c={matchedPath:r.matchedPath,remainingPath:r.remainingPath,fullPath:o.pathname,params:r.params};return s.value=[...s.value,c],{params:r.params,route:r.route,path:r.matchedPath||o.pathname,search:o.search,hash:o.hash}});return i.OneOfTuple(a.map(o=>[o.route,o]),e)})))},ie=e=>{const t=Rt(Object.keys(e));return i.Use(F,n=>i.Use(K,s=>{const a=n.map(o=>{const r=o[o.length-1];if(r==null)throw console.error("No router context available for ChildRouter",o),new Error("No router context available for ChildRouter");const c=r.remainingPath??"",l=t(c);if(l==null)throw console.error("No route found for remaining path",c),new Error("No route found");return{params:l.params,route:l.route,path:l.matchedPath,search:s.location.value.search,hash:s.location.value.hash}});return i.OneOfTuple(a.map(o=>[o.route,o]),e)}))},U=60*1e3,$=60*U,T=24*$,nt=7*T,st=30*T,ce=365*T,le=[{max:U*90,value:U,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:$*36,value:$,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:T*10,value:T,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:nt*6,value:nt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:st*18,value:st,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:ce,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function rt(e,t,n,s){const a=Math.round(e/t);return a<=1?n:s.replace("{}",a.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const Ot=(e=1e3)=>{const t=i.prop(new Date),n=f.interval(()=>t.set(new Date),e);return t.onDispose(n),t},Et=e=>{const t=Math.abs(e);if(t<U)return e<0?"just now":"in a moment";for(const n of le)if(t<n.max)return e<0?rt(t,n.value,n.past.singular,n.past.plural):rt(t,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},At=(e,{now:t,frequency:n=1e4}={})=>{const s=t!=null?i.Signal.is(t)?t.derive():i.prop(t):Ot(n),a=i.computedOf(e,s)((o,r)=>o.getTime()-r.getTime());return a.onDispose(()=>i.Value.dispose(s)),a},kt=(e,t={})=>{const n=At(e,t),s=n.map(Et);return s.onDispose(()=>n.dispose()),s},ue=(e,t={})=>kt(e,t);class Pt extends i.Prop{tick=()=>this.update(t=>t+1)}const he=(e=0)=>new Pt(e,i.strictEquals);exports.Anchor=ut;exports.Appearance=Ut;exports.AsyncResultView=j;exports.AutoFocus=Kt;exports.AutoSelect=Ct;exports.ChildRouter=ie;exports.ElementRect=Zt;exports.HTMLTitle=_t;exports.HiddenWhenEmpty=zt;exports.InViewport=pt;exports.Location=K;exports.Mutation=Bt;exports.MutationDisplay=gt;exports.NavigationService=re;exports.OnClickOutside=dt;exports.OnEnterKey=qt;exports.OnEscapeKey=Qt;exports.OnKeyPressed=I;exports.PopOver=Jt;exports.Query=Xt;exports.QueryDisplay=yt;exports.Rect=H;exports.ResultView=wt;exports.RootRouter=oe;exports.RouterContextProvider=F;exports.SelectOnFocus=Gt;exports.Ticker=Pt;exports.WhenInViewport=It;exports.WindowSize=te;exports._checkExtensionCondition=ot;exports._getExtension=at;exports._makeRouteMatcher=ee;exports._parseRouteSegments=q;exports.allPlacements=Yt;exports.areLocationsEqual=ct;exports.classes=Nt;exports.evaluateLocationMatch=z;exports.getAbsoluteRect=_;exports.handleAnchorClick=it;exports.locationFromURL=V;exports.makeMutationResource=ft;exports.makeQueryResource=vt;exports.matchesKeyCombo=mt;exports.matchesRoute=St;exports.nowSignal=Ot;exports.relativeTime=ue;exports.relativeTimeMillisSignal=At;exports.relativeTimeSignal=kt;exports.ticker=he;exports.timeDiffToString=Et;exports.urlFromLocation=b;exports.useAppearance=ht;