@tempots/ui 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.js +39 -39
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var we=Object.defineProperty;var xe=(t,e,n)=>e in t?we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gt=(t,e,n)=>xe(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),O=require("@tempots/std"),Ht=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},zt=(t,e)=>{const n=Ht(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},ve=(t,e,n,o)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const i=s;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:r,search:c,hash:l}=i;if(o){const u=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:zt(n,r)},_t=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(o=>o.startsWith(".")?o:"."+o):[];return o=>{ve(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},It=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Et=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},wt=(t,e)=>{const n=Et(e);return t.set(n),t},lt=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},be=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Ae=t=>{const e=t.container.currentURL,n=e.iso(o=>Et(o),o=>{if(be(o.pathname))return lt(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return lt({...o,pathname:i})});return{value:n,dispose:n.dispose}},Re=()=>{const t=a.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}},Ee=()=>{const t=a.prop(Re(),It),e=a.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",lt(o))}),{value:t,dispose:t.dispose}},Ot={mark:a.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Ee();if(e.isHeadless())return Ae(e);throw new Error("Unknown context")}},Oe=t=>{document.startViewTransition?document.startViewTransition(t):t()},jt=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return jt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return a.Use(Ot,i=>a.html.a(a.on.click(_t(()=>(o==!0?Oe(()=>{wt(i,a.Value.get(n))}):wt(i,a.Value.get(n)),!0),s)),a.attr.href(n),...e))},Se={mark:a.makeProviderMark("Appearance"),create:()=>{const t=qt();return{value:t,dispose:t.dispose}}};function qt(){const t=a.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=a.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),o.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),o}const St=(t,e)=>{if(typeof e=="function")return St(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Le=(t=10)=>a.WithElement(e=>a.OnDispose(O.delayed(()=>e==null?void 0:e.focus(),t))),Te=(t=10)=>a.WithElement(e=>{const n=O.delayed(()=>e.select(),t);return a.OnDispose(n)}),ke=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),De=t=>a.Portal("head > title",a.attr.innerText(t)),Ce={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},ct={partial:new Map,full:new Map},Z={partial:null,full:null};function Pe(t){return Z[t]==null&&(Z[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=ct[t].get(n.target);o==null||o.set(n.isIntersecting)})},Ce[t])),Z[t]}const Yt=({mode:t="partial",once:e=!1},n)=>{const o=a.prop(!1);return a.Fragment(a.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Pe(t):null;ct[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),ct[t].delete(s),ct[t].size===0&&((l=Z[t])==null||l.disconnect(),Z[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),a.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),a.renderableOfTNode(n(o)))},We=(t,e,n)=>Yt(t,o=>a.When(o,e,n??(()=>a.Empty))),Y=Math.min,_=Math.max,at=Math.round,rt=Math.floor,P=t=>({x:t,y:t}),Fe={left:"right",right:"left",bottom:"top",top:"bottom"},Ve={start:"end",end:"start"};function xt(t,e,n){return _(t,Y(e,n))}function nt(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function ot(t){return t.split("-")[1]}function Xt(t){return t==="x"?"y":"x"}function Lt(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(I(t))?"y":"x"}function Tt(t){return Xt($(t))}function Me(t,e,n){n===void 0&&(n=!1);const o=ot(t),s=Tt(t),i=Lt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=ut(r)),[r,ut(r)]}function Ne(t){const e=ut(t);return[vt(t),e,vt(e)]}function vt(t){return t.replace(/start|end/g,e=>Ve[e])}function $e(t,e,n){const o=["left","right"],s=["right","left"],i=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:o:e?o:s;case"left":case"right":return e?i:r;default:return[]}}function Ue(t,e,n,o){const s=ot(t);let i=$e(I(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(vt)))),i}function ut(t){return t.replace(/left|right|bottom|top/g,e=>Fe[e])}function Be(t){return{top:0,right:0,bottom:0,left:0,...t}}function Kt(t){return typeof t!="number"?Be(t):{top:t,right:t,bottom:t,left:t}}function ft(t){const{x:e,y:n,width:o,height:s}=t;return{width:o,height:s,top:n,left:e,right:e+o,bottom:n+s,x:e,y:n}}function Wt(t,e,n){let{reference:o,floating:s}=t;const i=$(e),r=Tt(e),c=Lt(r),l=I(e),u=i==="y",d=o.x+o.width/2-s.width/2,h=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let f;switch(l){case"top":f={x:d,y:o.y-s.height};break;case"bottom":f={x:d,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:h};break;case"left":f={x:o.x-s.width,y:h};break;default:f={x:o.x,y:o.y}}switch(ot(e)){case"start":f[r]-=p*(n&&u?-1:1);break;case"end":f[r]+=p*(n&&u?-1:1);break}return f}const He=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let u=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=Wt(u,o,l),p=o,f={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x,y:v,data:A,reset:b}=await g({x:d,y:h,initialPlacement:o,placement:p,strategy:s,middlewareData:f,rects:u,platform:r,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[w]:{...f[w],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(u=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:h}=Wt(u,p,l)),y=-1)}return{x:d,y:h,placement:p,strategy:s,middlewareData:f}};async function Jt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=nt(e,t),m=Kt(f),w=c[p?h==="floating"?"reference":"floating":h],g=ft(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:l})),x=h==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},b=ft(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:l}):x);return{top:(g.top-b.top+m.top)/A.y,bottom:(b.bottom-g.bottom+m.bottom)/A.y,left:(g.left-b.left+m.left)/A.x,right:(b.right-g.right+m.right)/A.x}}const ze=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:s,rects:i,platform:r,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=nt(t,e)||{};if(u==null)return{};const h=Kt(d),p={x:n,y:o},f=Tt(s),m=Lt(f),y=await r.getDimensions(u),w=f==="y",g=w?"top":"left",x=w?"bottom":"right",v=w?"clientHeight":"clientWidth",A=i.reference[m]+i.reference[f]-p[f]-i.floating[m],b=p[f]-i.reference[f],L=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u));let R=L?L[v]:0;(!R||!await(r.isElement==null?void 0:r.isElement(L)))&&(R=c.floating[v]||i.floating[m]);const J=A/2-b/2,B=R/2-y[m]/2-1,V=Y(h[g],B),G=Y(h[x],B),H=V,Q=R-y[m]-G,E=R/2-y[m]/2+J,z=xt(H,E,Q),M=!l.arrow&&ot(s)!=null&&E!==z&&i.reference[m]/2-(E<H?V:G)-y[m]/2<0,T=M?E<H?E-H:E-Q:0;return{[f]:p[f]+T,data:{[f]:z,centerOffset:E-z-T,...M&&{alignmentOffset:T}},reset:M}}}),_e=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:c,platform:l,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=nt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=I(s),x=$(c),v=I(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=p||(v||!y?[ut(c)]:Ne(c)),L=m!=="none";!p&&L&&b.push(...Ue(c,y,m,A));const R=[c,...b],J=await Jt(e,w),B=[];let V=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&B.push(J[g]),h){const E=Me(s,r,A);B.push(J[E[0]],J[E[1]])}if(V=[...V,{placement:s,overflows:B}],!B.every(E=>E<=0)){var G,H;const E=(((G=i.flip)==null?void 0:G.index)||0)+1,z=R[E];if(z&&(!(h==="alignment"?x!==$(z):!1)||V.every(k=>k.overflows[0]>0&&$(k.placement)===x)))return{data:{index:E,overflows:V},reset:{placement:z}};let M=(H=V.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:H.placement;if(!M)switch(f){case"bestFit":{var Q;const T=(Q=V.filter(k=>{if(L){const N=$(k.placement);return N===x||N==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(N=>N>0).reduce((N,ye)=>N+ye,0)]).sort((k,N)=>k[1]-N[1])[0])==null?void 0:Q[0];T&&(M=T);break}case"initialPlacement":M=c;break}if(s!==M)return{reset:{placement:M}}}return{}}}};async function Ie(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=I(n),c=ot(n),l=$(n)==="y",u=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,h=nt(e,t);let{mainAxis:p,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),l?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const je=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:s,y:i,placement:r,middlewareData:c}=e,l=await Ie(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},qe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...l}=nt(t,e),u={x:n,y:o},d=await Jt(e,l),h=$(I(s)),p=Xt(h);let f=u[p],m=u[h];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=f+d[w],v=f-d[g];f=xt(x,f,v)}if(r){const w=h==="y"?"top":"left",g=h==="y"?"bottom":"right",x=m+d[w],v=m-d[g];m=xt(x,m,v)}const y=c.fn({...e,[p]:f,[h]:m});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[p]:i,[h]:r}}}}}};function dt(){return typeof window<"u"}function K(t){return Gt(t)?(t.nodeName||"").toLowerCase():"#document"}function S(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function F(t){var e;return(e=(Gt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Gt(t){return dt()?t instanceof Node||t instanceof S(t).Node:!1}function D(t){return dt()?t instanceof Element||t instanceof S(t).Element:!1}function W(t){return dt()?t instanceof HTMLElement||t instanceof S(t).HTMLElement:!1}function Ft(t){return!dt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof S(t).ShadowRoot}function st(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function Ye(t){return["table","td","th"].includes(K(t))}function mt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function kt(t){const e=Dt(),n=D(t)?C(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function Xe(t){let e=U(t);for(;W(e)&&!X(e);){if(kt(e))return e;if(mt(e))return null;e=U(e)}return null}function Dt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function X(t){return["html","body","#document"].includes(K(t))}function C(t){return S(t).getComputedStyle(t)}function pt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function U(t){if(K(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ft(t)&&t.host||F(t);return Ft(e)?e.host:e}function Qt(t){const e=U(t);return X(e)?t.ownerDocument?t.ownerDocument.body:t.body:W(e)&&st(e)?e:Qt(e)}function tt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Qt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=S(s);if(i){const c=bt(r);return e.concat(r,r.visualViewport||[],st(s)?s:[],c&&n?tt(c):[])}return e.concat(s,tt(s,[],n))}function bt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Zt(t){const e=C(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=W(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=at(n)!==i||at(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function Ct(t){return D(t)?t:t.contextElement}function q(t){const e=Ct(t);if(!W(e))return P(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Zt(e);let r=(i?at(n.width):n.width)/o,c=(i?at(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Ke=P(0);function te(t){const e=S(t);return!Dt()||!e.visualViewport?Ke:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Je(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==S(t)?!1:e}function j(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Ct(t);let r=P(1);e&&(o?D(o)&&(r=q(o)):r=q(t));const c=Je(i,n,o)?te(i):P(0);let l=(s.left+c.x)/r.x,u=(s.top+c.y)/r.y,d=s.width/r.x,h=s.height/r.y;if(i){const p=S(i),f=o&&D(o)?S(o):o;let m=p,y=bt(m);for(;y&&o&&f!==m;){const w=q(y),g=y.getBoundingClientRect(),x=C(y),v=g.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,u*=w.y,d*=w.x,h*=w.y,l+=v,u+=A,m=S(y),y=bt(m)}}return ft({width:d,height:h,x:l,y:u})}function Pt(t,e){const n=pt(t).scrollLeft;return e?e.left+n:j(F(t)).left+n}function ee(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Pt(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Ge(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=F(o),c=e?mt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=P(1);const d=P(0),h=W(o);if((h||!h&&!i)&&((K(o)!=="body"||st(r))&&(l=pt(o)),W(o))){const f=j(o);u=q(o),d.x=f.x+o.clientLeft,d.y=f.y+o.clientTop}const p=r&&!h&&!i?ee(r,l,!0):P(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function Qe(t){return Array.from(t.getClientRects())}function Ze(t){const e=F(t),n=pt(t),o=t.ownerDocument.body,s=_(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=_(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Pt(t);const c=-n.scrollTop;return C(o).direction==="rtl"&&(r+=_(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function tn(t,e){const n=S(t),o=F(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const u=Dt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function en(t,e){const n=j(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=W(t)?q(t):P(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,u=o*i.y;return{width:r,height:c,x:l,y:u}}function Vt(t,e,n){let o;if(e==="viewport")o=tn(t,n);else if(e==="document")o=Ze(F(t));else if(D(e))o=en(e,n);else{const s=te(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ft(o)}function ne(t,e){const n=U(t);return n===e||!D(n)||X(n)?!1:C(n).position==="fixed"||ne(n,e)}function nn(t,e){const n=e.get(t);if(n)return n;let o=tt(t,[],!1).filter(c=>D(c)&&K(c)!=="body"),s=null;const i=C(t).position==="fixed";let r=i?U(t):t;for(;D(r)&&!X(r);){const c=C(r),l=kt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||st(r)&&!l&&ne(t,r))?o=o.filter(d=>d!==r):s=c,r=U(r)}return e.set(t,o),o}function on(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?mt(e)?[]:nn(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((u,d)=>{const h=Vt(e,d,s);return u.top=_(h.top,u.top),u.right=Y(h.right,u.right),u.bottom=Y(h.bottom,u.bottom),u.left=_(h.left,u.left),u},Vt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function sn(t){const{width:e,height:n}=Zt(t);return{width:e,height:n}}function rn(t,e,n){const o=W(e),s=F(e),i=n==="fixed",r=j(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=P(0);function u(){l.x=Pt(s)}if(o||!o&&!i)if((K(e)!=="body"||st(s))&&(c=pt(e)),o){const f=j(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&u();i&&!o&&s&&u();const d=s&&!o&&!i?ee(s,c):P(0),h=r.left+c.scrollLeft-l.x-d.x,p=r.top+c.scrollTop-l.y-d.y;return{x:h,y:p,width:r.width,height:r.height}}function yt(t){return C(t).position==="static"}function Mt(t,e){if(!W(t)||C(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return F(t)===n&&(n=n.ownerDocument.body),n}function oe(t,e){const n=S(t);if(mt(t))return n;if(!W(t)){let s=U(t);for(;s&&!X(s);){if(D(s)&&!yt(s))return s;s=U(s)}return n}let o=Mt(t,e);for(;o&&Ye(o)&&yt(o);)o=Mt(o,e);return o&&X(o)&&yt(o)&&!kt(o)?n:o||Xe(t)||n}const cn=async function(t){const e=this.getOffsetParent||oe,n=this.getDimensions,o=await n(t.floating);return{reference:rn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ln(t){return C(t).direction==="rtl"}const an={convertOffsetParentRelativeRectToViewportRelativeRect:Ge,getDocumentElement:F,getClippingRect:on,getOffsetParent:oe,getElementRects:cn,getClientRects:Qe,getDimensions:sn,getScale:q,isElement:D,isRTL:ln};function se(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function un(t,e){let n=null,o;const s=F(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const u=t.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(c||e(),!p||!f)return;const m=rt(h),y=rt(s.clientWidth-(d+p)),w=rt(s.clientHeight-(h+f)),g=rt(d),v={rootMargin:-m+"px "+-y+"px "+-w+"px "+-g+"px",threshold:_(0,Y(1,l))||1};let A=!0;function b(L){const R=L[0].intersectionRatio;if(R!==l){if(!A)return r();R?r(!1,R):o=setTimeout(()=>{r(!1,1e-7)},1e3)}R===1&&!se(u,t.getBoundingClientRect())&&r(),A=!1}try{n=new IntersectionObserver(b,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(t)}return r(!0),i}function fn(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=Ct(t),d=s||i?[...u?tt(u):[],...tt(e)]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const h=u&&c?un(u,n):null;let p=-1,f=null;r&&(f=new ResizeObserver(g=>{let[x]=g;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),n()}),u&&!l&&f.observe(u),f.observe(e));let m,y=l?j(t):null;l&&w();function w(){const g=j(t);y&&!se(y,g)&&n(),y=g,m=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(x=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),h==null||h(),(g=f)==null||g.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const hn=je,dn=qe,Nt=_e,mn=ze,pn=(t,e,n)=>{const o=new Map,s={platform:an,...n},i={...s.platform,_c:o};return He(t,e,{...s,platform:i})},gn=({content:t,open:e,placement:n,offset:o={mainAxis:0,crossAxis:0},arrow:s})=>a.WithBrowserCtx(i=>{const r=a.Value.toSignal(e),c=i.element,l=a.Value.toSignal(o),u=l.$.mainAxis.map(p=>p??0),d=l.$.crossAxis.map(p=>p??0),h=a.Value.toSignal(n??"top");return a.When(r,()=>a.Portal("body",a.html.div(a.WithElement(p=>{const f=p;f.style.position="absolute";let m=null;async function y(){const g=[Nt(),hn({mainAxis:u.get(),crossAxis:d.get()}),dn(),Nt()];m&&g.push(mn({element:m,padding:(s==null?void 0:s.padding)??0}));const x=await pn(c,f,{placement:h.get(),strategy:"absolute",middleware:g}),{x:v,y:A,middlewareData:b}=x;if(f.style.top=`${A}px`,f.style.left=`${v}px`,m&&b.arrow){const{x:L,y:R}=b.arrow;Object.assign(m.style,{left:L!=null?`${L}px`:"",top:R!=null?`${R}px`:""})}}const w=a.effectOf(u,d,h)(y);return a.Fragment(s!=null?a.html.div(s.content,a.WithElement(g=>{m=g})):null,a.OnDispose(fn(c,f,y),w))}),t())))}),ie=(t,e,n)=>{const o=a.prop(O.AsyncResult.notAsked),s=o.map(h=>O.AsyncResult.isSuccess(h)?h.value:void 0),i=o.map(h=>O.AsyncResult.isFailure(h)?h.error:void 0),r=o.map(h=>O.AsyncResult.isLoading(h));let c;const l=async h=>{c==null||c.abort(),c=new AbortController;const p=c.signal,f=o.get();o.set(O.AsyncResult.loading(O.AsyncResult.getOrUndefined(f)));try{const m=await e({request:h,abortSignal:p,previous:f});await Promise.resolve(),c=void 0,o.set(O.AsyncResult.success(m))}catch(m){c=void 0,o.set(O.AsyncResult.failure(n(m)))}},u=()=>l(a.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(a.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:u,dispose:d}},re=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return a.Fragment(a.OnDispose(o),St(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},yn=({request:t,load:e,mapError:n=o=>o})=>{const o=ie(t,e,n);return s=>re(o,s)},ce=(t,e)=>{if(typeof e=="function")return ce(t,{success:e});const n=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},wn=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,n,o,s){gt(this,"equals",e=>O.nearEqual(this.left,e.left)&&O.nearEqual(this.top,e.top)&&O.nearEqual(this.width,e.width)&&O.nearEqual(this.height,e.height));this.left=e,this.top=n,this.width=o,this.height=s}static of({left:e=0,top:n=0,width:o=0,height:s=0}){return new it(e,n,o,s)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get size(){return{width:this.width,height:this.height}}}function At(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 le=t=>a.WithBrowserCtx(e=>{const{element:n}=e,o=a.prop(At(n)),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set(it.of(At(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),a.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),xn=t=>le(t),vn=t=>e=>{const n=a.getWindow(),o=a.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},ae=(t,e)=>{const n=e.split("/").filter(s=>s!==""),o={};for(let s=0;s<t.length;s++){const i=t[s],r=n[s];if(!r&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==r)return null}else if(i.type==="param")o[i.name]=r;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},ue=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!==""),fe=t=>{const e=t.map(n=>{const o=ue(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=ae(s,o);if(r)return{...r,route:i}}return null}},bn=t=>{const e=fe(Object.keys(t));return a.Use(Ot,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return a.OneOfTuple(o.map(s=>[s.route,s]),t)})},ht=60*1e3,Rt=60*ht,et=24*Rt,$t=7*et,Ut=30*et,An=365*et,Rn=[{max:ht*90,value:ht,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Rt*36,value:Rt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:et*10,value:et,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:Ut*18,value:Ut,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:An,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Bt(t,e,n,o){const s=Math.round(t/e);return s<=1?n:o.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const he=(t=1e3)=>{const e=a.prop(new Date),n=O.interval(()=>e.set(new Date),t);return e.onDispose(n),e},de=t=>{const e=Math.abs(t);if(e<ht)return t<0?"just now":"in a moment";for(const n of Rn)if(e<n.max)return t<0?Bt(e,n.value,n.past.singular,n.past.plural):Bt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},me=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.prop(e):he(n),s=a.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>a.Value.dispose(o)),s},pe=(t,e={})=>{const n=me(t,e),o=n.map(de);return o.onDispose(n.dispose),o},En=(t,e={})=>pe(t,e);class ge extends a.Prop{constructor(){super(...arguments);gt(this,"tick",()=>this.update(n=>n+1))}}const On=(t=0)=>new ge(t,(e,n)=>e===n);exports.Anchor=jt;exports.Appearance=Se;exports.AsyncResultView=St;exports.AutoFocus=Le;exports.AutoSelect=Te;exports.ElementRect=le;exports.ElementSize=xn;exports.HTMLTitle=De;exports.HiddenWhenEmpty=ke;exports.InViewport=Yt;exports.Location=Ot;exports.PopOver=gn;exports.Rect=it;exports.Resource=yn;exports.ResourceDisplay=re;exports.ResultView=ce;exports.Router=bn;exports.SelectOnFocus=wn;exports.Ticker=ge;exports.WhenInViewport=We;exports.WindowSize=vn;exports._checkExtensionCondition=zt;exports._getExtension=Ht;exports._makeRouteMatcher=fe;exports._parseRouteSegments=ue;exports.areLocationsEqual=It;exports.getAbsoluteRect=At;exports.handleAnchorClick=_t;exports.locationFromURL=Et;exports.makeResource=ie;exports.matchesRoute=ae;exports.nowSignal=he;exports.relativeTime=En;exports.relativeTimeMillisSignal=me;exports.relativeTimeSignal=pe;exports.setLocationFromUrl=wt;exports.ticker=On;exports.timeDiffToString=de;exports.urlFromLocation=lt;exports.useAppearance=qt;
|
|
1
|
+
"use strict";var we=Object.defineProperty;var xe=(t,e,n)=>e in t?we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gt=(t,e,n)=>xe(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),O=require("@tempots/std"),Ht=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},zt=(t,e)=>{const n=Ht(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},ve=(t,e,n,o)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const i=s;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:r,search:c,hash:l}=i;if(o){const u=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:zt(n,r)},_t=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(o=>o.startsWith(".")?o:"."+o):[];return o=>{ve(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},It=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Et=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},wt=(t,e)=>{const n=Et(e);return t.set(n),t},lt=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},be=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Ae=t=>{const e=t.container.currentURL,n=e.iso(o=>Et(o),o=>{if(be(o.pathname))return lt(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return lt({...o,pathname:i})});return{value:n,dispose:n.dispose}},Re=()=>{const t=a.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}},Ee=()=>{const t=a.prop(Re(),It),e=a.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",lt(o))}),{value:t,dispose:t.dispose}},Ot={mark:a.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Ee();if(e.isHeadless())return Ae(e);throw new Error("Unknown context")}},Oe=t=>{document.startViewTransition?document.startViewTransition(t):t()},jt=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return jt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return a.Use(Ot,i=>a.html.a(a.on.click(_t(()=>(o==!0?Oe(()=>{wt(i,a.Value.get(n))}):wt(i,a.Value.get(n)),!0),s)),a.attr.href(n),...e))},Se={mark:a.makeProviderMark("Appearance"),create:()=>{const t=qt();return{value:t,dispose:t.dispose}}};function qt(){const t=a.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=a.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),o.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),o}const St=(t,e)=>{if(typeof e=="function")return St(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Le=(t=10)=>a.WithElement(e=>a.OnDispose(O.delayed(()=>e==null?void 0:e.focus(),t))),Te=(t=10)=>a.WithElement(e=>{const n=O.delayed(()=>e.select(),t);return a.OnDispose(n)}),ke=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),De=t=>a.Portal("head > title",a.attr.innerText(t)),Ce={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},ct={partial:new Map,full:new Map},Z={partial:null,full:null};function Pe(t){return Z[t]==null&&(Z[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=ct[t].get(n.target);o==null||o.set(n.isIntersecting)})},Ce[t])),Z[t]}const Yt=({mode:t="partial",once:e=!1},n)=>{const o=a.prop(!1);return a.Fragment(a.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Pe(t):null;ct[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),ct[t].delete(s),ct[t].size===0&&((l=Z[t])==null||l.disconnect(),Z[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),a.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),a.renderableOfTNode(n(o)))},We=(t,e,n)=>Yt(t,o=>a.When(o,e,n??(()=>a.Empty))),Y=Math.min,_=Math.max,at=Math.round,rt=Math.floor,P=t=>({x:t,y:t}),Fe={left:"right",right:"left",bottom:"top",top:"bottom"},Ve={start:"end",end:"start"};function xt(t,e,n){return _(t,Y(e,n))}function nt(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function ot(t){return t.split("-")[1]}function Xt(t){return t==="x"?"y":"x"}function Lt(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(I(t))?"y":"x"}function Tt(t){return Xt($(t))}function Me(t,e,n){n===void 0&&(n=!1);const o=ot(t),s=Tt(t),i=Lt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=ut(r)),[r,ut(r)]}function Ne(t){const e=ut(t);return[vt(t),e,vt(e)]}function vt(t){return t.replace(/start|end/g,e=>Ve[e])}function $e(t,e,n){const o=["left","right"],s=["right","left"],i=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:o:e?o:s;case"left":case"right":return e?i:r;default:return[]}}function Ue(t,e,n,o){const s=ot(t);let i=$e(I(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(vt)))),i}function ut(t){return t.replace(/left|right|bottom|top/g,e=>Fe[e])}function Be(t){return{top:0,right:0,bottom:0,left:0,...t}}function Kt(t){return typeof t!="number"?Be(t):{top:t,right:t,bottom:t,left:t}}function ft(t){const{x:e,y:n,width:o,height:s}=t;return{width:o,height:s,top:n,left:e,right:e+o,bottom:n+s,x:e,y:n}}function Wt(t,e,n){let{reference:o,floating:s}=t;const i=$(e),r=Tt(e),c=Lt(r),l=I(e),u=i==="y",d=o.x+o.width/2-s.width/2,h=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let f;switch(l){case"top":f={x:d,y:o.y-s.height};break;case"bottom":f={x:d,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:h};break;case"left":f={x:o.x-s.width,y:h};break;default:f={x:o.x,y:o.y}}switch(ot(e)){case"start":f[r]-=p*(n&&u?-1:1);break;case"end":f[r]+=p*(n&&u?-1:1);break}return f}const He=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let u=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=Wt(u,o,l),p=o,f={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x,y:v,data:A,reset:b}=await g({x:d,y:h,initialPlacement:o,placement:p,strategy:s,middlewareData:f,rects:u,platform:r,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[w]:{...f[w],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(u=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:h}=Wt(u,p,l)),y=-1)}return{x:d,y:h,placement:p,strategy:s,middlewareData:f}};async function Jt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=nt(e,t),m=Kt(f),w=c[p?h==="floating"?"reference":"floating":h],g=ft(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:l})),x=h==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},b=ft(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:l}):x);return{top:(g.top-b.top+m.top)/A.y,bottom:(b.bottom-g.bottom+m.bottom)/A.y,left:(g.left-b.left+m.left)/A.x,right:(b.right-g.right+m.right)/A.x}}const ze=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:s,rects:i,platform:r,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=nt(t,e)||{};if(u==null)return{};const h=Kt(d),p={x:n,y:o},f=Tt(s),m=Lt(f),y=await r.getDimensions(u),w=f==="y",g=w?"top":"left",x=w?"bottom":"right",v=w?"clientHeight":"clientWidth",A=i.reference[m]+i.reference[f]-p[f]-i.floating[m],b=p[f]-i.reference[f],L=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u));let R=L?L[v]:0;(!R||!await(r.isElement==null?void 0:r.isElement(L)))&&(R=c.floating[v]||i.floating[m]);const J=A/2-b/2,B=R/2-y[m]/2-1,V=Y(h[g],B),G=Y(h[x],B),H=V,Q=R-y[m]-G,E=R/2-y[m]/2+J,z=xt(H,E,Q),M=!l.arrow&&ot(s)!=null&&E!==z&&i.reference[m]/2-(E<H?V:G)-y[m]/2<0,T=M?E<H?E-H:E-Q:0;return{[f]:p[f]+T,data:{[f]:z,centerOffset:E-z-T,...M&&{alignmentOffset:T}},reset:M}}}),_e=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:c,platform:l,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=nt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=I(s),x=$(c),v=I(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=p||(v||!y?[ut(c)]:Ne(c)),L=m!=="none";!p&&L&&b.push(...Ue(c,y,m,A));const R=[c,...b],J=await Jt(e,w),B=[];let V=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&B.push(J[g]),h){const E=Me(s,r,A);B.push(J[E[0]],J[E[1]])}if(V=[...V,{placement:s,overflows:B}],!B.every(E=>E<=0)){var G,H;const E=(((G=i.flip)==null?void 0:G.index)||0)+1,z=R[E];if(z&&(!(h==="alignment"?x!==$(z):!1)||V.every(k=>k.overflows[0]>0&&$(k.placement)===x)))return{data:{index:E,overflows:V},reset:{placement:z}};let M=(H=V.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:H.placement;if(!M)switch(f){case"bestFit":{var Q;const T=(Q=V.filter(k=>{if(L){const N=$(k.placement);return N===x||N==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(N=>N>0).reduce((N,ye)=>N+ye,0)]).sort((k,N)=>k[1]-N[1])[0])==null?void 0:Q[0];T&&(M=T);break}case"initialPlacement":M=c;break}if(s!==M)return{reset:{placement:M}}}return{}}}};async function Ie(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=I(n),c=ot(n),l=$(n)==="y",u=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,h=nt(e,t);let{mainAxis:p,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),l?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const je=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:s,y:i,placement:r,middlewareData:c}=e,l=await Ie(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},qe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...l}=nt(t,e),u={x:n,y:o},d=await Jt(e,l),h=$(I(s)),p=Xt(h);let f=u[p],m=u[h];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=f+d[w],v=f-d[g];f=xt(x,f,v)}if(r){const w=h==="y"?"top":"left",g=h==="y"?"bottom":"right",x=m+d[w],v=m-d[g];m=xt(x,m,v)}const y=c.fn({...e,[p]:f,[h]:m});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[p]:i,[h]:r}}}}}};function dt(){return typeof window<"u"}function K(t){return Gt(t)?(t.nodeName||"").toLowerCase():"#document"}function S(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function F(t){var e;return(e=(Gt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Gt(t){return dt()?t instanceof Node||t instanceof S(t).Node:!1}function D(t){return dt()?t instanceof Element||t instanceof S(t).Element:!1}function W(t){return dt()?t instanceof HTMLElement||t instanceof S(t).HTMLElement:!1}function Ft(t){return!dt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof S(t).ShadowRoot}function st(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function Ye(t){return["table","td","th"].includes(K(t))}function mt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function kt(t){const e=Dt(),n=D(t)?C(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function Xe(t){let e=U(t);for(;W(e)&&!X(e);){if(kt(e))return e;if(mt(e))return null;e=U(e)}return null}function Dt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function X(t){return["html","body","#document"].includes(K(t))}function C(t){return S(t).getComputedStyle(t)}function pt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function U(t){if(K(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ft(t)&&t.host||F(t);return Ft(e)?e.host:e}function Qt(t){const e=U(t);return X(e)?t.ownerDocument?t.ownerDocument.body:t.body:W(e)&&st(e)?e:Qt(e)}function tt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Qt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=S(s);if(i){const c=bt(r);return e.concat(r,r.visualViewport||[],st(s)?s:[],c&&n?tt(c):[])}return e.concat(s,tt(s,[],n))}function bt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Zt(t){const e=C(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=W(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=at(n)!==i||at(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function Ct(t){return D(t)?t:t.contextElement}function q(t){const e=Ct(t);if(!W(e))return P(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Zt(e);let r=(i?at(n.width):n.width)/o,c=(i?at(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Ke=P(0);function te(t){const e=S(t);return!Dt()||!e.visualViewport?Ke:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Je(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==S(t)?!1:e}function j(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Ct(t);let r=P(1);e&&(o?D(o)&&(r=q(o)):r=q(t));const c=Je(i,n,o)?te(i):P(0);let l=(s.left+c.x)/r.x,u=(s.top+c.y)/r.y,d=s.width/r.x,h=s.height/r.y;if(i){const p=S(i),f=o&&D(o)?S(o):o;let m=p,y=bt(m);for(;y&&o&&f!==m;){const w=q(y),g=y.getBoundingClientRect(),x=C(y),v=g.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,u*=w.y,d*=w.x,h*=w.y,l+=v,u+=A,m=S(y),y=bt(m)}}return ft({width:d,height:h,x:l,y:u})}function Pt(t,e){const n=pt(t).scrollLeft;return e?e.left+n:j(F(t)).left+n}function ee(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Pt(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Ge(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=F(o),c=e?mt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=P(1);const d=P(0),h=W(o);if((h||!h&&!i)&&((K(o)!=="body"||st(r))&&(l=pt(o)),W(o))){const f=j(o);u=q(o),d.x=f.x+o.clientLeft,d.y=f.y+o.clientTop}const p=r&&!h&&!i?ee(r,l,!0):P(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function Qe(t){return Array.from(t.getClientRects())}function Ze(t){const e=F(t),n=pt(t),o=t.ownerDocument.body,s=_(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=_(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Pt(t);const c=-n.scrollTop;return C(o).direction==="rtl"&&(r+=_(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function tn(t,e){const n=S(t),o=F(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const u=Dt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function en(t,e){const n=j(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=W(t)?q(t):P(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,u=o*i.y;return{width:r,height:c,x:l,y:u}}function Vt(t,e,n){let o;if(e==="viewport")o=tn(t,n);else if(e==="document")o=Ze(F(t));else if(D(e))o=en(e,n);else{const s=te(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ft(o)}function ne(t,e){const n=U(t);return n===e||!D(n)||X(n)?!1:C(n).position==="fixed"||ne(n,e)}function nn(t,e){const n=e.get(t);if(n)return n;let o=tt(t,[],!1).filter(c=>D(c)&&K(c)!=="body"),s=null;const i=C(t).position==="fixed";let r=i?U(t):t;for(;D(r)&&!X(r);){const c=C(r),l=kt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||st(r)&&!l&&ne(t,r))?o=o.filter(d=>d!==r):s=c,r=U(r)}return e.set(t,o),o}function on(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?mt(e)?[]:nn(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((u,d)=>{const h=Vt(e,d,s);return u.top=_(h.top,u.top),u.right=Y(h.right,u.right),u.bottom=Y(h.bottom,u.bottom),u.left=_(h.left,u.left),u},Vt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function sn(t){const{width:e,height:n}=Zt(t);return{width:e,height:n}}function rn(t,e,n){const o=W(e),s=F(e),i=n==="fixed",r=j(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=P(0);function u(){l.x=Pt(s)}if(o||!o&&!i)if((K(e)!=="body"||st(s))&&(c=pt(e)),o){const f=j(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&u();i&&!o&&s&&u();const d=s&&!o&&!i?ee(s,c):P(0),h=r.left+c.scrollLeft-l.x-d.x,p=r.top+c.scrollTop-l.y-d.y;return{x:h,y:p,width:r.width,height:r.height}}function yt(t){return C(t).position==="static"}function Mt(t,e){if(!W(t)||C(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return F(t)===n&&(n=n.ownerDocument.body),n}function oe(t,e){const n=S(t);if(mt(t))return n;if(!W(t)){let s=U(t);for(;s&&!X(s);){if(D(s)&&!yt(s))return s;s=U(s)}return n}let o=Mt(t,e);for(;o&&Ye(o)&&yt(o);)o=Mt(o,e);return o&&X(o)&&yt(o)&&!kt(o)?n:o||Xe(t)||n}const cn=async function(t){const e=this.getOffsetParent||oe,n=this.getDimensions,o=await n(t.floating);return{reference:rn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ln(t){return C(t).direction==="rtl"}const an={convertOffsetParentRelativeRectToViewportRelativeRect:Ge,getDocumentElement:F,getClippingRect:on,getOffsetParent:oe,getElementRects:cn,getClientRects:Qe,getDimensions:sn,getScale:q,isElement:D,isRTL:ln};function se(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function un(t,e){let n=null,o;const s=F(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const u=t.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(c||e(),!p||!f)return;const m=rt(h),y=rt(s.clientWidth-(d+p)),w=rt(s.clientHeight-(h+f)),g=rt(d),v={rootMargin:-m+"px "+-y+"px "+-w+"px "+-g+"px",threshold:_(0,Y(1,l))||1};let A=!0;function b(L){const R=L[0].intersectionRatio;if(R!==l){if(!A)return r();R?r(!1,R):o=setTimeout(()=>{r(!1,1e-7)},1e3)}R===1&&!se(u,t.getBoundingClientRect())&&r(),A=!1}try{n=new IntersectionObserver(b,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(t)}return r(!0),i}function fn(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=Ct(t),d=s||i?[...u?tt(u):[],...tt(e)]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const h=u&&c?un(u,n):null;let p=-1,f=null;r&&(f=new ResizeObserver(g=>{let[x]=g;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),n()}),u&&!l&&f.observe(u),f.observe(e));let m,y=l?j(t):null;l&&w();function w(){const g=j(t);y&&!se(y,g)&&n(),y=g,m=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(x=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),h==null||h(),(g=f)==null||g.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const hn=je,dn=qe,Nt=_e,mn=ze,pn=(t,e,n)=>{const o=new Map,s={platform:an,...n},i={...s.platform,_c:o};return He(t,e,{...s,platform:i})},gn=({content:t,open:e,placement:n,offset:o={mainAxis:0,crossAxis:0},arrow:s})=>a.WithBrowserCtx(i=>{const r=a.Value.toSignal(e),c=i.element,l=a.Value.toSignal(o),u=l.$.mainAxis.map(p=>p??0),d=l.$.crossAxis.map(p=>p??0),h=a.Value.toSignal(n??"top");return a.When(r,()=>a.Portal("body",a.html.div(a.WithElement(p=>{const f=p;f.style.position="absolute";let m=null;async function y(){const g=[Nt(),hn({mainAxis:u.get(),crossAxis:d.get()}),dn(),Nt()];s!=null&&m!=null&&g.push(mn({element:m,padding:(s==null?void 0:s.padding)??0}));const x=await pn(c,f,{placement:h.get(),strategy:"absolute",middleware:g}),{x:v,y:A,middlewareData:b}=x;if(f.style.top=`${A}px`,f.style.left=`${v}px`,m&&b.arrow){const{x:L,y:R}=b.arrow;Object.assign(m.style,{left:L!=null?`${L}px`:"",top:R!=null?`${R}px`:""})}}const w=a.effectOf(u,d,h)(y);return a.Fragment(s!=null?a.html.div(s.content,a.WithElement(g=>{m=g,y()})):null,a.OnDispose(fn(c,f,y),w))}),t())))}),ie=(t,e,n)=>{const o=a.prop(O.AsyncResult.notAsked),s=o.map(h=>O.AsyncResult.isSuccess(h)?h.value:void 0),i=o.map(h=>O.AsyncResult.isFailure(h)?h.error:void 0),r=o.map(h=>O.AsyncResult.isLoading(h));let c;const l=async h=>{c==null||c.abort(),c=new AbortController;const p=c.signal,f=o.get();o.set(O.AsyncResult.loading(O.AsyncResult.getOrUndefined(f)));try{const m=await e({request:h,abortSignal:p,previous:f});await Promise.resolve(),c=void 0,o.set(O.AsyncResult.success(m))}catch(m){c=void 0,o.set(O.AsyncResult.failure(n(m)))}},u=()=>l(a.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(a.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:u,dispose:d}},re=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return a.Fragment(a.OnDispose(o),St(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},yn=({request:t,load:e,mapError:n=o=>o})=>{const o=ie(t,e,n);return s=>re(o,s)},ce=(t,e)=>{if(typeof e=="function")return ce(t,{success:e});const n=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},wn=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,n,o,s){gt(this,"equals",e=>O.nearEqual(this.left,e.left)&&O.nearEqual(this.top,e.top)&&O.nearEqual(this.width,e.width)&&O.nearEqual(this.height,e.height));this.left=e,this.top=n,this.width=o,this.height=s}static of({left:e=0,top:n=0,width:o=0,height:s=0}){return new it(e,n,o,s)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get size(){return{width:this.width,height:this.height}}}function At(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 le=t=>a.WithBrowserCtx(e=>{const{element:n}=e,o=a.prop(At(n)),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set(it.of(At(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),a.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),xn=t=>le(t),vn=t=>e=>{const n=a.getWindow(),o=a.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},ae=(t,e)=>{const n=e.split("/").filter(s=>s!==""),o={};for(let s=0;s<t.length;s++){const i=t[s],r=n[s];if(!r&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==r)return null}else if(i.type==="param")o[i.name]=r;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},ue=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!==""),fe=t=>{const e=t.map(n=>{const o=ue(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=ae(s,o);if(r)return{...r,route:i}}return null}},bn=t=>{const e=fe(Object.keys(t));return a.Use(Ot,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return a.OneOfTuple(o.map(s=>[s.route,s]),t)})},ht=60*1e3,Rt=60*ht,et=24*Rt,$t=7*et,Ut=30*et,An=365*et,Rn=[{max:ht*90,value:ht,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Rt*36,value:Rt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:et*10,value:et,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:Ut*18,value:Ut,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:An,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Bt(t,e,n,o){const s=Math.round(t/e);return s<=1?n:o.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const he=(t=1e3)=>{const e=a.prop(new Date),n=O.interval(()=>e.set(new Date),t);return e.onDispose(n),e},de=t=>{const e=Math.abs(t);if(e<ht)return t<0?"just now":"in a moment";for(const n of Rn)if(e<n.max)return t<0?Bt(e,n.value,n.past.singular,n.past.plural):Bt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},me=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.prop(e):he(n),s=a.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>a.Value.dispose(o)),s},pe=(t,e={})=>{const n=me(t,e),o=n.map(de);return o.onDispose(n.dispose),o},En=(t,e={})=>pe(t,e);class ge extends a.Prop{constructor(){super(...arguments);gt(this,"tick",()=>this.update(n=>n+1))}}const On=(t=0)=>new ge(t,(e,n)=>e===n);exports.Anchor=jt;exports.Appearance=Se;exports.AsyncResultView=St;exports.AutoFocus=Le;exports.AutoSelect=Te;exports.ElementRect=le;exports.ElementSize=xn;exports.HTMLTitle=De;exports.HiddenWhenEmpty=ke;exports.InViewport=Yt;exports.Location=Ot;exports.PopOver=gn;exports.Rect=it;exports.Resource=yn;exports.ResourceDisplay=re;exports.ResultView=ce;exports.Router=bn;exports.SelectOnFocus=wn;exports.Ticker=ge;exports.WhenInViewport=We;exports.WindowSize=vn;exports._checkExtensionCondition=zt;exports._getExtension=Ht;exports._makeRouteMatcher=fe;exports._parseRouteSegments=ue;exports.areLocationsEqual=It;exports.getAbsoluteRect=At;exports.handleAnchorClick=_t;exports.locationFromURL=Et;exports.makeResource=ie;exports.matchesRoute=ae;exports.nowSignal=he;exports.relativeTime=En;exports.relativeTimeMillisSignal=me;exports.relativeTimeSignal=pe;exports.setLocationFromUrl=wt;exports.ticker=On;exports.timeDiffToString=de;exports.urlFromLocation=lt;exports.useAppearance=qt;
|
package/index.js
CHANGED
|
@@ -3,13 +3,13 @@ var xe = (t, e, n) => e in t ? ye(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var bt = (t, e, n) => xe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { getWindow as it, prop as H, makeProviderMark as qt, Signal as Xt, Use as Kt, html as Rt, on as Jt, Value as C, attr as Gt, Empty as Et, OneOfType as Qt, WithElement as K, OnDispose as U, Portal as Zt, Fragment as gt, renderableOfTNode as Ct, When as te, WithBrowserCtx as ee, effectOf as ve, OneOfTuple as be, computedOf as Ae, Prop as Re } from "@tempots/dom";
|
|
5
5
|
import { delayed as ne, AsyncResult as $, nearEqual as at, interval as Ee } from "@tempots/std";
|
|
6
|
-
const
|
|
6
|
+
const Le = (t) => {
|
|
7
7
|
const e = t.split("/").pop();
|
|
8
8
|
if (e == null || e.startsWith(".")) return;
|
|
9
9
|
const n = e.split(".") || [];
|
|
10
10
|
return n.length > 1 ? "." + n.pop() : void 0;
|
|
11
|
-
},
|
|
12
|
-
const n =
|
|
11
|
+
}, Oe = (t, e) => {
|
|
12
|
+
const n = Le(e);
|
|
13
13
|
return n != null && (t.length === 0 || !t.some((o) => n == o));
|
|
14
14
|
}, Se = (t, e, n, o) => {
|
|
15
15
|
let s = t.target;
|
|
@@ -26,7 +26,7 @@ const Oe = (t) => {
|
|
|
26
26
|
if (!(h != null && h.startsWith("#")) && h !== a)
|
|
27
27
|
return !0;
|
|
28
28
|
}
|
|
29
|
-
return e ? !1 :
|
|
29
|
+
return e ? !1 : Oe(n, r);
|
|
30
30
|
}, Te = (t, e = {
|
|
31
31
|
ignoreUrlWithExtension: !0,
|
|
32
32
|
allowedExtensions: [],
|
|
@@ -55,7 +55,7 @@ const Oe = (t) => {
|
|
|
55
55
|
}, $t = (t, e) => {
|
|
56
56
|
const n = oe(e);
|
|
57
57
|
return t.set(n), t;
|
|
58
|
-
},
|
|
58
|
+
}, Lt = (t) => {
|
|
59
59
|
const n = new URLSearchParams(t.search).toString(), o = t.hash;
|
|
60
60
|
return `${t.pathname}${n ? `?${n}` : ""}${o ? `#${o}` : ""}`;
|
|
61
61
|
}, Ce = (t) => t.startsWith("http://") || t.startsWith("https://") || t.startsWith("//"), Pe = (t) => {
|
|
@@ -63,9 +63,9 @@ const Oe = (t) => {
|
|
|
63
63
|
(o) => oe(o),
|
|
64
64
|
(o) => {
|
|
65
65
|
if (Ce(o.pathname))
|
|
66
|
-
return
|
|
66
|
+
return Lt(o);
|
|
67
67
|
const s = new URL(o.pathname, e.value), i = s.origin + s.pathname;
|
|
68
|
-
return
|
|
68
|
+
return Lt({ ...o, pathname: i });
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
71
|
return { value: n, dispose: n.dispose };
|
|
@@ -94,7 +94,7 @@ const Oe = (t) => {
|
|
|
94
94
|
return e == null || e.addEventListener("popstate", n), t.onDispose(() => {
|
|
95
95
|
e == null || e.removeEventListener("popstate", n);
|
|
96
96
|
}), t.on((o) => {
|
|
97
|
-
e == null || e.history.pushState({}, "",
|
|
97
|
+
e == null || e.history.pushState({}, "", Lt(o));
|
|
98
98
|
}), {
|
|
99
99
|
value: t,
|
|
100
100
|
dispose: t.dispose
|
|
@@ -216,7 +216,7 @@ const Be = ({ mode: t = "partial", once: e = !1 }, n) => {
|
|
|
216
216
|
start: "end",
|
|
217
217
|
end: "start"
|
|
218
218
|
};
|
|
219
|
-
function
|
|
219
|
+
function Ot(t, e, n) {
|
|
220
220
|
return I(t, J(e, n));
|
|
221
221
|
}
|
|
222
222
|
function rt(t, e) {
|
|
@@ -484,17 +484,17 @@ const Xe = (t) => ({
|
|
|
484
484
|
const f = ce(h), m = {
|
|
485
485
|
x: n,
|
|
486
486
|
y: o
|
|
487
|
-
}, u = Dt(s), d = Pt(u), g = await r.getDimensions(a), w = u === "y", p = w ? "top" : "left", y = w ? "bottom" : "right", x = w ? "clientHeight" : "clientWidth", b = i.reference[d] + i.reference[u] - m[u] - i.floating[d], v = m[u] - i.reference[u],
|
|
488
|
-
let A =
|
|
489
|
-
(!A || !await (r.isElement == null ? void 0 : r.isElement(
|
|
490
|
-
const Z = b / 2 - v / 2, z = A / 2 - g[d] / 2 - 1, F = J(f[p], z), tt = J(f[y], z), _ = F, et = A - g[d] - tt, R = A / 2 - g[d] / 2 + Z, j =
|
|
487
|
+
}, u = Dt(s), d = Pt(u), g = await r.getDimensions(a), w = u === "y", p = w ? "top" : "left", y = w ? "bottom" : "right", x = w ? "clientHeight" : "clientWidth", b = i.reference[d] + i.reference[u] - m[u] - i.floating[d], v = m[u] - i.reference[u], L = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
|
|
488
|
+
let A = L ? L[x] : 0;
|
|
489
|
+
(!A || !await (r.isElement == null ? void 0 : r.isElement(L))) && (A = c.floating[x] || i.floating[d]);
|
|
490
|
+
const Z = b / 2 - v / 2, z = A / 2 - g[d] / 2 - 1, F = J(f[p], z), tt = J(f[y], z), _ = F, et = A - g[d] - tt, R = A / 2 - g[d] / 2 + Z, j = Ot(_, R, et), M = !l.arrow && ct(s) != null && R !== j && i.reference[d] / 2 - (R < _ ? F : tt) - g[d] / 2 < 0, O = M ? R < _ ? R - _ : R - et : 0;
|
|
491
491
|
return {
|
|
492
|
-
[u]: m[u] +
|
|
492
|
+
[u]: m[u] + O,
|
|
493
493
|
data: {
|
|
494
494
|
[u]: j,
|
|
495
|
-
centerOffset: R - j -
|
|
495
|
+
centerOffset: R - j - O,
|
|
496
496
|
...M && {
|
|
497
|
-
alignmentOffset:
|
|
497
|
+
alignmentOffset: O
|
|
498
498
|
}
|
|
499
499
|
},
|
|
500
500
|
reset: M
|
|
@@ -524,8 +524,8 @@ const Xe = (t) => ({
|
|
|
524
524
|
} = rt(t, e);
|
|
525
525
|
if ((n = i.arrow) != null && n.alignmentOffset)
|
|
526
526
|
return {};
|
|
527
|
-
const p = Y(s), y = N(c), x = Y(c) === c, b = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), v = m || (x || !g ? [dt(c)] : _e(c)),
|
|
528
|
-
!m &&
|
|
527
|
+
const p = Y(s), y = N(c), x = Y(c) === c, b = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), v = m || (x || !g ? [dt(c)] : _e(c)), L = d !== "none";
|
|
528
|
+
!m && L && v.push(...Ie(c, g, d, b));
|
|
529
529
|
const A = [c, ...v], Z = await le(e, w), z = [];
|
|
530
530
|
let F = ((o = i.flip) == null ? void 0 : o.overflows) || [];
|
|
531
531
|
if (h && z.push(Z[p]), f) {
|
|
@@ -550,13 +550,13 @@ const Xe = (t) => ({
|
|
|
550
550
|
placement: j
|
|
551
551
|
}
|
|
552
552
|
};
|
|
553
|
-
let M = (_ = F.filter((
|
|
553
|
+
let M = (_ = F.filter((O) => O.overflows[0] <= 0).sort((O, S) => O.overflows[1] - S.overflows[1])[0]) == null ? void 0 : _.placement;
|
|
554
554
|
if (!M)
|
|
555
555
|
switch (u) {
|
|
556
556
|
case "bestFit": {
|
|
557
557
|
var et;
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
558
|
+
const O = (et = F.filter((S) => {
|
|
559
|
+
if (L) {
|
|
560
560
|
const V = N(S.placement);
|
|
561
561
|
return V === y || // Create a bias to the `y` side axis due to horizontal
|
|
562
562
|
// reading directions favoring greater width.
|
|
@@ -564,7 +564,7 @@ const Xe = (t) => ({
|
|
|
564
564
|
}
|
|
565
565
|
return !0;
|
|
566
566
|
}).map((S) => [S.placement, S.overflows.filter((V) => V > 0).reduce((V, we) => V + we, 0)]).sort((S, V) => S[1] - V[1])[0]) == null ? void 0 : et[0];
|
|
567
|
-
|
|
567
|
+
O && (M = O);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
case "initialPlacement":
|
|
@@ -663,11 +663,11 @@ const Ge = function(t) {
|
|
|
663
663
|
let u = a[m], d = a[f];
|
|
664
664
|
if (i) {
|
|
665
665
|
const w = m === "y" ? "top" : "left", p = m === "y" ? "bottom" : "right", y = u + h[w], x = u - h[p];
|
|
666
|
-
u =
|
|
666
|
+
u = Ot(y, u, x);
|
|
667
667
|
}
|
|
668
668
|
if (r) {
|
|
669
669
|
const w = f === "y" ? "top" : "left", p = f === "y" ? "bottom" : "right", y = d + h[w], x = d - h[p];
|
|
670
|
-
d =
|
|
670
|
+
d = Ot(y, d, x);
|
|
671
671
|
}
|
|
672
672
|
const g = c.fn({
|
|
673
673
|
...e,
|
|
@@ -1107,8 +1107,8 @@ function gn(t, e) {
|
|
|
1107
1107
|
threshold: I(0, J(1, l)) || 1
|
|
1108
1108
|
};
|
|
1109
1109
|
let b = !0;
|
|
1110
|
-
function v(
|
|
1111
|
-
const A =
|
|
1110
|
+
function v(L) {
|
|
1111
|
+
const A = L[0].intersectionRatio;
|
|
1112
1112
|
if (A !== l) {
|
|
1113
1113
|
if (!b)
|
|
1114
1114
|
return r();
|
|
@@ -1206,7 +1206,7 @@ const yn = Ge, xn = Qe, zt = Ke, vn = Xe, bn = (t, e, n) => {
|
|
|
1206
1206
|
xn(),
|
|
1207
1207
|
zt()
|
|
1208
1208
|
];
|
|
1209
|
-
d && p.push(
|
|
1209
|
+
s != null && d != null && p.push(
|
|
1210
1210
|
vn({
|
|
1211
1211
|
element: d,
|
|
1212
1212
|
padding: (s == null ? void 0 : s.padding) ?? 0
|
|
@@ -1218,9 +1218,9 @@ const yn = Ge, xn = Qe, zt = Ke, vn = Xe, bn = (t, e, n) => {
|
|
|
1218
1218
|
middleware: p
|
|
1219
1219
|
}), { x, y: b, middlewareData: v } = y;
|
|
1220
1220
|
if (u.style.top = `${b}px`, u.style.left = `${x}px`, d && v.arrow) {
|
|
1221
|
-
const { x:
|
|
1221
|
+
const { x: L, y: A } = v.arrow;
|
|
1222
1222
|
Object.assign(d.style, {
|
|
1223
|
-
left:
|
|
1223
|
+
left: L != null ? `${L}px` : "",
|
|
1224
1224
|
top: A != null ? `${A}px` : ""
|
|
1225
1225
|
});
|
|
1226
1226
|
}
|
|
@@ -1234,7 +1234,7 @@ const yn = Ge, xn = Qe, zt = Ke, vn = Xe, bn = (t, e, n) => {
|
|
|
1234
1234
|
s != null ? Rt.div(
|
|
1235
1235
|
s.content,
|
|
1236
1236
|
K((p) => {
|
|
1237
|
-
d = p;
|
|
1237
|
+
d = p, g();
|
|
1238
1238
|
})
|
|
1239
1239
|
) : null,
|
|
1240
1240
|
U(wn(c, u, g), w)
|
|
@@ -1452,7 +1452,7 @@ function _t(t) {
|
|
|
1452
1452
|
height: e.height
|
|
1453
1453
|
});
|
|
1454
1454
|
}
|
|
1455
|
-
const
|
|
1455
|
+
const Ln = (t) => ee((e) => {
|
|
1456
1456
|
const { element: n } = e, o = H(_t(n)), s = Ct(t(o))(e), i = () => {
|
|
1457
1457
|
o.set(vt.of(_t(n)));
|
|
1458
1458
|
};
|
|
@@ -1460,7 +1460,7 @@ const On = (t) => ee((e) => {
|
|
|
1460
1460
|
return typeof ResizeObserver == "function" && (r = new ResizeObserver(i), r.observe(n)), U((c) => {
|
|
1461
1461
|
r == null || r.disconnect(), s(c);
|
|
1462
1462
|
});
|
|
1463
|
-
}), Xn = (t) =>
|
|
1463
|
+
}), Xn = (t) => Ln(t), Kn = (t) => (e) => {
|
|
1464
1464
|
const n = it(), o = H({
|
|
1465
1465
|
width: (n == null ? void 0 : n.innerWidth) ?? 0,
|
|
1466
1466
|
height: (n == null ? void 0 : n.innerHeight) ?? 0
|
|
@@ -1473,7 +1473,7 @@ const On = (t) => ee((e) => {
|
|
|
1473
1473
|
return n == null || n.addEventListener("resize", i), (r) => {
|
|
1474
1474
|
n == null || n.removeEventListener("resize", i), s(r);
|
|
1475
1475
|
};
|
|
1476
|
-
},
|
|
1476
|
+
}, On = (t, e) => {
|
|
1477
1477
|
const n = e.split("/").filter((s) => s !== ""), o = {};
|
|
1478
1478
|
for (let s = 0; s < t.length; s++) {
|
|
1479
1479
|
const i = t[s], r = n[s];
|
|
@@ -1495,7 +1495,7 @@ const On = (t) => ee((e) => {
|
|
|
1495
1495
|
});
|
|
1496
1496
|
return function(o) {
|
|
1497
1497
|
for (const { segments: s, route: i } of e) {
|
|
1498
|
-
const r =
|
|
1498
|
+
const r = On(s, o);
|
|
1499
1499
|
if (r)
|
|
1500
1500
|
return { ...r, route: i };
|
|
1501
1501
|
}
|
|
@@ -1614,7 +1614,7 @@ export {
|
|
|
1614
1614
|
ie as AsyncResultView,
|
|
1615
1615
|
Hn as AutoFocus,
|
|
1616
1616
|
Un as AutoSelect,
|
|
1617
|
-
|
|
1617
|
+
Ln as ElementRect,
|
|
1618
1618
|
Xn as ElementSize,
|
|
1619
1619
|
_n as HTMLTitle,
|
|
1620
1620
|
zn as HiddenWhenEmpty,
|
|
@@ -1630,8 +1630,8 @@ export {
|
|
|
1630
1630
|
Mn as Ticker,
|
|
1631
1631
|
jn as WhenInViewport,
|
|
1632
1632
|
Kn as WindowSize,
|
|
1633
|
-
|
|
1634
|
-
|
|
1633
|
+
Oe as _checkExtensionCondition,
|
|
1634
|
+
Le as _getExtension,
|
|
1635
1635
|
Tn as _makeRouteMatcher,
|
|
1636
1636
|
Sn as _parseRouteSegments,
|
|
1637
1637
|
ke as areLocationsEqual,
|
|
@@ -1639,7 +1639,7 @@ export {
|
|
|
1639
1639
|
Te as handleAnchorClick,
|
|
1640
1640
|
oe as locationFromURL,
|
|
1641
1641
|
An as makeResource,
|
|
1642
|
-
|
|
1642
|
+
On as matchesRoute,
|
|
1643
1643
|
Pn as nowSignal,
|
|
1644
1644
|
Gn as relativeTime,
|
|
1645
1645
|
Wn as relativeTimeMillisSignal,
|
|
@@ -1647,6 +1647,6 @@ export {
|
|
|
1647
1647
|
$t as setLocationFromUrl,
|
|
1648
1648
|
Qn as ticker,
|
|
1649
1649
|
Dn as timeDiffToString,
|
|
1650
|
-
|
|
1650
|
+
Lt as urlFromLocation,
|
|
1651
1651
|
Ve as useAppearance
|
|
1652
1652
|
};
|