@tempots/ui 6.2.0 → 6.4.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 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;
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)});function Ve(t){const e=Object.entries(t);return l.Fragment(...e.map(([o,n])=>l.attr.class(l.Value.map(n,r=>r?o:void 0))))}const Me=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)})}),Ne=t=>l.Portal("head > title",l.attr.innerText(t)),Ue={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 He(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)})},Ue[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"?He(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)))},$e=(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 Ke(t){return Tt({allowedKeys:["Enter"],handler:t})}function Be(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}),ze={left:"right",right:"left",bottom:"top",top:"bottom"},_e={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 je(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 Ie(t){const e=ft(t);return[bt(t),e,bt(e)]}function bt(t){return t.replace(/start|end/g,e=>_e[e])}function qe(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 Ye(t,e,o,n){const r=rt(t);let s=qe(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=>ze[e])}function Xe(t){return{top:0,right:0,bottom:0,left:0,...t}}function oe(t){return typeof t!="number"?Xe(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 Je=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 Ge=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}}}),Qe=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)]:Ie(c)),S=m!=="none";!g&&S&&R.push(...Ye(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=je(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 Ze(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 tn=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 Ze(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}}}}},en=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 nn(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 on(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 rn=W(0);function ae(t){const e=P(t);return!Wt()||!e.visualViewport?rn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sn(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=sn(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 cn(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 an(t){return Array.from(t.getClientRects())}function ln(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 un(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 fn(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=un(t,o);else if(e==="document")n=ln(V(t));else if(D(e))n=fn(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 hn(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 dn(t){let{element:e,boundary:o,rootBoundary:n,strategy:r}=t;const i=[...o==="clippingAncestors"?yt(e)?[]:hn(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 mn(t){const{width:e,height:o}=ce(t);return{width:e,height:o}}function gn(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&&nn(n)&&xt(n);)n=Kt(n,e);return n&&G(n)&&xt(n)&&!Ct(n)?o:n||on(t)||o}const pn=async function(t){const e=this.getOffsetParent||fe,o=this.getDimensions,n=await o(t.floating);return{reference:gn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function yn(t){return C(t).direction==="rtl"}const wn={convertOffsetParentRelativeRectToViewportRelativeRect:cn,getDocumentElement:V,getClippingRect:dn,getOffsetParent:fe,getElementRects:pn,getClientRects:an,getDimensions:mn,getScale:X,isElement:D,isRTL:yn};function he(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function vn(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 xn(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?vn(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 Rn=tn,On=en,Bt=Qe,bn=Ge,An=(t,e,o)=>{const n=new Map,r={platform:wn,...o},s={...r.platform,_c:n};return Je(t,e,{...r,platform:s})},En=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Pn=(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(),Rn({mainAxis:h.get(),crossAxis:g.get()}),On(),Bt()];y!=null&&d!=null&&v.push(bn({element:d,padding:m.get()}));const O=await An(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,xn(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)}))},Sn=({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)})},Ln=()=>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 Tn=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 kn=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!==""),Dn=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()}}},Cn=(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=Cn(r,s,n);if(i)return i}return null}},Wn=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)})))},Fn=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,Vn=365*nt,Mn=[{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:Vn,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 Mn)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},Nn=(t,e={})=>Re(t,e);class Oe extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Un=(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=Fn;exports.ElementRect=Tn;exports.HTMLTitle=Ne;exports.HiddenWhenEmpty=Me;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=te;exports.OnEnterKey=Ke;exports.OnEscapeKey=Be;exports.OnKeyPressed=Tt;exports.PopOver=Pn;exports.Rect=it;exports.Resource=Sn;exports.ResourceDisplay=me;exports.ResultView=ge;exports.RootRouter=Wn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Ln;exports.Ticker=Oe;exports.WhenInViewport=$e;exports.WindowSize=kn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=Dn;exports._parseRouteSegments=Mt;exports.allPlacements=En;exports.areLocationsEqual=Jt;exports.classes=Ve;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Xt;exports.locationFromURL=St;exports.makeResource=de;exports.matchesKeyCombo=ee;exports.matchesRoute=pe;exports.nowSignal=we;exports.relativeTime=Nn;exports.relativeTimeMillisSignal=xe;exports.relativeTimeSignal=Re;exports.setLocationFromUrl=Rt;exports.ticker=Un;exports.timeDiffToString=ve;exports.urlFromLocation=lt;exports.useAppearance=Qt;
package/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './renderables/appearance';
4
4
  export * from './renderables/async-result-view';
5
5
  export * from './renderables/autofocus';
6
6
  export * from './renderables/autoselect';
7
+ export * from './renderables/classes';
7
8
  export * from './renderables/hidden-when-empty';
8
9
  export * from './renderables/html-title';
9
10
  export * from './renderables/inviewport';
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
- 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 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";
3
+ var Ot = (t, e, o) => Pe(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { getWindow as at, prop as F, makeProviderMark as Wt, Signal as ee, Use as st, html as Et, on as ne, Value as A, attr as Ft, Empty as Lt, OneOfType as oe, WithElement as H, OnDispose as M, Fragment as q, Portal as re, renderableOfTNode as Mt, 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();
@@ -52,7 +52,7 @@ const We = (t) => {
52
52
  search: n,
53
53
  hash: r === "" ? void 0 : r
54
54
  };
55
- }, zt = (t, e) => {
55
+ }, Kt = (t, e) => {
56
56
  const o = le(e);
57
57
  return t.set(o), t;
58
58
  }, Pt = (t) => {
@@ -99,7 +99,7 @@ const We = (t) => {
99
99
  value: t,
100
100
  dispose: t.dispose
101
101
  };
102
- }, Mt = {
102
+ }, Nt = {
103
103
  mark: Wt("Location"),
104
104
  create: (t, e) => {
105
105
  if (e.isBrowser())
@@ -111,34 +111,34 @@ const We = (t) => {
111
111
  }, ze = (t) => {
112
112
  document.startViewTransition ? document.startViewTransition(t) : t();
113
113
  }, Ke = (t, ...e) => {
114
- if (typeof t == "string" || te.is(t))
114
+ if (typeof t == "string" || ee.is(t))
115
115
  return Ke({ href: t }, ...e);
116
116
  const {
117
117
  href: o,
118
118
  withViewTransition: n,
119
119
  ...r
120
120
  } = t;
121
- return st(Mt, (s) => Et.a(
122
- ee.click(
121
+ return st(Nt, (s) => Et.a(
122
+ ne.click(
123
123
  Ne(() => (n === !0 ? ze(() => {
124
- zt(s, E.get(o));
125
- }) : zt(s, E.get(o)), !0), r)
124
+ Kt(s, A.get(o));
125
+ }) : Kt(s, A.get(o)), !0), r)
126
126
  ),
127
- ne.href(o),
127
+ Ft.href(o),
128
128
  ...e
129
129
  /* c8 ignore next 2 */
130
130
  ));
131
131
  }, Yn = {
132
132
  mark: Wt("Appearance"),
133
133
  create: () => {
134
- const t = _e();
134
+ const t = je();
135
135
  return {
136
136
  value: t,
137
137
  dispose: t.dispose
138
138
  };
139
139
  }
140
140
  };
141
- function _e() {
141
+ function je() {
142
142
  const t = at(), e = t != null && t.matchMedia != null ? t.matchMedia("(prefers-color-scheme: dark)") : void 0, o = (e == null ? void 0 : e.matches) ?? !1, n = F(o ? "dark" : "light"), r = (s) => n.set(s.matches ? "dark" : "light");
143
143
  return e == null || e.addEventListener("change", r), n.onDispose(() => e == null ? void 0 : e.removeEventListener("change", r)), n;
144
144
  }
@@ -146,7 +146,7 @@ const ue = (t, e) => {
146
146
  if (typeof e == "function")
147
147
  return ue(t, { success: e });
148
148
  const o = e.failure ?? ((i) => i.map((c) => `Error: ${c}`)), n = e.success, r = e.loading ?? (() => Lt), s = e.notAsked ?? (() => Lt);
149
- return oe(E.toSignal(t), {
149
+ return oe(A.toSignal(t), {
150
150
  AsyncSuccess: (i) => n(i.$.value),
151
151
  AsyncFailure: (i) => o(i.$.error),
152
152
  Loading: (i) => r(i.map((c) => c.previousValue)),
@@ -155,12 +155,21 @@ const ue = (t, e) => {
155
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
- }), Jn = H((t) => {
158
+ });
159
+ function Jn(t) {
160
+ const e = Object.entries(t);
161
+ return q(
162
+ ...e.map(
163
+ ([o, n]) => Ft.class(A.map(n, (r) => r ? o : void 0))
164
+ )
165
+ );
166
+ }
167
+ const Gn = H((t) => {
159
168
  const e = t.style.getPropertyValue(":empty");
160
169
  return t.style.setProperty(":empty", "display:none"), M((o) => {
161
170
  o && t.style.setProperty(":empty", e);
162
171
  });
163
- }), Gn = (t) => re("head > title", ne.innerText(t)), je = {
172
+ }), Qn = (t) => re("head > title", Ft.innerText(t)), _e = {
164
173
  partial: {
165
174
  root: null,
166
175
  rootMargin: "0px",
@@ -184,11 +193,11 @@ function Ie(t) {
184
193
  const n = mt[t].get(o.target);
185
194
  n == null || n.set(o.isIntersecting);
186
195
  });
187
- }, je[t])), rt[t];
196
+ }, _e[t])), rt[t];
188
197
  }
189
198
  const Ye = ({ mode: t = "partial", once: e = !1 }, o) => {
190
199
  const n = F(!1);
191
- return Q(
200
+ return q(
192
201
  H((r) => {
193
202
  const s = typeof IntersectionObserver < "u" ? Ie(t) : null;
194
203
  mt[t].set(r, n), s == null || s.observe(r);
@@ -203,9 +212,9 @@ const Ye = ({ mode: t = "partial", once: e = !1 }, o) => {
203
212
  n.dispose(), i(), c == null || c();
204
213
  });
205
214
  }),
206
- Ft(o(n))
215
+ Mt(o(n))
207
216
  );
208
- }, Qn = (t, e, o) => Ye(t, (n) => se(n, e, o ?? (() => Lt)));
217
+ }, Zn = (t, e, o) => Ye(t, (n) => se(n, e, o ?? (() => Lt)));
209
218
  function qe(t) {
210
219
  return H((e) => {
211
220
  const o = (n) => {
@@ -216,9 +225,9 @@ function qe(t) {
216
225
  });
217
226
  });
218
227
  }
