@tempots/ui 2.5.6 → 2.6.0

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