@tempots/ui 2.9.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,7 +38,7 @@ const focusedInput = html.input(
38
38
 
39
39
  // Create an element that detects when it's in the viewport
40
40
  const lazyLoadedContent = InViewport(
41
- { threshold: 0.5 }, // Options for intersection observer
41
+ {}, // Options for intersection observer
42
42
  (isVisible) => isVisible.value
43
43
  ? html.div('Content is visible!')
44
44
  : html.div('Loading...')
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var me=Object.defineProperty;var ge=(t,e,n)=>e in t?me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ft=(t,e,n)=>ge(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),R=require("@tempots/std"),Ut=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Bt=(t,e)=>{const n=Ut(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},ye=(t,e,n,o)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const i=s;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:r,search:c,hash:l}=i;if(o){const a=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==a)return!0}return e?!1:Bt(n,r)},Ht=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(o=>o.startsWith(".")?o:"."+o):[];return o=>{ye(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},$t=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,wt=(t,e)=>{var i;const n=new URL(t,e??((i=u.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},ht=(t,e)=>{const n=wt(e);return t.set(n),t},Z=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},we=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),xe=t=>{const e=t.container.currentURL,n=e.iso(o=>wt(o),o=>{if(we(o.pathname))return Z(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return Z({...o,pathname:i})});return{value:n,dispose:n.dispose}},ve=()=>{const t=u.getWindow(),e=(t==null?void 0:t.location.hash)===""?void 0:(t==null?void 0:t.location.hash.substring(1))??void 0;return{pathname:(t==null?void 0:t.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((t==null?void 0:t.location.search)??"").entries()),hash:e}},be=()=>{const t=u.prop(ve(),$t),e=u.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",Z(o))}),{value:t,dispose:t.dispose}},xt={mark:u.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return be();if(e.isHeadless())return xe(e);throw new Error("Unknown context")}},Re=t=>{document.startViewTransition?document.startViewTransition(t):t()},zt=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return zt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return u.Use(xt,i=>u.html.a(u.on.click(Ht(()=>(o==!0?Re(()=>{ht(i,u.Value.get(n))}):ht(i,u.Value.get(n)),!0),s)),u.attr.href(n),...e))},Ae={mark:u.makeProviderMark("Appearance"),create:()=>{const t=u.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=u.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),{value:o,dispose:()=>e==null?void 0:e.removeEventListener("change",s)}}},vt=(t,e)=>{if(typeof e=="function")return vt(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>u.Empty),i=e.notAsked??(()=>u.Empty);return u.OneOfType(u.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Ee=(t=10)=>u.WithElement(e=>u.OnDispose(R.delayed(()=>e==null?void 0:e.focus(),t))),Oe=(t=10)=>u.WithElement(e=>{const n=R.delayed(()=>e.select(),t);return u.OnDispose(n)}),Le=u.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),u.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Se=t=>u.Portal("head > title",u.attr.innerText(t)),Te={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},Q={partial:new Map,full:new Map},j={partial:null,full:null};function ke(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=Q[t].get(n.target);o==null||o.set(n.isIntersecting)})},Te[t])),j[t]}const _t=(t,e)=>{const n=u.prop(!1);return u.Fragment(u.WithElement(o=>{const s=typeof IntersectionObserver<"u"?ke(t):null;return Q[t].set(o,n),s==null||s.observe(o),u.OnDispose(()=>{var i;n.dispose(),s==null||s.unobserve(o),Q[t].delete(o),Q[t].size===0&&((i=j[t])==null||i.disconnect(),j[t]=null)})}),u.renderableOfTNode(e(n)))},Ce=(t,e,n)=>_t(t,o=>u.When(o,e,n??(()=>u.Empty))),tt=Math.min,F=Math.max,et=Math.round,G=Math.floor,S=t=>({x:t,y:t}),We={left:"right",right:"left",bottom:"top",top:"bottom"},De={start:"end",end:"start"};function kt(t,e,n){return F(t,tt(e,n))}function it(t,e){return typeof t=="function"?t(e):t}function V(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function It(t){return t==="x"?"y":"x"}function jt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(V(t))?"y":"x"}function qt(t){return It(H(t))}function Pe(t,e,n){n===void 0&&(n=!1);const o=rt(t),s=qt(t),i=jt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=nt(r)),[r,nt(r)]}function Fe(t){const e=nt(t);return[pt(t),e,pt(e)]}function pt(t){return t.replace(/start|end/g,e=>De[e])}function Ve(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 Me(t,e,n,o){const s=rt(t);let i=Ve(V(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(pt)))),i}function nt(t){return t.replace(/left|right|bottom|top/g,e=>We[e])}function Ne(t){return{top:0,right:0,bottom:0,left:0,...t}}function Ue(t){return typeof t!="number"?Ne(t):{top:t,right:t,bottom:t,left:t}}function ot(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 Ct(t,e,n){let{reference:o,floating:s}=t;const i=H(e),r=qt(e),c=jt(r),l=V(e),a=i==="y",d=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let h;switch(l){case"top":h={x:d,y:o.y-s.height};break;case"bottom":h={x:d,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-s.width,y:f};break;default:h={x:o.x,y:o.y}}switch(rt(e)){case"start":h[r]-=p*(n&&a?-1:1);break;case"end":h[r]+=p*(n&&a?-1:1);break}return h}const Be=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:f}=Ct(a,o,l),p=o,h={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x,y:v,data:A,reset:b}=await g({x:d,y:f,initialPlacement:o,placement:p,strategy:s,middlewareData:h,rects:a,platform:r,elements:{reference:t,floating:e}});d=x??d,f=v??f,h={...h,[w]:{...h[w],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(a=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:f}=Ct(a,p,l)),y=-1)}return{x:d,y:f,placement:p,strategy:s,middlewareData:h}};async function Yt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=it(e,t),m=Ue(h),w=c[p?f==="floating"?"reference":"floating":f],g=ot(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:d,strategy:l})),x=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},b=ot(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 He=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=it(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=V(s),x=H(c),v=V(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(a.floating)),b=p||(v||!y?[nt(c)]:Fe(c)),N=m!=="none";!p&&N&&b.push(...Me(c,y,m,A));const he=[c,...b],ut=await Yt(e,w),J=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&J.push(ut[g]),f){const P=Pe(s,r,A);J.push(ut[P[0]],ut[P[1]])}if(_=[..._,{placement:s,overflows:J}],!J.every(P=>P<=0)){var Ot,Lt;const P=(((Ot=i.flip)==null?void 0:Ot.index)||0)+1,Tt=he[P];if(Tt)return{data:{index:P,overflows:_},reset:{placement:Tt}};let I=(Lt=_.filter(U=>U.overflows[0]<=0).sort((U,C)=>U.overflows[1]-C.overflows[1])[0])==null?void 0:Lt.placement;if(!I)switch(h){case"bestFit":{var St;const U=(St=_.filter(C=>{if(N){const W=H(C.placement);return W===x||W==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(W=>W>0).reduce((W,pe)=>W+pe,0)]).sort((C,W)=>C[1]-W[1])[0])==null?void 0:St[0];U&&(I=U);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};async function $e(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=V(n),c=rt(n),l=H(n)==="y",a=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,f=it(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(h=c==="end"?m*-1:m),l?{x:h*d,y:p*a}:{x:p*a,y:h*d}}const ze=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 $e(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},_e=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...l}=it(t,e),a={x:n,y:o},d=await Yt(e,l),f=H(V(s)),p=It(f);let h=a[p],m=a[f];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=h+d[w],v=h-d[g];h=kt(x,h,v)}if(r){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",x=m+d[w],v=m-d[g];m=kt(x,m,v)}const y=c.fn({...e,[p]:h,[f]:m});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[p]:i,[f]:r}}}}}};function ct(){return typeof window<"u"}function z(t){return Kt(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(Kt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Kt(t){return ct()?t instanceof Node||t instanceof E(t).Node:!1}function O(t){return ct()?t instanceof Element||t instanceof E(t).Element:!1}function T(t){return ct()?t instanceof HTMLElement||t instanceof E(t).HTMLElement:!1}function Wt(t){return!ct()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=L(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function Ie(t){return["table","td","th"].includes(z(t))}function lt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function bt(t){const e=Rt(),n=O(t)?L(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function je(t){let e=D(t);for(;T(e)&&!$(e);){if(bt(e))return e;if(lt(e))return null;e=D(e)}return null}function Rt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $(t){return["html","body","#document"].includes(z(t))}function L(t){return E(t).getComputedStyle(t)}function at(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function D(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Wt(t)&&t.host||k(t);return Wt(e)?e.host:e}function Xt(t){const e=D(t);return $(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&K(e)?e:Xt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Xt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=E(s);if(i){const c=mt(r);return e.concat(r,r.visualViewport||[],K(s)?s:[],c&&n?q(c):[])}return e.concat(s,q(s,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Jt(t){const e=L(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=T(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=et(n)!==i||et(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function At(t){return O(t)?t:t.contextElement}function B(t){const e=At(t);if(!T(e))return S(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Jt(e);let r=(i?et(n.width):n.width)/o,c=(i?et(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const qe=S(0);function Gt(t){const e=E(t);return!Rt()||!e.visualViewport?qe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ye(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==E(t)?!1:e}function M(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=At(t);let r=S(1);e&&(o?O(o)&&(r=B(o)):r=B(t));const c=Ye(i,n,o)?Gt(i):S(0);let l=(s.left+c.x)/r.x,a=(s.top+c.y)/r.y,d=s.width/r.x,f=s.height/r.y;if(i){const p=E(i),h=o&&O(o)?E(o):o;let m=p,y=mt(m);for(;y&&o&&h!==m;){const w=B(y),g=y.getBoundingClientRect(),x=L(y),v=g.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,a*=w.y,d*=w.x,f*=w.y,l+=v,a+=A,m=E(y),y=mt(m)}}return ot({width:d,height:f,x:l,y:a})}function Et(t,e){const n=at(t).scrollLeft;return e?e.left+n:M(k(t)).left+n}function Qt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Et(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Ke(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=k(o),c=e?lt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},a=S(1);const d=S(0),f=T(o);if((f||!f&&!i)&&((z(o)!=="body"||K(r))&&(l=at(o)),T(o))){const h=M(o);a=B(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=r&&!f&&!i?Qt(r,l,!0):S(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+d.x+p.x,y:n.y*a.y-l.scrollTop*a.y+d.y+p.y}}function Xe(t){return Array.from(t.getClientRects())}function Je(t){const e=k(t),n=at(t),o=t.ownerDocument.body,s=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Et(t);const c=-n.scrollTop;return L(o).direction==="rtl"&&(r+=F(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function Ge(t,e){const n=E(t),o=k(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const a=Rt();(!a||a&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function Qe(t,e){const n=M(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=T(t)?B(t):S(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,a=o*i.y;return{width:r,height:c,x:l,y:a}}function Dt(t,e,n){let o;if(e==="viewport")o=Ge(t,n);else if(e==="document")o=Je(k(t));else if(O(e))o=Qe(e,n);else{const s=Gt(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ot(o)}function Zt(t,e){const n=D(t);return n===e||!O(n)||$(n)?!1:L(n).position==="fixed"||Zt(n,e)}function Ze(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&z(c)!=="body"),s=null;const i=L(t).position==="fixed";let r=i?D(t):t;for(;O(r)&&!$(r);){const c=L(r),l=bt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||K(r)&&!l&&Zt(t,r))?o=o.filter(d=>d!==r):s=c,r=D(r)}return e.set(t,o),o}function tn(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?lt(e)?[]:Ze(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((a,d)=>{const f=Dt(e,d,s);return a.top=F(f.top,a.top),a.right=tt(f.right,a.right),a.bottom=tt(f.bottom,a.bottom),a.left=F(f.left,a.left),a},Dt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function en(t){const{width:e,height:n}=Jt(t);return{width:e,height:n}}function nn(t,e,n){const o=T(e),s=k(e),i=n==="fixed",r=M(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=S(0);if(o||!o&&!i)if((z(e)!=="body"||K(s))&&(c=at(e)),o){const p=M(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&(l.x=Et(s));const a=s&&!o&&!i?Qt(s,c):S(0),d=r.left+c.scrollLeft-l.x-a.x,f=r.top+c.scrollTop-l.y-a.y;return{x:d,y:f,width:r.width,height:r.height}}function dt(t){return L(t).position==="static"}function Pt(t,e){if(!T(t)||L(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function te(t,e){const n=E(t);if(lt(t))return n;if(!T(t)){let s=D(t);for(;s&&!$(s);){if(O(s)&&!dt(s))return s;s=D(s)}return n}let o=Pt(t,e);for(;o&&Ie(o)&&dt(o);)o=Pt(o,e);return o&&$(o)&&dt(o)&&!bt(o)?n:o||je(t)||n}const on=async function(t){const e=this.getOffsetParent||te,n=this.getDimensions,o=await n(t.floating);return{reference:nn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function sn(t){return L(t).direction==="rtl"}const rn={convertOffsetParentRelativeRectToViewportRelativeRect:Ke,getDocumentElement:k,getClippingRect:tn,getOffsetParent:te,getElementRects:on,getClientRects:Xe,getDimensions:en,getScale:B,isElement:O,isRTL:sn};function cn(t,e){let n=null,o;const s=k(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:a,top:d,width:f,height:p}=t.getBoundingClientRect();if(c||e(),!f||!p)return;const h=G(d),m=G(s.clientWidth-(a+f)),y=G(s.clientHeight-(d+p)),w=G(a),x={rootMargin:-h+"px "+-m+"px "+-y+"px "+-w+"px",threshold:F(0,tt(1,l))||1};let v=!0;function A(b){const N=b[0].intersectionRatio;if(N!==l){if(!v)return r();N?r(!1,N):o=setTimeout(()=>{r(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(A,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,x)}n.observe(t)}return r(!0),i}function ln(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=At(t),d=s||i?[...a?q(a):[],...q(e)]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=a&&c?cn(a,n):null;let p=-1,h=null;r&&(h=new ResizeObserver(g=>{let[x]=g;x&&x.target===a&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(e)})),n()}),a&&!l&&h.observe(a),h.observe(e));let m,y=l?M(t):null;l&&w();function w(){const g=M(t);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&n(),y=g,m=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(x=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const an=ze,un=_e,Ft=He,fn=(t,e,n)=>{const o=new Map,s={platform:rn,...n},i={...s.platform,_c:o};return Be(t,e,{...s,platform:i})},dn=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:s}={mainAxis:0,crossAxis:0}})=>u.WithBrowserCtx(i=>{const r=u.Value.toSignal(e),c=i.element;return u.When(r,()=>u.Portal("body",u.html.div(u.WithElement(l=>{const a=l;return a.style.position="absolute",u.OnDispose(ln(c,a,async()=>{const{x:d,y:f}=await fn(c,a,{placement:n,strategy:"absolute",middleware:[Ft(),an({mainAxis:o,crossAxis:s}),un(),Ft()]});a.style.top=`${f}px`,a.style.left=`${d}px`}))}),t())))}),ee=(t,e,n)=>{const o=u.prop(R.AsyncResult.notAsked),s=o.map(f=>R.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>R.AsyncResult.isFailure(f)?f.error:void 0),r=o.map(f=>R.AsyncResult.isLoading(f));let c;const l=async f=>{c==null||c.abort(),c=new AbortController;const p=c.signal,h=o.get();o.set(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(h)));try{const m=await e({request:f,abortSignal:p,previous:h});await Promise.resolve(),c=void 0,o.set(R.AsyncResult.success(m))}catch(m){c=void 0,o.set(R.AsyncResult.failure(n(m)))}},a=()=>l(t.get()),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(t.on(l)),{status:o,value:s,error:i,loading:r,reload:a,dispose:d}},ne=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return u.Fragment(u.OnDispose(o),vt(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},hn=({request:t,load:e,mapError:n=o=>o})=>{const o=ee(t,e,n);return s=>ne(o,s)},oe=(t,e)=>{if(typeof e=="function")return oe(t,{success:e});const n=e.failure??(s=>u.Fragment(u.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return u.OneOfType(u.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},pn=()=>u.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class X{constructor(e,n,o,s){ft(this,"equals",e=>R.nearEquals(this.left,e.left)&&R.nearEquals(this.top,e.top)&&R.nearEquals(this.width,e.width)&&R.nearEquals(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 X(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 gt(t){const e=t.getBoundingClientRect();return X.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const se=t=>u.WithBrowserCtx(e=>{const{element:n}=e,o=u.prop(gt(n)),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set(X.of(gt(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),u.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),mn=t=>se(t),gn=t=>e=>{const n=u.getWindow(),o=u.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},ie=(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}},re=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!==""),ce=t=>{const e=t.map(n=>{const o=re(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=ie(s,o);if(r)return{...r,route:i}}return null}},yn=t=>{const e=ce(Object.keys(t));return u.Use(xt,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return u.OneOfTuple(o.map(s=>[s.route,s]),t)})},st=60*1e3,yt=60*st,Y=24*yt,Vt=7*Y,Mt=30*Y,wn=365*Y,xn=[{max:st*90,value:st,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:yt*36,value:yt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:Y*10,value:Y,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Vt*6,value:Vt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Mt*18,value:Mt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:wn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Nt(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 le=(t=1e3)=>{const e=u.prop(new Date),n=R.interval(()=>e.set(new Date),t);return e.onDispose(n),e},ae=t=>{const e=Math.abs(t);if(e<st)return t<0?"just now":"in a moment";for(const n of xn)if(e<n.max)return t<0?Nt(e,n.value,n.past.singular,n.past.plural):Nt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ue=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?u.Signal.is(e)?e.derive():u.prop(e):le(n),s=u.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>u.Value.dispose(o)),s},fe=(t,e={})=>{const n=ue(t,e),o=n.map(ae);return o.onDispose(n.dispose),o},vn=(t,e={})=>fe(t,e);class de extends u.Prop{constructor(){super(...arguments);ft(this,"tick",()=>this.update(n=>n+1))}}const bn=(t=0)=>new de(t,(e,n)=>e===n);exports.Anchor=zt;exports.Appearance=Ae;exports.AsyncResultView=vt;exports.AutoFocus=Ee;exports.AutoSelect=Oe;exports.ElementRect=se;exports.ElementSize=mn;exports.HTMLTitle=Se;exports.HiddenWhenEmpty=Le;exports.InViewport=_t;exports.Location=xt;exports.PopOver=dn;exports.Rect=X;exports.Resource=hn;exports.ResourceDisplay=ne;exports.ResultView=oe;exports.Router=yn;exports.SelectOnFocus=pn;exports.Ticker=de;exports.WhenInViewport=Ce;exports.WindowSize=gn;exports._checkExtensionCondition=Bt;exports._getExtension=Ut;exports._makeRouteMatcher=ce;exports._parseRouteSegments=re;exports.areLocationsEqual=$t;exports.getAbsoluteRect=gt;exports.handleAnchorClick=Ht;exports.locationFromURL=wt;exports.makeResource=ee;exports.matchesRoute=ie;exports.nowSignal=le;exports.relativeTime=vn;exports.relativeTimeMillisSignal=ue;exports.relativeTimeSignal=fe;exports.setLocationFromUrl=ht;exports.ticker=bn;exports.timeDiffToString=ae;exports.urlFromLocation=Z;
1
+ "use strict";var me=Object.defineProperty;var ge=(t,e,n)=>e in t?me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ft=(t,e,n)=>ge(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),R=require("@tempots/std"),Ut=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Bt=(t,e)=>{const n=Ut(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},ye=(t,e,n,o)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const i=s;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:r,search:c,hash:l}=i;if(o){const a=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==a)return!0}return e?!1:Bt(n,r)},Ht=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(o=>o.startsWith(".")?o:"."+o):[];return o=>{ye(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},$t=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,wt=(t,e)=>{var i;const n=new URL(t,e??((i=u.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},ht=(t,e)=>{const n=wt(e);return t.set(n),t},Z=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},we=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),xe=t=>{const e=t.container.currentURL,n=e.iso(o=>wt(o),o=>{if(we(o.pathname))return Z(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return Z({...o,pathname:i})});return{value:n,dispose:n.dispose}},ve=()=>{const t=u.getWindow(),e=(t==null?void 0:t.location.hash)===""?void 0:(t==null?void 0:t.location.hash.substring(1))??void 0;return{pathname:(t==null?void 0:t.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((t==null?void 0:t.location.search)??"").entries()),hash:e}},be=()=>{const t=u.prop(ve(),$t),e=u.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",Z(o))}),{value:t,dispose:t.dispose}},xt={mark:u.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return be();if(e.isHeadless())return xe(e);throw new Error("Unknown context")}},Re=t=>{document.startViewTransition?document.startViewTransition(t):t()},zt=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return zt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return u.Use(xt,i=>u.html.a(u.on.click(Ht(()=>(o==!0?Re(()=>{ht(i,u.Value.get(n))}):ht(i,u.Value.get(n)),!0),s)),u.attr.href(n),...e))},Ae={mark:u.makeProviderMark("Appearance"),create:()=>{const t=u.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=u.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),{value:o,dispose:()=>e==null?void 0:e.removeEventListener("change",s)}}},vt=(t,e)=>{if(typeof e=="function")return vt(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>u.Empty),i=e.notAsked??(()=>u.Empty);return u.OneOfType(u.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Ee=(t=10)=>u.WithElement(e=>u.OnDispose(R.delayed(()=>e==null?void 0:e.focus(),t))),Oe=(t=10)=>u.WithElement(e=>{const n=R.delayed(()=>e.select(),t);return u.OnDispose(n)}),Le=u.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),u.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Se=t=>u.Portal("head > title",u.attr.innerText(t)),Te={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},Q={partial:new Map,full:new Map},j={partial:null,full:null};function ke(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=Q[t].get(n.target);o==null||o.set(n.isIntersecting)})},Te[t])),j[t]}const _t=({mode:t="partial",once:e=!1},n)=>{const o=u.prop(!1);return u.Fragment(u.WithElement(s=>{const i=typeof IntersectionObserver<"u"?ke(t):null;Q[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),Q[t].delete(s),Q[t].size===0&&((l=j[t])==null||l.disconnect(),j[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),u.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),u.renderableOfTNode(n(o)))},Ce=(t,e,n)=>_t(t,o=>u.When(o,e,n??(()=>u.Empty))),tt=Math.min,F=Math.max,et=Math.round,G=Math.floor,S=t=>({x:t,y:t}),We={left:"right",right:"left",bottom:"top",top:"bottom"},De={start:"end",end:"start"};function kt(t,e,n){return F(t,tt(e,n))}function it(t,e){return typeof t=="function"?t(e):t}function V(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function It(t){return t==="x"?"y":"x"}function jt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(V(t))?"y":"x"}function qt(t){return It(H(t))}function Pe(t,e,n){n===void 0&&(n=!1);const o=rt(t),s=qt(t),i=jt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=nt(r)),[r,nt(r)]}function Fe(t){const e=nt(t);return[pt(t),e,pt(e)]}function pt(t){return t.replace(/start|end/g,e=>De[e])}function Ve(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 Me(t,e,n,o){const s=rt(t);let i=Ve(V(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(pt)))),i}function nt(t){return t.replace(/left|right|bottom|top/g,e=>We[e])}function Ne(t){return{top:0,right:0,bottom:0,left:0,...t}}function Ue(t){return typeof t!="number"?Ne(t):{top:t,right:t,bottom:t,left:t}}function ot(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 Ct(t,e,n){let{reference:o,floating:s}=t;const i=H(e),r=qt(e),c=jt(r),l=V(e),a=i==="y",d=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let h;switch(l){case"top":h={x:d,y:o.y-s.height};break;case"bottom":h={x:d,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-s.width,y:f};break;default:h={x:o.x,y:o.y}}switch(rt(e)){case"start":h[r]-=p*(n&&a?-1:1);break;case"end":h[r]+=p*(n&&a?-1:1);break}return h}const Be=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:f}=Ct(a,o,l),p=o,h={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x,y:v,data:A,reset:b}=await g({x:d,y:f,initialPlacement:o,placement:p,strategy:s,middlewareData:h,rects:a,platform:r,elements:{reference:t,floating:e}});d=x??d,f=v??f,h={...h,[w]:{...h[w],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(a=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:f}=Ct(a,p,l)),y=-1)}return{x:d,y:f,placement:p,strategy:s,middlewareData:h}};async function Yt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=it(e,t),m=Ue(h),w=c[p?f==="floating"?"reference":"floating":f],g=ot(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:d,strategy:l})),x=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},b=ot(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 He=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=it(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=V(s),x=H(c),v=V(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(a.floating)),b=p||(v||!y?[nt(c)]:Fe(c)),N=m!=="none";!p&&N&&b.push(...Me(c,y,m,A));const he=[c,...b],ut=await Yt(e,w),J=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&J.push(ut[g]),f){const P=Pe(s,r,A);J.push(ut[P[0]],ut[P[1]])}if(_=[..._,{placement:s,overflows:J}],!J.every(P=>P<=0)){var Ot,Lt;const P=(((Ot=i.flip)==null?void 0:Ot.index)||0)+1,Tt=he[P];if(Tt)return{data:{index:P,overflows:_},reset:{placement:Tt}};let I=(Lt=_.filter(U=>U.overflows[0]<=0).sort((U,C)=>U.overflows[1]-C.overflows[1])[0])==null?void 0:Lt.placement;if(!I)switch(h){case"bestFit":{var St;const U=(St=_.filter(C=>{if(N){const W=H(C.placement);return W===x||W==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(W=>W>0).reduce((W,pe)=>W+pe,0)]).sort((C,W)=>C[1]-W[1])[0])==null?void 0:St[0];U&&(I=U);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};async function $e(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=V(n),c=rt(n),l=H(n)==="y",a=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,f=it(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(h=c==="end"?m*-1:m),l?{x:h*d,y:p*a}:{x:p*a,y:h*d}}const ze=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 $e(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},_e=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...l}=it(t,e),a={x:n,y:o},d=await Yt(e,l),f=H(V(s)),p=It(f);let h=a[p],m=a[f];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=h+d[w],v=h-d[g];h=kt(x,h,v)}if(r){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",x=m+d[w],v=m-d[g];m=kt(x,m,v)}const y=c.fn({...e,[p]:h,[f]:m});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[p]:i,[f]:r}}}}}};function ct(){return typeof window<"u"}function z(t){return Kt(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(Kt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Kt(t){return ct()?t instanceof Node||t instanceof E(t).Node:!1}function O(t){return ct()?t instanceof Element||t instanceof E(t).Element:!1}function T(t){return ct()?t instanceof HTMLElement||t instanceof E(t).HTMLElement:!1}function Wt(t){return!ct()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=L(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function Ie(t){return["table","td","th"].includes(z(t))}function lt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function bt(t){const e=Rt(),n=O(t)?L(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function je(t){let e=D(t);for(;T(e)&&!$(e);){if(bt(e))return e;if(lt(e))return null;e=D(e)}return null}function Rt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $(t){return["html","body","#document"].includes(z(t))}function L(t){return E(t).getComputedStyle(t)}function at(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function D(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Wt(t)&&t.host||k(t);return Wt(e)?e.host:e}function Xt(t){const e=D(t);return $(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&K(e)?e:Xt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Xt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=E(s);if(i){const c=mt(r);return e.concat(r,r.visualViewport||[],K(s)?s:[],c&&n?q(c):[])}return e.concat(s,q(s,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Jt(t){const e=L(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=T(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=et(n)!==i||et(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function At(t){return O(t)?t:t.contextElement}function B(t){const e=At(t);if(!T(e))return S(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Jt(e);let r=(i?et(n.width):n.width)/o,c=(i?et(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const qe=S(0);function Gt(t){const e=E(t);return!Rt()||!e.visualViewport?qe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ye(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==E(t)?!1:e}function M(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=At(t);let r=S(1);e&&(o?O(o)&&(r=B(o)):r=B(t));const c=Ye(i,n,o)?Gt(i):S(0);let l=(s.left+c.x)/r.x,a=(s.top+c.y)/r.y,d=s.width/r.x,f=s.height/r.y;if(i){const p=E(i),h=o&&O(o)?E(o):o;let m=p,y=mt(m);for(;y&&o&&h!==m;){const w=B(y),g=y.getBoundingClientRect(),x=L(y),v=g.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,a*=w.y,d*=w.x,f*=w.y,l+=v,a+=A,m=E(y),y=mt(m)}}return ot({width:d,height:f,x:l,y:a})}function Et(t,e){const n=at(t).scrollLeft;return e?e.left+n:M(k(t)).left+n}function Qt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Et(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Ke(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=k(o),c=e?lt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},a=S(1);const d=S(0),f=T(o);if((f||!f&&!i)&&((z(o)!=="body"||K(r))&&(l=at(o)),T(o))){const h=M(o);a=B(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=r&&!f&&!i?Qt(r,l,!0):S(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+d.x+p.x,y:n.y*a.y-l.scrollTop*a.y+d.y+p.y}}function Xe(t){return Array.from(t.getClientRects())}function Je(t){const e=k(t),n=at(t),o=t.ownerDocument.body,s=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Et(t);const c=-n.scrollTop;return L(o).direction==="rtl"&&(r+=F(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function Ge(t,e){const n=E(t),o=k(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const a=Rt();(!a||a&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function Qe(t,e){const n=M(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=T(t)?B(t):S(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,a=o*i.y;return{width:r,height:c,x:l,y:a}}function Dt(t,e,n){let o;if(e==="viewport")o=Ge(t,n);else if(e==="document")o=Je(k(t));else if(O(e))o=Qe(e,n);else{const s=Gt(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ot(o)}function Zt(t,e){const n=D(t);return n===e||!O(n)||$(n)?!1:L(n).position==="fixed"||Zt(n,e)}function Ze(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&z(c)!=="body"),s=null;const i=L(t).position==="fixed";let r=i?D(t):t;for(;O(r)&&!$(r);){const c=L(r),l=bt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||K(r)&&!l&&Zt(t,r))?o=o.filter(d=>d!==r):s=c,r=D(r)}return e.set(t,o),o}function tn(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?lt(e)?[]:Ze(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((a,d)=>{const f=Dt(e,d,s);return a.top=F(f.top,a.top),a.right=tt(f.right,a.right),a.bottom=tt(f.bottom,a.bottom),a.left=F(f.left,a.left),a},Dt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function en(t){const{width:e,height:n}=Jt(t);return{width:e,height:n}}function nn(t,e,n){const o=T(e),s=k(e),i=n==="fixed",r=M(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=S(0);if(o||!o&&!i)if((z(e)!=="body"||K(s))&&(c=at(e)),o){const p=M(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&(l.x=Et(s));const a=s&&!o&&!i?Qt(s,c):S(0),d=r.left+c.scrollLeft-l.x-a.x,f=r.top+c.scrollTop-l.y-a.y;return{x:d,y:f,width:r.width,height:r.height}}function dt(t){return L(t).position==="static"}function Pt(t,e){if(!T(t)||L(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function te(t,e){const n=E(t);if(lt(t))return n;if(!T(t)){let s=D(t);for(;s&&!$(s);){if(O(s)&&!dt(s))return s;s=D(s)}return n}let o=Pt(t,e);for(;o&&Ie(o)&&dt(o);)o=Pt(o,e);return o&&$(o)&&dt(o)&&!bt(o)?n:o||je(t)||n}const on=async function(t){const e=this.getOffsetParent||te,n=this.getDimensions,o=await n(t.floating);return{reference:nn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function sn(t){return L(t).direction==="rtl"}const rn={convertOffsetParentRelativeRectToViewportRelativeRect:Ke,getDocumentElement:k,getClippingRect:tn,getOffsetParent:te,getElementRects:on,getClientRects:Xe,getDimensions:en,getScale:B,isElement:O,isRTL:sn};function cn(t,e){let n=null,o;const s=k(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:a,top:d,width:f,height:p}=t.getBoundingClientRect();if(c||e(),!f||!p)return;const h=G(d),m=G(s.clientWidth-(a+f)),y=G(s.clientHeight-(d+p)),w=G(a),x={rootMargin:-h+"px "+-m+"px "+-y+"px "+-w+"px",threshold:F(0,tt(1,l))||1};let v=!0;function A(b){const N=b[0].intersectionRatio;if(N!==l){if(!v)return r();N?r(!1,N):o=setTimeout(()=>{r(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(A,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,x)}n.observe(t)}return r(!0),i}function ln(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=At(t),d=s||i?[...a?q(a):[],...q(e)]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=a&&c?cn(a,n):null;let p=-1,h=null;r&&(h=new ResizeObserver(g=>{let[x]=g;x&&x.target===a&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(e)})),n()}),a&&!l&&h.observe(a),h.observe(e));let m,y=l?M(t):null;l&&w();function w(){const g=M(t);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&n(),y=g,m=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(x=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const an=ze,un=_e,Ft=He,fn=(t,e,n)=>{const o=new Map,s={platform:rn,...n},i={...s.platform,_c:o};return Be(t,e,{...s,platform:i})},dn=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:s}={mainAxis:0,crossAxis:0}})=>u.WithBrowserCtx(i=>{const r=u.Value.toSignal(e),c=i.element;return u.When(r,()=>u.Portal("body",u.html.div(u.WithElement(l=>{const a=l;return a.style.position="absolute",u.OnDispose(ln(c,a,async()=>{const{x:d,y:f}=await fn(c,a,{placement:n,strategy:"absolute",middleware:[Ft(),an({mainAxis:o,crossAxis:s}),un(),Ft()]});a.style.top=`${f}px`,a.style.left=`${d}px`}))}),t())))}),ee=(t,e,n)=>{const o=u.prop(R.AsyncResult.notAsked),s=o.map(f=>R.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>R.AsyncResult.isFailure(f)?f.error:void 0),r=o.map(f=>R.AsyncResult.isLoading(f));let c;const l=async f=>{c==null||c.abort(),c=new AbortController;const p=c.signal,h=o.get();o.set(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(h)));try{const m=await e({request:f,abortSignal:p,previous:h});await Promise.resolve(),c=void 0,o.set(R.AsyncResult.success(m))}catch(m){c=void 0,o.set(R.AsyncResult.failure(n(m)))}},a=()=>l(u.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(u.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:a,dispose:d}},ne=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return u.Fragment(u.OnDispose(o),vt(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},hn=({request:t,load:e,mapError:n=o=>o})=>{const o=ee(t,e,n);return s=>ne(o,s)},oe=(t,e)=>{if(typeof e=="function")return oe(t,{success:e});const n=e.failure??(s=>u.Fragment(u.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return u.OneOfType(u.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},pn=()=>u.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class X{constructor(e,n,o,s){ft(this,"equals",e=>R.nearEquals(this.left,e.left)&&R.nearEquals(this.top,e.top)&&R.nearEquals(this.width,e.width)&&R.nearEquals(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 X(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 gt(t){const e=t.getBoundingClientRect();return X.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const se=t=>u.WithBrowserCtx(e=>{const{element:n}=e,o=u.prop(gt(n)),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set(X.of(gt(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),u.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),mn=t=>se(t),gn=t=>e=>{const n=u.getWindow(),o=u.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},ie=(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}},re=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!==""),ce=t=>{const e=t.map(n=>{const o=re(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=ie(s,o);if(r)return{...r,route:i}}return null}},yn=t=>{const e=ce(Object.keys(t));return u.Use(xt,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return u.OneOfTuple(o.map(s=>[s.route,s]),t)})},st=60*1e3,yt=60*st,Y=24*yt,Vt=7*Y,Mt=30*Y,wn=365*Y,xn=[{max:st*90,value:st,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:yt*36,value:yt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:Y*10,value:Y,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Vt*6,value:Vt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Mt*18,value:Mt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:wn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Nt(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 le=(t=1e3)=>{const e=u.prop(new Date),n=R.interval(()=>e.set(new Date),t);return e.onDispose(n),e},ae=t=>{const e=Math.abs(t);if(e<st)return t<0?"just now":"in a moment";for(const n of xn)if(e<n.max)return t<0?Nt(e,n.value,n.past.singular,n.past.plural):Nt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ue=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?u.Signal.is(e)?e.derive():u.prop(e):le(n),s=u.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>u.Value.dispose(o)),s},fe=(t,e={})=>{const n=ue(t,e),o=n.map(ae);return o.onDispose(n.dispose),o},vn=(t,e={})=>fe(t,e);class de extends u.Prop{constructor(){super(...arguments);ft(this,"tick",()=>this.update(n=>n+1))}}const bn=(t=0)=>new de(t,(e,n)=>e===n);exports.Anchor=zt;exports.Appearance=Ae;exports.AsyncResultView=vt;exports.AutoFocus=Ee;exports.AutoSelect=Oe;exports.ElementRect=se;exports.ElementSize=mn;exports.HTMLTitle=Se;exports.HiddenWhenEmpty=Le;exports.InViewport=_t;exports.Location=xt;exports.PopOver=dn;exports.Rect=X;exports.Resource=hn;exports.ResourceDisplay=ne;exports.ResultView=oe;exports.Router=yn;exports.SelectOnFocus=pn;exports.Ticker=de;exports.WhenInViewport=Ce;exports.WindowSize=gn;exports._checkExtensionCondition=Bt;exports._getExtension=Ut;exports._makeRouteMatcher=ce;exports._parseRouteSegments=re;exports.areLocationsEqual=$t;exports.getAbsoluteRect=gt;exports.handleAnchorClick=Ht;exports.locationFromURL=wt;exports.makeResource=ee;exports.matchesRoute=ie;exports.nowSignal=le;exports.relativeTime=vn;exports.relativeTimeMillisSignal=ue;exports.relativeTimeSignal=fe;exports.setLocationFromUrl=ht;exports.ticker=bn;exports.timeDiffToString=ae;exports.urlFromLocation=Z;
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var ge = Object.defineProperty;
2
2
  var ye = (t, e, n) => e in t ? ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var pt = (t, e, n) => ye(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { getWindow as J, prop as P, makeProviderMark as _t, Signal as It, Use as jt, html as Yt, on as qt, Value as H, attr as Kt, Empty as yt, OneOfType as Xt, WithElement as G, OnDispose as W, Portal as Jt, Fragment as At, renderableOfTNode as Rt, When as Gt, WithBrowserCtx as Qt, OneOfTuple as we, computedOf as xe, Prop as ve } from "@tempots/dom";
4
+ import { getWindow as J, prop as W, makeProviderMark as _t, Signal as It, Use as jt, html as Yt, on as qt, Value as D, attr as Kt, Empty as yt, OneOfType as Xt, WithElement as G, OnDispose as F, Portal as Jt, Fragment as At, renderableOfTNode as Rt, When as Gt, WithBrowserCtx as Qt, OneOfTuple as we, computedOf as xe, Prop as ve } from "@tempots/dom";
5
5
  import { delayed as Zt, AsyncResult as C, nearEquals as tt, interval as be } from "@tempots/std";
6
6
  const Ae = (t) => {
7
7
  const e = t.split("/").pop();
@@ -79,7 +79,7 @@ const Ae = (t) => {
79
79
  hash: e
80
80
  };
81
81
  }, Ce = () => {
82
- const t = P(ke(), Oe), e = J(), n = () => {
82
+ const t = W(ke(), Oe), e = J(), n = () => {
83
83
  let o = (e == null ? void 0 : e.location.hash) ?? "";
84
84
  o.startsWith("#") && (o = o.substring(1));
85
85
  const s = {
@@ -121,8 +121,8 @@ const Ae = (t) => {
121
121
  return jt(ee, (i) => Yt.a(
122
122
  qt.click(
123
123
  Le(() => (o == !0 ? De(() => {
124
- Pt(i, H.get(n));
125
- }) : Pt(i, H.get(n)), !0), s)
124
+ Pt(i, D.get(n));
125
+ }) : Pt(i, D.get(n)), !0), s)
126
126
  ),
127
127
  Kt.href(n),
128
128
  ...e
@@ -130,7 +130,7 @@ const Ae = (t) => {
130
130
  }, Fn = {
131
131
  mark: _t("Appearance"),
132
132
  create: () => {
133
- const t = J(), e = t != null && t.matchMedia != null ? t.matchMedia("(prefers-color-scheme: dark)") : void 0, n = (e == null ? void 0 : e.matches) ?? !1, o = P(n ? "dark" : "light"), s = (i) => o.set(i.matches ? "dark" : "light");
133
+ const t = J(), e = t != null && t.matchMedia != null ? t.matchMedia("(prefers-color-scheme: dark)") : void 0, n = (e == null ? void 0 : e.matches) ?? !1, o = W(n ? "dark" : "light"), s = (i) => o.set(i.matches ? "dark" : "light");
134
134
  return e == null || e.addEventListener("change", s), {
135
135
  value: o,
136
136
  dispose: () => e == null ? void 0 : e.removeEventListener("change", s)
@@ -140,18 +140,18 @@ const Ae = (t) => {
140
140
  if (typeof e == "function")
141
141
  return ne(t, { success: e });
142
142
  const n = e.failure ?? ((r) => r.map((c) => `Error: ${c}`)), o = e.success, s = e.loading ?? (() => yt), i = e.notAsked ?? (() => yt);
143
- return Xt(H.toSignal(t), {
143
+ return Xt(D.toSignal(t), {
144
144
  AsyncSuccess: (r) => o(r.$.value),
145
145
  AsyncFailure: (r) => n(r.$.error),
146
146
  Loading: (r) => s(r.map((c) => c.previousValue)),
147
147
  NotAsked: i
148
148
  });
149
- }, Mn = (t = 10) => G((e) => W(Zt(() => e == null ? void 0 : e.focus(), t))), Vn = (t = 10) => G((e) => {
149
+ }, Mn = (t = 10) => G((e) => F(Zt(() => e == null ? void 0 : e.focus(), t))), Vn = (t = 10) => G((e) => {
150
150
  const n = Zt(() => e.select(), t);
151
- return W(n);
151
+ return F(n);
152
152
  }), Nn = G((t) => {
153
153
  const e = t.style.getPropertyValue(":empty");
154
- return t.style.setProperty(":empty", "display:none"), W((n) => {
154
+ return t.style.setProperty(":empty", "display:none"), F((n) => {
155
155
  n && t.style.setProperty(":empty", e);
156
156
  });
157
157
  }), $n = (t) => Jt("head > title", Kt.innerText(t)), We = {
@@ -180,19 +180,26 @@ function Fe(t) {
180
180
  });
181
181
  }, We[t])), q[t];
182
182
  }
183
- const Me = (t, e) => {
184
- const n = P(!1);
183
+ const Me = ({ mode: t = "partial", once: e = !1 }, n) => {
184
+ const o = W(!1);
185
185
  return At(
186
- G((o) => {
187
- const s = typeof IntersectionObserver < "u" ? Fe(t) : null;
188
- return nt[t].set(o, n), s == null || s.observe(o), W(() => {
189
- var i;
190
- n.dispose(), s == null || s.unobserve(o), nt[t].delete(o), nt[t].size === 0 && ((i = q[t]) == null || i.disconnect(), q[t] = null);
186
+ G((s) => {
187
+ const i = typeof IntersectionObserver < "u" ? Fe(t) : null;
188
+ nt[t].set(s, o), i == null || i.observe(s);
189
+ function r() {
190
+ var l;
191
+ i == null || i.unobserve(s), nt[t].delete(s), nt[t].size === 0 && ((l = q[t]) == null || l.disconnect(), q[t] = null);
192
+ }
193
+ let c = null;
194
+ return e && (c = o.on((l) => {
195
+ l && r();
196
+ })), F(() => {
197
+ o.dispose(), r(), c == null || c();
191
198
  });
192
199
  }),
193
- Rt(e(n))
200
+ Rt(n(o))
194
201
  );
195
- }, Bn = (t, e, n) => Me(t, (o) => Gt(o, e, n ?? (() => yt))), ot = Math.min, M = Math.max, st = Math.round, et = Math.floor, L = (t) => ({
202
+ }, Bn = (t, e, n) => Me(t, (o) => Gt(o, e, n ?? (() => yt))), ot = Math.min, V = Math.max, st = Math.round, et = Math.floor, L = (t) => ({
196
203
  x: t,
197
204
  y: t
198
205
  }), Ve = {
@@ -205,12 +212,12 @@ const Me = (t, e) => {
205
212
  end: "start"
206
213
  };
207
214
  function Wt(t, e, n) {
208
- return M(t, ot(e, n));
215
+ return V(t, ot(e, n));
209
216
  }
210
217
  function lt(t, e) {
211
218
  return typeof t == "function" ? t(e) : t;
212
219
  }
213
- function V(t) {
220
+ function N(t) {
214
221
  return t.split("-")[0];
215
222
  }
216
223
  function at(t) {
@@ -223,7 +230,7 @@ function se(t) {
223
230
  return t === "y" ? "height" : "width";
224
231
  }
225
232
  function z(t) {
226
- return ["top", "bottom"].includes(V(t)) ? "y" : "x";
233
+ return ["top", "bottom"].includes(N(t)) ? "y" : "x";
227
234
  }
228
235
  function ie(t) {
229
236
  return oe(z(t));
@@ -256,7 +263,7 @@ function Ue(t, e, n) {
256
263
  }
257
264
  function He(t, e, n, o) {
258
265
  const s = at(t);
259
- let i = Ue(V(t), n === "start", o);
266
+ let i = Ue(N(t), n === "start", o);
260
267
  return s && (i = i.map((r) => r + "-" + s), e && (i = i.concat(i.map(xt)))), i;
261
268
  }
262
269
  function it(t) {
@@ -302,7 +309,7 @@ function Ft(t, e, n) {
302
309
  reference: o,
303
310
  floating: s
304
311
  } = t;
305
- const i = z(e), r = ie(e), c = se(r), l = V(e), a = i === "y", f = o.x + o.width / 2 - s.width / 2, u = o.y + o.height / 2 - s.height / 2, d = o[c] / 2 - s[c] / 2;
312
+ const i = z(e), r = ie(e), c = se(r), l = N(e), a = i === "y", f = o.x + o.width / 2 - s.width / 2, u = o.y + o.height / 2 - s.height / 2, d = o[c] / 2 - s[c] / 2;
306
313
  let h;
307
314
  switch (l) {
308
315
  case "top":
@@ -475,37 +482,37 @@ const je = function(t) {
475
482
  } = lt(t, e);
476
483
  if ((n = i.arrow) != null && n.alignmentOffset)
477
484
  return {};
478
- const p = V(s), w = z(c), x = V(c) === c, b = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), v = d || (x || !g ? [it(c)] : Be(c)), $ = m !== "none";
479
- !d && $ && v.push(...He(c, g, m, b));
485
+ const p = N(s), w = z(c), x = N(c) === c, b = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), v = d || (x || !g ? [it(c)] : Be(c)), B = m !== "none";
486
+ !d && B && v.push(...He(c, g, m, b));
480
487
  const me = [c, ...v], mt = await re(e, y), Z = [];
481
488
  let j = ((o = i.flip) == null ? void 0 : o.overflows) || [];
482
489
  if (f && Z.push(mt[p]), u) {
483
- const F = $e(s, r, b);
484
- Z.push(mt[F[0]], mt[F[1]]);
490
+ const M = $e(s, r, b);
491
+ Z.push(mt[M[0]], mt[M[1]]);
485
492
  }
486
493
  if (j = [...j, {
487
494
  placement: s,
488
495
  overflows: Z
489
- }], !Z.every((F) => F <= 0)) {
496
+ }], !Z.every((M) => M <= 0)) {
490
497
  var St, kt;
491
- const F = (((St = i.flip) == null ? void 0 : St.index) || 0) + 1, Dt = me[F];
498
+ const M = (((St = i.flip) == null ? void 0 : St.index) || 0) + 1, Dt = me[M];
492
499
  if (Dt)
493
500
  return {
494
501
  data: {
495
- index: F,
502
+ index: M,
496
503
  overflows: j
497
504
  },
498
505
  reset: {
499
506
  placement: Dt
500
507
  }
501
508
  };
502
- let Y = (kt = j.filter((B) => B.overflows[0] <= 0).sort((B, S) => B.overflows[1] - S.overflows[1])[0]) == null ? void 0 : kt.placement;
509
+ let Y = (kt = j.filter((U) => U.overflows[0] <= 0).sort((U, S) => U.overflows[1] - S.overflows[1])[0]) == null ? void 0 : kt.placement;
503
510
  if (!Y)
504
511
  switch (h) {
505
512
  case "bestFit": {
506
513
  var Ct;
507
- const B = (Ct = j.filter((S) => {
508
- if ($) {
514
+ const U = (Ct = j.filter((S) => {
515
+ if (B) {
509
516
  const k = z(S.placement);
510
517
  return k === w || // Create a bias to the `y` side axis due to horizontal
511
518
  // reading directions favoring greater width.
@@ -513,7 +520,7 @@ const je = function(t) {
513
520
  }
514
521
  return !0;
515
522
  }).map((S) => [S.placement, S.overflows.filter((k) => k > 0).reduce((k, pe) => k + pe, 0)]).sort((S, k) => S[1] - k[1])[0]) == null ? void 0 : Ct[0];
516
- B && (Y = B);
523
+ U && (Y = U);
517
524
  break;
518
525
  }
519
526
  case "initialPlacement":
@@ -536,7 +543,7 @@ async function Ye(t, e) {
536
543
  placement: n,
537
544
  platform: o,
538
545
  elements: s
539
- } = t, i = await (o.isRTL == null ? void 0 : o.isRTL(s.floating)), r = V(n), c = at(n), l = z(n) === "y", a = ["left", "top"].includes(r) ? -1 : 1, f = i && l ? -1 : 1, u = lt(e, t);
546
+ } = t, i = await (o.isRTL == null ? void 0 : o.isRTL(s.floating)), r = N(n), c = at(n), l = z(n) === "y", a = ["left", "top"].includes(r) ? -1 : 1, f = i && l ? -1 : 1, u = lt(e, t);
540
547
  let {
541
548
  mainAxis: d,
542
549
  crossAxis: h,
@@ -608,7 +615,7 @@ const qe = function(t) {
608
615
  } = lt(t, e), a = {
609
616
  x: n,
610
617
  y: o
611
- }, f = await re(e, l), u = z(V(s)), d = oe(u);
618
+ }, f = await re(e, l), u = z(N(s)), d = oe(u);
612
619
  let h = a[d], m = a[u];
613
620
  if (i) {
614
621
  const y = d === "y" ? "top" : "left", p = d === "y" ? "bottom" : "right", w = h + f[y], x = h - f[p];
@@ -689,13 +696,13 @@ function Et(t) {
689
696
  return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
690
697
  }
691
698
  function Je(t) {
692
- let e = D(t);
699
+ let e = P(t);
693
700
  for (; O(e) && !_(e); ) {
694
701
  if (Et(e))
695
702
  return e;
696
703
  if (ft(e))
697
704
  return null;
698
- e = D(e);
705
+ e = P(e);
699
706
  }
700
707
  return null;
701
708
  }
@@ -717,7 +724,7 @@ function ht(t) {
717
724
  scrollTop: t.scrollY
718
725
  };
719
726
  }
720
- function D(t) {
727
+ function P(t) {
721
728
  if (I(t) === "html")
722
729
  return t;
723
730
  const e = (
@@ -730,7 +737,7 @@ function D(t) {
730
737
  return Mt(e) ? e.host : e;
731
738
  }
732
739
  function le(t) {
733
- const e = D(t);
740
+ const e = P(t);
734
741
  return _(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : O(e) && Q(e) ? e : le(e);
735
742
  }
736
743
  function K(t, e, n) {
@@ -759,7 +766,7 @@ function ae(t) {
759
766
  function Ot(t) {
760
767
  return R(t) ? t : t.contextElement;
761
768
  }
762
- function U(t) {
769
+ function H(t) {
763
770
  const e = Ot(t);
764
771
  if (!O(e))
765
772
  return L(1);
@@ -785,18 +792,18 @@ function ue(t) {
785
792
  function Qe(t, e, n) {
786
793
  return e === void 0 && (e = !1), !n || e && n !== A(t) ? !1 : e;
787
794
  }
788
- function N(t, e, n, o) {
795
+ function $(t, e, n, o) {
789
796
  e === void 0 && (e = !1), n === void 0 && (n = !1);
790
797
  const s = t.getBoundingClientRect(), i = Ot(t);
791
798
  let r = L(1);
792
- e && (o ? R(o) && (r = U(o)) : r = U(t));
799
+ e && (o ? R(o) && (r = H(o)) : r = H(t));
793
800
  const c = Qe(i, n, o) ? ue(i) : L(0);
794
801
  let l = (s.left + c.x) / r.x, a = (s.top + c.y) / r.y, f = s.width / r.x, u = s.height / r.y;
795
802
  if (i) {
796
803
  const d = A(i), h = o && R(o) ? A(o) : o;
797
804
  let m = d, g = vt(m);
798
805
  for (; g && o && h !== m; ) {
799
- const y = U(g), p = g.getBoundingClientRect(), w = E(g), x = p.left + (g.clientLeft + parseFloat(w.paddingLeft)) * y.x, b = p.top + (g.clientTop + parseFloat(w.paddingTop)) * y.y;
806
+ const y = H(g), p = g.getBoundingClientRect(), w = E(g), x = p.left + (g.clientLeft + parseFloat(w.paddingLeft)) * y.x, b = p.top + (g.clientTop + parseFloat(w.paddingTop)) * y.y;
800
807
  l *= y.x, a *= y.y, f *= y.x, u *= y.y, l += x, a += b, m = A(g), g = vt(m);
801
808
  }
802
809
  }
@@ -809,7 +816,7 @@ function N(t, e, n, o) {
809
816
  }
810
817
  function Tt(t, e) {
811
818
  const n = ht(t).scrollLeft;
812
- return e ? e.left + n : N(T(t)).left + n;
819
+ return e ? e.left + n : $(T(t)).left + n;
813
820
  }
814
821
  function fe(t, e, n) {
815
822
  n === void 0 && (n = !1);
@@ -838,8 +845,8 @@ function Ze(t) {
838
845
  }, a = L(1);
839
846
  const f = L(0), u = O(o);
840
847
  if ((u || !u && !i) && ((I(o) !== "body" || Q(r)) && (l = ht(o)), O(o))) {
841
- const h = N(o);
842
- a = U(o), f.x = h.x + o.clientLeft, f.y = h.y + o.clientTop;
848
+ const h = $(o);
849
+ a = H(o), f.x = h.x + o.clientLeft, f.y = h.y + o.clientTop;
843
850
  }
844
851
  const d = r && !u && !i ? fe(r, l, !0) : L(0);
845
852
  return {
@@ -853,10 +860,10 @@ function tn(t) {
853
860
  return Array.from(t.getClientRects());
854
861
  }
855
862
  function en(t) {
856
- const e = T(t), n = ht(t), o = t.ownerDocument.body, s = M(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), i = M(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
863
+ const e = T(t), n = ht(t), o = t.ownerDocument.body, s = V(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), i = V(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
857
864
  let r = -n.scrollLeft + Tt(t);
858
865
  const c = -n.scrollTop;
859
- return E(o).direction === "rtl" && (r += M(e.clientWidth, o.clientWidth) - s), {
866
+ return E(o).direction === "rtl" && (r += V(e.clientWidth, o.clientWidth) - s), {
860
867
  width: s,
861
868
  height: i,
862
869
  x: r,
@@ -879,7 +886,7 @@ function nn(t, e) {
879
886
  };
880
887
  }
881
888
  function on(t, e) {
882
- const n = N(t, !0, e === "fixed"), o = n.top + t.clientTop, s = n.left + t.clientLeft, i = O(t) ? U(t) : L(1), r = t.clientWidth * i.x, c = t.clientHeight * i.y, l = s * i.x, a = o * i.y;
889
+ const n = $(t, !0, e === "fixed"), o = n.top + t.clientTop, s = n.left + t.clientLeft, i = O(t) ? H(t) : L(1), r = t.clientWidth * i.x, c = t.clientHeight * i.y, l = s * i.x, a = o * i.y;
883
890
  return {
884
891
  width: r,
885
892
  height: c,
@@ -907,7 +914,7 @@ function Vt(t, e, n) {
907
914
  return rt(o);
908
915
  }
909
916
  function he(t, e) {
910
- const n = D(t);
917
+ const n = P(t);
911
918
  return n === e || !R(n) || _(n) ? !1 : E(n).position === "fixed" || he(n, e);
912
919
  }
913
920
  function sn(t, e) {
@@ -916,10 +923,10 @@ function sn(t, e) {
916
923
  return n;
917
924
  let o = K(t, [], !1).filter((c) => R(c) && I(c) !== "body"), s = null;
918
925
  const i = E(t).position === "fixed";
919
- let r = i ? D(t) : t;
926
+ let r = i ? P(t) : t;
920
927
  for (; R(r) && !_(r); ) {
921
928
  const c = E(r), l = Et(r);
922
- !l && c.position === "fixed" && (s = null), (i ? !l && !s : !l && c.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || Q(r) && !l && he(t, r)) ? o = o.filter((f) => f !== r) : s = c, r = D(r);
929
+ !l && c.position === "fixed" && (s = null), (i ? !l && !s : !l && c.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || Q(r) && !l && he(t, r)) ? o = o.filter((f) => f !== r) : s = c, r = P(r);
923
930
  }
924
931
  return e.set(t, o), o;
925
932
  }
@@ -932,7 +939,7 @@ function rn(t) {
932
939
  } = t;
933
940
  const r = [...n === "clippingAncestors" ? ft(e) ? [] : sn(e, this._c) : [].concat(n), o], c = r[0], l = r.reduce((a, f) => {
934
941
  const u = Vt(e, f, s);
935
- return a.top = M(u.top, a.top), a.right = ot(u.right, a.right), a.bottom = ot(u.bottom, a.bottom), a.left = M(u.left, a.left), a;
942
+ return a.top = V(u.top, a.top), a.right = ot(u.right, a.right), a.bottom = ot(u.bottom, a.bottom), a.left = V(u.left, a.left), a;
936
943
  }, Vt(e, c, s));
937
944
  return {
938
945
  width: l.right - l.left,
@@ -952,7 +959,7 @@ function cn(t) {
952
959
  };
953
960
  }
954
961
  function ln(t, e, n) {
955
- const o = O(e), s = T(e), i = n === "fixed", r = N(t, !0, i, e);
962
+ const o = O(e), s = T(e), i = n === "fixed", r = $(t, !0, i, e);
956
963
  let c = {
957
964
  scrollLeft: 0,
958
965
  scrollTop: 0
@@ -960,7 +967,7 @@ function ln(t, e, n) {
960
967
  const l = L(0);
961
968
  if (o || !o && !i)
962
969
  if ((I(e) !== "body" || Q(s)) && (c = ht(e)), o) {
963
- const d = N(e, !0, i, e);
970
+ const d = $(e, !0, i, e);
964
971
  l.x = d.x + e.clientLeft, l.y = d.y + e.clientTop;
965
972
  } else s && (l.x = Tt(s));
966
973
  const a = s && !o && !i ? fe(s, c) : L(0), f = r.left + c.scrollLeft - l.x - a.x, u = r.top + c.scrollTop - l.y - a.y;
@@ -987,11 +994,11 @@ function de(t, e) {
987
994
  if (ft(t))
988
995
  return n;
989
996
  if (!O(t)) {
990
- let s = D(t);
997
+ let s = P(t);
991
998
  for (; s && !_(s); ) {
992
999
  if (R(s) && !gt(s))
993
1000
  return s;
994
- s = D(s);
1001
+ s = P(s);
995
1002
  }
996
1003
  return n;
997
1004
  }
@@ -1023,7 +1030,7 @@ const fn = {
1023
1030
  getElementRects: an,
1024
1031
  getClientRects: tn,
1025
1032
  getDimensions: cn,
1026
- getScale: U,
1033
+ getScale: H,
1027
1034
  isElement: R,
1028
1035
  isRTL: un
1029
1036
  };
@@ -1046,15 +1053,15 @@ function hn(t, e) {
1046
1053
  return;
1047
1054
  const h = et(f), m = et(s.clientWidth - (a + u)), g = et(s.clientHeight - (f + d)), y = et(a), w = {
1048
1055
  rootMargin: -h + "px " + -m + "px " + -g + "px " + -y + "px",
1049
- threshold: M(0, ot(1, l)) || 1
1056
+ threshold: V(0, ot(1, l)) || 1
1050
1057
  };
1051
1058
  let x = !0;
1052
1059
  function b(v) {
1053
- const $ = v[0].intersectionRatio;
1054
- if ($ !== l) {
1060
+ const B = v[0].intersectionRatio;
1061
+ if (B !== l) {
1055
1062
  if (!x)
1056
1063
  return r();
1057
- $ ? r(!1, $) : o = setTimeout(() => {
1064
+ B ? r(!1, B) : o = setTimeout(() => {
1058
1065
  r(!1, 1e-7);
1059
1066
  }, 1e3);
1060
1067
  }
@@ -1096,10 +1103,10 @@ function dn(t, e, n, o) {
1096
1103
  (x = h) == null || x.observe(e);
1097
1104
  })), n();
1098
1105
  }), a && !l && h.observe(a), h.observe(e));
1099
- let m, g = l ? N(t) : null;
1106
+ let m, g = l ? $(t) : null;
1100
1107
  l && y();
1101
1108
  function y() {
1102
- const p = N(t);
1109
+ const p = $(t);
1103
1110
  g && (p.x !== g.x || p.y !== g.y || p.width !== g.width || p.height !== g.height) && n(), g = p, m = requestAnimationFrame(y);
1104
1111
  }
1105
1112
  return n(), () => {
@@ -1127,7 +1134,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1127
1134
  placement: n,
1128
1135
  offset: { mainAxis: o, crossAxis: s } = { mainAxis: 0, crossAxis: 0 }
1129
1136
  }) => Qt((i) => {
1130
- const r = H.toSignal(e), c = i.element;
1137
+ const r = D.toSignal(e), c = i.element;
1131
1138
  return Gt(
1132
1139
  r,
1133
1140
  () => Jt(
@@ -1135,7 +1142,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1135
1142
  Yt.div(
1136
1143
  G((l) => {
1137
1144
  const a = l;
1138
- return a.style.position = "absolute", W(
1145
+ return a.style.position = "absolute", F(
1139
1146
  dn(c, a, async () => {
1140
1147
  const { x: f, y: u } = await gn(c, a, {
1141
1148
  placement: n,
@@ -1156,7 +1163,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1156
1163
  )
1157
1164
  );
1158
1165
  }), yn = (t, e, n) => {
1159
- const o = P(C.notAsked), s = o.map(
1166
+ const o = W(C.notAsked), s = o.map(
1160
1167
  (u) => C.isSuccess(u) ? u.value : void 0
1161
1168
  ), i = o.map(
1162
1169
  (u) => C.isFailure(u) ? u.error : void 0
@@ -1172,10 +1179,10 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1172
1179
  } catch (m) {
1173
1180
  c = void 0, o.set(C.failure(n(m)));
1174
1181
  }
1175
- }, a = () => l(t.get()), f = () => {
1182
+ }, a = () => l(D.get(t)), f = () => {
1176
1183
  c == null || c.abort(), c = void 0, o.dispose();
1177
1184
  };
1178
- return o.onDispose(t.on(l)), {
1185
+ return o.onDispose(D.on(t, l)), {
1179
1186
  status: o,
1180
1187
  value: s,
1181
1188
  error: i,
@@ -1186,7 +1193,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1186
1193
  }, wn = (t, e) => {
1187
1194
  const { status: n, dispose: o, reload: s } = t, { loading: i, failure: r, success: c } = e;
1188
1195
  return At(
1189
- W(o),
1196
+ F(o),
1190
1197
  ne(n, {
1191
1198
  loading: i != null ? (l) => i(l, s) : void 0,
1192
1199
  failure: r != null ? (l) => r(l, s) : void 0,
@@ -1204,10 +1211,10 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1204
1211
  if (typeof e == "function")
1205
1212
  return xn(t, { success: e });
1206
1213
  const n = e.failure ?? ((s) => At(
1207
- W(s.on(console.error)),
1214
+ F(s.on(console.error)),
1208
1215
  s.map((i) => `Error: ${i}`)
1209
1216
  )), o = e.success;
1210
- return Xt(H.toSignal(t), {
1217
+ return Xt(D.toSignal(t), {
1211
1218
  Success: (s) => o(s.$.value),
1212
1219
  Failure: (s) => n(s.$.error)
1213
1220
  });
@@ -1364,15 +1371,15 @@ function Bt(t) {
1364
1371
  });
1365
1372
  }
1366
1373
  const vn = (t) => Qt((e) => {
1367
- const { element: n } = e, o = P(Bt(n)), s = Rt(t(o))(e), i = () => {
1374
+ const { element: n } = e, o = W(Bt(n)), s = Rt(t(o))(e), i = () => {
1368
1375
  o.set(dt.of(Bt(n)));
1369
1376
  };
1370
1377
  let r;
1371
- return typeof ResizeObserver == "function" && (r = new ResizeObserver(i), r.observe(n)), W((c) => {
1378
+ return typeof ResizeObserver == "function" && (r = new ResizeObserver(i), r.observe(n)), F((c) => {
1372
1379
  r == null || r.disconnect(), s(c);
1373
1380
  });
1374
1381
  }), _n = (t) => vn(t), In = (t) => (e) => {
1375
- const n = J(), o = P({
1382
+ const n = J(), o = W({
1376
1383
  width: (n == null ? void 0 : n.innerWidth) ?? 0,
1377
1384
  height: (n == null ? void 0 : n.innerHeight) ?? 0
1378
1385
  }), s = Rt(t(o))(e), i = () => {
@@ -1488,7 +1495,7 @@ function zt(t, e, n, o) {
1488
1495
  );
1489
1496
  }
1490
1497
  const On = (t = 1e3) => {
1491
- const e = P(/* @__PURE__ */ new Date()), n = be(() => e.set(/* @__PURE__ */ new Date()), t);
1498
+ const e = W(/* @__PURE__ */ new Date()), n = be(() => e.set(/* @__PURE__ */ new Date()), t);
1492
1499
  return e.onDispose(n), e;
1493
1500
  }, Tn = (t) => {
1494
1501
  const e = Math.abs(t);
@@ -1499,11 +1506,11 @@ const On = (t = 1e3) => {
1499
1506
  return t < 0 ? zt(e, n.value, n.past.singular, n.past.plural) : zt(e, n.value, n.future.singular, n.future.plural);
1500
1507
  throw new Error("unreachable");
1501
1508
  }, Sn = (t, { now: e, frequency: n = 1e4 } = {}) => {
1502
- const o = e != null ? It.is(e) ? e.derive() : P(e) : On(n), s = xe(
1509
+ const o = e != null ? It.is(e) ? e.derive() : W(e) : On(n), s = xe(
1503
1510
  t,
1504
1511
  o
1505
1512
  )((i, r) => i.getTime() - r.getTime());
1506
- return s.onDispose(() => H.dispose(o)), s;
1513
+ return s.onDispose(() => D.dispose(o)), s;
1507
1514
  }, kn = (t, e = {}) => {
1508
1515
  const n = Sn(t, e), o = n.map(Tn);
1509
1516
  return o.onDispose(n.dispose), o;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "2.9.0",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -8,23 +8,27 @@ import { Signal, TNode, Renderable } from '@tempots/dom';
8
8
  * @public
9
9
  */
10
10
  export type InViewportMode = 'partial' | 'full';
11
+ export type InViewportOptions = {
12
+ mode?: InViewportMode;
13
+ once?: boolean;
14
+ };
11
15
  /**
12
16
  * Creates a renderable component that tracks whether the element is in the viewport.
13
17
  *
14
- * @param mode - The mode for tracking the element's visibility in the viewport.
18
+ * @param options - The options for the `InViewport` component.
15
19
  * @param fn - A function that returns the renderable component based on the visibility signal.
16
20
  * @returns The renderable component that tracks the element's visibility in the viewport.
17
21
  * @public
18
22
  */
19
- export declare const InViewport: (mode: InViewportMode, fn: (value: Signal<boolean>) => TNode) => Renderable;
23
+ export declare const InViewport: ({ mode, once }: InViewportOptions, fn: (value: Signal<boolean>) => TNode) => Renderable;
20
24
  /**
21
25
  * Executes the provided `then` function when the element is in the viewport.
22
26
  * Optionally, executes the `otherwise` function when the element is not in the viewport.
23
27
  *
24
- * @param mode - The mode to determine when the element is considered in the viewport.
28
+ * @param options - The options for the `InViewport` component.
25
29
  * @param then - The function to execute when the element is in the viewport.
26
30
  * @param otherwise - The function to execute when the element is not in the viewport.
27
31
  * @returns The result of executing the `then` function or the `otherwise` function.
28
32
  * @public
29
33
  */
30
- export declare const WhenInViewport: (mode: InViewportMode, then: () => TNode, otherwise?: () => TNode) => Renderable;
34
+ export declare const WhenInViewport: (options: InViewportOptions, then: () => TNode, otherwise?: () => TNode) => Renderable;
@@ -1,4 +1,4 @@
1
- import { Renderable, Signal, TNode } from '@tempots/dom';
1
+ import { Renderable, Signal, TNode, Value } from '@tempots/dom';
2
2
  import { AsyncResource, ResourceLoadOptions } from '../utils/resource';
3
3
  /**
4
4
  * Options for displaying the different states of an asynchronous resource.
@@ -41,7 +41,7 @@ export declare const ResourceDisplay: <V, E>(resource: AsyncResource<V, E>, opti
41
41
  * @public
42
42
  */
43
43
  export declare const Resource: <R, V, E = unknown>({ request, load, mapError, }: {
44
- request: Signal<R>;
44
+ request: Value<R>;
45
45
  load: (options: ResourceLoadOptions<R, V, E>) => Promise<V>;
46
46
  mapError?: (error: unknown) => E;
47
47
  }) => ((displayOptions: ResourceDisplayOptions<V, E>) => Renderable);
@@ -1,4 +1,4 @@
1
- import { Signal } from '@tempots/dom';
1
+ import { Signal, Value } from '@tempots/dom';
2
2
  import { AsyncResult } from '@tempots/std';
3
3
  /**
4
4
  * Represents an asynchronous resource with its current status, value, error, and loading state.
@@ -51,4 +51,4 @@ export interface ResourceLoadOptions<R, V, E> {
51
51
  * @returns The created asynchronous resource.
52
52
  * @public
53
53
  */
54
- export declare const makeResource: <R, V, E>(request: Signal<R>, load: (options: ResourceLoadOptions<R, V, E>) => Promise<V>, convertError: (error: unknown) => E) => AsyncResource<V, E>;
54
+ export declare const makeResource: <R, V, E>(request: Value<R>, load: (options: ResourceLoadOptions<R, V, E>) => Promise<V>, convertError: (error: unknown) => E) => AsyncResource<V, E>;