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