219
- const G = (t, e) => t === void 0 || t === e, Kt = (t, e) => t === void 0 || t === e;
228
+ const Q = (t, e) => t === void 0 || t === e, jt = (t, e) => t === void 0 || t === e;
220
229
  function Xe(t, e) {
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(
230
+ return typeof t == "string" ? e.key === t : jt(t.key, e.key) && jt(t.code, e.code) && Q(t.ctrlKey, e.ctrlKey) && Q(t.altKey, e.altKey) && Q(t.shiftKey, e.shiftKey) && Q(t.metaKey, e.metaKey) && Q(t.repeat, e.repeat) && Q(
222
231
  t.commandOrControlKey,
223
232
  e.metaKey || e.ctrlKey
224
233
  );
@@ -242,13 +251,13 @@ function fe({
242
251
  });
243
252
  });
244
253
  }
245
- function Zn(t) {
254
+ function to(t) {
246
255
  return fe({ allowedKeys: ["Enter"], handler: t });
247
256
  }
248
- function to(t) {
257
+ function eo(t) {
249
258
  return fe({ allowedKeys: ["Escape"], handler: t });
250
259
  }
251
- const tt = Math.min, q = Math.max, gt = Math.round, dt = Math.floor, D = (t) => ({
260
+ const tt = Math.min, X = Math.max, gt = Math.round, dt = Math.floor, D = (t) => ({
252
261
  x: t,
253
262
  y: t
254
263
  }), Je = {
@@ -261,12 +270,12 @@ const tt = Math.min, q = Math.max, gt = Math.round, dt = Math.floor, D = (t) =>
261
270
  end: "start"
262
271
  };
263
272
  function St(t, e, o) {
264
- return q(t, tt(e, o));
273
+ return X(t, tt(e, o));
265
274
  }
266
275
  function lt(t, e) {
267
276
  return typeof t == "function" ? t(e) : t;
268
277
  }
269
- function X(t) {
278
+ function J(t) {
270
279
  return t.split("-")[0];
271
280
  }
272
281
  function ut(t) {
@@ -275,18 +284,18 @@ function ut(t) {
275
284
  function he(t) {
276
285
  return t === "x" ? "y" : "x";
277
286
  }
278
- function Nt(t) {
287
+ function Vt(t) {
279
288
  return t === "y" ? "height" : "width";
280
289
  }
281
290
  function z(t) {
282
- return ["top", "bottom"].includes(X(t)) ? "y" : "x";
291
+ return ["top", "bottom"].includes(J(t)) ? "y" : "x";
283
292
  }
284
- function Vt(t) {
293
+ function $t(t) {
285
294
  return he(z(t));
286
295
  }
287
296
  function Qe(t, e, o) {
288
297
  o === void 0 && (o = !1);
289
- const n = ut(t), r = Vt(t), s = Nt(r);
298
+ const n = ut(t), r = $t(t), s = Vt(r);
290
299
  let i = r === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
291
300
  return e.reference[s] > e.floating[s] && (i = pt(i)), [i, pt(i)];
292
301
  }
@@ -312,7 +321,7 @@ function tn(t, e, o) {
312
321
  }
313
322
  function en(t, e, o, n) {
314
323
  const r = ut(t);
315
- let s = tn(X(t), o === "start", n);
324
+ let s = tn(J(t), o === "start", n);
316
325
  return r && (s = s.map((i) => i + "-" + r), e && (s = s.concat(s.map(Tt)))), s;
317
326
  }
318
327
  function pt(t) {
@@ -358,7 +367,7 @@ function _t(t, e, o) {
358
367
  reference: n,
359
368
  floating: r
360
369
  } = t;
361
- const s = z(e), i = Vt(e), c = Nt(i), a = X(e), l = s === "y", h = n.x + n.width / 2 - r.width / 2, f = n.y + n.height / 2 - r.height / 2, m = n[c] / 2 - r[c] / 2;
370
+ const s = z(e), i = $t(e), c = Vt(i), a = J(e), l = s === "y", h = n.x + n.width / 2 - r.width / 2, f = n.y + n.height / 2 - r.height / 2, m = n[c] / 2 - r[c] / 2;
362
371
  let u;
363
372
  switch (a) {
364
373
  case "top":
@@ -528,15 +537,15 @@ const rn = (t) => ({
528
537
  const f = de(h), m = {
529
538
  x: o,
530
539
  y: n
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));
540
+ }, u = $t(r), d = Vt(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
541
  let R = L ? L[y] : 0;
533
542
  (!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 = 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;
543
+ const j = b / 2 - v / 2, V = R / 2 - p[d] / 2 - 1, P = tt(f[g], V), _ = tt(f[x], V), I = P, ot = R - p[d] - _, O = R / 2 - p[d] / 2 + j, Y = St(I, O, ot), $ = !a.arrow && ut(r) != null && O !== Y && s.reference[d] / 2 - (O < I ? P : _) - p[d] / 2 < 0, S = $ ? O < I ? O - I : O - ot : 0;
535
544
  return {
536
545
  [u]: m[u] + S,
537
546
  data: {
538
547
  [u]: Y,
539
- centerOffset: A - Y - S,
548
+ centerOffset: O - Y - S,
540
549
  ...$ && {
541
550
  alignmentOffset: S
542
551
  }
@@ -568,26 +577,26 @@ const rn = (t) => ({
568
577
  } = lt(t, e);
569
578
  if ((o = s.arrow) != null && o.alignmentOffset)
570
579
  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)] : Ze(c)), L = d !== "none";
580
+ const g = J(r), x = z(c), y = J(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
581
  !m && L && v.push(...en(c, p, d, b));
573
- const R = [c, ...v], _ = await me(e, w), V = [];
582
+ const R = [c, ...v], j = await me(e, w), V = [];
574
583
  let P = ((n = s.flip) == null ? void 0 : n.overflows) || [];
575
- if (h && V.push(_[g]), f) {
576
- const A = Qe(r, i, b);
577
- V.push(_[A[0]], _[A[1]]);
584
+ if (h && V.push(j[g]), f) {
585
+ const O = Qe(r, i, b);
586
+ V.push(j[O[0]], j[O[1]]);
578
587
  }
579
588
  if (P = [...P, {
580
589
  placement: r,
581
590
  overflows: V
582
- }], !V.every((A) => A <= 0)) {
583
- var j, I;
584
- const A = (((j = s.flip) == null ? void 0 : j.index) || 0) + 1, Y = R[A];
591
+ }], !V.every((O) => O <= 0)) {
592
+ var _, I;
593
+ const O = (((_ = s.flip) == null ? void 0 : _.index) || 0) + 1, Y = R[O];
585
594
  if (Y && (!(f === "alignment" ? x !== z(Y) : !1) || // We leave the current main axis only if every placement on that axis
586
595
  // overflows the main axis.
587
596
  P.every((T) => T.overflows[0] > 0 && z(T.placement) === x)))
588
597
  return {
589
598
  data: {
590
- index: A,
599
+ index: O,
591
600
  overflows: P
592
601
  },
593
602
  reset: {
@@ -631,7 +640,7 @@ async function cn(t, e) {
631
640
  placement: o,
632
641
  platform: n,
633
642
  elements: r
634
- } = t, s = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), i = X(o), c = ut(o), a = z(o) === "y", l = ["left", "top"].includes(i) ? -1 : 1, h = s && a ? -1 : 1, f = lt(e, t);
643
+ } = t, s = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), i = J(o), c = ut(o), a = z(o) === "y", l = ["left", "top"].includes(i) ? -1 : 1, h = s && a ? -1 : 1, f = lt(e, t);
635
644
  let {
636
645
  mainAxis: m,
637
646
  crossAxis: u,
@@ -703,7 +712,7 @@ const an = function(t) {
703
712
  } = lt(t, e), l = {
704
713
  x: o,
705
714
  y: n
706
- }, h = await me(e, a), f = z(X(r)), m = he(f);
715
+ }, h = await me(e, a), f = z(J(r)), m = he(f);
707
716
  let u = l[m], d = l[f];
708
717
  if (s) {
709
718
  const w = m === "y" ? "top" : "left", g = m === "y" ? "bottom" : "right", x = u + h[w], y = u - h[g];
@@ -738,7 +747,7 @@ function xt() {
738
747
  function nt(t) {
739
748
  return ge(t) ? (t.nodeName || "").toLowerCase() : "#document";
740
749
  }
741
- function O(t) {
750
+ function E(t) {
742
751
  var e;
743
752
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
744
753
  }
@@ -747,16 +756,16 @@ function N(t) {
747
756
  return (e = (ge(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
748
757
  }
749
758
  function ge(t) {
750
- return xt() ? t instanceof Node || t instanceof O(t).Node : !1;
759
+ return xt() ? t instanceof Node || t instanceof E(t).Node : !1;
751
760
  }
752
761
  function k(t) {
753
- return xt() ? t instanceof Element || t instanceof O(t).Element : !1;
762
+ return xt() ? t instanceof Element || t instanceof E(t).Element : !1;
754
763
  }
755
764
  function W(t) {
756
- return xt() ? t instanceof HTMLElement || t instanceof O(t).HTMLElement : !1;
765
+ return xt() ? t instanceof HTMLElement || t instanceof E(t).HTMLElement : !1;
757
766
  }
758
- function jt(t) {
759
- return !xt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof O(t).ShadowRoot;
767
+ function It(t) {
768
+ return !xt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof E(t).ShadowRoot;
760
769
  }
761
770
  function ft(t) {
762
771
  const {
@@ -779,14 +788,14 @@ function vt(t) {
779
788
  }
780
789
  });
781
790
  }
782
- function $t(t) {
783
- const e = Ht(), o = k(t) ? C(t) : t;
791
+ function Ht(t) {
792
+ const e = Bt(), o = k(t) ? C(t) : t;
784
793
  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
794
  }
786
795
  function fn(t) {
787
796
  let e = K(t);
788
797
  for (; W(e) && !et(e); ) {
789
- if ($t(e))
798
+ if (Ht(e))
790
799
  return e;
791
800
  if (vt(e))
792
801
  return null;
@@ -794,14 +803,14 @@ function fn(t) {
794
803
  }
795
804
  return null;
796
805
  }
797
- function Ht() {
806
+ function Bt() {
798
807
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
799
808
  }
800
809
  function et(t) {
801
810
  return ["html", "body", "#document"].includes(nt(t));
802
811
  }
803
812
  function C(t) {
804
- return O(t).getComputedStyle(t);
813
+ return E(t).getComputedStyle(t);
805
814
  }
806
815
  function bt(t) {
807
816
  return k(t) ? {
@@ -819,10 +828,10 @@ function K(t) {
819
828
  // Step into the shadow DOM of the parent of a slotted node.
820
829
  t.assignedSlot || // DOM Element detected.
821
830
  t.parentNode || // ShadowRoot detected.
822
- jt(t) && t.host || // Fallback.
831
+ It(t) && t.host || // Fallback.
823
832
  N(t)
824
833
  );
825
- return jt(e) ? e.host : e;
834
+ return It(e) ? e.host : e;
826
835
  }
827
836
  function pe(t) {
828
837
  const e = K(t);
@@ -831,7 +840,7 @@ function pe(t) {
831
840
  function it(t, e, o) {
832
841
  var n;
833
842
  e === void 0 && (e = []), o === void 0 && (o = !0);
834
- const r = pe(t), s = r === ((n = t.ownerDocument) == null ? void 0 : n.body), i = O(r);
843
+ const r = pe(t), s = r === ((n = t.ownerDocument) == null ? void 0 : n.body), i = E(r);
835
844
  if (s) {
836
845
  const c = kt(i);
837
846
  return e.concat(i, i.visualViewport || [], ft(r) ? r : [], c && o ? it(c) : []);
@@ -851,11 +860,11 @@ function we(t) {
851
860
  $: c
852
861
  };
853
862
  }
854
- function Bt(t) {
863
+ function Ut(t) {
855
864
  return k(t) ? t : t.contextElement;
856
865
  }
857
866
  function Z(t) {
858
- const e = Bt(t);
867
+ const e = Ut(t);
859
868
  if (!W(e))
860
869
  return D(1);
861
870
  const o = e.getBoundingClientRect(), {
@@ -871,28 +880,28 @@ function Z(t) {
871
880
  }
872
881
  const hn = /* @__PURE__ */ D(0);
873
882
  function ye(t) {
874
- const e = O(t);
875
- return !Ht() || !e.visualViewport ? hn : {
883
+ const e = E(t);
884
+ return !Bt() || !e.visualViewport ? hn : {
876
885
  x: e.visualViewport.offsetLeft,
877
886
  y: e.visualViewport.offsetTop
878
887
  };
879
888
  }
880
889
  function dn(t, e, o) {
881
- return e === void 0 && (e = !1), !o || e && o !== O(t) ? !1 : e;
890
+ return e === void 0 && (e = !1), !o || e && o !== E(t) ? !1 : e;
882
891
  }
883
- function J(t, e, o, n) {
892
+ function G(t, e, o, n) {
884
893
  e === void 0 && (e = !1), o === void 0 && (o = !1);
885
- const r = t.getBoundingClientRect(), s = Bt(t);
894
+ const r = t.getBoundingClientRect(), s = Ut(t);
886
895
  let i = D(1);
887
896
  e && (n ? k(n) && (i = Z(n)) : i = Z(t));
888
897
  const c = dn(s, o, n) ? ye(s) : D(0);
889
898
  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
899
  if (s) {
891
- const m = O(s), u = n && k(n) ? O(n) : n;
900
+ const m = E(s), u = n && k(n) ? E(n) : n;
892
901
  let d = m, p = kt(d);
893
902
  for (; p && n && u !== d; ) {
894
903
  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
- a *= w.x, l *= w.y, h *= w.x, f *= w.y, a += y, l += b, d = O(p), p = kt(d);
904
+ a *= w.x, l *= w.y, h *= w.x, f *= w.y, a += y, l += b, d = E(p), p = kt(d);
896
905
  }
897
906
  }
898
907
  return wt({
@@ -902,15 +911,15 @@ function J(t, e, o, n) {
902
911
  y: l
903
912
  });
904
913
  }
905
- function Ut(t, e) {
914
+ function zt(t, e) {
906
915
  const o = bt(t).scrollLeft;
907
- return e ? e.left + o : J(N(t)).left + o;
916
+ return e ? e.left + o : G(N(t)).left + o;
908
917
  }
909
918
  function xe(t, e, o) {
910
919
  o === void 0 && (o = !1);
911
920
  const n = t.getBoundingClientRect(), r = n.left + e.scrollLeft - (o ? 0 : (
912
921
  // RTL <body> scrollbar.
913
- Ut(t, n)
922
+ zt(t, n)
914
923
  )), s = n.top + e.scrollTop;
915
924
  return {
916
925
  x: r,
@@ -933,7 +942,7 @@ function mn(t) {
933
942
  }, l = D(1);
934
943
  const h = D(0), f = W(n);
935
944
  if ((f || !f && !s) && ((nt(n) !== "body" || ft(i)) && (a = bt(n)), W(n))) {
936
- const u = J(n);
945
+ const u = G(n);
937
946
  l = Z(n), h.x = u.x + n.clientLeft, h.y = u.y + n.clientTop;
938
947
  }
939
948
  const m = i && !f && !s ? xe(i, a, !0) : D(0);
@@ -948,10 +957,10 @@ function gn(t) {
948
957
  return Array.from(t.getClientRects());
949
958
  }
950
959
  function pn(t) {
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
- let i = -o.scrollLeft + Ut(t);
960
+ const e = N(t), o = bt(t), n = t.ownerDocument.body, r = X(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = X(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
961
+ let i = -o.scrollLeft + zt(t);
953
962
  const c = -o.scrollTop;
954
- return C(n).direction === "rtl" && (i += q(e.clientWidth, n.clientWidth) - r), {
963
+ return C(n).direction === "rtl" && (i += X(e.clientWidth, n.clientWidth) - r), {
955
964
  width: r,
956
965
  height: s,
957
966
  x: i,
@@ -959,11 +968,11 @@ function pn(t) {
959
968
  };
960
969
  }
961
970
  function wn(t, e) {
962
- const o = O(t), n = N(t), r = o.visualViewport;
971
+ const o = E(t), n = N(t), r = o.visualViewport;
963
972
  let s = n.clientWidth, i = n.clientHeight, c = 0, a = 0;
964
973
  if (r) {
965
974
  s = r.width, i = r.height;
966
- const l = Ht();
975
+ const l = Bt();
967
976
  (!l || l && e === "fixed") && (c = r.offsetLeft, a = r.offsetTop);
968
977
  }
969
978
  return {
@@ -974,7 +983,7 @@ function wn(t, e) {
974
983
  };
975
984
  }
976
985
  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;
986
+ const o = G(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
987
  return {
979
988
  width: i,
980
989
  height: c,
@@ -982,7 +991,7 @@ function yn(t, e) {
982
991
  y: l
983
992
  };
984
993
  }
985
- function It(t, e, o) {
994
+ function Yt(t, e, o) {
986
995
  let n;
987
996
  if (e === "viewport")
988
997
  n = wn(t, o);
@@ -1013,7 +1022,7 @@ function xn(t, e) {
1013
1022
  const s = C(t).position === "fixed";
1014
1023
  let i = s ? K(t) : t;
1015
1024
  for (; k(i) && !et(i); ) {
1016
- const c = C(i), a = $t(i);
1025
+ const c = C(i), a = Ht(i);
1017
1026
  !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
1027
  }
1019
1028
  return e.set(t, n), n;
@@ -1026,9 +1035,9 @@ function vn(t) {
1026
1035
  strategy: r
1027
1036
  } = t;
1028
1037
  const i = [...o === "clippingAncestors" ? vt(e) ? [] : xn(e, this._c) : [].concat(o), n], c = i[0], a = i.reduce((l, h) => {
1029
- const f = It(e, h, r);
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
- }, It(e, c, r));
1038
+ const f = Yt(e, h, r);
1039
+ return l.top = X(f.top, l.top), l.right = tt(f.right, l.right), l.bottom = tt(f.bottom, l.bottom), l.left = X(f.left, l.left), l;
1040
+ }, Yt(e, c, r));
1032
1041
  return {
1033
1042
  width: a.right - a.left,
1034
1043
  height: a.bottom - a.top,
@@ -1047,18 +1056,18 @@ function bn(t) {
1047
1056
  };
1048
1057
  }
1049
1058
  function Rn(t, e, o) {
1050
- const n = W(e), r = N(e), s = o === "fixed", i = J(t, !0, s, e);
1059
+ const n = W(e), r = N(e), s = o === "fixed", i = G(t, !0, s, e);
1051
1060
  let c = {
1052
1061
  scrollLeft: 0,
1053
1062
  scrollTop: 0
1054
1063
  };
1055
1064
  const a = D(0);
1056
1065
  function l() {
1057
- a.x = Ut(r);
1066
+ a.x = zt(r);
1058
1067
  }
1059
1068
  if (n || !n && !s)
1060
1069
  if ((nt(e) !== "body" || ft(r)) && (c = bt(e)), n) {
1061
- const u = J(e, !0, s, e);
1070
+ const u = G(e, !0, s, e);
1062
1071
  a.x = u.x + e.clientLeft, a.y = u.y + e.clientTop;
1063
1072
  } else r && l();
1064
1073
  s && !n && r && l();
@@ -1070,10 +1079,10 @@ function Rn(t, e, o) {
1070
1079
  height: i.height
1071
1080
  };
1072
1081
  }
1073
- function Ot(t) {
1082
+ function At(t) {
1074
1083
  return C(t).position === "static";
1075
1084
  }
1076
- function Yt(t, e) {
1085
+ function qt(t, e) {
1077
1086
  if (!W(t) || C(t).position === "fixed")
1078
1087
  return null;
1079
1088
  if (e)
@@ -1082,24 +1091,24 @@ function Yt(t, e) {
1082
1091
  return N(t) === o && (o = o.ownerDocument.body), o;
1083
1092
  }
1084
1093
  function be(t, e) {
1085
- const o = O(t);
1094
+ const o = E(t);
1086
1095
  if (vt(t))
1087
1096
  return o;
1088
1097
  if (!W(t)) {
1089
1098
  let r = K(t);
1090
1099
  for (; r && !et(r); ) {
1091
- if (k(r) && !Ot(r))
1100
+ if (k(r) && !At(r))
1092
1101
  return r;
1093
1102
  r = K(r);
1094
1103
  }
1095
1104
  return o;
1096
1105
  }
1097
- let n = Yt(t, e);
1098
- for (; n && un(n) && Ot(n); )
1099
- n = Yt(n, e);
1100
- return n && et(n) && Ot(n) && !$t(n) ? o : n || fn(t) || o;
1106
+ let n = qt(t, e);
1107
+ for (; n && un(n) && At(n); )
1108
+ n = qt(n, e);
1109
+ return n && et(n) && At(n) && !Ht(n) ? o : n || fn(t) || o;
1101
1110
  }
1102
- const An = async function(t) {
1111
+ const On = async function(t) {
1103
1112
  const e = this.getOffsetParent || be, o = this.getDimensions, n = await o(t.floating);
1104
1113
  return {
1105
1114
  reference: Rn(t.reference, await e(t.floating), t.strategy),
@@ -1111,7 +1120,7 @@ const An = async function(t) {
1111
1120
  }
1112
1121
  };
1113
1122
  };
1114
- function On(t) {
1123
+ function An(t) {
1115
1124
  return C(t).direction === "rtl";
1116
1125
  }
1117
1126
  const En = {
@@ -1119,12 +1128,12 @@ const En = {
1119
1128
  getDocumentElement: N,
1120
1129
  getClippingRect: vn,
1121
1130
  getOffsetParent: be,
1122
- getElementRects: An,
1131
+ getElementRects: On,
1123
1132
  getClientRects: gn,
1124
1133
  getDimensions: bn,
1125
1134
  getScale: Z,
1126
1135
  isElement: k,
1127
- isRTL: On
1136
+ isRTL: An
1128
1137
  };
1129
1138
  function Re(t, e) {
1130
1139
  return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
@@ -1148,7 +1157,7 @@ function Ln(t, e) {
1148
1157
  return;
1149
1158
  const d = dt(f), p = dt(r.clientWidth - (h + m)), w = dt(r.clientHeight - (f + u)), g = dt(h), y = {
1150
1159
  rootMargin: -d + "px " + -p + "px " + -w + "px " + -g + "px",
1151
- threshold: q(0, tt(1, a)) || 1
1160
+ threshold: X(0, tt(1, a)) || 1
1152
1161
  };
1153
1162
  let b = !0;
1154
1163
  function v(L) {
@@ -1183,7 +1192,7 @@ function Pn(t, e, o, n) {
1183
1192
  elementResize: i = typeof ResizeObserver == "function",
1184
1193
  layoutShift: c = typeof IntersectionObserver == "function",
1185
1194
  animationFrame: a = !1
1186
- } = n, l = Bt(t), h = r || s ? [...l ? it(l) : [], ...it(e)] : [];
1195
+ } = n, l = Ut(t), h = r || s ? [...l ? it(l) : [], ...it(e)] : [];
1187
1196
  h.forEach((g) => {
1188
1197
  r && g.addEventListener("scroll", o, {
1189
1198
  passive: !0
@@ -1198,10 +1207,10 @@ function Pn(t, e, o, n) {
1198
1207
  (y = u) == null || y.observe(e);
1199
1208
  })), o();
1200
1209
  }), l && !a && u.observe(l), u.observe(e));
1201
- let d, p = a ? J(t) : null;
1210
+ let d, p = a ? G(t) : null;
1202
1211
  a && w();
1203
1212
  function w() {
1204
- const g = J(t);
1213
+ const g = G(t);
1205
1214
  p && !Re(p, g) && o(), p = g, d = requestAnimationFrame(w);
1206
1215
  }
1207
1216
  return o(), () => {
@@ -1211,7 +1220,7 @@ function Pn(t, e, o, n) {
1211
1220
  }), f == null || f(), (g = u) == null || g.disconnect(), u = null, a && cancelAnimationFrame(d);
1212
1221
  };
1213
1222
  }
1214
- const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1223
+ const Sn = an, Tn = ln, Xt = sn, kn = rn, Cn = (t, e, o) => {
1215
1224
  const n = /* @__PURE__ */ new Map(), r = {
1216
1225
  platform: En,
1217
1226
  ...o
@@ -1223,7 +1232,7 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1223
1232
  ...r,
1224
1233
  platform: s
1225
1234
  });
1226
- }, eo = [
1235
+ }, no = [
1227
1236
  "top",
1228
1237
  "top-start",
1229
1238
  "top-end",
@@ -1236,21 +1245,21 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1236
1245
  "left",
1237
1246
  "left-start",
1238
1247
  "left-end"
1239
- ], no = (t, e = { isOpen: !1 }) => {
1248
+ ], oo = (t, e = { isOpen: !1 }) => {
1240
1249
  const o = [];
1241
1250
  let n = null;
1242
- const r = E.deriveProp(e.isOpen);
1251
+ const r = A.deriveProp(e.isOpen);
1243
1252
  function s(c) {
1244
1253
  n = c, r.set(!0);
1245
1254
  }
1246
1255
  function i() {
1247
1256
  r.set(!1), o.forEach((c) => c()), o.length = 0;
1248
1257
  }
1249
- return Q(
1258
+ return q(
1250
1259
  t(s, i),
1251
1260
  se(
1252
1261
  r,
1253
- () => Q(
1262
+ () => q(
1254
1263
  (n == null ? void 0 : n.onClickOutside) != null ? qe(n.onClickOutside) : null,
1255
1264
  H(
1256
1265
  (c) => re(
@@ -1264,12 +1273,12 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1264
1273
  if (l == null)
1265
1274
  throw new Error(`Target not found: ${n == null ? void 0 : n.target}`);
1266
1275
  let h = null;
1267
- const f = E.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), m = E.toSignal(
1276
+ const f = A.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), m = A.toSignal(
1268
1277
  (n == null ? void 0 : n.crossAxisOffset) ?? 0
1269
- ), u = E.toSignal(
1278
+ ), u = A.toSignal(
1270
1279
  /* c8 ignore next 3 */
1271
1280
  (n == null ? void 0 : n.placement) ?? "top"
1272
- ), d = E.toSignal(
1281
+ ), d = A.toSignal(
1273
1282
  (n == null ? void 0 : n.arrowPadding) ?? 0
1274
1283
  ), p = n == null ? void 0 : n.arrow, w = F({
1275
1284
  centerOffset: 0,
@@ -1281,13 +1290,13 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1281
1290
  });
1282
1291
  async function g() {
1283
1292
  const y = [
1284
- qt(),
1293
+ Xt(),
1285
1294
  Sn({
1286
1295
  mainAxis: f.get(),
1287
1296
  crossAxis: m.get()
1288
1297
  }),
1289
1298
  Tn(),
1290
- qt()
1299
+ Xt()
1291
1300
  ];
1292
1301
  p != null && h != null && y.push(
1293
1302
  kn({
@@ -1302,16 +1311,16 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1302
1311
  }), { x: v, y: L, middlewareData: R } = b;
1303
1312
  if (a.style.top = `${L}px`, a.style.left = `${v}px`, h != null && R.arrow != null) {
1304
1313
  const {
1305
- x: _,
1314
+ x: j,
1306
1315
  y: V,
1307
1316
  centerOffset: P,
1308
- alignmentOffset: j
1317
+ alignmentOffset: _
1309
1318
  } = R.arrow;
1310
1319
  w.set({
1311
- x: _,
1320
+ x: j,
1312
1321
  y: V,
1313
1322
  centerOffset: P,
1314
- alignmentOffset: j,
1323
+ alignmentOffset: _,
1315
1324
  containerWidth: a.offsetWidth,
1316
1325
  containerHeight: a.offsetHeight
1317
1326
  });
@@ -1322,7 +1331,7 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1322
1331
  m,
1323
1332
  u
1324
1333
  )(g);
1325
- return Q(
1334
+ return q(
1326
1335
  n == null ? void 0 : n.content,
1327
1336
  (n == null ? void 0 : n.arrow) != null ? Et.div(
1328
1337
  n == null ? void 0 : n.arrow(
@@ -1368,10 +1377,10 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1368
1377
  } catch (d) {
1369
1378
  c = void 0, n.set(U.failure(o(d)));
1370
1379
  }
1371
- }, l = () => a(E.get(t)), h = () => {
1380
+ }, l = () => a(A.get(t)), h = () => {
1372
1381
  c == null || c.abort(), c = void 0, n.dispose();
1373
1382
  };
1374
- return n.onDispose(E.on(t, a)), {
1383
+ return n.onDispose(A.on(t, a)), {
1375
1384
  status: n,
1376
1385
  value: r,
1377
1386
  error: s,
@@ -1381,7 +1390,7 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1381
1390
  };
1382
1391
  }, Wn = (t, e) => {
1383
1392
  const { status: o, dispose: n, reload: r } = t, { loading: s, failure: i, success: c } = e;
1384
- return Q(
1393
+ return q(
1385
1394
  M(n),
1386
1395
  ue(o, {
1387
1396
  loading: s != null ? (a) => s(a, r) : void 0,
@@ -1389,7 +1398,7 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1389
1398
  success: (a) => c(a, r)
1390
1399
  })
1391
1400
  );
1392
- }, oo = ({
1401
+ }, ro = ({
1393
1402
  request: t,
1394
1403
  load: e,
1395
1404
  mapError: o = (n) => n
@@ -1399,15 +1408,15 @@ const Sn = an, Tn = ln, qt = sn, kn = rn, Cn = (t, e, o) => {
1399
1408
  }, Fn = (t, e) => {
1400
1409
  if (typeof e == "function")
1401
1410
  return Fn(t, { success: e });
1402
- const o = e.failure ?? ((r) => Q(
1411
+ const o = e.failure ?? ((r) => q(
1403
1412
  M(r.on(console.error)),
1404
1413
  r.map((s) => `Error: ${s}`)
1405
1414
  )), n = e.success;
1406
- return oe(E.toSignal(t), {
1415
+ return oe(A.toSignal(t), {
1407
1416
  Success: (r) => n(r.$.value),
1408
1417
  Failure: (r) => o(r.$.error)
1409
1418
  });
1410
- }, ro = () => ee.focus((t) => {
1419
+ }, so = () => ne.focus((t) => {
1411
1420
  var e;
1412
1421
  return (e = t.target) == null ? void 0 : e.select();
1413
1422
  });
@@ -1450,7 +1459,7 @@ class Rt {
1450
1459
  * console.log(rect1.equals(rect3)); // true (within tolerance)
1451
1460
  * ```
1452
1461
  */
1453
- At(this, "equals", (e) => ht(this.left, e.left) && ht(this.top, e.top) && ht(this.width, e.width) && ht(this.height, e.height));
1462
+ Ot(this, "equals", (e) => ht(this.left, e.left) && ht(this.top, e.top) && ht(this.width, e.width) && ht(this.height, e.height));
1454
1463
  this.left = e, this.top = o, this.width = n, this.height = r;
1455
1464
  }
1456
1465
  /**
@@ -1550,7 +1559,7 @@ class Rt {
1550
1559
  return { width: this.width, height: this.height };
1551
1560
  }
1552
1561
  }
1553
- function Xt(t) {
1562
+ function Jt(t) {
1554
1563
  const e = t.getBoundingClientRect();
1555
1564
  return Rt.of({
1556
1565
  top: e.top + window.scrollY,
@@ -1559,25 +1568,25 @@ function Xt(t) {
1559
1568
  height: e.height
1560
1569
  });
1561
1570
  }
1562
- const so = (t) => Te((e) => {
1563
- const { element: o } = e, n = F(Xt(o), (c, a) => c.equals(a)), r = Ft(t(n))(e), s = () => n.set(Rt.of(Xt(o)));
1571
+ const io = (t) => Te((e) => {
1572
+ const { element: o } = e, n = F(Jt(o), (c, a) => c.equals(a)), r = Mt(t(n))(e), s = () => n.set(Rt.of(Jt(o)));
1564
1573
  let i = null;
1565
1574
  return typeof ResizeObserver < "u" && (i = new ResizeObserver(s)), i == null || i.observe(o), M((c) => {
1566
1575
  i == null || i.disconnect(), r(c);
1567
1576
  });
1568
1577
  });
1569
- function Jt(t) {
1578
+ function Gt(t) {
1570
1579
  return {
1571
1580
  /* c8 ignore next 6 */
1572
1581
  width: (t == null ? void 0 : t.innerWidth) ?? 0,
1573
1582
  height: (t == null ? void 0 : t.innerHeight) ?? 0
1574
1583
  };
1575
1584
  }
1576
- const io = (t) => (e) => {
1585
+ const co = (t) => (e) => {
1577
1586
  const o = at(), n = F(
1578
- Jt(o),
1587
+ Gt(o),
1579
1588
  (i, c) => i.width === c.width && i.height === c.height
1580
- ), r = Ft(t(n))(e), s = () => n.set(Jt(o));
1589
+ ), r = Mt(t(n))(e), s = () => n.set(Gt(o));
1581
1590
  return o == null || o.addEventListener("resize", s), (i) => {
1582
1591
  o == null || o.removeEventListener("resize", s), r(i);
1583
1592
  };
@@ -1596,9 +1605,9 @@ const io = (t) => (e) => {
1596
1605
  return { params: n, path: e };
1597
1606
  }
1598
1607
  return o.length !== t.length ? null : { params: n, path: e };
1599
- }, Ae = (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 !== ""), co = (t) => {
1608
+ }, Oe = (t) => t.split("/").map((e) => e.startsWith(":") ? { type: "param", name: e.slice(1) } : e === "*" ? { type: "catch-all" } : { type: "literal", value: e }).filter((e) => e.type !== "literal" || e.value !== ""), ao = (t) => {
1600
1609
  const e = t.map((o) => {
1601
- const n = Ae(o);
1610
+ const n = Oe(o);
1602
1611
  return { route: o, segments: n };
1603
1612
  });
1604
1613
  return function(n) {
@@ -1651,9 +1660,9 @@ const io = (t) => (e) => {
1651
1660
  };
1652
1661
  }
1653
1662
  return null;
1654
- }, Oe = (t) => {
1663
+ }, Ae = (t) => {
1655
1664
  const e = t.map((o) => {
1656
- const n = Ae(o);
1665
+ const n = Oe(o);
1657
1666
  return { route: o, segments: n };
1658
1667
  });
1659
1668
  return function(n) {
@@ -1664,12 +1673,12 @@ const io = (t) => (e) => {
1664
1673
  }
1665
1674
  return null;
1666
1675
  };
1667
- }, ao = (t) => {
1668
- const e = Oe(Object.keys(t));
1676
+ }, lo = (t) => {
1677
+ const e = Ae(Object.keys(t));
1669
1678
  return ke(
1670
1679
  Ct,
1671
1680
  {},
1672
- () => st(Mt, (o) => st(Ct, (n) => {
1681
+ () => st(Nt, (o) => st(Ct, (n) => {
1673
1682
  const r = o.map((s) => {
1674
1683
  const i = e(s.pathname);
1675
1684
  if (i == null)
@@ -1695,9 +1704,9 @@ const io = (t) => (e) => {
1695
1704
  );
1696
1705
  }))
1697
1706
  );
1698
- }, lo = (t) => {
1699
- const e = Oe(Object.keys(t));
1700
- return st(Ct, (o) => st(Mt, (n) => {
1707
+ }, uo = (t) => {
1708
+ const e = Ae(Object.keys(t));
1709
+ return st(Ct, (o) => st(Nt, (n) => {
1701
1710
  const r = o.map((s) => {
1702
1711
  const i = s[s.length - 1], c = (i == null ? void 0 : i.remainingPath) || "";
1703
1712
  if (c === "")
@@ -1720,7 +1729,7 @@ const io = (t) => (e) => {
1720
1729
  t
1721
1730
  );
1722
1731
  }));
1723
- }, yt = 60 * 1e3, Dt = 60 * yt, ct = 24 * Dt, Gt = 7 * ct, Qt = 30 * ct, Vn = 365 * ct, $n = [
1732
+ }, yt = 60 * 1e3, Dt = 60 * yt, ct = 24 * Dt, Qt = 7 * ct, Zt = 30 * ct, Vn = 365 * ct, $n = [
1724
1733
  {
1725
1734
  max: yt * 90,
1726
1735
  value: yt,
@@ -1743,15 +1752,15 @@ const io = (t) => (e) => {
1743
1752
  future: { singular: "tomorrow", plural: "in {} days" }
1744
1753
  },
1745
1754
  {
1746
- max: Gt * 6,
1747
- value: Gt,
1755
+ max: Qt * 6,
1756
+ value: Qt,
1748
1757
  name: "week",
1749
1758
  past: { singular: "last week", plural: "{} weeks ago" },
1750
1759
  future: { singular: "in a week", plural: "in {} weeks" }
1751
1760
  },
1752
1761
  {
1753
- max: Qt * 18,
1754
- value: Qt,
1762
+ max: Zt * 18,
1763
+ value: Zt,
1755
1764
  name: "month",
1756
1765
  past: { singular: "last month", plural: "{} months ago" },
1757
1766
  future: { singular: "in a month", plural: "in {} months" }
@@ -1764,7 +1773,7 @@ const io = (t) => (e) => {
1764
1773
  future: { singular: "in a year", plural: "in {} years" }
1765
1774
  }
1766
1775
  ];
1767
- function Zt(t, e, o, n) {
1776
+ function te(t, e, o, n) {
1768
1777
  const r = Math.round(t / e);
1769
1778
  return r <= 1 ? o : n.replace(
1770
1779
  "{}",
@@ -1783,18 +1792,18 @@ const Hn = (t = 1e3) => {
1783
1792
  return t < 0 ? "just now" : "in a moment";
1784
1793
  for (const o of $n)
1785
1794
  if (e < o.max)
1786
- return t < 0 ? Zt(e, o.value, o.past.singular, o.past.plural) : Zt(e, o.value, o.future.singular, o.future.plural);
1795
+ return t < 0 ? te(e, o.value, o.past.singular, o.past.plural) : te(e, o.value, o.future.singular, o.future.plural);
1787
1796
  throw new Error("unreachable");
1788
1797
  }, Un = (t, { now: e, frequency: o = 1e4 } = {}) => {
1789
- const n = e != null ? te.is(e) ? e.derive() : F(e) : Hn(o), r = ie(
1798
+ const n = e != null ? ee.is(e) ? e.derive() : F(e) : Hn(o), r = ie(
1790
1799
  t,
1791
1800
  n
1792
1801
  )((s, i) => s.getTime() - i.getTime());
1793
- return r.onDispose(() => E.dispose(n)), r;
1802
+ return r.onDispose(() => A.dispose(n)), r;
1794
1803
  }, zn = (t, e = {}) => {
1795
1804
  const o = Un(t, e), n = o.map(Bn);
1796
1805
  return n.onDispose(o.dispose), n;
1797
- }, uo = (t, e = {}) => zn(t, e);
1806
+ }, fo = (t, e = {}) => zn(t, e);
1798
1807
  class Kn extends Ce {
1799
1808
  constructor() {
1800
1809
  super(...arguments);
@@ -1802,56 +1811,57 @@ class Kn extends Ce {
1802
1811
  * Triggers an update of the Ticker by incrementing its internal value.
1803
1812
  * @returns void
1804
1813
  */
1805
- At(this, "tick", () => this.update((o) => o + 1));
1814
+ Ot(this, "tick", () => this.update((o) => o + 1));
1806
1815
  }
1807
1816
  }
1808
- const fo = (t = 0) => new Kn(t, (e, o) => e === o);
1817
+ const ho = (t = 0) => new Kn(t, (e, o) => e === o);
1809
1818
  export {
1810
1819
  Ke as Anchor,
1811
1820
  Yn as Appearance,
1812
1821
  ue as AsyncResultView,
1813
1822
  qn as AutoFocus,
1814
1823
  Xn as AutoSelect,
1815
- lo as ChildRouter,
1816
- so as ElementRect,
1817
- Gn as HTMLTitle,
1818
- Jn as HiddenWhenEmpty,
1824
+ uo as ChildRouter,
1825
+ io as ElementRect,
1826
+ Qn as HTMLTitle,
1827
+ Gn as HiddenWhenEmpty,
1819
1828
  Ye as InViewport,
1820
- Mt as Location,
1829
+ Nt as Location,
1821
1830
  qe as OnClickOutside,
1822
- Zn as OnEnterKey,
1823
- to as OnEscapeKey,
1831
+ to as OnEnterKey,
1832
+ eo as OnEscapeKey,
1824
1833
  fe as OnKeyPressed,
1825
- no as PopOver,
1834
+ oo as PopOver,
1826
1835
  Rt as Rect,
1827
- oo as Resource,
1836
+ ro as Resource,
1828
1837
  Wn as ResourceDisplay,
1829
1838
  Fn as ResultView,
1830
- ao as RootRouter,
1839
+ lo as RootRouter,
1831
1840
  Ct as RouterContextProvider,
1832
- ro as SelectOnFocus,
1841
+ so as SelectOnFocus,
1833
1842
  Kn as Ticker,
1834
- Qn as WhenInViewport,
1835
- io as WindowSize,
1843
+ Zn as WhenInViewport,
1844
+ co as WindowSize,
1836
1845
  Fe as _checkExtensionCondition,
1837
1846
  We as _getExtension,
1838
- co as _makeRouteMatcher,
1839
- Ae as _parseRouteSegments,
1840
- eo as allPlacements,
1847
+ ao as _makeRouteMatcher,
1848
+ Oe as _parseRouteSegments,
1849
+ no as allPlacements,
1841
1850
  Ve as areLocationsEqual,
1842
- Xt as getAbsoluteRect,
1851
+ Jn as classes,
1852
+ Jt as getAbsoluteRect,
1843
1853
  Ne as handleAnchorClick,
1844
1854
  le as locationFromURL,
1845
1855
  Dn as makeResource,
1846
1856
  Xe as matchesKeyCombo,
1847
1857
  Mn as matchesRoute,
1848
1858
  Hn as nowSignal,
1849
- uo as relativeTime,
1859
+ fo as relativeTime,
1850
1860
  Un as relativeTimeMillisSignal,
1851
1861
  zn as relativeTimeSignal,
1852
- zt as setLocationFromUrl,
1853
- fo as ticker,
1862
+ Kt as setLocationFromUrl,
1863
+ ho as ticker,
1854
1864
  Bn as timeDiffToString,
1855
1865
  Pt as urlFromLocation,
1856
- _e as useAppearance
1866
+ je as useAppearance
1857
1867
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -0,0 +1,8 @@
1
+ import { Value } from '@tempots/dom';
2
+ /**
3
+ * Creates a renderable that applies classes based on a record of boolean signals.
4
+ *
5
+ * @param obj - The record of signals.
6
+ * @returns The created renderable.
7
+ */
8
+ export declare function classes(obj: Record<string, Value<boolean>>): import('@tempots/dom').Renderable<import('@tempots/dom').DOMContext>;