@tempots/ui 8.0.0 → 8.0.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 +1 -1
- package/index.d.ts +2 -0
- package/index.js +711 -623
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ae=Object.defineProperty;var Ee=(t,e,o)=>e in t?Ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var vt=(t,e,o)=>Ee(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),R=require("@tempots/std"),qt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Yt=(t,e)=>{const o=qt(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Le=(t,e,o,n)=>{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:a}=i;if(n){const u=r+c+a,h=i.getAttribute("href");if(!(h!=null&&h.startsWith("#"))&&h!==u)return!0}return e?!1:Yt(o,r)},Qt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const o=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(n=>n.startsWith(".")?n:"."+n):[];return n=>{Le(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},Xt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Pt=(t,e)=>{var i,r;const o=new URL(t,e??((i=l.getWindow())==null?void 0:i.location.toString())),n=Object.fromEntries(((r=o.searchParams)==null?void 0:r.entries())??[]);let s=o.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:o.pathname,search:n,hash:s===""?void 0:s}},bt=(t,e)=>{const o=Pt(e);return t.set(o),t},lt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Pe=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Te=t=>{const e=t.container.currentURL,o=e.iso(n=>Pt(n),n=>{if(Pe(n.pathname))return lt(n);const s=new URL(n.pathname,e.value),i=s.origin+s.pathname;return lt({...n,pathname:i})});return{value:o,dispose:o.dispose}},Se=()=>{const t=l.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}},ke=()=>{const t=l.prop(Se(),Xt),e=l.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:n===""?void 0:n};t.set(s)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",lt(n))}),{value:t,dispose:t.dispose}},gt={mark:l.makeProviderMark("Location"),create:(t,e)=>{if(e.isBrowser())return ke();if(e.isHeadless())return Te(e);throw new Error("Unknown context")}},De=t=>{document.startViewTransition?document.startViewTransition(t):t()},Jt=(t,...e)=>{if(typeof t=="string"||l.Signal.is(t))return Jt({href:t},...e);const{href:o,withViewTransition:n,...s}=t;return l.Use(gt,i=>l.html.a(l.on.click(Qt(()=>(n===!0?De(()=>{bt(i,l.Value.get(o))}):bt(i,l.Value.get(o)),!0),s)),l.attr.href(o),...e))},Ce={mark:l.makeProviderMark("Appearance"),create:()=>{const t=Gt();return{value:t,dispose:t.dispose}}};function Gt(){const t=l.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=l.prop(o?"dark":"light"),s=i=>n.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),n}const Tt=(t,e)=>{if(typeof e=="function")return Tt(t,{success:e});const o=e.failure??(r=>r.map(c=>`Error: ${c}`)),n=e.success,s=e.loading??(()=>l.Empty),i=e.notAsked??(()=>l.Empty);return l.OneOfType(l.Value.toSignal(t),{AsyncSuccess:r=>n(r.$.value),AsyncFailure:r=>o(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},We=(t=10)=>l.WithElement(e=>l.OnDispose(R.delayed(()=>e==null?void 0:e.focus(),t))),Fe=(t=10)=>l.WithElement(e=>{const o=R.delayed(()=>e.select(),t);return l.OnDispose(o)});function Ve(t){const e=Object.entries(t);return l.Fragment(...e.map(([o,n])=>l.attr.class(l.Value.map(n,s=>s?o:void 0))))}const Me=l.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),l.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),Ne=t=>l.Portal("head > title",l.attr.innerText(t)),Ue={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},at={partial:new Map,full:new Map},tt={partial:null,full:null};function He(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=at[t].get(o.target);n==null||n.set(o.isIntersecting)})},Ue[t])),tt[t]}const Zt=({mode:t="partial",once:e=!1},o)=>{const n=l.prop(!1);return l.Fragment(l.WithElement(s=>{const i=typeof IntersectionObserver<"u"?He(t):null;at[t].set(s,n),i==null||i.observe(s);function r(){var a;i==null||i.unobserve(s),at[t].delete(s),at[t].size===0&&((a=tt[t])==null||a.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(a=>{a&&r()})),l.OnDispose(()=>{n.dispose(),r(),c==null||c()})}),l.renderableOfTNode(o(n)))},$e=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function te(t){return l.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),l.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Nt=(t,e)=>t===void 0||t===e;function ee(t,e){return typeof t=="string"?e.key===t:Nt(t.key,e.key)&&Nt(t.code,e.code)&&Y(t.ctrlKey,e.ctrlKey)&&Y(t.altKey,e.altKey)&&Y(t.shiftKey,e.shiftKey)&&Y(t.metaKey,e.metaKey)&&Y(t.repeat,e.repeat)&&Y(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function St({allowedKeys:t,handler:e}){return l.WithElement(o=>{const n=s=>{if(o.contains(s.target)){for(const i of t)if(ee(i,s)){e(s);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function Ke(t){return St({allowedKeys:["Enter"],handler:t})}function Be(t){return St({allowedKeys:["Escape"],handler:t})}const X=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,W=t=>({x:t,y:t}),ze={left:"right",right:"left",bottom:"top",top:"bottom"},_e={start:"end",end:"start"};function Ot(t,e,o){return j(t,X(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function st(t){return t.split("-")[1]}function ne(t){return t==="x"?"y":"x"}function kt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(I(t))?"y":"x"}function Dt(t){return ne(H(t))}function je(t,e,o){o===void 0&&(o=!1);const n=st(t),s=Dt(t),i=kt(s);let r=s==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=ft(r)),[r,ft(r)]}function Ie(t){const e=ft(t);return[Rt(t),e,Rt(e)]}function Rt(t){return t.replace(/start|end/g,e=>_e[e])}function qe(t,e,o){const n=["left","right"],s=["right","left"],i=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return o?e?s:n:e?n:s;case"left":case"right":return e?i:r;default:return[]}}function Ye(t,e,o,n){const s=st(t);let i=qe(I(t),o==="start",n);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(Rt)))),i}function ft(t){return t.replace(/left|right|bottom|top/g,e=>ze[e])}function Qe(t){return{top:0,right:0,bottom:0,left:0,...t}}function oe(t){return typeof t!="number"?Qe(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:s}=t;return{width:n,height:s,top:o,left:e,right:e+n,bottom:o+s,x:e,y:o}}function Ut(t,e,o){let{reference:n,floating:s}=t;const i=H(e),r=Dt(e),c=kt(r),a=I(e),u=i==="y",h=n.x+n.width/2-s.width/2,d=n.y+n.height/2-s.height/2,g=n[c]/2-s[c]/2;let f;switch(a){case"top":f={x:h,y:n.y-s.height};break;case"bottom":f={x:h,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:d};break;case"left":f={x:n.x-s.width,y:d};break;default:f={x:n.x,y:n.y}}switch(st(e)){case"start":f[r]-=g*(o&&u?-1:1);break;case"end":f[r]+=g*(o&&u?-1:1);break}return f}const Xe=async(t,e,o)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:r}=o,c=i.filter(Boolean),a=await(r.isRTL==null?void 0:r.isRTL(e));let u=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:d}=Ut(u,n,a),g=n,f={},p=0;for(let w=0;w<c.length;w++){const{name:m,fn:y}=c[w],{x,y:v,data:O,reset:b}=await y({x:h,y:d,initialPlacement:n,placement:g,strategy:s,middlewareData:f,rects:u,platform:r,elements:{reference:t,floating:e}});h=x??h,d=v??d,f={...f,[m]:{...f[m],...O}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(u=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:h,y:d}=Ut(u,g,a)),w=-1)}return{x:h,y:d,placement:g,strategy:s,middlewareData:f}};async function se(t,e){var o;e===void 0&&(e={});const{x:n,y:s,platform:i,rects:r,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:g=!1,padding:f=0}=ot(e,t),p=oe(f),m=c[g?d==="floating"?"reference":"floating":d],y=ht(await i.getClippingRect({element:(o=await(i.isElement==null?void 0:i.isElement(m)))==null||o?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:h,strategy:a})),x=d==="floating"?{x:n,y:s,width:r.floating.width,height:r.floating.height}:r.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),O=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=ht(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:a}):x);return{top:(y.top-b.top+p.top)/O.y,bottom:(b.bottom-y.bottom+p.bottom)/O.y,left:(y.left-b.left+p.left)/O.x,right:(b.right-y.right+p.right)/O.x}}const Je=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:s,rects:i,platform:r,elements:c,middlewareData:a}=e,{element:u,padding:h=0}=ot(t,e)||{};if(u==null)return{};const d=oe(h),g={x:o,y:n},f=Dt(s),p=kt(f),w=await r.getDimensions(u),m=f==="y",y=m?"top":"left",x=m?"bottom":"right",v=m?"clientHeight":"clientWidth",O=i.reference[p]+i.reference[f]-g[f]-i.floating[p],b=g[f]-i.reference[f],P=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u));let A=P?P[v]:0;(!A||!await(r.isElement==null?void 0:r.isElement(P)))&&(A=c.floating[v]||i.floating[p]);const K=O/2-b/2,M=A/2-w[p]/2-1,T=X(d[y],M),B=X(d[x],M),z=T,Z=A-w[p]-B,E=A/2-w[p]/2+K,_=Ot(z,E,Z),N=!a.arrow&&st(s)!=null&&E!==_&&i.reference[p]/2-(E<z?T:B)-w[p]/2<0,S=N?E<z?E-z:E-Z:0;return{[f]:g[f]+S,data:{[f]:_,centerOffset:E-_-S,...N&&{alignmentOffset:S}},reset:N}}}),Ge=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:s,middlewareData:i,rects:r,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:w=!0,...m}=ot(t,e);if((o=i.arrow)!=null&&o.alignmentOffset)return{};const y=I(s),x=H(c),v=I(c)===c,O=await(a.isRTL==null?void 0:a.isRTL(u.floating)),b=g||(v||!w?[ft(c)]:Ie(c)),P=p!=="none";!g&&P&&b.push(...Ye(c,w,p,O));const A=[c,...b],K=await se(e,m),M=[];let T=((n=i.flip)==null?void 0:n.overflows)||[];if(h&&M.push(K[y]),d){const E=je(s,r,O);M.push(K[E[0]],K[E[1]])}if(T=[...T,{placement:s,overflows:M}],!M.every(E=>E<=0)){var B,z;const E=(((B=i.flip)==null?void 0:B.index)||0)+1,_=A[E];if(_&&(!(d==="alignment"?x!==H(_):!1)||T.every(k=>k.overflows[0]>0&&H(k.placement)===x)))return{data:{index:E,overflows:T},reset:{placement:_}};let N=(z=T.filter(S=>S.overflows[0]<=0).sort((S,k)=>S.overflows[1]-k.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(f){case"bestFit":{var Z;const S=(Z=T.filter(k=>{if(P){const U=H(k.placement);return U===x||U==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(U=>U>0).reduce((U,Re)=>U+Re,0)]).sort((k,U)=>k[1]-U[1])[0])==null?void 0:Z[0];S&&(N=S);break}case"initialPlacement":N=c;break}if(s!==N)return{reset:{placement:N}}}return{}}}};async function Ze(t,e){const{placement:o,platform:n,elements:s}=t,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),r=I(o),c=st(o),a=H(o)==="y",u=["left","top"].includes(r)?-1:1,h=i&&a?-1:1,d=ot(e,t);let{mainAxis:g,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof p=="number"&&(f=c==="end"?p*-1:p),a?{x:f*h,y:g*u}:{x:g*u,y:f*h}}const tn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:s,y:i,placement:r,middlewareData:c}=e,a=await Ze(e,t);return r===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:r}}}}},en=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:c={fn:m=>{let{x:y,y:x}=m;return{x:y,y:x}}},...a}=ot(t,e),u={x:o,y:n},h=await se(e,a),d=H(I(s)),g=ne(d);let f=u[g],p=u[d];if(i){const m=g==="y"?"top":"left",y=g==="y"?"bottom":"right",x=f+h[m],v=f-h[y];f=Ot(x,f,v)}if(r){const m=d==="y"?"top":"left",y=d==="y"?"bottom":"right",x=p+h[m],v=p-h[y];p=Ot(x,p,v)}const w=c.fn({...e,[g]:f,[d]:p});return{...w,data:{x:w.x-o,y:w.y-n,enabled:{[g]:i,[d]:r}}}}}};function pt(){return typeof window<"u"}function G(t){return re(t)?(t.nodeName||"").toLowerCase():"#document"}function L(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(re(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function re(t){return pt()?t instanceof Node||t instanceof L(t).Node:!1}function D(t){return pt()?t instanceof Element||t instanceof L(t).Element:!1}function F(t){return pt()?t instanceof HTMLElement||t instanceof L(t).HTMLElement:!1}function Ht(t){return!pt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof L(t).ShadowRoot}function rt(t){const{overflow:e,overflowX:o,overflowY:n,display:s}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(s)}function nn(t){return["table","td","th"].includes(G(t))}function yt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Ct(t){const e=Wt(),o=D(t)?C(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function on(t){let e=$(t);for(;F(e)&&!J(e);){if(Ct(e))return e;if(yt(e))return null;e=$(e)}return null}function Wt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function J(t){return["html","body","#document"].includes(G(t))}function C(t){return L(t).getComputedStyle(t)}function wt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $(t){if(G(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ht(t)&&t.host||V(t);return Ht(e)?e.host:e}function ie(t){const e=$(t);return J(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&rt(e)?e:ie(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const s=ie(t),i=s===((n=t.ownerDocument)==null?void 0:n.body),r=L(s);if(i){const c=At(r);return e.concat(r,r.visualViewport||[],rt(s)?s:[],c&&o?et(c):[])}return e.concat(s,et(s,[],o))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ce(t){const e=C(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=F(t),i=s?t.offsetWidth:o,r=s?t.offsetHeight:n,c=ut(o)!==i||ut(n)!==r;return c&&(o=i,n=r),{width:o,height:n,$:c}}function Ft(t){return D(t)?t:t.contextElement}function Q(t){const e=Ft(t);if(!F(e))return W(1);const o=e.getBoundingClientRect(),{width:n,height:s,$:i}=ce(e);let r=(i?ut(o.width):o.width)/n,c=(i?ut(o.height):o.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const sn=W(0);function ae(t){const e=L(t);return!Wt()||!e.visualViewport?sn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function rn(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==L(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const s=t.getBoundingClientRect(),i=Ft(t);let r=W(1);e&&(n?D(n)&&(r=Q(n)):r=Q(t));const c=rn(i,o,n)?ae(i):W(0);let a=(s.left+c.x)/r.x,u=(s.top+c.y)/r.y,h=s.width/r.x,d=s.height/r.y;if(i){const g=L(i),f=n&&D(n)?L(n):n;let p=g,w=At(p);for(;w&&n&&f!==p;){const m=Q(w),y=w.getBoundingClientRect(),x=C(w),v=y.left+(w.clientLeft+parseFloat(x.paddingLeft))*m.x,O=y.top+(w.clientTop+parseFloat(x.paddingTop))*m.y;a*=m.x,u*=m.y,h*=m.x,d*=m.y,a+=v,u+=O,p=L(w),w=At(p)}}return ht({width:h,height:d,x:a,y:u})}function Vt(t,e){const o=wt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function le(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-(o?0:Vt(t,n)),i=n.top+e.scrollTop;return{x:s,y:i}}function cn(t){let{elements:e,rect:o,offsetParent:n,strategy:s}=t;const i=s==="fixed",r=V(n),c=e?yt(e.floating):!1;if(n===r||c&&i)return o;let a={scrollLeft:0,scrollTop:0},u=W(1);const h=W(0),d=F(n);if((d||!d&&!i)&&((G(n)!=="body"||rt(r))&&(a=wt(n)),F(n))){const f=q(n);u=Q(n),h.x=f.x+n.clientLeft,h.y=f.y+n.clientTop}const g=r&&!d&&!i?le(r,a,!0):W(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+h.x+g.x,y:o.y*u.y-a.scrollTop*u.y+h.y+g.y}}function an(t){return Array.from(t.getClientRects())}function ln(t){const e=V(t),o=wt(t),n=t.ownerDocument.body,s=j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+Vt(t);const c=-o.scrollTop;return C(n).direction==="rtl"&&(r+=j(e.clientWidth,n.clientWidth)-s),{width:s,height:i,x:r,y:c}}function un(t,e){const o=L(t),n=V(t),s=o.visualViewport;let i=n.clientWidth,r=n.clientHeight,c=0,a=0;if(s){i=s.width,r=s.height;const u=Wt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,a=s.offsetTop)}return{width:i,height:r,x:c,y:a}}function fn(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,s=o.left+t.clientLeft,i=F(t)?Q(t):W(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,a=s*i.x,u=n*i.y;return{width:r,height:c,x:a,y:u}}function $t(t,e,o){let n;if(e==="viewport")n=un(t,o);else if(e==="document")n=ln(V(t));else if(D(e))n=fn(e,o);else{const s=ae(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ht(n)}function ue(t,e){const o=$(t);return o===e||!D(o)||J(o)?!1:C(o).position==="fixed"||ue(o,e)}function hn(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&G(c)!=="body"),s=null;const i=C(t).position==="fixed";let r=i?$(t):t;for(;D(r)&&!J(r);){const c=C(r),a=Ct(r);!a&&c.position==="fixed"&&(s=null),(i?!a&&!s:!a&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||rt(r)&&!a&&ue(t,r))?n=n.filter(h=>h!==r):s=c,r=$(r)}return e.set(t,n),n}function dn(t){let{element:e,boundary:o,rootBoundary:n,strategy:s}=t;const r=[...o==="clippingAncestors"?yt(e)?[]:hn(e,this._c):[].concat(o),n],c=r[0],a=r.reduce((u,h)=>{const d=$t(e,h,s);return u.top=j(d.top,u.top),u.right=X(d.right,u.right),u.bottom=X(d.bottom,u.bottom),u.left=j(d.left,u.left),u},$t(e,c,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function mn(t){const{width:e,height:o}=ce(t);return{width:e,height:o}}function gn(t,e,o){const n=F(e),s=V(e),i=o==="fixed",r=q(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const a=W(0);function u(){a.x=Vt(s)}if(n||!n&&!i)if((G(e)!=="body"||rt(s))&&(c=wt(e)),n){const f=q(e,!0,i,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else s&&u();i&&!n&&s&&u();const h=s&&!n&&!i?le(s,c):W(0),d=r.left+c.scrollLeft-a.x-h.x,g=r.top+c.scrollTop-a.y-h.y;return{x:d,y:g,width:r.width,height:r.height}}function xt(t){return C(t).position==="static"}function Kt(t,e){if(!F(t)||C(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function fe(t,e){const o=L(t);if(yt(t))return o;if(!F(t)){let s=$(t);for(;s&&!J(s);){if(D(s)&&!xt(s))return s;s=$(s)}return o}let n=Kt(t,e);for(;n&&nn(n)&&xt(n);)n=Kt(n,e);return n&&J(n)&&xt(n)&&!Ct(n)?o:n||on(t)||o}const pn=async function(t){const e=this.getOffsetParent||fe,o=this.getDimensions,n=await o(t.floating);return{reference:gn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function yn(t){return C(t).direction==="rtl"}const wn={convertOffsetParentRelativeRectToViewportRelativeRect:cn,getDocumentElement:V,getClippingRect:dn,getOffsetParent:fe,getElementRects:pn,getClientRects:an,getDimensions:mn,getScale:Q,isElement:D,isRTL:yn};function he(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function vn(t,e){let o=null,n;const s=V(t);function i(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function r(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),i();const u=t.getBoundingClientRect(),{left:h,top:d,width:g,height:f}=u;if(c||e(),!g||!f)return;const p=ct(d),w=ct(s.clientWidth-(h+g)),m=ct(s.clientHeight-(d+f)),y=ct(h),v={rootMargin:-p+"px "+-w+"px "+-m+"px "+-y+"px",threshold:j(0,X(1,a))||1};let O=!0;function b(P){const A=P[0].intersectionRatio;if(A!==a){if(!O)return r();A?r(!1,A):n=setTimeout(()=>{r(!1,1e-7)},1e3)}A===1&&!he(u,t.getBoundingClientRect())&&r(),O=!1}try{o=new IntersectionObserver(b,{...v,root:s.ownerDocument})}catch{o=new IntersectionObserver(b,v)}o.observe(t)}return r(!0),i}function xn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Ft(t),h=s||i?[...u?et(u):[],...et(e)]:[];h.forEach(y=>{s&&y.addEventListener("scroll",o,{passive:!0}),i&&y.addEventListener("resize",o)});const d=u&&c?vn(u,o):null;let g=-1,f=null;r&&(f=new ResizeObserver(y=>{let[x]=y;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),o()}),u&&!a&&f.observe(u),f.observe(e));let p,w=a?q(t):null;a&&m();function m(){const y=q(t);w&&!he(w,y)&&o(),w=y,p=requestAnimationFrame(m)}return o(),()=>{var y;h.forEach(x=>{s&&x.removeEventListener("scroll",o),i&&x.removeEventListener("resize",o)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const bn=tn,On=en,Bt=Ge,Rn=Je,An=(t,e,o)=>{const n=new Map,s={platform:wn,...o},i={...s.platform,_c:n};return Xe(t,e,{...s,platform:i})},En=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Ln=(t,e={isOpen:!1})=>{const o=[];let n=null;const s=l.Value.deriveProp(e.isOpen);function i(c){n=c,s.set(!0)}function r(){s.set(!1),o.forEach(c=>c()),o.length=0}return l.Fragment(t(i,r),l.When(s,()=>l.Fragment((n==null?void 0:n.onClickOutside)!=null?te(n.onClickOutside):null,l.WithElement(c=>l.Portal("body",l.html.div(l.WithElement(a=>{a.style.position="absolute";const u=typeof(n==null?void 0:n.target)=="string"?c.querySelector(n.target):(n==null?void 0:n.target)??c;if(u==null)throw new Error(`Target not found: ${n==null?void 0:n.target}`);let h=null;const d=l.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),g=l.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=l.Value.toSignal((n==null?void 0:n.placement)??"top"),p=l.Value.toSignal((n==null?void 0:n.arrowPadding)??0),w=n==null?void 0:n.arrow,m=l.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function y(){const v=[Bt(),bn({mainAxis:d.get(),crossAxis:g.get()}),On(),Bt()];w!=null&&h!=null&&v.push(Rn({element:h,padding:p.get()}));const O=await An(u,a,{placement:f.get(),strategy:"absolute",middleware:v}),{x:b,y:P,middlewareData:A}=O;if(a.style.top=`${P}px`,a.style.left=`${b}px`,h!=null&&A.arrow!=null){const{x:K,y:M,centerOffset:T,alignmentOffset:B}=A.arrow;m.set({x:K,y:M,centerOffset:T,alignmentOffset:B,containerWidth:a.offsetWidth,containerHeight:a.offsetHeight})}}const x=l.effectOf(d,g,f)(y);return l.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?l.html.div(n==null?void 0:n.arrow(l.computedOf(m,f)((v,O)=>({...v,placement:O}))),l.WithElement(v=>{h=v,y()})):null,l.OnDispose(m.dispose,xn(u,a,y),x))})))))))},de=({request:t,load:e,convertError:o,onSuccess:n,onError:s,onSettled:i})=>{let r;const c=l.prop(R.AsyncResult.notAsked),a=c.map(m=>R.AsyncResult.isSuccess(m)?m.value:void 0),u=c.map(m=>R.AsyncResult.isFailure(m)?m.error:void 0),h=c.map(m=>R.AsyncResult.isLoading(m)),d=()=>{r==null||r.abort(),r=void 0},g=m=>{d(),c.set(m??R.AsyncResult.notAsked)},f=async m=>{d(),r=new AbortController;const y=r.signal,x=c.get();c.set(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(x)));try{const v=await e({request:m,abortSignal:y,previous:x});await Promise.resolve(),r=void 0,c.set(R.AsyncResult.success(v)),n==null||n(v,m)}catch(v){r=void 0,c.set(R.AsyncResult.failure(o(v))),s==null||s(o(v),m)}i==null||i(c.get(),m)},p=()=>f(l.Value.get(t)),w=()=>{r==null||r.abort(),r=void 0,c.dispose()};return c.onDispose(l.Value.on(t,f)),{status:c,value:a,error:u,loading:h,cancel:g,reload:p,dispose:w}},me=(t,e)=>{const{status:o,dispose:n,reload:s}=t,{pending:i,failure:r,success:c}=e;return l.Fragment(l.OnDispose(n),Tt(o,{loading:i!=null?a=>i({previous:a,reload:s,cancel:t.cancel}):void 0,failure:r!=null?a=>r({error:a,reload:s}):void 0,success:a=>c({value:a,reload:s})}))},Pn=({request:t,load:e,convertError:o=u=>u,onSuccess:n,onError:s,onSettled:i,success:r,pending:c,failure:a})=>{const u=de({request:t,load:e,convertError:o,onSuccess:n,onError:s,onSettled:i});return me(u,{success:r,pending:c,failure:a})},ge=(t,e)=>{if(typeof e=="function")return ge(t,{success:e});const o=e.failure??(s=>l.Fragment(l.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),n=e.success;return l.OneOfType(l.Value.toSignal(t),{Success:s=>n(s.$.value),Failure:s=>o(s.$.error)})},Tn=()=>l.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,o,n,s,i,r){vt(this,"equals",e=>R.nearEqual(this.left,e.left)&&R.nearEqual(this.top,e.top)&&R.nearEqual(this.width,e.width)&&R.nearEqual(this.height,e.height));this.left=e,this.top=o,this.width=n,this.height=s,this.localLeft=i,this.localTop=r}static of({left:e=0,top:o=0,width:n=0,height:s=0,localLeft:i=0,localTop:r=0}){return new it(e,o,n,s,i,r)}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 localCenter(){return{x:this.localLeft+this.width/2,y:this.localTop+this.height/2}}get localBottom(){return this.localTop+this.height}get localRight(){return this.localLeft+this.width}get size(){return{width:this.width,height:this.height}}}function Et(t){const e=t.getBoundingClientRect();return it.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height,localLeft:t.offsetLeft,localTop:t.offsetTop})}const Sn=t=>l.WithBrowserCtx(e=>{const{element:o}=e,n=l.prop(Et(o),(c,a)=>c.equals(a)),s=l.renderableOfTNode(t(n))(e),i=()=>n.set(it.of(Et(o)));let r=null;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(i)),r==null||r.observe(o),l.OnDispose(c=>{r==null||r.disconnect(),s(c)})});function zt(t){return{width:(t==null?void 0:t.innerWidth)??0,height:(t==null?void 0:t.innerHeight)??0}}const kn=t=>e=>{const o=l.getWindow(),n=l.prop(zt(o),(r,c)=>r.width===c.width&&r.height===c.height),s=l.renderableOfTNode(t(n))(e),i=()=>n.set(zt(o));return o==null||o.addEventListener("resize",i),r=>{o==null||o.removeEventListener("resize",i),s(r)}},pe=(t,e)=>{const o=e.split("/").filter(s=>s!==""),n={};for(let s=0;s<t.length;s++){const i=t[s],r=o[s];if(!r&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==r)return null}else if(i.type==="param")n[i.name]=r;else if(i.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Mt=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!==""),Dn=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:i}of e){const r=pe(s,n);if(r)return{...r,route:i}}return null}},dt={mark:l.makeProviderMark("RouterContext"),create:()=>{const t=l.prop([]);return{value:t,dispose:()=>t.dispose()}}},Cn=(t,e,o)=>{const n=o.split("/").filter(r=>r!==""),s={};let i=0;for(let r=0;r<t.length;r++){const c=t[r],a=n[r];if(!a&&c.type!=="catch-all")return null;if(c.type==="literal"){if(c.value!==a)return null;i++}else if(c.type==="param")s[c.name]=a,i++;else if(c.type==="catch-all"){const u="/"+n.slice(0,i).join("/"),h="/"+n.slice(i).join("/");return{params:s,matchedPath:u==="/"?"":u,remainingPath:h==="/"?"":h,route:e}}}if(n.length===t.length){const r="/"+n.join("/");return{params:s,matchedPath:r==="/"?"":r,remainingPath:"",route:e}}return null},ye=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:i}of e){const r=Cn(s,i,n);if(r)return r}return null}},Wn=t=>{const e=ye(Object.keys(t));return l.Provide(dt,{},()=>l.Use(gt,o=>l.Use(dt,n=>{const s=o.map(i=>{const r=e(i.pathname);if(r==null)throw console.error("No route found for",i),new Error("No route found");const c={matchedPath:r.matchedPath,remainingPath:r.remainingPath,fullPath:i.pathname,params:r.params};return n.value=[...n.value,c],{params:r.params,route:r.route,path:r.matchedPath||i.pathname,search:i.search,hash:i.hash}});return l.OneOfTuple(s.map(i=>[i.route,i]),t)})))},Fn=t=>{const e=ye(Object.keys(t));return l.Use(dt,o=>l.Use(gt,n=>{const s=o.map(i=>{const r=i[i.length-1],c=(r==null?void 0:r.remainingPath)||"";if(c==="")throw console.error("No remaining path for SubRouter",i),new Error("No remaining path for SubRouter");const a=e(c);if(a==null)throw console.error("No route found for remaining path",c),new Error("No route found");return{params:a.params,route:a.route,path:a.matchedPath,search:n.value.search,hash:n.value.hash}});return l.OneOfTuple(s.map(i=>[i.route,i]),t)}))},mt=60*1e3,Lt=60*mt,nt=24*Lt,_t=7*nt,jt=30*nt,Vn=365*nt,Mn=[{max:mt*90,value:mt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Lt*36,value:Lt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:_t*6,value:_t,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:jt*18,value:jt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Vn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function It(t,e,o,n){const s=Math.round(t/e);return s<=1?o:n.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const we=(t=1e3)=>{const e=l.prop(new Date),o=R.interval(()=>e.set(new Date),t);return e.onDispose(o),e},ve=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Mn)if(e<o.max)return t<0?It(e,o.value,o.past.singular,o.past.plural):It(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},xe=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):we(o),s=l.computedOf(t,n)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>l.Value.dispose(n)),s},be=(t,e={})=>{const o=xe(t,e),n=o.map(ve);return n.onDispose(o.dispose),n},Nn=(t,e={})=>be(t,e);class Oe extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Un=(t=0)=>new Oe(t,(e,o)=>e===o);exports.Anchor=Jt;exports.Appearance=Ce;exports.AsyncResultView=Tt;exports.AutoFocus=We;exports.AutoSelect=Fe;exports.ChildRouter=Fn;exports.ElementRect=Sn;exports.HTMLTitle=Ne;exports.HiddenWhenEmpty=Me;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=te;exports.OnEnterKey=Ke;exports.OnEscapeKey=Be;exports.OnKeyPressed=St;exports.PopOver=Ln;exports.Query=Pn;exports.QueryDisplay=me;exports.Rect=it;exports.ResultView=ge;exports.RootRouter=Wn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Tn;exports.Ticker=Oe;exports.WhenInViewport=$e;exports.WindowSize=kn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=Dn;exports._parseRouteSegments=Mt;exports.allPlacements=En;exports.areLocationsEqual=Xt;exports.classes=Ve;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Qt;exports.locationFromURL=Pt;exports.makeQueryResource=de;exports.matchesKeyCombo=ee;exports.matchesRoute=pe;exports.nowSignal=we;exports.relativeTime=Nn;exports.relativeTimeMillisSignal=xe;exports.relativeTimeSignal=be;exports.setLocationFromUrl=bt;exports.ticker=Un;exports.timeDiffToString=ve;exports.urlFromLocation=lt;exports.useAppearance=Gt;
|
|
1
|
+
"use strict";var Le=Object.defineProperty;var Pe=(t,e,o)=>e in t?Le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var xt=(t,e,o)=>Pe(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),R=require("@tempots/std"),qt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Yt=(t,e)=>{const o=qt(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Te=(t,e,o,n)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const r=s;if(t.button!==0||t.ctrlKey||t.metaKey||r.target!=="_self"&&r.target!==""||r.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:a}=r;if(n){const u=i+c+a,h=r.getAttribute("href");if(!(h!=null&&h.startsWith("#"))&&h!==u)return!0}return e?!1:Yt(o,i)},Qt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const o=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(n=>n.startsWith(".")?n:"."+n):[];return n=>{Te(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},Xt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Tt=(t,e)=>{var r,i;const o=new URL(t,e??((r=l.getWindow())==null?void 0:r.location.toString())),n=Object.fromEntries(((i=o.searchParams)==null?void 0:i.entries())??[]);let s=o.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:o.pathname,search:n,hash:s===""?void 0:s}},At=(t,e)=>{const o=Tt(e);return t.set(o),t},lt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},ke=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Se=t=>{const e=t.container.currentURL,o=e.iso(n=>Tt(n),n=>{if(ke(n.pathname))return lt(n);const s=new URL(n.pathname,e.value),r=s.origin+s.pathname;return lt({...n,pathname:r})});return{value:o,dispose:o.dispose}},De=()=>{const t=l.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}},We=()=>{const t=l.prop(De(),Xt),e=l.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:n===""?void 0:n};t.set(s)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",lt(n))}),{value:t,dispose:t.dispose}},gt={mark:l.makeProviderMark("Location"),create:(t,e)=>{if(e.isBrowser())return We();if(e.isHeadless())return Se(e);throw new Error("Unknown context")}},Ce=t=>{document.startViewTransition?document.startViewTransition(t):t()},Jt=(t,...e)=>{if(typeof t=="string"||l.Signal.is(t))return Jt({href:t},...e);const{href:o,withViewTransition:n,...s}=t;return l.Use(gt,r=>l.html.a(l.on.click(Qt(()=>(n===!0?Ce(()=>{At(r,l.Value.get(o))}):At(r,l.Value.get(o)),!0),s)),l.attr.href(o),...e))},Fe={mark:l.makeProviderMark("Appearance"),create:()=>{const t=Gt();return{value:t,dispose:t.dispose}}};function Gt(){const t=l.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=l.prop(o?"dark":"light"),s=r=>n.set(r.matches?"dark":"light");return e==null||e.addEventListener("change",s),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),n}const pt=(t,e)=>{if(typeof e=="function")return pt(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,s=e.loading??(()=>l.Empty),r=e.notAsked??(()=>l.Empty);return l.OneOfType(l.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>s(i.map(c=>c.previousValue)),NotAsked:r})},Ve=(t=10)=>l.WithElement(e=>l.OnDispose(R.delayed(()=>e==null?void 0:e.focus(),t))),Me=(t=10)=>l.WithElement(e=>{const o=R.delayed(()=>e.select(),t);return l.OnDispose(o)});function Ne(t){const e=Object.entries(t);return l.Fragment(...e.map(([o,n])=>l.attr.class(l.Value.map(n,s=>s?o:void 0))))}const Ue=l.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),l.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),He=t=>l.Portal("head > title",l.attr.innerText(t)),$e={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},at={partial:new Map,full:new Map},tt={partial:null,full:null};function Ke(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=at[t].get(o.target);n==null||n.set(o.isIntersecting)})},$e[t])),tt[t]}const Zt=({mode:t="partial",once:e=!1},o)=>{const n=l.prop(!1);return l.Fragment(l.WithElement(s=>{const r=typeof IntersectionObserver<"u"?Ke(t):null;at[t].set(s,n),r==null||r.observe(s);function i(){var a;r==null||r.unobserve(s),at[t].delete(s),at[t].size===0&&((a=tt[t])==null||a.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(a=>{a&&i()})),l.OnDispose(()=>{n.dispose(),i(),c==null||c()})}),l.renderableOfTNode(o(n)))},Be=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function te(t){return l.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),l.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Nt=(t,e)=>t===void 0||t===e;function ee(t,e){return typeof t=="string"?e.key===t:Nt(t.key,e.key)&&Nt(t.code,e.code)&&Y(t.ctrlKey,e.ctrlKey)&&Y(t.altKey,e.altKey)&&Y(t.shiftKey,e.shiftKey)&&Y(t.metaKey,e.metaKey)&&Y(t.repeat,e.repeat)&&Y(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function kt({allowedKeys:t,handler:e}){return l.WithElement(o=>{const n=s=>{if(o.contains(s.target)){for(const r of t)if(ee(r,s)){e(s);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function ze(t){return kt({allowedKeys:["Enter"],handler:t})}function _e(t){return kt({allowedKeys:["Escape"],handler:t})}const ne=({mutate:t,convertError:e,onSuccess:o,onError:n,onSettled:s})=>{let r;const i=l.prop(R.AsyncResult.notAsked),c=i.map(m=>R.AsyncResult.isSuccess(m)?m.value:void 0),a=i.map(m=>R.AsyncResult.isFailure(m)?m.error:void 0),u=i.map(m=>R.AsyncResult.isLoading(m)),h=()=>{r==null||r.abort(),r=void 0};return{status:i,value:c,error:a,pending:u,execute:async(m,y)=>{h(),r=new AbortController;const p=r.signal,v=i.get(),x=(y==null?void 0:y.optimisticValue)??((y==null?void 0:y.optimisticFromRequest)!=null?y.optimisticFromRequest(m):void 0);x!=null?i.set(R.AsyncResult.loading(x)):i.set(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(v)));try{const w=await t({request:m,abortSignal:p,previous:v});r=void 0,i.set(R.AsyncResult.success(w)),o==null||o(w,m)}catch(w){r=void 0,i.set(R.AsyncResult.failure(e(w))),n==null||n(e(w),m)}s==null||s(i.get(),m)},cancel:m=>{h(),i.set(m??R.AsyncResult.notAsked)},dispose:()=>{r==null||r.abort(),r=void 0,i.dispose()}}},oe=(t,e)=>{const{status:o,dispose:n,execute:s}=t,{pending:r,failure:i,success:c,notAsked:a}=e;let u;const h=()=>{u!=null&&s(u)},d=g=>{u=g,s(g)};return l.Fragment(l.OnDispose(n),pt(o,{loading:r!=null?g=>r({previous:g,retry:h,execute:d,cancel:t.cancel}):void 0,failure:i!=null?g=>i({error:g,retry:h,execute:d}):void 0,success:g=>c({value:g,execute:d}),notAsked:()=>a({execute:d})}))},je=({mutate:t,convertError:e=u=>u,onSuccess:o,onError:n,onSettled:s,pending:r,failure:i,success:c,notAsked:a})=>{const u=ne({mutate:t,convertError:e,onSuccess:o,onError:n,onSettled:s});return oe(u,{pending:r,failure:i,success:c,notAsked:a})},X=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,C=t=>({x:t,y:t}),Ie={left:"right",right:"left",bottom:"top",top:"bottom"},qe={start:"end",end:"start"};function bt(t,e,o){return j(t,X(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function st(t){return t.split("-")[1]}function se(t){return t==="x"?"y":"x"}function St(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(I(t))?"y":"x"}function Dt(t){return se(H(t))}function Ye(t,e,o){o===void 0&&(o=!1);const n=st(t),s=Dt(t),r=St(s);let i=s==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(i=ft(i)),[i,ft(i)]}function Qe(t){const e=ft(t);return[Ot(t),e,Ot(e)]}function Ot(t){return t.replace(/start|end/g,e=>qe[e])}function Xe(t,e,o){const n=["left","right"],s=["right","left"],r=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?s:n:e?n:s;case"left":case"right":return e?r:i;default:return[]}}function Je(t,e,o,n){const s=st(t);let r=Xe(I(t),o==="start",n);return s&&(r=r.map(i=>i+"-"+s),e&&(r=r.concat(r.map(Ot)))),r}function ft(t){return t.replace(/left|right|bottom|top/g,e=>Ie[e])}function Ge(t){return{top:0,right:0,bottom:0,left:0,...t}}function ie(t){return typeof t!="number"?Ge(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:s}=t;return{width:n,height:s,top:o,left:e,right:e+n,bottom:o+s,x:e,y:o}}function Ut(t,e,o){let{reference:n,floating:s}=t;const r=H(e),i=Dt(e),c=St(i),a=I(e),u=r==="y",h=n.x+n.width/2-s.width/2,d=n.y+n.height/2-s.height/2,g=n[c]/2-s[c]/2;let f;switch(a){case"top":f={x:h,y:n.y-s.height};break;case"bottom":f={x:h,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:d};break;case"left":f={x:n.x-s.width,y:d};break;default:f={x:n.x,y:n.y}}switch(st(e)){case"start":f[i]-=g*(o&&u?-1:1);break;case"end":f[i]+=g*(o&&u?-1:1);break}return f}const Ze=async(t,e,o)=>{const{placement:n="bottom",strategy:s="absolute",middleware:r=[],platform:i}=o,c=r.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:d}=Ut(u,n,a),g=n,f={},m=0;for(let y=0;y<c.length;y++){const{name:p,fn:v}=c[y],{x,y:w,data:b,reset:A}=await v({x:h,y:d,initialPlacement:n,placement:g,strategy:s,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});h=x??h,d=w??d,f={...f,[p]:{...f[p],...b}},A&&m<=50&&(m++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(u=A.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:h,y:d}=Ut(u,g,a)),y=-1)}return{x:h,y:d,placement:g,strategy:s,middlewareData:f}};async function re(t,e){var o;e===void 0&&(e={});const{x:n,y:s,platform:r,rects:i,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:g=!1,padding:f=0}=ot(e,t),m=ie(f),p=c[g?d==="floating"?"reference":"floating":d],v=ht(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(p)))==null||o?p:p.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:u,rootBoundary:h,strategy:a})),x=d==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,w=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),b=await(r.isElement==null?void 0:r.isElement(w))?await(r.getScale==null?void 0:r.getScale(w))||{x:1,y:1}:{x:1,y:1},A=ht(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:w,strategy:a}):x);return{top:(v.top-A.top+m.top)/b.y,bottom:(A.bottom-v.bottom+m.bottom)/b.y,left:(v.left-A.left+m.left)/b.x,right:(A.right-v.right+m.right)/b.x}}const tn=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:s,rects:r,platform:i,elements:c,middlewareData:a}=e,{element:u,padding:h=0}=ot(t,e)||{};if(u==null)return{};const d=ie(h),g={x:o,y:n},f=Dt(s),m=St(f),y=await i.getDimensions(u),p=f==="y",v=p?"top":"left",x=p?"bottom":"right",w=p?"clientHeight":"clientWidth",b=r.reference[m]+r.reference[f]-g[f]-r.floating[m],A=g[f]-r.reference[f],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let O=P?P[w]:0;(!O||!await(i.isElement==null?void 0:i.isElement(P)))&&(O=c.floating[w]||r.floating[m]);const K=b/2-A/2,M=O/2-y[m]/2-1,T=X(d[v],M),B=X(d[x],M),z=T,Z=O-y[m]-B,E=O/2-y[m]/2+K,_=bt(z,E,Z),N=!a.arrow&&st(s)!=null&&E!==_&&r.reference[m]/2-(E<z?T:B)-y[m]/2<0,k=N?E<z?E-z:E-Z:0;return{[f]:g[f]+k,data:{[f]:_,centerOffset:E-_-k,...N&&{alignmentOffset:k}},reset:N}}}),en=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:s,middlewareData:r,rects:i,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...p}=ot(t,e);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const v=I(s),x=H(c),w=I(c)===c,b=await(a.isRTL==null?void 0:a.isRTL(u.floating)),A=g||(w||!y?[ft(c)]:Qe(c)),P=m!=="none";!g&&P&&A.push(...Je(c,y,m,b));const O=[c,...A],K=await re(e,p),M=[];let T=((n=r.flip)==null?void 0:n.overflows)||[];if(h&&M.push(K[v]),d){const E=Ye(s,i,b);M.push(K[E[0]],K[E[1]])}if(T=[...T,{placement:s,overflows:M}],!M.every(E=>E<=0)){var B,z;const E=(((B=r.flip)==null?void 0:B.index)||0)+1,_=O[E];if(_&&(!(d==="alignment"?x!==H(_):!1)||T.every(S=>S.overflows[0]>0&&H(S.placement)===x)))return{data:{index:E,overflows:T},reset:{placement:_}};let N=(z=T.filter(k=>k.overflows[0]<=0).sort((k,S)=>k.overflows[1]-S.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(f){case"bestFit":{var Z;const k=(Z=T.filter(S=>{if(P){const U=H(S.placement);return U===x||U==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(U=>U>0).reduce((U,Ee)=>U+Ee,0)]).sort((S,U)=>S[1]-U[1])[0])==null?void 0:Z[0];k&&(N=k);break}case"initialPlacement":N=c;break}if(s!==N)return{reset:{placement:N}}}return{}}}};async function nn(t,e){const{placement:o,platform:n,elements:s}=t,r=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=I(o),c=st(o),a=H(o)==="y",u=["left","top"].includes(i)?-1:1,h=r&&a?-1:1,d=ot(e,t);let{mainAxis:g,crossAxis:f,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof m=="number"&&(f=c==="end"?m*-1:m),a?{x:f*h,y:g*u}:{x:g*u,y:f*h}}const on=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:s,y:r,placement:i,middlewareData:c}=e,a=await nn(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:s+a.x,y:r+a.y,data:{...a,placement:i}}}}},sn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:s}=e,{mainAxis:r=!0,crossAxis:i=!1,limiter:c={fn:p=>{let{x:v,y:x}=p;return{x:v,y:x}}},...a}=ot(t,e),u={x:o,y:n},h=await re(e,a),d=H(I(s)),g=se(d);let f=u[g],m=u[d];if(r){const p=g==="y"?"top":"left",v=g==="y"?"bottom":"right",x=f+h[p],w=f-h[v];f=bt(x,f,w)}if(i){const p=d==="y"?"top":"left",v=d==="y"?"bottom":"right",x=m+h[p],w=m-h[v];m=bt(x,m,w)}const y=c.fn({...e,[g]:f,[d]:m});return{...y,data:{x:y.x-o,y:y.y-n,enabled:{[g]:r,[d]:i}}}}}};function yt(){return typeof window<"u"}function G(t){return ce(t)?(t.nodeName||"").toLowerCase():"#document"}function L(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(ce(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ce(t){return yt()?t instanceof Node||t instanceof L(t).Node:!1}function D(t){return yt()?t instanceof Element||t instanceof L(t).Element:!1}function F(t){return yt()?t instanceof HTMLElement||t instanceof L(t).HTMLElement:!1}function Ht(t){return!yt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof L(t).ShadowRoot}function it(t){const{overflow:e,overflowX:o,overflowY:n,display:s}=W(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(s)}function rn(t){return["table","td","th"].includes(G(t))}function wt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Wt(t){const e=Ct(),o=D(t)?W(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function cn(t){let e=$(t);for(;F(e)&&!J(e);){if(Wt(e))return e;if(wt(e))return null;e=$(e)}return null}function Ct(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function J(t){return["html","body","#document"].includes(G(t))}function W(t){return L(t).getComputedStyle(t)}function vt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $(t){if(G(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ht(t)&&t.host||V(t);return Ht(e)?e.host:e}function ae(t){const e=$(t);return J(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&it(e)?e:ae(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const s=ae(t),r=s===((n=t.ownerDocument)==null?void 0:n.body),i=L(s);if(r){const c=Et(i);return e.concat(i,i.visualViewport||[],it(s)?s:[],c&&o?et(c):[])}return e.concat(s,et(s,[],o))}function Et(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function le(t){const e=W(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=F(t),r=s?t.offsetWidth:o,i=s?t.offsetHeight:n,c=ut(o)!==r||ut(n)!==i;return c&&(o=r,n=i),{width:o,height:n,$:c}}function Ft(t){return D(t)?t:t.contextElement}function Q(t){const e=Ft(t);if(!F(e))return C(1);const o=e.getBoundingClientRect(),{width:n,height:s,$:r}=le(e);let i=(r?ut(o.width):o.width)/n,c=(r?ut(o.height):o.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const an=C(0);function ue(t){const e=L(t);return!Ct()||!e.visualViewport?an:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ln(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==L(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const s=t.getBoundingClientRect(),r=Ft(t);let i=C(1);e&&(n?D(n)&&(i=Q(n)):i=Q(t));const c=ln(r,o,n)?ue(r):C(0);let a=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,h=s.width/i.x,d=s.height/i.y;if(r){const g=L(r),f=n&&D(n)?L(n):n;let m=g,y=Et(m);for(;y&&n&&f!==m;){const p=Q(y),v=y.getBoundingClientRect(),x=W(y),w=v.left+(y.clientLeft+parseFloat(x.paddingLeft))*p.x,b=v.top+(y.clientTop+parseFloat(x.paddingTop))*p.y;a*=p.x,u*=p.y,h*=p.x,d*=p.y,a+=w,u+=b,m=L(y),y=Et(m)}}return ht({width:h,height:d,x:a,y:u})}function Vt(t,e){const o=vt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function fe(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-(o?0:Vt(t,n)),r=n.top+e.scrollTop;return{x:s,y:r}}function un(t){let{elements:e,rect:o,offsetParent:n,strategy:s}=t;const r=s==="fixed",i=V(n),c=e?wt(e.floating):!1;if(n===i||c&&r)return o;let a={scrollLeft:0,scrollTop:0},u=C(1);const h=C(0),d=F(n);if((d||!d&&!r)&&((G(n)!=="body"||it(i))&&(a=vt(n)),F(n))){const f=q(n);u=Q(n),h.x=f.x+n.clientLeft,h.y=f.y+n.clientTop}const g=i&&!d&&!r?fe(i,a,!0):C(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+h.x+g.x,y:o.y*u.y-a.scrollTop*u.y+h.y+g.y}}function fn(t){return Array.from(t.getClientRects())}function hn(t){const e=V(t),o=vt(t),n=t.ownerDocument.body,s=j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Vt(t);const c=-o.scrollTop;return W(n).direction==="rtl"&&(i+=j(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:c}}function dn(t,e){const o=L(t),n=V(t),s=o.visualViewport;let r=n.clientWidth,i=n.clientHeight,c=0,a=0;if(s){r=s.width,i=s.height;const u=Ct();(!u||u&&e==="fixed")&&(c=s.offsetLeft,a=s.offsetTop)}return{width:r,height:i,x:c,y:a}}function mn(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,s=o.left+t.clientLeft,r=F(t)?Q(t):C(1),i=t.clientWidth*r.x,c=t.clientHeight*r.y,a=s*r.x,u=n*r.y;return{width:i,height:c,x:a,y:u}}function $t(t,e,o){let n;if(e==="viewport")n=dn(t,o);else if(e==="document")n=hn(V(t));else if(D(e))n=mn(e,o);else{const s=ue(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ht(n)}function he(t,e){const o=$(t);return o===e||!D(o)||J(o)?!1:W(o).position==="fixed"||he(o,e)}function gn(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&G(c)!=="body"),s=null;const r=W(t).position==="fixed";let i=r?$(t):t;for(;D(i)&&!J(i);){const c=W(i),a=Wt(i);!a&&c.position==="fixed"&&(s=null),(r?!a&&!s:!a&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||it(i)&&!a&&he(t,i))?n=n.filter(h=>h!==i):s=c,i=$(i)}return e.set(t,n),n}function pn(t){let{element:e,boundary:o,rootBoundary:n,strategy:s}=t;const i=[...o==="clippingAncestors"?wt(e)?[]:gn(e,this._c):[].concat(o),n],c=i[0],a=i.reduce((u,h)=>{const d=$t(e,h,s);return u.top=j(d.top,u.top),u.right=X(d.right,u.right),u.bottom=X(d.bottom,u.bottom),u.left=j(d.left,u.left),u},$t(e,c,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function yn(t){const{width:e,height:o}=le(t);return{width:e,height:o}}function wn(t,e,o){const n=F(e),s=V(e),r=o==="fixed",i=q(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const a=C(0);function u(){a.x=Vt(s)}if(n||!n&&!r)if((G(e)!=="body"||it(s))&&(c=vt(e)),n){const f=q(e,!0,r,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else s&&u();r&&!n&&s&&u();const h=s&&!n&&!r?fe(s,c):C(0),d=i.left+c.scrollLeft-a.x-h.x,g=i.top+c.scrollTop-a.y-h.y;return{x:d,y:g,width:i.width,height:i.height}}function Rt(t){return W(t).position==="static"}function Kt(t,e){if(!F(t)||W(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function de(t,e){const o=L(t);if(wt(t))return o;if(!F(t)){let s=$(t);for(;s&&!J(s);){if(D(s)&&!Rt(s))return s;s=$(s)}return o}let n=Kt(t,e);for(;n&&rn(n)&&Rt(n);)n=Kt(n,e);return n&&J(n)&&Rt(n)&&!Wt(n)?o:n||cn(t)||o}const vn=async function(t){const e=this.getOffsetParent||de,o=this.getDimensions,n=await o(t.floating);return{reference:wn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function xn(t){return W(t).direction==="rtl"}const Rn={convertOffsetParentRelativeRectToViewportRelativeRect:un,getDocumentElement:V,getClippingRect:pn,getOffsetParent:de,getElementRects:vn,getClientRects:fn,getDimensions:yn,getScale:Q,isElement:D,isRTL:xn};function me(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function An(t,e){let o=null,n;const s=V(t);function r(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),r();const u=t.getBoundingClientRect(),{left:h,top:d,width:g,height:f}=u;if(c||e(),!g||!f)return;const m=ct(d),y=ct(s.clientWidth-(h+g)),p=ct(s.clientHeight-(d+f)),v=ct(h),w={rootMargin:-m+"px "+-y+"px "+-p+"px "+-v+"px",threshold:j(0,X(1,a))||1};let b=!0;function A(P){const O=P[0].intersectionRatio;if(O!==a){if(!b)return i();O?i(!1,O):n=setTimeout(()=>{i(!1,1e-7)},1e3)}O===1&&!me(u,t.getBoundingClientRect())&&i(),b=!1}try{o=new IntersectionObserver(A,{...w,root:s.ownerDocument})}catch{o=new IntersectionObserver(A,w)}o.observe(t)}return i(!0),r}function bn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Ft(t),h=s||r?[...u?et(u):[],...et(e)]:[];h.forEach(v=>{s&&v.addEventListener("scroll",o,{passive:!0}),r&&v.addEventListener("resize",o)});const d=u&&c?An(u,o):null;let g=-1,f=null;i&&(f=new ResizeObserver(v=>{let[x]=v;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(e)})),o()}),u&&!a&&f.observe(u),f.observe(e));let m,y=a?q(t):null;a&&p();function p(){const v=q(t);y&&!me(y,v)&&o(),y=v,m=requestAnimationFrame(p)}return o(),()=>{var v;h.forEach(x=>{s&&x.removeEventListener("scroll",o),r&&x.removeEventListener("resize",o)}),d==null||d(),(v=f)==null||v.disconnect(),f=null,a&&cancelAnimationFrame(m)}}const On=on,En=sn,Bt=en,Ln=tn,Pn=(t,e,o)=>{const n=new Map,s={platform:Rn,...o},r={...s.platform,_c:n};return Ze(t,e,{...s,platform:r})},Tn=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],kn=(t,e={isOpen:!1})=>{const o=[];let n=null;const s=l.Value.deriveProp(e.isOpen);function r(c){n=c,s.set(!0)}function i(){s.set(!1),o.forEach(c=>c()),o.length=0}return l.Fragment(t(r,i),l.When(s,()=>l.Fragment((n==null?void 0:n.onClickOutside)!=null?te(n.onClickOutside):null,l.WithElement(c=>l.Portal("body",l.html.div(l.WithElement(a=>{a.style.position="absolute";const u=typeof(n==null?void 0:n.target)=="string"?c.querySelector(n.target):(n==null?void 0:n.target)??c;if(u==null)throw new Error(`Target not found: ${n==null?void 0:n.target}`);let h=null;const d=l.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),g=l.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=l.Value.toSignal((n==null?void 0:n.placement)??"top"),m=l.Value.toSignal((n==null?void 0:n.arrowPadding)??0),y=n==null?void 0:n.arrow,p=l.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function v(){const w=[Bt(),On({mainAxis:d.get(),crossAxis:g.get()}),En(),Bt()];y!=null&&h!=null&&w.push(Ln({element:h,padding:m.get()}));const b=await Pn(u,a,{placement:f.get(),strategy:"absolute",middleware:w}),{x:A,y:P,middlewareData:O}=b;if(a.style.top=`${P}px`,a.style.left=`${A}px`,h!=null&&O.arrow!=null){const{x:K,y:M,centerOffset:T,alignmentOffset:B}=O.arrow;p.set({x:K,y:M,centerOffset:T,alignmentOffset:B,containerWidth:a.offsetWidth,containerHeight:a.offsetHeight})}}const x=l.effectOf(d,g,f)(v);return l.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?l.html.div(n==null?void 0:n.arrow(l.computedOf(p,f)((w,b)=>({...w,placement:b}))),l.WithElement(w=>{h=w,v()})):null,l.OnDispose(p.dispose,bn(u,a,v),x))})))))))},ge=({request:t,load:e,convertError:o,onSuccess:n,onError:s,onSettled:r})=>{let i;const c=l.prop(R.AsyncResult.notAsked),a=c.map(p=>R.AsyncResult.isSuccess(p)?p.value:void 0),u=c.map(p=>R.AsyncResult.isFailure(p)?p.error:void 0),h=c.map(p=>R.AsyncResult.isLoading(p)),d=()=>{i==null||i.abort(),i=void 0},g=p=>{d(),c.set(p??R.AsyncResult.notAsked)},f=async p=>{d(),i=new AbortController;const v=i.signal,x=c.get();c.set(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(x)));try{const w=await e({request:p,abortSignal:v,previous:x});await Promise.resolve(),i=void 0,c.set(R.AsyncResult.success(w)),n==null||n(w,p)}catch(w){i=void 0,c.set(R.AsyncResult.failure(o(w))),s==null||s(o(w),p)}r==null||r(c.get(),p)},m=()=>f(l.Value.get(t)),y=()=>{i==null||i.abort(),i=void 0,c.dispose()};return c.onDispose(l.Value.on(t,f)),{status:c,value:a,error:u,loading:h,cancel:g,reload:m,dispose:y}},pe=(t,e)=>{const{status:o,dispose:n,reload:s}=t,{pending:r,failure:i,success:c}=e;return l.Fragment(l.OnDispose(n),pt(o,{loading:r!=null?a=>r({previous:a,reload:s,cancel:t.cancel}):void 0,failure:i!=null?a=>i({error:a,reload:s}):void 0,success:a=>c({value:a,reload:s})}))},Sn=({request:t,load:e,convertError:o=u=>u,onSuccess:n,onError:s,onSettled:r,success:i,pending:c,failure:a})=>{const u=ge({request:t,load:e,convertError:o,onSuccess:n,onError:s,onSettled:r});return pe(u,{success:i,pending:c,failure:a})},ye=(t,e)=>{if(typeof e=="function")return ye(t,{success:e});const o=e.failure??(s=>l.Fragment(l.OnDispose(s.on(console.error)),s.map(r=>`Error: ${r}`))),n=e.success;return l.OneOfType(l.Value.toSignal(t),{Success:s=>n(s.$.value),Failure:s=>o(s.$.error)})},Dn=()=>l.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class rt{constructor(e,o,n,s,r,i){xt(this,"equals",e=>R.nearEqual(this.left,e.left)&&R.nearEqual(this.top,e.top)&&R.nearEqual(this.width,e.width)&&R.nearEqual(this.height,e.height));this.left=e,this.top=o,this.width=n,this.height=s,this.localLeft=r,this.localTop=i}static of({left:e=0,top:o=0,width:n=0,height:s=0,localLeft:r=0,localTop:i=0}){return new rt(e,o,n,s,r,i)}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 localCenter(){return{x:this.localLeft+this.width/2,y:this.localTop+this.height/2}}get localBottom(){return this.localTop+this.height}get localRight(){return this.localLeft+this.width}get size(){return{width:this.width,height:this.height}}}function Lt(t){const e=t.getBoundingClientRect();return rt.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height,localLeft:t.offsetLeft,localTop:t.offsetTop})}const Wn=t=>l.WithBrowserCtx(e=>{const{element:o}=e,n=l.prop(Lt(o),(c,a)=>c.equals(a)),s=l.renderableOfTNode(t(n))(e),r=()=>n.set(rt.of(Lt(o)));let i=null;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(r)),i==null||i.observe(o),l.OnDispose(c=>{i==null||i.disconnect(),s(c)})});function zt(t){return{width:(t==null?void 0:t.innerWidth)??0,height:(t==null?void 0:t.innerHeight)??0}}const Cn=t=>e=>{const o=l.getWindow(),n=l.prop(zt(o),(i,c)=>i.width===c.width&&i.height===c.height),s=l.renderableOfTNode(t(n))(e),r=()=>n.set(zt(o));return o==null||o.addEventListener("resize",r),i=>{o==null||o.removeEventListener("resize",r),s(i)}},we=(t,e)=>{const o=e.split("/").filter(s=>s!==""),n={};for(let s=0;s<t.length;s++){const r=t[s],i=o[s];if(!i&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==i)return null}else if(r.type==="param")n[r.name]=i;else if(r.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Mt=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!==""),Fn=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:r}of e){const i=we(s,n);if(i)return{...i,route:r}}return null}},dt={mark:l.makeProviderMark("RouterContext"),create:()=>{const t=l.prop([]);return{value:t,dispose:()=>t.dispose()}}},Vn=(t,e,o)=>{const n=o.split("/").filter(i=>i!==""),s={};let r=0;for(let i=0;i<t.length;i++){const c=t[i],a=n[i];if(!a&&c.type!=="catch-all")return null;if(c.type==="literal"){if(c.value!==a)return null;r++}else if(c.type==="param")s[c.name]=a,r++;else if(c.type==="catch-all"){const u="/"+n.slice(0,r).join("/"),h="/"+n.slice(r).join("/");return{params:s,matchedPath:u==="/"?"":u,remainingPath:h==="/"?"":h,route:e}}}if(n.length===t.length){const i="/"+n.join("/");return{params:s,matchedPath:i==="/"?"":i,remainingPath:"",route:e}}return null},ve=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:r}of e){const i=Vn(s,r,n);if(i)return i}return null}},Mn=t=>{const e=ve(Object.keys(t));return l.Provide(dt,{},()=>l.Use(gt,o=>l.Use(dt,n=>{const s=o.map(r=>{const i=e(r.pathname);if(i==null)throw console.error("No route found for",r),new Error("No route found");const c={matchedPath:i.matchedPath,remainingPath:i.remainingPath,fullPath:r.pathname,params:i.params};return n.value=[...n.value,c],{params:i.params,route:i.route,path:i.matchedPath||r.pathname,search:r.search,hash:r.hash}});return l.OneOfTuple(s.map(r=>[r.route,r]),t)})))},Nn=t=>{const e=ve(Object.keys(t));return l.Use(dt,o=>l.Use(gt,n=>{const s=o.map(r=>{const i=r[r.length-1],c=(i==null?void 0:i.remainingPath)||"";if(c==="")throw console.error("No remaining path for SubRouter",r),new Error("No remaining path for SubRouter");const a=e(c);if(a==null)throw console.error("No route found for remaining path",c),new Error("No route found");return{params:a.params,route:a.route,path:a.matchedPath,search:n.value.search,hash:n.value.hash}});return l.OneOfTuple(s.map(r=>[r.route,r]),t)}))},mt=60*1e3,Pt=60*mt,nt=24*Pt,_t=7*nt,jt=30*nt,Un=365*nt,Hn=[{max:mt*90,value:mt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Pt*36,value:Pt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:_t*6,value:_t,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:jt*18,value:jt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Un,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function It(t,e,o,n){const s=Math.round(t/e);return s<=1?o:n.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const xe=(t=1e3)=>{const e=l.prop(new Date),o=R.interval(()=>e.set(new Date),t);return e.onDispose(o),e},Re=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Hn)if(e<o.max)return t<0?It(e,o.value,o.past.singular,o.past.plural):It(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},Ae=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):xe(o),s=l.computedOf(t,n)((r,i)=>r.getTime()-i.getTime());return s.onDispose(()=>l.Value.dispose(n)),s},be=(t,e={})=>{const o=Ae(t,e),n=o.map(Re);return n.onDispose(o.dispose),n},$n=(t,e={})=>be(t,e);class Oe extends l.Prop{constructor(){super(...arguments);xt(this,"tick",()=>this.update(o=>o+1))}}const Kn=(t=0)=>new Oe(t,(e,o)=>e===o);exports.Anchor=Jt;exports.Appearance=Fe;exports.AsyncResultView=pt;exports.AutoFocus=Ve;exports.AutoSelect=Me;exports.ChildRouter=Nn;exports.ElementRect=Wn;exports.HTMLTitle=He;exports.HiddenWhenEmpty=Ue;exports.InViewport=Zt;exports.Location=gt;exports.Mutation=je;exports.MutationDisplay=oe;exports.OnClickOutside=te;exports.OnEnterKey=ze;exports.OnEscapeKey=_e;exports.OnKeyPressed=kt;exports.PopOver=kn;exports.Query=Sn;exports.QueryDisplay=pe;exports.Rect=rt;exports.ResultView=ye;exports.RootRouter=Mn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Dn;exports.Ticker=Oe;exports.WhenInViewport=Be;exports.WindowSize=Cn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=Fn;exports._parseRouteSegments=Mt;exports.allPlacements=Tn;exports.areLocationsEqual=Xt;exports.classes=Ne;exports.getAbsoluteRect=Lt;exports.handleAnchorClick=Qt;exports.locationFromURL=Tt;exports.makeMutationResource=ne;exports.makeQueryResource=ge;exports.matchesKeyCombo=ee;exports.matchesRoute=we;exports.nowSignal=xe;exports.relativeTime=$n;exports.relativeTimeMillisSignal=Ae;exports.relativeTimeSignal=be;exports.setLocationFromUrl=At;exports.ticker=Kn;exports.timeDiffToString=Re;exports.urlFromLocation=lt;exports.useAppearance=Gt;
|
package/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './renderables/onclickoutside';
|
|
|
12
12
|
export * from './renderables/onenterkey';
|
|
13
13
|
export * from './renderables/onescapekey';
|
|
14
14
|
export * from './renderables/onkeypressed';
|
|
15
|
+
export * from './renderables/mutation';
|
|
15
16
|
export * from './renderables/pop-over';
|
|
16
17
|
export * from './renderables/query';
|
|
17
18
|
export * from './renderables/result-view';
|
|
@@ -24,5 +25,6 @@ export * from './renderables/router/route-info';
|
|
|
24
25
|
export * from './renderables/router/router';
|
|
25
26
|
export * from './renderables/router/router-context';
|
|
26
27
|
export * from './utils/make-relative-time';
|
|
28
|
+
export * from './utils/mutation-resource';
|
|
27
29
|
export * from './utils/query-resource';
|
|
28
30
|
export * from './utils/ticker';
|