@tempots/ui 1.0.1 → 1.0.2

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