@tempots/ui 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.js +73 -73
- package/package.json +1 -1
- package/renderables/resource.d.ts +2 -2
- package/utils/resource.d.ts +2 -2
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=(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(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
|
|
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 =
|
|
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,
|
|
125
|
-
}) : Pt(i,
|
|
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 =
|
|
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(
|
|
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) =>
|
|
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
|
|
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"),
|
|
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 = {
|
|
@@ -181,18 +181,18 @@ function Fe(t) {
|
|
|
181
181
|
}, We[t])), q[t];
|
|
182
182
|
}
|
|
183
183
|
const Me = (t, e) => {
|
|
184
|
-
const n =
|
|
184
|
+
const n = W(!1);
|
|
185
185
|
return At(
|
|
186
186
|
G((o) => {
|
|
187
187
|
const s = typeof IntersectionObserver < "u" ? Fe(t) : null;
|
|
188
|
-
return nt[t].set(o, n), s == null || s.observe(o),
|
|
188
|
+
return nt[t].set(o, n), s == null || s.observe(o), F(() => {
|
|
189
189
|
var i;
|
|
190
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);
|
|
191
191
|
});
|
|
192
192
|
}),
|
|
193
193
|
Rt(e(n))
|
|
194
194
|
);
|
|
195
|
-
}, Bn = (t, e, n) => Me(t, (o) => Gt(o, e, n ?? (() => yt))), ot = Math.min,
|
|
195
|
+
}, 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
196
|
x: t,
|
|
197
197
|
y: t
|
|
198
198
|
}), Ve = {
|
|
@@ -205,12 +205,12 @@ const Me = (t, e) => {
|
|
|
205
205
|
end: "start"
|
|
206
206
|
};
|
|
207
207
|
function Wt(t, e, n) {
|
|
208
|
-
return
|
|
208
|
+
return V(t, ot(e, n));
|
|
209
209
|
}
|
|
210
210
|
function lt(t, e) {
|
|
211
211
|
return typeof t == "function" ? t(e) : t;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function N(t) {
|
|
214
214
|
return t.split("-")[0];
|
|
215
215
|
}
|
|
216
216
|
function at(t) {
|
|
@@ -223,7 +223,7 @@ function se(t) {
|
|
|
223
223
|
return t === "y" ? "height" : "width";
|
|
224
224
|
}
|
|
225
225
|
function z(t) {
|
|
226
|
-
return ["top", "bottom"].includes(
|
|
226
|
+
return ["top", "bottom"].includes(N(t)) ? "y" : "x";
|
|
227
227
|
}
|
|
228
228
|
function ie(t) {
|
|
229
229
|
return oe(z(t));
|
|
@@ -256,7 +256,7 @@ function Ue(t, e, n) {
|
|
|
256
256
|
}
|
|
257
257
|
function He(t, e, n, o) {
|
|
258
258
|
const s = at(t);
|
|
259
|
-
let i = Ue(
|
|
259
|
+
let i = Ue(N(t), n === "start", o);
|
|
260
260
|
return s && (i = i.map((r) => r + "-" + s), e && (i = i.concat(i.map(xt)))), i;
|
|
261
261
|
}
|
|
262
262
|
function it(t) {
|
|
@@ -302,7 +302,7 @@ function Ft(t, e, n) {
|
|
|
302
302
|
reference: o,
|
|
303
303
|
floating: s
|
|
304
304
|
} = t;
|
|
305
|
-
const i = z(e), r = ie(e), c = se(r), l =
|
|
305
|
+
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
306
|
let h;
|
|
307
307
|
switch (l) {
|
|
308
308
|
case "top":
|
|
@@ -475,37 +475,37 @@ const je = function(t) {
|
|
|
475
475
|
} = lt(t, e);
|
|
476
476
|
if ((n = i.arrow) != null && n.alignmentOffset)
|
|
477
477
|
return {};
|
|
478
|
-
const p =
|
|
479
|
-
!d &&
|
|
478
|
+
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";
|
|
479
|
+
!d && B && v.push(...He(c, g, m, b));
|
|
480
480
|
const me = [c, ...v], mt = await re(e, y), Z = [];
|
|
481
481
|
let j = ((o = i.flip) == null ? void 0 : o.overflows) || [];
|
|
482
482
|
if (f && Z.push(mt[p]), u) {
|
|
483
|
-
const
|
|
484
|
-
Z.push(mt[
|
|
483
|
+
const M = $e(s, r, b);
|
|
484
|
+
Z.push(mt[M[0]], mt[M[1]]);
|
|
485
485
|
}
|
|
486
486
|
if (j = [...j, {
|
|
487
487
|
placement: s,
|
|
488
488
|
overflows: Z
|
|
489
|
-
}], !Z.every((
|
|
489
|
+
}], !Z.every((M) => M <= 0)) {
|
|
490
490
|
var St, kt;
|
|
491
|
-
const
|
|
491
|
+
const M = (((St = i.flip) == null ? void 0 : St.index) || 0) + 1, Dt = me[M];
|
|
492
492
|
if (Dt)
|
|
493
493
|
return {
|
|
494
494
|
data: {
|
|
495
|
-
index:
|
|
495
|
+
index: M,
|
|
496
496
|
overflows: j
|
|
497
497
|
},
|
|
498
498
|
reset: {
|
|
499
499
|
placement: Dt
|
|
500
500
|
}
|
|
501
501
|
};
|
|
502
|
-
let Y = (kt = j.filter((
|
|
502
|
+
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
503
|
if (!Y)
|
|
504
504
|
switch (h) {
|
|
505
505
|
case "bestFit": {
|
|
506
506
|
var Ct;
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
507
|
+
const U = (Ct = j.filter((S) => {
|
|
508
|
+
if (B) {
|
|
509
509
|
const k = z(S.placement);
|
|
510
510
|
return k === w || // Create a bias to the `y` side axis due to horizontal
|
|
511
511
|
// reading directions favoring greater width.
|
|
@@ -513,7 +513,7 @@ const je = function(t) {
|
|
|
513
513
|
}
|
|
514
514
|
return !0;
|
|
515
515
|
}).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
|
-
|
|
516
|
+
U && (Y = U);
|
|
517
517
|
break;
|
|
518
518
|
}
|
|
519
519
|
case "initialPlacement":
|
|
@@ -536,7 +536,7 @@ async function Ye(t, e) {
|
|
|
536
536
|
placement: n,
|
|
537
537
|
platform: o,
|
|
538
538
|
elements: s
|
|
539
|
-
} = t, i = await (o.isRTL == null ? void 0 : o.isRTL(s.floating)), r =
|
|
539
|
+
} = 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
540
|
let {
|
|
541
541
|
mainAxis: d,
|
|
542
542
|
crossAxis: h,
|
|
@@ -608,7 +608,7 @@ const qe = function(t) {
|
|
|
608
608
|
} = lt(t, e), a = {
|
|
609
609
|
x: n,
|
|
610
610
|
y: o
|
|
611
|
-
}, f = await re(e, l), u = z(
|
|
611
|
+
}, f = await re(e, l), u = z(N(s)), d = oe(u);
|
|
612
612
|
let h = a[d], m = a[u];
|
|
613
613
|
if (i) {
|
|
614
614
|
const y = d === "y" ? "top" : "left", p = d === "y" ? "bottom" : "right", w = h + f[y], x = h - f[p];
|
|
@@ -689,13 +689,13 @@ function Et(t) {
|
|
|
689
689
|
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
690
|
}
|
|
691
691
|
function Je(t) {
|
|
692
|
-
let e =
|
|
692
|
+
let e = P(t);
|
|
693
693
|
for (; O(e) && !_(e); ) {
|
|
694
694
|
if (Et(e))
|
|
695
695
|
return e;
|
|
696
696
|
if (ft(e))
|
|
697
697
|
return null;
|
|
698
|
-
e =
|
|
698
|
+
e = P(e);
|
|
699
699
|
}
|
|
700
700
|
return null;
|
|
701
701
|
}
|
|
@@ -717,7 +717,7 @@ function ht(t) {
|
|
|
717
717
|
scrollTop: t.scrollY
|
|
718
718
|
};
|
|
719
719
|
}
|
|
720
|
-
function
|
|
720
|
+
function P(t) {
|
|
721
721
|
if (I(t) === "html")
|
|
722
722
|
return t;
|
|
723
723
|
const e = (
|
|
@@ -730,7 +730,7 @@ function D(t) {
|
|
|
730
730
|
return Mt(e) ? e.host : e;
|
|
731
731
|
}
|
|
732
732
|
function le(t) {
|
|
733
|
-
const e =
|
|
733
|
+
const e = P(t);
|
|
734
734
|
return _(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : O(e) && Q(e) ? e : le(e);
|
|
735
735
|
}
|
|
736
736
|
function K(t, e, n) {
|
|
@@ -759,7 +759,7 @@ function ae(t) {
|
|
|
759
759
|
function Ot(t) {
|
|
760
760
|
return R(t) ? t : t.contextElement;
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function H(t) {
|
|
763
763
|
const e = Ot(t);
|
|
764
764
|
if (!O(e))
|
|
765
765
|
return L(1);
|
|
@@ -785,18 +785,18 @@ function ue(t) {
|
|
|
785
785
|
function Qe(t, e, n) {
|
|
786
786
|
return e === void 0 && (e = !1), !n || e && n !== A(t) ? !1 : e;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function $(t, e, n, o) {
|
|
789
789
|
e === void 0 && (e = !1), n === void 0 && (n = !1);
|
|
790
790
|
const s = t.getBoundingClientRect(), i = Ot(t);
|
|
791
791
|
let r = L(1);
|
|
792
|
-
e && (o ? R(o) && (r =
|
|
792
|
+
e && (o ? R(o) && (r = H(o)) : r = H(t));
|
|
793
793
|
const c = Qe(i, n, o) ? ue(i) : L(0);
|
|
794
794
|
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
795
|
if (i) {
|
|
796
796
|
const d = A(i), h = o && R(o) ? A(o) : o;
|
|
797
797
|
let m = d, g = vt(m);
|
|
798
798
|
for (; g && o && h !== m; ) {
|
|
799
|
-
const y =
|
|
799
|
+
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
800
|
l *= y.x, a *= y.y, f *= y.x, u *= y.y, l += x, a += b, m = A(g), g = vt(m);
|
|
801
801
|
}
|
|
802
802
|
}
|
|
@@ -809,7 +809,7 @@ function N(t, e, n, o) {
|
|
|
809
809
|
}
|
|
810
810
|
function Tt(t, e) {
|
|
811
811
|
const n = ht(t).scrollLeft;
|
|
812
|
-
return e ? e.left + n :
|
|
812
|
+
return e ? e.left + n : $(T(t)).left + n;
|
|
813
813
|
}
|
|
814
814
|
function fe(t, e, n) {
|
|
815
815
|
n === void 0 && (n = !1);
|
|
@@ -838,8 +838,8 @@ function Ze(t) {
|
|
|
838
838
|
}, a = L(1);
|
|
839
839
|
const f = L(0), u = O(o);
|
|
840
840
|
if ((u || !u && !i) && ((I(o) !== "body" || Q(r)) && (l = ht(o)), O(o))) {
|
|
841
|
-
const h =
|
|
842
|
-
a =
|
|
841
|
+
const h = $(o);
|
|
842
|
+
a = H(o), f.x = h.x + o.clientLeft, f.y = h.y + o.clientTop;
|
|
843
843
|
}
|
|
844
844
|
const d = r && !u && !i ? fe(r, l, !0) : L(0);
|
|
845
845
|
return {
|
|
@@ -853,10 +853,10 @@ function tn(t) {
|
|
|
853
853
|
return Array.from(t.getClientRects());
|
|
854
854
|
}
|
|
855
855
|
function en(t) {
|
|
856
|
-
const e = T(t), n = ht(t), o = t.ownerDocument.body, s =
|
|
856
|
+
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
857
|
let r = -n.scrollLeft + Tt(t);
|
|
858
858
|
const c = -n.scrollTop;
|
|
859
|
-
return E(o).direction === "rtl" && (r +=
|
|
859
|
+
return E(o).direction === "rtl" && (r += V(e.clientWidth, o.clientWidth) - s), {
|
|
860
860
|
width: s,
|
|
861
861
|
height: i,
|
|
862
862
|
x: r,
|
|
@@ -879,7 +879,7 @@ function nn(t, e) {
|
|
|
879
879
|
};
|
|
880
880
|
}
|
|
881
881
|
function on(t, e) {
|
|
882
|
-
const n =
|
|
882
|
+
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
883
|
return {
|
|
884
884
|
width: r,
|
|
885
885
|
height: c,
|
|
@@ -907,7 +907,7 @@ function Vt(t, e, n) {
|
|
|
907
907
|
return rt(o);
|
|
908
908
|
}
|
|
909
909
|
function he(t, e) {
|
|
910
|
-
const n =
|
|
910
|
+
const n = P(t);
|
|
911
911
|
return n === e || !R(n) || _(n) ? !1 : E(n).position === "fixed" || he(n, e);
|
|
912
912
|
}
|
|
913
913
|
function sn(t, e) {
|
|
@@ -916,10 +916,10 @@ function sn(t, e) {
|
|
|
916
916
|
return n;
|
|
917
917
|
let o = K(t, [], !1).filter((c) => R(c) && I(c) !== "body"), s = null;
|
|
918
918
|
const i = E(t).position === "fixed";
|
|
919
|
-
let r = i ?
|
|
919
|
+
let r = i ? P(t) : t;
|
|
920
920
|
for (; R(r) && !_(r); ) {
|
|
921
921
|
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 =
|
|
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 = P(r);
|
|
923
923
|
}
|
|
924
924
|
return e.set(t, o), o;
|
|
925
925
|
}
|
|
@@ -932,7 +932,7 @@ function rn(t) {
|
|
|
932
932
|
} = t;
|
|
933
933
|
const r = [...n === "clippingAncestors" ? ft(e) ? [] : sn(e, this._c) : [].concat(n), o], c = r[0], l = r.reduce((a, f) => {
|
|
934
934
|
const u = Vt(e, f, s);
|
|
935
|
-
return a.top =
|
|
935
|
+
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
936
|
}, Vt(e, c, s));
|
|
937
937
|
return {
|
|
938
938
|
width: l.right - l.left,
|
|
@@ -952,7 +952,7 @@ function cn(t) {
|
|
|
952
952
|
};
|
|
953
953
|
}
|
|
954
954
|
function ln(t, e, n) {
|
|
955
|
-
const o = O(e), s = T(e), i = n === "fixed", r =
|
|
955
|
+
const o = O(e), s = T(e), i = n === "fixed", r = $(t, !0, i, e);
|
|
956
956
|
let c = {
|
|
957
957
|
scrollLeft: 0,
|
|
958
958
|
scrollTop: 0
|
|
@@ -960,7 +960,7 @@ function ln(t, e, n) {
|
|
|
960
960
|
const l = L(0);
|
|
961
961
|
if (o || !o && !i)
|
|
962
962
|
if ((I(e) !== "body" || Q(s)) && (c = ht(e)), o) {
|
|
963
|
-
const d =
|
|
963
|
+
const d = $(e, !0, i, e);
|
|
964
964
|
l.x = d.x + e.clientLeft, l.y = d.y + e.clientTop;
|
|
965
965
|
} else s && (l.x = Tt(s));
|
|
966
966
|
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 +987,11 @@ function de(t, e) {
|
|
|
987
987
|
if (ft(t))
|
|
988
988
|
return n;
|
|
989
989
|
if (!O(t)) {
|
|
990
|
-
let s =
|
|
990
|
+
let s = P(t);
|
|
991
991
|
for (; s && !_(s); ) {
|
|
992
992
|
if (R(s) && !gt(s))
|
|
993
993
|
return s;
|
|
994
|
-
s =
|
|
994
|
+
s = P(s);
|
|
995
995
|
}
|
|
996
996
|
return n;
|
|
997
997
|
}
|
|
@@ -1023,7 +1023,7 @@ const fn = {
|
|
|
1023
1023
|
getElementRects: an,
|
|
1024
1024
|
getClientRects: tn,
|
|
1025
1025
|
getDimensions: cn,
|
|
1026
|
-
getScale:
|
|
1026
|
+
getScale: H,
|
|
1027
1027
|
isElement: R,
|
|
1028
1028
|
isRTL: un
|
|
1029
1029
|
};
|
|
@@ -1046,15 +1046,15 @@ function hn(t, e) {
|
|
|
1046
1046
|
return;
|
|
1047
1047
|
const h = et(f), m = et(s.clientWidth - (a + u)), g = et(s.clientHeight - (f + d)), y = et(a), w = {
|
|
1048
1048
|
rootMargin: -h + "px " + -m + "px " + -g + "px " + -y + "px",
|
|
1049
|
-
threshold:
|
|
1049
|
+
threshold: V(0, ot(1, l)) || 1
|
|
1050
1050
|
};
|
|
1051
1051
|
let x = !0;
|
|
1052
1052
|
function b(v) {
|
|
1053
|
-
const
|
|
1054
|
-
if (
|
|
1053
|
+
const B = v[0].intersectionRatio;
|
|
1054
|
+
if (B !== l) {
|
|
1055
1055
|
if (!x)
|
|
1056
1056
|
return r();
|
|
1057
|
-
|
|
1057
|
+
B ? r(!1, B) : o = setTimeout(() => {
|
|
1058
1058
|
r(!1, 1e-7);
|
|
1059
1059
|
}, 1e3);
|
|
1060
1060
|
}
|
|
@@ -1096,10 +1096,10 @@ function dn(t, e, n, o) {
|
|
|
1096
1096
|
(x = h) == null || x.observe(e);
|
|
1097
1097
|
})), n();
|
|
1098
1098
|
}), a && !l && h.observe(a), h.observe(e));
|
|
1099
|
-
let m, g = l ?
|
|
1099
|
+
let m, g = l ? $(t) : null;
|
|
1100
1100
|
l && y();
|
|
1101
1101
|
function y() {
|
|
1102
|
-
const p =
|
|
1102
|
+
const p = $(t);
|
|
1103
1103
|
g && (p.x !== g.x || p.y !== g.y || p.width !== g.width || p.height !== g.height) && n(), g = p, m = requestAnimationFrame(y);
|
|
1104
1104
|
}
|
|
1105
1105
|
return n(), () => {
|
|
@@ -1127,7 +1127,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
|
|
|
1127
1127
|
placement: n,
|
|
1128
1128
|
offset: { mainAxis: o, crossAxis: s } = { mainAxis: 0, crossAxis: 0 }
|
|
1129
1129
|
}) => Qt((i) => {
|
|
1130
|
-
const r =
|
|
1130
|
+
const r = D.toSignal(e), c = i.element;
|
|
1131
1131
|
return Gt(
|
|
1132
1132
|
r,
|
|
1133
1133
|
() => Jt(
|
|
@@ -1135,7 +1135,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
|
|
|
1135
1135
|
Yt.div(
|
|
1136
1136
|
G((l) => {
|
|
1137
1137
|
const a = l;
|
|
1138
|
-
return a.style.position = "absolute",
|
|
1138
|
+
return a.style.position = "absolute", F(
|
|
1139
1139
|
dn(c, a, async () => {
|
|
1140
1140
|
const { x: f, y: u } = await gn(c, a, {
|
|
1141
1141
|
placement: n,
|
|
@@ -1156,7 +1156,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
|
|
|
1156
1156
|
)
|
|
1157
1157
|
);
|
|
1158
1158
|
}), yn = (t, e, n) => {
|
|
1159
|
-
const o =
|
|
1159
|
+
const o = W(C.notAsked), s = o.map(
|
|
1160
1160
|
(u) => C.isSuccess(u) ? u.value : void 0
|
|
1161
1161
|
), i = o.map(
|
|
1162
1162
|
(u) => C.isFailure(u) ? u.error : void 0
|
|
@@ -1172,10 +1172,10 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
|
|
|
1172
1172
|
} catch (m) {
|
|
1173
1173
|
c = void 0, o.set(C.failure(n(m)));
|
|
1174
1174
|
}
|
|
1175
|
-
}, a = () => l(
|
|
1175
|
+
}, a = () => l(D.get(t)), f = () => {
|
|
1176
1176
|
c == null || c.abort(), c = void 0, o.dispose();
|
|
1177
1177
|
};
|
|
1178
|
-
return o.onDispose(
|
|
1178
|
+
return o.onDispose(D.on(t, l)), {
|
|
1179
1179
|
status: o,
|
|
1180
1180
|
value: s,
|
|
1181
1181
|
error: i,
|
|
@@ -1186,7 +1186,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
|
|
|
1186
1186
|
}, wn = (t, e) => {
|
|
1187
1187
|
const { status: n, dispose: o, reload: s } = t, { loading: i, failure: r, success: c } = e;
|
|
1188
1188
|
return At(
|
|
1189
|
-
|
|
1189
|
+
F(o),
|
|
1190
1190
|
ne(n, {
|
|
1191
1191
|
loading: i != null ? (l) => i(l, s) : void 0,
|
|
1192
1192
|
failure: r != null ? (l) => r(l, s) : void 0,
|
|
@@ -1204,10 +1204,10 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
|
|
|
1204
1204
|
if (typeof e == "function")
|
|
1205
1205
|
return xn(t, { success: e });
|
|
1206
1206
|
const n = e.failure ?? ((s) => At(
|
|
1207
|
-
|
|
1207
|
+
F(s.on(console.error)),
|
|
1208
1208
|
s.map((i) => `Error: ${i}`)
|
|
1209
1209
|
)), o = e.success;
|
|
1210
|
-
return Xt(
|
|
1210
|
+
return Xt(D.toSignal(t), {
|
|
1211
1211
|
Success: (s) => o(s.$.value),
|
|
1212
1212
|
Failure: (s) => n(s.$.error)
|
|
1213
1213
|
});
|
|
@@ -1364,15 +1364,15 @@ function Bt(t) {
|
|
|
1364
1364
|
});
|
|
1365
1365
|
}
|
|
1366
1366
|
const vn = (t) => Qt((e) => {
|
|
1367
|
-
const { element: n } = e, o =
|
|
1367
|
+
const { element: n } = e, o = W(Bt(n)), s = Rt(t(o))(e), i = () => {
|
|
1368
1368
|
o.set(dt.of(Bt(n)));
|
|
1369
1369
|
};
|
|
1370
1370
|
let r;
|
|
1371
|
-
return typeof ResizeObserver == "function" && (r = new ResizeObserver(i), r.observe(n)),
|
|
1371
|
+
return typeof ResizeObserver == "function" && (r = new ResizeObserver(i), r.observe(n)), F((c) => {
|
|
1372
1372
|
r == null || r.disconnect(), s(c);
|
|
1373
1373
|
});
|
|
1374
1374
|
}), _n = (t) => vn(t), In = (t) => (e) => {
|
|
1375
|
-
const n = J(), o =
|
|
1375
|
+
const n = J(), o = W({
|
|
1376
1376
|
width: (n == null ? void 0 : n.innerWidth) ?? 0,
|
|
1377
1377
|
height: (n == null ? void 0 : n.innerHeight) ?? 0
|
|
1378
1378
|
}), s = Rt(t(o))(e), i = () => {
|
|
@@ -1488,7 +1488,7 @@ function zt(t, e, n, o) {
|
|
|
1488
1488
|
);
|
|
1489
1489
|
}
|
|
1490
1490
|
const On = (t = 1e3) => {
|
|
1491
|
-
const e =
|
|
1491
|
+
const e = W(/* @__PURE__ */ new Date()), n = be(() => e.set(/* @__PURE__ */ new Date()), t);
|
|
1492
1492
|
return e.onDispose(n), e;
|
|
1493
1493
|
}, Tn = (t) => {
|
|
1494
1494
|
const e = Math.abs(t);
|
|
@@ -1499,11 +1499,11 @@ const On = (t = 1e3) => {
|
|
|
1499
1499
|
return t < 0 ? zt(e, n.value, n.past.singular, n.past.plural) : zt(e, n.value, n.future.singular, n.future.plural);
|
|
1500
1500
|
throw new Error("unreachable");
|
|
1501
1501
|
}, Sn = (t, { now: e, frequency: n = 1e4 } = {}) => {
|
|
1502
|
-
const o = e != null ? It.is(e) ? e.derive() :
|
|
1502
|
+
const o = e != null ? It.is(e) ? e.derive() : W(e) : On(n), s = xe(
|
|
1503
1503
|
t,
|
|
1504
1504
|
o
|
|
1505
1505
|
)((i, r) => i.getTime() - r.getTime());
|
|
1506
|
-
return s.onDispose(() =>
|
|
1506
|
+
return s.onDispose(() => D.dispose(o)), s;
|
|
1507
1507
|
}, kn = (t, e = {}) => {
|
|
1508
1508
|
const n = Sn(t, e), o = n.map(Tn);
|
|
1509
1509
|
return o.onDispose(n.dispose), o;
|
package/package.json
CHANGED
|
@@ -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:
|
|
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);
|
package/utils/resource.d.ts
CHANGED
|
@@ -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:
|
|
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>;
|