@tempots/ui 5.1.0 → 5.2.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 +8 -2
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Oe=Object.defineProperty;var Ae=(t,e,o)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var yt=(t,e,o)=>Ae(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),E=require("@tempots/std"),_t=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},It=(t,e)=>{const o=_t(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Re=(t,e,o,n)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const r=s;if(t.button!==0||t.ctrlKey||t.metaKey||r.target!=="_self"&&r.target!==""||r.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:l}=r;if(n){const u=i+c+l,d=r.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:It(o,i)},jt=(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=>{Re(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},qt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Et=(t,e)=>{var r;const o=new URL(t,e??((r=a.getWindow())==null?void 0:r.location.toString())),n=Object.fromEntries(o.searchParams.entries());let s=o.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:o.pathname,search:n,hash:s===""?void 0:s}},xt=(t,e)=>{const o=Et(e);return t.set(o),t},at=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Ee=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Le=t=>{const e=t.container.currentURL,o=e.iso(n=>Et(n),n=>{if(Ee(n.pathname))return at(n);const s=new URL(n.pathname,e.value),r=s.origin+s.pathname;return at({...n,pathname:r})});return{value:o,dispose:o.dispose}},Se=()=>{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}},Te=()=>{const t=a.prop(Se(),qt),e=a.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.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:n===""?void 0:n};t.set(s)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",at(n))}),{value:t,dispose:t.dispose}},Lt={mark:a.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Te();if(e.isHeadless())return Le(e);throw new Error("Unknown context")}},ke=t=>{document.startViewTransition?document.startViewTransition(t):t()},Yt=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return Yt({href:t},...e);const{href:o,withViewTransition:n,...s}=t;return a.Use(Lt,r=>a.html.a(a.on.click(jt(()=>(n==!0?ke(()=>{xt(r,a.Value.get(o))}):xt(r,a.Value.get(o)),!0),s)),a.attr.href(o),...e))},Pe={mark:a.makeProviderMark("Appearance"),create:()=>{const t=Xt();return{value:t,dispose:t.dispose}}};function Xt(){const t=a.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=a.prop(o?"dark":"light"),s=r=>n.set(r.matches?"dark":"light");return e==null||e.addEventListener("change",s),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),n}const St=(t,e)=>{if(typeof e=="function")return St(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,s=e.loading??(()=>a.Empty),r=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>s(i.map(c=>c.previousValue)),NotAsked:r})},De=(t=10)=>a.WithElement(e=>a.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),We=(t=10)=>a.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return a.OnDispose(o)}),Ce=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),Fe=t=>a.Portal("head > title",a.attr.innerText(t)),Ve={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},lt={partial:new Map,full:new Map},tt={partial:null,full:null};function Me(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=lt[t].get(o.target);n==null||n.set(o.isIntersecting)})},Ve[t])),tt[t]}const Jt=({mode:t="partial",once:e=!1},o)=>{const n=a.prop(!1);return a.Fragment(a.WithElement(s=>{const r=typeof IntersectionObserver<"u"?Me(t):null;lt[t].set(s,n),r==null||r.observe(s);function i(){var l;r==null||r.unobserve(s),lt[t].delete(s),lt[t].size===0&&((l=tt[t])==null||l.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(l=>{l&&i()})),a.OnDispose(()=>{n.dispose(),i(),c==null||c()})}),a.renderableOfTNode(o(n)))},Ne=(t,e,o)=>Jt(t,n=>a.When(n,e,o??(()=>a.Empty)));function He(t){return a.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),a.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Vt=(t,e)=>t===void 0||t===e;function Gt(t,e){return typeof t=="string"?e.key===t:Vt(t.key,e.key)&&Vt(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 a.WithElement(o=>{const n=s=>{if(o.contains(s.target)){for(const r of t)if(Gt(r,s)){e(s);break}}};return document.addEventListener("keydown",n),a.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,I=Math.max,ut=Math.round,ct=Math.floor,C=t=>({x:t,y:t}),Ue={left:"right",right:"left",bottom:"top",top:"bottom"},ze={start:"end",end:"start"};function vt(t,e,o){return I(t,J(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function j(t){return t.split("-")[0]}function st(t){return t.split("-")[1]}function Qt(t){return t==="x"?"y":"x"}function kt(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(j(t))?"y":"x"}function Pt(t){return Qt($(t))}function Be(t,e,o){o===void 0&&(o=!1);const n=st(t),s=Pt(t),r=kt(s);let i=s==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(i=ft(i)),[i,ft(i)]}function _e(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"],s=["right","left"],r=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?s:n:e?n:s;case"left":case"right":return e?r:i;default:return[]}}function je(t,e,o,n){const s=st(t);let r=Ie(j(t),o==="start",n);return s&&(r=r.map(i=>i+"-"+s),e&&(r=r.concat(r.map(bt)))),r}function ft(t){return t.replace(/left|right|bottom|top/g,e=>Ue[e])}function qe(t){return{top:0,right:0,bottom:0,left:0,...t}}function Zt(t){return typeof t!="number"?qe(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:s}=t;return{width:n,height:s,top:o,left:e,right:e+n,bottom:o+s,x:e,y:o}}function Mt(t,e,o){let{reference:n,floating:s}=t;const r=$(e),i=Pt(e),c=kt(i),l=j(e),u=r==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,g=n[c]/2-s[c]/2;let f;switch(l){case"top":f={x:d,y:n.y-s.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-s.width,y:h};break;default:f={x:n.x,y:n.y}}switch(st(e)){case"start":f[i]-=g*(o&&u?-1:1);break;case"end":f[i]+=g*(o&&u?-1:1);break}return f}const Ye=async(t,e,o)=>{const{placement:n="bottom",strategy:s="absolute",middleware:r=[],platform:i}=o,c=r.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=Mt(u,n,l),g=n,f={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:p}=c[y],{x:v,y:x,data:O,reset:b}=await p({x:d,y:h,initialPlacement:n,placement:g,strategy:s,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});d=v??d,h=x??h,f={...f,[w]:{...f[w],...O}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(u=b.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:h}=Mt(u,g,l)),y=-1)}return{x:d,y:h,placement:g,strategy:s,middlewareData:f}};async function te(t,e){var o;e===void 0&&(e={});const{x:n,y:s,platform:r,rects:i,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:f=0}=ot(e,t),m=Zt(f),w=c[g?h==="floating"?"reference":"floating":h],p=ht(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(w)))==null||o?w:w.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:l})),v=h==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),O=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},b=ht(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:l}):v);return{top:(p.top-b.top+m.top)/O.y,bottom:(b.bottom-p.bottom+m.bottom)/O.y,left:(p.left-b.left+m.left)/O.x,right:(b.right-p.right+m.right)/O.x}}const Xe=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:s,rects:r,platform:i,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=ot(t,e)||{};if(u==null)return{};const h=Zt(d),g={x:o,y:n},f=Pt(s),m=kt(f),y=await i.getDimensions(u),w=f==="y",p=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",O=r.reference[m]+r.reference[f]-g[f]-r.floating[m],b=g[f]-r.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let A=S?S[x]:0;(!A||!await(i.isElement==null?void 0:i.isElement(S)))&&(A=c.floating[x]||r.floating[m]);const U=O/2-b/2,M=A/2-y[m]/2-1,T=J(h[p],M),z=J(h[v],M),B=T,Z=A-y[m]-z,R=A/2-y[m]/2+U,_=vt(B,R,Z),N=!l.arrow&&st(s)!=null&&R!==_&&r.reference[m]/2-(R<B?T:z)-y[m]/2<0,k=N?R<B?R-B:R-Z:0;return{[f]:g[f]+k,data:{[f]:_,centerOffset:R-_-k,...N&&{alignmentOffset:k}},reset:N}}}),Je=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:s,middlewareData:r,rects:i,initialPlacement:c,platform:l,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=r.arrow)!=null&&o.alignmentOffset)return{};const p=j(s),v=$(c),x=j(c)===c,O=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=g||(x||!y?[ft(c)]:_e(c)),S=m!=="none";!g&&S&&b.push(...je(c,y,m,O));const A=[c,...b],U=await te(e,w),M=[];let T=((n=r.flip)==null?void 0:n.overflows)||[];if(d&&M.push(U[p]),h){const R=Be(s,i,O);M.push(U[R[0]],U[R[1]])}if(T=[...T,{placement:s,overflows:M}],!M.every(R=>R<=0)){var z,B;const R=(((z=r.flip)==null?void 0:z.index)||0)+1,_=A[R];if(_&&(!(h==="alignment"?v!==$(_):!1)||T.every(P=>P.overflows[0]>0&&$(P.placement)===v)))return{data:{index:R,overflows:T},reset:{placement:_}};let N=(B=T.filter(k=>k.overflows[0]<=0).sort((k,P)=>k.overflows[1]-P.overflows[1])[0])==null?void 0:B.placement;if(!N)switch(f){case"bestFit":{var Z;const k=(Z=T.filter(P=>{if(S){const H=$(P.placement);return H===v||H==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(H=>H>0).reduce((H,be)=>H+be,0)]).sort((P,H)=>P[1]-H[1])[0])==null?void 0:Z[0];k&&(N=k);break}case"initialPlacement":N=c;break}if(s!==N)return{reset:{placement:N}}}return{}}}};async function Ge(t,e){const{placement:o,platform:n,elements:s}=t,r=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=j(o),c=st(o),l=$(o)==="y",u=["left","top"].includes(i)?-1:1,d=r&&l?-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),l?{x:f*d,y:g*u}:{x:g*u,y:f*d}}const Qe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:s,y:r,placement:i,middlewareData:c}=e,l=await Ge(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:{...l,placement:i}}}}},Ze=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:s}=e,{mainAxis:r=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:p,y:v}=w;return{x:p,y:v}}},...l}=ot(t,e),u={x:o,y:n},d=await te(e,l),h=$(j(s)),g=Qt(h);let f=u[g],m=u[h];if(r){const w=g==="y"?"top":"left",p=g==="y"?"bottom":"right",v=f+d[w],x=f-d[p];f=vt(v,f,x)}if(i){const w=h==="y"?"top":"left",p=h==="y"?"bottom":"right",v=m+d[w],x=m-d[p];m=vt(v,m,x)}const y=c.fn({...e,[g]:f,[h]:m});return{...y,data:{x:y.x-o,y:y.y-n,enabled:{[g]:r,[h]:i}}}}}};function mt(){return typeof window<"u"}function Q(t){return ee(t)?(t.nodeName||"").toLowerCase():"#document"}function L(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(ee(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ee(t){return mt()?t instanceof Node||t instanceof L(t).Node:!1}function D(t){return mt()?t instanceof Element||t instanceof L(t).Element:!1}function F(t){return mt()?t instanceof HTMLElement||t instanceof L(t).HTMLElement:!1}function Nt(t){return!mt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof L(t).ShadowRoot}function rt(t){const{overflow:e,overflowX:o,overflowY:n,display:s}=W(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(s)}function tn(t){return["table","td","th"].includes(Q(t))}function gt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Dt(t){const e=Wt(),o=D(t)?W(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function en(t){let e=K(t);for(;F(e)&&!G(e);){if(Dt(e))return e;if(gt(e))return null;e=K(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 W(t){return L(t).getComputedStyle(t)}function pt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function K(t){if(Q(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Nt(t)&&t.host||V(t);return Nt(e)?e.host:e}function ne(t){const e=K(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&rt(e)?e:ne(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const s=ne(t),r=s===((n=t.ownerDocument)==null?void 0:n.body),i=L(s);if(r){const c=Ot(i);return e.concat(i,i.visualViewport||[],rt(s)?s:[],c&&o?et(c):[])}return e.concat(s,et(s,[],o))}function Ot(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function oe(t){const e=W(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=F(t),r=s?t.offsetWidth:o,i=s?t.offsetHeight:n,c=ut(o)!==r||ut(n)!==i;return c&&(o=r,n=i),{width:o,height:n,$:c}}function Ct(t){return D(t)?t:t.contextElement}function X(t){const e=Ct(t);if(!F(e))return C(1);const o=e.getBoundingClientRect(),{width:n,height:s,$:r}=oe(e);let i=(r?ut(o.width):o.width)/n,c=(r?ut(o.height):o.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const nn=C(0);function se(t){const e=L(t);return!Wt()||!e.visualViewport?nn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function on(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==L(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const s=t.getBoundingClientRect(),r=Ct(t);let i=C(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=on(r,o,n)?se(r):C(0);let l=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,d=s.width/i.x,h=s.height/i.y;if(r){const g=L(r),f=n&&D(n)?L(n):n;let m=g,y=Ot(m);for(;y&&n&&f!==m;){const w=X(y),p=y.getBoundingClientRect(),v=W(y),x=p.left+(y.clientLeft+parseFloat(v.paddingLeft))*w.x,O=p.top+(y.clientTop+parseFloat(v.paddingTop))*w.y;l*=w.x,u*=w.y,d*=w.x,h*=w.y,l+=x,u+=O,m=L(y),y=Ot(m)}}return ht({width:d,height:h,x:l,y:u})}function Ft(t,e){const o=pt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function re(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-(o?0:Ft(t,n)),r=n.top+e.scrollTop;return{x:s,y:r}}function sn(t){let{elements:e,rect:o,offsetParent:n,strategy:s}=t;const r=s==="fixed",i=V(n),c=e?gt(e.floating):!1;if(n===i||c&&r)return o;let l={scrollLeft:0,scrollTop:0},u=C(1);const d=C(0),h=F(n);if((h||!h&&!r)&&((Q(n)!=="body"||rt(i))&&(l=pt(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&&!r?re(i,l,!0):C(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-l.scrollLeft*u.x+d.x+g.x,y:o.y*u.y-l.scrollTop*u.y+d.y+g.y}}function rn(t){return Array.from(t.getClientRects())}function cn(t){const e=V(t),o=pt(t),n=t.ownerDocument.body,s=I(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=I(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Ft(t);const c=-o.scrollTop;return W(n).direction==="rtl"&&(i+=I(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:c}}function ln(t,e){const o=L(t),n=V(t),s=o.visualViewport;let r=n.clientWidth,i=n.clientHeight,c=0,l=0;if(s){r=s.width,i=s.height;const u=Wt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:r,height:i,x:c,y:l}}function an(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,s=o.left+t.clientLeft,r=F(t)?X(t):C(1),i=t.clientWidth*r.x,c=t.clientHeight*r.y,l=s*r.x,u=n*r.y;return{width:i,height:c,x:l,y:u}}function Ht(t,e,o){let n;if(e==="viewport")n=ln(t,o);else if(e==="document")n=cn(V(t));else if(D(e))n=an(e,o);else{const s=se(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ht(n)}function ie(t,e){const o=K(t);return o===e||!D(o)||G(o)?!1:W(o).position==="fixed"||ie(o,e)}function un(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&Q(c)!=="body"),s=null;const r=W(t).position==="fixed";let i=r?K(t):t;for(;D(i)&&!G(i);){const c=W(i),l=Dt(i);!l&&c.position==="fixed"&&(s=null),(r?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||rt(i)&&!l&&ie(t,i))?n=n.filter(d=>d!==i):s=c,i=K(i)}return e.set(t,n),n}function fn(t){let{element:e,boundary:o,rootBoundary:n,strategy:s}=t;const i=[...o==="clippingAncestors"?gt(e)?[]:un(e,this._c):[].concat(o),n],c=i[0],l=i.reduce((u,d)=>{const h=Ht(e,d,s);return u.top=I(h.top,u.top),u.right=J(h.right,u.right),u.bottom=J(h.bottom,u.bottom),u.left=I(h.left,u.left),u},Ht(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function hn(t){const{width:e,height:o}=oe(t);return{width:e,height:o}}function dn(t,e,o){const n=F(e),s=V(e),r=o==="fixed",i=q(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const l=C(0);function u(){l.x=Ft(s)}if(n||!n&&!r)if((Q(e)!=="body"||rt(s))&&(c=pt(e)),n){const f=q(e,!0,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&u();r&&!n&&s&&u();const d=s&&!n&&!r?re(s,c):C(0),h=i.left+c.scrollLeft-l.x-d.x,g=i.top+c.scrollTop-l.y-d.y;return{x:h,y:g,width:i.width,height:i.height}}function wt(t){return W(t).position==="static"}function $t(t,e){if(!F(t)||W(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function ce(t,e){const o=L(t);if(gt(t))return o;if(!F(t)){let s=K(t);for(;s&&!G(s);){if(D(s)&&!wt(s))return s;s=K(s)}return o}let n=$t(t,e);for(;n&&tn(n)&&wt(n);)n=$t(n,e);return n&&G(n)&&wt(n)&&!Dt(n)?o:n||en(t)||o}const mn=async function(t){const e=this.getOffsetParent||ce,o=this.getDimensions,n=await o(t.floating);return{reference:dn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function gn(t){return W(t).direction==="rtl"}const pn={convertOffsetParentRelativeRectToViewportRelativeRect:sn,getDocumentElement:V,getClippingRect:fn,getOffsetParent:ce,getElementRects:mn,getClientRects:rn,getDimensions:hn,getScale:X,isElement:D,isRTL:gn};function le(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function yn(t,e){let o=null,n;const s=V(t);function r(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function i(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),r();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(s.clientWidth-(d+g)),w=ct(s.clientHeight-(h+f)),p=ct(d),x={rootMargin:-m+"px "+-y+"px "+-w+"px "+-p+"px",threshold:I(0,J(1,l))||1};let O=!0;function b(S){const A=S[0].intersectionRatio;if(A!==l){if(!O)return i();A?i(!1,A):n=setTimeout(()=>{i(!1,1e-7)},1e3)}A===1&&!le(u,t.getBoundingClientRect())&&i(),O=!1}try{o=new IntersectionObserver(b,{...x,root:s.ownerDocument})}catch{o=new IntersectionObserver(b,x)}o.observe(t)}return i(!0),r}function wn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,u=Ct(t),d=s||r?[...u?et(u):[],...et(e)]:[];d.forEach(p=>{s&&p.addEventListener("scroll",o,{passive:!0}),r&&p.addEventListener("resize",o)});const h=u&&c?yn(u,o):null;let g=-1,f=null;i&&(f=new ResizeObserver(p=>{let[v]=p;v&&v.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(e)})),o()}),u&&!l&&f.observe(u),f.observe(e));let m,y=l?q(t):null;l&&w();function w(){const p=q(t);y&&!le(y,p)&&o(),y=p,m=requestAnimationFrame(w)}return o(),()=>{var p;d.forEach(v=>{s&&v.removeEventListener("scroll",o),r&&v.removeEventListener("resize",o)}),h==null||h(),(p=f)==null||p.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const xn=Qe,vn=Ze,Kt=Je,bn=Xe,On=(t,e,o)=>{const n=new Map,s={platform:pn,...o},r={...s.platform,_c:n};return Ye(t,e,{...s,platform:r})},An=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Rn=(t,e={isOpen:!1})=>{const o=[];let n=null;const s=a.Value.deriveProp(e.isOpen);function r(c){n=c,s.set(!0)}function i(){s.set(!1),o.forEach(c=>c()),o.length=0}return a.Fragment(t(r,i),a.When(s,()=>a.WithElement(c=>a.Portal("body",a.html.div(a.WithElement(l=>{l.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=a.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),g=a.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=a.Value.toSignal((n==null?void 0:n.placement)??"top"),m=a.Value.toSignal((n==null?void 0:n.arrowPadding)??0),y=n==null?void 0:n.arrow,w=a.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function p(){const x=[Kt(),xn({mainAxis:h.get(),crossAxis:g.get()}),vn(),Kt()];y!=null&&d!=null&&x.push(bn({element:d,padding:m.get()}));const O=await On(u,l,{placement:f.get(),strategy:"absolute",middleware:x}),{x:b,y:S,middlewareData:A}=O;if(l.style.top=`${S}px`,l.style.left=`${b}px`,d!=null&&A.arrow!=null){const{x:U,y:M,centerOffset:T,alignmentOffset:z}=A.arrow;w.set({x:U,y:M,centerOffset:T,alignmentOffset:z,containerWidth:l.offsetWidth,containerHeight:l.offsetHeight})}}const v=a.effectOf(h,g,f)(p);return a.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?a.html.div(n==null?void 0:n.arrow(a.computedOf(w,f)((x,O)=>({...x,placement:O}))),a.WithElement(x=>{d=x,p()})):null,a.OnDispose(w.dispose,wn(u,l,p),v))}))))))},ae=(t,e,o)=>{const n=a.prop(E.AsyncResult.notAsked),s=n.map(h=>E.AsyncResult.isSuccess(h)?h.value:void 0),r=n.map(h=>E.AsyncResult.isFailure(h)?h.error:void 0),i=n.map(h=>E.AsyncResult.isLoading(h));let c;const l=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=()=>l(a.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,n.dispose()};return n.onDispose(a.Value.on(t,l)),{status:n,value:s,error:r,loading:i,reload:u,dispose:d}},ue=(t,e)=>{const{status:o,dispose:n,reload:s}=t,{loading:r,failure:i,success:c}=e;return a.Fragment(a.OnDispose(n),St(o,{loading:r!=null?l=>r(l,s):void 0,failure:i!=null?l=>i(l,s):void 0,success:l=>c(l,s)}))},En=({request:t,load:e,mapError:o=n=>n})=>{const n=ae(t,e,o);return s=>ue(n,s)},fe=(t,e)=>{if(typeof e=="function")return fe(t,{success:e});const o=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(r=>`Error: ${r}`))),n=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:s=>n(s.$.value),Failure:s=>o(s.$.error)})},Ln=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,o,n,s){yt(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=s}static of({left:e=0,top:o=0,width:n=0,height:s=0}){return new it(e,o,n,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 he=t=>a.WithBrowserCtx(e=>{const{element:o}=e,n=a.prop(At(o)),s=a.renderableOfTNode(t(n))(e),r=()=>{n.set(it.of(At(o)))};let i;return typeof ResizeObserver=="function"&&(i=new ResizeObserver(r),i.observe(o)),a.OnDispose(c=>{i==null||i.disconnect(),s(c)})}),Sn=t=>he(t),Tn=t=>e=>{const o=a.getWindow(),n=a.prop({width:(o==null?void 0:o.innerWidth)??0,height:(o==null?void 0:o.innerHeight)??0}),s=a.renderableOfTNode(t(n))(e),r=()=>{n.set({width:(o==null?void 0:o.innerWidth)??0,height:(o==null?void 0:o.innerHeight)??0})};return o==null||o.addEventListener("resize",r),i=>{o==null||o.removeEventListener("resize",r),s(i)}},de=(t,e)=>{const o=e.split("/").filter(s=>s!==""),n={};for(let s=0;s<t.length;s++){const r=t[s],i=o[s];if(!i&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==i)return null}else if(r.type==="param")n[r.name]=i;else if(r.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},me=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!==""),ge=t=>{const e=t.map(o=>{const n=me(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:r}of e){const i=de(s,n);if(i)return{...i,route:r}}return null}},kn=t=>{const e=ge(Object.keys(t));return a.Use(Lt,o=>{const n=o.map(s=>{const r=e(s.pathname);if(r==null)throw console.error("No route found for",s),new Error("No route found");return{params:r.params,route:r.route,path:r.path,search:s.search,hash:s.hash}});return a.OneOfTuple(n.map(s=>[s.route,s]),t)})},dt=60*1e3,Rt=60*dt,nt=24*Rt,Ut=7*nt,zt=30*nt,Pn=365*nt,Dn=[{max:dt*90,value:dt,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:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Ut*6,value:Ut,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:zt*18,value:zt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Pn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Bt(t,e,o,n){const s=Math.round(t/e);return s<=1?o:n.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const pe=(t=1e3)=>{const e=a.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},ye=t=>{const e=Math.abs(t);if(e<dt)return t<0?"just now":"in a moment";for(const o of Dn)if(e<o.max)return t<0?Bt(e,o.value,o.past.singular,o.past.plural):Bt(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},we=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?a.Signal.is(e)?e.derive():a.prop(e):pe(o),s=a.computedOf(t,n)((r,i)=>r.getTime()-i.getTime());return s.onDispose(()=>a.Value.dispose(n)),s},xe=(t,e={})=>{const o=we(t,e),n=o.map(ye);return n.onDispose(o.dispose),n},Wn=(t,e={})=>xe(t,e);class ve extends a.Prop{constructor(){super(...arguments);yt(this,"tick",()=>this.update(o=>o+1))}}const Cn=(t=0)=>new ve(t,(e,o)=>e===o);exports.Anchor=Yt;exports.Appearance=Pe;exports.AsyncResultView=St;exports.AutoFocus=De;exports.AutoSelect=We;exports.ElementRect=he;exports.ElementSize=Sn;exports.HTMLTitle=Fe;exports.HiddenWhenEmpty=Ce;exports.InViewport=Jt;exports.Location=Lt;exports.OnClickOutside=He;exports.OnEnterKey=$e;exports.OnEscapeKey=Ke;exports.OnKeyPressed=Tt;exports.PopOver=Rn;exports.Rect=it;exports.Resource=En;exports.ResourceDisplay=ue;exports.ResultView=fe;exports.Router=kn;exports.SelectOnFocus=Ln;exports.Ticker=ve;exports.WhenInViewport=Ne;exports.WindowSize=Tn;exports._checkExtensionCondition=It;exports._getExtension=_t;exports._makeRouteMatcher=ge;exports._parseRouteSegments=me;exports.allPlacements=An;exports.areLocationsEqual=qt;exports.getAbsoluteRect=At;exports.handleAnchorClick=jt;exports.locationFromURL=Et;exports.makeResource=ae;exports.matchesKeyCombo=Gt;exports.matchesRoute=de;exports.nowSignal=pe;exports.relativeTime=Wn;exports.relativeTimeMillisSignal=we;exports.relativeTimeSignal=xe;exports.setLocationFromUrl=xt;exports.ticker=Cn;exports.timeDiffToString=ye;exports.urlFromLocation=at;exports.useAppearance=Xt;
|
|
1
|
+
"use strict";var Oe=Object.defineProperty;var Ae=(t,e,o)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var yt=(t,e,o)=>Ae(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),E=require("@tempots/std"),_t=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},It=(t,e)=>{const o=_t(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Re=(t,e,o,n)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const r=s;if(t.button!==0||t.ctrlKey||t.metaKey||r.target!=="_self"&&r.target!==""||r.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:l}=r;if(n){const u=i+c+l,d=r.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:It(o,i)},jt=(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=>{Re(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},qt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Et=(t,e)=>{var r;const o=new URL(t,e??((r=a.getWindow())==null?void 0:r.location.toString())),n=Object.fromEntries(o.searchParams.entries());let s=o.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:o.pathname,search:n,hash:s===""?void 0:s}},xt=(t,e)=>{const o=Et(e);return t.set(o),t},at=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Ee=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Le=t=>{const e=t.container.currentURL,o=e.iso(n=>Et(n),n=>{if(Ee(n.pathname))return at(n);const s=new URL(n.pathname,e.value),r=s.origin+s.pathname;return at({...n,pathname:r})});return{value:o,dispose:o.dispose}},Se=()=>{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}},Te=()=>{const t=a.prop(Se(),qt),e=a.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.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:n===""?void 0:n};t.set(s)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",at(n))}),{value:t,dispose:t.dispose}},Lt={mark:a.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Te();if(e.isHeadless())return Le(e);throw new Error("Unknown context")}},ke=t=>{document.startViewTransition?document.startViewTransition(t):t()},Yt=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return Yt({href:t},...e);const{href:o,withViewTransition:n,...s}=t;return a.Use(Lt,r=>a.html.a(a.on.click(jt(()=>(n===!0?ke(()=>{xt(r,a.Value.get(o))}):xt(r,a.Value.get(o)),!0),s)),a.attr.href(o),...e))},Pe={mark:a.makeProviderMark("Appearance"),create:()=>{const t=Xt();return{value:t,dispose:t.dispose}}};function Xt(){const t=a.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=a.prop(o?"dark":"light"),s=r=>n.set(r.matches?"dark":"light");return e==null||e.addEventListener("change",s),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),n}const St=(t,e)=>{if(typeof e=="function")return St(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,s=e.loading??(()=>a.Empty),r=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>s(i.map(c=>c.previousValue)),NotAsked:r})},De=(t=10)=>a.WithElement(e=>a.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),We=(t=10)=>a.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return a.OnDispose(o)}),Ce=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),Fe=t=>a.Portal("head > title",a.attr.innerText(t)),Ve={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},lt={partial:new Map,full:new Map},tt={partial:null,full:null};function Me(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=lt[t].get(o.target);n==null||n.set(o.isIntersecting)})},Ve[t])),tt[t]}const Jt=({mode:t="partial",once:e=!1},o)=>{const n=a.prop(!1);return a.Fragment(a.WithElement(s=>{const r=typeof IntersectionObserver<"u"?Me(t):null;lt[t].set(s,n),r==null||r.observe(s);function i(){var l;r==null||r.unobserve(s),lt[t].delete(s),lt[t].size===0&&((l=tt[t])==null||l.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(l=>{l&&i()})),a.OnDispose(()=>{n.dispose(),i(),c==null||c()})}),a.renderableOfTNode(o(n)))},Ne=(t,e,o)=>Jt(t,n=>a.When(n,e,o??(()=>a.Empty)));function He(t){return a.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),a.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Vt=(t,e)=>t===void 0||t===e;function Gt(t,e){return typeof t=="string"?e.key===t:Vt(t.key,e.key)&&Vt(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 a.WithElement(o=>{const n=s=>{if(o.contains(s.target)){for(const r of t)if(Gt(r,s)){e(s);break}}};return document.addEventListener("keydown",n),a.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,I=Math.max,ut=Math.round,ct=Math.floor,C=t=>({x:t,y:t}),Ue={left:"right",right:"left",bottom:"top",top:"bottom"},ze={start:"end",end:"start"};function vt(t,e,o){return I(t,J(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function j(t){return t.split("-")[0]}function st(t){return t.split("-")[1]}function Qt(t){return t==="x"?"y":"x"}function kt(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(j(t))?"y":"x"}function Pt(t){return Qt($(t))}function Be(t,e,o){o===void 0&&(o=!1);const n=st(t),s=Pt(t),r=kt(s);let i=s==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(i=ft(i)),[i,ft(i)]}function _e(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"],s=["right","left"],r=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?s:n:e?n:s;case"left":case"right":return e?r:i;default:return[]}}function je(t,e,o,n){const s=st(t);let r=Ie(j(t),o==="start",n);return s&&(r=r.map(i=>i+"-"+s),e&&(r=r.concat(r.map(bt)))),r}function ft(t){return t.replace(/left|right|bottom|top/g,e=>Ue[e])}function qe(t){return{top:0,right:0,bottom:0,left:0,...t}}function Zt(t){return typeof t!="number"?qe(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:s}=t;return{width:n,height:s,top:o,left:e,right:e+n,bottom:o+s,x:e,y:o}}function Mt(t,e,o){let{reference:n,floating:s}=t;const r=$(e),i=Pt(e),c=kt(i),l=j(e),u=r==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,g=n[c]/2-s[c]/2;let f;switch(l){case"top":f={x:d,y:n.y-s.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-s.width,y:h};break;default:f={x:n.x,y:n.y}}switch(st(e)){case"start":f[i]-=g*(o&&u?-1:1);break;case"end":f[i]+=g*(o&&u?-1:1);break}return f}const Ye=async(t,e,o)=>{const{placement:n="bottom",strategy:s="absolute",middleware:r=[],platform:i}=o,c=r.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=Mt(u,n,l),g=n,f={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:p}=c[y],{x:v,y:x,data:O,reset:b}=await p({x:d,y:h,initialPlacement:n,placement:g,strategy:s,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});d=v??d,h=x??h,f={...f,[w]:{...f[w],...O}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(u=b.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:h}=Mt(u,g,l)),y=-1)}return{x:d,y:h,placement:g,strategy:s,middlewareData:f}};async function te(t,e){var o;e===void 0&&(e={});const{x:n,y:s,platform:r,rects:i,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:f=0}=ot(e,t),m=Zt(f),w=c[g?h==="floating"?"reference":"floating":h],p=ht(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(w)))==null||o?w:w.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:l})),v=h==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),O=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},b=ht(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:l}):v);return{top:(p.top-b.top+m.top)/O.y,bottom:(b.bottom-p.bottom+m.bottom)/O.y,left:(p.left-b.left+m.left)/O.x,right:(b.right-p.right+m.right)/O.x}}const Xe=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:s,rects:r,platform:i,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=ot(t,e)||{};if(u==null)return{};const h=Zt(d),g={x:o,y:n},f=Pt(s),m=kt(f),y=await i.getDimensions(u),w=f==="y",p=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",O=r.reference[m]+r.reference[f]-g[f]-r.floating[m],b=g[f]-r.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let A=S?S[x]:0;(!A||!await(i.isElement==null?void 0:i.isElement(S)))&&(A=c.floating[x]||r.floating[m]);const U=O/2-b/2,M=A/2-y[m]/2-1,T=J(h[p],M),z=J(h[v],M),B=T,Z=A-y[m]-z,R=A/2-y[m]/2+U,_=vt(B,R,Z),N=!l.arrow&&st(s)!=null&&R!==_&&r.reference[m]/2-(R<B?T:z)-y[m]/2<0,k=N?R<B?R-B:R-Z:0;return{[f]:g[f]+k,data:{[f]:_,centerOffset:R-_-k,...N&&{alignmentOffset:k}},reset:N}}}),Je=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:s,middlewareData:r,rects:i,initialPlacement:c,platform:l,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=r.arrow)!=null&&o.alignmentOffset)return{};const p=j(s),v=$(c),x=j(c)===c,O=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=g||(x||!y?[ft(c)]:_e(c)),S=m!=="none";!g&&S&&b.push(...je(c,y,m,O));const A=[c,...b],U=await te(e,w),M=[];let T=((n=r.flip)==null?void 0:n.overflows)||[];if(d&&M.push(U[p]),h){const R=Be(s,i,O);M.push(U[R[0]],U[R[1]])}if(T=[...T,{placement:s,overflows:M}],!M.every(R=>R<=0)){var z,B;const R=(((z=r.flip)==null?void 0:z.index)||0)+1,_=A[R];if(_&&(!(h==="alignment"?v!==$(_):!1)||T.every(P=>P.overflows[0]>0&&$(P.placement)===v)))return{data:{index:R,overflows:T},reset:{placement:_}};let N=(B=T.filter(k=>k.overflows[0]<=0).sort((k,P)=>k.overflows[1]-P.overflows[1])[0])==null?void 0:B.placement;if(!N)switch(f){case"bestFit":{var Z;const k=(Z=T.filter(P=>{if(S){const H=$(P.placement);return H===v||H==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(H=>H>0).reduce((H,be)=>H+be,0)]).sort((P,H)=>P[1]-H[1])[0])==null?void 0:Z[0];k&&(N=k);break}case"initialPlacement":N=c;break}if(s!==N)return{reset:{placement:N}}}return{}}}};async function Ge(t,e){const{placement:o,platform:n,elements:s}=t,r=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=j(o),c=st(o),l=$(o)==="y",u=["left","top"].includes(i)?-1:1,d=r&&l?-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),l?{x:f*d,y:g*u}:{x:g*u,y:f*d}}const Qe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:s,y:r,placement:i,middlewareData:c}=e,l=await Ge(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:{...l,placement:i}}}}},Ze=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:s}=e,{mainAxis:r=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:p,y:v}=w;return{x:p,y:v}}},...l}=ot(t,e),u={x:o,y:n},d=await te(e,l),h=$(j(s)),g=Qt(h);let f=u[g],m=u[h];if(r){const w=g==="y"?"top":"left",p=g==="y"?"bottom":"right",v=f+d[w],x=f-d[p];f=vt(v,f,x)}if(i){const w=h==="y"?"top":"left",p=h==="y"?"bottom":"right",v=m+d[w],x=m-d[p];m=vt(v,m,x)}const y=c.fn({...e,[g]:f,[h]:m});return{...y,data:{x:y.x-o,y:y.y-n,enabled:{[g]:r,[h]:i}}}}}};function mt(){return typeof window<"u"}function Q(t){return ee(t)?(t.nodeName||"").toLowerCase():"#document"}function L(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(ee(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ee(t){return mt()?t instanceof Node||t instanceof L(t).Node:!1}function D(t){return mt()?t instanceof Element||t instanceof L(t).Element:!1}function F(t){return mt()?t instanceof HTMLElement||t instanceof L(t).HTMLElement:!1}function Nt(t){return!mt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof L(t).ShadowRoot}function rt(t){const{overflow:e,overflowX:o,overflowY:n,display:s}=W(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(s)}function tn(t){return["table","td","th"].includes(Q(t))}function gt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Dt(t){const e=Wt(),o=D(t)?W(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function en(t){let e=K(t);for(;F(e)&&!G(e);){if(Dt(e))return e;if(gt(e))return null;e=K(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 W(t){return L(t).getComputedStyle(t)}function pt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function K(t){if(Q(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Nt(t)&&t.host||V(t);return Nt(e)?e.host:e}function ne(t){const e=K(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&rt(e)?e:ne(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const s=ne(t),r=s===((n=t.ownerDocument)==null?void 0:n.body),i=L(s);if(r){const c=Ot(i);return e.concat(i,i.visualViewport||[],rt(s)?s:[],c&&o?et(c):[])}return e.concat(s,et(s,[],o))}function Ot(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function oe(t){const e=W(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=F(t),r=s?t.offsetWidth:o,i=s?t.offsetHeight:n,c=ut(o)!==r||ut(n)!==i;return c&&(o=r,n=i),{width:o,height:n,$:c}}function Ct(t){return D(t)?t:t.contextElement}function X(t){const e=Ct(t);if(!F(e))return C(1);const o=e.getBoundingClientRect(),{width:n,height:s,$:r}=oe(e);let i=(r?ut(o.width):o.width)/n,c=(r?ut(o.height):o.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const nn=C(0);function se(t){const e=L(t);return!Wt()||!e.visualViewport?nn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function on(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==L(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const s=t.getBoundingClientRect(),r=Ct(t);let i=C(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=on(r,o,n)?se(r):C(0);let l=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,d=s.width/i.x,h=s.height/i.y;if(r){const g=L(r),f=n&&D(n)?L(n):n;let m=g,y=Ot(m);for(;y&&n&&f!==m;){const w=X(y),p=y.getBoundingClientRect(),v=W(y),x=p.left+(y.clientLeft+parseFloat(v.paddingLeft))*w.x,O=p.top+(y.clientTop+parseFloat(v.paddingTop))*w.y;l*=w.x,u*=w.y,d*=w.x,h*=w.y,l+=x,u+=O,m=L(y),y=Ot(m)}}return ht({width:d,height:h,x:l,y:u})}function Ft(t,e){const o=pt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function re(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-(o?0:Ft(t,n)),r=n.top+e.scrollTop;return{x:s,y:r}}function sn(t){let{elements:e,rect:o,offsetParent:n,strategy:s}=t;const r=s==="fixed",i=V(n),c=e?gt(e.floating):!1;if(n===i||c&&r)return o;let l={scrollLeft:0,scrollTop:0},u=C(1);const d=C(0),h=F(n);if((h||!h&&!r)&&((Q(n)!=="body"||rt(i))&&(l=pt(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&&!r?re(i,l,!0):C(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-l.scrollLeft*u.x+d.x+g.x,y:o.y*u.y-l.scrollTop*u.y+d.y+g.y}}function rn(t){return Array.from(t.getClientRects())}function cn(t){const e=V(t),o=pt(t),n=t.ownerDocument.body,s=I(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=I(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Ft(t);const c=-o.scrollTop;return W(n).direction==="rtl"&&(i+=I(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:c}}function ln(t,e){const o=L(t),n=V(t),s=o.visualViewport;let r=n.clientWidth,i=n.clientHeight,c=0,l=0;if(s){r=s.width,i=s.height;const u=Wt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:r,height:i,x:c,y:l}}function an(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,s=o.left+t.clientLeft,r=F(t)?X(t):C(1),i=t.clientWidth*r.x,c=t.clientHeight*r.y,l=s*r.x,u=n*r.y;return{width:i,height:c,x:l,y:u}}function Ht(t,e,o){let n;if(e==="viewport")n=ln(t,o);else if(e==="document")n=cn(V(t));else if(D(e))n=an(e,o);else{const s=se(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ht(n)}function ie(t,e){const o=K(t);return o===e||!D(o)||G(o)?!1:W(o).position==="fixed"||ie(o,e)}function un(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&Q(c)!=="body"),s=null;const r=W(t).position==="fixed";let i=r?K(t):t;for(;D(i)&&!G(i);){const c=W(i),l=Dt(i);!l&&c.position==="fixed"&&(s=null),(r?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||rt(i)&&!l&&ie(t,i))?n=n.filter(d=>d!==i):s=c,i=K(i)}return e.set(t,n),n}function fn(t){let{element:e,boundary:o,rootBoundary:n,strategy:s}=t;const i=[...o==="clippingAncestors"?gt(e)?[]:un(e,this._c):[].concat(o),n],c=i[0],l=i.reduce((u,d)=>{const h=Ht(e,d,s);return u.top=I(h.top,u.top),u.right=J(h.right,u.right),u.bottom=J(h.bottom,u.bottom),u.left=I(h.left,u.left),u},Ht(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function hn(t){const{width:e,height:o}=oe(t);return{width:e,height:o}}function dn(t,e,o){const n=F(e),s=V(e),r=o==="fixed",i=q(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const l=C(0);function u(){l.x=Ft(s)}if(n||!n&&!r)if((Q(e)!=="body"||rt(s))&&(c=pt(e)),n){const f=q(e,!0,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&u();r&&!n&&s&&u();const d=s&&!n&&!r?re(s,c):C(0),h=i.left+c.scrollLeft-l.x-d.x,g=i.top+c.scrollTop-l.y-d.y;return{x:h,y:g,width:i.width,height:i.height}}function wt(t){return W(t).position==="static"}function $t(t,e){if(!F(t)||W(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function ce(t,e){const o=L(t);if(gt(t))return o;if(!F(t)){let s=K(t);for(;s&&!G(s);){if(D(s)&&!wt(s))return s;s=K(s)}return o}let n=$t(t,e);for(;n&&tn(n)&&wt(n);)n=$t(n,e);return n&&G(n)&&wt(n)&&!Dt(n)?o:n||en(t)||o}const mn=async function(t){const e=this.getOffsetParent||ce,o=this.getDimensions,n=await o(t.floating);return{reference:dn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function gn(t){return W(t).direction==="rtl"}const pn={convertOffsetParentRelativeRectToViewportRelativeRect:sn,getDocumentElement:V,getClippingRect:fn,getOffsetParent:ce,getElementRects:mn,getClientRects:rn,getDimensions:hn,getScale:X,isElement:D,isRTL:gn};function le(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function yn(t,e){let o=null,n;const s=V(t);function r(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function i(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),r();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(s.clientWidth-(d+g)),w=ct(s.clientHeight-(h+f)),p=ct(d),x={rootMargin:-m+"px "+-y+"px "+-w+"px "+-p+"px",threshold:I(0,J(1,l))||1};let O=!0;function b(S){const A=S[0].intersectionRatio;if(A!==l){if(!O)return i();A?i(!1,A):n=setTimeout(()=>{i(!1,1e-7)},1e3)}A===1&&!le(u,t.getBoundingClientRect())&&i(),O=!1}try{o=new IntersectionObserver(b,{...x,root:s.ownerDocument})}catch{o=new IntersectionObserver(b,x)}o.observe(t)}return i(!0),r}function wn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,u=Ct(t),d=s||r?[...u?et(u):[],...et(e)]:[];d.forEach(p=>{s&&p.addEventListener("scroll",o,{passive:!0}),r&&p.addEventListener("resize",o)});const h=u&&c?yn(u,o):null;let g=-1,f=null;i&&(f=new ResizeObserver(p=>{let[v]=p;v&&v.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(e)})),o()}),u&&!l&&f.observe(u),f.observe(e));let m,y=l?q(t):null;l&&w();function w(){const p=q(t);y&&!le(y,p)&&o(),y=p,m=requestAnimationFrame(w)}return o(),()=>{var p;d.forEach(v=>{s&&v.removeEventListener("scroll",o),r&&v.removeEventListener("resize",o)}),h==null||h(),(p=f)==null||p.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const xn=Qe,vn=Ze,Kt=Je,bn=Xe,On=(t,e,o)=>{const n=new Map,s={platform:pn,...o},r={...s.platform,_c:n};return Ye(t,e,{...s,platform:r})},An=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Rn=(t,e={isOpen:!1})=>{const o=[];let n=null;const s=a.Value.deriveProp(e.isOpen);function r(c){n=c,s.set(!0)}function i(){s.set(!1),o.forEach(c=>c()),o.length=0}return a.Fragment(t(r,i),a.When(s,()=>a.WithElement(c=>a.Portal("body",a.html.div(a.WithElement(l=>{l.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=a.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),g=a.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=a.Value.toSignal((n==null?void 0:n.placement)??"top"),m=a.Value.toSignal((n==null?void 0:n.arrowPadding)??0),y=n==null?void 0:n.arrow,w=a.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function p(){const x=[Kt(),xn({mainAxis:h.get(),crossAxis:g.get()}),vn(),Kt()];y!=null&&d!=null&&x.push(bn({element:d,padding:m.get()}));const O=await On(u,l,{placement:f.get(),strategy:"absolute",middleware:x}),{x:b,y:S,middlewareData:A}=O;if(l.style.top=`${S}px`,l.style.left=`${b}px`,d!=null&&A.arrow!=null){const{x:U,y:M,centerOffset:T,alignmentOffset:z}=A.arrow;w.set({x:U,y:M,centerOffset:T,alignmentOffset:z,containerWidth:l.offsetWidth,containerHeight:l.offsetHeight})}}const v=a.effectOf(h,g,f)(p);return a.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?a.html.div(n==null?void 0:n.arrow(a.computedOf(w,f)((x,O)=>({...x,placement:O}))),a.WithElement(x=>{d=x,p()})):null,a.OnDispose(w.dispose,wn(u,l,p),v))}))))))},ae=(t,e,o)=>{const n=a.prop(E.AsyncResult.notAsked),s=n.map(h=>E.AsyncResult.isSuccess(h)?h.value:void 0),r=n.map(h=>E.AsyncResult.isFailure(h)?h.error:void 0),i=n.map(h=>E.AsyncResult.isLoading(h));let c;const l=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=()=>l(a.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,n.dispose()};return n.onDispose(a.Value.on(t,l)),{status:n,value:s,error:r,loading:i,reload:u,dispose:d}},ue=(t,e)=>{const{status:o,dispose:n,reload:s}=t,{loading:r,failure:i,success:c}=e;return a.Fragment(a.OnDispose(n),St(o,{loading:r!=null?l=>r(l,s):void 0,failure:i!=null?l=>i(l,s):void 0,success:l=>c(l,s)}))},En=({request:t,load:e,mapError:o=n=>n})=>{const n=ae(t,e,o);return s=>ue(n,s)},fe=(t,e)=>{if(typeof e=="function")return fe(t,{success:e});const o=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(r=>`Error: ${r}`))),n=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:s=>n(s.$.value),Failure:s=>o(s.$.error)})},Ln=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,o,n,s){yt(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=s}static of({left:e=0,top:o=0,width:n=0,height:s=0}){return new it(e,o,n,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 he=t=>a.WithBrowserCtx(e=>{const{element:o}=e,n=a.prop(At(o)),s=a.renderableOfTNode(t(n))(e),r=()=>{n.set(it.of(At(o)))};let i;return typeof ResizeObserver=="function"&&(i=new ResizeObserver(r),i.observe(o)),a.OnDispose(c=>{i==null||i.disconnect(),s(c)})}),Sn=t=>he(t),Tn=t=>e=>{const o=a.getWindow(),n=a.prop({width:(o==null?void 0:o.innerWidth)??0,height:(o==null?void 0:o.innerHeight)??0}),s=a.renderableOfTNode(t(n))(e),r=()=>{n.set({width:(o==null?void 0:o.innerWidth)??0,height:(o==null?void 0:o.innerHeight)??0})};return o==null||o.addEventListener("resize",r),i=>{o==null||o.removeEventListener("resize",r),s(i)}},de=(t,e)=>{const o=e.split("/").filter(s=>s!==""),n={};for(let s=0;s<t.length;s++){const r=t[s],i=o[s];if(!i&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==i)return null}else if(r.type==="param")n[r.name]=i;else if(r.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},me=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!==""),ge=t=>{const e=t.map(o=>{const n=me(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:r}of e){const i=de(s,n);if(i)return{...i,route:r}}return null}},kn=t=>{const e=ge(Object.keys(t));return a.Use(Lt,o=>{const n=o.map(s=>{const r=e(s.pathname);if(r==null)throw console.error("No route found for",s),new Error("No route found");return{params:r.params,route:r.route,path:r.path,search:s.search,hash:s.hash}});return a.OneOfTuple(n.map(s=>[s.route,s]),t)})},dt=60*1e3,Rt=60*dt,nt=24*Rt,Ut=7*nt,zt=30*nt,Pn=365*nt,Dn=[{max:dt*90,value:dt,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:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Ut*6,value:Ut,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:zt*18,value:zt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Pn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Bt(t,e,o,n){const s=Math.round(t/e);return s<=1?o:n.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const pe=(t=1e3)=>{const e=a.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},ye=t=>{const e=Math.abs(t);if(e<dt)return t<0?"just now":"in a moment";for(const o of Dn)if(e<o.max)return t<0?Bt(e,o.value,o.past.singular,o.past.plural):Bt(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},we=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?a.Signal.is(e)?e.derive():a.prop(e):pe(o),s=a.computedOf(t,n)((r,i)=>r.getTime()-i.getTime());return s.onDispose(()=>a.Value.dispose(n)),s},xe=(t,e={})=>{const o=we(t,e),n=o.map(ye);return n.onDispose(o.dispose),n},Wn=(t,e={})=>xe(t,e);class ve extends a.Prop{constructor(){super(...arguments);yt(this,"tick",()=>this.update(o=>o+1))}}const Cn=(t=0)=>new ve(t,(e,o)=>e===o);exports.Anchor=Yt;exports.Appearance=Pe;exports.AsyncResultView=St;exports.AutoFocus=De;exports.AutoSelect=We;exports.ElementRect=he;exports.ElementSize=Sn;exports.HTMLTitle=Fe;exports.HiddenWhenEmpty=Ce;exports.InViewport=Jt;exports.Location=Lt;exports.OnClickOutside=He;exports.OnEnterKey=$e;exports.OnEscapeKey=Ke;exports.OnKeyPressed=Tt;exports.PopOver=Rn;exports.Rect=it;exports.Resource=En;exports.ResourceDisplay=ue;exports.ResultView=fe;exports.Router=kn;exports.SelectOnFocus=Ln;exports.Ticker=ve;exports.WhenInViewport=Ne;exports.WindowSize=Tn;exports._checkExtensionCondition=It;exports._getExtension=_t;exports._makeRouteMatcher=ge;exports._parseRouteSegments=me;exports.allPlacements=An;exports.areLocationsEqual=qt;exports.getAbsoluteRect=At;exports.handleAnchorClick=jt;exports.locationFromURL=Et;exports.makeResource=ae;exports.matchesKeyCombo=Gt;exports.matchesRoute=de;exports.nowSignal=pe;exports.relativeTime=Wn;exports.relativeTimeMillisSignal=we;exports.relativeTimeSignal=xe;exports.setLocationFromUrl=xt;exports.ticker=Cn;exports.timeDiffToString=ye;exports.urlFromLocation=at;exports.useAppearance=Xt;
|
package/index.js
CHANGED
|
@@ -120,12 +120,13 @@ const Te = (t) => {
|
|
|
120
120
|
} = t;
|
|
121
121
|
return Gt(ie, (r) => Rt.a(
|
|
122
122
|
Qt.click(
|
|
123
|
-
De(() => (n
|
|
123
|
+
De(() => (n === !0 ? Ne(() => {
|
|
124
124
|
$t(r, E.get(o));
|
|
125
125
|
}) : $t(r, E.get(o)), !0), s)
|
|
126
126
|
),
|
|
127
127
|
Zt.href(o),
|
|
128
128
|
...e
|
|
129
|
+
/* c8 ignore next 2 */
|
|
129
130
|
));
|
|
130
131
|
}, Kn = {
|
|
131
132
|
mark: Xt("Appearance"),
|
|
@@ -1261,7 +1262,10 @@ const An = en, On = nn, _t = Ze, Rn = Qe, En = (t, e, o) => {
|
|
|
1261
1262
|
if (a == null)
|
|
1262
1263
|
throw new Error(`Target not found: ${n == null ? void 0 : n.target}`);
|
|
1263
1264
|
let h = null;
|
|
1264
|
-
const f = E.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), m = E.toSignal((n == null ? void 0 : n.crossAxisOffset) ?? 0), u = E.toSignal(
|
|
1265
|
+
const f = E.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), m = E.toSignal((n == null ? void 0 : n.crossAxisOffset) ?? 0), u = E.toSignal(
|
|
1266
|
+
/* c8 ignore next 3 */
|
|
1267
|
+
(n == null ? void 0 : n.placement) ?? "top"
|
|
1268
|
+
), d = E.toSignal((n == null ? void 0 : n.arrowPadding) ?? 0), p = n == null ? void 0 : n.arrow, w = H({
|
|
1265
1269
|
centerOffset: 0,
|
|
1266
1270
|
alignmentOffset: 0,
|
|
1267
1271
|
containerWidth: 0,
|
|
@@ -1562,6 +1566,7 @@ const Pn = (t) => Re((e) => {
|
|
|
1562
1566
|
height: (o == null ? void 0 : o.innerHeight) ?? 0
|
|
1563
1567
|
}), s = Dt(t(n))(e), r = () => {
|
|
1564
1568
|
n.set({
|
|
1569
|
+
/* c8 ignore next 6 */
|
|
1565
1570
|
width: (o == null ? void 0 : o.innerWidth) ?? 0,
|
|
1566
1571
|
height: (o == null ? void 0 : o.innerHeight) ?? 0
|
|
1567
1572
|
});
|
|
@@ -1616,6 +1621,7 @@ const Pn = (t) => Re((e) => {
|
|
|
1616
1621
|
n.map((s) => [s.route, s]),
|
|
1617
1622
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1618
1623
|
t
|
|
1624
|
+
/* c8 ignore next 2 */
|
|
1619
1625
|
);
|
|
1620
1626
|
});
|
|
1621
1627
|
}, wt = 60 * 1e3, kt = 60 * wt, it = 24 * kt, jt = 7 * it, Yt = 30 * it, Wn = 365 * it, Fn = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/ui",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"@floating-ui/dom": "^1.6.7"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@tempots/std": "0.
|
|
43
|
+
"@tempots/std": "0.22.1"
|
|
44
44
|
}
|
|
45
45
|
}
|