@tempots/ui 4.1.3 → 4.2.1

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.
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var ge=Object.defineProperty;var ye=(t,e,n)=>e in t?ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ft=(t,e,n)=>ye(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),R=require("@tempots/std"),Ut=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Bt=(t,e)=>{const n=Ut(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:c,hash:l}=i;if(o){const a=r+c+l,h=i.getAttribute("href");if(!(h!=null&&h.startsWith("#"))&&h!==a)return!0}return e?!1:Bt(n,r)},Ht=(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()}},$t=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,wt=(t,e)=>{var i;const n=new URL(t,e??((i=u.getWindow())==null?void 0:i.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}},dt=(t,e)=>{const n=wt(e);return t.set(n),t},Z=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},ve=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),xe=t=>{const e=t.container.currentURL,n=e.iso(o=>wt(o),o=>{if(ve(o.pathname))return Z(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return Z({...o,pathname:i})});return{value:n,dispose:n.dispose}},be=()=>{const t=u.getWindow(),e=(t==null?void 0:t.location.hash)===""?void 0:(t==null?void 0:t.location.hash.substring(1))??void 0;return{pathname:(t==null?void 0:t.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((t==null?void 0:t.location.search)??"").entries()),hash:e}},Re=()=>{const t=u.prop(be(),$t),e=u.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",Z(o))}),{value:t,dispose:t.dispose}},vt={mark:u.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Re();if(e.isHeadless())return xe(e);throw new Error("Unknown context")}},Ae=t=>{document.startViewTransition?document.startViewTransition(t):t()},zt=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return zt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return u.Use(vt,i=>u.html.a(u.on.click(Ht(()=>(o==!0?Ae(()=>{dt(i,u.Value.get(n))}):dt(i,u.Value.get(n)),!0),s)),u.attr.href(n),...e))},Ee={mark:u.makeProviderMark("Appearance"),create:()=>{const t=_t();return{value:t,dispose:t.dispose}}};function _t(){const t=u.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=u.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),o.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),o}const xt=(t,e)=>{if(typeof e=="function")return xt(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),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(c=>c.previousValue)),NotAsked:i})},Oe=(t=10)=>u.WithElement(e=>u.OnDispose(R.delayed(()=>e==null?void 0:e.focus(),t))),Le=(t=10)=>u.WithElement(e=>{const n=R.delayed(()=>e.select(),t);return u.OnDispose(n)}),Se=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)})}),Te=t=>u.Portal("head > title",u.attr.innerText(t)),ke={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},Q={partial:new Map,full:new Map},j={partial:null,full:null};function Ce(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=Q[t].get(n.target);o==null||o.set(n.isIntersecting)})},ke[t])),j[t]}const It=({mode:t="partial",once:e=!1},n)=>{const o=u.prop(!1);return u.Fragment(u.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Ce(t):null;Q[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),Q[t].delete(s),Q[t].size===0&&((l=j[t])==null||l.disconnect(),j[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),u.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),u.renderableOfTNode(n(o)))},De=(t,e,n)=>It(t,o=>u.When(o,e,n??(()=>u.Empty))),tt=Math.min,F=Math.max,et=Math.round,G=Math.floor,S=t=>({x:t,y:t}),We={left:"right",right:"left",bottom:"top",top:"bottom"},Pe={start:"end",end:"start"};function kt(t,e,n){return F(t,tt(e,n))}function it(t,e){return typeof t=="function"?t(e):t}function V(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function jt(t){return t==="x"?"y":"x"}function qt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(V(t))?"y":"x"}function Yt(t){return jt(H(t))}function Fe(t,e,n){n===void 0&&(n=!1);const o=rt(t),s=Yt(t),i=qt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=nt(r)),[r,nt(r)]}function Ve(t){const e=nt(t);return[pt(t),e,pt(e)]}function pt(t){return t.replace(/start|end/g,e=>Pe[e])}function Me(t,e,n){const o=["left","right"],s=["right","left"],i=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:o:e?o:s;case"left":case"right":return e?i:r;default:return[]}}function Ne(t,e,n,o){const s=rt(t);let i=Me(V(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(pt)))),i}function nt(t){return t.replace(/left|right|bottom|top/g,e=>We[e])}function Ue(t){return{top:0,right:0,bottom:0,left:0,...t}}function Be(t){return typeof t!="number"?Ue(t):{top:t,right:t,bottom:t,left:t}}function ot(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 Ct(t,e,n){let{reference:o,floating:s}=t;const i=H(e),r=Yt(e),c=qt(r),l=V(e),a=i==="y",h=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let d;switch(l){case"top":d={x:h,y:o.y-s.height};break;case"bottom":d={x:h,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:f};break;case"left":d={x:o.x-s.width,y:f};break;default:d={x:o.x,y:o.y}}switch(rt(e)){case"start":d[r]-=p*(n&&a?-1:1);break;case"end":d[r]+=p*(n&&a?-1:1);break}return d}const He=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:f}=Ct(a,o,l),p=o,d={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x:v,y:x,data:A,reset:b}=await g({x:h,y:f,initialPlacement:o,placement:p,strategy:s,middlewareData:d,rects:a,platform:r,elements:{reference:t,floating:e}});h=v??h,f=x??f,d={...d,[w]:{...d[w],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(a=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:h,y:f}=Ct(a,p,l)),y=-1)}return{x:h,y:f,placement:p,strategy:s,middlewareData:d}};async function Kt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=it(e,t),m=Be(d),w=c[p?f==="floating"?"reference":"floating":f],g=ot(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:h,strategy:l})),v=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},b=ot(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:l}):v);return{top:(g.top-b.top+m.top)/A.y,bottom:(b.bottom-g.bottom+m.bottom)/A.y,left:(g.left-b.left+m.left)/A.x,right:(b.right-g.right+m.right)/A.x}}const $e=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:c,platform:l,elements:a}=e,{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=it(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=V(s),v=H(c),x=V(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(a.floating)),b=p||(x||!y?[nt(c)]:Ve(c)),N=m!=="none";!p&&N&&b.push(...Ne(c,y,m,A));const pe=[c,...b],ut=await Kt(e,w),J=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(h&&J.push(ut[g]),f){const P=Fe(s,r,A);J.push(ut[P[0]],ut[P[1]])}if(_=[..._,{placement:s,overflows:J}],!J.every(P=>P<=0)){var Ot,Lt;const P=(((Ot=i.flip)==null?void 0:Ot.index)||0)+1,Tt=pe[P];if(Tt)return{data:{index:P,overflows:_},reset:{placement:Tt}};let I=(Lt=_.filter(U=>U.overflows[0]<=0).sort((U,C)=>U.overflows[1]-C.overflows[1])[0])==null?void 0:Lt.placement;if(!I)switch(d){case"bestFit":{var St;const U=(St=_.filter(C=>{if(N){const D=H(C.placement);return D===v||D==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(D=>D>0).reduce((D,me)=>D+me,0)]).sort((C,D)=>C[1]-D[1])[0])==null?void 0:St[0];U&&(I=U);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};async function ze(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=V(n),c=rt(n),l=H(n)==="y",a=["left","top"].includes(r)?-1:1,h=i&&l?-1:1,f=it(e,t);let{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(d=c==="end"?m*-1:m),l?{x:d*h,y:p*a}:{x:p*a,y:d*h}}const _e=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:c}=e,l=await ze(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},Ie=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:c={fn:w=>{let{x:g,y:v}=w;return{x:g,y:v}}},...l}=it(t,e),a={x:n,y:o},h=await Kt(e,l),f=H(V(s)),p=jt(f);let d=a[p],m=a[f];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=d+h[w],x=d-h[g];d=kt(v,d,x)}if(r){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=m+h[w],x=m-h[g];m=kt(v,m,x)}const y=c.fn({...e,[p]:d,[f]:m});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[p]:i,[f]:r}}}}}};function ct(){return typeof window<"u"}function z(t){return Xt(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(Xt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Xt(t){return ct()?t instanceof Node||t instanceof E(t).Node:!1}function O(t){return ct()?t instanceof Element||t instanceof E(t).Element:!1}function T(t){return ct()?t instanceof HTMLElement||t instanceof E(t).HTMLElement:!1}function Dt(t){return!ct()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=L(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function je(t){return["table","td","th"].includes(z(t))}function lt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function bt(t){const e=Rt(),n=O(t)?L(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function qe(t){let e=W(t);for(;T(e)&&!$(e);){if(bt(e))return e;if(lt(e))return null;e=W(e)}return null}function Rt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $(t){return["html","body","#document"].includes(z(t))}function L(t){return E(t).getComputedStyle(t)}function at(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Dt(t)&&t.host||k(t);return Dt(e)?e.host:e}function Jt(t){const e=W(t);return $(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&K(e)?e:Jt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Jt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=E(s);if(i){const c=mt(r);return e.concat(r,r.visualViewport||[],K(s)?s:[],c&&n?q(c):[])}return e.concat(s,q(s,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Gt(t){const e=L(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=T(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=et(n)!==i||et(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function At(t){return O(t)?t:t.contextElement}function B(t){const e=At(t);if(!T(e))return S(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Gt(e);let r=(i?et(n.width):n.width)/o,c=(i?et(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Ye=S(0);function Qt(t){const e=E(t);return!Rt()||!e.visualViewport?Ye:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ke(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==E(t)?!1:e}function M(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=At(t);let r=S(1);e&&(o?O(o)&&(r=B(o)):r=B(t));const c=Ke(i,n,o)?Qt(i):S(0);let l=(s.left+c.x)/r.x,a=(s.top+c.y)/r.y,h=s.width/r.x,f=s.height/r.y;if(i){const p=E(i),d=o&&O(o)?E(o):o;let m=p,y=mt(m);for(;y&&o&&d!==m;){const w=B(y),g=y.getBoundingClientRect(),v=L(y),x=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(v.paddingTop))*w.y;l*=w.x,a*=w.y,h*=w.x,f*=w.y,l+=x,a+=A,m=E(y),y=mt(m)}}return ot({width:h,height:f,x:l,y:a})}function Et(t,e){const n=at(t).scrollLeft;return e?e.left+n:M(k(t)).left+n}function Zt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Et(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Xe(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=k(o),c=e?lt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},a=S(1);const h=S(0),f=T(o);if((f||!f&&!i)&&((z(o)!=="body"||K(r))&&(l=at(o)),T(o))){const d=M(o);a=B(o),h.x=d.x+o.clientLeft,h.y=d.y+o.clientTop}const p=r&&!f&&!i?Zt(r,l,!0):S(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+h.x+p.x,y:n.y*a.y-l.scrollTop*a.y+h.y+p.y}}function Je(t){return Array.from(t.getClientRects())}function Ge(t){const e=k(t),n=at(t),o=t.ownerDocument.body,s=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Et(t);const c=-n.scrollTop;return L(o).direction==="rtl"&&(r+=F(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function Qe(t,e){const n=E(t),o=k(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const a=Rt();(!a||a&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function Ze(t,e){const n=M(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=T(t)?B(t):S(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,a=o*i.y;return{width:r,height:c,x:l,y:a}}function Wt(t,e,n){let o;if(e==="viewport")o=Qe(t,n);else if(e==="document")o=Ge(k(t));else if(O(e))o=Ze(e,n);else{const s=Qt(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ot(o)}function te(t,e){const n=W(t);return n===e||!O(n)||$(n)?!1:L(n).position==="fixed"||te(n,e)}function tn(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&z(c)!=="body"),s=null;const i=L(t).position==="fixed";let r=i?W(t):t;for(;O(r)&&!$(r);){const c=L(r),l=bt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||K(r)&&!l&&te(t,r))?o=o.filter(h=>h!==r):s=c,r=W(r)}return e.set(t,o),o}function en(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?lt(e)?[]:tn(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((a,h)=>{const f=Wt(e,h,s);return a.top=F(f.top,a.top),a.right=tt(f.right,a.right),a.bottom=tt(f.bottom,a.bottom),a.left=F(f.left,a.left),a},Wt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function nn(t){const{width:e,height:n}=Gt(t);return{width:e,height:n}}function on(t,e,n){const o=T(e),s=k(e),i=n==="fixed",r=M(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=S(0);if(o||!o&&!i)if((z(e)!=="body"||K(s))&&(c=at(e)),o){const p=M(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&(l.x=Et(s));const a=s&&!o&&!i?Zt(s,c):S(0),h=r.left+c.scrollLeft-l.x-a.x,f=r.top+c.scrollTop-l.y-a.y;return{x:h,y:f,width:r.width,height:r.height}}function ht(t){return L(t).position==="static"}function Pt(t,e){if(!T(t)||L(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function ee(t,e){const n=E(t);if(lt(t))return n;if(!T(t)){let s=W(t);for(;s&&!$(s);){if(O(s)&&!ht(s))return s;s=W(s)}return n}let o=Pt(t,e);for(;o&&je(o)&&ht(o);)o=Pt(o,e);return o&&$(o)&&ht(o)&&!bt(o)?n:o||qe(t)||n}const sn=async function(t){const e=this.getOffsetParent||ee,n=this.getDimensions,o=await n(t.floating);return{reference:on(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function rn(t){return L(t).direction==="rtl"}const cn={convertOffsetParentRelativeRectToViewportRelativeRect:Xe,getDocumentElement:k,getClippingRect:en,getOffsetParent:ee,getElementRects:sn,getClientRects:Je,getDimensions:nn,getScale:B,isElement:O,isRTL:rn};function ln(t,e){let n=null,o;const s=k(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:a,top:h,width:f,height:p}=t.getBoundingClientRect();if(c||e(),!f||!p)return;const d=G(h),m=G(s.clientWidth-(a+f)),y=G(s.clientHeight-(h+p)),w=G(a),v={rootMargin:-d+"px "+-m+"px "+-y+"px "+-w+"px",threshold:F(0,tt(1,l))||1};let x=!0;function A(b){const N=b[0].intersectionRatio;if(N!==l){if(!x)return r();N?r(!1,N):o=setTimeout(()=>{r(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(A,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,v)}n.observe(t)}return r(!0),i}function an(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=At(t),h=s||i?[...a?q(a):[],...q(e)]:[];h.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=a&&c?ln(a,n):null;let p=-1,d=null;r&&(d=new ResizeObserver(g=>{let[v]=g;v&&v.target===a&&d&&(d.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(e)})),n()}),a&&!l&&d.observe(a),d.observe(e));let m,y=l?M(t):null;l&&w();function w(){const g=M(t);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&n(),y=g,m=requestAnimationFrame(w)}return n(),()=>{var g;h.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(g=d)==null||g.disconnect(),d=null,l&&cancelAnimationFrame(m)}}const un=_e,fn=Ie,Ft=$e,hn=(t,e,n)=>{const o=new Map,s={platform:cn,...n},i={...s.platform,_c:o};return He(t,e,{...s,platform:i})},dn=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:s}={mainAxis:0,crossAxis:0}})=>u.WithBrowserCtx(i=>{const r=u.Value.toSignal(e),c=i.element;return u.When(r,()=>u.Portal("body",u.html.div(u.WithElement(l=>{const a=l;return a.style.position="absolute",u.OnDispose(an(c,a,async()=>{const{x:h,y:f}=await hn(c,a,{placement:n,strategy:"absolute",middleware:[Ft(),un({mainAxis:o,crossAxis:s}),fn(),Ft()]});a.style.top=`${f}px`,a.style.left=`${h}px`}))}),t())))}),ne=(t,e,n)=>{const o=u.prop(R.AsyncResult.notAsked),s=o.map(f=>R.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>R.AsyncResult.isFailure(f)?f.error:void 0),r=o.map(f=>R.AsyncResult.isLoading(f));let c;const l=async f=>{c==null||c.abort(),c=new AbortController;const p=c.signal,d=o.get();o.set(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(d)));try{const m=await e({request:f,abortSignal:p,previous:d});await Promise.resolve(),c=void 0,o.set(R.AsyncResult.success(m))}catch(m){c=void 0,o.set(R.AsyncResult.failure(n(m)))}},a=()=>l(u.Value.get(t)),h=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(u.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:a,dispose:h}},oe=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return u.Fragment(u.OnDispose(o),xt(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},pn=({request:t,load:e,mapError:n=o=>o})=>{const o=ne(t,e,n);return s=>oe(o,s)},se=(t,e)=>{if(typeof e=="function")return se(t,{success:e});const n=e.failure??(s=>u.Fragment(u.OnDispose(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)})},mn=()=>u.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class X{constructor(e,n,o,s){ft(this,"equals",e=>R.nearEquals(this.left,e.left)&&R.nearEquals(this.top,e.top)&&R.nearEquals(this.width,e.width)&&R.nearEquals(this.height,e.height));this.left=e,this.top=n,this.width=o,this.height=s}static of({left:e=0,top:n=0,width:o=0,height:s=0}){return new X(e,n,o,s)}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 size(){return{width:this.width,height:this.height}}}function gt(t){const e=t.getBoundingClientRect();return X.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const ie=t=>u.WithBrowserCtx(e=>{const{element:n}=e,o=u.prop(gt(n)),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set(X.of(gt(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),u.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),gn=t=>ie(t),yn=t=>e=>{const n=u.getWindow(),o=u.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},re=(t,e)=>{const n=e.split("/").filter(s=>s!==""),o={};for(let s=0;s<t.length;s++){const i=t[s],r=n[s];if(!r&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==r)return null}else if(i.type==="param")o[i.name]=r;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},ce=t=>t.split("/").map(e=>e.startsWith(":")?{type:"param",name:e.slice(1)}:e==="*"?{type:"catch-all"}:{type:"literal",value:e}).filter(e=>e.type!=="literal"||e.value!==""),le=t=>{const e=t.map(n=>{const o=ce(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=re(s,o);if(r)return{...r,route:i}}return null}},wn=t=>{const e=le(Object.keys(t));return u.Use(vt,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return u.OneOfTuple(o.map(s=>[s.route,s]),t)})},st=60*1e3,yt=60*st,Y=24*yt,Vt=7*Y,Mt=30*Y,vn=365*Y,xn=[{max:st*90,value:st,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:yt*36,value:yt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:Y*10,value:Y,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Vt*6,value:Vt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Mt*18,value:Mt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:vn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Nt(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 ae=(t=1e3)=>{const e=u.prop(new Date),n=R.interval(()=>e.set(new Date),t);return e.onDispose(n),e},ue=t=>{const e=Math.abs(t);if(e<st)return t<0?"just now":"in a moment";for(const n of xn)if(e<n.max)return t<0?Nt(e,n.value,n.past.singular,n.past.plural):Nt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},fe=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?u.Signal.is(e)?e.derive():u.prop(e):ae(n),s=u.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>u.Value.dispose(o)),s},he=(t,e={})=>{const n=fe(t,e),o=n.map(ue);return o.onDispose(n.dispose),o},bn=(t,e={})=>he(t,e);class de extends u.Prop{constructor(){super(...arguments);ft(this,"tick",()=>this.update(n=>n+1))}}const Rn=(t=0)=>new de(t,(e,n)=>e===n);exports.Anchor=zt;exports.Appearance=Ee;exports.AsyncResultView=xt;exports.AutoFocus=Oe;exports.AutoSelect=Le;exports.ElementRect=ie;exports.ElementSize=gn;exports.HTMLTitle=Te;exports.HiddenWhenEmpty=Se;exports.InViewport=It;exports.Location=vt;exports.PopOver=dn;exports.Rect=X;exports.Resource=pn;exports.ResourceDisplay=oe;exports.ResultView=se;exports.Router=wn;exports.SelectOnFocus=mn;exports.Ticker=de;exports.WhenInViewport=De;exports.WindowSize=yn;exports._checkExtensionCondition=Bt;exports._getExtension=Ut;exports._makeRouteMatcher=le;exports._parseRouteSegments=ce;exports.areLocationsEqual=$t;exports.getAbsoluteRect=gt;exports.handleAnchorClick=Ht;exports.locationFromURL=wt;exports.makeResource=ne;exports.matchesRoute=re;exports.nowSignal=ae;exports.relativeTime=bn;exports.relativeTimeMillisSignal=fe;exports.relativeTimeSignal=he;exports.setLocationFromUrl=dt;exports.ticker=Rn;exports.timeDiffToString=ue;exports.urlFromLocation=Z;exports.useAppearance=_t;
1
+ "use strict";var ge=Object.defineProperty;var ye=(t,e,n)=>e in t?ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ft=(t,e,n)=>ye(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),A=require("@tempots/std"),Ut=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},$t=(t,e)=>{const n=Ut(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:c,hash:l}=i;if(o){const u=r+c+l,h=i.getAttribute("href");if(!(h!=null&&h.startsWith("#"))&&h!==u)return!0}return e?!1:$t(n,r)},Bt=(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()}},Ht=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,wt=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.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}},dt=(t,e)=>{const n=wt(e);return t.set(n),t},Z=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},ve=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),xe=t=>{const e=t.container.currentURL,n=e.iso(o=>wt(o),o=>{if(ve(o.pathname))return Z(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return Z({...o,pathname:i})});return{value:n,dispose:n.dispose}},be=()=>{const t=a.getWindow(),e=(t==null?void 0:t.location.hash)===""?void 0:(t==null?void 0:t.location.hash.substring(1))??void 0;return{pathname:(t==null?void 0:t.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((t==null?void 0:t.location.search)??"").entries()),hash:e}},Ae=()=>{const t=a.prop(be(),Ht),e=a.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",Z(o))}),{value:t,dispose:t.dispose}},vt={mark:a.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Ae();if(e.isHeadless())return xe(e);throw new Error("Unknown context")}},Re=t=>{document.startViewTransition?document.startViewTransition(t):t()},zt=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return zt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return a.Use(vt,i=>a.html.a(a.on.click(Bt(()=>(o==!0?Re(()=>{dt(i,a.Value.get(n))}):dt(i,a.Value.get(n)),!0),s)),a.attr.href(n),...e))},Ee={mark:a.makeProviderMark("Appearance"),create:()=>{const t=_t();return{value:t,dispose:t.dispose}}};function _t(){const t=a.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=a.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),o.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),o}const xt=(t,e)=>{if(typeof e=="function")return xt(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Oe=(t=10)=>a.WithElement(e=>a.OnDispose(A.delayed(()=>e==null?void 0:e.focus(),t))),Se=(t=10)=>a.WithElement(e=>{const n=A.delayed(()=>e.select(),t);return a.OnDispose(n)}),Le=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Te=t=>a.Portal("head > title",a.attr.innerText(t)),ke={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},Q={partial:new Map,full:new Map},j={partial:null,full:null};function Ce(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=Q[t].get(n.target);o==null||o.set(n.isIntersecting)})},ke[t])),j[t]}const It=({mode:t="partial",once:e=!1},n)=>{const o=a.prop(!1);return a.Fragment(a.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Ce(t):null;Q[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),Q[t].delete(s),Q[t].size===0&&((l=j[t])==null||l.disconnect(),j[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),a.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),a.renderableOfTNode(n(o)))},De=(t,e,n)=>It(t,o=>a.When(o,e,n??(()=>a.Empty))),tt=Math.min,V=Math.max,et=Math.round,G=Math.floor,L=t=>({x:t,y:t}),We={left:"right",right:"left",bottom:"top",top:"bottom"},Pe={start:"end",end:"start"};function kt(t,e,n){return V(t,tt(e,n))}function it(t,e){return typeof t=="function"?t(e):t}function F(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function jt(t){return t==="x"?"y":"x"}function qt(t){return t==="y"?"height":"width"}function B(t){return["top","bottom"].includes(F(t))?"y":"x"}function Yt(t){return jt(B(t))}function Ve(t,e,n){n===void 0&&(n=!1);const o=rt(t),s=Yt(t),i=qt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=nt(r)),[r,nt(r)]}function Fe(t){const e=nt(t);return[pt(t),e,pt(e)]}function pt(t){return t.replace(/start|end/g,e=>Pe[e])}function Me(t,e,n){const o=["left","right"],s=["right","left"],i=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:o:e?o:s;case"left":case"right":return e?i:r;default:return[]}}function Ne(t,e,n,o){const s=rt(t);let i=Me(F(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(pt)))),i}function nt(t){return t.replace(/left|right|bottom|top/g,e=>We[e])}function Ue(t){return{top:0,right:0,bottom:0,left:0,...t}}function $e(t){return typeof t!="number"?Ue(t):{top:t,right:t,bottom:t,left:t}}function ot(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 Ct(t,e,n){let{reference:o,floating:s}=t;const i=B(e),r=Yt(e),c=qt(r),l=F(e),u=i==="y",h=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let d;switch(l){case"top":d={x:h,y:o.y-s.height};break;case"bottom":d={x:h,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:f};break;case"left":d={x:o.x-s.width,y:f};break;default:d={x:o.x,y:o.y}}switch(rt(e)){case"start":d[r]-=p*(n&&u?-1:1);break;case"end":d[r]+=p*(n&&u?-1:1);break}return d}const Be=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let u=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:f}=Ct(u,o,l),p=o,d={},m=0;for(let g=0;g<c.length;g++){const{name:w,fn:y}=c[g],{x:v,y:x,data:R,reset:b}=await y({x:h,y:f,initialPlacement:o,placement:p,strategy:s,middlewareData:d,rects:u,platform:r,elements:{reference:t,floating:e}});h=v??h,f=x??f,d={...d,[w]:{...d[w],...R}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(u=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:h,y:f}=Ct(u,p,l)),g=-1)}return{x:h,y:f,placement:p,strategy:s,middlewareData:d}};async function Kt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=it(e,t),m=$e(d),w=c[p?f==="floating"?"reference":"floating":f],y=ot(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:h,strategy:l})),v=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),R=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},b=ot(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:l}):v);return{top:(y.top-b.top+m.top)/R.y,bottom:(b.bottom-y.bottom+m.bottom)/R.y,left:(y.left-b.left+m.left)/R.x,right:(b.right-y.right+m.right)/R.x}}const He=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:c,platform:l,elements:u}=e,{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...w}=it(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=F(s),v=B(c),x=F(c)===c,R=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=p||(x||!g?[nt(c)]:Fe(c)),N=m!=="none";!p&&N&&b.push(...Ne(c,g,m,R));const pe=[c,...b],ut=await Kt(e,w),J=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(h&&J.push(ut[y]),f){const P=Ve(s,r,R);J.push(ut[P[0]],ut[P[1]])}if(_=[..._,{placement:s,overflows:J}],!J.every(P=>P<=0)){var Ot,St;const P=(((Ot=i.flip)==null?void 0:Ot.index)||0)+1,Tt=pe[P];if(Tt)return{data:{index:P,overflows:_},reset:{placement:Tt}};let I=(St=_.filter(U=>U.overflows[0]<=0).sort((U,C)=>U.overflows[1]-C.overflows[1])[0])==null?void 0:St.placement;if(!I)switch(d){case"bestFit":{var Lt;const U=(Lt=_.filter(C=>{if(N){const D=B(C.placement);return D===v||D==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(D=>D>0).reduce((D,me)=>D+me,0)]).sort((C,D)=>C[1]-D[1])[0])==null?void 0:Lt[0];U&&(I=U);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};async function ze(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=F(n),c=rt(n),l=B(n)==="y",u=["left","top"].includes(r)?-1:1,h=i&&l?-1:1,f=it(e,t);let{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(d=c==="end"?m*-1:m),l?{x:d*h,y:p*u}:{x:p*u,y:d*h}}const _e=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:c}=e,l=await ze(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},Ie=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:c={fn:w=>{let{x:y,y:v}=w;return{x:y,y:v}}},...l}=it(t,e),u={x:n,y:o},h=await Kt(e,l),f=B(F(s)),p=jt(f);let d=u[p],m=u[f];if(i){const w=p==="y"?"top":"left",y=p==="y"?"bottom":"right",v=d+h[w],x=d-h[y];d=kt(v,d,x)}if(r){const w=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=m+h[w],x=m-h[y];m=kt(v,m,x)}const g=c.fn({...e,[p]:d,[f]:m});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[p]:i,[f]:r}}}}}};function ct(){return typeof window<"u"}function z(t){return Xt(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(Xt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Xt(t){return ct()?t instanceof Node||t instanceof E(t).Node:!1}function O(t){return ct()?t instanceof Element||t instanceof E(t).Element:!1}function T(t){return ct()?t instanceof HTMLElement||t instanceof E(t).HTMLElement:!1}function Dt(t){return!ct()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=S(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function je(t){return["table","td","th"].includes(z(t))}function lt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function bt(t){const e=At(),n=O(t)?S(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function qe(t){let e=W(t);for(;T(e)&&!H(e);){if(bt(e))return e;if(lt(e))return null;e=W(e)}return null}function At(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function H(t){return["html","body","#document"].includes(z(t))}function S(t){return E(t).getComputedStyle(t)}function at(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Dt(t)&&t.host||k(t);return Dt(e)?e.host:e}function Jt(t){const e=W(t);return H(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&K(e)?e:Jt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Jt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=E(s);if(i){const c=mt(r);return e.concat(r,r.visualViewport||[],K(s)?s:[],c&&n?q(c):[])}return e.concat(s,q(s,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Gt(t){const e=S(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=T(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=et(n)!==i||et(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function Rt(t){return O(t)?t:t.contextElement}function $(t){const e=Rt(t);if(!T(e))return L(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Gt(e);let r=(i?et(n.width):n.width)/o,c=(i?et(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Ye=L(0);function Qt(t){const e=E(t);return!At()||!e.visualViewport?Ye:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ke(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==E(t)?!1:e}function M(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Rt(t);let r=L(1);e&&(o?O(o)&&(r=$(o)):r=$(t));const c=Ke(i,n,o)?Qt(i):L(0);let l=(s.left+c.x)/r.x,u=(s.top+c.y)/r.y,h=s.width/r.x,f=s.height/r.y;if(i){const p=E(i),d=o&&O(o)?E(o):o;let m=p,g=mt(m);for(;g&&o&&d!==m;){const w=$(g),y=g.getBoundingClientRect(),v=S(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*w.x,R=y.top+(g.clientTop+parseFloat(v.paddingTop))*w.y;l*=w.x,u*=w.y,h*=w.x,f*=w.y,l+=x,u+=R,m=E(g),g=mt(m)}}return ot({width:h,height:f,x:l,y:u})}function Et(t,e){const n=at(t).scrollLeft;return e?e.left+n:M(k(t)).left+n}function Zt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Et(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Xe(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=k(o),c=e?lt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=L(1);const h=L(0),f=T(o);if((f||!f&&!i)&&((z(o)!=="body"||K(r))&&(l=at(o)),T(o))){const d=M(o);u=$(o),h.x=d.x+o.clientLeft,h.y=d.y+o.clientTop}const p=r&&!f&&!i?Zt(r,l,!0):L(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+h.x+p.x,y:n.y*u.y-l.scrollTop*u.y+h.y+p.y}}function Je(t){return Array.from(t.getClientRects())}function Ge(t){const e=k(t),n=at(t),o=t.ownerDocument.body,s=V(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=V(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Et(t);const c=-n.scrollTop;return S(o).direction==="rtl"&&(r+=V(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function Qe(t,e){const n=E(t),o=k(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const u=At();(!u||u&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function Ze(t,e){const n=M(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=T(t)?$(t):L(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,u=o*i.y;return{width:r,height:c,x:l,y:u}}function Wt(t,e,n){let o;if(e==="viewport")o=Qe(t,n);else if(e==="document")o=Ge(k(t));else if(O(e))o=Ze(e,n);else{const s=Qt(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ot(o)}function te(t,e){const n=W(t);return n===e||!O(n)||H(n)?!1:S(n).position==="fixed"||te(n,e)}function tn(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&z(c)!=="body"),s=null;const i=S(t).position==="fixed";let r=i?W(t):t;for(;O(r)&&!H(r);){const c=S(r),l=bt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||K(r)&&!l&&te(t,r))?o=o.filter(h=>h!==r):s=c,r=W(r)}return e.set(t,o),o}function en(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?lt(e)?[]:tn(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((u,h)=>{const f=Wt(e,h,s);return u.top=V(f.top,u.top),u.right=tt(f.right,u.right),u.bottom=tt(f.bottom,u.bottom),u.left=V(f.left,u.left),u},Wt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function nn(t){const{width:e,height:n}=Gt(t);return{width:e,height:n}}function on(t,e,n){const o=T(e),s=k(e),i=n==="fixed",r=M(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=L(0);if(o||!o&&!i)if((z(e)!=="body"||K(s))&&(c=at(e)),o){const p=M(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&(l.x=Et(s));const u=s&&!o&&!i?Zt(s,c):L(0),h=r.left+c.scrollLeft-l.x-u.x,f=r.top+c.scrollTop-l.y-u.y;return{x:h,y:f,width:r.width,height:r.height}}function ht(t){return S(t).position==="static"}function Pt(t,e){if(!T(t)||S(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function ee(t,e){const n=E(t);if(lt(t))return n;if(!T(t)){let s=W(t);for(;s&&!H(s);){if(O(s)&&!ht(s))return s;s=W(s)}return n}let o=Pt(t,e);for(;o&&je(o)&&ht(o);)o=Pt(o,e);return o&&H(o)&&ht(o)&&!bt(o)?n:o||qe(t)||n}const sn=async function(t){const e=this.getOffsetParent||ee,n=this.getDimensions,o=await n(t.floating);return{reference:on(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function rn(t){return S(t).direction==="rtl"}const cn={convertOffsetParentRelativeRectToViewportRelativeRect:Xe,getDocumentElement:k,getClippingRect:en,getOffsetParent:ee,getElementRects:sn,getClientRects:Je,getDimensions:nn,getScale:$,isElement:O,isRTL:rn};function ln(t,e){let n=null,o;const s=k(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:u,top:h,width:f,height:p}=t.getBoundingClientRect();if(c||e(),!f||!p)return;const d=G(h),m=G(s.clientWidth-(u+f)),g=G(s.clientHeight-(h+p)),w=G(u),v={rootMargin:-d+"px "+-m+"px "+-g+"px "+-w+"px",threshold:V(0,tt(1,l))||1};let x=!0;function R(b){const N=b[0].intersectionRatio;if(N!==l){if(!x)return r();N?r(!1,N):o=setTimeout(()=>{r(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(R,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(R,v)}n.observe(t)}return r(!0),i}function an(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=Rt(t),h=s||i?[...u?q(u):[],...q(e)]:[];h.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const f=u&&c?ln(u,n):null;let p=-1,d=null;r&&(d=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&d&&(d.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(e)})),n()}),u&&!l&&d.observe(u),d.observe(e));let m,g=l?M(t):null;l&&w();function w(){const y=M(t);g&&(y.x!==g.x||y.y!==g.y||y.width!==g.width||y.height!==g.height)&&n(),g=y,m=requestAnimationFrame(w)}return n(),()=>{var y;h.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(y=d)==null||y.disconnect(),d=null,l&&cancelAnimationFrame(m)}}const un=_e,fn=Ie,Vt=He,hn=(t,e,n)=>{const o=new Map,s={platform:cn,...n},i={...s.platform,_c:o};return Be(t,e,{...s,platform:i})},dn=({content:t,open:e,placement:n,offset:o={mainAxis:0,crossAxis:0}})=>a.WithBrowserCtx(s=>{const i=a.Value.toSignal(e),r=s.element,c=a.Value.toSignal(o),l=c.$.mainAxis.map(f=>f??0),u=c.$.crossAxis.map(f=>f??0),h=a.Value.toSignal(n??"top");return a.When(i,()=>a.Portal("body",a.html.div(a.WithElement(f=>{const p=f;p.style.position="absolute";async function d(){const{x:g,y:w}=await hn(r,p,{placement:h.value,strategy:"absolute",middleware:[Vt(),un({mainAxis:l.value,crossAxis:u.value}),fn(),Vt()]});p.style.top=`${w}px`,p.style.left=`${g}px`}const m=a.effectOf(l,u,h)(d);return a.OnDispose(an(r,p,d),m)}),t())))}),ne=(t,e,n)=>{const o=a.prop(A.AsyncResult.notAsked),s=o.map(f=>A.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>A.AsyncResult.isFailure(f)?f.error:void 0),r=o.map(f=>A.AsyncResult.isLoading(f));let c;const l=async f=>{c==null||c.abort(),c=new AbortController;const p=c.signal,d=o.get();o.set(A.AsyncResult.loading(A.AsyncResult.getOrUndefined(d)));try{const m=await e({request:f,abortSignal:p,previous:d});await Promise.resolve(),c=void 0,o.set(A.AsyncResult.success(m))}catch(m){c=void 0,o.set(A.AsyncResult.failure(n(m)))}},u=()=>l(a.Value.get(t)),h=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(a.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:u,dispose:h}},oe=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return a.Fragment(a.OnDispose(o),xt(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},pn=({request:t,load:e,mapError:n=o=>o})=>{const o=ne(t,e,n);return s=>oe(o,s)},se=(t,e)=>{if(typeof e=="function")return se(t,{success:e});const n=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},mn=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class X{constructor(e,n,o,s){ft(this,"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));this.left=e,this.top=n,this.width=o,this.height=s}static of({left:e=0,top:n=0,width:o=0,height:s=0}){return new X(e,n,o,s)}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 size(){return{width:this.width,height:this.height}}}function gt(t){const e=t.getBoundingClientRect();return X.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const ie=t=>a.WithBrowserCtx(e=>{const{element:n}=e,o=a.prop(gt(n)),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set(X.of(gt(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),a.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),gn=t=>ie(t),yn=t=>e=>{const n=a.getWindow(),o=a.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},re=(t,e)=>{const n=e.split("/").filter(s=>s!==""),o={};for(let s=0;s<t.length;s++){const i=t[s],r=n[s];if(!r&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==r)return null}else if(i.type==="param")o[i.name]=r;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},ce=t=>t.split("/").map(e=>e.startsWith(":")?{type:"param",name:e.slice(1)}:e==="*"?{type:"catch-all"}:{type:"literal",value:e}).filter(e=>e.type!=="literal"||e.value!==""),le=t=>{const e=t.map(n=>{const o=ce(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=re(s,o);if(r)return{...r,route:i}}return null}},wn=t=>{const e=le(Object.keys(t));return a.Use(vt,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return a.OneOfTuple(o.map(s=>[s.route,s]),t)})},st=60*1e3,yt=60*st,Y=24*yt,Ft=7*Y,Mt=30*Y,vn=365*Y,xn=[{max:st*90,value:st,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:yt*36,value:yt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:Y*10,value:Y,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Ft*6,value:Ft,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Mt*18,value:Mt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:vn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Nt(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 ae=(t=1e3)=>{const e=a.prop(new Date),n=A.interval(()=>e.set(new Date),t);return e.onDispose(n),e},ue=t=>{const e=Math.abs(t);if(e<st)return t<0?"just now":"in a moment";for(const n of xn)if(e<n.max)return t<0?Nt(e,n.value,n.past.singular,n.past.plural):Nt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},fe=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.prop(e):ae(n),s=a.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>a.Value.dispose(o)),s},he=(t,e={})=>{const n=fe(t,e),o=n.map(ue);return o.onDispose(n.dispose),o},bn=(t,e={})=>he(t,e);class de extends a.Prop{constructor(){super(...arguments);ft(this,"tick",()=>this.update(n=>n+1))}}const An=(t=0)=>new de(t,(e,n)=>e===n);exports.Anchor=zt;exports.Appearance=Ee;exports.AsyncResultView=xt;exports.AutoFocus=Oe;exports.AutoSelect=Se;exports.ElementRect=ie;exports.ElementSize=gn;exports.HTMLTitle=Te;exports.HiddenWhenEmpty=Le;exports.InViewport=It;exports.Location=vt;exports.PopOver=dn;exports.Rect=X;exports.Resource=pn;exports.ResourceDisplay=oe;exports.ResultView=se;exports.Router=wn;exports.SelectOnFocus=mn;exports.Ticker=de;exports.WhenInViewport=De;exports.WindowSize=yn;exports._checkExtensionCondition=$t;exports._getExtension=Ut;exports._makeRouteMatcher=le;exports._parseRouteSegments=ce;exports.areLocationsEqual=Ht;exports.getAbsoluteRect=gt;exports.handleAnchorClick=Bt;exports.locationFromURL=wt;exports.makeResource=ne;exports.matchesRoute=re;exports.nowSignal=ae;exports.relativeTime=bn;exports.relativeTimeMillisSignal=fe;exports.relativeTimeSignal=he;exports.setLocationFromUrl=dt;exports.ticker=An;exports.timeDiffToString=ue;exports.urlFromLocation=Z;exports.useAppearance=_t;