UNPKG

@tempots/ui

Version:

Provides a higher level of renderables to help fast development with Tempo.

2 lines (1 loc) 38.7 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),A=require("@tempots/std"),Zt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},te=(t,e)=>{const n=Zt(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},We=(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:te(n,r)},ee=(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=>{We(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},ne=(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()},He=()=>{const t=u.prop(Nt(),ne),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),w=l?.state??{};f==="replaceState"||l?.replace?e.history.replaceState(w,"",d):e.history.pushState(w,"",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()}}},Me=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(Me(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}),Rt=t=>{if(t==null)return;const e=`${t}`;return e===""?void 0:e},oe=(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}},Ot=(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=Rt(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:oe(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(g=>g.pathname),s=e.map(g=>({...g.search})),i=e.map(g=>g.hash),r=(g,b)=>Ot(t.location.value,g,b),a=(g,b)=>u.computedOf(e,g)((O,L)=>Ot(O,L,b)),c=(g,b,O)=>{const L=et({...g,hash:Rt(g.hash??void 0)});t.commit(L,b,O)},l=(g,b)=>{const O=Ue(b,"pushState");c(g,b,O)},f=(g,b)=>{const O=g(et(t.location.value));l(O,b)},d=(g,b)=>{const O=t.resolve(g);l(O,b)},w=(g,b)=>{const O={...b,replace:!0};d(g,O)},h=(g,b)=>{t.go(g,b)},m=g=>{t.back(g)},x=g=>{t.forward(g)},p=(g,b)=>f(O=>({...O,pathname:g}),b),v=(g,b)=>f(O=>{const L={...O},$=Rt(g);return $==null?delete L.hash:L.hash=$,L},b),R=g=>v(void 0,g),y=(g,b)=>f(O=>({...O,search:oe(O.search,g)}),b);return{handle:{location:e,url:n,pathname:o,search:s,hash:i,setLocation:l,updateLocation:f,navigate:d,replace:w,go:h,back:m,forward:x,setPathname:p,setHash:v,clearHash:R,setSearch:y,setSearchParam:(g,b,O)=>y({[g]:b},O),updateSearch:(g,b)=>f(O=>({...O,search:{...g({...O.search})}}),b),queryParam:g=>e.map(b=>b.search[g]),run:(g,b)=>{const O=new _e(et(t.location.value));g(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 He();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}}},se=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return se({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(ee(()=>{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))},Ke={mark:u.makeProviderMark("Appearance"),create:()=>{const t=re();return{value:t,dispose:t.dispose}}};function re(){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 kt=(t,e)=>{if(typeof e=="function")return kt(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})},Be=(t=10)=>u.WithElement(e=>u.OnDispose(A.delayed(()=>e?.focus(),t))),je=(t=10)=>u.WithElement(e=>{const n=A.delayed(()=>e.select(),t);return u.OnDispose(n)});function Ie(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)})}),Ye=t=>u.Portal("head > title",u.attr.innerText(t)),Qe={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 Xe(t){return nt[t]==null&&(nt[t]=new IntersectionObserver(e=>{e.forEach(n=>{ut[t].get(n.target)?.set(n.isIntersecting)})},Qe[t])),nt[t]}const ie=({mode:t="partial",once:e=!1},n)=>{const o=u.prop(!1);return u.Fragment(u.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Xe(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)=>ie(t,o=>u.When(o,e,n??(()=>u.Empty)));function ae(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 X=(t,e)=>t===void 0||t===e,$t=(t,e)=>t===void 0||t===e;function ce(t,e){return typeof t=="string"?e.key===t:$t(t.key,e.key)&&$t(t.code,e.code)&&X(t.ctrlKey,e.ctrlKey)&&X(t.altKey,e.altKey)&&X(t.shiftKey,e.shiftKey)&&X(t.metaKey,e.metaKey)&&X(t.repeat,e.repeat)&&X(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function Tt({allowedKeys:t,handler:e}){return u.WithElement(n=>{const o=s=>{if(n.contains(s.target)){for(const i of t)if(ce(i,s)){e(s);break}}};return document.addEventListener("keydown",o),u.OnDispose(()=>{document.removeEventListener("keydown",o)})})}function Ge(t){return Tt({allowedKeys:["Enter"],handler:t})}function Ze(t){return Tt({allowedKeys:["Escape"],handler:t})}const le=({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 p=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:p,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()}}},ue=(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=le({mutate:t,convertError:e,onSuccess:n,onError:o,onSettled:s});return ue(r,{content:i})},G=Math.min,I=Math.max,ht=Math.round,lt=Math.floor,M=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 I(t,G(e,n))}function rt(t,e){return typeof t=="function"?t(e):t}function Y(t){return t.split("-")[0]}function it(t){return t.split("-")[1]}function fe(t){return t==="x"?"y":"x"}function Ct(t){return t==="y"?"height":"width"}const on=new Set(["top","bottom"]);function K(t){return on.has(Y(t))?"y":"x"}function Dt(t){return fe(K(t))}function sn(t,e,n){n===void 0&&(n=!1);const o=it(t),s=Dt(t),i=Ct(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[St(t),e,St(e)]}function St(t){return t.replace(/start|end/g,e=>nn[e])}const zt=["left","right"],Kt=["right","left"],an=["top","bottom"],cn=["bottom","top"];function ln(t,e,n){switch(t){case"top":case"bottom":return n?e?Kt:zt:e?zt:Kt;case"left":case"right":return e?an:cn;default:return[]}}function un(t,e,n,o){const s=it(t);let i=ln(Y(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(St)))),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 he(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 Bt(t,e,n){let{reference:o,floating:s}=t;const i=K(e),r=Dt(e),a=Ct(r),c=Y(e),l=i==="y",f=o.x+o.width/2-s.width/2,d=o.y+o.height/2-s.height/2,w=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]-=w*(n&&l?-1:1);break;case"end":h[r]+=w*(n&&l?-1:1);break}return h}const hn=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}=Bt(l,o,c),w=o,h={},m=0;for(let x=0;x<a.length;x++){const{name:p,fn:v}=a[x],{x:R,y,data:E,reset:S}=await v({x:f,y:d,initialPlacement:o,placement:w,strategy:s,middlewareData:h,rects:l,platform:r,elements:{reference:t,floating:e}});f=R??f,d=y??d,h={...h,[p]:{...h[p],...E}},S&&m<=50&&(m++,typeof S=="object"&&(S.placement&&(w=S.placement),S.rects&&(l=S.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):S.rects),{x:f,y:d}=Bt(l,w,c)),x=-1)}return{x:f,y:d,placement:w,strategy:s,middlewareData:h}};async function de(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:w=!1,padding:h=0}=rt(e,t),m=he(h),p=a[w?d==="floating"?"reference":"floating":d],v=mt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.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)),E=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},S=mt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:y,strategy:c}):R);return{top:(v.top-S.top+m.top)/E.y,bottom:(S.bottom-v.bottom+m.bottom)/E.y,left:(v.left-S.left+m.left)/E.x,right:(S.right-v.right+m.right)/E.x}}const dn=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=he(f),w={x:n,y:o},h=Dt(s),m=Ct(h),x=await r.getDimensions(l),p=h==="y",v=p?"top":"left",R=p?"bottom":"right",y=p?"clientHeight":"clientWidth",E=i.reference[m]+i.reference[h]-w[h]-i.floating[m],S=w[h]-i.reference[h],C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l));let P=C?C[y]:0;(!P||!await(r.isElement==null?void 0:r.isElement(C)))&&(P=a.floating[y]||i.floating[m]);const U=E/2-S/2,g=P/2-x[m]/2-1,b=G(d[v],g),O=G(d[R],g),L=b,$=P-x[m]-O,k=P/2-x[m]/2+U,j=At(L,k,$),_=!c.arrow&&it(s)!=null&&k!==j&&i.reference[m]/2-(k<L?b:O)-x[m]/2<0,D=_?k<L?k-L:k-$:0;return{[h]:w[h]+D,data:{[h]:j,centerOffset:k-j-D,..._&&{alignmentOffset:D}},reset:_}}}),mn=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:w,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:x=!0,...p}=rt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Y(s),R=K(a),y=Y(a)===a,E=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=w||(y||!x?[dt(a)]:rn(a)),C=m!=="none";!w&&C&&S.push(...un(a,x,m,E));const P=[a,...S],U=await de(e,p),g=[];let b=((o=i.flip)==null?void 0:o.overflows)||[];if(f&&g.push(U[v]),d){const k=sn(s,r,E);g.push(U[k[0]],U[k[1]])}if(b=[...b,{placement:s,overflows:g}],!g.every(k=>k<=0)){var O,L;const k=(((O=i.flip)==null?void 0:O.index)||0)+1,j=P[k];if(j&&(!(d==="alignment"?R!==K(j):!1)||b.every(W=>K(W.placement)===R?W.overflows[0]>0:!0)))return{data:{index:k,overflows:b},reset:{placement:j}};let _=(L=b.filter(D=>D.overflows[0]<=0).sort((D,W)=>D.overflows[1]-W.overflows[1])[0])==null?void 0:L.placement;if(!_)switch(h){case"bestFit":{var $;const D=($=b.filter(W=>{if(C){const z=K(W.placement);return z===R||z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(z=>z>0).reduce((z,De)=>z+De,0)]).sort((W,z)=>W[1]-z[1])[0])==null?void 0:$[0];D&&(_=D);break}case"initialPlacement":_=a;break}if(s!==_)return{reset:{placement:_}}}return{}}}},pn=new Set(["left","top"]);async function gn(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=Y(n),a=it(n),c=K(n)==="y",l=pn.has(r)?-1:1,f=i&&c?-1:1,d=rt(e,t);let{mainAxis:w,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:w*l}:{x:w*l,y:h*f}}const wn=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 gn(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}}}}},yn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:a={fn:p=>{let{x:v,y:R}=p;return{x:v,y:R}}},...c}=rt(t,e),l={x:n,y:o},f=await de(e,c),d=K(Y(s)),w=fe(d);let h=l[w],m=l[d];if(i){const p=w==="y"?"top":"left",v=w==="y"?"bottom":"right",R=h+f[p],y=h-f[v];h=At(R,h,y)}if(r){const p=d==="y"?"top":"left",v=d==="y"?"bottom":"right",R=m+f[p],y=m-f[v];m=At(R,m,y)}const x=a.fn({...e,[w]:h,[d]:m});return{...x,data:{x:x.x-n,y:x.y-o,enabled:{[w]:i,[d]:r}}}}}};function yt(){return typeof window<"u"}function tt(t){return me(t)?(t.nodeName||"").toLowerCase():"#document"}function T(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 T(t).Node:!1}function F(t){return yt()?t instanceof Element||t instanceof T(t).Element:!1}function V(t){return yt()?t instanceof HTMLElement||t instanceof T(t).HTMLElement:!1}function jt(t){return!yt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof T(t).ShadowRoot}const vn=new Set(["inline","contents"]);function at(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!vn.has(s)}const xn=new Set(["table","td","th"]);function bn(t){return xn.has(tt(t))}const Rn=[":popover-open",":modal"];function vt(t){return Rn.some(e=>{try{return t.matches(e)}catch{return!1}})}const On=["transform","translate","scale","rotate","perspective"],An=["transform","translate","scale","rotate","perspective","filter"],Sn=["paint","layout","strict","content"];function Wt(t){const e=Ft(),n=F(t)?H(t):t;return On.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))||Sn.some(o=>(n.contain||"").includes(o))}function En(t){let e=B(t);for(;V(e)&&!Z(e);){if(Wt(e))return e;if(vt(e))return null;e=B(e)}return null}function Ft(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Pn=new Set(["html","body","#document"]);function Z(t){return Pn.has(tt(t))}function H(t){return T(t).getComputedStyle(t)}function xt(t){return F(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(tt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||jt(t)&&t.host||N(t);return jt(e)?e.host:e}function pe(t){const e=B(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=T(s);if(i){const a=Et(r);return e.concat(r,r.visualViewport||[],at(s)?s:[],a&&n?ot(a):[])}return e.concat(s,ot(s,[],n))}function Et(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ge(t){const e=H(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 M(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 Ln=M(0);function we(t){const e=T(t);return!Ft()||!e.visualViewport?Ln:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function kn(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==T(t)?!1:e}function Q(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Ht(t);let r=M(1);e&&(o?F(o)&&(r=J(o)):r=J(t));const a=kn(i,n,o)?we(i):M(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 w=T(i),h=o&&F(o)?T(o):o;let m=w,x=Et(m);for(;x&&o&&h!==m;){const p=J(x),v=x.getBoundingClientRect(),R=H(x),y=v.left+(x.clientLeft+parseFloat(R.paddingLeft))*p.x,E=v.top+(x.clientTop+parseFloat(R.paddingTop))*p.y;c*=p.x,l*=p.y,f*=p.x,d*=p.y,c+=y,l+=E,m=T(x),x=Et(m)}}return mt({width:f,height:d,x:c,y:l})}function Mt(t,e){const n=xt(t).scrollLeft;return e?e.left+n:Q(N(t)).left+n}function ye(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Mt(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Tn(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=M(1);const f=M(0),d=V(o);if((d||!d&&!i)&&((tt(o)!=="body"||at(r))&&(c=xt(o)),V(o))){const h=Q(o);l=J(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const w=r&&!d&&!i?ye(r,c,!0):M(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+f.x+w.x,y:n.y*l.y-c.scrollTop*l.y+f.y+w.y}}function Cn(t){return Array.from(t.getClientRects())}function Dn(t){const e=N(t),n=xt(t),o=t.ownerDocument.body,s=I(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=I(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Mt(t);const a=-n.scrollTop;return H(o).direction==="rtl"&&(r+=I(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:a}}function Wn(t,e){const n=T(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 l=Ft();(!l||l&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:r,x:a,y:c}}function Fn(t,e){const n=Q(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=V(t)?J(t):M(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 It(t,e,n){let o;if(e==="viewport")o=Wn(t,n);else if(e==="document")o=Dn(N(t));else if(F(e))o=Fn(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=B(t);return n===e||!F(n)||Z(n)?!1:H(n).position==="fixed"||ve(n,e)}function Hn(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=H(t).position==="fixed";let r=i?B(t):t;for(;F(r)&&!Z(r);){const a=H(r),c=Wt(r);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||at(r)&&!c&&ve(t,r))?o=o.filter(f=>f!==r):s=a,r=B(r)}return e.set(t,o),o}function Mn(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?vt(e)?[]:Hn(e,this._c):[].concat(n),o],a=r[0],c=r.reduce((l,f)=>{const d=It(e,f,s);return l.top=I(d.top,l.top),l.right=G(d.right,l.right),l.bottom=G(d.bottom,l.bottom),l.left=I(d.left,l.left),l},It(e,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Vn(t){const{width:e,height:n}=ge(t);return{width:e,height:n}}function Nn(t,e,n){const o=V(e),s=N(e),i=n==="fixed",r=Q(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const c=M(0);function l(){c.x=Mt(s)}if(o||!o&&!i)if((tt(e)!=="body"||at(s))&&(a=xt(e)),o){const h=Q(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):M(0),d=r.left+a.scrollLeft-c.x-f.x,w=r.top+a.scrollTop-c.y-f.y;return{x:d,y:w,width:r.width,height:r.height}}function bt(t){return H(t).position==="static"}function qt(t,e){if(!V(t)||H(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=T(t);if(vt(t))return n;if(!V(t)){let s=B(t);for(;s&&!Z(s);){if(F(s)&&!bt(s))return s;s=B(s)}return n}let o=qt(t,e);for(;o&&bn(o)&&bt(o);)o=qt(o,e);return o&&Z(o)&&bt(o)&&!Wt(o)?n:o||En(t)||n}const _n=async function(t){const e=this.getOffsetParent||xe,n=this.getDimensions,o=await n(t.floating);return{reference:Nn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Un(t){return H(t).direction==="rtl"}const $n={convertOffsetParentRelativeRectToViewportRelativeRect:Tn,getDocumentElement:N,getClippingRect:Mn,getOffsetParent:xe,getElementRects:_n,getClientRects:Cn,getDimensions:Vn,getScale:J,isElement:F,isRTL:Un};function be(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function zn(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:w,height:h}=l;if(a||e(),!w||!h)return;const m=lt(d),x=lt(s.clientWidth-(f+w)),p=lt(s.clientHeight-(d+h)),v=lt(f),y={rootMargin:-m+"px "+-x+"px "+-p+"px "+-v+"px",threshold:I(0,G(1,c))||1};let E=!0;function S(C){const P=C[0].intersectionRatio;if(P!==c){if(!E)return r();P?r(!1,P):o=setTimeout(()=>{r(!1,1e-7)},1e3)}P===1&&!be(l,t.getBoundingClientRect())&&r(),E=!1}try{n=new IntersectionObserver(S,{...y,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(t)}return r(!0),i}function Kn(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?zn(l,n):null;let w=-1,h=null;r&&(h=new ResizeObserver(v=>{let[R]=v;R&&R.target===l&&h&&(h.unobserve(e),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(e)})),n()}),l&&!c&&h.observe(l),h.observe(e));let m,x=c?Q(t):null;c&&p();function p(){const v=Q(t);x&&!be(x,v)&&n(),x=v,m=requestAnimationFrame(p)}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 Bn=wn,jn=yn,Yt=mn,In=dn,qn=(t,e,n)=>{const o=new Map,s={platform:$n,...n},i={...s.platform,_c:o};return hn(t,e,{...s,platform:i})},Yn=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Qn=(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?ae(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),w=u.Value.toSignal(o?.crossAxisOffset??0),h=u.Value.toSignal(o?.placement??"top"),m=u.Value.toSignal(o?.arrowPadding??0),x=o?.arrow,p=u.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function v(){const y=[Yt(),Bn({mainAxis:d.get(),crossAxis:w.get()}),jn(),Yt()];x!=null&&f!=null&&y.push(In({element:f,padding:m.get()}));const E=await qn(l,c,{placement:h.get(),strategy:"absolute",middleware:y}),{x:S,y:C,middlewareData:P}=E;if(c.style.top=`${C}px`,c.style.left=`${S}px`,f!=null&&P.arrow!=null){const{x:U,y:g,centerOffset:b,alignmentOffset:O}=P.arrow;p.set({x:U,y:g,centerOffset:b,alignmentOffset:O,containerWidth:c.offsetWidth,containerHeight:c.offsetHeight})}}const R=u.effectOf(d,w,h)(v);return u.Fragment(o?.content,o?.arrow!=null?u.html.div(o?.arrow(u.computedOf(p,h)((y,E)=>({...y,placement:E}))),u.WithElement(y=>{f=y,v()})):null,u.OnDispose(Kn(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(p=>A.AsyncResult.isSuccess(p)?p.value:void 0),l=a.map(p=>A.AsyncResult.isFailure(p)?p.error:void 0),f=a.map(p=>A.AsyncResult.isLoading(p)),d=()=>{r?.abort(),r=void 0},w=p=>{d(),a.set(p??A.AsyncResult.notAsked)},h=async p=>{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:p,abortSignal:v,previous:R});await Promise.resolve(),r=void 0,a.set(A.AsyncResult.success(y)),o?.(y,p)}catch(y){r=void 0,a.set(A.AsyncResult.failure(n(y))),s?.(n(y),p)}i?.(a.get(),p)},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:w,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),kt(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})}))},Xn=({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})},Ae=(t,e)=>{if(typeof e=="function")return Ae(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)})},Jn=()=>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 Pt(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 Gn=t=>u.WithBrowserCtx(e=>{const{element:n}=e,o=u.prop(Pt(n),(a,c)=>a.equals(c)),s=u.renderableOfTNode(t(o)).render(e),i=()=>o.set(ct.of(Pt(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 Zn=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))}),Se=(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!==""),to=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=Se(s,o);if(r)return{...r,route:i}}return null}},eo=t=>{if(t==null)throw new Error("NavigationService: no Location handle attached. Make sure to attach one before calling navigation helpers.");return t};class no{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 eo(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 oo=new no,pt={mark:u.makeProviderMark("RouterContext"),create:()=>{const t=u.prop([]);return{value:t,dispose:()=>t.dispose()}}},so=(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=so(s,i,o);if(r)return r}return null}},ro=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)})))},io=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,Lt=60*gt,st=24*Lt,Xt=7*st,Jt=30*st,ao=365*st,co=[{max:gt*90,value:gt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Lt*36,value:Lt,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:Xt*6,value:Xt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Jt*18,value:Jt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:ao,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Gt(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 co)if(e<n.max)return t<0?Gt(e,n.value,n.past.singular,n.past.plural):Gt(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},lo=(t,e={})=>Te(t,e);class Ce extends u.Prop{tick=()=>this.update(e=>e+1)}const uo=(t=0)=>new Ce(t,(e,n)=>e===n);exports.Anchor=se;exports.Appearance=Ke;exports.AsyncResultView=kt;exports.AutoFocus=Be;exports.AutoSelect=je;exports.ChildRouter=io;exports.ElementRect=Gn;exports.HTMLTitle=Ye;exports.HiddenWhenEmpty=qe;exports.InViewport=ie;exports.Location=wt;exports.Mutation=tn;exports.MutationDisplay=ue;exports.NavigationService=oo;exports.OnClickOutside=ae;exports.OnEnterKey=Ge;exports.OnEscapeKey=Ze;exports.OnKeyPressed=Tt;exports.PopOver=Qn;exports.Query=Xn;exports.QueryDisplay=Oe;exports.Rect=ct;exports.ResultView=Ae;exports.RootRouter=ro;exports.RouterContextProvider=pt;exports.SelectOnFocus=Jn;exports.Ticker=Ce;exports.WhenInViewport=Je;exports.WindowSize=Zn;exports._checkExtensionCondition=te;exports._getExtension=Zt;exports._makeRouteMatcher=to;exports._parseRouteSegments=Vt;exports.allPlacements=Yn;exports.areLocationsEqual=ne;exports.classes=Ie;exports.evaluateLocationMatch=Ot;exports.getAbsoluteRect=Pt;exports.handleAnchorClick=ee;exports.locationFromURL=ft;exports.makeMutationResource=le;exports.makeQueryResource=Re;exports.matchesKeyCombo=ce;exports.matchesRoute=Se;exports.nowSignal=Pe;exports.relativeTime=lo;exports.relativeTimeMillisSignal=ke;exports.relativeTimeSignal=Te;exports.ticker=uo;exports.timeDiffToString=Le;exports.urlFromLocation=q;exports.useAppearance=re;