strata-ui-react 0.1.11 → 0.1.13

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/dist/index.cjs ADDED
@@ -0,0 +1,21 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`react/compiler-runtime`),u=require(`react`);u=c(u);let d=require(`react/jsx-runtime`),f=require(`react-dom`);f=c(f);function p(e,...t){let n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var m={};function h(e,t){let n=u.useRef(m);return n.current===m&&(n.current=e(t)),n}function g(e,t,n,r){let i=h(v).current;return y(i,e,t,n,r)&&x(i,[e,t,n,r]),i.callback}function _(e){let t=h(v).current;return b(t,e)&&x(t,e),t.callback}function v(){return{callback:null,cleanup:null,refs:[]}}function y(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function b(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function x(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var S=parseInt(u.version,10);function C(e){return S>=e}function w(e){if(!u.isValidElement(e))return null;let t=e,n=t.props;return(C(19)?n?.ref:t.ref)??null}function T(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function E(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){return typeof e==`function`?e(t):e}var k={};function A(e,t,n,r,i){let a={...ee(e,k)};return t&&(a=M(a,t)),n&&(a=M(a,n)),r&&(a=M(a,r)),i&&(a=M(a,i)),a}function j(e){if(e.length===0)return k;if(e.length===1)return ee(e[0],k);let t={...ee(e[0],k)};for(let n=1;n<e.length;n+=1)t=M(t,e[n]);return t}function M(e,t){return F(t)?t(e):N(e,t)}function N(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=T(e.style,r);break;case`className`:e[n]=R(e.className,r);break;default:P(n,r)?e[n]=I(e[n],r):e[n]=r}}return e}function P(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function F(e){return typeof e==`function`}function ee(e,t){return F(e)?e(t):e??k}function I(e,t){return t?e?n=>{if(z(n)){let r=n;L(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function L(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function R(e,t){return t?e?t+` `+e:t:e}function z(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function B(){}const te=Object.freeze([]),V=Object.freeze({}),ne={style:{transition:`none`}},H=`data-base-ui-click-trigger`,re={fallbackAxisSide:`end`},U={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function W(e,t,n={}){let r=t.render,i=ie(t,n);return n.enabled===!1?null:ae(e,r,i,n.state??V)}function ie(e,t={}){let{className:n,style:r,render:i}=e,{state:a=V,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?D(n,a):void 0,d=l?O(r,a):void 0,f=l?E(a,c):V,p=l?T(f,Array.isArray(s)?j(s):s)??V:V;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=_([p.ref,w(i),...o]):p.ref=g(p.ref,w(i),o):g(null,null)),l?(u!==void 0&&(p.className=R(p.className,u)),d!==void 0&&(p.style=T(p.style,d)),p):V}function ae(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=A(n,t.props);return e.ref=n.ref,u.cloneElement(t,e)}if(e&&typeof e==`string`)return oe(e,n);throw Error(process.env.NODE_ENV===`production`?p(8):`Base UI: Render element or function are not defined.`)}function oe(e,t){return e===`button`?(0,u.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,u.createElement)(`img`,{alt:``,...t,key:t.key}):u.createElement(e,t)}const se=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(se.displayName=`AvatarRootContext`);function ce(){let e=u.useContext(se);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(13):`Base UI: AvatarRootContext is missing. Avatar parts must be placed within <Avatar.Root>.`);return e}const le={imageLoadingStatus:()=>null},ue=u.forwardRef(function(e,t){let{className:n,render:r,...i}=e,[a,o]=u.useState(`idle`),s=u.useMemo(()=>({imageLoadingStatus:a}),[a]),c=u.useMemo(()=>({imageLoadingStatus:a,setImageLoadingStatus:o}),[a,o]),l=W(`span`,e,{state:s,ref:t,props:i,stateAttributesMapping:le});return(0,d.jsx)(se.Provider,{value:c,children:l})});process.env.NODE_ENV!==`production`&&(ue.displayName=`AvatarRoot`);var de=u[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],fe=de&&de!==u.useLayoutEffect?de:e=>e();function G(e){let t=h(pe).current;return t.next=e,fe(t.effect),t.trampoline}function pe(){let e={next:void 0,callback:me,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function me(){if(process.env.NODE_ENV!==`production`)throw Error(`Base UI: Cannot call an event handler while rendering.`)}var he=()=>{};const K=typeof document<`u`?u.useLayoutEffect:he;function ge(e,{referrerPolicy:t,crossOrigin:n}){let[r,i]=u.useState(`idle`);return K(()=>{if(!e)return i(`error`),B;let r=!0,a=new window.Image,o=e=>()=>{r&&i(e)};return i(`loading`),a.onload=o(`loaded`),a.onerror=o(`error`),t&&(a.referrerPolicy=t),a.crossOrigin=n??null,a.src=e,()=>{r=!1}},[e,n,t]),r}const _e=u.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:i,referrerPolicy:a,crossOrigin:o,...s}=e,c=ce(),l=ge(e.src,{referrerPolicy:a,crossOrigin:o}),d=G(e=>{i?.(e),c.setImageLoadingStatus(e)});return K(()=>{l!==`idle`&&d(l)},[l,d]),W(`img`,e,{state:u.useMemo(()=>({imageLoadingStatus:l}),[l]),ref:t,props:s,stateAttributesMapping:le,enabled:l===`loaded`})});process.env.NODE_ENV!==`production`&&(_e.displayName=`AvatarImage`);var ve=[];function ye(e){u.useEffect(e,ve)}var be=0,xe=class e{static create(){return new e}currentId=be;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=be,t()},e)}isStarted(){return this.currentId!==be}clear=()=>{this.currentId!==be&&(clearTimeout(this.currentId),this.currentId=be)};disposeEffect=()=>this.clear};function Se(){let e=h(xe.create).current;return ye(e.disposeEffect),e}const Ce=u.forwardRef(function(e,t){let{className:n,render:r,delay:i,...a}=e,{imageLoadingStatus:o}=ce(),[s,c]=u.useState(i===void 0),l=Se();return u.useEffect(()=>(i!==void 0&&l.start(i,()=>c(!0)),l.clear),[l,i]),W(`span`,e,{state:u.useMemo(()=>({imageLoadingStatus:o}),[o]),ref:t,props:a,stateAttributesMapping:le,enabled:o!==`loaded`&&s})});process.env.NODE_ENV!==`production`&&(Ce.displayName=`AvatarFallback`);function we(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=we(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Te(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=we(e))&&(r&&(r+=` `),r+=t);return r}var Ee=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},De=(e,t)=>({classGroupId:e,validator:t}),Oe=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ke=`-`,Ae=[],je=`arbitrary..`,Me=e=>{let t=Fe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Pe(e);let n=e.split(ke);return Ne(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ee(i,t):t:i||Ae}return n[e]||Ae}}},Ne=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Ne(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ke):e.slice(t).join(ke),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Pe=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?je+r:void 0})(),Fe=e=>{let{theme:t,classGroups:n}=e;return Ie(n,t)},Ie=(e,t)=>{let n=Oe();for(let r in e){let i=e[r];Le(i,n,r,t)}return n},Le=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Re(i,t,n,r)}},Re=(e,t,n,r)=>{if(typeof e==`string`){ze(e,t,n);return}if(typeof e==`function`){Be(e,t,n,r);return}Ve(e,t,n,r)},ze=(e,t,n)=>{let r=e===``?t:He(t,e);r.classGroupId=n},Be=(e,t,n,r)=>{if(Ue(e)){Le(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(De(n,e))},Ve=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Le(o,He(t,a),n,r)}},He=(e,t)=>{let n=e,r=t.split(ke),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Oe(),n.nextPart.set(t,i)),n=i}return n},Ue=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,We=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ge=`!`,Ke=`:`,qe=[],Je=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ye=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Ke){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ge)?(c=s.slice(0,-1),l=!0):s.startsWith(Ge)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Je(t,l,c,u)};if(t){let e=t+Ke,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Je(qe,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Xe=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ze=e=>({cache:We(e.cacheSize),parseClassName:Ye(e),sortModifiers:Xe(e),...Me(e)}),Qe=/\s+/,$e=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Qe),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Ge:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},et=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=tt(n))&&(i&&(i+=` `),i+=r);return i},tt=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=tt(e[r]))&&(n&&(n+=` `),n+=t);return n},nt=(e,...t)=>{let n,r,i,a,o=o=>(n=Ze(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=$e(e,n);return i(e,a),a};return a=o,(...e)=>a(et(...e))},rt=[],it=e=>{let t=t=>t[e]||rt;return t.isThemeGetter=!0,t},at=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ot=/^\((?:(\w[\w-]*):)?(.+)\)$/i,st=/^\d+\/\d+$/,ct=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ut=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ft=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pt=e=>st.test(e),q=e=>!!e&&!Number.isNaN(Number(e)),mt=e=>!!e&&Number.isInteger(Number(e)),ht=e=>e.endsWith(`%`)&&q(e.slice(0,-1)),gt=e=>ct.test(e),_t=()=>!0,vt=e=>lt.test(e)&&!ut.test(e),yt=()=>!1,bt=e=>dt.test(e),xt=e=>ft.test(e),St=e=>!J(e)&&!Y(e),Ct=e=>Ft(e,zt,yt),J=e=>at.test(e),wt=e=>Ft(e,Bt,vt),Tt=e=>Ft(e,Vt,q),Et=e=>Ft(e,Lt,yt),Dt=e=>Ft(e,Rt,xt),Ot=e=>Ft(e,Ut,bt),Y=e=>ot.test(e),kt=e=>It(e,Bt),At=e=>It(e,Ht),jt=e=>It(e,Lt),Mt=e=>It(e,zt),Nt=e=>It(e,Rt),Pt=e=>It(e,Ut,!0),Ft=(e,t,n)=>{let r=at.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},It=(e,t,n=!1)=>{let r=ot.exec(e);return r?r[1]?t(r[1]):n:!1},Lt=e=>e===`position`||e===`percentage`,Rt=e=>e===`image`||e===`url`,zt=e=>e===`length`||e===`size`||e===`bg-size`,Bt=e=>e===`length`,Vt=e=>e===`number`,Ht=e=>e===`family-name`,Ut=e=>e===`shadow`,Wt=()=>{let e=it(`color`),t=it(`font`),n=it(`text`),r=it(`font-weight`),i=it(`tracking`),a=it(`leading`),o=it(`breakpoint`),s=it(`container`),c=it(`spacing`),l=it(`radius`),u=it(`shadow`),d=it(`inset-shadow`),f=it(`text-shadow`),p=it(`drop-shadow`),m=it(`blur`),h=it(`perspective`),g=it(`aspect`),_=it(`ease`),v=it(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[pt,`full`,`auto`,...w()],E=()=>[mt,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,mt,Y,J]},mt,Y,J],O=()=>[mt,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[pt,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,Y,J],F=()=>[...b(),jt,Et,{position:[Y,J]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],I=()=>[`auto`,`cover`,`contain`,Mt,Ct,{size:[Y,J]}],L=()=>[ht,kt,wt],R=()=>[``,`none`,`full`,l,Y,J],z=()=>[``,q,kt,wt],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[q,ht,jt,Et],ne=()=>[``,`none`,m,Y,J],H=()=>[`none`,q,Y,J],re=()=>[`none`,q,Y,J],U=()=>[q,Y,J],W=()=>[pt,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[gt],breakpoint:[gt],color:[_t],container:[gt],"drop-shadow":[gt],ease:[`in`,`out`,`in-out`],font:[St],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[gt],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[gt],shadow:[gt],spacing:[`px`,q],text:[gt],"text-shadow":[gt],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,pt,J,Y,g]}],container:[`container`],columns:[{columns:[q,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[mt,`auto`,Y,J]}],basis:[{basis:[pt,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[q,pt,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,q,Y,J]}],shrink:[{shrink:[``,q,Y,J]}],order:[{order:[mt,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,kt,wt]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Y,Tt]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,ht,J]}],"font-family":[{font:[At,J,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[q,`none`,Y,Tt]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[q,`from-font`,`auto`,Y,wt]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[q,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:I()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},mt,Y,J],radial:[``,Y,J],conic:[mt,Y,J]},Nt,Dt]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[q,Y,J]}],"outline-w":[{outline:[``,q,kt,wt]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,Pt,Ot]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,Pt,Ot]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[q,wt]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,Pt,Ot]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[q,Y,J]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[q]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[q]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:ne()}],brightness:[{brightness:[q,Y,J]}],contrast:[{contrast:[q,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Pt,Ot]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,q,Y,J]}],"hue-rotate":[{"hue-rotate":[q,Y,J]}],invert:[{invert:[``,q,Y,J]}],saturate:[{saturate:[q,Y,J]}],sepia:[{sepia:[``,q,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[q,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[q,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,q,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[q,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,q,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[q,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[q,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,q,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[q,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[q,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:U()}],"skew-x":[{"skew-x":U()}],"skew-y":[{"skew-y":U()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[q,kt,wt,Tt]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},Gt=nt(Wt);function X(...e){return Gt(Te(e))}const Kt=e=>{let t=(0,l.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(`inline-flex size-xl items-center justify-center overflow-hidden rounded-full bg-surface-container align-middle font-medium select-none raised-2`,r),t[5]=r,t[6]=o);let s;return t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,d.jsx)(ue,{"data-slot":`avatar`,className:o,ref:a,...i,children:n}),t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s},qt=e=>{let t=(0,l.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,ref:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=X(`size-full object-cover`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,d.jsx)(_e,{"data-slot":`avatar-image`,className:a,ref:i,...r}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},Jt=e=>{let t=(0,l.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,ref:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=X(`flex size-full items-center justify-center`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,d.jsx)(Ce,{"data-slot":`avatar-fallback`,className:a,ref:i,...r}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o};var Yt=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e;const Xt=Te,Zt=(e,t)=>n=>{if(t?.variants==null)return Xt(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Yt(t)||Yt(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Xt(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Qt=Zt(`inline-flex items-center justify-center whitespace-nowrap select-none transition-all px-xs py-3xs gap-3xs font-medium`,{variants:{tone:{primary:``,secondary:``,tertiary:``,neutral:``,error:``,success:``,warning:``},style:{solid:`raised-1`,outline:`bg-transparent outline outline-2`},radius:{rounded:`rounded-lg`,circle:`rounded-full`}},defaultVariants:{tone:`neutral`,style:`solid`,radius:`rounded`},compoundVariants:[{tone:`primary`,style:`solid`,className:`bg-primary text-on-primary`},{tone:`primary`,style:`outline`,className:`outline-primary text-primary`},{tone:`secondary`,style:`solid`,className:`bg-secondary text-on-secondary`},{tone:`secondary`,style:`outline`,className:`outline-secondary text-secondary`},{tone:`tertiary`,style:`solid`,className:`bg-tertiary text-on-tertiary`},{tone:`tertiary`,style:`outline`,className:`outline-tertiary text-tertiary`},{tone:`neutral`,style:`solid`,className:`bg-surface-container`},{tone:`neutral`,style:`outline`,className:`outline-on-surface text-on-surface`},{tone:`error`,style:`solid`,className:`bg-error text-on-error`},{tone:`error`,style:`outline`,className:`outline-error text-error`},{tone:`success`,style:`solid`,className:`bg-success text-on-success`},{tone:`success`,style:`outline`,className:`outline-success text-success`},{tone:`warning`,style:`solid`,className:`bg-warning text-on-warning`},{tone:`warning`,style:`outline`,className:`outline-warning text-warning`}]}),$t=e=>{let t=(0,l.c)(18),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,tone:c,style:s,radius:a,children:n,ref:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let u;t[8]!==r||t[9]!==a||t[10]!==s||t[11]!==c?(u=X(Qt({className:r,tone:c,style:s,radius:a})),t[8]=r,t[9]=a,t[10]=s,t[11]=c,t[12]=u):u=t[12];let f;return t[13]!==n||t[14]!==i||t[15]!==o||t[16]!==u?(f=(0,d.jsx)(`div`,{className:u,ref:o,...i,children:n}),t[13]=n,t[14]=i,t[15]=o,t[16]=u,t[17]=f):f=t[17],f},en=Zt(`inline-flex items-center justify-center whitespace-nowrap rounded-full select-none transition-all disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,{variants:{tone:{destructive:``,glass:``,neutral:``,primary:``,secondary:``,success:``,accent:``,warning:``},style:{solid:``,outline:`active:border-transparent`,ghost:``},size:{large:`h-2xl px-lg style-text-default-1 gap-xs [&>svg]:size-md`,medium:`h-xl px-md style-text-default-0 gap-2xs [&>svg]:size-sm`,small:`h-lg px-sm style-text-default--1 gap-3xs [&>svg]:size-xs`,iconLarge:`size-2xl p-0 [&>svg]:size-md`,iconMedium:`size-xl p-0 [&>svg]:size-sm`,iconSmall:`size-lg p-0 [&>svg]:size-xs`}},defaultVariants:{tone:`primary`,style:`solid`,size:`medium`},compoundVariants:[{tone:`primary`,style:`solid`,className:`bg-primary text-on-primary`},{tone:`primary`,style:`solid`,size:[`small`,`iconSmall`],className:`raised-1 hover:raised-2 active:inset-shadow-1-shadow`},{tone:`primary`,style:`solid`,size:[`medium`,`iconMedium`],className:`raised-2 hover:raised-4 active:inset-shadow-2-shadow`},{tone:`primary`,style:`solid`,size:[`large`,`iconLarge`],className:`raised-4 hover:raised-8 active:inset-shadow-3-shadow`},{tone:`primary`,style:`outline`,className:`border-primary text-primary hover:text-on-primary-container hover:bg-primary-container active:bg-transparent`},{tone:`primary`,style:`outline`,size:[`small`,`iconSmall`],className:`border-1`},{tone:`primary`,style:`outline`,size:[`medium`,`iconMedium`],className:`border-2`},{tone:`primary`,style:`outline`,size:[`large`,`iconLarge`],className:`border-4`},{tone:`primary`,style:`ghost`,className:`text-primary hover:surface-bright active:bg-surface-dim`},{tone:`primary`,style:`ghost`,size:[`small`,`iconSmall`],className:`hover:raised-1 active:inset-shadow-1-shadow`},{tone:`primary`,style:`ghost`,size:[`medium`,`iconMedium`],className:`hover:raised-2 active:inset-shadow-2-shadow`},{tone:`primary`,style:`ghost`,size:[`large`,`iconLarge`],className:`hover:raised-4 active:inset-shadow-3-shadow`},{tone:`secondary`,style:`solid`,className:`bg-secondary text-on-secondary`},{tone:`secondary`,style:`solid`,size:[`small`,`iconSmall`],className:`raised-1 hover:raised-2 active:inset-shadow-1-shadow`},{tone:`secondary`,style:`solid`,size:[`medium`,`iconMedium`],className:`raised-2 hover:raised-4 active:inset-shadow-2-shadow`},{tone:`secondary`,style:`solid`,size:[`large`,`iconLarge`],className:`raised-4 hover:raised-8 active:inset-shadow-3-shadow`},{tone:`secondary`,style:`outline`,className:`border-secondary text-secondary hover:text-on-secondary-container hover:bg-secondary-container active:bg-transparent`},{tone:`secondary`,style:`outline`,size:[`small`,`iconSmall`],className:`border-1`},{tone:`secondary`,style:`outline`,size:[`medium`,`iconMedium`],className:`border-2`},{tone:`secondary`,style:`outline`,size:[`large`,`iconLarge`],className:`border-4`},{tone:`secondary`,style:`ghost`,className:`text-secondary hover:surface-bright active:bg-surface-dim`},{tone:`secondary`,style:`ghost`,size:[`small`,`iconSmall`],className:`hover:raised-1 active:inset-shadow-1-shadow`},{tone:`secondary`,style:`ghost`,size:[`medium`,`iconMedium`],className:`hover:raised-2 active:inset-shadow-2-shadow`},{tone:`secondary`,style:`ghost`,size:[`large`,`iconLarge`],className:`hover:raised-4 active:inset-shadow-3-shadow`},{tone:`accent`,style:`solid`,className:`bg-accent text-on-accent`},{tone:`accent`,style:`solid`,size:[`small`,`iconSmall`],className:`raised-1 hover:raised-2 active:inset-shadow-1-shadow`},{tone:`accent`,style:`solid`,size:[`medium`,`iconMedium`],className:`raised-2 hover:raised-4 active:inset-shadow-2-shadow`},{tone:`accent`,style:`solid`,size:[`large`,`iconLarge`],className:`raised-4 hover:raised-8 active:inset-shadow-3-shadow`},{tone:`accent`,style:`outline`,className:`border-accent text-accent hover:text-on-accent-container hover:bg-accent-container active:bg-transparent`},{tone:`accent`,style:`outline`,size:[`small`,`iconSmall`],className:`border-1`},{tone:`accent`,style:`outline`,size:[`medium`,`iconMedium`],className:`border-2`},{tone:`accent`,style:`outline`,size:[`large`,`iconLarge`],className:`border-4`},{tone:`accent`,style:`ghost`,className:`text-accent hover:surface-bright active:bg-surface-dim`},{tone:`accent`,style:`ghost`,size:[`small`,`iconSmall`],className:`hover:raised-1 active:inset-shadow-1-shadow`},{tone:`accent`,style:`ghost`,size:[`medium`,`iconMedium`],className:`hover:raised-2 active:inset-shadow-2-shadow`},{tone:`accent`,style:`ghost`,size:[`large`,`iconLarge`],className:`hover:raised-4 active:inset-shadow-3-shadow`},{tone:`success`,style:`solid`,className:`bg-success text-on-success`},{tone:`success`,style:`solid`,size:[`small`,`iconSmall`],className:`raised-1 hover:raised-2 active:inset-shadow-1-shadow`},{tone:`success`,style:`solid`,size:[`medium`,`iconMedium`],className:`raised-2 hover:raised-4 active:inset-shadow-2-shadow`},{tone:`success`,style:`solid`,size:[`large`,`iconLarge`],className:`raised-4 hover:raised-8 active:inset-shadow-3-shadow`},{tone:`success`,style:`outline`,className:`border-success text-success hover:text-on-success-container hover:bg-success-container active:bg-transparent`},{tone:`success`,style:`outline`,size:[`small`,`iconSmall`],className:`border-1`},{tone:`success`,style:`outline`,size:[`medium`,`iconMedium`],className:`border-2`},{tone:`success`,style:`outline`,size:[`large`,`iconLarge`],className:`border-4`},{tone:`success`,style:`ghost`,className:`text-success hover:surface-bright active:bg-surface-dim`},{tone:`success`,style:`ghost`,size:[`small`,`iconSmall`],className:`hover:raised-1 active:inset-shadow-1-shadow`},{tone:`success`,style:`ghost`,size:[`medium`,`iconMedium`],className:`hover:raised-2 active:inset-shadow-2-shadow`},{tone:`success`,style:`ghost`,size:[`large`,`iconLarge`],className:`hover:raised-4 active:inset-shadow-3-shadow`},{tone:`warning`,style:`solid`,className:`bg-warning text-on-warning`},{tone:`warning`,style:`solid`,size:[`small`,`iconSmall`],className:`raised-1 hover:raised-2 active:inset-shadow-1-shadow`},{tone:`warning`,style:`solid`,size:[`medium`,`iconMedium`],className:`raised-2 hover:raised-4 active:inset-shadow-2-shadow`},{tone:`warning`,style:`solid`,size:[`large`,`iconLarge`],className:`raised-4 hover:raised-8 active:inset-shadow-3-shadow`},{tone:`warning`,style:`outline`,className:`border-warning text-warning hover:text-on-warning-container hover:bg-warning-container active:bg-transparent`},{tone:`warning`,style:`outline`,size:[`small`,`iconSmall`],className:`border-1`},{tone:`warning`,style:`outline`,size:[`medium`,`iconMedium`],className:`border-2`},{tone:`warning`,style:`outline`,size:[`large`,`iconLarge`],className:`border-4`},{tone:`warning`,style:`ghost`,className:`text-warning hover:surface-bright active:bg-surface-dim`},{tone:`warning`,style:`ghost`,size:[`small`,`iconSmall`],className:`hover:raised-1 active:inset-shadow-1-shadow`},{tone:`warning`,style:`ghost`,size:[`medium`,`iconMedium`],className:`hover:raised-2 active:inset-shadow-2-shadow`},{tone:`warning`,style:`ghost`,size:[`large`,`iconLarge`],className:`hover:raised-4 active:inset-shadow-3-shadow`},{tone:`destructive`,style:`solid`,className:`bg-error text-on-error`},{tone:`destructive`,style:`solid`,size:[`small`,`iconSmall`],className:`raised-1 hover:raised-2 active:inset-shadow-1-shadow`},{tone:`destructive`,style:`solid`,size:[`medium`,`iconMedium`],className:`raised-2 hover:raised-4 active:inset-shadow-2-shadow`},{tone:`destructive`,style:`solid`,size:[`large`,`iconLarge`],className:`raised-4 hover:raised-8 active:inset-shadow-3-shadow`},{tone:`destructive`,style:`outline`,className:`border-error text-error hover:text-on-error-container hover:bg-error-container active:bg-transparent`},{tone:`destructive`,style:`outline`,size:[`small`,`iconSmall`],className:`border-1`},{tone:`destructive`,style:`outline`,size:[`medium`,`iconMedium`],className:`border-2`},{tone:`destructive`,style:`outline`,size:[`large`,`iconLarge`],className:`border-4`},{tone:`destructive`,style:`ghost`,className:`text-error hover:surface-bright active:bg-surface-dim`},{tone:`destructive`,style:`ghost`,size:[`small`,`iconSmall`],className:`hover:raised-1 active:inset-shadow-1-shadow`},{tone:`destructive`,style:`ghost`,size:[`medium`,`iconMedium`],className:`hover:raised-2 active:inset-shadow-2-shadow`},{tone:`destructive`,style:`ghost`,size:[`large`,`iconLarge`],className:`hover:raised-4 active:inset-shadow-3-shadow`},{tone:`neutral`,style:`solid`,className:`bg-surface-container text-on-surface`},{tone:`neutral`,style:`solid`,size:[`small`,`iconSmall`],className:`raised-1 hover:raised-2 active:inset-shadow-1-shadow`},{tone:`neutral`,style:`solid`,size:[`medium`,`iconMedium`],className:`raised-2 hover:raised-4 active:inset-shadow-2-shadow`},{tone:`neutral`,style:`solid`,size:[`large`,`iconLarge`],className:`raised-4 hover:raised-8 active:inset-shadow-3-shadow`},{tone:`neutral`,style:`outline`,className:`border-outline text-on-surface hover:text-on-surface hover:bg-surface-container-high active:bg-transparent`},{tone:`neutral`,style:`outline`,size:[`small`,`iconSmall`],className:`border-1`},{tone:`neutral`,style:`outline`,size:[`medium`,`iconMedium`],className:`border-2`},{tone:`neutral`,style:`outline`,size:[`large`,`iconLarge`],className:`border-4`},{tone:`neutral`,style:`ghost`,className:`text-on-surface hover:surface-bright active:bg-surface-dim`},{tone:`neutral`,style:`ghost`,size:[`small`,`iconSmall`],className:`hover:raised-1 active:inset-shadow-1-shadow`},{tone:`neutral`,style:`ghost`,size:[`medium`,`iconMedium`],className:`hover:raised-2 active:inset-shadow-2-shadow`},{tone:`neutral`,style:`ghost`,size:[`large`,`iconLarge`],className:`hover:raised-4 active:inset-shadow-3-shadow`}]});function tn(e){let t=(0,l.c)(16),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,tone:s,style:o,size:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c;t[7]!==r||t[8]!==a||t[9]!==o||t[10]!==s?(c=X(en({tone:s,style:o,size:a,className:r})),t[7]=r,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11];let u;return t[12]!==n||t[13]!==i||t[14]!==c?(u=(0,d.jsx)(`button`,{className:c,...i,children:n}),t[12]=n,t[13]=i,t[14]=c,t[15]=u):u=t[15],u}function nn({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=u.useRef(e!==void 0),[a,o]=u.useState(t),s=i?e:a;if(process.env.NODE_ENV!==`production`){u.useEffect(()=>{i!==(e!==void 0)&&console.error([`Base UI: A component is changing the ${i?``:`un`}controlled ${r} state of ${n} to be ${i?`un`:``}controlled.`,`Elements should not switch from uncontrolled to controlled (or vice versa).`,`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.",`More info: https://fb.me/react-controlled-components`].join(`
2
+ `))},[r,n,e]);let{current:a}=u.useRef(t);u.useEffect(()=>{!i&&JSON.stringify(a)!==JSON.stringify(t)&&console.error([`Base UI: A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
3
+ `))},[JSON.stringify(t)])}return[s,u.useCallback(e=>{i||o(e)},[])]}const rn={clip:`rect(0 0 0 0)`,overflow:`hidden`,whiteSpace:`nowrap`,position:`fixed`,top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};let an=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),on=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});const sn={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},cn={valid(e){return e===null?null:e?{[on.valid]:``}:{[on.invalid]:``}}};function ln(e){return u.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[an.checked]:``}:{[an.unchecked]:``}},...cn}),[e.indeterminate])}const un={...u};var dn=0;function fn(e,t=`mui`){let[n,r]=u.useState(e),i=e||n;return u.useEffect(()=>{n??(dn+=1,r(`${t}-${dn}`))},[n,t]),i}var pn=un.useId;function mn(e,t){if(pn!==void 0){let n=pn();return e??(t?`${t}-${n}`:n)}return fn(e,t)}function hn(e){return mn(e,`base-ui`)}function gn(){return typeof window<`u`}function _n(e){return bn(e)?(e.nodeName||``).toLowerCase():`#document`}function vn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yn(e){return((bn(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function bn(e){return gn()?e instanceof Node||e instanceof vn(e).Node:!1}function Z(e){return gn()?e instanceof Element||e instanceof vn(e).Element:!1}function xn(e){return gn()?e instanceof HTMLElement||e instanceof vn(e).HTMLElement:!1}function Sn(e){return!gn()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof vn(e).ShadowRoot}var Cn=new Set([`inline`,`contents`]);function wn(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ln(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Cn.has(i)}var Tn=new Set([`table`,`td`,`th`]);function En(e){return Tn.has(_n(e))}var Dn=[`:popover-open`,`:modal`];function On(e){return Dn.some(t=>{try{return e.matches(t)}catch{return!1}})}var kn=[`transform`,`translate`,`scale`,`rotate`,`perspective`],An=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],jn=[`paint`,`layout`,`strict`,`content`];function Mn(e){let t=Pn(),n=Z(e)?Ln(e):e;return kn.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||An.some(e=>(n.willChange||``).includes(e))||jn.some(e=>(n.contain||``).includes(e))}function Nn(e){let t=zn(e);for(;xn(t)&&!In(t);){if(Mn(t))return t;if(On(t))return null;t=zn(t)}return null}function Pn(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var Fn=new Set([`html`,`body`,`#document`]);function In(e){return Fn.has(_n(e))}function Ln(e){return vn(e).getComputedStyle(e)}function Rn(e){return Z(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zn(e){if(_n(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Sn(e)&&e.host||yn(e);return Sn(t)?t.host:t}function Bn(e){let t=zn(e);return In(t)?e.ownerDocument?e.ownerDocument.body:e.body:xn(t)&&wn(t)?t:Bn(t)}function Vn(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Bn(e),i=r===e.ownerDocument?.body,a=vn(r);if(i){let e=Hn(a);return t.concat(a,a.visualViewport||[],wn(r)?r:[],e&&n?Vn(e):[])}return t.concat(r,Vn(r,[],n))}function Hn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Un;process.env.NODE_ENV!==`production`&&(Un=new Set);function Wn(...e){if(process.env.NODE_ENV!==`production`){let t=e.join(` `);Un.has(t)||(Un.add(t),console.error(`Base UI: ${t}`))}}const Gn=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(Gn.displayName=`CompositeRootContext`);function Kn(e=!1){let t=u.useContext(Gn);if(t===void 0&&!e)throw Error(process.env.NODE_ENV===`production`?p(16):`Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.`);return t}function qn(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:u.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Jn(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=u.useRef(null),o=Kn(!0)!==void 0,s=G(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=qn({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i});process.env.NODE_ENV!==`production`&&u.useEffect(()=>{if(!a.current)return;let e=a.current.tagName===`BUTTON`;i?e||Wn("A component that acts as a button was not rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is a real <button>, or set the `nativeButton` prop on the component to `false`."):e&&Wn("A component that acts as a button was rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is not a real <button>, or set the `nativeButton` prop on the component to `true`.")},[i]);let l=u.useCallback(()=>{let e=a.current;Yn(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return K(l,[l]),{getButtonProps:u.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return A({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(L(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(L(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:G(e=>{a.current=e,l()})}}function Yn(e){return xn(e)&&e.tagName===`BUTTON`}const Xn=u.createContext({invalid:void 0,name:void 0,validityData:{state:sn,errors:[],error:``,value:``,initialValue:null},setValidityData:B,disabled:void 0,touched:!1,setTouched:B,dirty:!1,setDirty:B,filled:!1,setFilled:B,focused:!1,setFocused:B,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=V)=>e,getInputValidationProps:(e=V)=>e,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!==`production`&&(Xn.displayName=`FieldRootContext`);function Zn(e=!0){let t=u.useContext(Xn);if(t.setValidityData===B&&!e)throw Error(process.env.NODE_ENV===`production`?p(28):`Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.`);return t}const Qn=u.createContext({disabled:!1});process.env.NODE_ENV!==`production`&&(Qn.displayName=`FieldItemContext`);function $n(){return u.useContext(Qn)}function er(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const tr=u.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:B,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});process.env.NODE_ENV!==`production`&&(tr.displayName=`FormContext`);function nr(){return u.useContext(tr)}function rr(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=nr(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=Zn(),p=G(e.getValue);K(()=>{if(!t)return;let e=n;e===void 0&&(e=p()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,p]),K(()=>{!t||!r||s.current.fields.set(r,{getValue:p,name:i,controlRef:a,validityData:er(u,c),validate(){let e=n;e===void 0&&(e=p()),l.current=!0,f.flushSync(()=>o(e))}})},[o,a,t,s,p,r,c,l,i,u,n]),K(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}const ir=u.createContext({controlId:void 0,setControlId:B,labelId:void 0,setLabelId:B,messageIds:[],setMessageIds:B,getDescriptionProps:e=>e});process.env.NODE_ENV!==`production`&&(ir.displayName=`LabelableContext`);function ar(){return u.useContext(ir)}const or=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(or.displayName=`CheckboxGroupContext`);function sr(e=!0){let t=u.useContext(or);if(t===void 0&&!e)throw Error(process.env.NODE_ENV===`production`?p(3):`Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.`);return t}const cr=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(cr.displayName=`CheckboxRootContext`);function lr(){let e=u.useContext(cr);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(14):`Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.`);return e}const ur=`none`,dr=`trigger-press`,fr=`trigger-hover`,pr=`trigger-focus`,mr=`outside-press`,hr=`close-press`,gr=`focus-out`,_r=`escape-key`,vr=`disabled`,yr=`imperative-action`;function br(e,t,n,r){let i=!1,a=!1,o=r??V;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function xr(e,t){let n=u.useRef(e),r=G(t);K(()=>{n.current!==e&&r(n.current)},[e,r]),K(()=>{n.current=e},[e])}const Sr=`data-parent`,Cr=u.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,disabled:a=!1,id:o,indeterminate:s=!1,inputRef:c,name:l,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:_=!1,uncheckedValue:v,value:y,nativeButton:b=!1,...x}=e,{clearErrors:S}=nr(),{disabled:C,name:w,setDirty:T,setFilled:E,setFocused:D,setTouched:O,state:k,validationMode:j,validityData:M,shouldValidateOnChange:N,validation:P}=Zn(),F=$n(),{labelId:ee,controlId:I,setControlId:L,getDescriptionProps:R}=ar(),z=sr(),te=z?.parent,ne=te&&z.allValues,H=C||F.disabled||z?.disabled||a,re=w??l,U=y??re,ie=hn(),ae=hn(),oe=I;ne?oe=p?ae:`${te.id}-${U}`:o&&(oe=o);let se={};ne&&(p?se=z.parent.getParentProps():U&&(se=z.parent.getChildProps(U)));let ce=G(f),{checked:le=n,indeterminate:ue=s,onCheckedChange:de,...fe}=se,pe=z?.value,me=z?.setValue,he=z?.defaultValue,ge=u.useRef(null),{getButtonProps:_e,buttonRef:ve}=Jn({disabled:H,native:b}),ye=z?.validation??P,[be,xe]=nn({controlled:U&&pe&&!p?pe.includes(U):le,default:U&&he&&!p?he.includes(U):i,name:`Checkbox`,state:`checked`});K(()=>{if(L!==B)return L(oe),()=>{L(void 0)}},[oe,z,L,p]),rr({enabled:!z,id:ie,commit:ye.commit,value:be,controlRef:ge,name:re,getValue:()=>be});let Se=u.useRef(null),Ce=g(c,Se,ye.inputRef);K(()=>{Se.current&&(Se.current.indeterminate=ue,be&&E(!0))},[be,ue,E]),xr(be,()=>{z&&!p||(S(re),E(be),T(be!==M.initialValue),N()?ye.commit(be):ye.commit(be,!0))});let we=A({checked:be,disabled:H,name:p?void 0:re,id:oe??void 0,required:_,ref:Ce,style:rn,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=br(ur,e.nativeEvent);de?.(t,n),ce(t,n),!n.isCanceled&&(xe(t),U&&pe&&me&&!p&&me(t?[...pe,U]:pe.filter(e=>e!==U),n))},onFocus(){ge.current?.focus()}},y===void 0?V:{value:(z?be&&y:y)||``},R,z?ye.getValidationProps:ye.getInputValidationProps),Te=ne?!!le:be,Ee=ne&&ue||s;u.useEffect(()=>{te&&U&&te.disabledStatesRef.current.set(U,H)},[te,H,U]);let De=u.useMemo(()=>({...k,checked:Te,disabled:H,readOnly:m,required:_,indeterminate:Ee}),[k,Te,H,m,_,Ee]),Oe=ln(De),ke=W(`span`,e,{state:De,ref:[ve,ge,t,z?.registerControlRef],props:[{id:ie,role:`checkbox`,"aria-checked":ue?`mixed`:be,"aria-readonly":m||void 0,"aria-required":_||void 0,"aria-labelledby":ee,"data-parent":p?``:void 0,onFocus(){D(!0)},onBlur(){let e=Se.current;e&&(O(!0),D(!1),j===`onBlur`&&ye.commit(z?pe:e.checked))},onClick(e){m||H||(e.preventDefault(),Se.current?.click())}},R,ye.getValidationProps,x,fe,_e],stateAttributesMapping:Oe});return(0,d.jsxs)(cr.Provider,{value:De,children:[ke,!be&&!z&&re&&!p&&v!==void 0&&(0,d.jsx)(`input`,{type:`hidden`,name:re,value:v}),(0,d.jsx)(`input`,{...we})]})});process.env.NODE_ENV!==`production`&&(Cr.displayName=`CheckboxRoot`);function wr(e){let t=h(Tr,e).current;return t.next=e,K(t.effect),t}function Tr(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Er=null,Dr=globalThis.requestAnimationFrame,Or=class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1;let n=process.env.NODE_ENV===`test`&&Dr!==requestAnimationFrame&&(Dr=requestAnimationFrame,!0);return(!this.isScheduled||n)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},kr=new Or,Ar=class e{static create(){return new e}static request(e){return kr.request(e)}static cancel(e){return kr.cancel(e)}currentId=Er;request(e){this.cancel(),this.currentId=kr.request(()=>{this.currentId=Er,e()})}cancel=()=>{this.currentId!==Er&&(kr.cancel(this.currentId),this.currentId=Er)};disposeEffect=()=>this.cancel};function jr(){let e=h(Ar.create).current;return ye(e.disposeEffect),e}function Mr(e){return e==null?e:`current`in e?e.current:e}function Nr(e,t=!1,n=!0){let r=jr();return G((i,a=null)=>{r.cancel();let o=Mr(e);o!=null&&(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function e(){o&&Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{a!=null&&a.aborted||f.flushSync(i)}).catch(()=>{if(n){if(a!=null&&a.aborted)return;f.flushSync(i)}else o.getAnimations().length>0&&o.getAnimations().some(e=>e.pending||e.playState!==`finished`)&&e()})}t?r.request(e):e()}))})}function Pr(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=wr(n),o=G(i),s=Nr(r,n);u.useEffect(()=>{t&&s(()=>{n===a.current&&o()})},[t,n,o,s,a])}function Fr(e,t=!1,n=!1){let[r,i]=u.useState(e&&t?`idle`:void 0),[a,o]=u.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),K(()=>{if(!e&&a&&r!==`ending`&&n){let e=Ar.request(()=>{i(`ending`)});return()=>{Ar.cancel(e)}}},[e,a,r,n]),K(()=>{if(!e||t)return;let n=Ar.request(()=>{i(void 0)});return()=>{Ar.cancel(n)}},[t,e]),K(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Ar.request(()=>{i(`idle`)});return()=>{Ar.cancel(n)}},[t,e,a,i,r]),u.useMemo(()=>({mounted:a,setMounted:o,transitionStatus:r}),[a,r])}let Ir=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({});var Lr={[Ir.startingStyle]:``},Rr={[Ir.endingStyle]:``};const zr={transitionStatus(e){return e===`starting`?Lr:e===`ending`?Rr:null}},Br=u.forwardRef(function(e,t){let{render:n,className:r,keepMounted:i=!1,...a}=e,o=lr(),s=o.checked||o.indeterminate,{transitionStatus:c,setMounted:l}=Fr(s),d=u.useRef(null),f=u.useMemo(()=>({...o,transitionStatus:c}),[o,c]);Pr({open:s,ref:d,onComplete(){s||l(!1)}});let p=ln(o),m=u.useMemo(()=>({...p,...zr,...cn}),[p]),h=i||s,g=W(`span`,e,{enabled:h,ref:[t,d],state:f,stateAttributesMapping:m,props:a});return h?g:null});process.env.NODE_ENV!==`production`&&(Br.displayName=`CheckboxIndicator`);const Vr=e=>{let t=(0,l.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,d.jsx)(Br,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};var Hr=new Map([[`bold`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),u.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),Ur=new Map([[`bold`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),u.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),Wr=new Map([[`bold`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z`}))],[`duotone`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),u.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`fill`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z`}))],[`regular`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`thin`,u.createElement(u.Fragment,null,u.createElement(`path`,{d:`M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z`}))]]),Gr=(0,u.createContext)({color:`currentColor`,size:`1em`,weight:`regular`,mirrored:!1}),Kr=u.forwardRef((e,t)=>{let{alt:n,color:r,size:i,weight:a,mirrored:o,children:s,weights:c,...l}=e,{color:d=`currentColor`,size:f,weight:p=`regular`,mirrored:m=!1,...h}=u.useContext(Gr);return u.createElement(`svg`,{ref:t,xmlns:`http://www.w3.org/2000/svg`,width:i??f,height:i??f,fill:r??d,viewBox:`0 0 256 256`,transform:o||m?`scale(-1, 1)`:void 0,...h,...l},!!n&&u.createElement(`title`,null,n),s,c.get(a??p))});Kr.displayName=`IconBase`;var qr=u.forwardRef((e,t)=>u.createElement(Kr,{ref:t,...e,weights:Hr}));qr.displayName=`CaretUpIcon`;var Jr=u.forwardRef((e,t)=>u.createElement(Kr,{ref:t,...e,weights:Ur}));Jr.displayName=`CheckIcon`;var Yr=u.forwardRef((e,t)=>u.createElement(Kr,{ref:t,...e,weights:Wr}));Yr.displayName=`XIcon`;const Xr=e=>{let t=(0,l.c)(23),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:n,ref:s,label:a,id:i,disabled:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c;t[7]===n?c=t[8]:(c=X(`flex size-md items-center text-on-accent justify-center rounded-sm bg-surface-dim inset-shadow-1-shadow data-checked:bg-accent data-checked:raised-1 hover:cursor-pointer transition-colors hover:disabled:cursor-not-allowed`,n),t[7]=n,t[8]=c);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,d.jsx)(Vr,{children:(0,d.jsx)(Jr,{weight:`bold`})}),t[9]=u):u=t[9];let f;t[10]!==r||t[11]!==i||t[12]!==o||t[13]!==s||t[14]!==c?(f=(0,d.jsx)(Cr,{id:i,disabled:r,className:c,ref:s,...o,children:u}),t[10]=r,t[11]=i,t[12]=o,t[13]=s,t[14]=c,t[15]=f):f=t[15];let p;t[16]!==r||t[17]!==i||t[18]!==a?(p=a&&(0,d.jsx)(`label`,{htmlFor:i,className:X(`body-base cursor-pointer`,r&&`text-text-neutral-primary-disabled cursor-not-allowed`),children:a}),t[16]=r,t[17]=i,t[18]=a,t[19]=p):p=t[19];let m;return t[20]!==f||t[21]!==p?(m=(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p]}),t[20]=f,t[21]=p,t[22]=m):m=t[22],m},Zr=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(Zr.displayName=`DialogRootContext`);function Qr(e){let t=u.useContext(Zr);if(e===!1&&t===void 0)throw Error(process.env.NODE_ENV===`production`?p(27):`Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.`);return t}let $r=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ir.startingStyle]=`startingStyle`,e[e.endingStyle=Ir.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e}({}),ei=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({});var ti={[ei.popupOpen]:``},ni={[ei.popupOpen]:``,[ei.pressed]:``},ri={[$r.open]:``},ii={[$r.closed]:``},ai={[$r.anchorHidden]:``};const oi={open(e){return e?ti:null}},si={open(e){return e?ri:ii},anchorHidden(e){return e?ai:null}};var ci={...si,...zr};const li=u.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...a}=e,{store:o}=Qr(),s=o.useState(`open`),c=o.useState(`nested`),l=o.useState(`mounted`),d=o.useState(`transitionStatus`);return W(`div`,e,{state:u.useMemo(()=>({open:s,transitionStatus:d}),[s,d]),ref:[o.context.backdropRef,t],stateAttributesMapping:ci,props:[{role:`presentation`,hidden:!l,style:{userSelect:`none`,WebkitUserSelect:`none`}},a],enabled:i||!c})});process.env.NODE_ENV!==`production`&&(li.displayName=`DialogBackdrop`);const ui=u.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,...o}=e,{store:s}=Qr(),c=s.useState(`open`);function l(e){c&&s.setOpen(!1,br(`close-press`,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=Jn({disabled:i,native:a});return W(`button`,e,{state:u.useMemo(()=>({disabled:i}),[i]),ref:[t,f],props:[{onClick:l},o,d]})});process.env.NODE_ENV!==`production`&&(ui.displayName=`DialogClose`);const di=u.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=Qr(),s=hn(i);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),W(`p`,e,{ref:t,props:[{id:s},a]})});process.env.NODE_ENV!==`production`&&(di.displayName=`DialogDescription`);var fi=typeof navigator<`u`,pi=wi(),mi=Ei(),hi=Ti();const gi=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),_i=pi.platform===`MacIntel`&&pi.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(pi.platform),vi=fi&&/firefox/i.test(hi),yi=fi&&/apple/i.test(navigator.vendor),bi=fi&&/Edg/i.test(hi),xi=fi&&/android/i.test(mi)||/android/i.test(hi),Si=fi&&mi.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,Ci=hi.includes(`jsdom/`);function wi(){if(!fi)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function Ti(){if(!fi)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Ei(){if(!fi)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}const Di=`data-base-ui-focusable`,Oi=`active`,ki=`selected`,Ai=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,ji=`ArrowLeft`,Mi=`ArrowRight`,Ni=`ArrowUp`,Pi=`ArrowDown`;function Fi(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Q(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Sn(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ii(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Li(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Ri(e){return e.matches(`html,body`)}function zi(e){return e?.ownerDocument||document}function Bi(e){return xn(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Vi(e){return e?e.getAttribute(`role`)===`combobox`&&Bi(e):!1}function Hi(e){if(!e||Ci)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Ui(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Wi(e,t,n=!0){return e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Wi(e,t.id,n)])}function Gi(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Ki(e){e.preventDefault(),e.stopPropagation()}function qi(e){return`nativeEvent`in e}function Ji(e){return e.mozInputSource===0&&e.isTrusted?!0:xi&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Yi(e){return Ci?!1:!xi&&e.width===0&&e.height===0||xi&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Xi(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Zi(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var Qi=[`top`,`right`,`bottom`,`left`],$i=Math.min,ea=Math.max,ta=Math.round,na=Math.floor,ra=e=>({x:e,y:e}),ia={left:`right`,right:`left`,bottom:`top`,top:`bottom`},aa={start:`end`,end:`start`};function oa(e,t,n){return ea(e,$i(t,n))}function sa(e,t){return typeof e==`function`?e(t):e}function ca(e){return e.split(`-`)[0]}function la(e){return e.split(`-`)[1]}function ua(e){return e===`x`?`y`:`x`}function da(e){return e===`y`?`height`:`width`}var fa=new Set([`top`,`bottom`]);function pa(e){return fa.has(ca(e))?`y`:`x`}function ma(e){return ua(pa(e))}function ha(e,t,n){n===void 0&&(n=!1);let r=la(e),i=ma(e),a=da(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=wa(o)),[o,wa(o)]}function ga(e){let t=wa(e);return[_a(e),t,_a(t)]}function _a(e){return e.replace(/start|end/g,e=>aa[e])}var va=[`left`,`right`],ya=[`right`,`left`],ba=[`top`,`bottom`],xa=[`bottom`,`top`];function Sa(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ya:va:t?va:ya;case`left`:case`right`:return t?ba:xa;default:return[]}}function Ca(e,t,n,r){let i=la(e),a=Sa(ca(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_a)))),a}function wa(e){return e.replace(/left|right|bottom|top/g,e=>ia[e])}function Ta(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ea(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ta(e)}function Da(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Oa(e,t,n){return Math.floor(e/t)!==n}function ka(e,t){return t<0||t>=e.current.length}function Aa(e,t){return Ma(e,{disabledIndices:t})}function ja(e,t){return Ma(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ma(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.current.length-1&&La(e,a,r));return a}function Na(e,{event:t,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}){let d=l,f=[],p={},m=!1;{let t=null,n=-1;e.current.forEach((e,r)=>{if(e==null)return;let i=e.closest(`[role="row"]`);i&&(m=!0),(i!==t||n===-1)&&(t=i,n+=1,f[n]=[]),f[n].push(r),p[r]=n})}let h=m&&f.length>0&&f.some(e=>e.length!==a);function g(t){if(!h||l===-1)return;let n=p[l];if(n==null)return;let i=f[n].indexOf(l),a=t===`up`?n-1:n+1;r&&(a<0?a=f.length-1:a>=f.length&&(a=0));let s=new Set;for(;a>=0&&a<f.length&&!s.has(a);){s.add(a);let n=f[a];if(n.length===0){a=t===`up`?a-1:a+1;continue}let c=Math.min(i,n.length-1);for(let t=c;t>=0;--t){let r=n[t];if(!La(e,r,o))return r}a=t===`up`?a-1:a+1,r&&(a<0?a=f.length-1:a>=f.length&&(a=0))}}if(t.key===`ArrowUp`){let n=g(`up`);if(n!==void 0)u&&Ki(t),d=n;else{if(u&&Ki(t),l===-1)d=c;else if(d=Ma(e,{startingIndex:d,amount:a,decrement:!0,disabledIndices:o}),r&&(l-a<s||d<0)){let e=l%a,t=c%a,n=c-(t-e);d=t===e?c:t>e?n:n-a}ka(e,d)&&(d=l)}}if(t.key===`ArrowDown`){let n=g(`down`);n===void 0?(u&&Ki(t),l===-1?d=s:(d=Ma(e,{startingIndex:l,amount:a,disabledIndices:o}),r&&l+a>c&&(d=Ma(e,{startingIndex:l%a-a,amount:a,disabledIndices:o}))),ka(e,d)&&(d=l)):(u&&Ki(t),d=n)}if(n===`both`){let n=na(l/a);t.key===(i?`ArrowLeft`:`ArrowRight`)&&(u&&Ki(t),l%a===a-1?r&&(d=Ma(e,{startingIndex:l-l%a-1,disabledIndices:o})):(d=Ma(e,{startingIndex:l,disabledIndices:o}),r&&Oa(d,a,n)&&(d=Ma(e,{startingIndex:l-l%a-1,disabledIndices:o}))),Oa(d,a,n)&&(d=l)),t.key===(i?`ArrowRight`:`ArrowLeft`)&&(u&&Ki(t),l%a===0?r&&(d=Ma(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o})):(d=Ma(e,{startingIndex:l,decrement:!0,disabledIndices:o}),r&&Oa(d,a,n)&&(d=Ma(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o}))),Oa(d,a,n)&&(d=l));let s=na(c/a)===n;ka(e,d)&&(d=r&&s?t.key===(i?`ArrowRight`:`ArrowLeft`)?c:Ma(e,{startingIndex:l-l%a-1,disabledIndices:o}):l)}return d}function Pa(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{if(e>t&&process.env.NODE_ENV!==`production`)throw Error(process.env.NODE_ENV===`production`?p(29,o):`[Floating UI]: Invalid grid - item width at index ${o} is greater than grid columns`);let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function Fa(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function Ia(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function La(e,t,n){if(typeof n==`function`)return n(t);if(n)return n.includes(t);let r=e.current[t];return r?r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`:!1}var Ra=[`input:not([inert])`,`select:not([inert])`,`textarea:not([inert])`,`a[href]:not([inert])`,`button:not([inert])`,`[tabindex]:not(slot):not([inert])`,`audio[controls]:not([inert])`,`video[controls]:not([inert])`,`[contenteditable]:not([contenteditable="false"]):not([inert])`,`details>summary:first-of-type:not([inert])`,`details:not([inert])`],za=Ra.join(`,`),Ba=typeof Element>`u`,Va=Ba?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ha=!Ba&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},Ua=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&Ua(e.parentNode)},Wa=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},Ga=function(e,t,n){if(Ua(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(za));return t&&Va.call(e,za)&&r.unshift(e),r=r.filter(n),r},Ka=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!Ua(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=Ka(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{Va.call(a,za)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!Ua(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=Ka(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},qa=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},Ja=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Wa(e))&&!qa(e)?0:e.tabIndex},Ya=function(e,t){var n=Ja(e);return n<0&&t&&!qa(e)?0:n},Xa=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Za=function(e){return e.tagName===`INPUT`},Qa=function(e){return Za(e)&&e.type===`hidden`},$a=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},eo=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},to=function(e){if(!e.name)return!0;var t=e.form||Ha(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=eo(r,e.form);return!i||i===e},no=function(e){return Za(e)&&e.type===`radio`},ro=function(e){return no(e)&&!to(e)},io=function(e){var t=e&&Ha(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=Ha(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},ao=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},oo=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=Va.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(Va.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=Ha(e);if(o&&!o.shadowRoot&&r(o)===!0)return ao(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(io(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return ao(e);return!1},so=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return Va.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},co=function(e,t){return!(t.disabled||Ua(t)||Qa(t)||oo(t,e)||$a(t)||so(t))},lo=function(e,t){return!(ro(t)||Ja(t)<0||!co(e,t))},uo=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},fo=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=Ya(a,i),s=i?fo(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(Xa).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},po=function(e,t){return t||={},fo(t.getShadowRoot?Ka([e],t.includeContainer,{filter:lo.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:uo}):Ga(e,t.includeContainer,lo.bind(null,t)))},mo=function(e,t){return t||={},t.getShadowRoot?Ka([e],t.includeContainer,{filter:co.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Ga(e,t.includeContainer,co.bind(null,t))},ho=function(e,t){if(t||={},!e)throw Error(`No node provided`);return Va.call(e,za)===!1?!1:lo(t,e)};const go=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function _o(e,t){let n=po(e,go()),r=n.length;if(r===0)return;let i=Fi(zi(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function vo(e){return _o(zi(e).body,1)||e}function yo(e){return _o(zi(e).body,-1)||e}function bo(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Q(n,r)}function xo(e){po(e,go()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function So(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Co(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var wo=u.createContext(null);process.env.NODE_ENV!==`production`&&(wo.displayName=`FloatingNodeContext`);var To=u.createContext(null);process.env.NODE_ENV!==`production`&&(To.displayName=`FloatingTreeContext`);const Eo=()=>u.useContext(wo)?.id||null,Do=e=>{let t=u.useContext(To);return e??t};function Oo(e){return`data-base-ui-${e}`}var ko=Oo(`safe-polygon`),Ao=`button,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ai}`;function jo(e,t,n){if(n&&!Xi(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}var Mo=u.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new xe,currentIdRef:{current:null},currentContextRef:{current:null}});process.env.NODE_ENV!==`production`&&(Mo.displayName=`FloatingDelayGroupContext`);function No(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=u.useRef(n),a=u.useRef(n),o=u.useRef(null),s=u.useRef(null),c=Se();return(0,d.jsx)(Mo.Provider,{value:u.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Po(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{enabled:i=!0,open:a}=t,{currentIdRef:o,delayRef:s,timeoutMs:c,initialDelayRef:l,currentContextRef:d,hasProvider:f,timeout:p}=u.useContext(Mo),[m,h]=u.useState(!1);return K(()=>{function e(){h(!1),d.current?.setIsInstantPhase(!1),o.current=null,d.current=null,s.current=l.current}if(i&&o.current&&!a&&o.current===r){if(h(!1),c){let t=r;return p.start(c,()=>{n.select(`open`)||o.current&&o.current!==t||e()}),()=>{p.clear()}}e()}},[i,a,r,o,s,c,l,d,p,n]),K(()=>{if(!i||!a)return;let e=d.current,t=o.current;p.clear(),d.current={onOpenChange:n.setOpen,setIsInstantPhase:h},o.current=r,s.current={open:0,close:jo(l.current,`close`)},t!==null&&t!==r?(h(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,br(ur))):(h(!1),e?.setIsInstantPhase(!1))},[i,a,r,n,o,s,c,l,d,p]),K(()=>()=>{d.current=null},[d]),u.useMemo(()=>({hasProvider:f,delayRef:s,isInstantPhase:m}),[f,s,m])}function Fo(e){return e?.ownerDocument||document}const Io=u.forwardRef(function(e,t){let[n,r]=u.useState();K(()=>{yi&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,d.jsx)(`span`,{...e,ref:t,style:rn,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});process.env.NODE_ENV!==`production`&&(Io.displayName=`FocusGuard`);var Lo=0;function Ro(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Lo);let a=()=>e?.focus({preventScroll:n});i?a():Lo=requestAnimationFrame(a)}var zo={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Bo(e){return e===`inert`?zo.inert:e===`aria-hidden`?zo[`aria-hidden`]:zo.none}var Vo=new WeakSet,Ho={},Uo=0,Wo=e=>e&&(e.host||Wo(e.parentNode)),Go=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Wo(t);return e.contains(n)?n:null}).filter(e=>e!=null);function Ko(e,t,n,r){let i=`data-base-ui-inert`,a=r?`inert`:n?`aria-hidden`:null,o=Go(t,e),s=new Set,c=new Set(o),l=[];Ho[i]||(Ho[i]=new WeakMap);let u=Ho[i];o.forEach(d),f(t),s.clear();function d(e){!e||s.has(e)||(s.add(e),e.parentNode&&d(e.parentNode))}function f(e){!e||c.has(e)||[].forEach.call(e.children,e=>{if(_n(e)!==`script`)if(s.has(e))f(e);else{let t=a?e.getAttribute(a):null,n=t!==null&&t!==`false`,r=Bo(a),o=(r.get(e)||0)+1,s=(u.get(e)||0)+1;r.set(e,o),u.set(e,s),l.push(e),o===1&&n&&Vo.add(e),s===1&&e.setAttribute(i,``),!n&&a&&e.setAttribute(a,a===`inert`?``:`true`)}})}return Uo+=1,()=>{l.forEach(e=>{let t=Bo(a),n=(t.get(e)||0)-1,r=(u.get(e)||0)-1;t.set(e,n),u.set(e,r),n||(!Vo.has(e)&&a&&e.removeAttribute(a),Vo.delete(e)),r||e.removeAttribute(i)}),--Uo,Uo||(zo.inert=new WeakMap,zo[`aria-hidden`]=new WeakMap,zo.none=new WeakMap,Vo=new WeakSet,Ho={})}}function qo(e,t=!1,n=!1){let r=zi(e[0]).body;return Ko(e.concat(Array.from(r.querySelectorAll(`[aria-live]`))),r,t,n)}var Jo=u.createContext(null);process.env.NODE_ENV!==`production`&&(Jo.displayName=`PortalContext`);const Yo=()=>u.useContext(Jo);var Xo=Oo(`portal`);function Zo(e={}){let{ref:t,container:n,componentProps:r=V,elementProps:i,elementState:a}=e,o=mn(),s=Yo()?.portalNode,[c,l]=u.useState(null),[d,p]=u.useState(null),m=u.useRef(null);K(()=>{if(n===null){m.current&&(m.current=null,p(null),l(null));return}if(o==null)return;let e=(n&&(bn(n)?n:n.current))??s??document.body;if(e==null){m.current&&(m.current=null,p(null),l(null));return}m.current!==e&&(m.current=e,p(null),l(e))},[n,s,o]);let h=W(`div`,r,{ref:[t,p],state:a,props:[{id:o,[Xo]:``},i]});return{portalNode:d,portalSubtree:c&&h?f.createPortal(h,c):null}}const Qo=u.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,...s}=e,{portalNode:c,portalSubtree:l}=Zo({container:r,ref:t,componentProps:e,elementProps:s}),p=u.useRef(null),m=u.useRef(null),h=u.useRef(null),g=u.useRef(null),[_,v]=u.useState(null),y=_?.modal,b=_?.open,x=typeof o==`boolean`?o:!!_&&!_.modal&&_.open&&!!c;u.useEffect(()=>{if(!c||y)return;function e(e){c&&bo(e)&&(e.type===`focusin`?So:xo)(c)}return c.addEventListener(`focusin`,e,!0),c.addEventListener(`focusout`,e,!0),()=>{c.removeEventListener(`focusin`,e,!0),c.removeEventListener(`focusout`,e,!0)}},[c,y]),u.useEffect(()=>{!c||b||So(c)},[b,c]);let S=u.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:m,beforeInsideRef:h,afterInsideRef:g,portalNode:c,setFocusManagerState:v}),[c]);return(0,d.jsxs)(u.Fragment,{children:[l,(0,d.jsxs)(Jo.Provider,{value:S,children:[x&&c&&(0,d.jsx)(Io,{"data-type":`outside`,ref:p,onFocus:e=>{bo(e,c)?h.current?.focus():yo(_?_.domReference:null)?.focus()}}),x&&c&&(0,d.jsx)(`span`,{"aria-owns":c.id,style:U}),c&&f.createPortal(n,c),x&&c&&(0,d.jsx)(Io,{"data-type":`outside`,ref:m,onFocus:e=>{bo(e,c)?g.current?.focus():(vo(_?_.domReference:null)?.focus(),_?.closeOnFocusOut&&_?.onOpenChange(!1,br(`focus-out`,e.nativeEvent)))}})]})]})});process.env.NODE_ENV!==`production`&&(Qo.displayName=`FloatingPortal`);function $o(e,t){let n=vn(e.target);return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var es=20,ts=[];function ns(){ts=ts.filter(e=>e.isConnected)}function rs(e){ns(),e&&_n(e)!==`body`&&(ts.push(e),ts.length>es&&(ts=ts.slice(-es)))}function is(){return ns(),ts[ts.length-1]}function as(e){if(!e)return null;let t=go();return ho(e,t)?e:po(e,t)[0]||e}function os(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():Ln(e).display!==`none`}function ss(e,t){if(!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=go(),r=mo(e,n).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return ho(e,n)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),i=e.getAttribute(`tabindex`);t.current.includes(`floating`)||r.length===0?i!==`0`&&e.setAttribute(`tabindex`,`0`):(i!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function cs(e){let{context:t,children:n,disabled:r=!1,order:i=[`content`],initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:f=``,getInsideElements:p=()=>[],nextFocusableElement:m,previousFocusableElement:h,beforeContentFocusGuardRef:_,externalTree:v}=e,y=`rootStore`in t?t.rootStore:t,b=y.useState(`open`),x=y.useState(`domReferenceElement`),S=y.useState(`floatingElement`),{events:C,dataRef:w}=y.context,T=G(()=>w.current.floatingContext?.nodeId),E=G(p),D=a===!1,O=Vi(x)&&D,k=wr(i),A=wr(a),j=wr(o),M=wr(f),N=Do(v),P=Yo(),F=u.useRef(null),ee=u.useRef(null),I=u.useRef(!1),L=u.useRef(!1),R=u.useRef(!1),z=u.useRef(-1),B=u.useRef(``),te=u.useRef(``),V=Se(),ne=Se(),H=jr(),re=P!=null,U=Ui(S),W=G((e=U)=>e?po(e,go()):[]),ie=G(e=>{let t=W(e);return k.current.map(()=>t).filter(Boolean).flat()});u.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Q(U,Fi(zi(U)))&&W().length===0&&!O&&Ki(e)}let t=zi(U);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[r,x,U,c,k,O,W,ie]),u.useEffect(()=>{if(r||!S)return;function e(e){let t=Ii(e),n=W().indexOf(t);n!==-1&&(z.current=n)}return S.addEventListener(`focusin`,e),()=>{S.removeEventListener(`focusin`,e)}},[r,S,W]),u.useEffect(()=>{if(r||!b)return;let e=zi(U);function t(){R.current=!1}function n(e){let t=Ii(e);R.current=!(Q(S,t)||Q(x,t)||Q(P?.portalNode,t)),te.current=e.pointerType||`keyboard`}function i(){te.current=`keyboard`}return e.addEventListener(`pointerdown`,n,!0),e.addEventListener(`pointerup`,t,!0),e.addEventListener(`pointercancel`,t,!0),e.addEventListener(`keydown`,i,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),e.removeEventListener(`pointerup`,t,!0),e.removeEventListener(`pointercancel`,t,!0),e.removeEventListener(`keydown`,i,!0)}},[r,S,x,U,b,P]),u.useEffect(()=>{if(r||!l)return;function e(){L.current=!0,ne.start(0,()=>{L.current=!1})}function t(e){let t=e.relatedTarget,n=e.currentTarget,r=Ii(e);queueMicrotask(()=>{let i=T(),a=y.context.triggerElements,o=!(Q(x,t)||Q(S,t)||Q(t,S)||Q(P?.portalNode,t)||t!=null&&a.hasElement(t)||a.hasMatchingElement(e=>Q(e,t))||t?.hasAttribute(Oo(`focus-guard`))||N&&(Wi(N.nodesRef.current,i).find(e=>Q(e.context?.elements.floating,t)||Q(e.context?.elements.domReference,t))||Gi(N.nodesRef.current,i).find(e=>[e.context?.elements.floating,Ui(e.context?.elements.floating)].includes(t)||e.context?.elements.domReference===t)));if(n===x&&U&&ss(U,k),s&&n!==x&&!os(r)&&Fi(zi(U))===zi(U).body){if(xn(U)&&(U.focus(),s===`popup`)){H.request(()=>{U.focus()});return}let e=z.current,t=W(),n=t[e]||t[t.length-1]||U;xn(n)&&n.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(O||!c)&&t&&o&&!L.current&&(O||t!==is())&&(I.current=!0,y.setOpen(!1,br(`focus-out`,e)))})}function n(){R.current||(w.current.insideReactTree=!0,V.start(0,()=>{w.current.insideReactTree=!1}))}let i=xn(x)?x:null,a=[];if(!(!S&&!i))return i&&(i.addEventListener(`focusout`,t),i.addEventListener(`pointerdown`,e),a.push(()=>{i.removeEventListener(`focusout`,t),i.removeEventListener(`pointerdown`,e)})),S&&(S.addEventListener(`focusout`,t),P&&(S.addEventListener(`focusout`,n,!0),a.push(()=>{S.removeEventListener(`focusout`,n,!0)})),a.push(()=>{S.removeEventListener(`focusout`,t)})),()=>{a.forEach(e=>{e()})}},[r,x,S,U,c,N,P,y,l,s,W,O,T,k,w,V,ne,H]);let ae=u.useRef(null),oe=u.useRef(null),se=g(ae,_,P?.beforeInsideRef),ce=g(oe,P?.afterInsideRef);u.useEffect(()=>{if(r||!S||!b)return;let e=Array.from(P?.portalNode?.querySelectorAll(`[${Oo(`portal`)}]`)||[]),t=qo([S,(N?Gi(N.nodesRef.current,T()):[]).find(e=>Vi(e.context?.elements.domReference||null))?.context?.elements.domReference,...e,...E(),F.current,ee.current,ae.current,oe.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Mr(h),Mr(m),O?x:null].filter(e=>e!=null),c||O);return()=>{t()}},[b,r,x,S,c,k,P,O,N,T,E,m,h]),K(()=>{if(!b||r||!xn(U))return;let e=Fi(zi(U));queueMicrotask(()=>{let t=ie(U),n=A.current,r=typeof n==`function`?n(M.current||``):n;if(r===void 0||r===!1)return;let i;i=r===!0||r===null?t[0]||U:Mr(r),i=i||t[0]||U,!Q(U,e)&&Ro(i,{preventScroll:i===U})})},[r,b,U,D,ie,A,M]),K(()=>{if(r||!U)return;let e=zi(U);rs(Fi(e));function t(e){if(e.open||(B.current=$o(e.nativeEvent,te.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(I.current=!0),e.reason===`outside-press`)if(e.nested)I.current=!1;else if(Ji(e.nativeEvent)||Yi(e.nativeEvent))I.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?I.current=!1:I.current=!0}}C.on(`openchange`,t);let n=e.createElement(`span`);n.setAttribute(`tabindex`,`-1`),n.setAttribute(`aria-hidden`,`true`),Object.assign(n.style,rn),re&&x&&x.insertAdjacentElement(`afterend`,n);function i(){let e=j.current,t=typeof e==`function`?e(B.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=x||is();return e&&e.isConnected?e:n}let r=x||is()||n;return Mr(t)||r}return()=>{C.off(`openchange`,t);let r=Fi(e),a=Q(S,r)||N&&Wi(N.nodesRef.current,T(),!1).some(e=>Q(e.context?.elements.floating,r)),o=i();queueMicrotask(()=>{let t=as(o),i=typeof j.current!=`boolean`;j.current&&!I.current&&xn(t)&&(!(!i&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),n.remove()})}},[r,S,U,j,w,C,N,re,x,T]),u.useEffect(()=>{queueMicrotask(()=>{I.current=!1})},[r]),u.useEffect(()=>{if(r||!b)return;function e(e){Ii(e)?.closest(`[data-base-ui-click-trigger]`)&&(L.current=!0)}let t=zi(U);return t.addEventListener(`pointerdown`,e,!0),()=>{t.removeEventListener(`pointerdown`,e,!0)}},[r,b,U]),K(()=>{if(!r&&P)return P.setFocusManagerState({modal:c,closeOnFocusOut:l,open:b,onOpenChange:y.setOpen,domReference:x}),()=>{P.setFocusManagerState(null)}},[r,P,c,b,y,l,x]),K(()=>{if(!(r||!U))return ss(U,k),()=>{queueMicrotask(ns)}},[r,U,k]);let le=!r&&(c?!O:!0)&&(re||c);return(0,d.jsxs)(u.Fragment,{children:[le&&(0,d.jsx)(Io,{"data-type":`inside`,ref:se,onFocus:e=>{if(c){let e=ie();Ro(e[e.length-1])}else P?.portalNode&&(I.current=!1,bo(e,P.portalNode)?vo(x)?.focus():Mr(h??P.beforeOutsideRef)?.focus())}}),n,le&&(0,d.jsx)(Io,{"data-type":`inside`,ref:ce,onFocus:e=>{c?Ro(ie()[0]):P?.portalNode&&(l&&(I.current=!0),bo(e,P.portalNode)?yo(x)?.focus():Mr(m??P.afterOutsideRef)?.focus())}})]})}function ls(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0}=t,d=u.useRef(void 0),f=jr(),p=Se(),m=u.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,u=n.select(`open`);if(e.button!==0||a===`click`||Xi(t,!0)&&s)return;let m=r.current.openEvent,h=m?.type,g=n.select(`domReferenceElement`)!==e.currentTarget,_=u&&g||!(u&&o&&(!(m&&c)||h===`click`||h===`mousedown`));if(Bi(i.target)){let e=br(dr,i,i.target);_&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e);return}let v=e.currentTarget;f.request(()=>{let e=br(dr,i,v);_&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(Xi(t,!0)&&s)return;let i=n.select(`open`),u=r.current.openEvent,f=n.select(`domReferenceElement`)!==e.currentTarget,m=i&&f||!(i&&o&&(!(u&&c)||Zi(u))),h=br(dr,e.nativeEvent,e.currentTarget);m&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,h)}):n.setOpen(m,h)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l]);return u.useMemo(()=>i?{reference:m}:V,[i,m])}function us(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function ds(e){return e!=null&&e.clientX!=null}function fs(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`,x:l=null,y:d=null}=t,f=u.useRef(!1),p=u.useRef(null),[m,h]=u.useState(),[g,_]=u.useState([]),v=G((e,t)=>{f.current||o.current.openEvent&&!ds(o.current.openEvent)||n.set(`positionReference`,us(a,{x:e,y:t,axis:c,dataRef:o,pointerType:m}))}),y=G(e=>{l!=null||d!=null||(r?p.current||_([]):v(e.clientX,e.clientY))}),b=Xi(m)?i:r,x=u.useCallback(()=>{if(!b||!s||l!=null||d!=null)return;let e=vn(i);function t(n){Q(i,Ii(n))?(e.removeEventListener(`mousemove`,t),p.current=null):v(n.clientX,n.clientY)}if(!o.current.openEvent||ds(o.current.openEvent)){e.addEventListener(`mousemove`,t);let n=()=>{e.removeEventListener(`mousemove`,t),p.current=null};return p.current=n,n}n.set(`positionReference`,a)},[b,s,l,d,i,o,a,n,v]);u.useEffect(()=>x(),[x,g]),u.useEffect(()=>{s&&!i&&(f.current=!1)},[s,i]),u.useEffect(()=>{!s&&r&&(f.current=!0)},[s,r]),K(()=>{s&&(l!=null||d!=null)&&(f.current=!1,v(l,d))},[s,l,d,v]);let S=u.useMemo(()=>{function e(e){h(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}},[y]);return u.useMemo(()=>s?{reference:S}:{},[s,S])}function ps(e,t,n){let{reference:r,floating:i}=e,a=pa(t),o=ma(t),s=da(o),c=ca(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(la(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}var ms=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ps(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ps(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function hs(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=sa(t,e),p=Ea(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Da(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Da(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var gs=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=sa(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ca(r),_=pa(o),v=ca(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[wa(o)]:ga(o)),x=p!==`none`;!d&&x&&b.push(...Ca(o,m,p,y));let S=[o,...b],C=await hs(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ha(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==pa(t))||T.every(e=>pa(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=pa(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function _s(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vs(e){return Qi.some(t=>e[t]>=0)}var ys=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n}=t,{strategy:r=`referenceHidden`,...i}=sa(e,t);switch(r){case`referenceHidden`:{let e=_s(await hs(t,{...i,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:vs(e)}}}case`escaped`:{let e=_s(await hs(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:vs(e)}}}default:return{}}}}},bs=new Set([`left`,`top`]);async function xs(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ca(n),s=la(n),c=pa(n)===`y`,l=bs.has(o)?-1:1,u=a&&c?-1:1,d=sa(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ss=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await xs(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Cs=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=sa(e,t),l={x:n,y:r},u=await hs(t,c),d=pa(ca(i)),f=ua(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=oa(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=oa(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}},ws=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=sa(e,t),u={x:n,y:r},d=pa(i),f=ua(d),p=u[f],m=u[d],h=sa(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=bs.has(ca(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ts=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=sa(e,t),u=await hs(t,l),d=ca(i),f=la(i),p=pa(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=$i(h-u[g],v),x=$i(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=ea(u.left,0),t=ea(u.right,0),n=ea(u.top,0),r=ea(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ea(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ea(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Es(e){let t=Ln(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=xn(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ta(n)!==a||ta(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ds(e){return Z(e)?e:e.contextElement}function Os(e){let t=Ds(e);if(!xn(t))return ra(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Es(t),o=(a?ta(n.width):n.width)/r,s=(a?ta(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ks=ra(0);function As(e){let t=vn(e);return!Pn()||!t.visualViewport?ks:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function js(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vn(e)?!1:t}function Ms(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ds(e),o=ra(1);t&&(r?Z(r)&&(o=Os(r)):o=Os(e));let s=js(a,n,r)?As(a):ra(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=vn(a),t=r&&Z(r)?vn(r):r,n=e,i=Hn(n);for(;i&&r&&t!==n;){let e=Os(i),t=i.getBoundingClientRect(),r=Ln(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=vn(i),i=Hn(n)}}return Da({width:u,height:d,x:c,y:l})}function Ns(e,t){let n=Rn(e).scrollLeft;return t?t.left+n:Ms(yn(e)).left+n}function Ps(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ns(e,n),y:n.top+t.scrollTop}}function Fs(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=yn(r),s=t?On(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ra(1),u=ra(0),d=xn(r);if((d||!d&&!a)&&((_n(r)!==`body`||wn(o))&&(c=Rn(r)),xn(r))){let e=Ms(r);l=Os(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ps(o,c):ra(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Is(e){return Array.from(e.getClientRects())}function Ls(e){let t=yn(e),n=Rn(e),r=e.ownerDocument.body,i=ea(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ea(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ns(e),s=-n.scrollTop;return Ln(r).direction===`rtl`&&(o+=ea(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Rs=25;function zs(e,t){let n=vn(e),r=yn(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Pn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ns(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Rs&&(a-=o)}else l<=Rs&&(a+=l);return{width:a,height:o,x:s,y:c}}var Bs=new Set([`absolute`,`fixed`]);function Vs(e,t){let n=Ms(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=xn(e)?Os(e):ra(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Hs(e,t,n){let r;if(t===`viewport`)r=zs(e,n);else if(t===`document`)r=Ls(yn(e));else if(Z(t))r=Vs(t,n);else{let n=As(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Da(r)}function Us(e,t){let n=zn(e);return n===t||!Z(n)||In(n)?!1:Ln(n).position===`fixed`||Us(n,t)}function Ws(e,t){let n=t.get(e);if(n)return n;let r=Vn(e,[],!1).filter(e=>Z(e)&&_n(e)!==`body`),i=null,a=Ln(e).position===`fixed`,o=a?zn(e):e;for(;Z(o)&&!In(o);){let t=Ln(o),n=Mn(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Bs.has(i.position)||wn(o)&&!n&&Us(e,o))?r=r.filter(e=>e!==o):i=t,o=zn(o)}return t.set(e,r),r}function Gs(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?On(t)?[]:Ws(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Hs(t,n,i);return e.top=ea(r.top,e.top),e.right=$i(r.right,e.right),e.bottom=$i(r.bottom,e.bottom),e.left=ea(r.left,e.left),e},Hs(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Ks(e){let{width:t,height:n}=Es(e);return{width:t,height:n}}function qs(e,t,n){let r=xn(t),i=yn(t),a=n===`fixed`,o=Ms(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ra(0);function l(){c.x=Ns(i)}if(r||!r&&!a)if((_n(t)!==`body`||wn(i))&&(s=Rn(t)),r){let e=Ms(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ps(i,s):ra(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Js(e){return Ln(e).position===`static`}function Ys(e,t){if(!xn(e)||Ln(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return yn(e)===n&&(n=n.ownerDocument.body),n}function Xs(e,t){let n=vn(e);if(On(e))return n;if(!xn(e)){let t=zn(e);for(;t&&!In(t);){if(Z(t)&&!Js(t))return t;t=zn(t)}return n}let r=Ys(e,t);for(;r&&En(r)&&Js(r);)r=Ys(r,t);return r&&In(r)&&Js(r)&&!Mn(r)?n:r||Nn(e)||n}var Zs=async function(e){let t=this.getOffsetParent||Xs,n=this.getDimensions,r=await n(e.floating);return{reference:qs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qs(e){return Ln(e).direction===`rtl`}var $s={convertOffsetParentRelativeRectToViewportRelativeRect:Fs,getDocumentElement:yn,getClippingRect:Gs,getOffsetParent:Xs,getElementRects:Zs,getClientRects:Is,getDimensions:Ks,getScale:Os,isElement:Z,isRTL:Qs};function ec(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tc(e,t){let n=null,r,i=yn(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=na(d),h=na(i.clientWidth-(u+f)),g=na(i.clientHeight-(d+p)),_=na(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ea(0,$i(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ec(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function nc(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ds(e),u=i||a?[...l?Vn(l):[],...Vn(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?tc(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Ms(e):null;c&&g();function g(){let t=Ms(e);h&&!ec(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var rc=Ss,ic=Cs,ac=gs,oc=Ts,sc=ys,cc=ws,lc=(e,t,n)=>{let r=new Map,i={platform:$s,...n},a={...i.platform,_c:r};return ms(e,t,{...i,platform:a})},uc=typeof document<`u`?u.useLayoutEffect:function(){};function dc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!dc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function fc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pc(e,t){let n=fc(e);return Math.round(t*n)/n}function mc(e){let t=u.useRef(e);return uc(()=>{t.current=e}),t}function hc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[d,p]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=u.useState(r);dc(m,r)||h(r);let[g,_]=u.useState(null),[v,y]=u.useState(null),b=u.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=u.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=u.useRef(null),T=u.useRef(null),E=u.useRef(d),D=c!=null,O=mc(c),k=mc(i),A=mc(l),j=u.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};k.current&&(e.platform=k.current),lc(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!dc(E.current,t)&&(E.current=t,f.flushSync(()=>{p(t)}))})},[m,t,n,k,A]);uc(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[l]);let M=u.useRef(!1);uc(()=>(M.current=!0,()=>{M.current=!1}),[]),uc(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=u.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=u.useMemo(()=>({reference:S,floating:C}),[S,C]),F=u.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=pc(P.floating,d.x),r=pc(P.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...fc(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,d.x,d.y]);return u.useMemo(()=>({...d,update:j,refs:N,elements:P,floatingStyles:F}),[d,j,N,P,F])}var gc=(e,t)=>({...rc(e),options:[e,t]}),_c=(e,t)=>({...ic(e),options:[e,t]}),vc=(e,t)=>({...cc(e),options:[e,t]}),yc=(e,t)=>({...ac(e),options:[e,t]}),bc=(e,t)=>({...oc(e),options:[e,t]}),xc=(e,t)=>({...sc(e),options:[e,t]}),Sc={intentional:`onClick`,sloppy:`onPointerDown`};function Cc(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function wc(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`referenceElement`),o=n.useState(`domReferenceElement`),{onOpenChange:s,dataRef:c}=n.context,{enabled:l=!0,escapeKey:d=!0,outsidePress:f=!0,outsidePressEvent:p=`sloppy`,referencePress:m=!1,referencePressEvent:h=`sloppy`,ancestorScroll:g=!1,bubbles:_,externalTree:v}=t,y=Do(v),b=G(typeof f==`function`?f:()=>!1),x=typeof f==`function`?b:f,S=u.useRef(!1),{escapeKey:C,outsidePress:w}=Cc(_),T=u.useRef(null),E=Se(),D=Se(),O=G(()=>{D.clear(),c.current.insideReactTree=!1}),k=u.useRef(!1),A=u.useRef(``),j=G(e=>{A.current=e.pointerType}),M=G(()=>{let e=A.current,t=e===`pen`||!e?`mouse`:e,n=typeof p==`function`?p():p;return typeof n==`string`?n:n[t]}),N=G(e=>{if(!r||!l||!d||e.key!==`Escape`||k.current)return;let t=c.current.floatingContext?.nodeId,i=y?Wi(y.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let a=br(`escape-key`,qi(e)?e.nativeEvent:e);n.setOpen(!1,a),!C&&!a.isPropagationAllowed&&e.stopPropagation()}),P=G(e=>{let t=M();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}),F=G(()=>{c.current.insideReactTree=!0,D.start(0,O)}),ee=G((e,t=!1)=>{if(P(e)){O();return}if(c.current.insideReactTree){O();return}if(M()===`intentional`&&t||typeof x==`function`&&!x(e))return;let r=Ii(e),i=`[${Oo(`inert`)}]`,a=zi(n.select(`floatingElement`)).querySelectorAll(i),o=n.context.triggerElements;if(r&&(o.hasElement(r)||o.hasMatchingElement(e=>Q(e,r))))return;let s=Z(r)?r:null;for(;s&&!In(s);){let e=zn(s);if(In(e)||!Z(e))break;s=e}if(a.length&&Z(r)&&!Ri(r)&&!Q(r,n.select(`floatingElement`))&&Array.from(a).every(e=>!Q(s,e)))return;if(xn(r)&&!(`touches`in e)){let t=In(r),n=Ln(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}let l=c.current.floatingContext?.nodeId,u=y&&Wi(y.nodesRef.current,l).some(t=>Li(e,t.context?.elements.floating));if(Li(e,n.select(`floatingElement`))||Li(e,n.select(`domReferenceElement`))||u)return;let d=y?Wi(y.nodesRef.current,l):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,br(`outside-press`,e)),O()}),I=G(e=>{M()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!l||Li(e,n.select(`floatingElement`))||Li(e,n.select(`domReferenceElement`))||ee(e)}),L=G(e=>{if(M()!==`sloppy`||!n.select(`open`)||!l||Li(e,n.select(`floatingElement`))||Li(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}),R=G(e=>{let t=Ii(e);function n(){L(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),z=G(e=>{let t=S.current;if(S.current=!1,E.clear(),e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)return;let n=Ii(e);function r(){e.type===`pointerdown`?I(e):ee(e,t),n?.removeEventListener(e.type,r)}n?.addEventListener(e.type,r)}),B=G(e=>{if(M()!==`sloppy`||!T.current||Li(e,n.select(`floatingElement`))||Li(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(ee(e),E.clear(),T.current=null)}),te=G(e=>{let t=Ii(e);function n(){B(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),V=G(e=>{M()!==`sloppy`||!T.current||Li(e,n.select(`floatingElement`))||Li(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&ee(e),E.clear(),T.current=null)}),ne=G(e=>{let t=Ii(e);function n(){V(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)});u.useEffect(()=>{if(!r||!l)return;c.current.__escapeKeyBubbles=C,c.current.__outsidePressBubbles=w;let e=new xe;function t(e){n.setOpen(!1,br(ur,e))}function s(){e.clear(),k.current=!0}function u(){e.start(Pn()?5:0,()=>{k.current=!1})}let f=zi(i);f.addEventListener(`pointerdown`,j,!0),d&&(f.addEventListener(`keydown`,N),f.addEventListener(`compositionstart`,s),f.addEventListener(`compositionend`,u)),x&&(f.addEventListener(`click`,z,!0),f.addEventListener(`pointerdown`,z,!0),f.addEventListener(`touchstart`,R,!0),f.addEventListener(`touchmove`,te,!0),f.addEventListener(`touchend`,ne,!0),f.addEventListener(`mousedown`,z,!0));let p=[];return g&&(Z(o)&&(p=Vn(o)),Z(i)&&(p=p.concat(Vn(i))),!Z(a)&&a&&a.contextElement&&(p=p.concat(Vn(a.contextElement)))),p=p.filter(e=>e!==f.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{f.removeEventListener(`pointerdown`,j,!0),d&&(f.removeEventListener(`keydown`,N),f.removeEventListener(`compositionstart`,s),f.removeEventListener(`compositionend`,u)),x&&(f.removeEventListener(`click`,z,!0),f.removeEventListener(`pointerdown`,z,!0),f.removeEventListener(`touchstart`,R,!0),f.removeEventListener(`touchmove`,te,!0),f.removeEventListener(`touchend`,ne,!0),f.removeEventListener(`mousedown`,z,!0)),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),e.clear()}},[c,i,a,o,d,x,r,s,g,l,C,w,N,ee,z,I,R,te,ne,j,n]),u.useEffect(O,[x,O]);let H=u.useMemo(()=>({onKeyDown:N,...m&&{[Sc[h]]:e=>{n.setOpen(!1,br(`trigger-press`,e.nativeEvent))},...h!==`intentional`&&{onClick(e){n.setOpen(!1,br(`trigger-press`,e.nativeEvent))}}}}),[N,n,m,h]),re=G(e=>{let t=Ii(e.nativeEvent);!Q(n.select(`floatingElement`),t)||e.button!==0||(S.current=!0)}),U=u.useMemo(()=>({onKeyDown:N,onPointerDown:re,onMouseDown:re,onMouseUp:re,onClickCapture:F,onMouseDownCapture:F,onPointerDownCapture:F,onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[N,re,F]);return u.useMemo(()=>l?{reference:H,floating:U,trigger:H}:{},[l,H,U])}var Tc=(e,t,n)=>{if(t.length===1&&t[0]===n){let t=!1;try{let n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw Error()}catch(t){({stack:e}=t)}console.warn(`The result function returned its own inputs without modification. e.g
4
+ \`createSelector([state => state.todos], todos => todos)\`
5
+ This could lead to inefficient memoization and unnecessary re-renders.
6
+ Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:e})}}},Ec=(e,t,n)=>{let{memoize:r,memoizeOptions:i}=t,{inputSelectorResults:a,inputSelectorResultsCopy:o}=e,s=r(()=>({}),...i);if(s.apply(null,a)!==s.apply(null,o)){let e;try{throw Error()}catch(t){({stack:e}=t)}console.warn(`An input selector returned a different result when passed same arguments.
7
+ This means your output selector will likely run more frequently than intended.
8
+ Avoid returning a new reference inside your input selector, e.g.
9
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:a,secondInputs:o,stack:e})}},Dc={inputStabilityCheck:`once`,identityFunctionCheck:`once`},Oc=Symbol(`NOT_FOUND`);function kc(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Ac(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function jc(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Mc=e=>Array.isArray(e)?e:[e];function Nc(e){let t=Array.isArray(e[0])?e[0]:e;return jc(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Pc(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Fc=(e,t)=>{let{identityFunctionCheck:n,inputStabilityCheck:r}={...Dc,...t};return{identityFunctionCheck:{shouldRun:n===`always`||n===`once`&&e,run:Tc},inputStabilityCheck:{shouldRun:r===`always`||r===`once`&&e,run:Ec}}},Ic=Object.getPrototypeOf({});function Lc(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Oc},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Rc(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return Oc}function i(t,i){r(t)===Oc&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var zc=(e,t)=>e===t;function Bc(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function Vc(e,t){let{equalityCheck:n=zc,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Bc(n),o=0,s=r<=1?Lc(a):Rc(r,a);function c(){let t=s.get(arguments);if(t===Oc){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Hc=class{constructor(e){this.value=e}deref(){return this.value}},Uc=typeof WeakRef<`u`?WeakRef:Hc,Wc=0,Gc=1;function Kc(){return{s:Wc,v:void 0,o:null,p:null}}function qc(e,t={}){let n=Kc(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=Kc(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=Kc(),e.set(n,t)):t=r}}let s=t,c;if(t.s===Gc)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Uc(c):c}return s.s=Gc,s.v=c,c}return o.clearCache=()=>{n=Kc(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Jc(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),kc(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=qc,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=Mc(c),p=Mc(u),m=Nc(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=!0,_=l(function(){r++;let e=Pc(m,arguments);if(i=h.apply(null,e),process.env.NODE_ENV!==`production`){let{identityFunctionCheck:t,inputStabilityCheck:n}=Fc(g,d);if(t.shouldRun&&t.run(o,e,i),n.shouldRun){let t=Pc(m,arguments);n.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:s,memoizeOptions:f},arguments)}g&&=!1}return i},...p);return Object.assign(_,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var Yc=Jc(qc),Xc=Object.assign((e,t=Yc)=>{Ac(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Xc}),Zc=Jc({memoize:Vc,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const $=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(process.env.NODE_ENV===`production`?p(1):`Unsupported number of selectors`);let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s};var Qc=o((e=>{var t=require(`react`);function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),$c=o((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function n(e,t){d||a.startTransition===void 0||(d=!0,console.error(`You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.`));var n=t();if(!f){var i=t();o(n,i)||(console.error(`The result of getSnapshot should be cached to avoid an infinite loop`),f=!0)}i=s({inst:{value:n,getSnapshot:t}});var p=i[0].inst,m=i[1];return l(function(){p.value=n,p.getSnapshot=t,r(p)&&m({inst:p})},[e,n,t]),c(function(){return r(p)&&m({inst:p}),e(function(){r(p)&&m({inst:p})})},[e]),u(n),n}function r(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch{return!0}}function i(e,t){return t()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=require(`react`),o=typeof Object.is==`function`?Object.is:t,s=a.useState,c=a.useEffect,l=a.useLayoutEffect,u=a.useDebugValue,d=!1,f=!1,p=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?i:n;e.useSyncExternalStore=a.useSyncExternalStore===void 0?p:a.useSyncExternalStore,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),el=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Qc():t.exports=$c()})),tl=o((e=>{var t=require(`react`),n=el();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),nl=o((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=require(`react`),r=el(),i=typeof Object.is==`function`?Object.is:t,a=r.useSyncExternalStore,o=n.useRef,s=n.useEffect,c=n.useMemo,l=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),rl=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=tl():t.exports=nl()})),il=el(),al=rl(),ol=C(19)?cl:ll;function sl(e,t,n,r,i){return ol(e,t,n,r,i)}function cl(e,t,n,r,i){let a=u.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,il.useSyncExternalStore)(e.subscribe,a,a)}function ll(e,t,n,r,i){return(0,al.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var ul=class e{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){e.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||e.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){let t={...this.state};e.prototype.setState.call(this,t)}},dl=class extends ul{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}controlledValues=new Map;useSyncedValue(e,t){u.useDebugValue(e),K(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){K(()=>(this.state[e]!==t&&this.set(e,t),()=>{this.set(e,void 0)}),[e,t])}useSyncedValues(e){if(process.env.NODE_ENV!==`production`){u.useDebugValue(e,e=>Object.keys(e));let t=u.useRef(Object.keys(e)).current,n=Object.keys(e);(t.length!==n.length||t.some((e,t)=>e!==n[t]))&&console.error(`ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.`)}K(()=>{this.update(e)},Object.values(e))}useControlledProp(e,t,n){u.useDebugValue(e);let r=t!==void 0;if(process.env.NODE_ENV!==`production`){let t=this.controlledValues.get(e);t!==void 0&&t!==r&&console.error(`A component is changing the ${r?``:`un`}controlled state of ${e.toString()} to be ${r?`un`:``}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}this.controlledValues.has(e)||(this.controlledValues.set(e,r),!r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})),K(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n,r])}set(e,t){this.controlledValues.get(e)!==!0&&super.set(e,t)}update(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.update(t)}setState(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.setState({...this.state,...t})}select=(e,t,n,r)=>{let i=this.selectors[e];return i(this.state,t,n,r)};useState=(e,t,n,r)=>{u.useDebugValue(e);let i=this.selectors[e];return sl(this,i,t,n,r)};useContextCallback(e,t){u.useDebugValue(e);let n=G(t??B);this.context[e]=n}useStateSetter(e){let t=u.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function fl(){let[,e]=u.useState({});return u.useCallback(()=>{e({})},[])}var pl={open:$(e=>e.open),domReferenceElement:$(e=>e.domReferenceElement),referenceElement:$(e=>e.positionReference??e.referenceElement),floatingElement:$(e=>e.floatingElement),floatingId:$(e=>e.floatingId)},ml=class extends dl{constructor(e){let{nested:t,noEmit:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Co(),nested:t,noEmit:n,triggerElements:i},pl)}setOpen=(e,t)=>{if((!e||!this.state.open||Zi(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}this.context.onOpenChange?.(e,t)}};function hl(e,t){let n=u.useRef(null);return u.useCallback(r=>{e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null&&(n.current=e,t.context.triggerElements.add(e,r)))},[t,e])}function gl(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=hl(e,n),o=G(t=>{a(t),t!==null&&n.select(`open`)&&n.select(`activeTriggerId`)==null&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return K(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function _l(e){let t=e.useState(`open`);K(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function vl(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Fr(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=G(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Pr({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var yl=class{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);if(n!==t&&(n!==void 0&&this.elements.delete(n),this.elements.add(t),this.idMap.set(e,t),process.env.NODE_ENV!==`production`&&this.elements.size!==this.idMap.size))throw Error(process.env.NODE_ENV===`production`?p(87):`Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.`)}delete(e){let t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(let t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}};function bl(){return new ml({open:!1,floatingElement:null,referenceElement:null,triggerElements:new yl,floatingId:``,nested:!1,noEmit:!1,onOpenChange:void 0})}function xl(){return{open:!1,mounted:!1,transitionStatus:`idle`,floatingRootContext:bl(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:V,inactiveTriggerProps:V,popupProps:V}}const Sl={open:$(e=>e.open),mounted:$(e=>e.mounted),transitionStatus:$(e=>e.transitionStatus),floatingRootContext:$(e=>e.floatingRootContext),preventUnmountingOnClose:$(e=>e.preventUnmountingOnClose),payload:$(e=>e.payload),activeTriggerId:$(e=>e.activeTriggerId),activeTriggerElement:$(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:$((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:$((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:$((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:$((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:$(e=>e.popupProps),popupElement:$(e=>e.popupElement),positionerElement:$(e=>e.positionerElement)};function Cl(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=mn(),a=Eo()!=null;if(process.env.NODE_ENV!==`production`){let e=r.reference;e&&!Z(e)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`",`instead.`)}let o=h(()=>new ml({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new yl,floatingId:i,nested:a,noEmit:e.noEmit||!1})).current;return K(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Z(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o.context.noEmit=e.noEmit||!1,o}function wl(e={}){let{nodeId:t,externalTree:n}=e,r=Cl(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=u.useState(null),c=u.useRef(null),l=Do(n);K(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let d=hc({...e,elements:{...a,...o&&{reference:o}}}),f=u.useCallback(e=>{let t=Z(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),d.refs.setReference(t)},[d.refs]),[p,m]=u.useState(null),[h,g]=u.useState(null);i.useSyncedValue(`referenceElement`,p),i.useSyncedValue(`domReferenceElement`,Z(p)?p:null),i.useSyncedValue(`floatingElement`,h);let _=u.useCallback(e=>{(Z(e)||e===null)&&(c.current=e,m(e)),(Z(d.refs.reference.current)||d.refs.reference.current===null||e!==null&&!Z(e))&&d.refs.setReference(e)},[d.refs,m]),v=u.useCallback(e=>{g(e),d.refs.setFloating(e)},[d.refs]),y=u.useMemo(()=>({...d.refs,setReference:_,setFloating:v,setPositionReference:f,domReference:c}),[d.refs,_,v,f]),b=u.useMemo(()=>({...d.elements,domReference:a.domReference}),[d.elements,a.domReference]),x=i.useState(`open`),S=i.useState(`floatingId`),C=u.useMemo(()=>({...d,dataRef:i.context.dataRef,open:x,onOpenChange:i.setOpen,events:i.context.events,floatingId:S,refs:y,elements:b,nodeId:t,rootStore:i}),[d,y,b,t,i,x,S]);return K(()=>{i.context.dataRef.current.floatingContext=C;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=C)}),u.useMemo(()=>({...d,context:C,refs:y,elements:b,rootStore:i}),[d,y,b,C,i])}function Tl(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,a=mn(),o=Eo()!=null,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(r?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=h(()=>new ml({open:s,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:i,floatingId:a,nested:o,noEmit:n})).current;return K(()=>{let e={open:s,floatingId:a,referenceElement:c,floatingElement:l};Z(c)&&(e.domReferenceElement=c),d.update(e)},[s,a,c,l,d]),d.context.onOpenChange=i,d.context.nested=o,d.context.noEmit=n,d}var El=Si&&yi;function Dl(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,visibleOnly:o=!0}=t,s=u.useRef(!1),c=Se(),l=u.useRef(!0);u.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=vn(e);function r(){!n.select(`open`)&&xn(e)&&e===Fi(zi(e))&&(s.current=!0)}function i(){l.current=!0}function o(){l.current=!1}return t.addEventListener(`blur`,r),El&&(t.addEventListener(`keydown`,i,!0),t.addEventListener(`pointerdown`,o,!0)),()=>{t.removeEventListener(`blur`,r),El&&(t.removeEventListener(`keydown`,i,!0),t.removeEventListener(`pointerdown`,o,!0))}},[n,a]),u.useEffect(()=>{if(!a)return;function e(e){(e.reason===`trigger-press`||e.reason===`escape-key`)&&(s.current=!0)}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a]);let d=u.useMemo(()=>({onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;let t=Ii(e.nativeEvent);if(o&&Z(t)){if(El&&!e.relatedTarget){if(!l.current&&!Bi(t))return}else if(!Hi(t))return}n.setOpen(!0,br(pr,e.nativeEvent,e.currentTarget))},onBlur(e){s.current=!1;let t=e.relatedTarget,r=e.nativeEvent,a=Z(t)&&t.hasAttribute(Oo(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;c.start(0,()=>{let o=n.select(`domReferenceElement`),s=Fi(o?o.ownerDocument:document);!t&&s===o||Q(i.current.floatingContext?.refs.floating.current,s)||Q(o,s)||a||n.context.triggerElements.hasElement(e.relatedTarget)||n.setOpen(!1,br(pr,r))})}}),[i,n,o,c]);return u.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}const Ol=Oo(`safe-polygon`);var kl=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ai}`;function Al(e){return e?!!e.closest(kl):!1}function jl(e){let t=u.useRef(void 0),n=u.useRef(!1),r=u.useRef(void 0),i=u.useRef(!0),a=u.useRef(!1),o=u.useRef(()=>{}),s=u.useRef(!1),c=Se(),l=Se(),d=u.useRef(void 0);return u.useMemo(()=>{let u=e.context.dataRef.current;return u.hoverInteractionState||={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:a,unbindMouseMoveRef:o,restTimeoutPendingRef:s,openChangeTimeout:c,restTimeout:l,handleCloseOptionsRef:d},u.hoverInteractionState},[e,t,n,r,i,a,o,s,c,l,d])}var Ml=new Set([`click`,`mousedown`]);function Nl(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,externalTree:l}=t,{pointerTypeRef:d,interactedInsideRef:f,handlerRef:p,performedPointerEventsMutationRef:m,unbindMouseMoveRef:h,restTimeoutPendingRef:g,openChangeTimeout:_,handleCloseOptionsRef:v}=jl(n),y=Do(l),b=Eo(),x=G(()=>f.current?!0:o.current.openEvent?Ml.has(o.current.openEvent.type):!1),S=G(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),C=u.useCallback((e,t=!0)=>{let r=Pl(c,d.current);r&&!p.current?_.start(r,()=>n.setOpen(!1,br(fr,e))):t&&(_.clear(),n.setOpen(!1,br(fr,e)))},[c,p,n,d,_]),w=G(()=>{h.current(),p.current=void 0}),T=G(()=>{if(m.current){let e=zi(i).body;e.style.pointerEvents=``,e.removeAttribute(Ol),m.current=!1}}),E=G(e=>{if(!Al(Ii(e))){f.current=!1;return}f.current=!0});K(()=>{r||(d.current=void 0,g.current=!1,f.current=!1,w(),T())},[r,d,g,f,w,T]),u.useEffect(()=>()=>{w()},[w]),u.useEffect(()=>T,[T]),K(()=>{if(s&&r&&v.current?.blockPointerEvents&&S()&&Z(a)&&i){m.current=!0;let e=zi(i).body;e.setAttribute(Ol,``);let t=a,n=i,r=y?.nodesRef.current.find(e=>e.id===b)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),e.style.pointerEvents=`none`,t.style.pointerEvents=`auto`,n.style.pointerEvents=`auto`,()=>{e.style.pointerEvents=``,t.style.pointerEvents=``,n.style.pointerEvents=``}}},[s,r,a,i,v,S,y,b,m]),u.useEffect(()=>{if(!s)return;function e(e){if(x()||!o.current.floatingContext||!n.select(`open`))return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||(T(),w(),x()||C(e))}function t(e){_.clear(),T(),p.current?.(e),w()}function r(e){x()||C(e,!1)}let a=i;return a&&(a.addEventListener(`mouseleave`,e),a.addEventListener(`mouseenter`,t),a.addEventListener(`mouseleave`,r),a.addEventListener(`pointerdown`,E,!0)),()=>{a&&(a.removeEventListener(`mouseleave`,e),a.removeEventListener(`mouseenter`,t),a.removeEventListener(`mouseleave`,r),a.removeEventListener(`pointerdown`,E,!0))}})}function Pl(e,t){return t&&!Xi(t)?0:typeof e==`function`?e():e}function Fl(e){return typeof e==`function`?e():e}var Il={current:null};function Ll(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:d=!0,triggerElementRef:p=Il,externalTree:m,isActiveTrigger:h=!0}=t,g=Do(m),{pointerTypeRef:_,interactedInsideRef:v,handlerRef:y,blockMouseMoveRef:b,performedPointerEventsMutationRef:x,unbindMouseMoveRef:S,restTimeoutPendingRef:C,openChangeTimeout:w,restTimeout:T,handleCloseOptionsRef:E}=jl(n),D=wr(s),O=wr(o),k=wr(l);h&&(E.current=D.current?.__options);let A=G(()=>v.current?!0:r.current.openEvent?[`click`,`mousedown`].includes(r.current.openEvent.type):!1),j=u.useCallback((e,t=!0)=>{let r=jo(O.current,`close`,_.current);r&&!y.current?w.start(r,()=>n.setOpen(!1,br(fr,e))):t&&(w.clear(),n.setOpen(!1,br(fr,e)))},[O,y,n,_,w]),M=G(()=>{S.current(),y.current=void 0}),N=G(()=>{if(x.current){let e=zi(n.select(`domReferenceElement`)).body;e.style.pointerEvents=``,e.removeAttribute(Ol),x.current=!1}});u.useEffect(()=>{if(!a)return;function e(e){e.open||(w.clear(),T.clear(),b.current=!0,C.current=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,w,T,b,C]);let P=G(e=>{if(A()||!r.current.floatingContext)return;let t=n.context.triggerElements;if(e.relatedTarget&&t.hasElement(e.relatedTarget))return;let i=p.current;D.current?.({...r.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){N(),M(),!A()&&i===n.select(`domReferenceElement`)&&j(e)}})(e)});return u.useEffect(()=>{if(!a)return;let e=p.current??(h?n.select(`domReferenceElement`):null);if(!Z(e))return;function t(e){if(w.clear(),b.current=!1,c&&!Xi(_.current)||Fl(k.current)>0&&!jo(O.current,`open`))return;let t=jo(O.current,`open`,_.current),r=n.select(`domReferenceElement`),i=n.context.triggerElements,a=(i.hasElement(e.target)||i.hasMatchingElement(t=>Q(t,e.target)))&&(!r||!Q(r,e.target)),o=e.currentTarget??null,s=!n.select(`open`)||a;t?w.start(t,()=>{s&&n.setOpen(!0,br(fr,e,o))}):s&&n.setOpen(!0,br(fr,e,o))}function i(e){if(A()){N();return}S.current();let t=zi(n.select(`domReferenceElement`));T.clear(),C.current=!1;let i=n.context.triggerElements;if(!(e.relatedTarget&&i.hasElement(e.relatedTarget))){if(D.current&&r.current.floatingContext){n.select(`open`)||w.clear();let i=p.current;y.current=D.current({...r.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){N(),M(),!A()&&i===n.select(`domReferenceElement`)&&j(e,!0)}});let a=y.current;a(e),t.addEventListener(`mousemove`,a),S.current=()=>{t.removeEventListener(`mousemove`,a)};return}(_.current!==`touch`||!Q(n.select(`floatingElement`),e.relatedTarget))&&j(e)}}function o(e){P(e)}return n.select(`open`)&&e.addEventListener(`mouseleave`,o),d&&e.addEventListener(`mousemove`,t,{once:!0}),e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,i),()=>{e.removeEventListener(`mouseleave`,o),d&&e.removeEventListener(`mousemove`,t),e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,i)}},[M,N,b,r,O,j,n,a,D,P,h,A,c,d,_,k,T,C,w,p,g,S,y]),u.useMemo(()=>{function e(e){_.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.context.triggerElements,o=n.select(`open`),s=(a.hasElement(e.target)||a.hasMatchingElement(t=>Q(t,e.target)))&&(!i||!Q(i,e.target));if(c&&!Xi(_.current)||o&&!s||Fl(k.current)===0||!s&&C.current&&e.movementX**2+e.movementY**2<2)return;T.clear();function l(){!b.current&&(!o||s)&&n.setOpen(!0,br(fr,t,r))}_.current===`touch`?f.flushSync(()=>{l()}):s&&o?l():(C.current=!0,T.start(Fl(k.current),l))}}},[b,c,n,_,k,T,C])}function Rl(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=u.useCallback(t=>zl(t,e,`reference`),t),o=u.useCallback(t=>zl(t,e,`floating`),n),s=u.useCallback(t=>zl(t,e,`item`),r),c=u.useCallback(t=>zl(t,e,`trigger`),i);return u.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function zl(e,t,n){let r=new Map,i=n===`item`,a={};for(let t in n===`floating`&&(a.tabIndex=-1,a[`data-base-ui-focusable`]=``),e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&Bl(a,s,i,r)}return Bl(a,e,i,r),a}function Bl(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var Vl=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Hl(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{enabled:s=!0,role:c=`dialog`}=t,l=mn(),d=a?.id||l,f=u.useMemo(()=>Ui(o)?.id||i,[o,i]),p=Vl.get(c)??c,m=Eo()!=null,h=u.useMemo(()=>p===`tooltip`||c===`label`?V:{"aria-haspopup":p===`alertdialog`?`dialog`:p,"aria-expanded":`false`,...p===`listbox`&&{role:`combobox`},...p===`menu`&&m&&{role:`menuitem`},...c===`select`&&{"aria-autocomplete":`none`},...c===`combobox`&&{"aria-autocomplete":`list`}},[p,m,c]),g=u.useMemo(()=>p===`tooltip`||c===`label`?{[`aria-${c===`label`?`labelledby`:`describedby`}`]:r?f:void 0}:{...h,"aria-expanded":r?`true`:`false`,"aria-controls":r?f:void 0,...p===`menu`&&{id:d}},[p,f,r,d,c,h]),_=u.useMemo(()=>{let e={id:f,...p&&{role:p}};return p===`tooltip`||c===`label`?e:{...e,...p===`menu`&&{"aria-labelledby":d}}},[p,f,d,c]),v=u.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${f}-fui-option`}};switch(c){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[f,c]);return u.useMemo(()=>s?{reference:g,floating:_,item:v,trigger:h}:{},[s,g,_,h,v])}function Ul(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function Wl(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Gl(e={}){let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i=new xe,a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=({x:e,y:n,placement:o,elements:s,onClose:c,nodeId:u,tree:d})=>function(f){function p(){i.clear(),c()}if(i.clear(),!s.domReference||!s.floating||o==null||e==null||n==null)return;let{clientX:m,clientY:h}=f,g=[m,h],_=Ii(f),v=f.type===`mouseleave`,y=Q(s.floating,_),b=Q(s.domReference,_),x=s.domReference.getBoundingClientRect(),S=s.floating.getBoundingClientRect(),C=o.split(`-`)[0],w=e>S.right-S.width/2,T=n>S.bottom-S.height/2,E=Wl(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&Z(f.relatedTarget)&&Q(s.floating,f.relatedTarget)||d&&Wi(d.nodesRef.current,u).some(({context:e})=>e?.open))return;if(C===`top`&&n>=x.bottom-1||C===`bottom`&&n<=x.top+1||C===`left`&&e>=x.right-1||C===`right`&&e<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]];break;default:}function P([e,n]){switch(C){case`top`:return[[D?e+t/2:w?e+t*4:e-t*4,n+t+1],[D?e-t/2:w?e+t*4:e-t*4,n+t+1],...[[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]]];case`bottom`:return[[D?e+t/2:w?e+t*4:e-t*4,n-t],[D?e-t/2:w?e+t*4:e-t*4,n-t],...[[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]]];case`left`:{let r=[e+t+1,O?n+t/2:T?n+t*4:n-t*4],i=[e+t+1,O?n-t/2:T?n+t*4:n-t*4];return[...[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom]],r,i]}case`right`:return[[e-t,O?n+t/2:T?n+t*4:n-t*4],[e-t,O?n-t/2:T?n+t*4:n-t*4],...[[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]]];default:return[]}}if(!Ul([m,h],N)){if(a&&!E)return p();if(!v&&r){let e=l(f.clientX,f.clientY);if(e!==null&&e<.1)return p()}Ul([m,h],P([e,n]))?!a&&r&&i.start(40,p):p()}};return u.__options={blockPointerEvents:n},u}let Kl=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),ql=function(e){return e[e.open=$r.open]=`open`,e[e.closed=$r.closed]=`closed`,e[e.startingStyle=$r.startingStyle]=`startingStyle`,e[e.endingStyle=$r.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({});const Jl=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(Jl.displayName=`DialogPortalContext`);function Yl(){let e=u.useContext(Jl);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(26):`Base UI: <Dialog.Portal> is missing.`);return e}const Xl=`ArrowUp`,Zl=`ArrowDown`,Ql=`ArrowLeft`,$l=`ArrowRight`,eu=`Home`,tu=`End`,nu=new Set([Ql,$l]),ru=new Set([Ql,$l,eu,`End`]),iu=new Set([Xl,Zl]),au=new Set([Xl,Zl,eu,`End`]),ou=new Set([...nu,...iu]),su=new Set([...ou,eu,`End`]),cu=new Set([Xl,Zl,Ql,$l,eu,`End`]),lu=`Shift`,uu=`Control`,du=`Alt`,fu=`Meta`,pu=new Set([`Shift`,`Control`,`Alt`,`Meta`]);function mu(e){return xn(e)&&e.tagName===`INPUT`}function hu(e){return!!(mu(e)&&e.selectionStart!=null||xn(e)&&e.tagName===`TEXTAREA`)}function gu(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=_u(e,t,`left`),a=vu(e),o=vu(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginRight<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=_u(e,t,`top`),r=vu(e),i=vu(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function _u(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function vu(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var yu={...si,...zr,nestedDialogOpen(e){return e?{[ql.nestedDialogOpen]:``}:null}};const bu=u.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,...o}=e,{store:s}=Qr(),c=s.useState(`descriptionElementId`),l=s.useState(`disablePointerDismissal`),f=s.useState(`floatingRootContext`),p=s.useState(`popupProps`),m=s.useState(`modal`),h=s.useState(`mounted`),g=s.useState(`nested`),_=s.useState(`nestedOpenDialogCount`),v=s.useState(`open`),y=s.useState(`openMethod`),b=s.useState(`titleElementId`),x=s.useState(`transitionStatus`),S=s.useState(`role`);Yl(),Pr({open:v,ref:s.context.popupRef,onComplete(){v&&s.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?s.context.popupRef.current:!0}let w=i===void 0?C:i,T=_>0,E=W(`div`,e,{state:u.useMemo(()=>({open:v,nested:g,transitionStatus:x,nestedDialogOpen:T}),[v,g,x,T]),props:[p,{"aria-labelledby":b??void 0,"aria-describedby":c??void 0,role:S,tabIndex:-1,hidden:!h,onKeyDown(e){cu.has(e.key)&&e.stopPropagation()},style:{[Kl.nestedDialogs]:_}},o],ref:[t,s.context.popupRef,s.useStateSetter(`popupElement`)],stateAttributesMapping:yu});return(0,d.jsx)(cs,{context:f,openInteractionType:y,disabled:!h,closeOnFocusOut:!l,initialFocus:w,returnFocus:r,modal:m!==!1,restoreFocus:`popup`,children:E})});process.env.NODE_ENV!==`production`&&(bu.displayName=`DialogPopup`);function xu(e){return C(19)?e:e?`true`:void 0}const Su=u.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n?.getBoundingClientRect();i=`polygon(
10
+ 0% 0%,
11
+ 100% 0%,
12
+ 100% 100%,
13
+ 0% 100%,
14
+ 0% 0%,
15
+ ${e.left}px ${e.top}px,
16
+ ${e.left}px ${e.bottom}px,
17
+ ${e.right}px ${e.bottom}px,
18
+ ${e.right}px ${e.top}px,
19
+ ${e.left}px ${e.top}px
20
+ )`}return(0,d.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});process.env.NODE_ENV!==`production`&&(Su.displayName=`InternalBackdrop`);const Cu=u.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Qr(),a=i.useState(`mounted`),o=i.useState(`modal`);return a||n?(0,d.jsx)(Jl.Provider,{value:n,children:(0,d.jsxs)(Qo,{ref:t,...r,children:[a&&o===!0&&(0,d.jsx)(Su,{ref:i.context.internalBackdropRef,inert:xu(!open)}),e.children]})}):null});process.env.NODE_ENV!==`production`&&(Cu.displayName=`DialogPortal`);var wu={},Tu={},Eu=``;function Du(e){if(typeof document>`u`)return!1;let t=Fo(e);return vn(t).innerWidth-t.documentElement.clientWidth>0}function Ou(e){let t=Fo(e),n=t.documentElement,r=t.body,i=wn(n)?n:r,a=i.style.overflow;return i.style.overflow=`hidden`,()=>{i.style.overflow=a}}function ku(e){let t=Fo(e),n=t.documentElement,r=t.body,i=vn(n),a=0,o=0,s=Ar.create(),c=typeof CSS<`u`&&CSS.supports?.(`scrollbar-gutter`,`stable`);if(gi&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let e=i.getComputedStyle(n),t=i.getComputedStyle(r),s=(e.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,wu={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Eu=n.style.scrollBehavior,Tu={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let l=n.scrollHeight>n.clientHeight,u=n.scrollWidth>n.clientWidth,d=e.overflowY===`scroll`||t.overflowY===`scroll`,f=e.overflowX===`scroll`||t.overflowX===`scroll`,p=Math.max(0,i.innerWidth-n.clientWidth),m=Math.max(0,i.innerHeight-n.clientHeight),h=parseFloat(t.marginTop)+parseFloat(t.marginBottom),g=parseFloat(t.marginLeft)+parseFloat(t.marginRight),_=wn(n)?n:r;if(c){n.style.scrollbarGutter=s,_.style.overflowY=`hidden`,_.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:s,overflowY:`hidden`,overflowX:`hidden`}),(l||d)&&(n.style.overflowY=`scroll`),(u||f)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:h||m?`calc(100dvh - ${h+m}px)`:`100dvh`,width:g||p?`calc(100vw - ${g+p}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,wu),Object.assign(r.style,Tu),c||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Eu)}function d(){u(),s.request(l)}return l(),i.addEventListener(`resize`,d),()=>{s.cancel(),u(),typeof i.removeEventListener==`function`&&i.removeEventListener(`resize`,d)}}var Au=class{lockCount=0;restore=null;timeoutLock=xe.create();timeoutUnlock=xe.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Fo(e).documentElement,n=vn(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=B;return}this.restore=_i||!Du(e)?Ou(e):ku(e)}},ju=new Au;function Mu(e=!0,t=null){K(()=>{if(e)return ju.acquire(t)},[e,t])}function Nu(e){let t=u.useRef(``),n=u.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:u.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n&&e(n,n.pointerType),e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Pu(e){let[t,n]=u.useState(null),r=G((t,r)=>{e||n(r)}),i=u.useCallback(()=>{n(null)},[]),{onClick:a,onPointerDown:o}=Nu(r);return u.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:a,onPointerDown:o}}),[t,i,a,o])}function Fu(e){let{store:t,parentContext:n,actionsRef:r}=e,i=t.useState(`open`),a=t.useState(`disablePointerDismissal`),o=t.useState(`modal`),s=t.useState(`popupElement`),{openMethod:c,triggerProps:l,reset:d}=Pu(i);_l(t);let{forceUnmount:f}=vl(i,t,()=>{d()}),p=G(e=>{let n=br(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),m=u.useCallback(()=>{t.setOpen(!1,p(yr))},[t,p]);u.useImperativeHandle(r,()=>({unmount:f,close:m}),[f,m]);let h=Tl({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[g,_]=u.useState(0),v=g===0,y=Hl(h),b=wc(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=Ii(e);if(v&&!a){let e=n;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||Q(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});Mu(i&&o===!0,s);let{getReferenceProps:x,getFloatingProps:S,getTriggerProps:C}=Rl([y,b]);t.useContextCallback(`onNestedDialogOpen`,e=>{_(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{_(0)}),u.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(g),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,g]);let w=u.useMemo(()=>x(l),[x,l]),T=u.useMemo(()=>C(l),[C,l]),E=u.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:c,activeTriggerProps:w,inactiveTriggerProps:T,popupProps:E,floatingRootContext:h,nestedOpenDialogCount:g})}var Iu={...Sl,modal:$(e=>e.modal),nested:$(e=>e.nested),nestedOpenDialogCount:$(e=>e.nestedOpenDialogCount),disablePointerDismissal:$(e=>e.disablePointerDismissal),openMethod:$(e=>e.openMethod),descriptionElementId:$(e=>e.descriptionElementId),titleElementId:$(e=>e.titleElementId),viewportElement:$(e=>e.viewportElement),role:$(e=>e.role)},Lu=class extends dl{constructor(e){super(Ru(e),{popupRef:u.createRef(),backdropRef:u.createRef(),internalBackdropRef:u.createRef(),triggerElements:new yl,onOpenChange:void 0,onOpenChangeComplete:void 0},Iu)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function Ru(e={}){return{...xl(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function zu(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:f,defaultTriggerId:p=null}=e,m=Qr(!0),g=!!m,_=h(()=>l?.store??new Lu({open:n??r,activeTriggerId:f===void 0?p:f,modal:s,disablePointerDismissal:o,nested:g})).current;_.useControlledProp(`open`,n,r),_.useControlledProp(`activeTriggerId`,f,p),_.useSyncedValues({disablePointerDismissal:o,nested:g,modal:s}),_.useContextCallback(`onOpenChange`,i),_.useContextCallback(`onOpenChangeComplete`,a);let v=_.useState(`payload`);Fu({store:_,actionsRef:c,parentContext:m?.store.context,onOpenChange:i,triggerIdProp:f});let y=u.useMemo(()=>({store:_}),[_]);return(0,d.jsx)(Zr.Provider,{value:y,children:typeof t==`function`?t({payload:v}):t})}const Bu=u.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=Qr(),s=hn(i);return o.useSyncedValueWithCleanup(`titleElementId`,s),W(`h2`,e,{ref:t,props:[{id:s},a]})});process.env.NODE_ENV!==`production`&&(Bu.displayName=`DialogTitle`);const Vu=u.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,payload:s,handle:c,...l}=e,d=Qr(!0),f=c?.store??d?.store;if(!f)throw Error(process.env.NODE_ENV===`production`?p(79):`Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.`);let m=hn(o),h=f.useState(`floatingRootContext`),g=f.useState(`isOpenedByTrigger`,m),_=u.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=gl(m,_,f,{payload:s}),{getButtonProps:b,buttonRef:x}=Jn({disabled:i,native:a}),S=Rl([ls(h,{enabled:h!=null})]),C=u.useMemo(()=>({disabled:i,open:g}),[i,g]),w=f.useState(`triggerProps`,y);return W(`button`,e,{state:C,ref:[x,t,v,_],props:[S.getReferenceProps(),w,{"data-base-ui-click-trigger":``,id:m},l,b],stateAttributesMapping:oi})});process.env.NODE_ENV!==`production`&&(Vu.displayName=`DialogTrigger`);const Hu=e=>{let t=(0,l.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(``,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,d.jsx)(tn,{style:`ghost`,tone:`neutral`,children:`Close`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,d.jsx)(ui,{className:o,ref:a,...i,render:s,children:n}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c},Uu=e=>{let t=(0,l.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(`text-prose-0 mb-0`,r),t[5]=r,t[6]=o);let s;return t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,d.jsx)(di,{className:o,ref:a,...i,children:n}),t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s},Wu=e=>{let t=(0,l.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,showCloseButton:o,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?!0:o,c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,d.jsx)(li,{className:`fixed inset-[0px] min-h-dvh bg-scrim opacity-50 transition-all duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-[-webkit-touch-callout:none]:absolute`}),t[6]=c):c=t[6];let u;t[7]===r?u=t[8]:(u=X(`fixed top-1/2 left-1/2 min-w-1/3 max-w-[calc(100vw-3rem)] px-md py-sm space-y-2xs -translate-x-1/2 -translate-y-1/2 rounded-lg bg-surface-container outline-1 outline-outline transition-all duration-150 data-ending-style:scale-90 data-ending-style:opacity-0 data-starting-style:scale-90 data-starting-style:opacity-0`,r),t[7]=r,t[8]=u);let f;t[9]===s?f=t[10]:(f=s&&(0,d.jsx)(Hu,{}),t[9]=s,t[10]=f);let p;t[11]===f?p=t[12]:(p=(0,d.jsx)(`div`,{className:`flex justify-end`,children:f}),t[11]=f,t[12]=p);let m;return t[13]!==n||t[14]!==i||t[15]!==a||t[16]!==u||t[17]!==p?(m=(0,d.jsxs)(Cu,{children:[c,(0,d.jsxs)(bu,{className:u,ref:a,...i,children:[n,p]})]}),t[13]=n,t[14]=i,t[15]=a,t[16]=u,t[17]=p,t[18]=m):m=t[18],m},Gu=e=>{let t=(0,l.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(`text-strong-2`,r),t[5]=r,t[6]=o);let s;return t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,d.jsx)(Bu,{className:o,ref:a,...i,children:n}),t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s},Ku=e=>{let t=(0,l.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(``,r),t[5]=r,t[6]=o);let s;return t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,d.jsx)(Vu,{className:o,ref:a,...i,children:n}),t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s},qu=e=>{let t=(0,l.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,d.jsx)(zu,{...n}),t[2]=n,t[3]=r),r};var Ju=new WeakMap,Yu=new WeakMap,Xu={current:[]},Zu=!1,Qu=0,$u=new Set,ed=new Map;function td(e){let t=Array.from(e).sort((e,t)=>e instanceof cd&&e.options.deps.includes(t)?1:t instanceof cd&&t.options.deps.includes(e)?-1:0);for(let e of t){if(Xu.current.includes(e))continue;Xu.current.push(e),e.recompute();let t=Yu.get(e);if(t)for(let e of t){let t=Ju.get(e);t&&td(t)}}}function nd(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function rd(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function id(e){if(Qu>0&&!ed.has(e)&&ed.set(e,e.prevState),$u.add(e),!(Qu>0)&&!Zu)try{for(Zu=!0;$u.size>0;){let e=Array.from($u);$u.clear();for(let t of e)t.prevState=ed.get(t)??t.prevState,nd(t);for(let t of e){let e=Ju.get(t);e&&(Xu.current.push(t),td(e))}for(let t of e){let e=Ju.get(t);if(e)for(let t of e)rd(t)}}}finally{Zu=!1,Xu.current=[],ed.clear()}}function ad(e){Qu++;try{e()}finally{if(Qu--,Qu===0){let e=$u.values().next().value;e&&id(e)}}}function od(e){return typeof e==`function`}var sd=class{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t;this.listeners.add(e);let n=((t=this.options)?.onSubscribe)?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n;this.prevState=this.state,this.options?.updateFn?this.state=this.options.updateFn(this.prevState)(e):od(e)?this.state=e(this.prevState):this.state=e,(n=(t=this.options)?.onUpdate)==null||n.call(t),id(this)}},cd=class e{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{let e=this.options.deps.length,t=Array(e),n=Array(e);for(let r=0;r<e;r++){let e=this.options.deps[r];t[r]=e.prevState,n[r]=e.state}return this.lastSeenDepValues=n,{prevDepVals:t,currDepVals:n,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,t;this.prevState=this.state;let n=this.getDepVals();this.state=this.options.fn(n),(t=(e=this.options).onUpdate)==null||t.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(let t of this.options.deps)t instanceof e&&t.checkIfRecalculationNeededDeeply();let t=!1,n=this.lastSeenDepValues,{currDepVals:r}=this.getDepVals();for(let e=0;e<r.length;e++)if(r[e]!==n[e]){t=!0;break}t&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(let e of this._subscriptions)e()}),this.subscribe=e=>{var t;this.listeners.add(e);let n=(t=this.options).onSubscribe?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(let n of t)if(n instanceof e)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof sd){let e=Ju.get(n);e||(e=new Set,Ju.set(n,e)),e.add(this);let t=Yu.get(this);t||(t=new Set,Yu.set(this,t)),t.add(n)}}unregisterFromGraph(t=this.options.deps){for(let n of t)if(n instanceof e)this.unregisterFromGraph(n.options.deps);else if(n instanceof sd){let e=Ju.get(n);e&&e.delete(this);let t=Yu.get(this);t&&t.delete(n)}}},ld=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function ud(e,t){return new ld(e,t).maybeExecute}var dd=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},fd=class extends dd{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}},pd=new fd;function md(e,t){return typeof e==`function`?e(t):e}function hd(e,t){return Td(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function gd(e,t,n){let r=Td(t);function i(e){if(!r.length)return md(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function _d(e,t){let n=Td(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var vd=/^(\d+)$/gm,yd=/\.(\d+)(?=\.)/gm,bd=/^(\d+)\./gm,xd=/\.(\d+$)/gm,Sd=/\.{2,}/gm,Cd=`__int__`,wd=`${Cd}$1`;function Td(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);return e.replace(/(^\[)|]/gm,``).replace(/\[/g,`.`).replace(vd,wd).replace(yd,`.${wd}.`).replace(bd,`${wd}.`).replace(xd,`.${wd}`).replace(Sd,`.`).split(`.`).map(e=>{if(e.startsWith(Cd)){let t=e.substring(7),n=parseInt(t,10);return String(n)===t?n:t}return e})}function Ed(e,t){return e.length===0?t:t.length===0?e:t.startsWith(`[`)||t.startsWith(`.`)?e+t:`${e}.${t}`}function Dd(e){return!(Array.isArray(e)&&e.length===0)}function Od(e,t){return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function kd(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0;break}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var Ad=e=>!!e&&typeof e==`object`&&`fields`in e;function jd(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!jd(e[i],t[i]))return!1;return!0}var Md=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},Nd=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function Pd(e,t){return e==null?t:{...e,...t}}for(var Fd=256,Id=[],Ld;Fd--;)Id[Fd]=(Fd+256).toString(16).substring(1);function Rd(){let e=0,t,n=``;if(!Ld||Fd+16>256){for(Ld=Array(256),e=256;e--;)Ld[e]=256*Math.random()|0;e=0,Fd=0}for(;e<16;e++)t=Ld[Fd+e],e===6?n+=Id[t&15|64]:e===8?n+=Id[t&63|128]:n+=Id[t],e&1&&e>1&&e<11&&(n+=`-`);return Fd++,n}var zd=ud(e=>pd.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300}),Bd=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function Vd(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);Array.isArray(i)&&!Number.isNaN(o)?a+=`[${o}]`:a+=(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var Hd=(e,t)=>{let n=Vd(e,t);return{form:n,fields:n}},Ud={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:Hd(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:Hd(r.issues,e)}},Wd=e=>!!e&&`~standard`in e,Gd={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Kd(e){function t(t,n,r){let i=o(t,n,`move`,r),s=Math.min(n,r),l=Math.max(n,r);for(let e=s;e<=l;e++)i.push(a(t,e));let u=Object.keys(e.fieldInfo).reduce((r,i)=>(i.startsWith(a(t,n))&&r.set(i,e.getFieldMeta(i)),r),new Map);c(i,n<r?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(a(t,r))).forEach(i=>{let o=i.replace(a(t,r),a(t,n)),s=u.get(o);s&&e.setFieldMeta(i,s)})}function n(e,t){c(o(e,t,`remove`),`up`)}function r(t,n,r){o(t,n,`swap`,r).forEach(i=>{if(!i.toString().startsWith(a(t,n)))return;let o=i.toString().replace(a(t,n),a(t,r)),[s,c]=[e.getFieldMeta(i),e.getFieldMeta(o)];s&&e.setFieldMeta(o,s),c&&e.setFieldMeta(i,c)})}function i(t,n){let r=o(t,n,`insert`);c(r,`down`),r.forEach(r=>{r.toString().startsWith(a(t,n))&&e.setFieldMeta(r,l())})}function a(e,t){return`${e}[${t}]`}function o(t,n,r,i){let o=[a(t,n)];switch(r){case`swap`:o.push(a(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)o.push(a(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)o.push(a(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>o.some(t=>e.startsWith(t)))}function s(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function c(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=s(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,l())})}let l=()=>Gd;return{handleArrayMove:t,handleArrayRemove:n,handleArraySwap:r,handleArrayInsert:i}}function qd(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var Jd=class{constructor(e){this.options={},this.fieldInfo={},this.prevTransformArray=[],this.mount=()=>{let e=this.fieldMetaDerived.mount(),t=this.store.mount(),n=this.store.subscribe(()=>{zd(this)}),r=pd.on(`request-form-state`,e=>{e.payload.id===this._formId&&pd.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),i=pd.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),a=pd.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),o=()=>{a(),i(),r(),n(),e(),t(),pd.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:s}=this.options.validators||{};return pd.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),s&&this.validateSync(`mount`),o},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=!!e.transform?.deps?.some((e,t)=>e!==this.prevTransformArray[t]),r=e.defaultValues&&!jd(e.defaultValues,t.defaultValues)&&!this.state.isTouched,i=!jd(e.defaultState,t.defaultState)&&!this.state.isTouched;!r&&!i&&!n||(ad(()=>{this.baseStore.setState(()=>qd(Object.assign({},this.state,i?e.defaultState:{},r?{values:e.defaultValues}:{},n?{_force_re_eval:!this.state._force_re_eval}:{})))}),pd.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>qd({...this.options.defaultState,values:e??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:r}))},this.validateAllFields=async e=>{let t=[];return ad(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0}))),n.instance.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return ad(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;return n?(n.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)):[]},this.validateSync=e=>{let t=Od(e,{...this.options,form:this,validationLogic:this.options.validationLogic||Bd}),n=!1,r={};return ad(()=>{for(let e of t){if(!e.validate)continue;let{formError:t,fieldErrors:i}=Yd(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),a=Xd(e.cause),o=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]);for(let e of o){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Gd,o=i?.[e],{newErrorValue:s,newSource:c}=Md({newFormValidatorError:o,isPreviousErrorFromFormValidator:n?.[a]===`form`,previousErrorValue:t?.[a]});c===`form`&&(r[e]={...r[e],[a]:o}),t?.[a]!==s&&this.setFieldMeta(e,(e=Gd)=>({...e,errorMap:{...e.errorMap,[a]:s},errorSourceMap:{...e.errorSourceMap,[a]:c}}))}this.state.errorMap?.[a]!==t&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:t}})),(t||i)&&(n=!0)}let i=Xd(`submit`);this.state.errorMap?.[i]&&e!==`submit`&&!n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[i]:void 0}}));let a=Xd(`server`);this.state.errorMap?.[a]&&e!==`server`&&!n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}))}),{hasErrored:n,fieldsErrorMap:r}},this.validateAsync=async e=>{let t=kd(e,{...this.options,form:this,validationLogic:this.options.validationLogic||Bd});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let n=[],r;for(let e of t){if(!e.validate)continue;let t=Xd(e.cause);this.state.validationMetaMap[t]?.lastAbortController.abort();let i=new AbortController;this.state.validationMetaMap[t]={lastAbortController:i},n.push(new Promise(async t=>{let n;try{n=await new Promise((t,n)=>{setTimeout(async()=>{if(i.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:i.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){n=e}let{formError:a,fieldErrors:o}=Yd(n);o&&(r=r?{...r,...o}:o);let s=Xd(e.cause);for(let e of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[e]===void 0)continue;let t=this.getFieldMeta(e);if(!t)continue;let{errorMap:n,errorSourceMap:i}=t,a=r?.[e],{newErrorValue:o,newSource:c}=Md({newFormValidatorError:a,isPreviousErrorFromFormValidator:i?.[s]===`form`,previousErrorValue:n?.[s]});n?.[s]!==o&&this.setFieldMeta(e,e=>({...e,errorMap:{...e.errorMap,[s]:o},errorSourceMap:{...e.errorSourceMap,[s]:c}}))}this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[s]:a}})),t(r?{fieldErrors:r,errorMapKey:s}:void 0)}))}let i=[],a={};if(n.length){i=await Promise.all(n);for(let e of i)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))a[n]={...a[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),a},this.validate=e=>{let{hasErrored:t,fieldsErrorMap:n}=this.validateSync(e);return t&&!this.options.asyncAlways?n:this.validateAsync(e)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),ad(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),pd.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),pd.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}ad(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.options.listeners?.onSubmit?.({value:e.instance.state.value,fieldApi:e.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),ad(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),pd.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),pd.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>hd(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:md(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=Gd,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;ad(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:gd(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=_d(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],Pd(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),Kd(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),Pd(r,{dontValidate:!0})),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),Pd(n,{dontValidate:!0})),Kd(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return gd(gd(e,`${t}`,i),`${n}`,r)},Pd(r,{dontValidate:!0})),Kd(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},Pd(r,{dontValidate:!0})),Kd(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],Pd(t,{dontValidate:!0})),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>({...t,fieldMetaBase:{...t.fieldMetaBase,[e]:Gd},values:this.options.defaultValues?gd(t.values,e,hd(this.options.defaultValues,e)):t.values}))},this.setErrorMap=e=>{ad(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(Ad(t)){let{formError:e,fieldErrors:r}=Yd(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>Ud.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>Ud.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??Rd(),this._devtoolsSubmissionOverride=!1,this.baseStore=new sd(qd({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values})),this.fieldMetaDerived=new cd({deps:[this.baseStore],fn:({prevDepVals:e,currDepVals:t,prevVal:n})=>{let r=n,i=e?.[0],a=t[0],o=0,s={};for(let e of Object.keys(a.fieldMetaBase)){let t=a.fieldMetaBase[e],n=i?.fieldMetaBase[e],c=r?.[e],l=hd(a.values,e),u=c?.errors;if(!n||t.errorMap!==n.errorMap){u=Object.values(t.errorMap??{}).filter(e=>e!==void 0);let n=this.getFieldInfo(e)?.instance;n&&!n.options.disableErrorFlat&&(u=u.flat(1))}let d=!Dd(u),f=!t.isDirty,p=jd(l,hd(this.options.defaultValues,e))||jd(l,this.getFieldInfo(e)?.instance?.options.defaultValue);if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&t===n){s[e]=c,o++;continue}s[e]={...t,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(a.fieldMetaBase).length&&r&&o===Object.keys(a.fieldMetaBase).length?r:s}}),this.store=new cd({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:e,currDepVals:t,prevVal:n})=>{let r=n,i=e?.[0],a=t[0],o=t[1],s=Object.values(o).filter(Boolean),c=s.some(e=>e.isValidating),l=s.every(e=>e.isValid),u=s.some(e=>e.isTouched),d=s.some(e=>e.isBlurred),f=s.every(e=>e.isDefaultValue),p=u&&a.errorMap?.onMount,m=s.some(e=>e.isDirty),h=!m,g=!!(a.errorMap?.onMount||s.some(e=>e?.errorMap?.onMount)),_=!!c,v=r?.errors??[];(!i||a.errorMap!==i.errorMap)&&(v=Object.values(a.errorMap).reduce((e,t)=>t===void 0?e:t&&Ad(t)?(e.push(t.form),e):(e.push(t),e),[]));let y=v.length===0,b=l&&y,x=this.options.canSubmitWhenInvalid??!1,S=a.submissionAttempts===0&&!u&&!g||!_&&!a.isSubmitting&&b||x,C=a.errorMap;if(p&&(v=v.filter(e=>e!==a.errorMap.onMount),C=Object.assign(C,{onMount:void 0})),r&&i&&r.errorMap===C&&r.fieldMeta===this.fieldMetaDerived.state&&r.errors===v&&r.isFieldsValidating===c&&r.isFieldsValid===l&&r.isFormValid===y&&r.isValid===b&&r.canSubmit===S&&r.isTouched===u&&r.isBlurred===d&&r.isPristine===h&&r.isDefaultValue===f&&r.isDirty===m&&jd(i,a))return r;let w={...a,errorMap:C,fieldMeta:this.fieldMetaDerived.state,errors:v,isFieldsValidating:c,isFieldsValid:l,isFormValid:y,isValid:b,canSubmit:S,isTouched:u,isBlurred:d,isPristine:h,isDefaultValue:f,isDirty:m},T=this.options.transform?.deps??[];if(T.length!==this.prevTransformArray.length||T.some((e,t)=>e!==this.prevTransformArray[t])){let e=Object.assign({},this,{state:w});this.options.transform?.fn(e),w=e.state,this.prevTransformArray=T}return w}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return Wd(e.validate)?Ud[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Yd(e){return e?Ad(e)?{formError:Yd(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function Xd(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;case`change`:default:return`onChange`}}var Zd=class{constructor(e){this.options={},this.mount=()=>{let e=this.store.mount();this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let t=this.getInfo();t.instance=this,this.update(this.options);let{onMount:n}=this.options.validators||{};if(n){let e=this.runValidator({validate:n,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),e},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(jd(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,Pd(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,Pd(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,Pd(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,Pd(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,Pd(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,Pd(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,Pd(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,Pd(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{let t=Object.values(this.form.fieldInfo),n=[];for(let r of t){if(!r.instance)continue;let{onChangeListenTo:t,onBlurListenTo:i}=r.instance.options.validators||{};e===`change`&&t?.includes(this.name)&&n.push(r.instance),e===`blur`&&i?.includes(this.name)&&n.push(r.instance)}return n},this.validateSync=(e,t)=>{let n=Od(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Bd}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=Od(e,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Bd});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;ad(()=>{let e=(e,n)=>{let r=$d(n.cause),a=n.validate?Qd(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=Nd({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=$d(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=kd(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Bd}),r=await t,i=this.getLinkedFields(e),a=i.reduce((t,n)=>{let r=kd(e,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Bd});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),o=[],s=[],c=n.some(e=>e.validate)||a.some(e=>e.validate);if(c){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of i)e.setMeta(e=>({...e,isValidating:!0}))}let l=(e,t,n)=>{let i=$d(t.cause);e.getInfo().validationMetaMap[i]?.lastAbortController.abort();let a=new AbortController;this.getInfo().validationMetaMap[i]={lastAbortController:a},n.push(new Promise(async n=>{let o;try{o=await new Promise((n,r)=>{this.timeoutIds.validations[t.cause]&&clearTimeout(this.timeoutIds.validations[t.cause]),this.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(a.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:a.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){o=e}if(a.signal.aborted)return n(void 0);let s=Qd(o),c=r[this.name]?.[i],{newErrorValue:l,newSource:u}=Nd({formLevelError:c,fieldLevelError:s});e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,o);for(let e of a)e.validate&&l(e.field,e,s);let u=[];if((o.length||s.length)&&(u=await Promise.all(o),await Promise.all(s)),c){this.setMeta(e=>({...e,isValidating:!1}));for(let e of i)e.setMeta(e=>({...e,isValidating:!1}))}return u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e),{hasErrored:r}=this.validateSync(e,n[this.name]??{});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[$d(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e);return this.validateAsync(e,i)},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>Ud.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>Ud.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},this.form=e.form,this.name=e.name,this.options=e,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new cd({deps:[this.form.store],fn:()=>{let t=this.form.getFieldMeta(this.name)??{...Gd,...e.defaultMeta},n=this.form.getFieldValue(this.name);return!t.isTouched&&n===void 0&&this.options.defaultValue!==void 0&&!jd(n,this.options.defaultValue)&&(n=this.options.defaultValue),{value:n,meta:t}}})}get state(){return this.store.state}runValidator(e){return Wd(e.validate)?Ud[e.type](e.value,e.validate):e.validate(e.value)}triggerOnBlurListener(){let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}};function Qd(e){if(e)return e}function $d(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;case`change`:default:return`onChange`}}var ef=class e{constructor(t){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap==`string`)return Ed(this.fieldsMap,e);let t=Td(e)[0];if(typeof t!=`string`)return``;let n=e.slice(t.length),r=this.fieldsMap[t];return Ed(r,n)},this.getFormFieldOptions=e=>{let t={...e},n=t.validators;if(t.name=this.getFormFieldName(e.name),n&&(n.onChangeListenTo||n.onBlurListenTo)){let e={...n},r=e=>{if(e)return e.map(e=>this.getFormFieldName(e))};e.onChangeListenTo=r(n.onChangeListenTo),e.onBlurListenTo=r(n.onBlurListenTo),t.validators=e}return t},this.mount=()=>this.store.mount(),this.validateArrayFieldsStartingFrom=async(e,t,n)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),t,n),this.validateField=(e,t)=>this.form.validateField(this.getFormFieldName(e),t),this.getFieldValue=e=>this.form.getFieldValue(this.getFormFieldName(e)),this.getFieldMeta=e=>this.form.getFieldMeta(this.getFormFieldName(e)),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(this.getFormFieldName(e),t),this.setFieldValue=(e,t,n)=>this.form.setFieldValue(this.getFormFieldName(e),t,n),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,t,n)=>this.form.pushFieldValue(this.getFormFieldName(e),t,n),this.insertFieldValue=async(e,t,n,r)=>this.form.insertFieldValue(this.getFormFieldName(e),t,n,r),this.replaceFieldValue=async(e,t,n,r)=>this.form.replaceFieldValue(this.getFormFieldName(e),t,n,r),this.removeFieldValue=async(e,t,n)=>this.form.removeFieldValue(this.getFormFieldName(e),t,n),this.swapFieldValues=(e,t,n,r)=>this.form.swapFieldValues(this.getFormFieldName(e),t,n,r),this.moveFieldValues=(e,t,n,r)=>this.form.moveFieldValues(this.getFormFieldName(e),t,n,r),this.clearFieldValues=(e,t)=>this.form.clearFieldValues(this.getFormFieldName(e),t),this.resetField=e=>this.form.resetField(this.getFormFieldName(e)),this.validateAllFields=e=>this.form.validateAllFields(e),t.form instanceof e){let e=t.form;if(this.form=e.form,typeof t.fields==`string`)this.fieldsMap=e.getFormFieldName(t.fields);else{let n={...t.fields};for(let t in n)n[t]=e.getFormFieldName(n[t]);this.fieldsMap=n}}else this.form=t.form,this.fieldsMap=t.fields;this.store=new cd({deps:[this.form.store],fn:({currDepVals:e})=>{let t=e[0],n;if(typeof this.fieldsMap==`string`)n=hd(t.values,this.fieldsMap);else{n={};let e=this.fieldsMap;for(let r in e)n[r]=hd(t.values,e[r])}return{values:n}}})}get state(){return this.store.state}async handleSubmit(e){return this.form.handleSubmit(e)}},tf=rl();function nf(e,t=e=>e,n={}){let r=n.equal??rf;return(0,tf.useSyncExternalStoreWithSelector)(e.subscribe,()=>e.state,()=>e.state,t,r)}function rf(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=af(e);if(n.length!==af(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function af(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var of=typeof window<`u`?u.useLayoutEffect:u.useEffect;function sf(e){let[t,n]=(0,u.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,u.useState)(()=>new Zd({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new Zd({...e})),n({form:e.form,name:e.name}));let a=nf(r.store,e.mode===`array`?e=>Object.keys(e.value??[]).length:e=>e.value),o=nf(r.store,e=>e.meta.isTouched),s=nf(r.store,e=>e.meta.isBlurred),c=nf(r.store,e=>e.meta.isDirty),l=nf(r.store,e=>e.meta.errorMap),d=nf(r.store,e=>e.meta.errorSourceMap),f=nf(r.store,e=>e.meta.isValidating),p=(0,u.useMemo)(()=>{let t={...r,get state(){return{value:e.mode===`array`?r.state.value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:d,isValidating:f}}}}};return t.Field=cf,t},[r,e.mode,a,o,s,c,l,d,f]);return of(r.mount,[r]),of(()=>{r.update(e)}),p}var cf=(({children:e,...t})=>{let n=sf(t);return(0,d.jsx)(d.Fragment,{children:(0,u.useMemo)(()=>md(e,n),[e,n])})});function lf(){return(0,u.useState)(()=>Rd())[0]}var uf=u.version.split(`.`)[0]===`17`?lf:u.useId;function df({form:e,selector:t,children:n}){return(0,d.jsx)(d.Fragment,{children:md(n,nf(e.store,t))})}function ff(e){let t=uf(),[n,r]=(0,u.useState)(e?.formId),[i,a]=(0,u.useState)(()=>new Jd({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new Jd({...e,formId:n})),r(n)}let o=(0,u.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,d.jsx)(cf,{...e,form:i})},e.Subscribe=function(e){return(0,d.jsx)(df,{form:i,selector:e.selector,children:e.children})},e},[i]);return of(i.mount,[]),of(()=>{i.update(e)}),o}function pf({lens:e,selector:t,children:n}){return(0,d.jsx)(d.Fragment,{children:md(n,nf(e.store,t))})}function mf(e){let[t]=(0,u.useState)(()=>{let n=new ef(e),r=e.form instanceof ef?e.form.form:e.form,i=n;return i.AppForm=function(e){return(0,d.jsx)(r.AppForm,{...e})},i.AppField=function(e){return(0,d.jsx)(r.AppField,{...t.getFormFieldOptions(e)})},i.Field=function(e){return(0,d.jsx)(r.Field,{...t.getFormFieldOptions(e)})},i.Subscribe=function(e){return(0,d.jsx)(pf,{lens:t,selector:e.selector,children:e.children})},Object.assign(i,{...e.formComponents})});return of(t.mount,[t]),t}var hf=(0,u.createContext)(null),gf=(0,u.createContext)(null);function _f(){function e(){let e=(0,u.useContext)(hf);if(!e)throw Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return e}function t(){let e=(0,u.useContext)(gf);if(!e)throw Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return e}return{fieldContext:hf,useFieldContext:e,useFormContext:t,formContext:gf}}function vf({fieldComponents:e,fieldContext:t,formContext:n,formComponents:r}){function i(i){let a=ff(i),o=(0,u.useMemo)(()=>({children:e})=>(0,d.jsx)(n.Provider,{value:a,children:e}),[a]),s=(0,u.useMemo)(()=>(({children:n,...r})=>(0,d.jsx)(a.Field,{...r,children:r=>(0,d.jsx)(t.Provider,{value:r,children:n(Object.assign(r,e))})})),[a]);return(0,u.useMemo)(()=>Object.assign(a,{AppField:s,AppForm:o,...r}),[a,s,o])}function a({render:e,props:t}){return n=>e({...t,...n})}function o({render:e,props:t,defaultValues:n}){return function(i){let a=mf((0,u.useMemo)(()=>({form:i.form,fields:i.fields,defaultValues:n,formComponents:r}),[i.form,i.fields]));return e({...t,...i,group:a})}}return{useAppForm:i,withForm:a,withFieldGroup:o}}const{fieldContext:yf,useFieldContext:bf,formContext:xf,useFormContext:Sf}=_f(),Cf=e=>{let t=(0,l.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=bf(),s;t[5]===r?s=t[6]:(s=X(``,r),t[5]=r,t[6]=s);let c;t[7]===o.state.meta.errors?c=t[8]:(c=o.state.meta.errors.length>0&&(0,d.jsx)(`div`,{className:`mt-2`,children:o.state.meta.errors.map(wf)}),t[7]=o.state.meta.errors,t[8]=c);let u;return t[9]!==n||t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==c?(u=(0,d.jsxs)(`div`,{className:s,ref:a,...i,children:[n,c]}),t[9]=n,t[10]=i,t[11]=a,t[12]=s,t[13]=c,t[14]=u):u=t[14],u};function wf(e,t){return(0,d.jsx)(`p`,{className:`text-error text-sm`,children:e.message},t)}function Tf(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=ar(),o=hn(t);return K(()=>{if(!(!n&&!t||a===B)){if(n){let e=r?.current;Z(e)&&e.closest(`label`)!=null?a(t??null):a(i??o)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,r,i,a,n,o]),i??o}const Ef=u.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,...d}=e,{state:f,name:p,disabled:m}=Zn(),h=m||s,g=p??a,_=u.useMemo(()=>({...f,disabled:h}),[f,h]),{setTouched:v,setDirty:y,validityData:b,setFocused:x,setFilled:S,validationMode:C,validation:w}=Zn(),{labelId:T}=ar(),E=Tf({id:i});K(()=>{let e=o!=null;w.inputRef.current?.value||e&&o!==``?S(!0):e&&o===``&&S(!1)},[w.inputRef,S,o]);let[D,O]=nn({controlled:o,default:l,name:`FieldControl`,state:`value`}),k=o!==void 0,A=G((e,t)=>{c?.(e,t),!t.isCanceled&&O(e)});return rr({id:E,name:g,commit:w.commit,value:D,getValue:()=>w.inputRef.current?.value,controlRef:w.inputRef}),W(`input`,e,{ref:t,state:_,props:[{id:E,disabled:h,name:g,ref:w.inputRef,"aria-labelledby":T,...k?{value:D}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;A(t,br(ur,e.nativeEvent)),y(t!==b.initialValue),S(t!==``)},onFocus(){x(!0)},onBlur(e){v(!0),x(!1),C===`onBlur`&&w.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(v(!0),w.commit(e.currentTarget.value))}},w.getInputValidationProps(),d],stateAttributesMapping:cn})});process.env.NODE_ENV!==`production`&&(Ef.displayName=`FieldControl`);const Df=u.forwardRef(function(e,t){return(0,d.jsx)(Ef,{ref:t,...e})});process.env.NODE_ENV!==`production`&&(Df.displayName=`Input`);const Of=e=>{let t=(0,l.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(``,r),t[5]=r,t[6]=o);let s;return t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,d.jsx)(`div`,{className:o,ref:a,...i,children:n}),t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s},kf=e=>{let t=(0,l.c)(20),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({leadingIcon:r,showSeparator:o,className:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?!0:o,c=i.disabled,f=i.disabled,p;t[6]===n?p=t[7]:(p=X(`flex items-center gap-xs px-md w-full py-sm group h-xl inset-shadow-2-shadow inset-shadow-sm bg-surface-dim rounded-xl data-[disabled=true]:opacity-50 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:hover:outline-transparent outline-2 outline-transparent hover:not-focus-within:outline-outline focus-within:outline-primary focus-within:caret-primary transition-all`,n),t[6]=n,t[7]=p);let m;t[8]!==r||t[9]!==s?(m=r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:X(`flex items-center text-on-surface-variant justify-center [&>svg]:size-s group-focus-within:text-primary transition-all`),children:(0,u.createElement)(r,{weight:`bold`})}),s&&(0,d.jsx)(Of,{orientation:`vertical`,className:`group-focus-within:bg-primary`})]}),t[8]=r,t[9]=s,t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=X(`outline-none w-full`,`placeholder:opacity-60`,`disabled:text-text-neutral-primary-disabled disabled:cursor-not-allowed`,`overflow-ellipsis`),t[11]=h):h=t[11];let g;t[12]!==i||t[13]!==a?(g=(0,d.jsx)(Df,{className:h,ref:a,...i}),t[12]=i,t[13]=a,t[14]=g):g=t[14];let _;return t[15]!==i.disabled||t[16]!==p||t[17]!==m||t[18]!==g?(_=(0,d.jsxs)(`div`,{"aria-disabled":c,"data-disabled":f,className:p,children:[m,g]}),t[15]=i.disabled,t[16]=p,t[17]=m,t[18]=g,t[19]=_):_=t[19],_},Af=e=>{let t=(0,l.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=bf(),s=o.name,c=o.name,u=o.state.value,f;t[5]===o?f=t[6]:(f=e=>o.handleChange(e.target.value),t[5]=o,t[6]=f);let p;t[7]===o?p=t[8]:(p=o.state.value&&o.getMeta().errors.length>0&&`outline-error`,t[7]=o,t[8]=p);let m;t[9]===o?m=t[10]:(m=o.state.value&&o.getMeta().isValid&&`outline-success`,t[9]=o,t[10]=m);let h;t[11]!==r||t[12]!==p||t[13]!==m?(h=X(p,m,r),t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==n||t[16]!==o.name||t[17]!==o.state.value||t[18]!==i||t[19]!==a||t[20]!==f||t[21]!==h?(g=(0,d.jsx)(kf,{required:!0,type:`text`,id:s,name:c,value:u,onChange:f,className:h,ref:a,...i,children:n}),t[15]=n,t[16]=o.name,t[17]=o.state.value,t[18]=i,t[19]=a,t[20]=f,t[21]=h,t[22]=g):g=t[22],g},jf=e=>{let t=(0,l.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({submittingText:o,className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?`Submitting...`:o,c=Sf(),u;t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==a||t[10]!==s?(u=e=>{let[t,o]=e;return(0,d.jsx)(tn,{type:`submit`,disabled:!t||o,className:X(`w-full`,r),ref:a,...i,children:o?s:n})},t[6]=n,t[7]=r,t[8]=i,t[9]=a,t[10]=s,t[11]=u):u=t[11];let f;return t[12]!==c.Subscribe||t[13]!==u?(f=(0,d.jsx)(c.Subscribe,{selector:Mf,children:u}),t[12]=c.Subscribe,t[13]=u,t[14]=f):f=t[14],f};function Mf(e){return[e.canSubmit,e.isSubmitting]}const Nf=e=>{let t=(0,l.c)(17),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=nf(Sf().store,Pf),s;t[5]===r?s=t[6]:(s=X(``,r),t[5]=r,t[6]=s);let c;t[7]===o?c=t[8]:(c=o.map(Ff),t[7]=o,t[8]=c);let u;t[9]===c?u=t[10]:(u=(0,d.jsx)(`div`,{className:`mt-2`,children:c}),t[9]=c,t[10]=u);let f;return t[11]!==n||t[12]!==i||t[13]!==a||t[14]!==s||t[15]!==u?(f=(0,d.jsxs)(`div`,{className:s,ref:a,...i,children:[n,u]}),t[11]=n,t[12]=i,t[13]=a,t[14]=s,t[15]=u,t[16]=f):f=t[16],f};function Pf(e){return e.errors}function Ff(e,t){return(0,d.jsx)(`p`,{className:`text-error text-sm`,children:e.message},t)}const If=vf({fieldComponents:{FieldErrors:Cf,FieldInput:Af},formComponents:{FormErrors:Nf,FormSubmit:jf},fieldContext:yf,formContext:xf}),Lf=e=>{let t=(0,l.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(`hover:cursor-pointer`,r),t[5]=r,t[6]=o);let s;return t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,d.jsx)(`label`,{"data-slot":`label`,className:o,ref:a,...i,children:n}),t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s},Rf=e=>{let t=(0,l.c)(36),n,r,i,a,o,s,c,u,f;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],u=t[8],f=t[9]):({className:r,imageUrl:a,fallbackText:i,profileName:c,profileEmail:u,compact:f,children:n,ref:s,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=u,t[9]=f);let p=c===void 0?``:c,m=u===void 0?``:u,h=f===void 0?!1:f,g;t[10]===r?g=t[11]:(g=X(`flex items-center gap-xs transition-colors`,r),t[10]=r,t[11]=g);let _;t[12]===a?_=t[13]:(_=(0,d.jsx)(qt,{src:a}),t[12]=a,t[13]=_);let v;t[14]===i?v=t[15]:(v=(0,d.jsx)(Jt,{children:i}),t[14]=i,t[15]=v);let y;t[16]!==n||t[17]!==_||t[18]!==v?(y=(0,d.jsxs)(Kt,{children:[_,v,n]}),t[16]=n,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=h&&`hidden`,x;t[20]===b?x=t[21]:(x=X(`flex flex-col justify-start items-start`,b),t[20]=b,t[21]=x);let S;t[22]===p?S=t[23]:(S=(0,d.jsx)(`span`,{className:`text-prose-0`,children:p}),t[22]=p,t[23]=S);let C;t[24]===m?C=t[25]:(C=(0,d.jsx)(`span`,{className:`text-on-surface-variant text-prose--1`,children:m}),t[24]=m,t[25]=C);let w;t[26]!==S||t[27]!==C||t[28]!==x?(w=(0,d.jsxs)(`div`,{className:x,children:[S,C]}),t[26]=S,t[27]=C,t[28]=x,t[29]=w):w=t[29];let T;return t[30]!==o||t[31]!==s||t[32]!==w||t[33]!==g||t[34]!==y?(T=(0,d.jsxs)(`button`,{className:g,ref:s,...o,children:[y,w]}),t[30]=o,t[31]=s,t[32]=w,t[33]=g,t[34]=y,t[35]=T):T=t[35],T},zf=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(zf.displayName=`ScrollAreaRootContext`);function Bf(){let e=u.useContext(zf);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(53):`Base UI: ScrollAreaRootContext is missing. ScrollArea parts must be placed within <ScrollArea.Root>.`);return e}let Vf=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});const Hf=500,Uf=16;function Wf(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}let Gf=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({});var Kf=`base-ui-disable-scrollbar`;const qf={className:Kf,element:(0,d.jsx)(`style`,{href:Kf,precedence:`base-ui:low`,children:`.${Kf}{scrollbar-width:none}.${Kf}::-webkit-scrollbar{display:none}`})};let Jf=function(e){return e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({});const Yf={hasOverflowX:e=>e?{[Jf.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[Jf.hasOverflowY]:``}:null,overflowXStart:e=>e?{[Jf.overflowXStart]:``}:null,overflowXEnd:e=>e?{[Jf.overflowXEnd]:``}:null,overflowYStart:e=>e?{[Jf.overflowYStart]:``}:null,overflowYEnd:e=>e?{[Jf.overflowYEnd]:``}:null,cornerHidden:()=>null};var Xf={width:0,height:0},Zf={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1};const Qf=u.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...a}=e,[o,s]=u.useState(!1),[c,l]=u.useState(!1),[f,p]=u.useState(!1),[m,h]=u.useState(Xf),[g,_]=u.useState(Xf),[v,y]=u.useState(!1),[b,x]=u.useState(Zf),S=hn(),C=u.useRef(null),w=u.useRef(null),T=u.useRef(null),E=u.useRef(null),D=u.useRef(null),O=u.useRef(null),k=u.useRef(null),A=u.useRef(!1),j=u.useRef(0),M=u.useRef(0),N=u.useRef(0),P=u.useRef(0),F=u.useRef(`vertical`),ee=Se(),I=Se(),L=u.useRef({x:0,y:0}),[R,z]=u.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),B=$f(i),te=G(e=>{let t=e.x-L.current.x,n=e.y-L.current.y;L.current=e,n!==0&&(p(!0),ee.start(500,()=>{p(!1)})),t!==0&&(l(!0),I.start(500,()=>{l(!1)}))}),V=G(e=>{e.button===0&&(A.current=!0,j.current=e.clientY,M.current=e.clientX,F.current=e.currentTarget.getAttribute(Gf.orientation),w.current&&(N.current=w.current.scrollTop,P.current=w.current.scrollLeft),D.current&&F.current===`vertical`&&D.current.setPointerCapture(e.pointerId),O.current&&F.current===`horizontal`&&O.current.setPointerCapture(e.pointerId))}),ne=G(e=>{if(!A.current)return;let t=e.clientY-j.current,n=e.clientX-M.current;if(w.current){let r=w.current.scrollHeight,i=w.current.clientHeight,a=w.current.scrollWidth,o=w.current.clientWidth;if(D.current&&T.current&&F.current===`vertical`){let n=Wf(T.current,`padding`,`y`),a=Wf(D.current,`margin`,`y`),o=D.current.offsetHeight,s=t/(T.current.offsetHeight-o-n-a);w.current.scrollTop=N.current+s*(r-i),e.preventDefault(),p(!0),ee.start(500,()=>{p(!1)})}if(O.current&&E.current&&F.current===`horizontal`){let t=Wf(E.current,`padding`,`x`),r=Wf(O.current,`margin`,`x`),i=O.current.offsetWidth,s=n/(E.current.offsetWidth-i-t-r);w.current.scrollLeft=P.current+s*(a-o),e.preventDefault(),l(!0),I.start(500,()=>{l(!1)})}}}),H=G(e=>{A.current=!1,D.current&&F.current===`vertical`&&D.current.releasePointerCapture(e.pointerId),O.current&&F.current===`horizontal`&&O.current.releasePointerCapture(e.pointerId)});function re(e){let t=e.pointerType===`touch`;y(t),t||s(Q(C.current,e.target))}let U=u.useMemo(()=>({hasOverflowX:!R.scrollbarXHidden,hasOverflowY:!R.scrollbarYHidden,overflowXStart:b.xStart,overflowXEnd:b.xEnd,overflowYStart:b.yStart,overflowYEnd:b.yEnd,cornerHidden:R.cornerHidden}),[R.scrollbarXHidden,R.scrollbarYHidden,R.cornerHidden,b]),ie={role:`presentation`,onPointerEnter:re,onPointerMove:re,onPointerDown({pointerType:e}){y(e===`touch`)},onPointerLeave(){s(!1)},style:{position:`relative`,[Vf.scrollAreaCornerHeight]:`${m.height}px`,[Vf.scrollAreaCornerWidth]:`${m.width}px`}},ae=W(`div`,e,{state:U,ref:[t,C],props:[ie,a],stateAttributesMapping:Yf}),oe=u.useMemo(()=>({handlePointerDown:V,handlePointerMove:ne,handlePointerUp:H,handleScroll:te,cornerSize:m,setCornerSize:h,thumbSize:g,setThumbSize:_,touchModality:v,cornerRef:k,scrollingX:c,setScrollingX:l,scrollingY:f,setScrollingY:p,hovering:o,setHovering:s,viewportRef:w,rootRef:C,scrollbarYRef:T,scrollbarXRef:E,thumbYRef:D,thumbXRef:O,rootId:S,hiddenState:R,setHiddenState:z,overflowEdges:b,setOverflowEdges:x,viewportState:U,overflowEdgeThreshold:B}),[V,ne,H,te,m,g,v,k,c,l,f,p,o,s,w,C,T,E,D,O,S,R,b,U,B]);return(0,d.jsxs)(zf.Provider,{value:oe,children:[qf.element,ae]})});process.env.NODE_ENV!==`production`&&(Qf.displayName=`ScrollAreaRoot`);function $f(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}const ep=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(ep.displayName=`ScrollAreaViewportContext`);const tp=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(tp.displayName=`DirectionContext`);function np(){return u.useContext(tp)?.direction??`ltr`}function rp(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function ip(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}let ap=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({});var op=!1;function sp(){op||gi||(typeof CSS<`u`&&`registerProperty`in CSS&&[ap.scrollAreaOverflowXStart,ap.scrollAreaOverflowXEnd,ap.scrollAreaOverflowYStart,ap.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),op=!0)}const cp=u.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:a,scrollbarYRef:o,scrollbarXRef:s,thumbYRef:c,thumbXRef:l,cornerRef:p,setCornerSize:m,setThumbSize:h,rootId:g,setHiddenState:_,hiddenState:v,handleScroll:y,setHovering:b,setOverflowEdges:x,overflowEdges:S,overflowEdgeThreshold:C}=Bf(),w=np(),T=u.useRef(!0),E=Se(),D=Se();function O(){let e=a.current,t=o.current,n=s.current,r=c.current,i=l.current,u=p.current;if(!e)return;let d=e.scrollHeight,f=e.scrollWidth,g=e.clientHeight,v=e.clientWidth,y=e.scrollTop,b=e.scrollLeft;if(d===0||f===0)return;let S=g>=d,T=v>=f,E=v/f,D=g/d,O=Math.max(0,f-v),k=Math.max(0,d-g),A=0,j=0;T||(A=rp(w===`rtl`?-b:b,0,O),j=O-A);let M=S?0:rp(y,0,k),N=S?0:k-M,P=T?0:v,F=S?0:g,ee=Wf(n,`padding`,`x`),I=Wf(t,`padding`,`y`),L=Wf(i,`margin`,`x`),R=Wf(r,`margin`,`y`),z=P-ee-L,B=F-I-R,te=n?Math.min(n.offsetWidth,z):z,V=t?Math.min(t.offsetHeight,B):B,ne=Math.max(16,te*E),H=Math.max(16,V*D);if(h(e=>e.height===H&&e.width===ne?e:{width:ne,height:H}),t&&r){let e=t.offsetHeight-H-I-R,n=d-g,i=n===0?0:y/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-ne-ee-L,t=f-v,r=t===0?0:b/t,a=w===`rtl`?rp(r*e,-e,0):rp(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let re=rp(A,0,O),U=rp(j,0,O),W=rp(M,0,k),ie=rp(N,0,k),ae=[[ap.scrollAreaOverflowXStart,re],[ap.scrollAreaOverflowXEnd,U],[ap.scrollAreaOverflowYStart,W],[ap.scrollAreaOverflowYEnd,ie]];for(let[t,n]of ae)e.style.setProperty(t,`${n}px`);u&&(T||S?m({width:0,height:0}):!T&&!S&&m({width:t?.offsetWidth||0,height:n?.offsetHeight||0})),_(e=>{let t=S||T;return e.scrollbarYHidden===S&&e.scrollbarXHidden===T&&e.cornerHidden===t?e:{scrollbarYHidden:S,scrollbarXHidden:T,cornerHidden:t}});let oe={xStart:!T&&re>C.xStart,xEnd:!T&&U>C.xEnd,yStart:!S&&W>C.yStart,yEnd:!S&&ie>C.yEnd};x(e=>e.xStart===oe.xStart&&e.xEnd===oe.xEnd&&e.yStart===oe.yStart&&e.yEnd===oe.yEnd?e:oe)}let k=G(()=>{f.flushSync(O)});K(()=>{if(a.current)return sp(),ip(a.current,k)},[k,a]),K(()=>{queueMicrotask(k)},[k,v,w]),K(()=>{a.current?.matches(`:hover`)&&b(!0)},[a,b]),u.useEffect(()=>{let e=a.current;if(typeof ResizeObserver>`u`||!e)return;let t=new ResizeObserver(k);return t.observe(e),D.start(0,()=>{Promise.all(e.getAnimations({subtree:!0}).map(e=>e.finished)).then(k).catch(()=>{})}),()=>{t.disconnect(),D.clear()}},[k,a,D]);function A(){T.current=!1}let j={role:`presentation`,...g&&{"data-id":`${g}-viewport`},...(!v.scrollbarXHidden||!v.scrollbarYHidden)&&{tabIndex:0},className:qf.className,style:{overflow:`scroll`},onScroll(){a.current&&(k(),T.current||y({x:a.current.scrollLeft,y:a.current.scrollTop}),E.start(100,()=>{T.current=!0}))},onWheel:A,onTouchMove:A,onPointerMove:A,onPointerEnter:A,onKeyDown:A},M=u.useMemo(()=>({hasOverflowX:!v.scrollbarXHidden,hasOverflowY:!v.scrollbarYHidden,overflowXStart:S.xStart,overflowXEnd:S.xEnd,overflowYStart:S.yStart,overflowYEnd:S.yEnd,cornerHidden:v.cornerHidden}),[v.scrollbarXHidden,v.scrollbarYHidden,v.cornerHidden,S]),N=W(`div`,e,{ref:[t,a],state:M,props:[j,i],stateAttributesMapping:Yf}),P=u.useMemo(()=>({computeThumbPosition:k}),[k]);return(0,d.jsx)(ep.Provider,{value:P,children:N})});process.env.NODE_ENV!==`production`&&(cp.displayName=`ScrollAreaViewport`);const lp=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(lp.displayName=`ScrollAreaScrollbarContext`);function up(){let e=u.useContext(lp);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(54):`Base UI: ScrollAreaScrollbarContext is missing. ScrollAreaScrollbar parts must be placed within <ScrollArea.Scrollbar>.`);return e}let dp=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({});const fp=u.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...o}=e,{hovering:s,scrollingX:c,scrollingY:l,hiddenState:f,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:h,viewportRef:g,thumbYRef:_,thumbXRef:v,handlePointerDown:y,handlePointerUp:b,rootId:x,thumbSize:S}=Bf(),C=u.useMemo(()=>({hovering:s,scrolling:{horizontal:c,vertical:l}[i],orientation:i,hasOverflowX:!f.scrollbarXHidden,hasOverflowY:!f.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:f.cornerHidden}),[s,c,l,i,f,p]),w=np();u.useEffect(()=>{let e=g.current,t=i===`vertical`?m.current:h.current;if(!t)return;function n(n){if(!(!e||!t||n.ctrlKey)){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,h,m,g]);let T={...x&&{"data-id":`${x}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&g.current){if(_.current&&m.current&&i===`vertical`){let t=Wf(_.current,`margin`,`y`),n=Wf(m.current,`padding`,`y`),r=_.current.offsetHeight,i=m.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=g.current.scrollHeight,s=g.current.clientHeight,c=a/(m.current.offsetHeight-r-n-t)*(o-s);g.current.scrollTop=c}if(v.current&&h.current&&i===`horizontal`){let t=Wf(v.current,`margin`,`x`),n=Wf(h.current,`padding`,`x`),r=v.current.offsetWidth,i=h.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=g.current.scrollWidth,s=g.current.clientWidth,c=a/(h.current.offsetWidth-r-n-t),l;w===`rtl`?(l=(1-c)*(o-s),g.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),g.current.scrollLeft=l}y(e)}},onPointerUp:b,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,...i===`vertical`&&{top:0,bottom:`var(${Vf.scrollAreaCornerHeight})`,insetInlineEnd:0,[dp.scrollAreaThumbHeight]:`${S.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${Vf.scrollAreaCornerWidth})`,bottom:0,[dp.scrollAreaThumbWidth]:`${S.width}px`}}},E=W(`div`,e,{ref:[t,i===`vertical`?m:h],state:C,props:[T,o],stateAttributesMapping:Yf}),D=u.useMemo(()=>({orientation:i}),[i]),O=i===`vertical`?f.scrollbarYHidden:f.scrollbarXHidden;return a||!O?(0,d.jsx)(lp.Provider,{value:D,children:E}):null});process.env.NODE_ENV!==`production`&&(fp.displayName=`ScrollAreaScrollbar`);const pp=u.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:o,handlePointerDown:s,handlePointerMove:c,handlePointerUp:l,setScrollingX:d,setScrollingY:f}=Bf(),{orientation:p}=up(),m=u.useMemo(()=>({orientation:p}),[p]);return W(`div`,e,{ref:[t,p===`vertical`?a:o],state:m,props:[{onPointerDown:s,onPointerMove:c,onPointerUp(e){p===`vertical`&&f(!1),p===`horizontal`&&d(!1),l(e)},style:{...p===`vertical`&&{height:`var(${dp.scrollAreaThumbHeight})`},...p===`horizontal`&&{width:`var(${dp.scrollAreaThumbWidth})`}}},i]})});process.env.NODE_ENV!==`production`&&(pp.displayName=`ScrollAreaThumb`);const mp=u.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:o,hiddenState:s}=Bf(),c=W(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},i]});return s.cornerHidden?null:c});process.env.NODE_ENV!==`production`&&(mp.displayName=`ScrollAreaCorner`);const hp=e=>{let t=(0,l.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({orientation:o,className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?`vertical`:o,c=s===`horizontal`&&`h-full`,u;t[6]!==r||t[7]!==c?(u=X(`h-[200px] rounded-lg bg-surface-container`,c,r),t[6]=r,t[7]=c,t[8]=u):u=t[8];let f;t[9]===n?f=t[10]:(f=(0,d.jsx)(cp,{className:`h-full overscroll-contain flex flex-col gap-xs py-2xs pr-sm pl-sm prose-step-0`,children:n}),t[9]=n,t[10]=f);let p=s===`vertical`&&`w-2xs mr-2xs my-2xs`,m=s===`horizontal`&&`h-2xs flex-col mb-2xs mx-xs`,h;t[11]!==r||t[12]!==p||t[13]!==m?(h=X(`inset-shadow-1-shadow flex justify-center rounded p-[2px] bg-surface-dim opacity-0 transition-opacity delay-300 data-hovering:opacity-100 data-hovering:delay-0 data-hovering:duration-75 data-scrolling:opacity-100 data-scrolling:delay-0 data-scrolling:duration-75 hover:cursor-pointer`,p,m,r),t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,d.jsx)(pp,{className:`w-full h-full rounded-full bg-accent rounded-1`}),t[15]=g):g=t[15];let _;t[16]!==s||t[17]!==h?(_=(0,d.jsx)(fp,{orientation:s,className:h,children:g}),t[16]=s,t[17]=h,t[18]=_):_=t[18];let v;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,d.jsx)(mp,{}),t[19]=v):v=t[19];let y;return t[20]!==i||t[21]!==a||t[22]!==u||t[23]!==f||t[24]!==_?(y=(0,d.jsxs)(Qf,{className:u,ref:a,...i,children:[f,_,v]}),t[20]=i,t[21]=a,t[22]=u,t[23]=f,t[24]=_,t[25]=y):y=t[25],y},gp=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(gp.displayName=`TooltipRootContext`);function _p(e){let t=u.useContext(gp);if(t===void 0&&!e)throw Error(process.env.NODE_ENV===`production`?p(72):`Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.`);return t}var vp={...Sl,disabled:$(e=>e.disabled),instantType:$(e=>e.instantType),isInstantPhase:$(e=>e.isInstantPhase),trackCursorAxis:$(e=>e.trackCursorAxis),disableHoverablePopup:$(e=>e.disableHoverablePopup),lastOpenChangeReason:$(e=>e.openChangeReason),closeDelay:$(e=>e.closeDelay)},yp=class e extends dl{constructor(e){super({...bp(),...e},{popupRef:u.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new yl},vp)}setOpen=(e,t)=>{let n=t.reason,r=n===fr,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?f.flushSync(o):o()};static useStore(t,n){let r=h(()=>t??new e(n)).current,i=Tl({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}};function bp(){return{...xl(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function xp(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:f,defaultTriggerId:p=null,children:m}=e,h=yp.useStore(l?.store,{open:r??n,activeTriggerId:f===void 0?p:f});h.useControlledProp(`open`,r,n),h.useControlledProp(`activeTriggerId`,f,p),h.useContextCallback(`onOpenChange`,s),h.useContextCallback(`onOpenChangeComplete`,c);let g=h.useState(`open`),_=h.useState(`activeTriggerId`),v=h.useState(`payload`);h.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});let y=!t&&g;K(()=>{g&&t&&h.setOpen(!1,br(`disabled`))},[g,t,h]),h.useSyncedValue(`disabled`,t),_l(h);let{forceUnmount:b,transitionStatus:x}=vl(y,h),S=h.useState(`isInstantPhase`),C=h.useState(`instantType`),w=h.useState(`lastOpenChangeReason`),T=u.useRef(null);K(()=>{x===`ending`&&w===`none`||x!==`ending`&&S?(C!==`delay`&&(T.current=C),h.set(`instantType`,`delay`)):T.current!==null&&(h.set(`instantType`,T.current),T.current=null)},[x,S,w,C,h]),K(()=>{y&&(_??h.set(`payload`,void 0))},[h,_,y]);let E=u.useCallback(()=>{h.setOpen(!1,Sp(h,yr))},[h]);u.useImperativeHandle(o,()=>({unmount:b,close:E}),[b,E]);let D=h.useState(`floatingRootContext`),{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=Rl([Dl(D,{enabled:!t}),wc(D,{enabled:!t,referencePress:!0}),fs(D,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=u.useMemo(()=>O(),[O]),M=u.useMemo(()=>A(),[A]),N=u.useMemo(()=>k(),[k]);return h.useSyncedValues({floatingRootContext:D,activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,d.jsx)(gp.Provider,{value:h,children:typeof m==`function`?m({payload:v}):m})}function Sp(e,t){let n=br(t);return n.preventUnmountOnClose=()=>{e.set(`preventUnmountingOnClose`,!0)},n}const Cp=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(Cp.displayName=`TooltipProviderContext`);function wp(){return u.useContext(Cp)}const Tp=600,Ep=u.forwardRef(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeDelay:c,id:l,...d}=e,f=_p(!0),m=i?.store??f;if(!m)throw Error(process.env.NODE_ENV===`production`?p(82):`Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle.`);let h=hn(l),g=m.useState(`isTriggerActive`,h),_=m.useState(`floatingRootContext`),v=m.useState(`isOpenedByTrigger`,h),y=u.useRef(null),b=s??600,x=c??0,{registerTrigger:S,isMountedByThisTrigger:C}=gl(h,y,m,{payload:a,closeDelay:x}),w=wp(),{delayRef:T,isInstantPhase:E,hasProvider:D}=Po(_,{open:v});m.useSyncedValue(`isInstantPhase`,E);let O=m.useState(`disabled`),k=o??O,A=m.useState(`trackCursorAxis`),j=m.useState(`disableHoverablePopup`),M=Ll(_,{enabled:!k,mouseOnly:!0,move:!1,handleClose:!j&&A!==`both`?Gl():null,restMs(){let e=w?.delay,t=typeof T.current==`object`?T.current.open:void 0,n=b;return D&&(n=t===0?0:s??e??b),n},delay(){let e=typeof T.current==`object`?T.current.close:void 0,t=x;return c==null&&D&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g}),N=u.useMemo(()=>({open:v}),[v]),P=m.useState(`triggerProps`,C);return W(`button`,e,{state:N,ref:[t,S,y],props:[M,P,{id:h},d],stateAttributesMapping:oi})});process.env.NODE_ENV!==`production`&&(Ep.displayName=`TooltipTrigger`);const Dp=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(Dp.displayName=`TooltipPortalContext`);function Op(){let e=u.useContext(Dp);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(70):`Base UI: <Tooltip.Portal> is missing.`);return e}const kp=u.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,...o}=e,{portalNode:s,portalSubtree:c}=Zo({container:r,ref:t,componentProps:e,elementProps:o});return!c&&!s?null:(0,d.jsxs)(u.Fragment,{children:[c,s&&f.createPortal(n,s)]})});process.env.NODE_ENV!==`production`&&(kp.displayName=`FloatingPortalLite`);const Ap=u.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return _p().useState(`mounted`)||n?(0,d.jsx)(Dp.Provider,{value:n,children:(0,d.jsx)(kp,{ref:t,...r})}):null});process.env.NODE_ENV!==`production`&&(Ap.displayName=`TooltipPortal`);const jp=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(jp.displayName=`TooltipPositionerContext`);function Mp(){let e=u.useContext(jp);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(71):`Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.`);return e}const Np=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=sa(e,t)||{};if(l==null)return{};let f=Ea(u),p={x:n,y:r},m=ma(i),h=da(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=oa(k,j,A),N=!c.arrow&&la(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Pp=(e,t)=>({...Np(e),options:[e,t]}),Fp={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await xc().fn(e)).data?.referenceHidden||a}}}},Ip={sideX:`left`,sideY:`top`},Lp={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=vn(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Ip};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Fo(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=ca(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Ip.sideX,g=f===`top`?`bottom`:Ip.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Rp(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function zp(e,t,n){let{rects:r,placement:i}=e;return{side:Rp(t,ca(i),n),align:la(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Bp(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:v,adaptiveOrigin:y,lazyFlip:b=!1,externalTree:x}=e,[S,C]=u.useState(null);!h&&S!==null&&C(null);let w=g.side||`flip`,T=g.align||`flip`,E=g.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=G(D),k=D?O:t,A=wr(t),j=np()===`rtl`,M=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":j?`left`:`right`,"inline-start":j?`right`:`left`}[r],N=a===`center`?M:`${M}-${a}`,P=c,F=r===`bottom`?1:0,ee=r===`top`?1:0,I=r===`right`?1:0,L=r===`left`?1:0;typeof P==`number`?P={top:P+F,right:P+L,bottom:P+ee,left:P+I}:P&&={top:(P.top||0)+F,right:(P.right||0)+L,bottom:(P.bottom||0)+ee,left:(P.left||0)+I};let R={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:P},z=u.useRef(null),B=wr(i),te=wr(o),V=[gc(e=>{let t=zp(e,r,j),n=typeof B.current==`function`?B.current(t):B.current,i=typeof te.current==`function`?te.current(t):te.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,j,r])],ne=T===`none`&&w!==`shift`,H=!ne&&(l||_||w===`shift`),re=w===`none`?null:yc({...R,padding:{top:P.top+1,right:P.right+1,bottom:P.bottom+1,left:P.left+1},mainAxis:!_&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),U=ne?null:_c(e=>{let t=Fo(e.elements.floating).documentElement;return{...R,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:H,limiter:l||_?void 0:vc(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=pa(ca(e.placement)),i=r===`y`?t:n,a=r===`y`?P.left+P.right:P.top+P.bottom;return{offset:i/2+a/2}})}},[R,l,_,P,T]);w===`shift`||T===`shift`||a===`center`?V.push(U,re):V.push(re,U),V.push(bc({...R,apply({elements:{floating:e},rects:{reference:t},availableWidth:n,availableHeight:r}){Object.entries({"--available-width":`${n}px`,"--available-height":`${r}px`,"--anchor-width":`${t.width}px`,"--anchor-height":`${t.height}px`}).forEach(([t,n])=>{e.style.setProperty(t,n)})}}),Pp(()=>({element:z.current||document.createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=ca(a),l=pa(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(zp(e,r,j)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,H&&l===`y`&&b?S:x),{}}},Fp,y),K(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[h,m]);let W=u.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:ie,elements:ae,x:oe,y:se,middlewareData:ce,update:le,placement:ue,context:de,isPositioned:fe,floatingStyles:pe}=wl({rootContext:m,placement:N,middleware:V,strategy:n,whileElementsMounted:p?void 0:(...e)=>nc(...e,W),nodeId:v,externalTree:x}),{sideX:me,sideY:he}=ce.adaptiveOrigin||Ip,ge=fe?n:`fixed`,_e=u.useMemo(()=>y?{position:ge,[me]:oe,[he]:se}:{position:ge,...pe},[y,ge,me,oe,he,se,pe]),ve=u.useRef(null);K(()=>{if(!h)return;let e=A.current,t=typeof e==`function`?e():e,n=(Vp(t)?t.current:t)||null;n!==ve.current&&(ie.setPositionReference(n),ve.current=n)},[h,ie,k,A]),u.useEffect(()=>{if(!h)return;let e=A.current;typeof e!=`function`&&Vp(e)&&e.current!==ve.current&&(ie.setPositionReference(e.current),ve.current=e.current)},[h,ie,k,A]),u.useEffect(()=>{if(p&&h&&ae.domReference&&ae.floating)return nc(ae.domReference,ae.floating,le,W)},[p,h,ae,le,W]);let ye=ca(ue),be=Rp(r,ye,j),xe=la(ue)||`center`,Se=!!ce.hide?.referenceHidden;K(()=>{b&&h&&fe&&C(ye)},[b,h,fe,ye]);let Ce=u.useMemo(()=>({position:`absolute`,top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),we=ce.arrow?.centerOffset!==0;return u.useMemo(()=>({positionerStyles:_e,arrowStyles:Ce,arrowRef:z,arrowUncentered:we,side:be,align:xe,physicalSide:ye,anchorHidden:Se,refs:ie,context:de,isPositioned:fe,update:le}),[_e,Ce,z,we,be,xe,ye,Se,ie,de,fe,le])}function Vp(e){return e!=null&&`current`in e}function Hp(e){return e===`starting`?ne:V}const Up=u.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:h=!1,disableAnchorTracking:g=!1,collisionAvoidance:_=re,...v}=e,y=_p(),b=Op(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=Bp({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:f,collisionPadding:p,sticky:h,arrowPadding:m,disableAnchorTracking:g,keepMounted:b,collisionAvoidance:_,adaptiveOrigin:Lp}),k=u.useMemo(()=>{let e={};return(!x||C===`both`||w)&&(e.pointerEvents=`none`),{role:`presentation`,hidden:!S,style:{...O.positionerStyles,...e}}},[x,C,w,S,O.positionerStyles]),A=u.useMemo(()=>({open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[x,O.side,O.align,O.anchorHidden,C,E]),j=u.useMemo(()=>({...A,arrowRef:O.arrowRef,arrowStyles:O.arrowStyles,arrowUncentered:O.arrowUncentered}),[A,O.arrowRef,O.arrowStyles,O.arrowUncentered]),M=W(`div`,e,{state:A,props:[k,Hp(D),v],ref:[t,y.useStateSetter(`positionerElement`)],stateAttributesMapping:si});return(0,d.jsx)(jp.Provider,{value:j,children:M})});process.env.NODE_ENV!==`production`&&(Up.displayName=`TooltipPositioner`);function Wp(e){let t=Ln(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=xn(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(ta(n)!==a||ta(r)!==o)&&(n=a,r=o),{width:n,height:r}}var Gp=typeof ResizeObserver<`u`,Kp=()=>!0;function qp(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=Kp,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:l}=e,d=u.useRef(!0),f=Nr(t,!0,!1),p=jr(),m=u.useRef(null),h=G(o),g=G(s),_=u.useMemo(()=>{let e=c===`top`,t=c===`left`;return l===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:V},[c,l]);K(()=>{if(!i||!a()||!Gp){d.current=!0,m.current=null;return}if(!t||!n)return;Object.entries(_).forEach(([e,n])=>{t.style.setProperty(e,n)});let e=new ResizeObserver(e=>{let t=e[0];t&&(m.current===null?m.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)}:(m.current.width=Math.ceil(t.borderBoxSize[0].inlineSize),m.current.height=Math.ceil(t.borderBoxSize[0].blockSize)))});e.observe(t),t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`);let r=Jp(t,`position`,`static`),o=Jp(t,`transform`,`none`),s=Jp(t,`scale`,`1`),c=Jp(n,`--available-width`,`max-content`),l=Jp(n,`--available-height`,`max-content`);if(h?.(),d.current||m.current===null){n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let i=Wp(t);return n.style.setProperty(`--positioner-width`,`${i.width}px`),n.style.setProperty(`--positioner-height`,`${i.height}px`),r(),o(),s(),c(),l(),g?.(null,i),d.current=!1,()=>{e.disconnect()}}t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`),n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let u=Wp(t);t.style.setProperty(`--popup-width`,`${m.current.width}px`),t.style.setProperty(`--popup-height`,`${m.current.height}px`),r(),o(),c(),l(),g?.(m.current,u),n.style.setProperty(`--positioner-width`,`${u.width}px`),n.style.setProperty(`--positioner-height`,`${u.height}px`);let v=new AbortController;return p.request(()=>{t.style.setProperty(`--popup-width`,`${u.width}px`),t.style.setProperty(`--popup-height`,`${u.height}px`),f(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},v.signal)}),()=>{e.disconnect(),v.abort(),p.cancel()}},[r,t,n,f,p,a,i,h,g,_])}function Jp(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}var Yp={...si,...zr};const Xp=u.forwardRef(function(e,t){let{className:n,render:r,...i}=e,a=_p(),{side:o,align:s}=Mp(),c=a.useState(`open`),l=a.useState(`mounted`),d=a.useState(`instantType`),f=a.useState(`transitionStatus`),p=a.useState(`popupProps`),m=a.useState(`payload`),h=a.useState(`popupElement`),g=a.useState(`positionerElement`),_=a.useState(`floatingRootContext`),v=np();Pr({open:c,ref:a.context.popupRef,onComplete(){c&&a.context.onOpenChangeComplete?.(!0)}});function y(){_.context.events.emit(`measure-layout`)}function b(e,t){_.context.events.emit(`measure-layout-complete`,{previousDimensions:e,nextDimensions:t})}qp({popupElement:h,positionerElement:g,mounted:l,content:m,enabled:u.useCallback(()=>a.context.triggerElements.size>1,[a]),onMeasureLayout:y,onMeasureLayoutComplete:b,side:o,direction:v});let x=a.useState(`disabled`),S=a.useState(`closeDelay`);return Nl(_,{enabled:!x,closeDelay:S}),W(`div`,e,{state:u.useMemo(()=>({open:c,side:o,align:s,instant:d,transitionStatus:f}),[c,o,s,d,f]),ref:[t,a.context.popupRef,a.useStateSetter(`popupElement`)],props:[p,Hp(f),i],stateAttributesMapping:Yp})});process.env.NODE_ENV!==`production`&&(Xp.displayName=`TooltipPopup`);const Zp=u.forwardRef(function(e,t){let{className:n,render:r,...i}=e,a=_p().useState(`instantType`),{open:o,arrowRef:s,side:c,align:l,arrowUncentered:d,arrowStyles:f}=Mp();return W(`div`,e,{state:u.useMemo(()=>({open:o,side:c,align:l,uncentered:d,instant:a}),[o,c,l,d,a]),ref:[t,s],props:[{style:f,"aria-hidden":!0},i],stateAttributesMapping:si})});process.env.NODE_ENV!==`production`&&(Zp.displayName=`TooltipArrow`);const Qp=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=u.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=u.useMemo(()=>({open:t,close:n}),[t,n]);return(0,d.jsx)(Cp.Provider,{value:i,children:(0,d.jsx)(No,{delay:a,timeoutMs:r,children:e.children})})};process.env.NODE_ENV!==`production`&&(Qp.displayName=`TooltipProvider`);const $p=e=>{let t=(0,l.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,d.jsx)(Qp,{children:(0,d.jsx)(xp,{...r,children:n})}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i},em=e=>{let t=(0,l.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,d.jsx)(Ep,{...r,children:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i},tm=e=>{let t=(0,l.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=X(`bg-surface-container-high origin-(--transform-origin) px-xs py-3xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md text-sm text-balance`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(Zp,{className:`data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180`,children:(0,d.jsx)(qr,{weight:`fill`,className:`fill-surface-container-high `})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,d.jsx)(Ap,{children:(0,d.jsx)(Up,{sideOffset:10,children:(0,d.jsxs)(Xp,{className:a,...i,children:[o,n]})})}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s},nm=({sliderInstance:e,isActive:t,onKeyDownHandler:n,onMouseDownHandler:r,onTouchStart:i,value:a,className:o,children:s,ref:c,...l})=>{let[f,p]=(0,u.useState)(!1);return(0,d.jsxs)($p,{open:t||f,trackCursorAxis:`x`,children:[(0,d.jsx)(em,{render:(0,d.jsx)(`button`,{onKeyDown:n,onMouseDown:r,onTouchStart:i,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),role:`slider`,"aria-valuemin":e.options.min,"aria-valuemax":e.options.max,"aria-valuenow":a,style:{left:`${e.getPercentageForValue(a)}%`,zIndex:t?`1`:`0`},className:X(`absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full outline-none border-2 border-primary bg-surface-container hover:cursor-pointer active:border-secondary hover:border-secondary transition-[width,height,border] aspect-square`,t?`size-md shadow-4-shadow`:`size-sm shadow-1-shadow`,o),ref:c,...l,children:s})}),(0,d.jsx)(tm,{children:(0,d.jsx)(`span`,{children:a})})]})},rm=({index:e,steps:t,left:n,width:r,className:i,children:a,ref:o,...s})=>(0,d.jsx)(`div`,{className:X(`absolute bg-primary h-full rounded-full inset-shadow-1-shadow`,i),style:{background:`${e===t-1?`transparent`:`var(--color-primary)`}`,left:`${n}%`,width:`${r}%`},ref:o,...s,children:a}),im=({className:e,children:t,ref:n,...r})=>(0,d.jsx)(`p`,{className:X(`absolute text-[0.6rem] top-full -translate-x-1/2 translate-y-[1.2rem] whitespace-nowrap style-text-default--1 text-on-surface-variant`,e),ref:n,...r,children:t}),am=({percentage:e,className:t,children:n,ref:r,...i})=>(0,d.jsxs)(`div`,{className:X(`absolute top-2xs -translate-x-1/2`,t),ref:r,...i,style:{left:`${e}%`},children:[(0,d.jsx)(`span`,{className:`absolute bg-on-surface-variant rounded-full left-0 h-2xs w-[2px] -translate-x-1/2 translate-y-[0.7rem]`}),n]}),om=({className:e,children:t,sliderRef:n,...r})=>(0,d.jsx)(`div`,{className:X(`relative h-2xs inset-shadow-1-shadow rounded-full bg-surface-dim grow`,e),ref:n,...r,children:t});var sm=e=>{let t=e.getBoundingClientRect();return{left:Math.ceil(t.left),width:Math.ceil(t.width)}},cm=e=>[...e].map(Number).sort((e,t)=>e-t),lm={getPercentageForValue:(e,t,n)=>Math.max(0,Math.min(100,(e-t)/(n-t)*100)),getValueForClientX:(e,t,n,r)=>{let{left:i,width:a}=t,o=(e-i)/a;return(r-n)*o+n}},um=class{constructor(e){this.sortedValues=[],this.rangerElement=null,this._willUpdate=()=>{let e=this.options.getRangerElement();this.rangerElement!==e&&(this.rangerElement=e)},this.getValueForClientX=e=>{let t=sm(this.rangerElement);return this.options.interpolator.getValueForClientX(e,t,this.options.min,this.options.max)},this.getNextStep=(e,t)=>{let{min:n,max:r}=this.options;if(`steps`in this.options){let{steps:n}=this.options,r=n.indexOf(e)+t;return r>=0&&r<n.length?n[r]:e}else{let i=e+this.options.stepSize*t;return i>=n&&i<=r?i:e}},this.roundToStep=e=>{let{min:t,max:n}=this.options,r=t,i=n;if(`steps`in this.options)this.options.steps.forEach(t=>{t<=e&&t>r&&(r=t),t>=e&&t<i&&(i=t)});else{let{stepSize:t}=this.options;for(;r<e&&r+t<e;)r+=t;i=Math.min(r+t,n)}return e-r<i-e?r:i},this.handleDrag=e=>{if(this.activeHandleIndex===void 0)return;let t=e.type===`touchmove`?e.changedTouches[0].clientX:e.clientX,n=this.getValueForClientX(t),r=this.roundToStep(n);this.sortedValues=[...this.options.values.slice(0,this.activeHandleIndex),r,...this.options.values.slice(this.activeHandleIndex+1)],this.options.onDrag?this.options.onDrag(this):(this.tempValues=this.sortedValues,this.options.rerender())},this.handleKeyDown=(e,t)=>{let{values:n}=this.options;if(e.keyCode===37||e.keyCode===39){this.activeHandleIndex=t;let r=e.keyCode===37?-1:1,i=this.getNextStep(n[t],r);this.sortedValues=cm([...n.slice(0,t),i,...n.slice(t+1)]),this.options.onChange&&this.options.onChange(this)}},this.handlePress=(e,t)=>{this.activeHandleIndex=t,this.options.rerender();let n=()=>{let{tempValues:e,handleDrag:t}=this;document.removeEventListener(`mousemove`,t),document.removeEventListener(`touchmove`,t),document.removeEventListener(`mouseup`,n),document.removeEventListener(`touchend`,n),this.sortedValues=cm(e||this.options.values),this.options.onChange&&this.options.onChange(this),this.options.onDrag&&this.options.onDrag(this),this.activeHandleIndex=void 0,this.tempValues=void 0,this.options.rerender()},{handleDrag:r}=this;document.addEventListener(`mousemove`,r),document.addEventListener(`touchmove`,r),document.addEventListener(`mouseup`,n),document.addEventListener(`touchend`,n)},this.getPercentageForValue=e=>this.options.interpolator.getPercentageForValue(e,this.options.min,this.options.max),this.getTicks=()=>{let e=[];if(this.options.ticks)e=[...this.options.ticks];else if(`steps`in this.options)e=[...this.options.steps];else{for(e=[this.options.min];e[e.length-1]<this.options.max-this.options.tickSize;)e.push(e[e.length-1]+this.options.tickSize);e.push(this.options.max)}return e.map((e,t)=>({value:e,key:t,percentage:this.getPercentageForValue(e)}))},this.getSteps=()=>{let e=cm(this.tempValues||this.options.values);return[...e,this.options.max].map((t,n)=>{let r=e[n-1],i=r===void 0?this.options.min:r,a=this.getPercentageForValue(i);return{left:a,width:this.getPercentageForValue(t)-a}})},this.handles=()=>(this.tempValues||this.options.values).map((e,t)=>({value:e,isActive:t===this.activeHandleIndex,onKeyDownHandler:e=>{this.handleKeyDown(e,t)},onMouseDownHandler:e=>{this.handlePress(e,t)},onTouchStart:e=>{this.handlePress(e,t)}})),this.setOptions(e)}setOptions(e){Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,tickSize:10,interpolator:lm,onChange:()=>{},...e}}},dm=typeof window<`u`?u.useLayoutEffect:u.useEffect;function fm(e){let t=u.useReducer(()=>({}),{})[1],n={...e,rerender:t,onChange:n=>{t(),e.onChange?.(n)}},[r]=u.useState(()=>new um(n));return r.setOptions(n),dm(()=>r._willUpdate()),r}const pm=({leadingIcon:e,trailingIcon:t,min:n,max:r,stepSize:i,defaultValues:a,showTickLabels:o,label:s,className:c,ref:l,...f})=>{let p=(0,u.useRef)(null),[m,h]=(0,u.useState)(a||[50]),g=fm({getRangerElement:()=>p.current,values:m,min:n??0,max:r??100,stepSize:i??1,onChange:e=>{h(e.sortedValues)}});return(0,d.jsxs)(`div`,{ref:l,className:X(`space-y-2xs`,c),...f,children:[s&&(0,d.jsx)(`p`,{className:`style-text-default--1 text-on-surface-variant`,children:s}),(0,d.jsxs)(`div`,{className:`flex items-center w-full gap-sm`,children:[e&&(0,d.jsx)(e,{className:`size-sm`,weight:`bold`}),(0,d.jsxs)(om,{sliderRef:p,children:[o&&g.getTicks().map(({value:e,key:t,percentage:n})=>(0,d.jsx)(am,{percentage:n,children:(0,d.jsx)(im,{children:e})},t)),g.getSteps().map(({left:e,width:t},n)=>(0,d.jsx)(rm,{index:n,steps:g.getSteps().length,left:e,width:t},n)),g.handles().map(({isActive:e,onKeyDownHandler:t,onMouseDownHandler:n,onTouchStart:r,value:i},a)=>(0,d.jsx)(nm,{sliderInstance:g,isActive:e,onKeyDownHandler:t,onMouseDownHandler:n,onTouchStart:r,value:i},a))]}),t&&(0,d.jsx)(t,{className:`size-sm`,weight:`bold`})]})]})},mm=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(mm.displayName=`SwitchRootContext`);function hm(){let e=u.useContext(mm);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(63):`Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>.`);return e}let gm=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});const _m={...cn,checked(e){return e?{[gm.checked]:``}:{[gm.unchecked]:``}}},vm=u.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:_,...v}=e,{clearErrors:y}=nr(),{state:b,setTouched:x,setDirty:S,validityData:C,setFilled:w,setFocused:T,shouldValidateOnChange:E,validationMode:D,disabled:O,name:k,validation:j}=Zn(),{labelId:M}=ar(),N=O||m,P=k??s,F=G(l),ee=u.useRef(null),I=g(ee,o,j.inputRef),L=u.useRef(null),R=hn(),z=Tf({id:a,implicit:!1,controlRef:L}),[B,te]=nn({controlled:n,default:!!i,name:`Switch`,state:`checked`});rr({id:R,commit:j.commit,value:B,controlRef:L,name:P,getValue:()=>B}),K(()=>{ee.current&&w(ee.current.checked)},[ee,w]),xr(B,()=>{y(P),S(B!==C.initialValue),w(B),E()?j.commit(B):j.commit(B,!0)});let{getButtonProps:V,buttonRef:ne}=Jn({disabled:N,native:c}),H={id:R,role:`switch`,"aria-checked":B,"aria-readonly":f||void 0,"aria-labelledby":M,onFocus(){N||T(!0)},onBlur(){let e=ee.current;!e||N||(x(!0),T(!1),D===`onBlur`&&j.commit(e.checked))},onClick(e){f||N||(e.preventDefault(),ee?.current?.click())}},re=u.useMemo(()=>A({checked:B,disabled:N,id:z,name:P,required:p,style:rn,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:I,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=br(ur,e.nativeEvent);F?.(t,n),!n.isCanceled&&te(t)},onFocus(){L.current?.focus()}},j.getInputValidationProps),[B,N,I,z,P,F,p,te,j]),U=u.useMemo(()=>({...b,checked:B,disabled:N,readOnly:f,required:p}),[b,B,N,f,p]),ie=W(`span`,e,{state:U,ref:[t,L,ne],props:[H,j.getValidationProps,v,V],stateAttributesMapping:_m});return(0,d.jsxs)(mm.Provider,{value:U,children:[ie,!B&&P&&_!==void 0&&(0,d.jsx)(`input`,{type:`hidden`,name:P,value:_}),(0,d.jsx)(`input`,{...re})]})});process.env.NODE_ENV!==`production`&&(vm.displayName=`SwitchRoot`);const ym=u.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=Zn(),o=hm();return W(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:_m,props:i})});process.env.NODE_ENV!==`production`&&(ym.displayName=`SwitchThumb`);const bm=e=>{let t=(0,l.c)(18),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({label:r,className:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=X(`relative group transition-colors flex items-center h-[26px] w-[50px] rounded-full bg-surface-dim bg-size-[6.5rem_100%] inset-shadow-1-shadow p-0.5 ease-[cubic-bezier(0.26,0.75,0.38,0.45)] before:absolute before:rounded-full data-checked:bg-accent data-checked:active:bg-gray-500 outline-2 outline-transparent not-disabled:hover:outline-accent hover:cursor-pointer disabled:opacity-50 disabled:pointer-events-none`,n),t[5]=n,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,d.jsx)(ym,{className:`size-[14px] data-checked:size-[18px] rounded-full bg-accent transition-transform duration-500 ease-[cubic-bezier(0.68,-0.55,0.27,1.55)] translate-x-[6px] shadow-xs data-checked:translate-x-[26px] data-checked:scale-[1.1] data-unchecked:bg-accent data-checked:bg-on-accent`}),t[7]=s):s=t[7];let c;t[8]!==i||t[9]!==a||t[10]!==o?(c=(0,d.jsx)(vm,{className:o,ref:a,...i,children:s}),t[8]=i,t[9]=a,t[10]=o,t[11]=c):c=t[11];let u;t[12]!==r||t[13]!==i?(u=r&&(0,d.jsx)(Lf,{htmlFor:i.id,children:r}),t[12]=r,t[13]=i,t[14]=u):u=t[14];let f;return t[15]!==c||t[16]!==u?(f=(0,d.jsxs)(`div`,{className:`flex items-center gap-xs`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=f):f=t[17],f},xm=u.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!==`production`&&(xm.displayName=`CompositeListContext`);function Sm(){return u.useContext(xm)}function Cm(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=G(i),o=u.useRef(0),s=h(Tm).current,c=h(wm).current,[l,f]=u.useState(0),p=u.useRef(l),m=G((e,t)=>{c.set(e,t??null),p.current+=1,f(p.current)}),g=G(e=>{c.delete(e),p.current+=1,f(p.current)}),_=u.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Em).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);K(()=>{if(typeof MutationObserver!=`function`||_.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(p.current+=1,f(p.current))});return _.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[_]),K(()=>{p.current===l&&(n.current.length!==_.size&&(n.current.length=_.size),r&&r.current.length!==_.size&&(r.current.length=_.size),o.current=_.size),a(_)},[a,_,n,r,l]),K(()=>()=>{n.current=[]},[n]),K(()=>()=>{r&&(r.current=[])},[r]);let v=G(e=>(s.add(e),()=>{s.delete(e)}));K(()=>{s.forEach(e=>e(_))},[s,_]);let y=u.useMemo(()=>({register:m,unregister:g,subscribeMapChange:v,elementsRef:n,labelsRef:r,nextIndexRef:o}),[m,g,v,n,r,o]);return(0,d.jsx)(xm.Provider,{value:y,children:t})}function wm(){return new Map}function Tm(){return new Set}function Em(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function Dm(e){}const Om=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(Om.displayName=`TabsRootContext`);function km(){let e=u.useContext(Om);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(64):`Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.`);return e}let Am=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({});const jm={tabActivationDirection:e=>({[Am.activationDirection]:e})},Mm=u.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,...c}=e,l=np(),f=Object.hasOwn(e,`defaultValue`),p=u.useRef([]),[m,h]=u.useState(()=>new Map),[g,_]=nn({controlled:s,default:r,name:`Tabs`,state:`value`}),v=s!==void 0,[y,b]=u.useState(()=>new Map),[x,S]=u.useState(`none`),C=G((e,t)=>{i?.(e,t),!t.isCanceled&&(_(e),S(t.activationDirection))}),w=G((e,t)=>{h(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),T=G((e,t)=>{h(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),E=u.useCallback(e=>m.get(e),[m]),D=u.useCallback(e=>{for(let t of y.values())if(e===t?.value)return t?.id},[y]),O=u.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of y.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[y]),k=u.useMemo(()=>({direction:l,getTabElementBySelectedValue:O,getTabIdByPanelValue:D,getTabPanelIdByValue:E,onValueChange:C,orientation:a,registerMountedTabPanel:w,setTabMap:b,unregisterMountedTabPanel:T,tabActivationDirection:x,value:g}),[l,O,D,E,C,a,w,b,T,x,g]),A=u.useMemo(()=>{for(let e of y.values())if(e!=null&&e.value===g)return e},[y,g]),j=u.useMemo(()=>{for(let e of y.values())if(e!=null&&!e.disabled)return e.value},[y]);K(()=>{if(v||y.size===0)return;let e=A?.disabled;if(f&&e&&g===r||!e&&!(A==null&&g!==null))return;let t=j??null;g!==t&&(_(t),S(`none`))},[r,j,f,v,A,S,_,y,g]);let M=W(`div`,e,{state:{orientation:a,tabActivationDirection:x},ref:t,props:c,stateAttributesMapping:jm});return(0,d.jsx)(Om.Provider,{value:k,children:(0,d.jsx)(Cm,{elementsRef:p,children:M})})});process.env.NODE_ENV!==`production`&&(Mm.displayName=`TabsRoot`);const Nm=`data-composite-item-active`;let Pm=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Fm(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:d,nextIndexRef:f}=Sm(),p=u.useRef(-1),[m,h]=u.useState(a??(i===Pm.GuessFromOrder?()=>{if(p.current===-1){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),g=u.useRef(null),_=u.useCallback(e=>{if(g.current=e,m!==-1&&e!==null&&(l.current[m]=e,d)){let n=t!==void 0;d.current[m]=n?t:r?.current?.textContent??e.textContent}},[m,l,d,t,r]);return K(()=>{if(a!=null)return;let e=g.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),K(()=>{if(a==null)return c(e=>{let t=g.current?e.get(g.current)?.index:null;t!=null&&h(t)})},[a,c,h]),u.useMemo(()=>({ref:_,index:m}),[m,_])}function Im(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Kn(),{ref:i,index:a}=Fm(e),o=n===a,s=u.useRef(null),c=g(i,s);return{compositeProps:u.useMemo(()=>({tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}}),[o,r,a,t]),compositeRef:c,index:a}}const Lm=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(Lm.displayName=`TabsListContext`);function Rm(){let e=u.useContext(Lm);if(e===void 0)throw Error(process.env.NODE_ENV===`production`?p(65):`Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.`);return e}const zm=u.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,...c}=e,{value:l,getTabPanelIdByValue:d,orientation:f}=km(),{activateOnFocus:p,highlightedTabIndex:m,onTabActivation:h,setHighlightedTabIndex:g,tabsListElement:_}=Rm(),v=hn(o),{compositeProps:y,compositeRef:b,index:x}=Im({metadata:u.useMemo(()=>({disabled:r,id:v,value:a}),[r,v,a])}),S=a===l,C=u.useRef(!1);K(()=>{if(C.current){C.current=!1;return}if(!(S&&x>-1&&m!==x))return;let e=_;if(e!=null){let t=Fi(Fo(e));if(t&&Q(e,t))return}r||g(x)},[S,x,m,g,r,_]);let{getButtonProps:w,buttonRef:T}=Jn({disabled:r,native:s,focusableWhenDisabled:!0}),E=d(a),D=u.useRef(!1),O=u.useRef(!1);function k(e){S||r||h(a,br(ur,e.nativeEvent,void 0,{activationDirection:`none`}))}function A(e){S||(x>-1&&!r&&g(x),!r&&p&&(!D.current||D.current&&O.current)&&h(a,br(ur,e.nativeEvent,void 0,{activationDirection:`none`})))}function j(e){if(S||r)return;D.current=!0;function t(){D.current=!1,O.current=!1}(!e.button||e.button===0)&&(O.current=!0,Fo(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return W(`button`,e,{state:u.useMemo(()=>({disabled:r,active:S,orientation:f}),[r,S,f]),ref:[t,T,b],props:[y,{role:`tab`,"aria-controls":E,"aria-selected":S,id:v,onClick:k,onFocus:A,onPointerDown:j,"data-composite-item-active":S?``:void 0,onKeyDownCapture(){C.current=!0}},c,w]})});process.env.NODE_ENV!==`production`&&(zm.displayName=`TabsTab`);const Bm='!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();';let Vm=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({});var Hm={...jm,activeTabPosition:()=>null,activeTabSize:()=>null};const Um=u.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,...a}=e,{getTabElementBySelectedValue:o,orientation:s,tabActivationDirection:c,value:l}=km(),{tabsListElement:f}=Rm(),[p,m]=u.useState(!1),{value:h}=km();ye(()=>m(!0));let g=fl();u.useEffect(()=>{if(l!=null&&f!=null&&typeof ResizeObserver<`u`){let e=new ResizeObserver(g);return e.observe(f),()=>{e.disconnect()}}},[l,f,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(l!=null&&f!=null){let e=o(l);if(C=!0,e!=null){let{width:t,height:n}=Wp(e),{width:r,height:i}=Wp(f),a=e.getBoundingClientRect(),o=f.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+f.scrollLeft-f.clientLeft,y=t/c+f.scrollTop-f.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=f.scrollWidth-_-x,b=f.scrollHeight-y-S}}let w=u.useMemo(()=>C?{left:_,right:v,top:y,bottom:b}:null,[_,v,y,b,C]),T=u.useMemo(()=>C?{width:x,height:S}:null,[x,S,C]),E=u.useMemo(()=>{if(C)return{[Vm.activeTabLeft]:`${_}px`,[Vm.activeTabRight]:`${v}px`,[Vm.activeTabTop]:`${y}px`,[Vm.activeTabBottom]:`${b}px`,[Vm.activeTabWidth]:`${x}px`,[Vm.activeTabHeight]:`${S}px`}},[_,v,y,b,x,S,C]),D=C&&x>0&&S>0,O=W(`span`,e,{state:u.useMemo(()=>({orientation:s,activeTabPosition:w,activeTabSize:T,tabActivationDirection:c}),[s,w,T,c]),ref:t,props:[{role:`presentation`,style:E,hidden:!D},a,{suppressHydrationWarning:!0}],stateAttributesMapping:Hm});return h==null?null:(0,d.jsxs)(u.Fragment,{children:[O,!p&&i&&(0,d.jsx)(`script`,{dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})});process.env.NODE_ENV!==`production`&&(Um.displayName=`TabsIndicator`);let Wm=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e}({});const Gm=u.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,...o}=e,{value:s,getTabIdByPanelValue:c,orientation:l,tabActivationDirection:d,registerMountedTabPanel:f,unregisterMountedTabPanel:p}=km(),m=hn(),{ref:h,index:g}=Fm({metadata:u.useMemo(()=>({id:m,value:r}),[m,r])}),_=r!==s,v=c(r),y=W(`div`,e,{state:u.useMemo(()=>({hidden:_,orientation:l,tabActivationDirection:d}),[_,l,d]),ref:[t,h],props:[{"aria-labelledby":v,hidden:_,id:m??void 0,role:`tabpanel`,tabIndex:_?-1:0,[Wm.index]:g},o],stateAttributesMapping:jm});return K(()=>{if(!(_&&!a)&&m!=null)return f(r,m),()=>{p(r,m)}},[_,a,r,m,f,p]),!_||a?y:null});process.env.NODE_ENV!==`production`&&(Gm.displayName=`TabsPanel`);function Km(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var qm=[];function Jm(e){let{itemSizes:t,cols:n=1,loopFocus:r=!0,dense:i=!1,orientation:a=`both`,direction:o,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:d=!1,stopEventPropagation:f=!1,disabledIndices:p,modifierKeys:m=qm}=e,[h,_]=u.useState(0),v=n>1,y=u.useRef(null),b=g(y,l),x=u.useRef([]),S=u.useRef(!1),C=s??h,w=G((e,t=!1)=>{if((c??_)(e),t){let t=x.current[e];gu(y.current,t,o,a)}}),T=G(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&w(r),gu(y.current,n,o,a)}),E=u.useMemo(()=>({"aria-orientation":a===`both`?void 0:a,ref:b,onFocus(e){!y.current||!hu(e.target)||e.target.setSelectionRange(0,e.target.value.length??0)},onKeyDown(e){let s=d?su:ou;if(!s.has(e.key)||Ym(e,m)||!y.current)return;let c=o===`rtl`,l=c?Ql:$l,u={horizontal:l,vertical:Zl,both:l}[a],h=c?$l:Ql,g={horizontal:h,vertical:Xl,both:h}[a];if(hu(e.target)&&!Km(e.target)){let t=e.target.selectionStart,n=e.target.selectionEnd,r=e.target.value??``;if(t==null||e.shiftKey||t!==n||e.key!==g&&t<r.length||e.key!==u&&t>0)return}let _=C,b=Aa(x,p),S=ja(x,p);if(v){let o=t||Array.from({length:x.current.length},()=>({width:1,height:1})),s=Pa(o,n,i),l=s.findIndex(e=>e!=null&&!La(x,e,p)),u=s.reduce((e,t,n)=>t!=null&&!La(x,t,p)?n:e,-1);_=s[Na({current:s.map(e=>e?x.current[e]:null)},{event:e,orientation:a,loopFocus:r,cols:n,disabledIndices:Ia([...p||x.current.map((e,t)=>La(x,t)?t:void 0),void 0],s),minIndex:l,maxIndex:u,prevIndex:Fa(C>S?b:C,o,s,n,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:c})]}let T={horizontal:[l],vertical:[Zl],both:[l,Zl]}[a],E={horizontal:[h],vertical:[Xl],both:[h,Xl]}[a],D=v?s:{horizontal:d?ru:nu,vertical:d?au:iu,both:s}[a];d&&(e.key===`Home`?_=b:e.key===`End`&&(_=S)),_===C&&(T.includes(e.key)||E.includes(e.key))&&(_=r&&_===S&&T.includes(e.key)?b:r&&_===b&&E.includes(e.key)?S:Ma(x,{startingIndex:_,decrement:E.includes(e.key),disabledIndices:p})),_!==C&&!ka(x,_)&&(f&&e.stopPropagation(),D.has(e.key)&&e.preventDefault(),w(_,!0),queueMicrotask(()=>{x.current[_]?.focus()}))}}),[n,i,o,p,x,d,C,v,t,r,b,m,w,a,f]);return u.useMemo(()=>({props:E,highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:x,disabledIndices:p,onMapChange:T,relayKeyboardEvent:E.onKeyDown}),[E,C,w,x,p,T])}function Ym(e,t){for(let n of pu.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Xm(e){let{render:t,className:n,refs:r=te,props:i=te,state:a=V,stateAttributesMapping:o,highlightedIndex:s,onHighlightedIndexChange:c,orientation:l,dense:f,itemSizes:p,loopFocus:m,cols:h,enableHomeAndEndKeys:g,onMapChange:_,stopEventPropagation:v=!0,rootRef:y,disabledIndices:b,modifierKeys:x,highlightItemOnHover:S=!1,tag:C=`div`,...w}=e,{props:T,highlightedIndex:E,onHighlightedIndexChange:D,elementsRef:O,onMapChange:k,relayKeyboardEvent:A}=Jm({itemSizes:p,cols:h,loopFocus:m,dense:f,orientation:l,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:y,stopEventPropagation:v,enableHomeAndEndKeys:g,direction:np(),disabledIndices:b,modifierKeys:x}),j=W(C,e,{state:a,ref:r,props:[T,...i,w],stateAttributesMapping:o}),M=u.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:D,highlightItemOnHover:S,relayKeyboardEvent:A}),[E,D,S,A]);return(0,d.jsx)(Gn.Provider,{value:M,children:(0,d.jsx)(Cm,{elementsRef:O,onMapChange:e=>{_?.(e),k(e)},children:j})})}const Zm=u.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,...o}=e,{getTabElementBySelectedValue:s,onValueChange:c,orientation:l,value:f,setTabMap:p,tabActivationDirection:m}=km(),[h,g]=u.useState(0),[_,v]=u.useState(null),y=$m(f,l,_,s),b=G((e,t)=>{e!==f&&(t.activationDirection=y(e),c(e,t))}),x=u.useMemo(()=>({orientation:l,tabActivationDirection:m}),[l,m]),S={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},C=u.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:h,onTabActivation:b,setHighlightedTabIndex:g,tabsListElement:_,value:f}),[n,h,b,g,_,f]);return(0,d.jsx)(Lm.Provider,{value:C,children:(0,d.jsx)(Xm,{render:a,className:r,state:x,refs:[t,v],props:[S,o],stateAttributesMapping:jm,highlightedIndex:h,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:g,onMapChange:p,disabledIndices:te})})});process.env.NODE_ENV!==`production`&&(Zm.displayName=`TabsList`);function Qm(e,t){let{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect();return{left:n-i,top:r-a}}function $m(e,t,n,r){let[i,a]=u.useState(null);return K(()=>{if(e==null||n==null){a(null);return}let i=r(e);if(i==null){a(null);return}let{left:o,top:s}=Qm(i,n);a(t===`horizontal`?o:s)},[t,r,n,e]),u.useCallback(o=>{if(o===e)return`none`;if(o==null)return a(null),`none`;if(o!=null&&n!=null){let e=r(o);if(e!=null){let{left:r,top:o}=Qm(e,n);if(i==null)return a(t===`horizontal`?r:o),`none`;if(t===`horizontal`){if(r<i)return a(r),`left`;if(r>i)return a(r),`right`}else if(o<i)return a(o),`up`;else if(o>i)return a(o),`down`}}return`none`},[r,t,i,n,e])}const eh=(0,u.createContext)(`vertical`),th=e=>{let t=(0,l.c)(13),n,r;if(t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),(0,u.useContext)(eh)===`horizontal`){let e;t[3]===n?e=t[4]:(e=X(`absolute left-1/2 h-11 md:h-12 top-0 z-[-1] w-(--active-tab-width) translate-y-(--active-tab-top) -translate-x-1/2 rounded-2xl md:rounded-full bg-surface-brand-primary-default transition-all duration-300 ease-[cubic-bezier(0.68,-0.55,0.27,1.55)]`,n),t[3]=n,t[4]=e);let i;return t[5]!==r||t[6]!==e?(i=(0,d.jsx)(Um,{className:e,...r}),t[5]=r,t[6]=e,t[7]=i):i=t[7],i}let i;t[8]===n?i=t[9]:(i=X(`absolute top-1/2 h-11 md:h-12 left-0 z-[-1] w-(--active-tab-width) translate-x-(--active-tab-left) -translate-y-1/2 rounded-full bg-surface-brand-primary-default transition-all duration-300 ease-[cubic-bezier(0.68,-0.55,0.27,1.55)]`,n),t[8]=n,t[9]=i);let a;return t[10]!==r||t[11]!==i?(a=(0,d.jsx)(Um,{className:i,...r}),t[10]=r,t[11]=i,t[12]=a):a=t[12],a},nh=e=>{let t=(0,l.c)(13),n,r;if(t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),(0,u.useContext)(eh)===`horizontal`){let e;t[3]===n?e=t[4]:(e=X(`relative z-0 flex flex-col h-fit grow gap-2 p-2 bg-surface-neutral-primary-default rounded-3xl`,n),t[3]=n,t[4]=e);let i;return t[5]!==r||t[6]!==e?(i=(0,d.jsx)(Zm,{className:e,...r}),t[5]=r,t[6]=e,t[7]=i):i=t[7],i}let i;t[8]===n?i=t[9]:(i=X(`relative z-0 flex gap-1 p-2 bg-surface-neutral-primary-default rounded-full`,n),t[8]=n,t[9]=i);let a;return t[10]!==r||t[11]!==i?(a=(0,d.jsx)(Zm,{className:i,...r}),t[10]=r,t[11]=i,t[12]=a):a=t[12],a},rh=e=>{let t=(0,l.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,u.useContext)(eh)===`horizontal`?`flex-1 min-h-0 h-full`:`grow`,a;t[3]!==n||t[4]!==i?(a=X(`relative rounded-xl bg-surface-neutral-primary-default`,i,`flex items-center justify-center p-4 overflow-auto`,n),t[3]=n,t[4]=i,t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==a?(o=(0,d.jsx)(Gm,{className:a,...r}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o},ih=e=>{let t=(0,l.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`inline-flex rounded-2xl md:rounded-full h-11 md:h-12 px-6 body-base-semibold w-full text-text-brand-primary-default text-center items-center justify-center border-0 break-keep whitespace-nowrap outline-none select-none focus-visible:relative focus-visible:before:absolute focus-visible:before:outline data-selected:text-text-inverse-primary-default transition-colors duration-300 hover:cursor-pointer aria-[selected=false]:hover:bg-surface-neutral-primary-hover`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,d.jsx)(zm,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},ah=e=>{let t=(0,l.c)(15),{className:n,ref:r,...i}=e,[a,o]=(0,u.useState)(i.orientation??`vertical`);if((0,u.useEffect)(()=>{let e=()=>{window.innerWidth<768?o(`horizontal`):o(i.orientation??`vertical`)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i.orientation]),i.orientation=a,i.orientation===`horizontal`){let e=i.orientation,a;t[0]===n?a=t[1]:(a=X(`flex flex-wrap gap-4 overflow-auto`,n),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r||t[4]!==a?(o=(0,d.jsx)(Mm,{className:a,ref:r,...i}),t[2]=i,t[3]=r,t[4]=a,t[5]=o):o=t[5];let s;return t[6]!==i.orientation||t[7]!==o?(s=(0,d.jsx)(eh.Provider,{value:e,children:o}),t[6]=i.orientation,t[7]=o,t[8]=s):s=t[8],s}let s;t[9]===n?s=t[10]:(s=X(`flex flex-col gap-2 overflow-clip`,n),t[9]=n,t[10]=s);let c;return t[11]!==i||t[12]!==r||t[13]!==s?(c=(0,d.jsx)(Mm,{className:s,ref:r,...i}),t[11]=i,t[12]=r,t[13]=s,t[14]=c):c=t[14],c};var oh=0;function sh(e){return oh+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${oh}`}const ch=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(ch.displayName=`ToastContext`);function lh(){let e=u.useContext(ch);if(!e)throw Error(process.env.NODE_ENV===`production`?p(73):`Base UI: useToastManager must be used within <Toast.Provider>.`);return e}function uh(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}const dh=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,[a,o]=u.useState([]),[s,c]=u.useState(!1),[l,f]=u.useState(!1),[p,m]=u.useState(null);a.length===0&&(s&&c(!1),l&&f(!1));let h=s||l,g=u.useRef(new Map),_=u.useRef(null),v=u.useRef(!0),y=u.useRef(!1);function b(e){let t=Fi(Fo(_.current));if(!_.current||!Q(_.current,t)||!Hi(t))return;let n=a.findIndex(t=>t.id===e),r=null,i=n+1;for(;i<a.length;){if(a[i].transitionStatus!==`ending`){r=a[i];break}i+=1}if(!r)for(i=n-1;i>=0;){if(a[i].transitionStatus!==`ending`){r=a[i];break}--i}r?r.ref?.current?.focus():p?.focus({preventScroll:!0})}let x=G(()=>{y.current||(y.current=!0,g.current.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}),S=G(()=>{y.current&&(y.current=!1,g.current.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=xe.create(),e.timeout.start(e.remaining,()=>{g.current.delete(t),e.callback()}),e.start=Date.now()}))}),C=G(e=>{o(t=>{let n=t.map(t=>t.id===e?{...t,transitionStatus:`ending`,height:0}:t),i=n.filter(e=>e.transitionStatus!==`ending`);return n.map(e=>{if(e.transitionStatus===`ending`)return e;let t=i.indexOf(e)>=r;return{...e,limited:t}})});let t=g.current.get(e);t&&t.timeout&&(t.timeout.clear(),g.current.delete(e)),a.find(t=>t.id===e)?.onClose?.(),b(e),a.length===1&&(c(!1),f(!1))}),w=G(e=>{o(t=>t.filter(t=>t.id!==e)),a.find(t=>t.id===e)?.onRemove?.()}),T=G((e,t,n)=>{let r=Date.now(),i=v.current&&!s&&!l,a=i?xe.create():void 0;a?.start(t,()=>{g.current.delete(e),n()}),g.current.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}),E=G(e=>{let t=e.id||sh(`toast`),i={...e,id:t,transitionStatus:`starting`};o(e=>{let t=[i,...e],n=t.filter(e=>e.transitionStatus!==`ending`);if(n.length>r){let e=n.length-r,i=n.slice(-e);return t.map(e=>i.some(t=>t.id===e.id)?{...e,limited:!0}:{...e,limited:!1})}return t.map(e=>({...e,limited:!1}))});let a=i.timeout??n;return i.type!==`loading`&&a>0&&T(t,a,()=>C(t)),(s||l||!v.current)&&x(),t}),D=G((e,t)=>{o(n=>n.map(n=>n.id===e?{...n,...t}:n))}),O=G((e,t)=>{let r=E({...uh(t.loading),type:`loading`}),i=e.then(e=>{let i=uh(t.success,e);D(r,{...i,type:`success`});let a=i.timeout??n;return a>0&&T(r,a,()=>C(r)),(s||l||!v.current)&&x(),e}).catch(e=>{let i=uh(t.error,e);D(r,{...i,type:`error`});let a=i.timeout??n;return a>0&&T(r,a,()=>C(r)),(s||l||!v.current)&&x(),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i});u.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?O(t.promise,t):e===`update`&&n?D(n,t):e===`close`&&n?C(n):E(t)})},[E,D,T,n,i,O,C]);let k=u.useMemo(()=>({toasts:a,setToasts:o,hovering:s,setHovering:c,focused:l,setFocused:f,expanded:h,add:E,close:C,remove:w,update:D,promise:O,pauseTimers:x,resumeTimers:S,prevFocusElement:p,setPrevFocusElement:m,viewportRef:_,scheduleTimer:T,windowFocusedRef:v}),[E,C,l,s,h,x,p,O,w,S,T,a,D]);return(0,d.jsx)(ch.Provider,{value:k,children:t})};process.env.NODE_ENV!==`production`&&(dh.displayName=`ToastProvider`);const fh=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(fh.displayName=`ToastViewportContext`);let ph=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({});const mh=u.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,{toasts:o,pauseTimers:s,resumeTimers:c,setHovering:l,setFocused:f,viewportRef:p,windowFocusedRef:m,prevFocusElement:h,setPrevFocusElement:g,expanded:_,focused:v}=lh(),y=u.useRef(!1),b=u.useRef(!1),x=o.length,S=o[0]?.height??0,C=u.useMemo(()=>o.some(e=>e.transitionStatus===`ending`),[o]);u.useEffect(()=>{if(!p.current)return;function e(e){x!==0&&e.key===`F6`&&e.target!==p.current&&(e.preventDefault(),g(Fi(Fo(p.current))),p.current?.focus({preventScroll:!0}),s(),f(!0))}let t=vn(p.current);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[s,f,g,x,p]),u.useEffect(()=>{if(!p.current||!x)return;let e=vn(p.current);function t(t){t.target===e&&(m.current=!1,s())}function n(t){if(t.relatedTarget||t.target===e)return;let n=Ii(t),r=Fi(Fo(p.current));(!Q(p.current,n)||!Hi(r))&&c(),setTimeout(()=>{m.current=!0})}return e.addEventListener(`blur`,t,!0),e.addEventListener(`focus`,n,!0),()=>{e.removeEventListener(`blur`,t,!0),e.removeEventListener(`focus`,n,!0)}},[s,c,p,m,f,x]),u.useEffect(()=>{let e=p.current;if(!e||x===0)return;let t=Fo(e);function n(t){t.pointerType===`touch`&&(Q(e,Ii(t))||(c(),l(!1),f(!1)))}return t.addEventListener(`pointerdown`,n,!0),()=>{t.removeEventListener(`pointerdown`,n,!0)}},[x,c,f,l,p]);function w(e){p.current&&(y.current=!0,e.relatedTarget===p.current?o[0]?.ref?.current?.focus():h?.focus({preventScroll:!0}))}function T(e){e.key===`Tab`&&e.shiftKey&&e.target===p.current&&(e.preventDefault(),h?.focus({preventScroll:!0}),c())}u.useEffect(()=>{!m.current||C||!b.current||(c(),l(!1),b.current=!1)},[C,c,l,m]);function E(){s(),l(!0),b.current=!1}function D(){o.some(e=>e.transitionStatus===`ending`)?b.current=!0:(c(),l(!1))}function O(){if(y.current){y.current=!1;return}v||Hi(Fo(p.current).activeElement)&&(f(!0),s())}function k(e){!v||Q(p.current,e.relatedTarget)||(f(!1),c())}let A={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:E,onMouseMove:E,onMouseLeave:D,onFocus:O,onBlur:k,onKeyDown:T,onClick:O},j=u.useMemo(()=>({expanded:_}),[_]),M=W(`div`,e,{ref:[t,p],state:j,props:[A,{style:{[ph.frontmostHeight]:S?`${S}px`:void 0}},a,{children:(0,d.jsxs)(u.Fragment,{children:[x>0&&h&&(0,d.jsx)(Io,{onFocus:w}),i,x>0&&h&&(0,d.jsx)(Io,{onFocus:w})]})}]}),N=u.useMemo(()=>({viewportRef:p}),[p]),P=u.useMemo(()=>o.filter(e=>e.priority===`high`),[o]);return(0,d.jsxs)(fh.Provider,{value:N,children:[x>0&&h&&(0,d.jsx)(Io,{onFocus:w}),M,!v&&P.length>0&&(0,d.jsx)(`div`,{style:rn,children:P.map(e=>(0,d.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,d.jsx)(`div`,{children:e.title}),(0,d.jsx)(`div`,{children:e.description})]},e.id))})]})});process.env.NODE_ENV!==`production`&&(mh.displayName=`ToastViewport`);const hh=u.createContext(void 0);process.env.NODE_ENV!==`production`&&(hh.displayName=`ToastRootContext`);function gh(){let e=u.useContext(hh);if(!e)throw Error(process.env.NODE_ENV===`production`?p(66):`Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.`);return e}let _h=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({});var vh={...zr,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},yh=40,bh=10,xh=.5,Sh=1;function Ch(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function wh(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}const Th=u.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,{toasts:p,focused:m,close:h,remove:g,setToasts:_,pauseTimers:v,expanded:y,setHovering:b}=lh(),[x,S]=u.useState(void 0),[C,w]=u.useState(!1),[T,E]=u.useState(!1),[D,O]=u.useState(!1),[k,A]=u.useState({x:0,y:0}),[j,M]=u.useState({x:0,y:0,scale:1}),[N,P]=u.useState(),[F,ee]=u.useState(),[I,L]=u.useState(null),R=u.useRef(null),z=u.useRef({x:0,y:0}),B=u.useRef({x:0,y:0,scale:1}),te=u.useRef(void 0),V=u.useRef(0),ne=u.useRef(!1),H=u.useRef({x:0,y:0}),re=u.useRef(!1),U=u.useMemo(()=>p.indexOf(n),[n,p]),ie=u.useMemo(()=>p.filter(e=>e.transitionStatus!==`ending`).indexOf(n),[n,p]),ae=u.useMemo(()=>p.slice(0,p.indexOf(n)).reduce((e,t)=>e+(t.height||0),0),[p,n]);Pr({open:n.transitionStatus!==`ending`,ref:R,onComplete(){n.transitionStatus===`ending`&&g(n.id)}});let oe=G((e=!1)=>{let t=R.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){_(e=>e.map(e=>e.id===n.id?{...e,ref:R,height:i,transitionStatus:void 0}:e))}e?f.flushSync(a):a()});K(oe,[oe]);function se(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**xh:-(Math.abs(e)**xh):(!c.includes(`right`)&&e>0&&(n=e**xh),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**xh))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**xh:-(Math.abs(t)**xh):(!c.includes(`down`)&&t>0&&(r=t**xh),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**xh))),{x:n,y:r}}function ce(e){if(e.button!==0)return;e.pointerType===`touch`&&v();let t=Ii(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(ne.current=!1,te.current=void 0,V.current=0,z.current={x:e.clientX,y:e.clientY},H.current=z.current,R.current){let e=wh(R.current);B.current=e,M(e),A({x:e.x,y:e.y})}b(!0),w(!0),E(!1),L(null),re.current=!0,R.current?.setPointerCapture(e.pointerId)}}function le(e){if(!C)return;e.preventDefault(),re.current&&=(z.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>H.current.y||i>0&&t<H.current.y)&&(H.current={x:H.current.x,y:t}),(r<0&&n>H.current.x||r>0&&n<H.current.x)&&(H.current={x:n,y:H.current.y});let a=n-z.current.x,o=t-z.current.y,s=t-H.current.y,l=n-H.current.x;if(!T&&Math.sqrt(a*a+o*o)>=Sh&&(E(!0),I===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&L(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!te.current)I===`vertical`?o>0?u=`down`:o<0&&(u=`up`):I===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(te.current=u,V.current=Ch(u,a,o),S(u));else{let e=te.current,t=Ch(e,l,s);t>yh?(ne.current=!1,S(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&V.current-t>=bh&&(ne.current=!0)}let d=se(a,o),f=B.current.x,p=B.current.y;I===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(f+=d.x):(I===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(f+=d.x),(c.includes(`up`)||c.includes(`down`))&&(p+=d.y)),A({x:f,y:p})}function ue(e){if(!C)return;if(w(!1),E(!1),L(null),R.current?.releasePointerCapture(e.pointerId),ne.current){A({x:j.x,y:j.y}),S(void 0);return}let t=!1,r=k.x-j.x,i=k.y-j.y,a;for(let e of c){switch(e){case`right`:r>yh&&(t=!0,a=`right`);break;case`left`:r<-yh&&(t=!0,a=`left`);break;case`down`:i>yh&&(t=!0,a=`down`);break;case`up`:i<-yh&&(t=!0,a=`up`);break;default:break}if(t)break}t?(S(a),O(!0),h(n.id)):(A({x:j.x,y:j.y}),S(void 0))}function de(e){if(e.key===`Escape`){if(!R.current||!Q(R.current,Fi(Fo(R.current))))return;h(n.id)}}u.useEffect(()=>{if(!l)return;let e=R.current;if(!e)return;function t(t){Q(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function fe(){if(!C&&k.x===j.x&&k.y===j.y&&!D)return{[_h.swipeMovementX]:`0px`,[_h.swipeMovementY]:`0px`};let e=k.x-j.x,t=k.y-j.y;return{transition:C?`none`:void 0,transform:C?`translateX(${k.x}px) translateY(${k.y}px) scale(${j.scale})`:void 0,[_h.swipeMovementX]:`${e}px`,[_h.swipeMovementY]:`${t}px`}}let pe=n.priority===`high`,me={role:pe?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":N,"aria-describedby":F,"aria-hidden":pe&&!m?!0:void 0,onPointerDown:l?ce:void 0,onPointerMove:l?le:void 0,onPointerUp:l?ue:void 0,onKeyDown:de,inert:xu(n.limited),style:{...fe(),[_h.index]:n.transitionStatus===`ending`?U:ie,[_h.offsetY]:`${ae}px`,[_h.height]:n.height?`${n.height}px`:void 0}},he=u.useMemo(()=>({rootRef:R,toast:n,titleId:N,setTitleId:P,descriptionId:F,setDescriptionId:ee,swiping:C,swipeDirection:x,recalculateHeight:oe,index:U,visibleIndex:ie,expanded:y}),[n,N,F,C,x,oe,U,ie,y]),ge=u.useMemo(()=>({transitionStatus:n.transitionStatus,expanded:y,limited:n.limited||!1,type:n.type,swiping:he.swiping,swipeDirection:he.swipeDirection}),[y,n.transitionStatus,n.limited,n.type,he.swiping,he.swipeDirection]),_e=W(`div`,e,{ref:[t,he.rootRef],state:ge,stateAttributesMapping:vh,props:[me,o]});return(0,d.jsx)(hh.Provider,{value:he,children:_e})});process.env.NODE_ENV!==`production`&&(Th.displayName=`ToastRoot`);const Eh=u.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s}=gh(),c=a??s.description,l=!!c,d=mn(i),{setDescriptionId:f}=gh();K(()=>{if(l)return f(d),()=>{f(void 0)}},[l,d,f]);let p=W(`p`,e,{ref:t,state:u.useMemo(()=>({type:s.type}),[s.type]),props:{...o,id:d,children:c}});return l?p:null});process.env.NODE_ENV!==`production`&&(Eh.displayName=`ToastDescription`);const Dh=u.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s}=gh(),c=a??s.title,l=!!c,d=mn(i),{setTitleId:f}=gh();K(()=>{if(l)return f(d),()=>{f(void 0)}},[l,d,f]);let p=W(`h2`,e,{ref:t,state:u.useMemo(()=>({type:s.type}),[s.type]),props:{...o,id:d,children:c}});return l?p:null});process.env.NODE_ENV!==`production`&&(Dh.displayName=`ToastTitle`);const Oh=u.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,{close:s,expanded:c}=lh(),{toast:l}=gh(),[d,f]=u.useState(!1),{getButtonProps:p,buttonRef:m}=Jn({disabled:i,native:a}),h=u.useMemo(()=>({type:l.type}),[l.type]);return W(`button`,e,{ref:[t,m],state:h,props:[{"aria-hidden":!c&&!d,onClick(){s(l.id)},onFocus(){f(!0)},onBlur(){f(!1)}},o,p]})});process.env.NODE_ENV!==`production`&&(Oh.displayName=`ToastClose`);const kh=kp;function Ah(){let e=u.useContext(ch);if(!e)throw Error(process.env.NODE_ENV===`production`?p(73):`Base UI: useToastManager must be used within <Toast.Provider>.`);let{toasts:t,add:n,close:r,update:i,promise:a}=e;return u.useMemo(()=>({toasts:t,add:n,close:r,update:i,promise:a}),[t,n,r,i,a])}const jh=({className:e,children:t,position:n=`top-right`,ref:r,...i})=>{let{toasts:a}=Ah(),o=e=>{switch(e){case`top-left`:return`left`;case`bottom-left`:return`left`;case`top-right`:return`right`;case`bottom-right`:return`right`;case`top-center`:return`up`;case`bottom-center`:return`down`;default:return`right`}};return a.map(a=>(0,d.jsxs)(Th,{toast:a,swipeDirection:o(n),className:X(n===`bottom-right`||n===`bottom-center`||n===`bottom-left`?`absolute right-0 bottom-0 left-auto z-[calc(1000-var(--toast-index))] mr-0 w-full transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-15px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))] rounded-lg border border-outline bg-surface-container bg-clip-padding p-sm shadow-lg transition-all [transition-property:opacity,transform] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)] select-none after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-[""] data-ending-style:opacity-0 data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))] data-limited:opacity-0 data-starting-style:transform-[translateY(150%)] [&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:transform-[translateY(150%)] data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+150%))] data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+150%))] data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-150%))] data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-150%))] flex flex-col gap-3xs`:`absolute top-0 right-0 left-0 z-[calc(1000-var(--toast-index))] mx-auto w-full transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*15px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))] rounded-lg border border-gray-200 bg-gray-50 bg-clip-padding p-sm shadow-lg transition-all [transition-property:opacity,transform] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)] select-none after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-[''] data-ending-style:opacity-0 data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)+calc(var(--toast-index)*var(--gap))+var(--toast-swipe-movement-y)))] data-limited:opacity-0 data-starting-style:transform-[translateY(-150%)] [&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:transform-[translateY(-150%)] data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+150%))] data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+150%))] data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-150%))] data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-150%))]`,e,a.data.variant===`success`&&`border-success bg-success-container`,a.data.variant===`error`&&`border-error bg-error-container`,a.data.variant===`warning`&&`border-warning bg-warning-container`),style:{"--gap":`1rem`,"--offset-y":`calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))`},ref:r,...i,children:[t,(0,d.jsx)(Dh,{className:X(`text-sm font-semibold text-on-surface`,a.data.variant===`success`&&`text-on-success-container`,a.data.variant===`error`&&`text-on-error-container`,a.data.variant===`warning`&&`text-on-warning-container`)}),(0,d.jsx)(Eh,{className:X(`text-sm text-on-surface`,a.data.variant===`success`&&`text-on-success-container`,a.data.variant===`error`&&`text-on-error-container`,a.data.variant===`warning`&&`text-on-warning-container`)}),(0,d.jsx)(Oh,{className:`absolute top-xs right-2xs flex size-xs items-center justify-center rounded border-none bg-transparent text-on-surface hover:cursor-pointer`,"aria-label":`Close`,children:(0,d.jsx)(Yr,{weight:`bold`})})]},a.id))},Mh=e=>{let t=(0,l.c)(24),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({position:o,className:r,children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o===void 0?`bottom-center`:o,c=s===`top-left`,u=s===`top-center`,f=s===`top-right`,p=s===`bottom-left`,m=s===`bottom-center`,h=s===`bottom-right`,g;t[6]!==r||t[7]!==c||t[8]!==u||t[9]!==f||t[10]!==p||t[11]!==m||t[12]!==h?(g=X({"fixed z-10 top-[1rem] left-[1rem] right-auto bottom-auto mx-0 flex w-1/4":c,"fixed z-10 top-[1rem] left-1/2 right-auto bottom-auto mx-auto flex w-1/4 -translate-x-1/2":u,"fixed z-10 top-[1rem] right-[1rem] left-auto bottom-auto mx-0 flex w-1/4":f,"fixed z-10 bottom-[6rem] left-[1rem] right-auto top-auto mx-0 flex w-1/4":p,"fixed z-10 bottom-[6rem] left-1/2 right-auto top-auto mx-auto flex w-1/4 -translate-x-1/2":m,"fixed z-10 bottom-[6rem] right-[1rem] left-auto top-auto mx-0 flex w-1/4":h},r),t[6]=r,t[7]=c,t[8]=u,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]===s?_=t[15]:(_=(0,d.jsx)(jh,{position:s}),t[14]=s,t[15]=_);let v;t[16]!==i||t[17]!==a||t[18]!==g||t[19]!==_?(v=(0,d.jsx)(kh,{children:(0,d.jsx)(mh,{className:g,ref:a,...i,children:_})}),t[16]=i,t[17]=a,t[18]=g,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==n||t[22]!==v?(y=(0,d.jsxs)(dh,{timeout:5e3,children:[n,v]}),t[21]=n,t[22]=v,t[23]=y):y=t[23],y};exports.Avatar=Kt,exports.AvatarFallback=Jt,exports.AvatarImage=qt,exports.Badge=$t,exports.Button=tn,exports.Checkbox=Xr,exports.CheckboxIndicator=Vr,exports.Dialog=qu,exports.DialogClose=Hu,exports.DialogDescription=Uu,exports.DialogPopup=Wu,exports.DialogTitle=Gu,exports.DialogTrigger=Ku,exports.FieldErrors=Cf,exports.FieldInput=Af,exports.Form=If,exports.FormErrors=Nf,exports.FormSubmit=jf,exports.Input=kf,exports.Label=Lf,exports.Profile=Rf,exports.ScrollArea=hp,exports.Separator=Of,exports.Slider=pm,exports.SliderHandle=nm,exports.SliderSegment=rm,exports.SliderTick=am,exports.SliderTickLabel=im,exports.SliderTrack=om,exports.Switch=bm,exports.Tabs=ah,exports.TabsIndicator=th,exports.TabsList=nh,exports.TabsPanel=rh,exports.TabsTab=ih,exports.Toast=jh,exports.ToastProvider=Mh,exports.Tooltip=$p,exports.TooltipContent=tm,exports.TooltipTrigger=em,exports.cn=X;
21
+ //# sourceMappingURL=index.cjs.map