@tempots/ui 6.1.0 → 6.2.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 Oe=Object.defineProperty;var Ae=(t,e,o)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var vt=(t,e,o)=>Ae(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),E=require("@tempots/std"),qt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Yt=(t,e)=>{const o=qt(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Ee=(t,e,o,n)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const s=r;if(t.button!==0||t.ctrlKey||t.metaKey||s.target!=="_self"&&s.target!==""||s.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:a}=s;if(n){const u=i+c+a,d=s.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:Yt(o,i)},Xt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const o=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(n=>n.startsWith(".")?n:"."+n):[];return n=>{Ee(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},Jt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,St=(t,e)=>{var s,i;const o=new URL(t,e??((s=l.getWindow())==null?void 0:s.location.toString())),n=Object.fromEntries(((i=o.searchParams)==null?void 0:i.entries())??[]);let r=o.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:o.pathname,search:n,hash:r===""?void 0:r}},Rt=(t,e)=>{const o=St(e);return t.set(o),t},lt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Pe=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Se=t=>{const e=t.container.currentURL,o=e.iso(n=>St(n),n=>{if(Pe(n.pathname))return lt(n);const r=new URL(n.pathname,e.value),s=r.origin+r.pathname;return lt({...n,pathname:s})});return{value:o,dispose:o.dispose}},Le=()=>{const t=l.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}},Te=()=>{const t=l.prop(Le(),Jt),e=l.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.substring(1));const r={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:n===""?void 0:n};t.set(r)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",lt(n))}),{value:t,dispose:t.dispose}},gt={mark:l.makeProviderMark("Location"),create:(t,e)=>{if(e.isBrowser())return Te();if(e.isHeadless())return Se(e);throw new Error("Unknown context")}},ke=t=>{document.startViewTransition?document.startViewTransition(t):t()},Gt=(t,...e)=>{if(typeof t=="string"||l.Signal.is(t))return Gt({href:t},...e);const{href:o,withViewTransition:n,...r}=t;return l.Use(gt,s=>l.html.a(l.on.click(Xt(()=>(n===!0?ke(()=>{Rt(s,l.Value.get(o))}):Rt(s,l.Value.get(o)),!0),r)),l.attr.href(o),...e))},De={mark:l.makeProviderMark("Appearance"),create:()=>{const t=Qt();return{value:t,dispose:t.dispose}}};function Qt(){const t=l.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=l.prop(o?"dark":"light"),r=s=>n.set(s.matches?"dark":"light");return e==null||e.addEventListener("change",r),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",r)),n}const Lt=(t,e)=>{if(typeof e=="function")return Lt(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,r=e.loading??(()=>l.Empty),s=e.notAsked??(()=>l.Empty);return l.OneOfType(l.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>r(i.map(c=>c.previousValue)),NotAsked:s})},We=(t=10)=>l.WithElement(e=>l.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),Ce=(t=10)=>l.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return l.OnDispose(o)}),Fe=l.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),l.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),Ve=t=>l.Portal("head > title",l.attr.innerText(t)),Me={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},at={partial:new Map,full:new Map},tt={partial:null,full:null};function Ne(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=at[t].get(o.target);n==null||n.set(o.isIntersecting)})},Me[t])),tt[t]}const Zt=({mode:t="partial",once:e=!1},o)=>{const n=l.prop(!1);return l.Fragment(l.WithElement(r=>{const s=typeof IntersectionObserver<"u"?Ne(t):null;at[t].set(r,n),s==null||s.observe(r);function i(){var a;s==null||s.unobserve(r),at[t].delete(r),at[t].size===0&&((a=tt[t])==null||a.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(a=>{a&&i()})),l.OnDispose(()=>{n.dispose(),i(),c==null||c()})}),l.renderableOfTNode(o(n)))},Ue=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function He(t){return l.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),l.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Nt=(t,e)=>t===void 0||t===e;function te(t,e){return typeof t=="string"?e.key===t:Nt(t.key,e.key)&&Nt(t.code,e.code)&&Y(t.ctrlKey,e.ctrlKey)&&Y(t.altKey,e.altKey)&&Y(t.shiftKey,e.shiftKey)&&Y(t.metaKey,e.metaKey)&&Y(t.repeat,e.repeat)&&Y(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function Tt({allowedKeys:t,handler:e}){return l.WithElement(o=>{const n=r=>{if(o.contains(r.target)){for(const s of t)if(te(s,r)){e(r);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function $e(t){return Tt({allowedKeys:["Enter"],handler:t})}function Ke(t){return Tt({allowedKeys:["Escape"],handler:t})}const J=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,C=t=>({x:t,y:t}),Be={left:"right",right:"left",bottom:"top",top:"bottom"},ze={start:"end",end:"start"};function bt(t,e,o){return j(t,J(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function ee(t){return t==="x"?"y":"x"}function kt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(I(t))?"y":"x"}function Dt(t){return ee(H(t))}function _e(t,e,o){o===void 0&&(o=!1);const n=rt(t),r=Dt(t),s=kt(r);let i=r==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=ft(i)),[i,ft(i)]}function je(t){const e=ft(t);return[Ot(t),e,Ot(e)]}function Ot(t){return t.replace(/start|end/g,e=>ze[e])}function Ie(t,e,o){const n=["left","right"],r=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?r:n:e?n:r;case"left":case"right":return e?s:i;default:return[]}}function qe(t,e,o,n){const r=rt(t);let s=Ie(I(t),o==="start",n);return r&&(s=s.map(i=>i+"-"+r),e&&(s=s.concat(s.map(Ot)))),s}function ft(t){return t.replace(/left|right|bottom|top/g,e=>Be[e])}function Ye(t){return{top:0,right:0,bottom:0,left:0,...t}}function ne(t){return typeof t!="number"?Ye(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:r}=t;return{width:n,height:r,top:o,left:e,right:e+n,bottom:o+r,x:e,y:o}}function Ut(t,e,o){let{reference:n,floating:r}=t;const s=H(e),i=Dt(e),c=kt(i),a=I(e),u=s==="y",d=n.x+n.width/2-r.width/2,h=n.y+n.height/2-r.height/2,g=n[c]/2-r[c]/2;let f;switch(a){case"top":f={x:d,y:n.y-r.height};break;case"bottom":f={x:d,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:h};break;case"left":f={x:n.x-r.width,y:h};break;default:f={x:n.x,y:n.y}}switch(rt(e)){case"start":f[i]-=g*(o&&u?-1:1);break;case"end":f[i]+=g*(o&&u?-1:1);break}return f}const Xe=async(t,e,o)=>{const{placement:n="bottom",strategy:r="absolute",middleware:s=[],platform:i}=o,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:h}=Ut(u,n,a),g=n,f={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:p}=c[y],{x,y:v,data:b,reset:R}=await p({x:d,y:h,initialPlacement:n,placement:g,strategy:r,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[w]:{...f[w],...b}},R&&m<=50&&(m++,typeof R=="object"&&(R.placement&&(g=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):R.rects),{x:d,y:h}=Ut(u,g,a)),y=-1)}return{x:d,y:h,placement:g,strategy:r,middlewareData:f}};async function oe(t,e){var o;e===void 0&&(e={});const{x:n,y:r,platform:s,rects:i,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:f=0}=ot(e,t),m=ne(f),w=c[g?h==="floating"?"reference":"floating":h],p=ht(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:a})),x=h==="floating"?{x:n,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},R=ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:a}):x);return{top:(p.top-R.top+m.top)/b.y,bottom:(R.bottom-p.bottom+m.bottom)/b.y,left:(p.left-R.left+m.left)/b.x,right:(R.right-p.right+m.right)/b.x}}const Je=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:r,rects:s,platform:i,elements:c,middlewareData:a}=e,{element:u,padding:d=0}=ot(t,e)||{};if(u==null)return{};const h=ne(d),g={x:o,y:n},f=Dt(r),m=kt(f),y=await i.getDimensions(u),w=f==="y",p=w?"top":"left",x=w?"bottom":"right",v=w?"clientHeight":"clientWidth",b=s.reference[m]+s.reference[f]-g[f]-s.floating[m],R=g[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let O=S?S[v]:0;(!O||!await(i.isElement==null?void 0:i.isElement(S)))&&(O=c.floating[v]||s.floating[m]);const K=b/2-R/2,M=O/2-y[m]/2-1,L=J(h[p],M),B=J(h[x],M),z=L,Z=O-y[m]-B,A=O/2-y[m]/2+K,_=bt(z,A,Z),N=!a.arrow&&rt(r)!=null&&A!==_&&s.reference[m]/2-(A<z?L:B)-y[m]/2<0,T=N?A<z?A-z:A-Z:0;return{[f]:g[f]+T,data:{[f]:_,centerOffset:A-_-T,...N&&{alignmentOffset:T}},reset:N}}}),Ge=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=ot(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const p=I(r),x=H(c),v=I(c)===c,b=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=g||(v||!y?[ft(c)]:je(c)),S=m!=="none";!g&&S&&R.push(...qe(c,y,m,b));const O=[c,...R],K=await oe(e,w),M=[];let L=((n=s.flip)==null?void 0:n.overflows)||[];if(d&&M.push(K[p]),h){const A=_e(r,i,b);M.push(K[A[0]],K[A[1]])}if(L=[...L,{placement:r,overflows:M}],!M.every(A=>A<=0)){var B,z;const A=(((B=s.flip)==null?void 0:B.index)||0)+1,_=O[A];if(_&&(!(h==="alignment"?x!==H(_):!1)||L.every(k=>k.overflows[0]>0&&H(k.placement)===x)))return{data:{index:A,overflows:L},reset:{placement:_}};let N=(z=L.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(f){case"bestFit":{var Z;const T=(Z=L.filter(k=>{if(S){const U=H(k.placement);return U===x||U==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(U=>U>0).reduce((U,be)=>U+be,0)]).sort((k,U)=>k[1]-U[1])[0])==null?void 0:Z[0];T&&(N=T);break}case"initialPlacement":N=c;break}if(r!==N)return{reset:{placement:N}}}return{}}}};async function Qe(t,e){const{placement:o,platform:n,elements:r}=t,s=await(n.isRTL==null?void 0:n.isRTL(r.floating)),i=I(o),c=rt(o),a=H(o)==="y",u=["left","top"].includes(i)?-1:1,d=s&&a?-1:1,h=ot(e,t);let{mainAxis:g,crossAxis:f,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof m=="number"&&(f=c==="end"?m*-1:m),a?{x:f*d,y:g*u}:{x:g*u,y:f*d}}const Ze=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:r,y:s,placement:i,middlewareData:c}=e,a=await Qe(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},tn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:r}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:p,y:x}=w;return{x:p,y:x}}},...a}=ot(t,e),u={x:o,y:n},d=await oe(e,a),h=H(I(r)),g=ee(h);let f=u[g],m=u[h];if(s){const w=g==="y"?"top":"left",p=g==="y"?"bottom":"right",x=f+d[w],v=f-d[p];f=bt(x,f,v)}if(i){const w=h==="y"?"top":"left",p=h==="y"?"bottom":"right",x=m+d[w],v=m-d[p];m=bt(x,m,v)}const y=c.fn({...e,[g]:f,[h]:m});return{...y,data:{x:y.x-o,y:y.y-n,enabled:{[g]:s,[h]:i}}}}}};function pt(){return typeof window<"u"}function Q(t){return re(t)?(t.nodeName||"").toLowerCase():"#document"}function P(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(re(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function re(t){return pt()?t instanceof Node||t instanceof P(t).Node:!1}function D(t){return pt()?t instanceof Element||t instanceof P(t).Element:!1}function F(t){return pt()?t instanceof HTMLElement||t instanceof P(t).HTMLElement:!1}function Ht(t){return!pt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof P(t).ShadowRoot}function st(t){const{overflow:e,overflowX:o,overflowY:n,display:r}=W(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(r)}function en(t){return["table","td","th"].includes(Q(t))}function yt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Wt(t){const e=Ct(),o=D(t)?W(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function nn(t){let e=$(t);for(;F(e)&&!G(e);){if(Wt(e))return e;if(yt(e))return null;e=$(e)}return null}function Ct(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function G(t){return["html","body","#document"].includes(Q(t))}function W(t){return P(t).getComputedStyle(t)}function wt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $(t){if(Q(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ht(t)&&t.host||V(t);return Ht(e)?e.host:e}function se(t){const e=$(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&st(e)?e:se(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=se(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),i=P(r);if(s){const c=At(i);return e.concat(i,i.visualViewport||[],st(r)?r:[],c&&o?et(c):[])}return e.concat(r,et(r,[],o))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ie(t){const e=W(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const r=F(t),s=r?t.offsetWidth:o,i=r?t.offsetHeight:n,c=ut(o)!==s||ut(n)!==i;return c&&(o=s,n=i),{width:o,height:n,$:c}}function Ft(t){return D(t)?t:t.contextElement}function X(t){const e=Ft(t);if(!F(e))return C(1);const o=e.getBoundingClientRect(),{width:n,height:r,$:s}=ie(e);let i=(s?ut(o.width):o.width)/n,c=(s?ut(o.height):o.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const on=C(0);function ce(t){const e=P(t);return!Ct()||!e.visualViewport?on:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function rn(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==P(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),s=Ft(t);let i=C(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=rn(s,o,n)?ce(s):C(0);let a=(r.left+c.x)/i.x,u=(r.top+c.y)/i.y,d=r.width/i.x,h=r.height/i.y;if(s){const g=P(s),f=n&&D(n)?P(n):n;let m=g,y=At(m);for(;y&&n&&f!==m;){const w=X(y),p=y.getBoundingClientRect(),x=W(y),v=p.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,b=p.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,u*=w.y,d*=w.x,h*=w.y,a+=v,u+=b,m=P(y),y=At(m)}}return ht({width:d,height:h,x:a,y:u})}function Vt(t,e){const o=wt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function ae(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-(o?0:Vt(t,n)),s=n.top+e.scrollTop;return{x:r,y:s}}function sn(t){let{elements:e,rect:o,offsetParent:n,strategy:r}=t;const s=r==="fixed",i=V(n),c=e?yt(e.floating):!1;if(n===i||c&&s)return o;let a={scrollLeft:0,scrollTop:0},u=C(1);const d=C(0),h=F(n);if((h||!h&&!s)&&((Q(n)!=="body"||st(i))&&(a=wt(n)),F(n))){const f=q(n);u=X(n),d.x=f.x+n.clientLeft,d.y=f.y+n.clientTop}const g=i&&!h&&!s?ae(i,a,!0):C(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+d.x+g.x,y:o.y*u.y-a.scrollTop*u.y+d.y+g.y}}function cn(t){return Array.from(t.getClientRects())}function an(t){const e=V(t),o=wt(t),n=t.ownerDocument.body,r=j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Vt(t);const c=-o.scrollTop;return W(n).direction==="rtl"&&(i+=j(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:c}}function ln(t,e){const o=P(t),n=V(t),r=o.visualViewport;let s=n.clientWidth,i=n.clientHeight,c=0,a=0;if(r){s=r.width,i=r.height;const u=Ct();(!u||u&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}return{width:s,height:i,x:c,y:a}}function un(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,r=o.left+t.clientLeft,s=F(t)?X(t):C(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,a=r*s.x,u=n*s.y;return{width:i,height:c,x:a,y:u}}function $t(t,e,o){let n;if(e==="viewport")n=ln(t,o);else if(e==="document")n=an(V(t));else if(D(e))n=un(e,o);else{const r=ce(t);n={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return ht(n)}function le(t,e){const o=$(t);return o===e||!D(o)||G(o)?!1:W(o).position==="fixed"||le(o,e)}function fn(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&Q(c)!=="body"),r=null;const s=W(t).position==="fixed";let i=s?$(t):t;for(;D(i)&&!G(i);){const c=W(i),a=Wt(i);!a&&c.position==="fixed"&&(r=null),(s?!a&&!r:!a&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||st(i)&&!a&&le(t,i))?n=n.filter(d=>d!==i):r=c,i=$(i)}return e.set(t,n),n}function hn(t){let{element:e,boundary:o,rootBoundary:n,strategy:r}=t;const i=[...o==="clippingAncestors"?yt(e)?[]:fn(e,this._c):[].concat(o),n],c=i[0],a=i.reduce((u,d)=>{const h=$t(e,d,r);return u.top=j(h.top,u.top),u.right=J(h.right,u.right),u.bottom=J(h.bottom,u.bottom),u.left=j(h.left,u.left),u},$t(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function dn(t){const{width:e,height:o}=ie(t);return{width:e,height:o}}function mn(t,e,o){const n=F(e),r=V(e),s=o==="fixed",i=q(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const a=C(0);function u(){a.x=Vt(r)}if(n||!n&&!s)if((Q(e)!=="body"||st(r))&&(c=wt(e)),n){const f=q(e,!0,s,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else r&&u();s&&!n&&r&&u();const d=r&&!n&&!s?ae(r,c):C(0),h=i.left+c.scrollLeft-a.x-d.x,g=i.top+c.scrollTop-a.y-d.y;return{x:h,y:g,width:i.width,height:i.height}}function xt(t){return W(t).position==="static"}function Kt(t,e){if(!F(t)||W(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function ue(t,e){const o=P(t);if(yt(t))return o;if(!F(t)){let r=$(t);for(;r&&!G(r);){if(D(r)&&!xt(r))return r;r=$(r)}return o}let n=Kt(t,e);for(;n&&en(n)&&xt(n);)n=Kt(n,e);return n&&G(n)&&xt(n)&&!Wt(n)?o:n||nn(t)||o}const gn=async function(t){const e=this.getOffsetParent||ue,o=this.getDimensions,n=await o(t.floating);return{reference:mn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function pn(t){return W(t).direction==="rtl"}const yn={convertOffsetParentRelativeRectToViewportRelativeRect:sn,getDocumentElement:V,getClippingRect:hn,getOffsetParent:ue,getElementRects:gn,getClientRects:cn,getDimensions:dn,getScale:X,isElement:D,isRTL:pn};function fe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function wn(t,e){let o=null,n;const r=V(t);function s(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=t.getBoundingClientRect(),{left:d,top:h,width:g,height:f}=u;if(c||e(),!g||!f)return;const m=ct(h),y=ct(r.clientWidth-(d+g)),w=ct(r.clientHeight-(h+f)),p=ct(d),v={rootMargin:-m+"px "+-y+"px "+-w+"px "+-p+"px",threshold:j(0,J(1,a))||1};let b=!0;function R(S){const O=S[0].intersectionRatio;if(O!==a){if(!b)return i();O?i(!1,O):n=setTimeout(()=>{i(!1,1e-7)},1e3)}O===1&&!fe(u,t.getBoundingClientRect())&&i(),b=!1}try{o=new IntersectionObserver(R,{...v,root:r.ownerDocument})}catch{o=new IntersectionObserver(R,v)}o.observe(t)}return i(!0),s}function vn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Ft(t),d=r||s?[...u?et(u):[],...et(e)]:[];d.forEach(p=>{r&&p.addEventListener("scroll",o,{passive:!0}),s&&p.addEventListener("resize",o)});const h=u&&c?wn(u,o):null;let g=-1,f=null;i&&(f=new ResizeObserver(p=>{let[x]=p;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),o()}),u&&!a&&f.observe(u),f.observe(e));let m,y=a?q(t):null;a&&w();function w(){const p=q(t);y&&!fe(y,p)&&o(),y=p,m=requestAnimationFrame(w)}return o(),()=>{var p;d.forEach(x=>{r&&x.removeEventListener("scroll",o),s&&x.removeEventListener("resize",o)}),h==null||h(),(p=f)==null||p.disconnect(),f=null,a&&cancelAnimationFrame(m)}}const xn=Ze,Rn=tn,Bt=Ge,bn=Je,On=(t,e,o)=>{const n=new Map,r={platform:yn,...o},s={...r.platform,_c:n};return Xe(t,e,{...r,platform:s})},An=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],En=(t,e={isOpen:!1})=>{const o=[];let n=null;const r=l.Value.deriveProp(e.isOpen);function s(c){n=c,r.set(!0)}function i(){r.set(!1),o.forEach(c=>c()),o.length=0}return l.Fragment(t(s,i),l.When(r,()=>l.WithElement(c=>l.Portal("body",l.html.div(l.WithElement(a=>{a.style.position="absolute";const u=typeof(n==null?void 0:n.target)=="string"?c.querySelector(n.target):(n==null?void 0:n.target)??c;if(u==null)throw new Error(`Target not found: ${n==null?void 0:n.target}`);let d=null;const h=l.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),g=l.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=l.Value.toSignal((n==null?void 0:n.placement)??"top"),m=l.Value.toSignal((n==null?void 0:n.arrowPadding)??0),y=n==null?void 0:n.arrow,w=l.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function p(){const v=[Bt(),xn({mainAxis:h.get(),crossAxis:g.get()}),Rn(),Bt()];y!=null&&d!=null&&v.push(bn({element:d,padding:m.get()}));const b=await On(u,a,{placement:f.get(),strategy:"absolute",middleware:v}),{x:R,y:S,middlewareData:O}=b;if(a.style.top=`${S}px`,a.style.left=`${R}px`,d!=null&&O.arrow!=null){const{x:K,y:M,centerOffset:L,alignmentOffset:B}=O.arrow;w.set({x:K,y:M,centerOffset:L,alignmentOffset:B,containerWidth:a.offsetWidth,containerHeight:a.offsetHeight})}}const x=l.effectOf(h,g,f)(p);return l.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?l.html.div(n==null?void 0:n.arrow(l.computedOf(w,f)((v,b)=>({...v,placement:b}))),l.WithElement(v=>{d=v,p()})):null,l.OnDispose(w.dispose,vn(u,a,p),x))}))))))},he=(t,e,o)=>{const n=l.prop(E.AsyncResult.notAsked),r=n.map(h=>E.AsyncResult.isSuccess(h)?h.value:void 0),s=n.map(h=>E.AsyncResult.isFailure(h)?h.error:void 0),i=n.map(h=>E.AsyncResult.isLoading(h));let c;const a=async h=>{c==null||c.abort(),c=new AbortController;const g=c.signal,f=n.get();n.set(E.AsyncResult.loading(E.AsyncResult.getOrUndefined(f)));try{const m=await e({request:h,abortSignal:g,previous:f});await Promise.resolve(),c=void 0,n.set(E.AsyncResult.success(m))}catch(m){c=void 0,n.set(E.AsyncResult.failure(o(m)))}},u=()=>a(l.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,n.dispose()};return n.onDispose(l.Value.on(t,a)),{status:n,value:r,error:s,loading:i,reload:u,dispose:d}},de=(t,e)=>{const{status:o,dispose:n,reload:r}=t,{loading:s,failure:i,success:c}=e;return l.Fragment(l.OnDispose(n),Lt(o,{loading:s!=null?a=>s(a,r):void 0,failure:i!=null?a=>i(a,r):void 0,success:a=>c(a,r)}))},Pn=({request:t,load:e,mapError:o=n=>n})=>{const n=he(t,e,o);return r=>de(n,r)},me=(t,e)=>{if(typeof e=="function")return me(t,{success:e});const o=e.failure??(r=>l.Fragment(l.OnDispose(r.on(console.error)),r.map(s=>`Error: ${s}`))),n=e.success;return l.OneOfType(l.Value.toSignal(t),{Success:r=>n(r.$.value),Failure:r=>o(r.$.error)})},Sn=()=>l.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,o,n,r){vt(this,"equals",e=>E.nearEqual(this.left,e.left)&&E.nearEqual(this.top,e.top)&&E.nearEqual(this.width,e.width)&&E.nearEqual(this.height,e.height));this.left=e,this.top=o,this.width=n,this.height=r}static of({left:e=0,top:o=0,width:n=0,height:r=0}){return new it(e,o,n,r)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get size(){return{width:this.width,height:this.height}}}function Et(t){const e=t.getBoundingClientRect();return it.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const Ln=t=>l.WithBrowserCtx(e=>{const{element:o}=e,n=l.prop(Et(o),(c,a)=>c.equals(a)),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(it.of(Et(o)));let i=null;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(s)),i==null||i.observe(o),l.OnDispose(c=>{i==null||i.disconnect(),r(c)})});function zt(t){return{width:(t==null?void 0:t.innerWidth)??0,height:(t==null?void 0:t.innerHeight)??0}}const Tn=t=>e=>{const o=l.getWindow(),n=l.prop(zt(o),(i,c)=>i.width===c.width&&i.height===c.height),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(zt(o));return o==null||o.addEventListener("resize",s),i=>{o==null||o.removeEventListener("resize",s),r(i)}},ge=(t,e)=>{const o=e.split("/").filter(r=>r!==""),n={};for(let r=0;r<t.length;r++){const s=t[r],i=o[r];if(!i&&s.type!=="catch-all")return null;if(s.type==="literal"){if(s.value!==i)return null}else if(s.type==="param")n[s.name]=i;else if(s.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Mt=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!==""),kn=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=ge(r,n);if(i)return{...i,route:s}}return null}},dt={mark:l.makeProviderMark("RouterContext"),create:()=>{const t=l.prop([]);return{value:t,dispose:()=>t.dispose()}}},Dn=(t,e,o)=>{const n=o.split("/").filter(i=>i!==""),r={};let s=0;for(let i=0;i<t.length;i++){const c=t[i],a=n[i];if(!a&&c.type!=="catch-all")return null;if(c.type==="literal"){if(c.value!==a)return null;s++}else if(c.type==="param")r[c.name]=a,s++;else if(c.type==="catch-all"){const u="/"+n.slice(0,s).join("/"),d="/"+n.slice(s).join("/");return{params:r,matchedPath:u==="/"?"":u,remainingPath:d==="/"?"":d,route:e}}}if(n.length===t.length){const i="/"+n.join("/");return{params:r,matchedPath:i==="/"?"":i,remainingPath:"",route:e}}return null},pe=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=Dn(r,s,n);if(i)return i}return null}},Wn=t=>{const e=pe(Object.keys(t));return l.Provide(dt,{},()=>l.Use(gt,o=>l.Use(dt,n=>{const r=o.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");const c={matchedPath:i.matchedPath,remainingPath:i.remainingPath,fullPath:s.pathname,params:i.params};return n.value=[...n.value,c],{params:i.params,route:i.route,path:i.matchedPath||s.pathname,search:s.search,hash:s.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)})))},Cn=t=>{const e=pe(Object.keys(t));return l.Use(dt,o=>l.Use(gt,n=>{const r=o.map(s=>{const i=s[s.length-1],c=(i==null?void 0:i.remainingPath)||"";if(c==="")throw console.error("No remaining path for SubRouter",s),new Error("No remaining path for SubRouter");const a=e(c);if(a==null)throw console.error("No route found for remaining path",c),new Error("No route found");return{params:a.params,route:a.route,path:a.matchedPath,search:n.value.search,hash:n.value.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)}))},mt=60*1e3,Pt=60*mt,nt=24*Pt,_t=7*nt,jt=30*nt,Fn=365*nt,Vn=[{max:mt*90,value:mt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Pt*36,value:Pt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:_t*6,value:_t,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:jt*18,value:jt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Fn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function It(t,e,o,n){const r=Math.round(t/e);return r<=1?o:n.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ye=(t=1e3)=>{const e=l.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},we=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Vn)if(e<o.max)return t<0?It(e,o.value,o.past.singular,o.past.plural):It(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},ve=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):ye(o),r=l.computedOf(t,n)((s,i)=>s.getTime()-i.getTime());return r.onDispose(()=>l.Value.dispose(n)),r},xe=(t,e={})=>{const o=ve(t,e),n=o.map(we);return n.onDispose(o.dispose),n},Mn=(t,e={})=>xe(t,e);class Re extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Nn=(t=0)=>new Re(t,(e,o)=>e===o);exports.Anchor=Gt;exports.Appearance=De;exports.AsyncResultView=Lt;exports.AutoFocus=We;exports.AutoSelect=Ce;exports.ChildRouter=Cn;exports.ElementRect=Ln;exports.HTMLTitle=Ve;exports.HiddenWhenEmpty=Fe;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=He;exports.OnEnterKey=$e;exports.OnEscapeKey=Ke;exports.OnKeyPressed=Tt;exports.PopOver=En;exports.Rect=it;exports.Resource=Pn;exports.ResourceDisplay=de;exports.ResultView=me;exports.RootRouter=Wn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Sn;exports.Ticker=Re;exports.WhenInViewport=Ue;exports.WindowSize=Tn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=kn;exports._parseRouteSegments=Mt;exports.allPlacements=An;exports.areLocationsEqual=Jt;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Xt;exports.locationFromURL=St;exports.makeResource=he;exports.matchesKeyCombo=te;exports.matchesRoute=ge;exports.nowSignal=ye;exports.relativeTime=Mn;exports.relativeTimeMillisSignal=ve;exports.relativeTimeSignal=xe;exports.setLocationFromUrl=Rt;exports.ticker=Nn;exports.timeDiffToString=we;exports.urlFromLocation=lt;exports.useAppearance=Qt;
1
+ "use strict";var Ae=Object.defineProperty;var Ee=(t,e,o)=>e in t?Ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var vt=(t,e,o)=>Ee(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),E=require("@tempots/std"),qt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Yt=(t,e)=>{const o=qt(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Pe=(t,e,o,n)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const s=r;if(t.button!==0||t.ctrlKey||t.metaKey||s.target!=="_self"&&s.target!==""||s.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:a}=s;if(n){const u=i+c+a,d=s.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:Yt(o,i)},Xt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const o=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(n=>n.startsWith(".")?n:"."+n):[];return n=>{Pe(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},Jt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,St=(t,e)=>{var s,i;const o=new URL(t,e??((s=l.getWindow())==null?void 0:s.location.toString())),n=Object.fromEntries(((i=o.searchParams)==null?void 0:i.entries())??[]);let r=o.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:o.pathname,search:n,hash:r===""?void 0:r}},Rt=(t,e)=>{const o=St(e);return t.set(o),t},lt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Se=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Le=t=>{const e=t.container.currentURL,o=e.iso(n=>St(n),n=>{if(Se(n.pathname))return lt(n);const r=new URL(n.pathname,e.value),s=r.origin+r.pathname;return lt({...n,pathname:s})});return{value:o,dispose:o.dispose}},Te=()=>{const t=l.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}},ke=()=>{const t=l.prop(Te(),Jt),e=l.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.substring(1));const r={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:n===""?void 0:n};t.set(r)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",lt(n))}),{value:t,dispose:t.dispose}},gt={mark:l.makeProviderMark("Location"),create:(t,e)=>{if(e.isBrowser())return ke();if(e.isHeadless())return Le(e);throw new Error("Unknown context")}},De=t=>{document.startViewTransition?document.startViewTransition(t):t()},Gt=(t,...e)=>{if(typeof t=="string"||l.Signal.is(t))return Gt({href:t},...e);const{href:o,withViewTransition:n,...r}=t;return l.Use(gt,s=>l.html.a(l.on.click(Xt(()=>(n===!0?De(()=>{Rt(s,l.Value.get(o))}):Rt(s,l.Value.get(o)),!0),r)),l.attr.href(o),...e))},Ce={mark:l.makeProviderMark("Appearance"),create:()=>{const t=Qt();return{value:t,dispose:t.dispose}}};function Qt(){const t=l.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=l.prop(o?"dark":"light"),r=s=>n.set(s.matches?"dark":"light");return e==null||e.addEventListener("change",r),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",r)),n}const Lt=(t,e)=>{if(typeof e=="function")return Lt(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,r=e.loading??(()=>l.Empty),s=e.notAsked??(()=>l.Empty);return l.OneOfType(l.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>r(i.map(c=>c.previousValue)),NotAsked:s})},We=(t=10)=>l.WithElement(e=>l.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),Fe=(t=10)=>l.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return l.OnDispose(o)}),Ve=l.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),l.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),Me=t=>l.Portal("head > title",l.attr.innerText(t)),Ne={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},at={partial:new Map,full:new Map},tt={partial:null,full:null};function Ue(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=at[t].get(o.target);n==null||n.set(o.isIntersecting)})},Ne[t])),tt[t]}const Zt=({mode:t="partial",once:e=!1},o)=>{const n=l.prop(!1);return l.Fragment(l.WithElement(r=>{const s=typeof IntersectionObserver<"u"?Ue(t):null;at[t].set(r,n),s==null||s.observe(r);function i(){var a;s==null||s.unobserve(r),at[t].delete(r),at[t].size===0&&((a=tt[t])==null||a.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(a=>{a&&i()})),l.OnDispose(()=>{n.dispose(),i(),c==null||c()})}),l.renderableOfTNode(o(n)))},He=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function te(t){return l.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),l.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Nt=(t,e)=>t===void 0||t===e;function ee(t,e){return typeof t=="string"?e.key===t:Nt(t.key,e.key)&&Nt(t.code,e.code)&&Y(t.ctrlKey,e.ctrlKey)&&Y(t.altKey,e.altKey)&&Y(t.shiftKey,e.shiftKey)&&Y(t.metaKey,e.metaKey)&&Y(t.repeat,e.repeat)&&Y(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function Tt({allowedKeys:t,handler:e}){return l.WithElement(o=>{const n=r=>{if(o.contains(r.target)){for(const s of t)if(ee(s,r)){e(r);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function $e(t){return Tt({allowedKeys:["Enter"],handler:t})}function Ke(t){return Tt({allowedKeys:["Escape"],handler:t})}const J=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,W=t=>({x:t,y:t}),Be={left:"right",right:"left",bottom:"top",top:"bottom"},ze={start:"end",end:"start"};function Ot(t,e,o){return j(t,J(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function ne(t){return t==="x"?"y":"x"}function kt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(I(t))?"y":"x"}function Dt(t){return ne(H(t))}function _e(t,e,o){o===void 0&&(o=!1);const n=rt(t),r=Dt(t),s=kt(r);let i=r==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=ft(i)),[i,ft(i)]}function je(t){const e=ft(t);return[bt(t),e,bt(e)]}function bt(t){return t.replace(/start|end/g,e=>ze[e])}function Ie(t,e,o){const n=["left","right"],r=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?r:n:e?n:r;case"left":case"right":return e?s:i;default:return[]}}function qe(t,e,o,n){const r=rt(t);let s=Ie(I(t),o==="start",n);return r&&(s=s.map(i=>i+"-"+r),e&&(s=s.concat(s.map(bt)))),s}function ft(t){return t.replace(/left|right|bottom|top/g,e=>Be[e])}function Ye(t){return{top:0,right:0,bottom:0,left:0,...t}}function oe(t){return typeof t!="number"?Ye(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:r}=t;return{width:n,height:r,top:o,left:e,right:e+n,bottom:o+r,x:e,y:o}}function Ut(t,e,o){let{reference:n,floating:r}=t;const s=H(e),i=Dt(e),c=kt(i),a=I(e),u=s==="y",d=n.x+n.width/2-r.width/2,h=n.y+n.height/2-r.height/2,g=n[c]/2-r[c]/2;let f;switch(a){case"top":f={x:d,y:n.y-r.height};break;case"bottom":f={x:d,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:h};break;case"left":f={x:n.x-r.width,y:h};break;default:f={x:n.x,y:n.y}}switch(rt(e)){case"start":f[i]-=g*(o&&u?-1:1);break;case"end":f[i]+=g*(o&&u?-1:1);break}return f}const Xe=async(t,e,o)=>{const{placement:n="bottom",strategy:r="absolute",middleware:s=[],platform:i}=o,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:h}=Ut(u,n,a),g=n,f={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:p}=c[y],{x,y:v,data:O,reset:R}=await p({x:d,y:h,initialPlacement:n,placement:g,strategy:r,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[w]:{...f[w],...O}},R&&m<=50&&(m++,typeof R=="object"&&(R.placement&&(g=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):R.rects),{x:d,y:h}=Ut(u,g,a)),y=-1)}return{x:d,y:h,placement:g,strategy:r,middlewareData:f}};async function re(t,e){var o;e===void 0&&(e={});const{x:n,y:r,platform:s,rects:i,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:f=0}=ot(e,t),m=oe(f),w=c[g?h==="floating"?"reference":"floating":h],p=ht(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:a})),x=h==="floating"?{x:n,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),O=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},R=ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:a}):x);return{top:(p.top-R.top+m.top)/O.y,bottom:(R.bottom-p.bottom+m.bottom)/O.y,left:(p.left-R.left+m.left)/O.x,right:(R.right-p.right+m.right)/O.x}}const Je=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:r,rects:s,platform:i,elements:c,middlewareData:a}=e,{element:u,padding:d=0}=ot(t,e)||{};if(u==null)return{};const h=oe(d),g={x:o,y:n},f=Dt(r),m=kt(f),y=await i.getDimensions(u),w=f==="y",p=w?"top":"left",x=w?"bottom":"right",v=w?"clientHeight":"clientWidth",O=s.reference[m]+s.reference[f]-g[f]-s.floating[m],R=g[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let b=S?S[v]:0;(!b||!await(i.isElement==null?void 0:i.isElement(S)))&&(b=c.floating[v]||s.floating[m]);const K=O/2-R/2,M=b/2-y[m]/2-1,L=J(h[p],M),B=J(h[x],M),z=L,Z=b-y[m]-B,A=b/2-y[m]/2+K,_=Ot(z,A,Z),N=!a.arrow&&rt(r)!=null&&A!==_&&s.reference[m]/2-(A<z?L:B)-y[m]/2<0,T=N?A<z?A-z:A-Z:0;return{[f]:g[f]+T,data:{[f]:_,centerOffset:A-_-T,...N&&{alignmentOffset:T}},reset:N}}}),Ge=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=ot(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const p=I(r),x=H(c),v=I(c)===c,O=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=g||(v||!y?[ft(c)]:je(c)),S=m!=="none";!g&&S&&R.push(...qe(c,y,m,O));const b=[c,...R],K=await re(e,w),M=[];let L=((n=s.flip)==null?void 0:n.overflows)||[];if(d&&M.push(K[p]),h){const A=_e(r,i,O);M.push(K[A[0]],K[A[1]])}if(L=[...L,{placement:r,overflows:M}],!M.every(A=>A<=0)){var B,z;const A=(((B=s.flip)==null?void 0:B.index)||0)+1,_=b[A];if(_&&(!(h==="alignment"?x!==H(_):!1)||L.every(k=>k.overflows[0]>0&&H(k.placement)===x)))return{data:{index:A,overflows:L},reset:{placement:_}};let N=(z=L.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(f){case"bestFit":{var Z;const T=(Z=L.filter(k=>{if(S){const U=H(k.placement);return U===x||U==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(U=>U>0).reduce((U,be)=>U+be,0)]).sort((k,U)=>k[1]-U[1])[0])==null?void 0:Z[0];T&&(N=T);break}case"initialPlacement":N=c;break}if(r!==N)return{reset:{placement:N}}}return{}}}};async function Qe(t,e){const{placement:o,platform:n,elements:r}=t,s=await(n.isRTL==null?void 0:n.isRTL(r.floating)),i=I(o),c=rt(o),a=H(o)==="y",u=["left","top"].includes(i)?-1:1,d=s&&a?-1:1,h=ot(e,t);let{mainAxis:g,crossAxis:f,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof m=="number"&&(f=c==="end"?m*-1:m),a?{x:f*d,y:g*u}:{x:g*u,y:f*d}}const Ze=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:r,y:s,placement:i,middlewareData:c}=e,a=await Qe(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},tn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:r}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:p,y:x}=w;return{x:p,y:x}}},...a}=ot(t,e),u={x:o,y:n},d=await re(e,a),h=H(I(r)),g=ne(h);let f=u[g],m=u[h];if(s){const w=g==="y"?"top":"left",p=g==="y"?"bottom":"right",x=f+d[w],v=f-d[p];f=Ot(x,f,v)}if(i){const w=h==="y"?"top":"left",p=h==="y"?"bottom":"right",x=m+d[w],v=m-d[p];m=Ot(x,m,v)}const y=c.fn({...e,[g]:f,[h]:m});return{...y,data:{x:y.x-o,y:y.y-n,enabled:{[g]:s,[h]:i}}}}}};function pt(){return typeof window<"u"}function Q(t){return se(t)?(t.nodeName||"").toLowerCase():"#document"}function P(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(se(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function se(t){return pt()?t instanceof Node||t instanceof P(t).Node:!1}function D(t){return pt()?t instanceof Element||t instanceof P(t).Element:!1}function F(t){return pt()?t instanceof HTMLElement||t instanceof P(t).HTMLElement:!1}function Ht(t){return!pt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof P(t).ShadowRoot}function st(t){const{overflow:e,overflowX:o,overflowY:n,display:r}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(r)}function en(t){return["table","td","th"].includes(Q(t))}function yt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Ct(t){const e=Wt(),o=D(t)?C(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function nn(t){let e=$(t);for(;F(e)&&!G(e);){if(Ct(e))return e;if(yt(e))return null;e=$(e)}return null}function Wt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function G(t){return["html","body","#document"].includes(Q(t))}function C(t){return P(t).getComputedStyle(t)}function wt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $(t){if(Q(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ht(t)&&t.host||V(t);return Ht(e)?e.host:e}function ie(t){const e=$(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&st(e)?e:ie(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=ie(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),i=P(r);if(s){const c=At(i);return e.concat(i,i.visualViewport||[],st(r)?r:[],c&&o?et(c):[])}return e.concat(r,et(r,[],o))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ce(t){const e=C(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const r=F(t),s=r?t.offsetWidth:o,i=r?t.offsetHeight:n,c=ut(o)!==s||ut(n)!==i;return c&&(o=s,n=i),{width:o,height:n,$:c}}function Ft(t){return D(t)?t:t.contextElement}function X(t){const e=Ft(t);if(!F(e))return W(1);const o=e.getBoundingClientRect(),{width:n,height:r,$:s}=ce(e);let i=(s?ut(o.width):o.width)/n,c=(s?ut(o.height):o.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const on=W(0);function ae(t){const e=P(t);return!Wt()||!e.visualViewport?on:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function rn(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==P(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),s=Ft(t);let i=W(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=rn(s,o,n)?ae(s):W(0);let a=(r.left+c.x)/i.x,u=(r.top+c.y)/i.y,d=r.width/i.x,h=r.height/i.y;if(s){const g=P(s),f=n&&D(n)?P(n):n;let m=g,y=At(m);for(;y&&n&&f!==m;){const w=X(y),p=y.getBoundingClientRect(),x=C(y),v=p.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,O=p.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,u*=w.y,d*=w.x,h*=w.y,a+=v,u+=O,m=P(y),y=At(m)}}return ht({width:d,height:h,x:a,y:u})}function Vt(t,e){const o=wt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function le(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-(o?0:Vt(t,n)),s=n.top+e.scrollTop;return{x:r,y:s}}function sn(t){let{elements:e,rect:o,offsetParent:n,strategy:r}=t;const s=r==="fixed",i=V(n),c=e?yt(e.floating):!1;if(n===i||c&&s)return o;let a={scrollLeft:0,scrollTop:0},u=W(1);const d=W(0),h=F(n);if((h||!h&&!s)&&((Q(n)!=="body"||st(i))&&(a=wt(n)),F(n))){const f=q(n);u=X(n),d.x=f.x+n.clientLeft,d.y=f.y+n.clientTop}const g=i&&!h&&!s?le(i,a,!0):W(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+d.x+g.x,y:o.y*u.y-a.scrollTop*u.y+d.y+g.y}}function cn(t){return Array.from(t.getClientRects())}function an(t){const e=V(t),o=wt(t),n=t.ownerDocument.body,r=j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Vt(t);const c=-o.scrollTop;return C(n).direction==="rtl"&&(i+=j(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:c}}function ln(t,e){const o=P(t),n=V(t),r=o.visualViewport;let s=n.clientWidth,i=n.clientHeight,c=0,a=0;if(r){s=r.width,i=r.height;const u=Wt();(!u||u&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}return{width:s,height:i,x:c,y:a}}function un(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,r=o.left+t.clientLeft,s=F(t)?X(t):W(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,a=r*s.x,u=n*s.y;return{width:i,height:c,x:a,y:u}}function $t(t,e,o){let n;if(e==="viewport")n=ln(t,o);else if(e==="document")n=an(V(t));else if(D(e))n=un(e,o);else{const r=ae(t);n={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return ht(n)}function ue(t,e){const o=$(t);return o===e||!D(o)||G(o)?!1:C(o).position==="fixed"||ue(o,e)}function fn(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&Q(c)!=="body"),r=null;const s=C(t).position==="fixed";let i=s?$(t):t;for(;D(i)&&!G(i);){const c=C(i),a=Ct(i);!a&&c.position==="fixed"&&(r=null),(s?!a&&!r:!a&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||st(i)&&!a&&ue(t,i))?n=n.filter(d=>d!==i):r=c,i=$(i)}return e.set(t,n),n}function hn(t){let{element:e,boundary:o,rootBoundary:n,strategy:r}=t;const i=[...o==="clippingAncestors"?yt(e)?[]:fn(e,this._c):[].concat(o),n],c=i[0],a=i.reduce((u,d)=>{const h=$t(e,d,r);return u.top=j(h.top,u.top),u.right=J(h.right,u.right),u.bottom=J(h.bottom,u.bottom),u.left=j(h.left,u.left),u},$t(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function dn(t){const{width:e,height:o}=ce(t);return{width:e,height:o}}function mn(t,e,o){const n=F(e),r=V(e),s=o==="fixed",i=q(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const a=W(0);function u(){a.x=Vt(r)}if(n||!n&&!s)if((Q(e)!=="body"||st(r))&&(c=wt(e)),n){const f=q(e,!0,s,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else r&&u();s&&!n&&r&&u();const d=r&&!n&&!s?le(r,c):W(0),h=i.left+c.scrollLeft-a.x-d.x,g=i.top+c.scrollTop-a.y-d.y;return{x:h,y:g,width:i.width,height:i.height}}function xt(t){return C(t).position==="static"}function Kt(t,e){if(!F(t)||C(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function fe(t,e){const o=P(t);if(yt(t))return o;if(!F(t)){let r=$(t);for(;r&&!G(r);){if(D(r)&&!xt(r))return r;r=$(r)}return o}let n=Kt(t,e);for(;n&&en(n)&&xt(n);)n=Kt(n,e);return n&&G(n)&&xt(n)&&!Ct(n)?o:n||nn(t)||o}const gn=async function(t){const e=this.getOffsetParent||fe,o=this.getDimensions,n=await o(t.floating);return{reference:mn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function pn(t){return C(t).direction==="rtl"}const yn={convertOffsetParentRelativeRectToViewportRelativeRect:sn,getDocumentElement:V,getClippingRect:hn,getOffsetParent:fe,getElementRects:gn,getClientRects:cn,getDimensions:dn,getScale:X,isElement:D,isRTL:pn};function he(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function wn(t,e){let o=null,n;const r=V(t);function s(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=t.getBoundingClientRect(),{left:d,top:h,width:g,height:f}=u;if(c||e(),!g||!f)return;const m=ct(h),y=ct(r.clientWidth-(d+g)),w=ct(r.clientHeight-(h+f)),p=ct(d),v={rootMargin:-m+"px "+-y+"px "+-w+"px "+-p+"px",threshold:j(0,J(1,a))||1};let O=!0;function R(S){const b=S[0].intersectionRatio;if(b!==a){if(!O)return i();b?i(!1,b):n=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!he(u,t.getBoundingClientRect())&&i(),O=!1}try{o=new IntersectionObserver(R,{...v,root:r.ownerDocument})}catch{o=new IntersectionObserver(R,v)}o.observe(t)}return i(!0),s}function vn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Ft(t),d=r||s?[...u?et(u):[],...et(e)]:[];d.forEach(p=>{r&&p.addEventListener("scroll",o,{passive:!0}),s&&p.addEventListener("resize",o)});const h=u&&c?wn(u,o):null;let g=-1,f=null;i&&(f=new ResizeObserver(p=>{let[x]=p;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),o()}),u&&!a&&f.observe(u),f.observe(e));let m,y=a?q(t):null;a&&w();function w(){const p=q(t);y&&!he(y,p)&&o(),y=p,m=requestAnimationFrame(w)}return o(),()=>{var p;d.forEach(x=>{r&&x.removeEventListener("scroll",o),s&&x.removeEventListener("resize",o)}),h==null||h(),(p=f)==null||p.disconnect(),f=null,a&&cancelAnimationFrame(m)}}const xn=Ze,Rn=tn,Bt=Ge,On=Je,bn=(t,e,o)=>{const n=new Map,r={platform:yn,...o},s={...r.platform,_c:n};return Xe(t,e,{...r,platform:s})},An=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],En=(t,e={isOpen:!1})=>{const o=[];let n=null;const r=l.Value.deriveProp(e.isOpen);function s(c){n=c,r.set(!0)}function i(){r.set(!1),o.forEach(c=>c()),o.length=0}return l.Fragment(t(s,i),l.When(r,()=>l.Fragment((n==null?void 0:n.onClickOutside)!=null?te(n.onClickOutside):null,l.WithElement(c=>l.Portal("body",l.html.div(l.WithElement(a=>{a.style.position="absolute";const u=typeof(n==null?void 0:n.target)=="string"?c.querySelector(n.target):(n==null?void 0:n.target)??c;if(u==null)throw new Error(`Target not found: ${n==null?void 0:n.target}`);let d=null;const h=l.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),g=l.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=l.Value.toSignal((n==null?void 0:n.placement)??"top"),m=l.Value.toSignal((n==null?void 0:n.arrowPadding)??0),y=n==null?void 0:n.arrow,w=l.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function p(){const v=[Bt(),xn({mainAxis:h.get(),crossAxis:g.get()}),Rn(),Bt()];y!=null&&d!=null&&v.push(On({element:d,padding:m.get()}));const O=await bn(u,a,{placement:f.get(),strategy:"absolute",middleware:v}),{x:R,y:S,middlewareData:b}=O;if(a.style.top=`${S}px`,a.style.left=`${R}px`,d!=null&&b.arrow!=null){const{x:K,y:M,centerOffset:L,alignmentOffset:B}=b.arrow;w.set({x:K,y:M,centerOffset:L,alignmentOffset:B,containerWidth:a.offsetWidth,containerHeight:a.offsetHeight})}}const x=l.effectOf(h,g,f)(p);return l.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?l.html.div(n==null?void 0:n.arrow(l.computedOf(w,f)((v,O)=>({...v,placement:O}))),l.WithElement(v=>{d=v,p()})):null,l.OnDispose(w.dispose,vn(u,a,p),x))})))))))},de=(t,e,o)=>{const n=l.prop(E.AsyncResult.notAsked),r=n.map(h=>E.AsyncResult.isSuccess(h)?h.value:void 0),s=n.map(h=>E.AsyncResult.isFailure(h)?h.error:void 0),i=n.map(h=>E.AsyncResult.isLoading(h));let c;const a=async h=>{c==null||c.abort(),c=new AbortController;const g=c.signal,f=n.get();n.set(E.AsyncResult.loading(E.AsyncResult.getOrUndefined(f)));try{const m=await e({request:h,abortSignal:g,previous:f});await Promise.resolve(),c=void 0,n.set(E.AsyncResult.success(m))}catch(m){c=void 0,n.set(E.AsyncResult.failure(o(m)))}},u=()=>a(l.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,n.dispose()};return n.onDispose(l.Value.on(t,a)),{status:n,value:r,error:s,loading:i,reload:u,dispose:d}},me=(t,e)=>{const{status:o,dispose:n,reload:r}=t,{loading:s,failure:i,success:c}=e;return l.Fragment(l.OnDispose(n),Lt(o,{loading:s!=null?a=>s(a,r):void 0,failure:i!=null?a=>i(a,r):void 0,success:a=>c(a,r)}))},Pn=({request:t,load:e,mapError:o=n=>n})=>{const n=de(t,e,o);return r=>me(n,r)},ge=(t,e)=>{if(typeof e=="function")return ge(t,{success:e});const o=e.failure??(r=>l.Fragment(l.OnDispose(r.on(console.error)),r.map(s=>`Error: ${s}`))),n=e.success;return l.OneOfType(l.Value.toSignal(t),{Success:r=>n(r.$.value),Failure:r=>o(r.$.error)})},Sn=()=>l.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,o,n,r){vt(this,"equals",e=>E.nearEqual(this.left,e.left)&&E.nearEqual(this.top,e.top)&&E.nearEqual(this.width,e.width)&&E.nearEqual(this.height,e.height));this.left=e,this.top=o,this.width=n,this.height=r}static of({left:e=0,top:o=0,width:n=0,height:r=0}){return new it(e,o,n,r)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get size(){return{width:this.width,height:this.height}}}function Et(t){const e=t.getBoundingClientRect();return it.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const Ln=t=>l.WithBrowserCtx(e=>{const{element:o}=e,n=l.prop(Et(o),(c,a)=>c.equals(a)),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(it.of(Et(o)));let i=null;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(s)),i==null||i.observe(o),l.OnDispose(c=>{i==null||i.disconnect(),r(c)})});function zt(t){return{width:(t==null?void 0:t.innerWidth)??0,height:(t==null?void 0:t.innerHeight)??0}}const Tn=t=>e=>{const o=l.getWindow(),n=l.prop(zt(o),(i,c)=>i.width===c.width&&i.height===c.height),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(zt(o));return o==null||o.addEventListener("resize",s),i=>{o==null||o.removeEventListener("resize",s),r(i)}},pe=(t,e)=>{const o=e.split("/").filter(r=>r!==""),n={};for(let r=0;r<t.length;r++){const s=t[r],i=o[r];if(!i&&s.type!=="catch-all")return null;if(s.type==="literal"){if(s.value!==i)return null}else if(s.type==="param")n[s.name]=i;else if(s.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Mt=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!==""),kn=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=pe(r,n);if(i)return{...i,route:s}}return null}},dt={mark:l.makeProviderMark("RouterContext"),create:()=>{const t=l.prop([]);return{value:t,dispose:()=>t.dispose()}}},Dn=(t,e,o)=>{const n=o.split("/").filter(i=>i!==""),r={};let s=0;for(let i=0;i<t.length;i++){const c=t[i],a=n[i];if(!a&&c.type!=="catch-all")return null;if(c.type==="literal"){if(c.value!==a)return null;s++}else if(c.type==="param")r[c.name]=a,s++;else if(c.type==="catch-all"){const u="/"+n.slice(0,s).join("/"),d="/"+n.slice(s).join("/");return{params:r,matchedPath:u==="/"?"":u,remainingPath:d==="/"?"":d,route:e}}}if(n.length===t.length){const i="/"+n.join("/");return{params:r,matchedPath:i==="/"?"":i,remainingPath:"",route:e}}return null},ye=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=Dn(r,s,n);if(i)return i}return null}},Cn=t=>{const e=ye(Object.keys(t));return l.Provide(dt,{},()=>l.Use(gt,o=>l.Use(dt,n=>{const r=o.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");const c={matchedPath:i.matchedPath,remainingPath:i.remainingPath,fullPath:s.pathname,params:i.params};return n.value=[...n.value,c],{params:i.params,route:i.route,path:i.matchedPath||s.pathname,search:s.search,hash:s.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)})))},Wn=t=>{const e=ye(Object.keys(t));return l.Use(dt,o=>l.Use(gt,n=>{const r=o.map(s=>{const i=s[s.length-1],c=(i==null?void 0:i.remainingPath)||"";if(c==="")throw console.error("No remaining path for SubRouter",s),new Error("No remaining path for SubRouter");const a=e(c);if(a==null)throw console.error("No route found for remaining path",c),new Error("No route found");return{params:a.params,route:a.route,path:a.matchedPath,search:n.value.search,hash:n.value.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)}))},mt=60*1e3,Pt=60*mt,nt=24*Pt,_t=7*nt,jt=30*nt,Fn=365*nt,Vn=[{max:mt*90,value:mt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Pt*36,value:Pt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:_t*6,value:_t,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:jt*18,value:jt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Fn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function It(t,e,o,n){const r=Math.round(t/e);return r<=1?o:n.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const we=(t=1e3)=>{const e=l.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},ve=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Vn)if(e<o.max)return t<0?It(e,o.value,o.past.singular,o.past.plural):It(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},xe=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):we(o),r=l.computedOf(t,n)((s,i)=>s.getTime()-i.getTime());return r.onDispose(()=>l.Value.dispose(n)),r},Re=(t,e={})=>{const o=xe(t,e),n=o.map(ve);return n.onDispose(o.dispose),n},Mn=(t,e={})=>Re(t,e);class Oe extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Nn=(t=0)=>new Oe(t,(e,o)=>e===o);exports.Anchor=Gt;exports.Appearance=Ce;exports.AsyncResultView=Lt;exports.AutoFocus=We;exports.AutoSelect=Fe;exports.ChildRouter=Wn;exports.ElementRect=Ln;exports.HTMLTitle=Me;exports.HiddenWhenEmpty=Ve;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=te;exports.OnEnterKey=$e;exports.OnEscapeKey=Ke;exports.OnKeyPressed=Tt;exports.PopOver=En;exports.Rect=it;exports.Resource=Pn;exports.ResourceDisplay=me;exports.ResultView=ge;exports.RootRouter=Cn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Sn;exports.Ticker=Oe;exports.WhenInViewport=He;exports.WindowSize=Tn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=kn;exports._parseRouteSegments=Mt;exports.allPlacements=An;exports.areLocationsEqual=Jt;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Xt;exports.locationFromURL=St;exports.makeResource=de;exports.matchesKeyCombo=ee;exports.matchesRoute=pe;exports.nowSignal=we;exports.relativeTime=Mn;exports.relativeTimeMillisSignal=xe;exports.relativeTimeSignal=Re;exports.setLocationFromUrl=Rt;exports.ticker=Nn;exports.timeDiffToString=ve;exports.urlFromLocation=lt;exports.useAppearance=Qt;
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var Le = Object.defineProperty;
2
2
  var Pe = (t, e, o) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
3
  var At = (t, e, o) => Pe(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { getWindow as at, prop as F, makeProviderMark as Wt, Signal as te, Use as rt, html as Et, on as ee, Value as E, attr as ne, Empty as Lt, OneOfType as oe, WithElement as H, OnDispose as M, Portal as re, Fragment as st, renderableOfTNode as Ft, When as se, effectOf as Se, computedOf as ie, WithBrowserCtx as Te, Provide as ke, OneOfTuple as ce, Prop as Ce } from "@tempots/dom";
4
+ import { getWindow as at, prop as F, makeProviderMark as Wt, Signal as te, Use as st, html as Et, on as ee, Value as E, attr as ne, Empty as Lt, OneOfType as oe, WithElement as H, OnDispose as M, Portal as re, Fragment as Q, renderableOfTNode as Ft, When as se, effectOf as Se, computedOf as ie, WithBrowserCtx as Te, Provide as ke, OneOfTuple as ce, Prop as Ce } from "@tempots/dom";
5
5
  import { delayed as ae, AsyncResult as U, nearEqual as ht, interval as De } from "@tempots/std";
6
6
  const We = (t) => {
7
7
  const e = t.split("/").pop();
@@ -118,7 +118,7 @@ const We = (t) => {
118
118
  withViewTransition: n,
119
119
  ...r
120
120
  } = t;
121
- return rt(Mt, (s) => Et.a(
121
+ return st(Mt, (s) => Et.a(
122
122
  ee.click(
123
123
  Ne(() => (n === !0 ? ze(() => {
124
124
  zt(s, E.get(o));
@@ -128,7 +128,7 @@ const We = (t) => {
128
128
  ...e
129
129
  /* c8 ignore next 2 */
130
130
  ));
131
- }, In = {
131
+ }, Yn = {
132
132
  mark: Wt("Appearance"),
133
133
  create: () => {
134
134
  const t = _e();
@@ -152,15 +152,15 @@ const ue = (t, e) => {
152
152
  Loading: (i) => r(i.map((c) => c.previousValue)),
153
153
  NotAsked: s
154
154
  });
155
- }, Yn = (t = 10) => H((e) => M(ae(() => e == null ? void 0 : e.focus(), t))), qn = (t = 10) => H((e) => {
155
+ }, qn = (t = 10) => H((e) => M(ae(() => e == null ? void 0 : e.focus(), t))), Xn = (t = 10) => H((e) => {
156
156
  const o = ae(() => e.select(), t);
157
157
  return M(o);
158
- }), Xn = H((t) => {
158
+ }), Jn = H((t) => {
159
159
  const e = t.style.getPropertyValue(":empty");
160
160
  return t.style.setProperty(":empty", "display:none"), M((o) => {
161
161
  o && t.style.setProperty(":empty", e);
162
162
  });
163
- }), Jn = (t) => re("head > title", ne.innerText(t)), je = {
163
+ }), Gn = (t) => re("head > title", ne.innerText(t)), je = {
164
164
  partial: {
165
165
  root: null,
166
166
  rootMargin: "0px",
@@ -174,27 +174,27 @@ const ue = (t, e) => {
174
174
  }, mt = {
175
175
  partial: /* @__PURE__ */ new Map(),
176
176
  full: /* @__PURE__ */ new Map()
177
- }, ot = {
177
+ }, rt = {
178
178
  partial: null,
179
179
  full: null
180
180
  };
181
181
  function Ie(t) {
182
- return ot[t] == null && (ot[t] = new IntersectionObserver((e) => {
182
+ return rt[t] == null && (rt[t] = new IntersectionObserver((e) => {
183
183
  e.forEach((o) => {
184
184
  const n = mt[t].get(o.target);
185
185
  n == null || n.set(o.isIntersecting);
186
186
  });
187
- }, je[t])), ot[t];
187
+ }, je[t])), rt[t];
188
188
  }
189
189
  const Ye = ({ mode: t = "partial", once: e = !1 }, o) => {
190
190
  const n = F(!1);
191
- return st(
191
+ return Q(
192
192
  H((r) => {
193
193
  const s = typeof IntersectionObserver < "u" ? Ie(t) : null;
194
194
  mt[t].set(r, n), s == null || s.observe(r);
195
195
  function i() {
196
196
  var a;
197
- s == null || s.unobserve(r), mt[t].delete(r), mt[t].size === 0 && ((a = ot[t]) == null || a.disconnect(), ot[t] = null);
197
+ s == null || s.unobserve(r), mt[t].delete(r), mt[t].size === 0 && ((a = rt[t]) == null || a.disconnect(), rt[t] = null);
198
198
  }
199
199
  let c = null;
200
200
  return e && (c = n.on((a) => {
@@ -205,8 +205,8 @@ const Ye = ({ mode: t = "partial", once: e = !1 }, o) => {
205
205
  }),
206
206
  Ft(o(n))
207
207
  );
208
- }, Gn = (t, e, o) => Ye(t, (n) => se(n, e, o ?? (() => Lt)));
209
- function Qn(t) {
208
+ }, Qn = (t, e, o) => Ye(t, (n) => se(n, e, o ?? (() => Lt)));
209
+ function qe(t) {
210
210
  return H((e) => {
211
211
  const o = (n) => {
212
212
  e.contains(n.target) || t(n);
@@ -217,7 +217,7 @@ function Qn(t) {
217
217
  });
218
218
  }
219
219
  const G = (t, e) => t === void 0 || t === e, Kt = (t, e) => t === void 0 || t === e;
220
- function qe(t, e) {
220
+ function Xe(t, e) {
221
221
  return typeof t == "string" ? e.key === t : Kt(t.key, e.key) && Kt(t.code, e.code) && G(t.ctrlKey, e.ctrlKey) && G(t.altKey, e.altKey) && G(t.shiftKey, e.shiftKey) && G(t.metaKey, e.metaKey) && G(t.repeat, e.repeat) && G(
222
222
  t.commandOrControlKey,
223
223
  e.metaKey || e.ctrlKey
@@ -231,7 +231,7 @@ function fe({
231
231
  const n = (r) => {
232
232
  if (o.contains(r.target)) {
233
233
  for (const s of t)
234
- if (qe(s, r)) {
234
+ if (Xe(s, r)) {
235
235
  e(r);
236
236
  break;
237
237
  }
@@ -248,20 +248,20 @@ function Zn(t) {
248
248
  function to(t) {
249
249
  return fe({ allowedKeys: ["Escape"], handler: t });
250
250
  }
251
- const Z = Math.min, q = Math.max, gt = Math.round, dt = Math.floor, D = (t) => ({
251
+ const tt = Math.min, q = Math.max, gt = Math.round, dt = Math.floor, D = (t) => ({
252
252
  x: t,
253
253
  y: t
254
- }), Xe = {
254
+ }), Je = {
255
255
  left: "right",
256
256
  right: "left",
257
257
  bottom: "top",
258
258
  top: "bottom"
259
- }, Je = {
259
+ }, Ge = {
260
260
  start: "end",
261
261
  end: "start"
262
262
  };
263
263
  function St(t, e, o) {
264
- return q(t, Z(e, o));
264
+ return q(t, tt(e, o));
265
265
  }
266
266
  function lt(t, e) {
267
267
  return typeof t == "function" ? t(e) : t;
@@ -284,20 +284,20 @@ function z(t) {
284
284
  function Vt(t) {
285
285
  return he(z(t));
286
286
  }
287
- function Ge(t, e, o) {
287
+ function Qe(t, e, o) {
288
288
  o === void 0 && (o = !1);
289
289
  const n = ut(t), r = Vt(t), s = Nt(r);
290
290
  let i = r === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
291
291
  return e.reference[s] > e.floating[s] && (i = pt(i)), [i, pt(i)];
292
292
  }
293
- function Qe(t) {
293
+ function Ze(t) {
294
294
  const e = pt(t);
295
295
  return [Tt(t), e, Tt(e)];
296
296
  }
297
297
  function Tt(t) {
298
- return t.replace(/start|end/g, (e) => Je[e]);
298
+ return t.replace(/start|end/g, (e) => Ge[e]);
299
299
  }
300
- function Ze(t, e, o) {
300
+ function tn(t, e, o) {
301
301
  const n = ["left", "right"], r = ["right", "left"], s = ["top", "bottom"], i = ["bottom", "top"];
302
302
  switch (t) {
303
303
  case "top":
@@ -310,15 +310,15 @@ function Ze(t, e, o) {
310
310
  return [];
311
311
  }
312
312
  }
313
- function tn(t, e, o, n) {
313
+ function en(t, e, o, n) {
314
314
  const r = ut(t);
315
- let s = Ze(X(t), o === "start", n);
315
+ let s = tn(X(t), o === "start", n);
316
316
  return r && (s = s.map((i) => i + "-" + r), e && (s = s.concat(s.map(Tt)))), s;
317
317
  }
318
318
  function pt(t) {
319
- return t.replace(/left|right|bottom|top/g, (e) => Xe[e]);
319
+ return t.replace(/left|right|bottom|top/g, (e) => Je[e]);
320
320
  }
321
- function en(t) {
321
+ function nn(t) {
322
322
  return {
323
323
  top: 0,
324
324
  right: 0,
@@ -328,7 +328,7 @@ function en(t) {
328
328
  };
329
329
  }
330
330
  function de(t) {
331
- return typeof t != "number" ? en(t) : {
331
+ return typeof t != "number" ? nn(t) : {
332
332
  top: t,
333
333
  right: t,
334
334
  bottom: t,
@@ -401,7 +401,7 @@ function _t(t, e, o) {
401
401
  }
402
402
  return u;
403
403
  }
404
- const nn = async (t, e, o) => {
404
+ const on = async (t, e, o) => {
405
405
  const {
406
406
  placement: n = "bottom",
407
407
  strategy: r = "absolute",
@@ -507,7 +507,7 @@ async function me(t, e) {
507
507
  right: (v.right - g.right + d.right) / b.x
508
508
  };
509
509
  }
510
- const on = (t) => ({
510
+ const rn = (t) => ({
511
511
  name: "arrow",
512
512
  options: t,
513
513
  async fn(e) {
@@ -531,7 +531,7 @@ const on = (t) => ({
531
531
  }, u = Vt(r), d = Nt(u), p = await i.getDimensions(l), w = u === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", b = s.reference[d] + s.reference[u] - m[u] - s.floating[d], v = m[u] - s.reference[u], L = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l));
532
532
  let R = L ? L[y] : 0;
533
533
  (!R || !await (i.isElement == null ? void 0 : i.isElement(L))) && (R = c.floating[y] || s.floating[d]);
534
- const _ = b / 2 - v / 2, V = R / 2 - p[d] / 2 - 1, P = Z(f[g], V), j = Z(f[x], V), I = P, nt = R - p[d] - j, A = R / 2 - p[d] / 2 + _, Y = St(I, A, nt), $ = !a.arrow && ut(r) != null && A !== Y && s.reference[d] / 2 - (A < I ? P : j) - p[d] / 2 < 0, S = $ ? A < I ? A - I : A - nt : 0;
534
+ const _ = b / 2 - v / 2, V = R / 2 - p[d] / 2 - 1, P = tt(f[g], V), j = tt(f[x], V), I = P, ot = R - p[d] - j, A = R / 2 - p[d] / 2 + _, Y = St(I, A, ot), $ = !a.arrow && ut(r) != null && A !== Y && s.reference[d] / 2 - (A < I ? P : j) - p[d] / 2 < 0, S = $ ? A < I ? A - I : A - ot : 0;
535
535
  return {
536
536
  [u]: m[u] + S,
537
537
  data: {
@@ -544,7 +544,7 @@ const on = (t) => ({
544
544
  reset: $
545
545
  };
546
546
  }
547
- }), rn = function(t) {
547
+ }), sn = function(t) {
548
548
  return t === void 0 && (t = {}), {
549
549
  name: "flip",
550
550
  options: t,
@@ -568,12 +568,12 @@ const on = (t) => ({
568
568
  } = lt(t, e);
569
569
  if ((o = s.arrow) != null && o.alignmentOffset)
570
570
  return {};
571
- const g = X(r), x = z(c), y = X(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = m || (y || !p ? [pt(c)] : Qe(c)), L = d !== "none";
572
- !m && L && v.push(...tn(c, p, d, b));
571
+ const g = X(r), x = z(c), y = X(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = m || (y || !p ? [pt(c)] : Ze(c)), L = d !== "none";
572
+ !m && L && v.push(...en(c, p, d, b));
573
573
  const R = [c, ...v], _ = await me(e, w), V = [];
574
574
  let P = ((n = s.flip) == null ? void 0 : n.overflows) || [];
575
575
  if (h && V.push(_[g]), f) {
576
- const A = Ge(r, i, b);
576
+ const A = Qe(r, i, b);
577
577
  V.push(_[A[0]], _[A[1]]);
578
578
  }
579
579
  if (P = [...P, {
@@ -598,8 +598,8 @@ const on = (t) => ({
598
598
  if (!$)
599
599
  switch (u) {
600
600
  case "bestFit": {
601
- var nt;
602
- const S = (nt = P.filter((T) => {
601
+ var ot;
602
+ const S = (ot = P.filter((T) => {
603
603
  if (L) {
604
604
  const B = z(T.placement);
605
605
  return B === x || // Create a bias to the `y` side axis due to horizontal
@@ -607,7 +607,7 @@ const on = (t) => ({
607
607
  B === "y";
608
608
  }
609
609
  return !0;
610
- }).map((T) => [T.placement, T.overflows.filter((B) => B > 0).reduce((B, Ee) => B + Ee, 0)]).sort((T, B) => T[1] - B[1])[0]) == null ? void 0 : nt[0];
610
+ }).map((T) => [T.placement, T.overflows.filter((B) => B > 0).reduce((B, Ee) => B + Ee, 0)]).sort((T, B) => T[1] - B[1])[0]) == null ? void 0 : ot[0];
611
611
  S && ($ = S);
612
612
  break;
613
613
  }
@@ -626,7 +626,7 @@ const on = (t) => ({
626
626
  }
627
627
  };
628
628
  };
629
- async function sn(t, e) {
629
+ async function cn(t, e) {
630
630
  const {
631
631
  placement: o,
632
632
  platform: n,
@@ -653,7 +653,7 @@ async function sn(t, e) {
653
653
  y: u * h
654
654
  };
655
655
  }
656
- const cn = function(t) {
656
+ const an = function(t) {
657
657
  return t === void 0 && (t = 0), {
658
658
  name: "offset",
659
659
  options: t,
@@ -664,7 +664,7 @@ const cn = function(t) {
664
664
  y: s,
665
665
  placement: i,
666
666
  middlewareData: c
667
- } = e, a = await sn(e, t);
667
+ } = e, a = await cn(e, t);
668
668
  return i === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
669
669
  x: r + a.x,
670
670
  y: s + a.y,
@@ -675,7 +675,7 @@ const cn = function(t) {
675
675
  };
676
676
  }
677
677
  };
678
- }, an = function(t) {
678
+ }, ln = function(t) {
679
679
  return t === void 0 && (t = {}), {
680
680
  name: "shift",
681
681
  options: t,
@@ -735,7 +735,7 @@ const cn = function(t) {
735
735
  function xt() {
736
736
  return typeof window < "u";
737
737
  }
738
- function et(t) {
738
+ function nt(t) {
739
739
  return ge(t) ? (t.nodeName || "").toLowerCase() : "#document";
740
740
  }
741
741
  function O(t) {
@@ -767,8 +767,8 @@ function ft(t) {
767
767
  } = C(t);
768
768
  return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !["inline", "contents"].includes(r);
769
769
  }
770
- function ln(t) {
771
- return ["table", "td", "th"].includes(et(t));
770
+ function un(t) {
771
+ return ["table", "td", "th"].includes(nt(t));
772
772
  }
773
773
  function vt(t) {
774
774
  return [":popover-open", ":modal"].some((e) => {
@@ -783,9 +783,9 @@ function $t(t) {
783
783
  const e = Ht(), o = k(t) ? C(t) : t;
784
784
  return ["transform", "translate", "scale", "rotate", "perspective"].some((n) => o[n] ? o[n] !== "none" : !1) || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((n) => (o.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (o.contain || "").includes(n));
785
785
  }
786
- function un(t) {
786
+ function fn(t) {
787
787
  let e = K(t);
788
- for (; W(e) && !tt(e); ) {
788
+ for (; W(e) && !et(e); ) {
789
789
  if ($t(e))
790
790
  return e;
791
791
  if (vt(e))
@@ -797,8 +797,8 @@ function un(t) {
797
797
  function Ht() {
798
798
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
799
799
  }
800
- function tt(t) {
801
- return ["html", "body", "#document"].includes(et(t));
800
+ function et(t) {
801
+ return ["html", "body", "#document"].includes(nt(t));
802
802
  }
803
803
  function C(t) {
804
804
  return O(t).getComputedStyle(t);
@@ -813,7 +813,7 @@ function bt(t) {
813
813
  };
814
814
  }
815
815
  function K(t) {
816
- if (et(t) === "html")
816
+ if (nt(t) === "html")
817
817
  return t;
818
818
  const e = (
819
819
  // Step into the shadow DOM of the parent of a slotted node.
@@ -826,7 +826,7 @@ function K(t) {
826
826
  }
827
827
  function pe(t) {
828
828
  const e = K(t);
829
- return tt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : W(e) && ft(e) ? e : pe(e);
829
+ return et(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : W(e) && ft(e) ? e : pe(e);
830
830
  }
831
831
  function it(t, e, o) {
832
832
  var n;
@@ -854,7 +854,7 @@ function we(t) {
854
854
  function Bt(t) {
855
855
  return k(t) ? t : t.contextElement;
856
856
  }
857
- function Q(t) {
857
+ function Z(t) {
858
858
  const e = Bt(t);
859
859
  if (!W(e))
860
860
  return D(1);
@@ -869,29 +869,29 @@ function Q(t) {
869
869
  y: c
870
870
  };
871
871
  }
872
- const fn = /* @__PURE__ */ D(0);
872
+ const hn = /* @__PURE__ */ D(0);
873
873
  function ye(t) {
874
874
  const e = O(t);
875
- return !Ht() || !e.visualViewport ? fn : {
875
+ return !Ht() || !e.visualViewport ? hn : {
876
876
  x: e.visualViewport.offsetLeft,
877
877
  y: e.visualViewport.offsetTop
878
878
  };
879
879
  }
880
- function hn(t, e, o) {
880
+ function dn(t, e, o) {
881
881
  return e === void 0 && (e = !1), !o || e && o !== O(t) ? !1 : e;
882
882
  }
883
883
  function J(t, e, o, n) {
884
884
  e === void 0 && (e = !1), o === void 0 && (o = !1);
885
885
  const r = t.getBoundingClientRect(), s = Bt(t);
886
886
  let i = D(1);
887
- e && (n ? k(n) && (i = Q(n)) : i = Q(t));
888
- const c = hn(s, o, n) ? ye(s) : D(0);
887
+ e && (n ? k(n) && (i = Z(n)) : i = Z(t));
888
+ const c = dn(s, o, n) ? ye(s) : D(0);
889
889
  let a = (r.left + c.x) / i.x, l = (r.top + c.y) / i.y, h = r.width / i.x, f = r.height / i.y;
890
890
  if (s) {
891
891
  const m = O(s), u = n && k(n) ? O(n) : n;
892
892
  let d = m, p = kt(d);
893
893
  for (; p && n && u !== d; ) {
894
- const w = Q(p), g = p.getBoundingClientRect(), x = C(p), y = g.left + (p.clientLeft + parseFloat(x.paddingLeft)) * w.x, b = g.top + (p.clientTop + parseFloat(x.paddingTop)) * w.y;
894
+ const w = Z(p), g = p.getBoundingClientRect(), x = C(p), y = g.left + (p.clientLeft + parseFloat(x.paddingLeft)) * w.x, b = g.top + (p.clientTop + parseFloat(x.paddingTop)) * w.y;
895
895
  a *= w.x, l *= w.y, h *= w.x, f *= w.y, a += y, l += b, d = O(p), p = kt(d);
896
896
  }
897
897
  }
@@ -917,7 +917,7 @@ function xe(t, e, o) {
917
917
  y: s
918
918
  };
919
919
  }
920
- function dn(t) {
920
+ function mn(t) {
921
921
  let {
922
922
  elements: e,
923
923
  rect: o,
@@ -932,9 +932,9 @@ function dn(t) {
932
932
  scrollTop: 0
933
933
  }, l = D(1);
934
934
  const h = D(0), f = W(n);
935
- if ((f || !f && !s) && ((et(n) !== "body" || ft(i)) && (a = bt(n)), W(n))) {
935
+ if ((f || !f && !s) && ((nt(n) !== "body" || ft(i)) && (a = bt(n)), W(n))) {
936
936
  const u = J(n);
937
- l = Q(n), h.x = u.x + n.clientLeft, h.y = u.y + n.clientTop;
937
+ l = Z(n), h.x = u.x + n.clientLeft, h.y = u.y + n.clientTop;
938
938
  }
939
939
  const m = i && !f && !s ? xe(i, a, !0) : D(0);
940
940
  return {
@@ -944,10 +944,10 @@ function dn(t) {
944
944
  y: o.y * l.y - a.scrollTop * l.y + h.y + m.y
945
945
  };
946
946
  }
947
- function mn(t) {
947
+ function gn(t) {
948
948
  return Array.from(t.getClientRects());
949
949
  }
950
- function gn(t) {
950
+ function pn(t) {
951
951
  const e = N(t), o = bt(t), n = t.ownerDocument.body, r = q(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = q(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
952
952
  let i = -o.scrollLeft + Ut(t);
953
953
  const c = -o.scrollTop;
@@ -958,7 +958,7 @@ function gn(t) {
958
958
  y: c
959
959
  };
960
960
  }
961
- function pn(t, e) {
961
+ function wn(t, e) {
962
962
  const o = O(t), n = N(t), r = o.visualViewport;
963
963
  let s = n.clientWidth, i = n.clientHeight, c = 0, a = 0;
964
964
  if (r) {
@@ -973,8 +973,8 @@ function pn(t, e) {
973
973
  y: a
974
974
  };
975
975
  }
976
- function wn(t, e) {
977
- const o = J(t, !0, e === "fixed"), n = o.top + t.clientTop, r = o.left + t.clientLeft, s = W(t) ? Q(t) : D(1), i = t.clientWidth * s.x, c = t.clientHeight * s.y, a = r * s.x, l = n * s.y;
976
+ function yn(t, e) {
977
+ const o = J(t, !0, e === "fixed"), n = o.top + t.clientTop, r = o.left + t.clientLeft, s = W(t) ? Z(t) : D(1), i = t.clientWidth * s.x, c = t.clientHeight * s.y, a = r * s.x, l = n * s.y;
978
978
  return {
979
979
  width: i,
980
980
  height: c,
@@ -985,11 +985,11 @@ function wn(t, e) {
985
985
  function It(t, e, o) {
986
986
  let n;
987
987
  if (e === "viewport")
988
- n = pn(t, o);
988
+ n = wn(t, o);
989
989
  else if (e === "document")
990
- n = gn(N(t));
990
+ n = pn(N(t));
991
991
  else if (k(e))
992
- n = wn(e, o);
992
+ n = yn(e, o);
993
993
  else {
994
994
  const r = ye(t);
995
995
  n = {
@@ -1003,31 +1003,31 @@ function It(t, e, o) {
1003
1003
  }
1004
1004
  function ve(t, e) {
1005
1005
  const o = K(t);
1006
- return o === e || !k(o) || tt(o) ? !1 : C(o).position === "fixed" || ve(o, e);
1006
+ return o === e || !k(o) || et(o) ? !1 : C(o).position === "fixed" || ve(o, e);
1007
1007
  }
1008
- function yn(t, e) {
1008
+ function xn(t, e) {
1009
1009
  const o = e.get(t);
1010
1010
  if (o)
1011
1011
  return o;
1012
- let n = it(t, [], !1).filter((c) => k(c) && et(c) !== "body"), r = null;
1012
+ let n = it(t, [], !1).filter((c) => k(c) && nt(c) !== "body"), r = null;
1013
1013
  const s = C(t).position === "fixed";
1014
1014
  let i = s ? K(t) : t;
1015
- for (; k(i) && !tt(i); ) {
1015
+ for (; k(i) && !et(i); ) {
1016
1016
  const c = C(i), a = $t(i);
1017
1017
  !a && c.position === "fixed" && (r = null), (s ? !a && !r : !a && c.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || ft(i) && !a && ve(t, i)) ? n = n.filter((h) => h !== i) : r = c, i = K(i);
1018
1018
  }
1019
1019
  return e.set(t, n), n;
1020
1020
  }
1021
- function xn(t) {
1021
+ function vn(t) {
1022
1022
  let {
1023
1023
  element: e,
1024
1024
  boundary: o,
1025
1025
  rootBoundary: n,
1026
1026
  strategy: r
1027
1027
  } = t;
1028
- const i = [...o === "clippingAncestors" ? vt(e) ? [] : yn(e, this._c) : [].concat(o), n], c = i[0], a = i.reduce((l, h) => {
1028
+ const i = [...o === "clippingAncestors" ? vt(e) ? [] : xn(e, this._c) : [].concat(o), n], c = i[0], a = i.reduce((l, h) => {
1029
1029
  const f = It(e, h, r);
1030
- return l.top = q(f.top, l.top), l.right = Z(f.right, l.right), l.bottom = Z(f.bottom, l.bottom), l.left = q(f.left, l.left), l;
1030
+ return l.top = q(f.top, l.top), l.right = tt(f.right, l.right), l.bottom = tt(f.bottom, l.bottom), l.left = q(f.left, l.left), l;
1031
1031
  }, It(e, c, r));
1032
1032
  return {
1033
1033
  width: a.right - a.left,
@@ -1036,7 +1036,7 @@ function xn(t) {
1036
1036
  y: a.top
1037
1037
  };
1038
1038
  }
1039
- function vn(t) {
1039
+ function bn(t) {
1040
1040
  const {
1041
1041
  width: e,
1042
1042
  height: o
@@ -1046,7 +1046,7 @@ function vn(t) {
1046
1046
  height: o
1047
1047
  };
1048
1048
  }
1049
- function bn(t, e, o) {
1049
+ function Rn(t, e, o) {
1050
1050
  const n = W(e), r = N(e), s = o === "fixed", i = J(t, !0, s, e);
1051
1051
  let c = {
1052
1052
  scrollLeft: 0,
@@ -1057,7 +1057,7 @@ function bn(t, e, o) {
1057
1057
  a.x = Ut(r);
1058
1058
  }
1059
1059
  if (n || !n && !s)
1060
- if ((et(e) !== "body" || ft(r)) && (c = bt(e)), n) {
1060
+ if ((nt(e) !== "body" || ft(r)) && (c = bt(e)), n) {
1061
1061
  const u = J(e, !0, s, e);
1062
1062
  a.x = u.x + e.clientLeft, a.y = u.y + e.clientTop;
1063
1063
  } else r && l();
@@ -1087,7 +1087,7 @@ function be(t, e) {
1087
1087
  return o;
1088
1088
  if (!W(t)) {
1089
1089
  let r = K(t);
1090
- for (; r && !tt(r); ) {
1090
+ for (; r && !et(r); ) {
1091
1091
  if (k(r) && !Ot(r))
1092
1092
  return r;
1093
1093
  r = K(r);
@@ -1095,14 +1095,14 @@ function be(t, e) {
1095
1095
  return o;
1096
1096
  }
1097
1097
  let n = Yt(t, e);
1098
- for (; n && ln(n) && Ot(n); )
1098
+ for (; n && un(n) && Ot(n); )
1099
1099
  n = Yt(n, e);
1100
- return n && tt(n) && Ot(n) && !$t(n) ? o : n || un(t) || o;
1100
+ return n && et(n) && Ot(n) && !$t(n) ? o : n || fn(t) || o;
1101
1101
  }
1102
- const Rn = async function(t) {
1102
+ const An = async function(t) {
1103
1103
  const e = this.getOffsetParent || be, o = this.getDimensions, n = await o(t.floating);
1104
1104
  return {
1105
- reference: bn(t.reference, await e(t.floating), t.strategy),
1105
+ reference: Rn(t.reference, await e(t.floating), t.strategy),
1106
1106
  floating: {
1107
1107
  x: 0,
1108
1108
  y: 0,
@@ -1111,25 +1111,25 @@ const Rn = async function(t) {
1111
1111
  }
1112
1112
  };
1113
1113
  };
1114
- function An(t) {
1114
+ function On(t) {
1115
1115
  return C(t).direction === "rtl";
1116
1116
  }
1117
- const On = {
1118
- convertOffsetParentRelativeRectToViewportRelativeRect: dn,
1117
+ const En = {
1118
+ convertOffsetParentRelativeRectToViewportRelativeRect: mn,
1119
1119
  getDocumentElement: N,
1120
- getClippingRect: xn,
1120
+ getClippingRect: vn,
1121
1121
  getOffsetParent: be,
1122
- getElementRects: Rn,
1123
- getClientRects: mn,
1124
- getDimensions: vn,
1125
- getScale: Q,
1122
+ getElementRects: An,
1123
+ getClientRects: gn,
1124
+ getDimensions: bn,
1125
+ getScale: Z,
1126
1126
  isElement: k,
1127
- isRTL: An
1127
+ isRTL: On
1128
1128
  };
1129
1129
  function Re(t, e) {
1130
1130
  return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
1131
1131
  }
1132
- function En(t, e) {
1132
+ function Ln(t, e) {
1133
1133
  let o = null, n;
1134
1134
  const r = N(t);
1135
1135
  function s() {
@@ -1148,7 +1148,7 @@ function En(t, e) {
1148
1148
  return;
1149
1149
  const d = dt(f), p = dt(r.clientWidth - (h + m)), w = dt(r.clientHeight - (f + u)), g = dt(h), y = {
1150
1150
  rootMargin: -d + "px " + -p + "px " + -w + "px " + -g + "px",
1151
- threshold: q(0, Z(1, a)) || 1
1151
+ threshold: q(0, tt(1, a)) || 1
1152
1152
  };
1153
1153
  let b = !0;
1154
1154
  function v(L) {
@@ -1175,7 +1175,7 @@ function En(t, e) {
1175
1175
  }
1176
1176
  return i(!0), s;
1177
1177
  }
1178
- function Ln(t, e, o, n) {
1178
+ function Pn(t, e, o, n) {
1179
1179
  n === void 0 && (n = {});
1180
1180
  const {
1181
1181
  ancestorScroll: r = !0,
@@ -1189,7 +1189,7 @@ function Ln(t, e, o, n) {
1189
1189
  passive: !0
1190
1190
  }), s && g.addEventListener("resize", o);
1191
1191
  });
1192
- const f = l && c ? En(l, o) : null;
1192
+ const f = l && c ? Ln(l, o) : null;
1193
1193
  let m = -1, u = null;
1194
1194
  i && (u = new ResizeObserver((g) => {
1195
1195
  let [x] = g;
@@ -1211,15 +1211,15 @@ function Ln(t, e, o, n) {
1211
1211
  }), f == null || f(), (g = u) == null || g.disconnect(), u = null, a && cancelAnimationFrame(d);
1212
1212
  };
1213
1213
  }
1214
- const Pn = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1214
+ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1215
1215
  const n = /* @__PURE__ */ new Map(), r = {
1216
- platform: On,
1216
+ platform: En,
1217
1217
  ...o
1218
1218
  }, s = {
1219
1219
  ...r.platform,
1220
1220
  _c: n
1221
1221
  };
1222
- return nn(t, e, {
1222
+ return on(t, e, {
1223
1223
  ...r,
1224
1224
  platform: s
1225
1225
  });
@@ -1246,105 +1246,112 @@ const Pn = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1246
1246
  function i() {
1247
1247
  r.set(!1), o.forEach((c) => c()), o.length = 0;
1248
1248
  }
1249
- return st(
1249
+ return Q(
1250
1250
  t(s, i),
1251
1251
  se(
1252
1252
  r,
1253
- () => H(
1254
- (c) => re(
1255
- "body",
1256
- Et.div(
1257
- H((a) => {
1258
- a.style.position = "absolute";
1259
- const l = typeof (n == null ? void 0 : n.target) == "string" ? c.querySelector(
1260
- n.target
1261
- ) : (n == null ? void 0 : n.target) ?? c;
1262
- if (l == null)
1263
- throw new Error(`Target not found: ${n == null ? void 0 : n.target}`);
1264
- let h = null;
1265
- const f = E.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), m = E.toSignal((n == null ? void 0 : n.crossAxisOffset) ?? 0), u = E.toSignal(
1266
- /* c8 ignore next 3 */
1267
- (n == null ? void 0 : n.placement) ?? "top"
1268
- ), d = E.toSignal((n == null ? void 0 : n.arrowPadding) ?? 0), p = n == null ? void 0 : n.arrow, w = F({
1269
- centerOffset: 0,
1270
- alignmentOffset: 0,
1271
- containerWidth: 0,
1272
- containerHeight: 0,
1273
- x: void 0,
1274
- y: void 0
1275
- });
1276
- async function g() {
1277
- const y = [
1278
- qt(),
1279
- Pn({
1280
- mainAxis: f.get(),
1281
- crossAxis: m.get()
1282
- }),
1283
- Sn(),
1284
- qt()
1285
- ];
1286
- p != null && h != null && y.push(
1287
- Tn({
1288
- element: h,
1289
- padding: d.get()
1290
- })
1291
- );
1292
- const b = await kn(l, a, {
1293
- placement: u.get(),
1294
- strategy: "absolute",
1295
- middleware: y
1296
- }), { x: v, y: L, middlewareData: R } = b;
1297
- if (a.style.top = `${L}px`, a.style.left = `${v}px`, h != null && R.arrow != null) {
1298
- const {
1299
- x: _,
1300
- y: V,
1301
- centerOffset: P,
1302
- alignmentOffset: j
1303
- } = R.arrow;
1304
- w.set({
1305
- x: _,
1306
- y: V,
1307
- centerOffset: P,
1308
- alignmentOffset: j,
1309
- containerWidth: a.offsetWidth,
1310
- containerHeight: a.offsetHeight
1311
- });
1253
+ () => Q(
1254
+ (n == null ? void 0 : n.onClickOutside) != null ? qe(n.onClickOutside) : null,
1255
+ H(
1256
+ (c) => re(
1257
+ "body",
1258
+ Et.div(
1259
+ H((a) => {
1260
+ a.style.position = "absolute";
1261
+ const l = typeof (n == null ? void 0 : n.target) == "string" ? c.querySelector(
1262
+ n.target
1263
+ ) : (n == null ? void 0 : n.target) ?? c;
1264
+ if (l == null)
1265
+ throw new Error(`Target not found: ${n == null ? void 0 : n.target}`);
1266
+ let h = null;
1267
+ const f = E.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), m = E.toSignal(
1268
+ (n == null ? void 0 : n.crossAxisOffset) ?? 0
1269
+ ), u = E.toSignal(
1270
+ /* c8 ignore next 3 */
1271
+ (n == null ? void 0 : n.placement) ?? "top"
1272
+ ), d = E.toSignal(
1273
+ (n == null ? void 0 : n.arrowPadding) ?? 0
1274
+ ), p = n == null ? void 0 : n.arrow, w = F({
1275
+ centerOffset: 0,
1276
+ alignmentOffset: 0,
1277
+ containerWidth: 0,
1278
+ containerHeight: 0,
1279
+ x: void 0,
1280
+ y: void 0
1281
+ });
1282
+ async function g() {
1283
+ const y = [
1284
+ qt(),
1285
+ Sn({
1286
+ mainAxis: f.get(),
1287
+ crossAxis: m.get()
1288
+ }),
1289
+ Tn(),
1290
+ qt()
1291
+ ];
1292
+ p != null && h != null && y.push(
1293
+ kn({
1294
+ element: h,
1295
+ padding: d.get()
1296
+ })
1297
+ );
1298
+ const b = await Cn(l, a, {
1299
+ placement: u.get(),
1300
+ strategy: "absolute",
1301
+ middleware: y
1302
+ }), { x: v, y: L, middlewareData: R } = b;
1303
+ if (a.style.top = `${L}px`, a.style.left = `${v}px`, h != null && R.arrow != null) {
1304
+ const {
1305
+ x: _,
1306
+ y: V,
1307
+ centerOffset: P,
1308
+ alignmentOffset: j
1309
+ } = R.arrow;
1310
+ w.set({
1311
+ x: _,
1312
+ y: V,
1313
+ centerOffset: P,
1314
+ alignmentOffset: j,
1315
+ containerWidth: a.offsetWidth,
1316
+ containerHeight: a.offsetHeight
1317
+ });
1318
+ }
1312
1319
  }
1313
- }
1314
- const x = Se(
1315
- f,
1316
- m,
1317
- u
1318
- )(g);
1319
- return st(
1320
- n == null ? void 0 : n.content,
1321
- (n == null ? void 0 : n.arrow) != null ? Et.div(
1322
- n == null ? void 0 : n.arrow(
1323
- ie(
1324
- w,
1325
- u
1326
- )((y, b) => ({
1327
- ...y,
1328
- placement: b
1329
- }))
1330
- ),
1331
- H((y) => {
1332
- h = y, g();
1333
- })
1334
- ) : null,
1335
- M(
1336
- w.dispose,
1337
- Ln(l, a, g),
1338
- x
1339
- )
1340
- );
1341
- })
1320
+ const x = Se(
1321
+ f,
1322
+ m,
1323
+ u
1324
+ )(g);
1325
+ return Q(
1326
+ n == null ? void 0 : n.content,
1327
+ (n == null ? void 0 : n.arrow) != null ? Et.div(
1328
+ n == null ? void 0 : n.arrow(
1329
+ ie(
1330
+ w,
1331
+ u
1332
+ )((y, b) => ({
1333
+ ...y,
1334
+ placement: b
1335
+ }))
1336
+ ),
1337
+ H((y) => {
1338
+ h = y, g();
1339
+ })
1340
+ ) : null,
1341
+ M(
1342
+ w.dispose,
1343
+ Pn(l, a, g),
1344
+ x
1345
+ )
1346
+ );
1347
+ })
1348
+ )
1342
1349
  )
1343
1350
  )
1344
1351
  )
1345
1352
  )
1346
1353
  );
1347
- }, Cn = (t, e, o) => {
1354
+ }, Dn = (t, e, o) => {
1348
1355
  const n = F(U.notAsked), r = n.map(
1349
1356
  (f) => U.isSuccess(f) ? f.value : void 0
1350
1357
  ), s = n.map(
@@ -1372,9 +1379,9 @@ const Pn = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1372
1379
  reload: l,
1373
1380
  dispose: h
1374
1381
  };
1375
- }, Dn = (t, e) => {
1382
+ }, Wn = (t, e) => {
1376
1383
  const { status: o, dispose: n, reload: r } = t, { loading: s, failure: i, success: c } = e;
1377
- return st(
1384
+ return Q(
1378
1385
  M(n),
1379
1386
  ue(o, {
1380
1387
  loading: s != null ? (a) => s(a, r) : void 0,
@@ -1387,12 +1394,12 @@ const Pn = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1387
1394
  load: e,
1388
1395
  mapError: o = (n) => n
1389
1396
  }) => {
1390
- const n = Cn(t, e, o);
1391
- return (r) => Dn(n, r);
1392
- }, Wn = (t, e) => {
1397
+ const n = Dn(t, e, o);
1398
+ return (r) => Wn(n, r);
1399
+ }, Fn = (t, e) => {
1393
1400
  if (typeof e == "function")
1394
- return Wn(t, { success: e });
1395
- const o = e.failure ?? ((r) => st(
1401
+ return Fn(t, { success: e });
1402
+ const o = e.failure ?? ((r) => Q(
1396
1403
  M(r.on(console.error)),
1397
1404
  r.map((s) => `Error: ${s}`)
1398
1405
  )), n = e.success;
@@ -1574,7 +1581,7 @@ const io = (t) => (e) => {
1574
1581
  return o == null || o.addEventListener("resize", s), (i) => {
1575
1582
  o == null || o.removeEventListener("resize", s), r(i);
1576
1583
  };
1577
- }, Fn = (t, e) => {
1584
+ }, Mn = (t, e) => {
1578
1585
  const o = e.split("/").filter((r) => r !== ""), n = {};
1579
1586
  for (let r = 0; r < t.length; r++) {
1580
1587
  const s = t[r], i = o[r];
@@ -1596,7 +1603,7 @@ const io = (t) => (e) => {
1596
1603
  });
1597
1604
  return function(n) {
1598
1605
  for (const { segments: r, route: s } of e) {
1599
- const i = Fn(r, n);
1606
+ const i = Mn(r, n);
1600
1607
  if (i)
1601
1608
  return { ...i, route: s };
1602
1609
  }
@@ -1611,7 +1618,7 @@ const io = (t) => (e) => {
1611
1618
  dispose: () => t.dispose()
1612
1619
  };
1613
1620
  }
1614
- }, Mn = (t, e, o) => {
1621
+ }, Nn = (t, e, o) => {
1615
1622
  const n = o.split("/").filter((i) => i !== ""), r = {};
1616
1623
  let s = 0;
1617
1624
  for (let i = 0; i < t.length; i++) {
@@ -1651,7 +1658,7 @@ const io = (t) => (e) => {
1651
1658
  });
1652
1659
  return function(n) {
1653
1660
  for (const { segments: r, route: s } of e) {
1654
- const i = Mn(r, s, n);
1661
+ const i = Nn(r, s, n);
1655
1662
  if (i)
1656
1663
  return i;
1657
1664
  }
@@ -1662,7 +1669,7 @@ const io = (t) => (e) => {
1662
1669
  return ke(
1663
1670
  Ct,
1664
1671
  {},
1665
- () => rt(Mt, (o) => rt(Ct, (n) => {
1672
+ () => st(Mt, (o) => st(Ct, (n) => {
1666
1673
  const r = o.map((s) => {
1667
1674
  const i = e(s.pathname);
1668
1675
  if (i == null)
@@ -1690,7 +1697,7 @@ const io = (t) => (e) => {
1690
1697
  );
1691
1698
  }, lo = (t) => {
1692
1699
  const e = Oe(Object.keys(t));
1693
- return rt(Ct, (o) => rt(Mt, (n) => {
1700
+ return st(Ct, (o) => st(Mt, (n) => {
1694
1701
  const r = o.map((s) => {
1695
1702
  const i = s[s.length - 1], c = (i == null ? void 0 : i.remainingPath) || "";
1696
1703
  if (c === "")
@@ -1713,7 +1720,7 @@ const io = (t) => (e) => {
1713
1720
  t
1714
1721
  );
1715
1722
  }));
1716
- }, yt = 60 * 1e3, Dt = 60 * yt, ct = 24 * Dt, Gt = 7 * ct, Qt = 30 * ct, Nn = 365 * ct, Vn = [
1723
+ }, yt = 60 * 1e3, Dt = 60 * yt, ct = 24 * Dt, Gt = 7 * ct, Qt = 30 * ct, Vn = 365 * ct, $n = [
1717
1724
  {
1718
1725
  max: yt * 90,
1719
1726
  value: yt,
@@ -1751,7 +1758,7 @@ const io = (t) => (e) => {
1751
1758
  },
1752
1759
  {
1753
1760
  max: 1 / 0,
1754
- value: Nn,
1761
+ value: Vn,
1755
1762
  name: "year",
1756
1763
  past: { singular: "last year", plural: "{} years ago" },
1757
1764
  future: { singular: "in a year", plural: "in {} years" }
@@ -1767,28 +1774,28 @@ function Zt(t, e, o, n) {
1767
1774
  })
1768
1775
  );
1769
1776
  }
1770
- const $n = (t = 1e3) => {
1777
+ const Hn = (t = 1e3) => {
1771
1778
  const e = F(/* @__PURE__ */ new Date()), o = De(() => e.set(/* @__PURE__ */ new Date()), t);
1772
1779
  return e.onDispose(o), e;
1773
- }, Hn = (t) => {
1780
+ }, Bn = (t) => {
1774
1781
  const e = Math.abs(t);
1775
1782
  if (e < yt)
1776
1783
  return t < 0 ? "just now" : "in a moment";
1777
- for (const o of Vn)
1784
+ for (const o of $n)
1778
1785
  if (e < o.max)
1779
1786
  return t < 0 ? Zt(e, o.value, o.past.singular, o.past.plural) : Zt(e, o.value, o.future.singular, o.future.plural);
1780
1787
  throw new Error("unreachable");
1781
- }, Bn = (t, { now: e, frequency: o = 1e4 } = {}) => {
1782
- const n = e != null ? te.is(e) ? e.derive() : F(e) : $n(o), r = ie(
1788
+ }, Un = (t, { now: e, frequency: o = 1e4 } = {}) => {
1789
+ const n = e != null ? te.is(e) ? e.derive() : F(e) : Hn(o), r = ie(
1783
1790
  t,
1784
1791
  n
1785
1792
  )((s, i) => s.getTime() - i.getTime());
1786
1793
  return r.onDispose(() => E.dispose(n)), r;
1787
- }, Un = (t, e = {}) => {
1788
- const o = Bn(t, e), n = o.map(Hn);
1794
+ }, zn = (t, e = {}) => {
1795
+ const o = Un(t, e), n = o.map(Bn);
1789
1796
  return n.onDispose(o.dispose), n;
1790
- }, uo = (t, e = {}) => Un(t, e);
1791
- class zn extends Ce {
1797
+ }, uo = (t, e = {}) => zn(t, e);
1798
+ class Kn extends Ce {
1792
1799
  constructor() {
1793
1800
  super(...arguments);
1794
1801
  /**
@@ -1798,33 +1805,33 @@ class zn extends Ce {
1798
1805
  At(this, "tick", () => this.update((o) => o + 1));
1799
1806
  }
1800
1807
  }
1801
- const fo = (t = 0) => new zn(t, (e, o) => e === o);
1808
+ const fo = (t = 0) => new Kn(t, (e, o) => e === o);
1802
1809
  export {
1803
1810
  Ke as Anchor,
1804
- In as Appearance,
1811
+ Yn as Appearance,
1805
1812
  ue as AsyncResultView,
1806
- Yn as AutoFocus,
1807
- qn as AutoSelect,
1813
+ qn as AutoFocus,
1814
+ Xn as AutoSelect,
1808
1815
  lo as ChildRouter,
1809
1816
  so as ElementRect,
1810
- Jn as HTMLTitle,
1811
- Xn as HiddenWhenEmpty,
1817
+ Gn as HTMLTitle,
1818
+ Jn as HiddenWhenEmpty,
1812
1819
  Ye as InViewport,
1813
1820
  Mt as Location,
1814
- Qn as OnClickOutside,
1821
+ qe as OnClickOutside,
1815
1822
  Zn as OnEnterKey,
1816
1823
  to as OnEscapeKey,
1817
1824
  fe as OnKeyPressed,
1818
1825
  no as PopOver,
1819
1826
  Rt as Rect,
1820
1827
  oo as Resource,
1821
- Dn as ResourceDisplay,
1822
- Wn as ResultView,
1828
+ Wn as ResourceDisplay,
1829
+ Fn as ResultView,
1823
1830
  ao as RootRouter,
1824
1831
  Ct as RouterContextProvider,
1825
1832
  ro as SelectOnFocus,
1826
- zn as Ticker,
1827
- Gn as WhenInViewport,
1833
+ Kn as Ticker,
1834
+ Qn as WhenInViewport,
1828
1835
  io as WindowSize,
1829
1836
  Fe as _checkExtensionCondition,
1830
1837
  We as _getExtension,
@@ -1835,16 +1842,16 @@ export {
1835
1842
  Xt as getAbsoluteRect,
1836
1843
  Ne as handleAnchorClick,
1837
1844
  le as locationFromURL,
1838
- Cn as makeResource,
1839
- qe as matchesKeyCombo,
1840
- Fn as matchesRoute,
1841
- $n as nowSignal,
1845
+ Dn as makeResource,
1846
+ Xe as matchesKeyCombo,
1847
+ Mn as matchesRoute,
1848
+ Hn as nowSignal,
1842
1849
  uo as relativeTime,
1843
- Bn as relativeTimeMillisSignal,
1844
- Un as relativeTimeSignal,
1850
+ Un as relativeTimeMillisSignal,
1851
+ zn as relativeTimeSignal,
1845
1852
  zt as setLocationFromUrl,
1846
1853
  fo as ticker,
1847
- Hn as timeDiffToString,
1854
+ Bn as timeDiffToString,
1848
1855
  Pt as urlFromLocation,
1849
1856
  _e as useAppearance
1850
1857
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -62,6 +62,10 @@ export type PopOverOptions = {
62
62
  * positioned relative to the parent element.
63
63
  */
64
64
  target?: string | HTMLElement;
65
+ /**
66
+ * Specifies a function to be called when a click occurs outside of the PopOver.
67
+ */
68
+ onClickOutside?: () => void;
65
69
  };
66
70
  /**
67
71
  * Creates a pop-over component.