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