@tempots/ui 1.2.1-next.0 → 1.2.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var de=Object.defineProperty;var me=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Rt=(t,e,n)=>me(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),O=require("@tempots/std"),Ft=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Mt=(t,e)=>{const n=Ft(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},he=(t,e,n,o)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const i=r;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:s,search:c,hash:u}=i;if(o){const l=s+c+u,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==l)return!0}return e?!1:Mt(n,s)},Wt=(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=>{he(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},Vt=a.makeProviderMark("LocationProvider"),pe=t=>a.Fragment(a.OnBrowserCtx(()=>a.Async(Promise.resolve().then(()=>require("./browser-location-D36kVbd7.cjs")).then(e=>e.ProvideBrowserLocation),e=>e(t))),a.OnHeadlessCtx(e=>a.Async(Promise.resolve().then(()=>require("./headless-location-8Va85S-Q.cjs")).then(n=>n.ProvideHeadlessLocation),n=>n(e.container.currentURL,t)))),mt=t=>a.UseProvider(Vt,e=>n=>{const o=a.makeProp(e.value,e.equals);e.feedProp(o),o.on(e.set);const r=a.renderableOfTNode(t(o))(n);return i=>{o.dispose(),r(i)}}),ge=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Nt=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let r=n.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:n.pathname,search:o,hash:r===""?void 0:r}},$t=(t,e)=>{const n=Nt(e);return t.set(n),t},ye=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},Ht=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return Ht({href:t},...e);const{href:n,...o}=t;return mt(r=>a.html.a(a.on.click(Wt(()=>($t(r,a.Value.get(n)),!0),o)),a.attr.href(n),...e))},ht=a.makeProviderMark("Appearance"),we=t=>{const e=a.getWindow(),n=e!=null&&e.matchMedia!=null&&e.matchMedia("(prefers-color-scheme: dark)").matches,o=a.makeProp(n?"dark":"light"),r=s=>{o.set(s.matches?"dark":"light")},i=e!=null&&e.matchMedia!=null?e.matchMedia("(prefers-color-scheme: dark)"):void 0;return i==null||i.addEventListener("change",r),a.Fragment(a.WithProvider(ht,o,t),a.OnDispose(()=>i==null?void 0:i.removeEventListener("change",r)))},ve=t=>a.UseProvider(ht,t),Ut=(t,e)=>{if(typeof e=="function")return Ut(t,{success:e});const n=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(c=>`Error: ${c}`))),o=e.success,r=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:s=>o(s.$.value),AsyncFailure:s=>n(s.$.error),Loading:s=>r(s.$.previousValue??a.makeSignal(void 0)),NotAsked:i})},xe=(t=10)=>a.OnElement(e=>a.OnDispose(O.delayed(()=>e==null?void 0:e.focus(),t))),be=(t=10)=>a.OnElement(e=>{const n=O.delayed(()=>e.select(),t);return a.OnDispose(n)}),Ae=a.OnElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Re=t=>a.Portal("head > title",a.attr.innerText(t)),Oe={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},G={partial:new Map,full:new Map},j={partial:null,full:null};function Ee(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=G[t].get(n.target);o==null||o.set(n.isIntersecting)})},Oe[t])),j[t]}const zt=(t,e)=>{const n=a.makeProp(!1);return a.Fragment(a.OnElement(o=>{const r=typeof IntersectionObserver<"u"?Ee(t):null;return G[t].set(o,n),r==null||r.observe(o),a.OnDispose(()=>{var i;n.dispose(),r==null||r.unobserve(o),G[t].delete(o),G[t].size===0&&((i=j[t])==null||i.disconnect(),j[t]=null)})}),a.renderableOfTNode(e(n)))},ke=(t,e,n)=>zt(t,o=>a.When(o,e,n??(()=>a.Empty))),Q=Math.min,M=Math.max,Z=Math.round,J=Math.floor,L=t=>({x:t,y:t}),Le={left:"right",right:"left",bottom:"top",top:"bottom"},Se={start:"end",end:"start"};function Ot(t,e,n){return M(t,Q(e,n))}function ot(t,e){return typeof t=="function"?t(e):t}function W(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function Bt(t){return t==="x"?"y":"x"}function _t(t){return t==="y"?"height":"width"}function U(t){return["top","bottom"].includes(W(t))?"y":"x"}function It(t){return Bt(U(t))}function Te(t,e,n){n===void 0&&(n=!1);const o=rt(t),r=It(t),i=_t(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=tt(s)),[s,tt(s)]}function Pe(t){const e=tt(t);return[ut(t),e,ut(e)]}function ut(t){return t.replace(/start|end/g,e=>Se[e])}function Ce(t,e,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?r:o:e?o:r;case"left":case"right":return e?i:s;default:return[]}}function De(t,e,n,o){const r=rt(t);let i=Ce(W(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(ut)))),i}function tt(t){return t.replace(/left|right|bottom|top/g,e=>Le[e])}function Fe(t){return{top:0,right:0,bottom:0,left:0,...t}}function Me(t){return typeof t!="number"?Fe(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function Et(t,e,n){let{reference:o,floating:r}=t;const i=U(e),s=It(e),c=_t(s),u=W(e),l=i==="y",d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,h=o[c]/2-r[c]/2;let m;switch(u){case"top":m={x:d,y:o.y-r.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:f};break;case"left":m={x:o.x-r.width,y:f};break;default:m={x:o.x,y:o.y}}switch(rt(e)){case"start":m[s]-=h*(n&&l?-1:1);break;case"end":m[s]+=h*(n&&l?-1:1);break}return m}const We=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=i.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:f}=Et(l,o,u),h=o,m={},p=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x:v,y:x,data:A,reset:b}=await g({x:d,y:f,initialPlacement:o,placement:h,strategy:r,middlewareData:m,rects:l,platform:s,elements:{reference:t,floating:e}});d=v??d,f=x??f,m={...m,[w]:{...m[w],...A}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(h=b.placement),b.rects&&(l=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):b.rects),{x:d,y:f}=Et(l,h,u)),y=-1)}return{x:d,y:f,placement:h,strategy:r,middlewareData:m}};async function jt(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:u}=t,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=ot(e,t),p=Me(m),w=c[h?f==="floating"?"reference":"floating":f],g=et(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:l,rootBoundary:d,strategy:u})),v=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},b=et(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:u}):v);return{top:(g.top-b.top+p.top)/A.y,bottom:(b.bottom-g.bottom+p.bottom)/A.y,left:(g.left-b.left+p.left)/A.x,right:(b.right-g.right+p.right)/A.x}}const Ve=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:u,elements:l}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:y=!0,...w}=ot(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=W(r),v=U(c),x=W(c)===c,A=await(u.isRTL==null?void 0:u.isRTL(l.floating)),b=h||(x||!y?[tt(c)]:Pe(c)),N=p!=="none";!h&&N&&b.push(...De(c,y,p,A));const ue=[c,...b],lt=await jt(e,w),X=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&X.push(lt[g]),f){const F=Te(r,s,A);X.push(lt[F[0]],lt[F[1]])}if(_=[..._,{placement:r,overflows:X}],!X.every(F=>F<=0)){var vt,xt;const F=(((vt=i.flip)==null?void 0:vt.index)||0)+1,At=ue[F];if(At)return{data:{index:F,overflows:_},reset:{placement:At}};let I=(xt=_.filter($=>$.overflows[0]<=0).sort(($,P)=>$.overflows[1]-P.overflows[1])[0])==null?void 0:xt.placement;if(!I)switch(m){case"bestFit":{var bt;const $=(bt=_.filter(P=>{if(N){const C=U(P.placement);return C===v||C==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(C=>C>0).reduce((C,fe)=>C+fe,0)]).sort((P,C)=>P[1]-C[1])[0])==null?void 0:bt[0];$&&(I=$);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};async function Ne(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=W(n),c=rt(n),u=U(n)==="y",l=["left","top"].includes(s)?-1:1,d=i&&u?-1:1,f=ot(e,t);let{mainAxis:h,crossAxis:m,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof p=="number"&&(m=c==="end"?p*-1:p),u?{x:m*d,y:h*l}:{x:h*l,y:m*d}}const $e=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=e,u=await Ne(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+u.x,y:i+u.y,data:{...u,placement:s}}}}},He=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:w=>{let{x:g,y:v}=w;return{x:g,y:v}}},...u}=ot(t,e),l={x:n,y:o},d=await jt(e,u),f=U(W(r)),h=Bt(f);let m=l[h],p=l[f];if(i){const w=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=m+d[w],x=m-d[g];m=Ot(v,m,x)}if(s){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=p+d[w],x=p-d[g];p=Ot(v,p,x)}const y=c.fn({...e,[h]:m,[f]:p});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[h]:i,[f]:s}}}}}};function it(){return typeof window<"u"}function B(t){return qt(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function T(t){var e;return(e=(qt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function qt(t){return it()?t instanceof Node||t instanceof R(t).Node:!1}function E(t){return it()?t instanceof Element||t instanceof R(t).Element:!1}function S(t){return it()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function kt(t){return!it()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=k(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(r)}function Ue(t){return["table","td","th"].includes(B(t))}function st(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function pt(t){const e=gt(),n=E(t)?k(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 ze(t){let e=D(t);for(;S(e)&&!z(e);){if(pt(e))return e;if(st(e))return null;e=D(e)}return null}function gt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function z(t){return["html","body","#document"].includes(B(t))}function k(t){return R(t).getComputedStyle(t)}function ct(t){return E(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function D(t){if(B(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kt(t)&&t.host||T(t);return kt(e)?e.host:e}function Yt(t){const e=D(t);return z(e)?t.ownerDocument?t.ownerDocument.body:t.body:S(e)&&K(e)?e:Yt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Yt(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=R(r);if(i){const c=ft(s);return e.concat(s,s.visualViewport||[],K(r)?r:[],c&&n?q(c):[])}return e.concat(r,q(r,[],n))}function ft(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Kt(t){const e=k(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=S(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,c=Z(n)!==i||Z(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function yt(t){return E(t)?t:t.contextElement}function H(t){const e=yt(t);if(!S(e))return L(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Kt(e);let s=(i?Z(n.width):n.width)/o,c=(i?Z(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Be=L(0);function Xt(t){const e=R(t);return!gt()||!e.visualViewport?Be:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _e(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==R(t)?!1:e}function V(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=yt(t);let s=L(1);e&&(o?E(o)&&(s=H(o)):s=H(t));const c=_e(i,n,o)?Xt(i):L(0);let u=(r.left+c.x)/s.x,l=(r.top+c.y)/s.y,d=r.width/s.x,f=r.height/s.y;if(i){const h=R(i),m=o&&E(o)?R(o):o;let p=h,y=ft(p);for(;y&&o&&m!==p;){const w=H(y),g=y.getBoundingClientRect(),v=k(y),x=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(v.paddingTop))*w.y;u*=w.x,l*=w.y,d*=w.x,f*=w.y,u+=x,l+=A,p=R(y),y=ft(p)}}return et({width:d,height:f,x:u,y:l})}function wt(t,e){const n=ct(t).scrollLeft;return e?e.left+n:V(T(t)).left+n}function Jt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),r=o.left+e.scrollLeft-(n?0:wt(t,o)),i=o.top+e.scrollTop;return{x:r,y:i}}function Ie(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=T(o),c=e?st(e.floating):!1;if(o===s||c&&i)return n;let u={scrollLeft:0,scrollTop:0},l=L(1);const d=L(0),f=S(o);if((f||!f&&!i)&&((B(o)!=="body"||K(s))&&(u=ct(o)),S(o))){const m=V(o);l=H(o),d.x=m.x+o.clientLeft,d.y=m.y+o.clientTop}const h=s&&!f&&!i?Jt(s,u,!0):L(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+d.x+h.x,y:n.y*l.y-u.scrollTop*l.y+d.y+h.y}}function je(t){return Array.from(t.getClientRects())}function qe(t){const e=T(t),n=ct(t),o=t.ownerDocument.body,r=M(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=M(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+wt(t);const c=-n.scrollTop;return k(o).direction==="rtl"&&(s+=M(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}function Ye(t,e){const n=R(t),o=T(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,u=0;if(r){i=r.width,s=r.height;const l=gt();(!l||l&&e==="fixed")&&(c=r.offsetLeft,u=r.offsetTop)}return{width:i,height:s,x:c,y:u}}function Ke(t,e){const n=V(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=S(t)?H(t):L(1),s=t.clientWidth*i.x,c=t.clientHeight*i.y,u=r*i.x,l=o*i.y;return{width:s,height:c,x:u,y:l}}function Lt(t,e,n){let o;if(e==="viewport")o=Ye(t,n);else if(e==="document")o=qe(T(t));else if(E(e))o=Ke(e,n);else{const r=Xt(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return et(o)}function Gt(t,e){const n=D(t);return n===e||!E(n)||z(n)?!1:k(n).position==="fixed"||Gt(n,e)}function Xe(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>E(c)&&B(c)!=="body"),r=null;const i=k(t).position==="fixed";let s=i?D(t):t;for(;E(s)&&!z(s);){const c=k(s),u=pt(s);!u&&c.position==="fixed"&&(r=null),(i?!u&&!r:!u&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||K(s)&&!u&&Gt(t,s))?o=o.filter(d=>d!==s):r=c,s=D(s)}return e.set(t,o),o}function Je(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const s=[...n==="clippingAncestors"?st(e)?[]:Xe(e,this._c):[].concat(n),o],c=s[0],u=s.reduce((l,d)=>{const f=Lt(e,d,r);return l.top=M(f.top,l.top),l.right=Q(f.right,l.right),l.bottom=Q(f.bottom,l.bottom),l.left=M(f.left,l.left),l},Lt(e,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Ge(t){const{width:e,height:n}=Kt(t);return{width:e,height:n}}function Qe(t,e,n){const o=S(e),r=T(e),i=n==="fixed",s=V(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=L(0);if(o||!o&&!i)if((B(e)!=="body"||K(r))&&(c=ct(e)),o){const h=V(e,!0,i,e);u.x=h.x+e.clientLeft,u.y=h.y+e.clientTop}else r&&(u.x=wt(r));const l=r&&!o&&!i?Jt(r,c):L(0),d=s.left+c.scrollLeft-u.x-l.x,f=s.top+c.scrollTop-u.y-l.y;return{x:d,y:f,width:s.width,height:s.height}}function at(t){return k(t).position==="static"}function St(t,e){if(!S(t)||k(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return T(t)===n&&(n=n.ownerDocument.body),n}function Qt(t,e){const n=R(t);if(st(t))return n;if(!S(t)){let r=D(t);for(;r&&!z(r);){if(E(r)&&!at(r))return r;r=D(r)}return n}let o=St(t,e);for(;o&&Ue(o)&&at(o);)o=St(o,e);return o&&z(o)&&at(o)&&!pt(o)?n:o||ze(t)||n}const Ze=async function(t){const e=this.getOffsetParent||Qt,n=this.getDimensions,o=await n(t.floating);return{reference:Qe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function tn(t){return k(t).direction==="rtl"}const en={convertOffsetParentRelativeRectToViewportRelativeRect:Ie,getDocumentElement:T,getClippingRect:Je,getOffsetParent:Qt,getElementRects:Ze,getClientRects:je,getDimensions:Ge,getScale:H,isElement:E,isRTL:tn};function nn(t,e){let n=null,o;const r=T(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const{left:l,top:d,width:f,height:h}=t.getBoundingClientRect();if(c||e(),!f||!h)return;const m=J(d),p=J(r.clientWidth-(l+f)),y=J(r.clientHeight-(d+h)),w=J(l),v={rootMargin:-m+"px "+-p+"px "+-y+"px "+-w+"px",threshold:M(0,Q(1,u))||1};let x=!0;function A(b){const N=b[0].intersectionRatio;if(N!==u){if(!x)return s();N?s(!1,N):o=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(A,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(A,v)}n.observe(t)}return s(!0),i}function on(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=o,l=yt(t),d=r||i?[...l?q(l):[],...q(e)]:[];d.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=l&&c?nn(l,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===l&&m&&(m.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(e)})),n()}),l&&!u&&m.observe(l),m.observe(e));let p,y=u?V(t):null;u&&w();function w(){const g=V(t);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&n(),y=g,p=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(g=m)==null||g.disconnect(),m=null,u&&cancelAnimationFrame(p)}}const rn=$e,sn=He,Tt=Ve,cn=(t,e,n)=>{const o=new Map,r={platform:en,...n},i={...r.platform,_c:o};return We(t,e,{...r,platform:i})},ln=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:r}={mainAxis:0,crossAxis:0}})=>a.OnBrowserCtx(i=>{const s=a.Value.toSignal(e),c=i.element;return a.When(s,()=>a.Portal("body",a.html.div(a.OnElement(u=>{const l=u;return l.style.position="absolute",a.OnDispose(on(c,l,async()=>{const{x:d,y:f}=await cn(c,l,{placement:n,strategy:"absolute",middleware:[Tt(),rn({mainAxis:o,crossAxis:r}),sn(),Tt()]});l.style.top=`${f}px`,l.style.left=`${d}px`}))}),t())))}),Zt=({request:t,load:e,convertError:n})=>{const o=a.makeProp(O.AsyncResult.notAsked),r=o.map(f=>O.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>O.AsyncResult.isFailure(f)?f.error:void 0),s=o.map(f=>O.AsyncResult.isLoading(f));let c;const u=async f=>{c==null||c.abort(),c=new AbortController;const h=c.signal,m=o.get();o.set(O.AsyncResult.loading(O.AsyncResult.getOrUndefined(m)));try{const p=await e({request:f,abortSignal:h,previous:m});c=void 0,o.set(O.AsyncResult.success(p))}catch(p){c=void 0,o.set(O.AsyncResult.failure(n(p)))}},l=()=>u(t.get()),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(t.on(u)),{status:o,value:r,error:i,loading:s,reload:l,dispose:d}},te=(t,e)=>{const{status:n,dispose:o,reload:r}=t,{notAsked:i,loading:s,error:c,success:u}=e;return a.Fragment(a.OnDispose(o),a.OneOfType(n,{NotAsked:()=>i!=null?i(r):void 0,Loading:l=>s!=null?s(l.$.previousValue,r):a.Ensure(l.$.previousValue,d=>u(d,r),()=>a.Empty),AsyncFailure:l=>c!=null?c(l.$.error,r):void 0,AsyncSuccess:l=>u(l.$.value,r)}))},an=t=>{const e=Zt(t);return n=>te(e,n)},ee=(t,e)=>{if(typeof e=="function")return ee(t,{success:e});const n=e.failure??(r=>a.Fragment(a.OnDispose(r.on(console.error)),r.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:r=>o(r.$.value),Failure:r=>n(r.$.error)})},un=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()}),fn=t=>a.OnBrowserCtx(e=>{const{element:n}=e,o=a.makeProp({width:n.clientWidth,height:n.clientHeight}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:n.clientWidth,height:n.clientHeight})};let s;return typeof ResizeObserver=="function"&&(s=new ResizeObserver(i),s.observe(n)),a.OnDispose(c=>{s==null||s.disconnect(),r(c)})}),dn=t=>e=>{const n=a.getWindow(),o=a.makeProp({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),s=>{n==null||n.removeEventListener("resize",i),r(s)}},ne=(t,e)=>{const n=e.split("/").filter(r=>r!==""),o={};for(let r=0;r<t.length;r++){const i=t[r],s=n[r];if(!s&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==s)return null}else if(i.type==="param")o[i.name]=s;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},oe=t=>t.split("/").map(e=>e.startsWith(":")?{type:"param",name:e.slice(1)}:e==="*"?{type:"catch-all"}:{type:"literal",value:e}).filter(e=>e.type!=="literal"||e.value!==""),re=t=>{const e=t.map(n=>{const o=oe(n);return{route:n,segments:o}});return function(o){for(const{segments:r,route:i}of e){const s=ne(r,o);if(s)return{...s,route:i}}return null}},mn=t=>{const e=re(Object.keys(t));return mt(n=>{const o=n.map(r=>{const i=e(r.pathname);if(i==null)throw console.error("No route found for",r),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:r.search,hash:r.hash}});return a.OneOfTuple(o.map(r=>[r.route,r]),t)})},nt=60*1e3,dt=60*nt,Y=24*dt,Pt=7*Y,Ct=30*Y,hn=365*Y,pn=[{max:nt*90,value:nt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:dt*36,value:dt,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:Pt*6,value:Pt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Ct*18,value:Ct,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:hn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Dt(t,e,n,o){const r=Math.round(t/e);return r<=1?n:o.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ie=(t=1e3)=>{const e=a.makeProp(new Date),n=O.interval(()=>e.set(new Date),t);return e.onDispose(n),e},se=t=>{const e=Math.abs(t);if(e<nt)return t<0?"just now":"in a moment";for(const n of pn)if(e<n.max)return t<0?Dt(e,n.value,n.past.singular,n.past.plural):Dt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ce=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.makeProp(e):ie(n),r=a.makeComputedOf(t,o)((i,s)=>i.getTime()-s.getTime());return r.onDispose(()=>a.Value.dispose(o)),r},le=(t,e={})=>{const n=ce(t,e),o=n.map(se);return o.onDispose(n.dispose),o},gn=(t,e={})=>le(t,e);class ae extends a.Prop{constructor(){super(...arguments);Rt(this,"tick",()=>this.update(n=>n+1))}}const yn=(t=0)=>new ae(t,(e,n)=>e===n);exports.Anchor=Ht;exports.AsyncResultView=Ut;exports.AutoFocus=xe;exports.AutoSelect=be;exports.ElementSize=fn;exports.HTMLTitle=Re;exports.HiddenWhenEmpty=Ae;exports.InViewport=zt;exports.LocationProviderMarker=Vt;exports.PopOver=ln;exports.ProvideAppearance=we;exports.ProvideLocation=pe;exports.Resource=an;exports.ResourceDisplay=te;exports.ResultView=ee;exports.Router=mn;exports.SelectOnFocus=un;exports.Ticker=ae;exports.UseAppearance=ve;exports.UseLocation=mt;exports.WhenInViewport=ke;exports.WindowSize=dn;exports._checkExtensionCondition=Mt;exports._getExtension=Ft;exports._makeRouteMatcher=re;exports._parseRouteSegments=oe;exports.appearanceMarker=ht;exports.areLocationsEqual=ge;exports.handleAnchorClick=Wt;exports.locationFromURL=Nt;exports.makeNowSignal=ie;exports.makeRelativeTime=gn;exports.makeRelativeTimeMillisSignal=ce;exports.makeRelativeTimeSignal=le;exports.makeResource=Zt;exports.makeTicker=yn;exports.matchesRoute=ne;exports.setLocationFromUrl=$t;exports.timeDiffToString=se;exports.urlFromLocation=ye;
1
+ "use strict";var de=Object.defineProperty;var me=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Rt=(t,e,n)=>me(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),O=require("@tempots/std"),Ft=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Mt=(t,e)=>{const n=Ft(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},he=(t,e,n,o)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const i=r;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:s,search:c,hash:u}=i;if(o){const l=s+c+u,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==l)return!0}return e?!1:Mt(n,s)},Wt=(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=>{he(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},Vt=a.makeProviderMark("LocationProvider"),pe=t=>a.Fragment(a.OnBrowserCtx(()=>a.Async(Promise.resolve().then(()=>require("./browser-location-D36kVbd7.cjs")).then(e=>e.ProvideBrowserLocation),e=>e(t))),a.OnHeadlessCtx(e=>a.Async(Promise.resolve().then(()=>require("./headless-location-8Va85S-Q.cjs")).then(n=>n.ProvideHeadlessLocation),n=>n(e.container.currentURL,t)))),mt=t=>a.UseProvider(Vt,e=>n=>{const o=a.makeProp(e.value,e.equals);e.feedProp(o),o.on(e.set);const r=a.renderableOfTNode(t(o))(n);return i=>{o.dispose(),r(i)}}),ge=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Nt=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let r=n.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:n.pathname,search:o,hash:r===""?void 0:r}},$t=(t,e)=>{const n=Nt(e);return t.set(n),t},ye=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},Ht=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return Ht({href:t},...e);const{href:n,...o}=t;return mt(r=>a.html.a(a.on.click(Wt(()=>($t(r,a.Value.get(n)),!0),o)),a.attr.href(n),...e))},ht=a.makeProviderMark("Appearance"),we=t=>{const e=a.getWindow(),n=e!=null&&e.matchMedia!=null&&e.matchMedia("(prefers-color-scheme: dark)").matches,o=a.makeProp(n?"dark":"light"),r=s=>{o.set(s.matches?"dark":"light")},i=e!=null&&e.matchMedia!=null?e.matchMedia("(prefers-color-scheme: dark)"):void 0;return i==null||i.addEventListener("change",r),a.Fragment(a.WithProvider(ht,o,t),a.OnDispose(()=>i==null?void 0:i.removeEventListener("change",r)))},ve=t=>a.UseProvider(ht,t),Ut=(t,e)=>{if(typeof e=="function")return Ut(t,{success:e});const n=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(c=>`Error: ${c}`))),o=e.success,r=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:s=>o(s.$.value),AsyncFailure:s=>n(s.$.error),Loading:s=>r(s.$.previousValue??a.makeSignal(void 0)),NotAsked:i})},xe=(t=10)=>a.OnElement(e=>a.OnDispose(O.delayed(()=>e==null?void 0:e.focus(),t))),be=(t=10)=>a.OnElement(e=>{const n=O.delayed(()=>e.select(),t);return a.OnDispose(n)}),Ae=a.OnElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Re=t=>a.Portal("head > title",a.attr.innerText(t)),Oe={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},G={partial:new Map,full:new Map},j={partial:null,full:null};function Ee(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=G[t].get(n.target);o==null||o.set(n.isIntersecting)})},Oe[t])),j[t]}const zt=(t,e)=>{const n=a.makeProp(!1);return a.Fragment(a.OnElement(o=>{const r=typeof IntersectionObserver<"u"?Ee(t):null;return G[t].set(o,n),r==null||r.observe(o),a.OnDispose(()=>{var i;n.dispose(),r==null||r.unobserve(o),G[t].delete(o),G[t].size===0&&((i=j[t])==null||i.disconnect(),j[t]=null)})}),a.renderableOfTNode(e(n)))},ke=(t,e,n)=>zt(t,o=>a.When(o,e,n??(()=>a.Empty))),Q=Math.min,M=Math.max,Z=Math.round,J=Math.floor,L=t=>({x:t,y:t}),Le={left:"right",right:"left",bottom:"top",top:"bottom"},Se={start:"end",end:"start"};function Ot(t,e,n){return M(t,Q(e,n))}function ot(t,e){return typeof t=="function"?t(e):t}function W(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function Bt(t){return t==="x"?"y":"x"}function _t(t){return t==="y"?"height":"width"}function U(t){return["top","bottom"].includes(W(t))?"y":"x"}function It(t){return Bt(U(t))}function Te(t,e,n){n===void 0&&(n=!1);const o=rt(t),r=It(t),i=_t(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=tt(s)),[s,tt(s)]}function Pe(t){const e=tt(t);return[ut(t),e,ut(e)]}function ut(t){return t.replace(/start|end/g,e=>Se[e])}function Ce(t,e,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?r:o:e?o:r;case"left":case"right":return e?i:s;default:return[]}}function De(t,e,n,o){const r=rt(t);let i=Ce(W(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(ut)))),i}function tt(t){return t.replace(/left|right|bottom|top/g,e=>Le[e])}function Fe(t){return{top:0,right:0,bottom:0,left:0,...t}}function Me(t){return typeof t!="number"?Fe(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function Et(t,e,n){let{reference:o,floating:r}=t;const i=U(e),s=It(e),c=_t(s),u=W(e),l=i==="y",d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,h=o[c]/2-r[c]/2;let m;switch(u){case"top":m={x:d,y:o.y-r.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:f};break;case"left":m={x:o.x-r.width,y:f};break;default:m={x:o.x,y:o.y}}switch(rt(e)){case"start":m[s]-=h*(n&&l?-1:1);break;case"end":m[s]+=h*(n&&l?-1:1);break}return m}const We=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=i.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:f}=Et(l,o,u),h=o,m={},p=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x:v,y:x,data:A,reset:b}=await g({x:d,y:f,initialPlacement:o,placement:h,strategy:r,middlewareData:m,rects:l,platform:s,elements:{reference:t,floating:e}});d=v??d,f=x??f,m={...m,[w]:{...m[w],...A}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(h=b.placement),b.rects&&(l=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):b.rects),{x:d,y:f}=Et(l,h,u)),y=-1)}return{x:d,y:f,placement:h,strategy:r,middlewareData:m}};async function jt(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:u}=t,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=ot(e,t),p=Me(m),w=c[h?f==="floating"?"reference":"floating":f],g=et(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:l,rootBoundary:d,strategy:u})),v=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},b=et(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:u}):v);return{top:(g.top-b.top+p.top)/A.y,bottom:(b.bottom-g.bottom+p.bottom)/A.y,left:(g.left-b.left+p.left)/A.x,right:(b.right-g.right+p.right)/A.x}}const Ve=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:u,elements:l}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:y=!0,...w}=ot(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=W(r),v=U(c),x=W(c)===c,A=await(u.isRTL==null?void 0:u.isRTL(l.floating)),b=h||(x||!y?[tt(c)]:Pe(c)),N=p!=="none";!h&&N&&b.push(...De(c,y,p,A));const ue=[c,...b],lt=await jt(e,w),X=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&X.push(lt[g]),f){const F=Te(r,s,A);X.push(lt[F[0]],lt[F[1]])}if(_=[..._,{placement:r,overflows:X}],!X.every(F=>F<=0)){var vt,xt;const F=(((vt=i.flip)==null?void 0:vt.index)||0)+1,At=ue[F];if(At)return{data:{index:F,overflows:_},reset:{placement:At}};let I=(xt=_.filter($=>$.overflows[0]<=0).sort(($,P)=>$.overflows[1]-P.overflows[1])[0])==null?void 0:xt.placement;if(!I)switch(m){case"bestFit":{var bt;const $=(bt=_.filter(P=>{if(N){const C=U(P.placement);return C===v||C==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(C=>C>0).reduce((C,fe)=>C+fe,0)]).sort((P,C)=>P[1]-C[1])[0])==null?void 0:bt[0];$&&(I=$);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};async function Ne(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=W(n),c=rt(n),u=U(n)==="y",l=["left","top"].includes(s)?-1:1,d=i&&u?-1:1,f=ot(e,t);let{mainAxis:h,crossAxis:m,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof p=="number"&&(m=c==="end"?p*-1:p),u?{x:m*d,y:h*l}:{x:h*l,y:m*d}}const $e=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=e,u=await Ne(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+u.x,y:i+u.y,data:{...u,placement:s}}}}},He=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:w=>{let{x:g,y:v}=w;return{x:g,y:v}}},...u}=ot(t,e),l={x:n,y:o},d=await jt(e,u),f=U(W(r)),h=Bt(f);let m=l[h],p=l[f];if(i){const w=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=m+d[w],x=m-d[g];m=Ot(v,m,x)}if(s){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=p+d[w],x=p-d[g];p=Ot(v,p,x)}const y=c.fn({...e,[h]:m,[f]:p});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[h]:i,[f]:s}}}}}};function it(){return typeof window<"u"}function B(t){return qt(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function T(t){var e;return(e=(qt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function qt(t){return it()?t instanceof Node||t instanceof R(t).Node:!1}function E(t){return it()?t instanceof Element||t instanceof R(t).Element:!1}function S(t){return it()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function kt(t){return!it()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=k(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(r)}function Ue(t){return["table","td","th"].includes(B(t))}function st(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function pt(t){const e=gt(),n=E(t)?k(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 ze(t){let e=D(t);for(;S(e)&&!z(e);){if(pt(e))return e;if(st(e))return null;e=D(e)}return null}function gt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function z(t){return["html","body","#document"].includes(B(t))}function k(t){return R(t).getComputedStyle(t)}function ct(t){return E(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function D(t){if(B(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kt(t)&&t.host||T(t);return kt(e)?e.host:e}function Yt(t){const e=D(t);return z(e)?t.ownerDocument?t.ownerDocument.body:t.body:S(e)&&K(e)?e:Yt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Yt(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=R(r);if(i){const c=ft(s);return e.concat(s,s.visualViewport||[],K(r)?r:[],c&&n?q(c):[])}return e.concat(r,q(r,[],n))}function ft(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Kt(t){const e=k(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=S(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,c=Z(n)!==i||Z(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function yt(t){return E(t)?t:t.contextElement}function H(t){const e=yt(t);if(!S(e))return L(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Kt(e);let s=(i?Z(n.width):n.width)/o,c=(i?Z(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Be=L(0);function Xt(t){const e=R(t);return!gt()||!e.visualViewport?Be:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _e(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==R(t)?!1:e}function V(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=yt(t);let s=L(1);e&&(o?E(o)&&(s=H(o)):s=H(t));const c=_e(i,n,o)?Xt(i):L(0);let u=(r.left+c.x)/s.x,l=(r.top+c.y)/s.y,d=r.width/s.x,f=r.height/s.y;if(i){const h=R(i),m=o&&E(o)?R(o):o;let p=h,y=ft(p);for(;y&&o&&m!==p;){const w=H(y),g=y.getBoundingClientRect(),v=k(y),x=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(v.paddingTop))*w.y;u*=w.x,l*=w.y,d*=w.x,f*=w.y,u+=x,l+=A,p=R(y),y=ft(p)}}return et({width:d,height:f,x:u,y:l})}function wt(t,e){const n=ct(t).scrollLeft;return e?e.left+n:V(T(t)).left+n}function Jt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),r=o.left+e.scrollLeft-(n?0:wt(t,o)),i=o.top+e.scrollTop;return{x:r,y:i}}function Ie(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=T(o),c=e?st(e.floating):!1;if(o===s||c&&i)return n;let u={scrollLeft:0,scrollTop:0},l=L(1);const d=L(0),f=S(o);if((f||!f&&!i)&&((B(o)!=="body"||K(s))&&(u=ct(o)),S(o))){const m=V(o);l=H(o),d.x=m.x+o.clientLeft,d.y=m.y+o.clientTop}const h=s&&!f&&!i?Jt(s,u,!0):L(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+d.x+h.x,y:n.y*l.y-u.scrollTop*l.y+d.y+h.y}}function je(t){return Array.from(t.getClientRects())}function qe(t){const e=T(t),n=ct(t),o=t.ownerDocument.body,r=M(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=M(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+wt(t);const c=-n.scrollTop;return k(o).direction==="rtl"&&(s+=M(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}function Ye(t,e){const n=R(t),o=T(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,u=0;if(r){i=r.width,s=r.height;const l=gt();(!l||l&&e==="fixed")&&(c=r.offsetLeft,u=r.offsetTop)}return{width:i,height:s,x:c,y:u}}function Ke(t,e){const n=V(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=S(t)?H(t):L(1),s=t.clientWidth*i.x,c=t.clientHeight*i.y,u=r*i.x,l=o*i.y;return{width:s,height:c,x:u,y:l}}function Lt(t,e,n){let o;if(e==="viewport")o=Ye(t,n);else if(e==="document")o=qe(T(t));else if(E(e))o=Ke(e,n);else{const r=Xt(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return et(o)}function Gt(t,e){const n=D(t);return n===e||!E(n)||z(n)?!1:k(n).position==="fixed"||Gt(n,e)}function Xe(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>E(c)&&B(c)!=="body"),r=null;const i=k(t).position==="fixed";let s=i?D(t):t;for(;E(s)&&!z(s);){const c=k(s),u=pt(s);!u&&c.position==="fixed"&&(r=null),(i?!u&&!r:!u&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||K(s)&&!u&&Gt(t,s))?o=o.filter(d=>d!==s):r=c,s=D(s)}return e.set(t,o),o}function Je(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const s=[...n==="clippingAncestors"?st(e)?[]:Xe(e,this._c):[].concat(n),o],c=s[0],u=s.reduce((l,d)=>{const f=Lt(e,d,r);return l.top=M(f.top,l.top),l.right=Q(f.right,l.right),l.bottom=Q(f.bottom,l.bottom),l.left=M(f.left,l.left),l},Lt(e,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Ge(t){const{width:e,height:n}=Kt(t);return{width:e,height:n}}function Qe(t,e,n){const o=S(e),r=T(e),i=n==="fixed",s=V(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=L(0);if(o||!o&&!i)if((B(e)!=="body"||K(r))&&(c=ct(e)),o){const h=V(e,!0,i,e);u.x=h.x+e.clientLeft,u.y=h.y+e.clientTop}else r&&(u.x=wt(r));const l=r&&!o&&!i?Jt(r,c):L(0),d=s.left+c.scrollLeft-u.x-l.x,f=s.top+c.scrollTop-u.y-l.y;return{x:d,y:f,width:s.width,height:s.height}}function at(t){return k(t).position==="static"}function St(t,e){if(!S(t)||k(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return T(t)===n&&(n=n.ownerDocument.body),n}function Qt(t,e){const n=R(t);if(st(t))return n;if(!S(t)){let r=D(t);for(;r&&!z(r);){if(E(r)&&!at(r))return r;r=D(r)}return n}let o=St(t,e);for(;o&&Ue(o)&&at(o);)o=St(o,e);return o&&z(o)&&at(o)&&!pt(o)?n:o||ze(t)||n}const Ze=async function(t){const e=this.getOffsetParent||Qt,n=this.getDimensions,o=await n(t.floating);return{reference:Qe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function tn(t){return k(t).direction==="rtl"}const en={convertOffsetParentRelativeRectToViewportRelativeRect:Ie,getDocumentElement:T,getClippingRect:Je,getOffsetParent:Qt,getElementRects:Ze,getClientRects:je,getDimensions:Ge,getScale:H,isElement:E,isRTL:tn};function nn(t,e){let n=null,o;const r=T(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const{left:l,top:d,width:f,height:h}=t.getBoundingClientRect();if(c||e(),!f||!h)return;const m=J(d),p=J(r.clientWidth-(l+f)),y=J(r.clientHeight-(d+h)),w=J(l),v={rootMargin:-m+"px "+-p+"px "+-y+"px "+-w+"px",threshold:M(0,Q(1,u))||1};let x=!0;function A(b){const N=b[0].intersectionRatio;if(N!==u){if(!x)return s();N?s(!1,N):o=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(A,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(A,v)}n.observe(t)}return s(!0),i}function on(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=o,l=yt(t),d=r||i?[...l?q(l):[],...q(e)]:[];d.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=l&&c?nn(l,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===l&&m&&(m.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(e)})),n()}),l&&!u&&m.observe(l),m.observe(e));let p,y=u?V(t):null;u&&w();function w(){const g=V(t);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&n(),y=g,p=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(g=m)==null||g.disconnect(),m=null,u&&cancelAnimationFrame(p)}}const rn=$e,sn=He,Tt=Ve,cn=(t,e,n)=>{const o=new Map,r={platform:en,...n},i={...r.platform,_c:o};return We(t,e,{...r,platform:i})},ln=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:r}={mainAxis:0,crossAxis:0}})=>a.OnBrowserCtx(i=>{const s=a.Value.toSignal(e),c=i.element;return a.When(s,()=>a.Portal("body",a.html.div(a.OnElement(u=>{const l=u;return l.style.position="absolute",a.OnDispose(on(c,l,async()=>{const{x:d,y:f}=await cn(c,l,{placement:n,strategy:"absolute",middleware:[Tt(),rn({mainAxis:o,crossAxis:r}),sn(),Tt()]});l.style.top=`${f}px`,l.style.left=`${d}px`}))}),t())))}),Zt=(t,e,n)=>{const o=a.makeProp(O.AsyncResult.notAsked),r=o.map(f=>O.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>O.AsyncResult.isFailure(f)?f.error:void 0),s=o.map(f=>O.AsyncResult.isLoading(f));let c;const u=async f=>{c==null||c.abort(),c=new AbortController;const h=c.signal,m=o.get();o.set(O.AsyncResult.loading(O.AsyncResult.getOrUndefined(m)));try{const p=await e({request:f,abortSignal:h,previous:m});c=void 0,o.set(O.AsyncResult.success(p))}catch(p){c=void 0,o.set(O.AsyncResult.failure(n(p)))}},l=()=>u(t.get()),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(t.on(u)),{status:o,value:r,error:i,loading:s,reload:l,dispose:d}},te=(t,e)=>{const{status:n,dispose:o,reload:r}=t,{notAsked:i,loading:s,error:c,success:u}=e;return a.Fragment(a.OnDispose(o),a.OneOfType(n,{NotAsked:()=>i!=null?i(r):void 0,Loading:l=>s!=null?s(l.$.previousValue,r):a.Ensure(l.$.previousValue,d=>u(d,r),()=>a.Empty),AsyncFailure:l=>c!=null?c(l.$.error,r):void 0,AsyncSuccess:l=>u(l.$.value,r)}))},an=(t,e,n)=>{const o=Zt(t,e,n);return r=>te(o,r)},ee=(t,e)=>{if(typeof e=="function")return ee(t,{success:e});const n=e.failure??(r=>a.Fragment(a.OnDispose(r.on(console.error)),r.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:r=>o(r.$.value),Failure:r=>n(r.$.error)})},un=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()}),fn=t=>a.OnBrowserCtx(e=>{const{element:n}=e,o=a.makeProp({width:n.clientWidth,height:n.clientHeight}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:n.clientWidth,height:n.clientHeight})};let s;return typeof ResizeObserver=="function"&&(s=new ResizeObserver(i),s.observe(n)),a.OnDispose(c=>{s==null||s.disconnect(),r(c)})}),dn=t=>e=>{const n=a.getWindow(),o=a.makeProp({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),s=>{n==null||n.removeEventListener("resize",i),r(s)}},ne=(t,e)=>{const n=e.split("/").filter(r=>r!==""),o={};for(let r=0;r<t.length;r++){const i=t[r],s=n[r];if(!s&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==s)return null}else if(i.type==="param")o[i.name]=s;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},oe=t=>t.split("/").map(e=>e.startsWith(":")?{type:"param",name:e.slice(1)}:e==="*"?{type:"catch-all"}:{type:"literal",value:e}).filter(e=>e.type!=="literal"||e.value!==""),re=t=>{const e=t.map(n=>{const o=oe(n);return{route:n,segments:o}});return function(o){for(const{segments:r,route:i}of e){const s=ne(r,o);if(s)return{...s,route:i}}return null}},mn=t=>{const e=re(Object.keys(t));return mt(n=>{const o=n.map(r=>{const i=e(r.pathname);if(i==null)throw console.error("No route found for",r),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:r.search,hash:r.hash}});return a.OneOfTuple(o.map(r=>[r.route,r]),t)})},nt=60*1e3,dt=60*nt,Y=24*dt,Pt=7*Y,Ct=30*Y,hn=365*Y,pn=[{max:nt*90,value:nt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:dt*36,value:dt,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:Pt*6,value:Pt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Ct*18,value:Ct,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:hn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Dt(t,e,n,o){const r=Math.round(t/e);return r<=1?n:o.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ie=(t=1e3)=>{const e=a.makeProp(new Date),n=O.interval(()=>e.set(new Date),t);return e.onDispose(n),e},se=t=>{const e=Math.abs(t);if(e<nt)return t<0?"just now":"in a moment";for(const n of pn)if(e<n.max)return t<0?Dt(e,n.value,n.past.singular,n.past.plural):Dt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ce=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.makeProp(e):ie(n),r=a.makeComputedOf(t,o)((i,s)=>i.getTime()-s.getTime());return r.onDispose(()=>a.Value.dispose(o)),r},le=(t,e={})=>{const n=ce(t,e),o=n.map(se);return o.onDispose(n.dispose),o},gn=(t,e={})=>le(t,e);class ae extends a.Prop{constructor(){super(...arguments);Rt(this,"tick",()=>this.update(n=>n+1))}}const yn=(t=0)=>new ae(t,(e,n)=>e===n);exports.Anchor=Ht;exports.AsyncResultView=Ut;exports.AutoFocus=xe;exports.AutoSelect=be;exports.ElementSize=fn;exports.HTMLTitle=Re;exports.HiddenWhenEmpty=Ae;exports.InViewport=zt;exports.LocationProviderMarker=Vt;exports.PopOver=ln;exports.ProvideAppearance=we;exports.ProvideLocation=pe;exports.Resource=an;exports.ResourceDisplay=te;exports.ResultView=ee;exports.Router=mn;exports.SelectOnFocus=un;exports.Ticker=ae;exports.UseAppearance=ve;exports.UseLocation=mt;exports.WhenInViewport=ke;exports.WindowSize=dn;exports._checkExtensionCondition=Mt;exports._getExtension=Ft;exports._makeRouteMatcher=re;exports._parseRouteSegments=oe;exports.appearanceMarker=ht;exports.areLocationsEqual=ge;exports.handleAnchorClick=Wt;exports.locationFromURL=Nt;exports.makeNowSignal=ie;exports.makeRelativeTime=gn;exports.makeRelativeTimeMillisSignal=ce;exports.makeRelativeTimeSignal=le;exports.makeResource=Zt;exports.makeTicker=yn;exports.matchesRoute=ne;exports.setLocationFromUrl=$t;exports.timeDiffToString=se;exports.urlFromLocation=ye;
package/index.js CHANGED
@@ -1115,11 +1115,7 @@ const fn = Ie, dn = je, $t = Ue, hn = (t, e, n) => {
1115
1115
  )
1116
1116
  )
1117
1117
  );
1118
- }), mn = ({
1119
- request: t,
1120
- load: e,
1121
- convertError: n
1122
- }) => {
1118
+ }), mn = (t, e, n) => {
1123
1119
  const o = W(P.notAsked), r = o.map(
1124
1120
  (u) => P.isSuccess(u) ? u.value : void 0
1125
1121
  ), i = o.map(
@@ -1164,9 +1160,9 @@ const fn = Ie, dn = je, $t = Ue, hn = (t, e, n) => {
1164
1160
  AsyncSuccess: (l) => a(l.$.value, r)
1165
1161
  })
1166
1162
  );
1167
- }, Bn = (t) => {
1168
- const e = mn(t);
1169
- return (n) => pn(e, n);
1163
+ }, Bn = (t, e, n) => {
1164
+ const o = mn(t, e, n);
1165
+ return (r) => pn(o, r);
1170
1166
  }, gn = (t, e) => {
1171
1167
  if (typeof e == "function")
1172
1168
  return gn(t, { success: e });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "1.2.1-next.0",
3
+ "version": "1.2.1-next.2",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -1,5 +1,5 @@
1
1
  import { Signal, TNode } from '@tempots/dom';
2
- import { MakeResourceOptions, AsyncResource } from '../utils/resource';
2
+ import { AsyncResource, ResourceLoadOptions } from '../utils/resource';
3
3
  /**
4
4
  * Options for displaying the different states of an asynchronous resource.
5
5
  *
@@ -36,8 +36,10 @@ export declare const ResourceDisplay: <V, E>(resource: AsyncResource<V, E>, opti
36
36
  * @template V - The type of the value when the resource is successfully loaded.
37
37
  * @template E - The type of the error when the resource fails to load.
38
38
  *
39
- * @param {ResourceOptions<R, V, E>} resourceOptions - The options for creating and displaying the resource.
39
+ * @param request - The request to load the resource.
40
+ * @param load - The function to load the resource.
41
+ * @param convertError - The function to convert an unknown error into a specific error type.
40
42
  * @returns A function that takes display options and returns a node representing the current state of the resource.
41
43
  * @public
42
44
  */
43
- export declare const Resource: <R, V, E>(resourceOptions: MakeResourceOptions<R, V, E>) => (displayOptions: ResourceDisplayOptions<V, E>) => import('@tempots/dom').Renderable;
45
+ export declare const Resource: <R, V, E>(request: Signal<R>, load: (options: ResourceLoadOptions<R, V, E>) => Promise<V>, convertError: (error: unknown) => E) => (displayOptions: ResourceDisplayOptions<V, E>) => import('@tempots/dom').Renderable;
@@ -38,22 +38,6 @@ export interface ResourceLoadOptions<R, V, E> {
38
38
  /** The previous result of the resource loading, if any. */
39
39
  readonly previous: AsyncResult<V, E>;
40
40
  }
41
- /**
42
- * Options for creating a resource, including the request signal, load function, and error converter.
43
- *
44
- * @template R - The type of the request.
45
- * @template V - The type of the value when the resource is successfully loaded.
46
- * @template E - The type of the error when the resource fails to load.
47
- * @public
48
- */
49
- export interface MakeResourceOptions<R, V, E> {
50
- /** A signal representing the request to load the resource. */
51
- readonly request: Signal<R>;
52
- /** A function to load the resource, returning a promise of the value. */
53
- readonly load: (options: ResourceLoadOptions<R, V, E>) => Promise<V>;
54
- /** A function to convert an unknown error into a specific error type. */
55
- readonly convertError: (error: unknown) => E;
56
- }
57
41
  /**
58
42
  * Creates an asynchronous resource that can be loaded, reloaded, and disposed of.
59
43
  *
@@ -61,8 +45,10 @@ export interface MakeResourceOptions<R, V, E> {
61
45
  * @template V - The type of the value when the resource is successfully loaded.
62
46
  * @template E - The type of the error when the resource fails to load.
63
47
  *
64
- * @param {MakeResourceOptions<R, V, E>} options - The options for creating the resource.
65
- * @returns {AsyncResource<V, E>} The created asynchronous resource.
48
+ * @param request - The request to load the resource.
49
+ * @param load - The function to load the resource.
50
+ * @param convertError - The function to convert an unknown error into a specific error type.
51
+ * @returns The created asynchronous resource.
66
52
  * @public
67
53
  */
68
- export declare const makeResource: <R, V, E>({ request, load, convertError, }: MakeResourceOptions<R, V, E>) => AsyncResource<V, E>;
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>;