@getontime/cli
Version:
Time keeping for live events
2 lines • 68.3 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f14ad0099eab1969fdd065b56af5fdd3cf530de6`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`487d63d5-3aee-4420-946f-fe40e2f3898a`,e._sentryDebugIdIdentifier=`sentry-dbid-487d63d5-3aee-4420-946f-fe40e2f3898a`)}catch{}})();import{a as e,n as t,t as n}from"./jsx-runtime-BNC90REB.js";import{$t as r,Qt as i,en as a}from"./useSocket-B9-0Z7zf.js";import{K as o,Tt as s}from"./constants-8b9Q9Bj6.js";var c=e(t(),1),l={};function u(e,t){let n=c.useRef(l);return n.current===l&&(n.current=e(t)),n}var d=[],f=void 0;function p(){return f}function m(e){d.push(e)}function h(e){let t=(t,n)=>{let r=u(_).current,i;try{f=r;for(let e of d)e.before(r);i=e(t,n);for(let e of d)e.after(r);r.didInitialize=!0}finally{f=void 0}return i};return t.displayName=e.displayName||e.name,t}function g(e){return c.forwardRef(h(e))}function _(){return{didInitialize:!1}}var v=typeof document<`u`?c.useLayoutEffect:()=>{};function y(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var b=y(`https://base-ui.com/production-error`,`Base UI`),x=[];function S(e){c.useEffect(e,x)}function C(e){"@babel/helpers - typeof";return C=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C(e)}function ee(e,t){if(C(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(C(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function w(e){var t=ee(e,`string`);return C(t)==`symbol`?t:t+``}function T(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=0,D=class e{constructor(){T(this,`currentId`,E),T(this,`clear`,()=>{this.currentId!==E&&(clearTimeout(this.currentId),this.currentId=E)}),T(this,`disposeEffect`,()=>this.clear)}static create(){return new e}start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=E,t()},e)}isStarted(){return this.currentId!==E}};function O(){let e=u(D.create).current;return S(e.disposeEffect),e}function te(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:k,platform:A,maxTouchPoints:j}=te(),M=k.toLowerCase(),N=A.toLowerCase(),P=/^i(os$|p)/.test(N)||N===`macintel`&&j>1,ne=`android`,F=N===ne||M.includes(ne),I=!P&&N.startsWith(`mac`);N.startsWith(`win`),!F&&/^(linux|chrome os)/.test(N);var re=I||P,ie=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),ae=!ie&&M.includes(`firefox`);!ie&&M.includes(`chrom`);var oe=re,se=/jsdom|happydom/.test(M);function L(e){e.preventDefault(),e.stopPropagation()}function ce(e){return`nativeEvent`in e}function le(e){return e.pointerType===``&&e.isTrusted?!0:F&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function ue(e){return se?!1:!F&&e.width===0&&e.height===0||F&&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 de(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function fe(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function R(){return typeof window<`u`}function z(e){return pe(e)?(e.nodeName||``).toLowerCase():`#document`}function B(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function V(e){return((pe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function pe(e){return R()?e instanceof Node||e instanceof B(e).Node:!1}function H(e){return R()?e instanceof Element||e instanceof B(e).Element:!1}function U(e){return R()?e instanceof HTMLElement||e instanceof B(e).HTMLElement:!1}function me(e){return!R()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof B(e).ShadowRoot}function he(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ee(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ge(e){return/^(table|td|th)$/.test(z(e))}function _e(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ve=/transform|translate|scale|rotate|perspective|filter/,ye=/paint|layout|strict|content/,be=e=>!!e&&e!==`none`,xe;function Se(e){let t=H(e)?Ee(e):e;return be(t.transform)||be(t.translate)||be(t.scale)||be(t.rotate)||be(t.perspective)||!we()&&(be(t.backdropFilter)||be(t.filter))||ve.test(t.willChange||``)||ye.test(t.contain||``)}function Ce(e){let t=Oe(e);for(;U(t)&&!Te(t);){if(Se(t))return t;if(_e(t))return null;t=Oe(t)}return null}function we(){return xe??(xe=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`)),xe}function Te(e){return/^(html|body|#document)$/.test(z(e))}function Ee(e){return B(e).getComputedStyle(e)}function De(e){return H(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Oe(e){if(z(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||me(e)&&e.host||V(e);return me(t)?t.host:t}function ke(e){let t=Oe(e);return Te(t)?e.ownerDocument?e.ownerDocument.body:e.body:U(t)&&he(t)?t:ke(t)}function Ae(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ke(e),i=r===e.ownerDocument?.body,a=B(r);if(i){let e=je(a);return t.concat(a,a.visualViewport||[],he(r)?r:[],e&&n?Ae(e):[])}else return t.concat(r,Ae(r,[],n))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Me=`data-base-ui-focusable`,Ne=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Pe=`ArrowLeft`,Fe=`ArrowRight`,Ie=`ArrowUp`,Le=`ArrowDown`;function W(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function G(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&me(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function K(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Re(e,t){if(!H(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(G(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function ze(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 Be(e){return e.matches(`html,body`)}function Ve(e){return U(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function He(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ne}`)!=null}function Ue(e){return e?e.getAttribute(`role`)===`combobox`&&Ve(e):!1}function We(e){if(!e||se)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Ge(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Ke(){}var qe=Object.freeze([]),q=Object.freeze({}),Je=`none`,Ye=`trigger-press`,Xe=`trigger-hover`,Ze=`trigger-focus`,Qe=`outside-press`,$e=`item-press`,et=`close-press`,tt=`input-change`,nt=`input-clear`,rt=`input-press`,it=`focus-out`,at=`escape-key`,ot=`list-navigation`,st=`pointer`,ct=`cancel-open`,lt=`sibling-open`,ut=`disabled`,dt=`imperative-action`,ft=`window-resize`;function pt(e,t,n,r){let i=!1,a=!1,o=r??q;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 mt(e,t,n){let r=n??q;return{reason:e,event:t??new Event(`base-ui`),...r}}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function ht(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function gt(e,t,n,r){let i=u(vt).current;return yt(i,e,t,n,r)&&xt(i,[e,t,n,r]),i.callback}function _t(e){let t=u(vt).current;return bt(t,e)&&xt(t,e),t.callback}function vt(){return{callback:null,cleanup:null,refs:[]}}function yt(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function bt(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function xt(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(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:}}}}}}function St(e){let t=u(Ct,e).current;return t.next=e,v(t.effect),t}function Ct(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var wt={...c},Tt=wt.useInsertionEffect,Et=Tt&&Tt!==wt.useLayoutEffect?Tt:e=>e();function Y(e){let t=u(Dt).current;return t.next=e,Et(t.effect),t.trampoline}function Dt(){let e={next:void 0,callback:Ot,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Ot(){}var kt=null;globalThis.requestAnimationFrame;var At=new class{constructor(){T(this,`callbacks`,[]),T(this,`callbacksCount`,0),T(this,`nextId`,1),T(this,`startId`,1),T(this,`isScheduled`,!1),T(this,`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;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||(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)}},jt=class e{constructor(){T(this,`currentId`,kt),T(this,`cancel`,()=>{this.currentId!==kt&&(At.cancel(this.currentId),this.currentId=kt)}),T(this,`disposeEffect`,()=>this.cancel)}static create(){return new e}static request(e){return At.request(e)}static cancel(e){return At.cancel(e)}request(e){this.cancel(),this.currentId=At.request(()=>{this.currentId=kt,e()})}};function Mt(){let e=u(jt.create).current;return S(e.disposeEffect),e}function X(e){return e?.ownerDocument||document}var Nt={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Pt={...Nt,position:`fixed`,top:0,left:0},Ft={...Nt,position:`absolute`},Z=n(),It=c.forwardRef(function(e,t){let[n,r]=c.useState();v(()=>{oe&&ie&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Z.jsx)(`span`,{...e,ref:t,style:Pt,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),Lt=[`top`,`right`,`bottom`,`left`],Rt=Math.min,zt=Math.max,Bt=Math.round,Vt=Math.floor,Ht=e=>({x:e,y:e}),Ut={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Wt(e,t,n){return zt(e,Rt(t,n))}function Gt(e,t){return typeof e==`function`?e(t):e}function Kt(e){return e.split(`-`)[0]}function qt(e){return e.split(`-`)[1]}function Jt(e){return e===`x`?`y`:`x`}function Yt(e){return e===`y`?`height`:`width`}function Xt(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Zt(e){return Jt(Xt(e))}function Qt(e,t,n){n===void 0&&(n=!1);let r=qt(e),i=Zt(e),a=Yt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=cn(o)),[o,cn(o)]}function $t(e){let t=cn(e);return[en(e),t,en(t)]}function en(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var tn=[`left`,`right`],nn=[`right`,`left`],rn=[`top`,`bottom`],an=[`bottom`,`top`];function on(e,t,n){switch(e){case`top`:case`bottom`:return n?t?nn:tn:t?tn:nn;case`left`:case`right`:return t?rn:an;default:return[]}}function sn(e,t,n,r){let i=qt(e),a=on(Kt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(en)))),a}function cn(e){let t=Kt(e);return Ut[t]+e.slice(t.length)}function ln(e){return{top:0,right:0,bottom:0,left:0,...e}}function un(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ln(e)}function dn(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 fn(e,t,n){return Math.floor(e/t)!==n}function pn(e,t){return t<0||t>=e.length}function mn(e,t){return Q(e.current,{disabledIndices:t})}function hn(e,t){return Q(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Q(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.length-1&&_n(e,a,r));return a}function gn(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!_n(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=Vt(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!_n(e,r,s))return r}};d&&L(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=Q(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=Q(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}pn(e,f)&&(f=u)}if(n===`both`){let n=Vt(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&L(t),u%o===o-1?r&&(f=Q(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Q(e,{startingIndex:u,disabledIndices:s}),r&&fn(f,o,n)&&(f=Q(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),fn(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&L(t),u%o===0?r&&(f=Q(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Q(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&fn(f,o,n)&&(f=Q(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),fn(f,o,n)&&(f=u));let c=Vt(l/o)===n;pn(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:Q(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function _n(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?yn(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function vn(e){return e.visibility===`hidden`||e.visibility===`collapse`}function yn(e,t=e?Ee(e):null){return!e||!e.isConnected||!t||vn(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var bn=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function xn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return me(n)?n.host:null}function Sn(e){for(let t of Array.from(e.children))if(z(t)===`summary`)return t;return null}function Cn(e,t){let n=Sn(t);return!!n&&(e===n||G(n,e))}function wn(e){let t=e?z(e):``;return e!=null&&e.matches(bn)&&(t!==`summary`||e.parentElement!=null&&z(e.parentElement)===`details`&&Sn(e.parentElement)===e)&&(t!==`details`||Sn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Tn(e){if(!wn(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=xn(t)){let n=t!==e,r=z(t)===`slot`;if(t.hasAttribute(`inert`)||n&&z(t)===`details`&&!t.open&&!Cn(e,t)||t.hasAttribute(`hidden`)||!r&&!En(t,n))return!1}return!0}function En(e,t){let n=Ee(e);return t?n.display!==`none`:yn(e,n)}function Dn(e){let t=e.tabIndex;if(t<0){let t=z(e);if(t===`details`||t===`audio`||t===`video`||U(e)&&e.isContentEditable)return 0}return t}function On(e){if(z(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function kn(e,t){let n=On(e);if(!n)return!0;let r=t.find(e=>{let t=On(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=On(e);return t?.name===n.name&&t.form===n.form})===n}function An(e){if(U(e)&&z(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return U(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function jn(e,t){An(e).forEach(e=>{wn(e)&&t.push(e),jn(e,t)})}function Mn(e,t,n){An(e).forEach(e=>{U(e)&&e.matches(t)&&n.push(e),Mn(e,t,n)})}function Nn(e){return Tn(e)&&Dn(e)>=0}function Pn(e){let t=[];return jn(e,t),t.filter(Tn)}function Fn(e){let t=Pn(e);return t.filter(e=>Dn(e)>=0&&kn(e,t))}function In(e,t){let n=Fn(e),r=n.length;if(r===0)return;let i=W(X(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Ln(e){return In(X(e).body,1)||e}function Rn(e){return In(X(e).body,-1)||e}function zn(e,t){if(!e)return null;let n=Fn(X(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Bn(e){return zn(e,1)}function Vn(e){return zn(e,-1)}function Hn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!G(n,r)}function Un(e){Fn(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Wn(e){let t=[];Mn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Gn(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Gn(e,t.id,n)])}function Kn(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 qn(e){return`data-base-ui-${e}`}var Jn=0;function Yn(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Jn);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Ke;let o=requestAnimationFrame(a);return Jn=o,()=>{Jn===o&&(cancelAnimationFrame(o),Jn=0)}}var Xn={inert:new WeakMap,"aria-hidden":new WeakMap},Zn=`data-base-ui-inert`,Qn={inert:new WeakSet,"aria-hidden":new WeakSet},$n=new WeakMap,er=0;function tr(e){return Qn[e]}function nr(e){return e?me(e)?e.host:nr(e.parentNode):null}var rr=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=nr(t);return e.contains(n)?n:null}).filter(e=>e!=null),ir=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},ar=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{z(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function or(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=rr(t,e),l=i?ar(t,ir(c),new Set(c)):[],u=[],d=[];if(a){let e=Xn[a],n=tr(a);s=n,o=e;let r=rr(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);ar(t,ir(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=($n.get(e)||0)+1;$n.set(e,t),d.push(e),t===1&&e.setAttribute(Zn,``)}),er+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=($n.get(e)||0)-1;$n.set(e,t),t||e.removeAttribute(Zn)}),--er,er||(Xn.inert=new WeakMap,Xn[`aria-hidden`]=new WeakMap,Qn.inert=new WeakSet,Qn[`aria-hidden`]=new WeakSet,$n=new WeakMap)}}function sr(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=X(e[0]).body;return or(e,a,n,r,{mark:i})}var cr=0;function lr(e,t=`mui`){let[n,r]=c.useState(e),i=e||n;return c.useEffect(()=>{n??(cr+=1,r(`${t}-${cr}`))},[n,t]),i}var ur=wt.useId;function dr(e,t){if(ur!==void 0){let n=ur();return e??(t?`${t}-${n}`:n)}return lr(e,t)}var fr=19;function pr(e){return fr>=e}function mr(e){if(!c.isValidElement(e))return null;let t=e,n=t.props;return(pr(19)?n?.ref:t.ref)??null}function hr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function gr(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 _r(e,t){return typeof e==`function`?e(t):e}function vr(e,t){return typeof e==`function`?e(t):e}var yr={};function br(e,t,n,r,i){if(!n&&!r&&!i&&!e)return Sr(t);let a=Sr(e);return t&&(a=Cr(a,t)),n&&(a=Cr(a,n)),r&&(a=Cr(a,r)),i&&(a=Cr(a,i)),a}function xr(e){if(e.length===0)return yr;if(e.length===1)return Sr(e[0]);let t=Sr(e[0]);for(let n=1;n<e.length;n+=1)t=Cr(t,e[n]);return t}function Sr(e){return Dr(e)?{...Or(e,yr)}:wr(e)}function Cr(e,t){return Dr(t)?Or(t,e):Tr(e,t)}function wr(e){let t={...e};for(let e in t){let n=t[e];Er(e,n)&&(t[e]=Ar(n))}return t}function Tr(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=hr(e.style,r);break;case`className`:e[n]=Mr(e.className,r);break;default:Er(n,r)?e[n]=kr(e[n],r):e[n]=r}}return e}function Er(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 Dr(e){return typeof e==`function`}function Or(e,t){return Dr(e)?e(t):e??yr}function kr(e,t){return t?e?(...n)=>{let r=n[0];if(Nr(r)){let i=r;jr(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Ar(t):e}function Ar(e){return e&&((...t)=>{let n=t[0];return Nr(n)&&jr(n),e(...t)})}function jr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Mr(e,t){return t?e?t+` `+e:t:e}function Nr(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function Pr(e,t,n={}){let r=t.render,i=Fr(t,n);return n.enabled===!1?null:Rr(e,r,i,n.state??q)}function Fr(e,t={}){let{className:n,style:r,render:i}=e,{state:a=q,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?_r(n,a):void 0,d=l?vr(r,a):void 0,f=l?gr(a,c):q,p=l&&s?Ir(s):void 0,m=l?hr(f,p)??{}:q;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=_t([m.ref,mr(i),...o]):m.ref=gt(m.ref,mr(i),o):gt(null,null)),l?(u!==void 0&&(m.className=Mr(m.className,u)),d!==void 0&&(m.style=hr(m.style,d)),m):q}function Ir(e){return Array.isArray(e)?xr(e):br(void 0,e)}var Lr=Symbol.for(`react.lazy`);function Rr(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=br(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===Lr&&(i=c.Children.toArray(t)[0]),c.cloneElement(i,e)}if(e&&typeof e==`string`)return zr(e,n);throw Error(b(8))}function zr(e,t){return e===`button`?(0,c.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,c.createElement)(`img`,{alt:``,...t,key:t.key}):c.createElement(e,t)}var Br={style:{transition:`none`}},Vr=`data-base-ui-click-trigger`,Hr={fallbackAxisSide:`none`},Ur={fallbackAxisSide:`end`},Wr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Gr=e(a(),1),Kr=c.createContext(null),qr=()=>c.useContext(Kr),Jr=qn(`portal`);function Yr(e={}){let{ref:t,container:n,componentProps:r=q,elementProps:i}=e,a=dr(),o=qr()?.portalNode,[s,l]=c.useState(null),[u,d]=c.useState(null),f=Y(e=>{e!==null&&d(e)}),p=c.useRef(null);v(()=>{if(n===null){p.current&&(p.current=null,d(null),l(null));return}if(a==null)return;let e=(n&&(pe(n)?n:n.current))??o??document.body;if(e==null){p.current&&(p.current=null,d(null),l(null));return}p.current!==e&&(p.current=e,d(null),l(e))},[n,o,a]);let m=Pr(`div`,r,{ref:[t,f],props:[{id:a,[Jr]:``},i]});return{portalNode:u,portalSubtree:s&&m?Gr.createPortal(m,s):null}}var Xr=c.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...l}=e,{portalNode:u,portalSubtree:d}=Yr({container:o,ref:t,componentProps:e,elementProps:l}),f=c.useRef(null),p=c.useRef(null),m=c.useRef(null),h=c.useRef(null),[g,_]=c.useState(null),y=c.useRef(!1),b=g?.modal,x=g?.open,S=typeof s==`boolean`?s:!!g&&!g.modal&&g.open&&!!u;c.useEffect(()=>{if(!u||b)return;function e(e){u&&e.relatedTarget&&Hn(e)&&(e.type===`focusin`?y.current&&(Wn(u),y.current=!1):(Un(u),y.current=!0))}return ht(J(u,`focusin`,e,!0),J(u,`focusout`,e,!0))},[u,b]),v(()=>{!u||x!==!0||!y.current||(Wn(u),y.current=!1)},[x,u]);let C=c.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:u,setFocusManagerState:_}),[u]);return(0,Z.jsxs)(c.Fragment,{children:[d,(0,Z.jsxs)(Kr.Provider,{value:C,children:[S&&u&&(0,Z.jsx)(It,{"data-type":`outside`,ref:f,onFocus:e=>{Hn(e,u)?m.current?.focus():Rn(g?g.domReference:null)?.focus()}}),S&&u&&(0,Z.jsx)(`span`,{"aria-owns":u.id,style:Wr}),u&&Gr.createPortal(a,u),S&&u&&(0,Z.jsx)(It,{"data-type":`outside`,ref:p,onFocus:e=>{Hn(e,u)?h.current?.focus():(Ln(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,pt(`focus-out`,e.nativeEvent)))}})]})]})});function Zr(){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 Qr=class{constructor(){T(this,`nodesRef`,{current:[]}),T(this,`events`,Zr())}addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},$r=c.createContext(null),ei=c.createContext(null),ti=()=>c.useContext($r)?.id||null,ni=e=>{let t=c.useContext(ei);return e??t};function ri(e){let t=dr(),n=ni(e),r=ti();return v(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function ii(e){let{children:t,id:n}=e,r=ti();return(0,Z.jsx)($r.Provider,{value:c.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function ai(e){let{children:t,externalTree:n}=e,r=u(()=>n??new Qr).current;return(0,Z.jsx)(ei.Provider,{value:r,children:t})}function oi(e){return e==null?e:`current`in e?e.current:e}function si(e,t){let n=B(K(e));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 ci=20,li=[];function ui(){li=li.filter(e=>e.deref()?.isConnected)}function di(e){ui(),e&&z(e)!==`body`&&(li.push(new WeakRef(e)),li.length>ci&&(li=li.slice(-ci)))}function fi(){return ui(),li[li.length-1]?.deref()}function pi(e){return e?Nn(e)?e:Fn(e)[0]||e:null}function mi(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Pn(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Nn(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function hi(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=`rootStore`in t?t.rootStore:t,_=g.useState(`open`),y=g.useState(`domReferenceElement`),b=g.useState(`floatingElement`),{events:x,dataRef:S}=g.context,C=Y(()=>S.current.floatingContext?.nodeId),ee=i===!1,w=Ue(y)&&ee,T=St(i),E=St(a),D=St(u),te=St(_),k=ni(m),A=qr(),j=c.useRef(!1),M=c.useRef(!1),N=c.useRef(!1),P=c.useRef(null),ne=c.useRef(``),F=c.useRef(``),I=c.useRef(null),re=c.useRef(null),ae=gt(I,p,A?.beforeInsideRef),oe=gt(re,A?.afterInsideRef),se=O(),ce=O(),de=Mt(),fe=A!=null,R=Ge(b),B=Y((e=R)=>e?Fn(e):[]),V=Y(()=>h?.().filter(e=>e!=null)??[]);c.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&G(R,W(X(R)))&&B().length===0&&!w&&L(e)}return J(X(R),`keydown`,e)},[r,R,s,w,B]),c.useEffect(()=>{if(r||!_)return;let e=X(R);function t(){N.current=!1}function n(e){let t=K(e),n=V();N.current=!(G(b,t)||G(y,t)||G(A?.portalNode,t)||n.some(e=>e===t||G(e,t))),F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0,ce.start(0,()=>{M.current=!1}))}function i(){F.current=`keyboard`}return ht(J(e,`pointerdown`,n,!0),J(e,`pointerup`,t,!0),J(e,`pointercancel`,t,!0),J(e,`keydown`,i,!0),t)},[r,b,y,R,_,A,ce,V]),c.useEffect(()=>{if(r||!l)return;let e=X(R);function t(){M.current=!0,ce.start(0,()=>{M.current=!1})}function n(e){let t=K(e);Nn(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=K(t);s&&n==null&&i!=null&&G(b,i)&&di(i),queueMicrotask(()=>{let a=C(),c=g.context.triggerElements,l=V(),u=n?.hasAttribute(qn(`focus-guard`))&&[I.current,re.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,oi(f),oi(d)].includes(n),p=!(G(y,n)||G(b,n)||G(n,b)||G(A?.portalNode,n)||l.some(e=>e===n||G(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>G(e,n))||u||k&&(Gn(k.nodesRef.current,a).find(e=>G(e.context?.elements.floating,n)||G(e.context?.elements.domReference,n))||Kn(k.nodesRef.current,a).find(e=>[e.context?.elements.floating,Ge(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===y&&R&&mi(R),o&&r!==y&&!yn(i)&&W(e)===e.body){if(U(R)&&(R.focus(),o===`popup`)){de.request(()=>{R.focus()});return}let e=B(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||R;U(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(w||!s)&&n&&p&&!M.current&&(w||n!==fi())&&(j.current=!0,g.setOpen(!1,pt(it,t)))})}function a(){N.current||(S.current.insideReactTree=!0,se.start(0,()=>{S.current.insideReactTree=!1}))}let c=U(y)?y:null;if(!(!b&&!c))return ht(c&&J(c,`focusout`,i),c&&J(c,`pointerdown`,t),b&&J(b,`focusin`,n),b&&J(b,`focusout`,i),b&&A&&J(b,`focusout`,a,!0))},[r,y,b,R,s,k,A,g,l,o,B,w,C,S,se,ce,de,d,f,V]),c.useEffect(()=>{if(r||!b||!_)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${qn(`portal`)}]`)||[]),t=(k?Kn(k.nodesRef.current,C()):[]).find(e=>Ue(e.context?.elements.domReference||null))?.context?.elements.domReference,n=sr([...[b,...e,I.current,re.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...V()],t,oi(f),oi(d),w?y:null].filter(e=>e!=null),{ariaHidden:s||w,mark:!1}),i=sr([b,...e].filter(e=>e!=null));return()=>{i(),n()}},[_,r,y,b,s,A,w,k,C,d,f,V]),v(()=>{if(!_||r||!U(R))return;let e=X(R),t=W(e);queueMicrotask(()=>{let n=T.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||G(R,t))return;let i=null,a=()=>(i??(i=B(R)),i[0]||R),o;o=r===!0||r===null?a():oi(r),o=o||a();let s=G(R,W(e));Yn(o,{preventScroll:o===R,shouldFocus(){if(!te.current)return!1;if(s)return!0;let t=W(e);return!(t!==o&&G(R,t))}})})},[r,_,R,B,T,D,te]),v(()=>{if(r||!R)return;let e=X(R),t=W(e),n=D.current==null;di(t);function i(e){if(e.open||(ne.current=si(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(j.current=!0),e.reason===`outside-press`)if(e.nested)j.current=!1;else if(le(e.nativeEvent)||ue(e.nativeEvent))j.current=!1;else{let e=!1;X(R).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}x.on(`openchange`,i);function a(){let e=E.current,r=typeof e==`function`?e(ne.current):e;if(r===void 0||r===!1)return null;r===null&&(r=!0);let i=y?.isConnected?y:null,a=t?.isConnected&&z(t)!==`body`?t:null,o=n?a||i:i||a;return o||(o=fi()||null),typeof r==`boolean`?o:oi(r)||o||null}return()=>{x.off(`openchange`,i);let t=W(e),n=V(),r=G(b,t)||n.some(e=>e===t||G(e,t))||k&&Gn(k.nodesRef.current,C(),!1).some(e=>G(e.context?.elements.floating,t)),o=E.current,s=a();queueMicrotask(()=>{let n=pi(s),i=typeof o!=`boolean`;o&&!j.current&&U(n)&&(!(!i&&n!==t&&t!==e.body)||r)&&n.focus({preventScroll:!0}),j.current=!1})}},[r,b,R,E,D,x,k,y,C,V]),v(()=>{if(!ie||_||!b)return;let e=W(X(b));!U(e)||!Ve(e)||G(b,e)&&e.blur()},[_,b]),v(()=>{if(!(r||!A))return A.setFocusManagerState({modal:s,closeOnFocusOut:l,open:_,onOpenChange:g.setOpen,domReference:y}),()=>{A.setFocusManagerState(null)}},[r,A,s,_,g,l,y]),v(()=>{if(!(r||!R))return mi(R),()=>{queueMicrotask(ui)}},[r,R]);let pe=!r&&(s?!w:!0)&&(fe||s);return(0,Z.jsxs)(c.Fragment,{children:[pe&&(0,Z.jsx)(It,{"data-type":`inside`,ref:ae,onFocus:e=>{if(s){let e=B();Yn(e[e.length-1])}else A?.portalNode&&(j.current=!1,Hn(e,A.portalNode)?Ln(y)?.focus():oi(f??A.beforeOutsideRef)?.focus())}}),n,pe&&(0,Z.jsx)(It,{"data-type":`inside`,ref:oe,onFocus:e=>{s?Yn(B()[0]):A?.portalNode&&(l&&(j.current=!0),Hn(e,A.portalNode)?Rn(y)?.focus():oi(d??A.afterOutsideRef)?.focus())}})]})}function gi(){return!1}function _i(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function vi(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=gi,bubbles:s,externalTree:l}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=u.useState(`floatingElement`),{dataRef:p}=u.context,m=ni(l),h=Y(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=Y(()=>a),{escapeKey:y,outsidePress:b}=_i(s),x=c.useRef(!1),S=c.useRef(!1),C=c.useRef(!1),ee=c.useRef(!1),w=c.useRef(``),T=c.useRef(null),E=O(),te=O(),k=Y(()=>{te.clear(),p.current.insideReactTree=!1}),A=Y(e=>{let t=p.current.floatingContext?.nodeId;return(m?Gn(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),j=Y(e=>ze(e,u.select(`floatingElement`))||ze(e,u.select(`domReferenceElement`))),M=Y(e=>{o()&&u.setOpen(!1,pt(Ye,e.nativeEvent))}),N=Y(e=>{if(!d||!n||!r||e.key!==`Escape`||ee.current||!y&&A(`__escapeKeyBubbles`))return;let t=pt(at,ce(e)?e.nativeEvent:e);u.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),P=Y(()=>{p.current.insideReactTree=!0,te.start(0,k)}),ne=Y(e=>{if(!d||!n||e.button!==0)return;let t=K(e.nativeEvent);G(u.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),F=Y(e=>{!d||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});c.useEffect(()=>{if(!d||!n)return;p.current.__escapeKeyBubbles=y,p.current.__outsidePressBubbles=b;let e=new D,t=new D;function i(){e.clear(),ee.current=!0}function a(){e.start(ie?5:0,()=>{ee.current=!1})}function o(){C.current=!0,t.start(0,()=>{C.current=!1})}function s(){x.current=!1,S.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=p.current.floatingContext?.nodeId,n=m&&Gn(m.nodesRef.current,t).some(t=>ze(e,t.context?.elements.floating));return j(e)||n}function O(e){if(l(e)){e.type!==`click`&&!j(e)&&(t.clear(),C.current=!1),k();return}if(p.current.insideReactTree){k();return}let n=K(e),r=`[${qn(`inert`)}]`,i=H(n)?n.getRootNode():null,a=Array.from((me(i)?i:X(u.select(`floatingElement`))).querySelectorAll(r)),o=u.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>G(e,n))))return;let s=H(n)?n:null;for(;s&&!Te(s);){let e=Oe(s);if(Te(e)||!H(e))break;s=e}if(!(a.length&&H(n)&&!Be(n)&&!G(n,u.select(`floatingElement`))&&a.every(e=>!G(s,e)))){if(U(n)&&!(`touches`in e)){let t=Te(n),r=Ee(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!h(e)){if(c()===`intentional`&&C.current){t.clear(),C.current=!1;return}typeof g==`function`&&!g(e)||A(`__outsidePressBubbles`)||(u.setOpen(!1,pt(Qe,e)),k())}}}function te(e){c()!==`sloppy`||e.pointerType===`touch`||!u.select(`open`)||!n||j(e)||O(e)}function M(e){if(c()!==`sloppy`||!u.select(`open`)||!n||j(e))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)}))}function P(e,t){let n=K(e);if(!n)return;let r=J(n,e.type,()=>{t(e),r()})}function ne(e){w.current=`touch`,P(e,M)}function F(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&P(e,e=>{e.type===`pointerdown`?te(e):O(e)})}function I(e){if(!x.current)return;let n=S.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!h(e)){if(n){o();return}typeof g==`function`&&!g(e)||(t.clear(),C.current=!0,k())}}}function re(e){if(c()!==`sloppy`||!T.current||j(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(O(e),E.clear(),T.current=null)}function ae(e){P(e,re)}function oe(e){c()!==`sloppy`||!T.current||j(e)||(T.current.dismissOnTouchEnd&&O(e),E.clear(),T.current=null)}function se(e){P(e,oe)}let L=X(f),ce=ht(r&&ht(J(L,`keydown`,N),J(L,`compositionstart`,i),J(L,`compositionend`,a)),_&&ht(J(L,`click`,F,!0),J(L,`pointerdown`,F,!0),J(L,`pointerup`,I,!0),J(L,`pointercancel`,I,!0),J(L,`mousedown`,F,!0),J(L,`mouseup`,I,!0),J(L,`touchstart`,ne,!0),J(L,`touchmove`,ae,!0),J(L,`touchend`,se,!0)));return()=>{ce(),e.clear(),t.clear(),s(),C.current=!1}},[p,f,r,_,g,d,n,y,b,N,k,v,A,j,m,u,E]),c.useEffect(k,[g,k]);let I=c.useMemo(()=>({onKeyDown:N,onPointerDown:M,onClick:M}),[N,M]),re=c.useMemo(()=>({onKeyDown:N,onPointerDown:F,onMouseDown:F,onClickCapture:P,onMouseDownCapture(e){P(),ne(e)},onPointerDownCapture(e){P(),ne(e)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[N,P,ne,F]);return c.useMemo(()=>n?{reference:I,floating:re,trigger:I}:{},[n,I,re])}function yi(e){let t=c.useRef(!0);t.current&&(t.current=!1,e())}var $=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(b(1));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},bi=r(),xi=e(i(),1),Si=pr(19)?Ti:Ei;function Ci(e,t,n,r,i){return Si(e,t,n,r,i)}function wi(e,t,n,r,i){let a=c.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,bi.useSyncExternalStore)(e.subscribe,a,a)}m({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,bi.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Ti(e,t,n,r,i){let a=p();if(!a)return wi(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Ei(e,t,n,r,i){return(0,xi.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Di=class{constructor(e){T(this,`subscribe`,e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})),T(this,`getSnapshot`,()=>this.state),this.state=e,this.listeners=new Set,this.updateTick=0}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(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Ci(this,e,t,n,r)}},Oi=class extends Di{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){c.useDebugValue(e);let n=this;v(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;v(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;v(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){c.useDebugValue(e);let n=this,r=t!==void 0;v(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return c.useDebugValue(e),Ci(this,this.selectors[e],t,n,r)}useContextCallback(e,t){c.useDebugValue(e);let n=Y(t??Ke);this.context[e]=n}useStateSetter(e){let t=c.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)}})}},ki={open:$(e=>e.open),transitionStatus:$(e=>e.transitionStatus),domReferenceElement:$(e=>e.domReferenceElement),referenceElement:$(e=>e.positionReference??e.referenceElement),floatingElement:$(e=>e.floatingElement),floatingId:$(e=>e.floatingId)},Ai=class extends Oi{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Zr(),nested:n,triggerElements:i},ki),T(this,`syncOpenEvent`,(e,t)=>{(!e||!this.state.open||t!=null&&fe(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)}),T(this,`dispatchOpenChange`,(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}),T(this,`setOpen`,(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}),this.syncOnly=t}};function ji(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),l=t.useState(`activeTriggerElement`),u=t.useState(n?`popupElement`:`positionerElement`),d=t.context.triggerElements,f=o,p=c.useRef(null);r===void 0&&p.current===null&&(p.current=new Ai({open:s,transitionStatus:void 0,referenceElement:l,floatingElement:u,triggerElements:d,onOpenChange:f,floatingId:i,syncOnly:!0,nested:a}));let m=r??p.current;return t.useSyncedValue(`floatingId`,i),v(()=>{let e={open:s,floatingId:i,referenceElement:l,floatingElement:u};H(l)&&(e.domReferenceElement=l),m.state.positionReference===m.state.referenceElement&&(e.positionReference=l),m.update(e)},[s,i,l,u,m]),m.context.onOpenChange=f,m.context.nested=a,m}function Mi(e,t=!1,n=!1){let[r,i]=c.useState(e&&t?`idle`:void 0),[a,o]=c.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),v(()=>{if(!e&&a&&r!==`ending`&&n){let e=jt.request(()=>{i(`ending`)});return()=>{jt.cancel(e)}}},[e,a,r,n]),v(()=>{if(!e||t)return;let n=jt.request(()=>{i(void 0)});return()=>{jt.cancel(n)}},[t,e]),v(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=jt.request(()=>{i(`idle`)});return()=>{jt.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var Ni=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Pi={[Ni.startingStyle]:``},Fi={[Ni.endingStyle]:``},Ii={transitionStatus(e){return e===`starting`?Pi:e===`ending`?Fi:null}};function Li(e,t=!1,n=!0){let r=Mt();return Y((i,a=null)=>{r.cancel();let o=oi(e);if(o==null)return;let s=o,c=()=>{Gr.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=Ni.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Ri(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Y(i),o=Li(r,n,!1);c.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var zi={tabIndex:-1,[Me]:``};function Bi(e){return t=>t===`touch`?e.current:!0}function Vi(e,t,n=!1){let r=dr(),i=ti()!=null,a=c.useRef(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e??a.current;return ji({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function Hi(e,t){let n=c.useRef(null),r=c.useRef(null);return c.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function Ui(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function Wi(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Gi(e,t,n,r={}){let i=n.reason,a=i===Xe,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Wi(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),Ui(i,t,n.trigger,c()),e.update(i)};a?Gr.flushSync(l):l()}function Ki(e,t,n,r){yi(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function qi(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Hi(e,n),o=Y(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update({activeTriggerElement:t,...i?r:null});return}o==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return v(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function Ji(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState(`open`);v(()=>{if(!r){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,i={};e.state.triggerCount!==t&&(i.triggerCount=t);let a=e.select(`activeTriggerId`),o=null;if(a){let t=e.context.triggerElements.getById(a);t?t!==e.state.activeTriggerElement&&(i.activeTriggerElement=t):o=a}if(!o&&!a&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;i.activeTriggerId=e,i.activeTriggerElement=n}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),o&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===o&&!e.context.triggerElements.getById(o)){let t=pt(Je);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,e.useState(`triggerCount`),n])}function Yi(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Mi(e),o=t.useState(`preventUnmountingOnClose`),s=e?!1:o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=Y(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Ri({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function Xi(e,t){e.useSyncedValues(t),v(()=>()=>{e.update({activeTriggerProps:q,inactiveTriggerProps:q,popupProps:q})},[e])}function Zi(e,t){v(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),v(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var Qi=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function $i(){return new Ai({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Qi,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function ea(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:$i(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:q,inactiveTriggerProps:q,popupProps:q}}function ta(e,t,n=!1){return new Ai({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var na=$(e=>e.triggerIdProp??e.activeTriggerId),ra=$(e=>e.openProp??e.open),ia=$(e=>(e.popupElement?.id??e.floatingId)||void 0);function aa(e,t){return t!==void 0&&ra(e)&&na(e)===t}function oa(e,t){return aa(e,t)?!0:t!==void 0&&ra(e)&&na(e)==null&&e.triggerCount===1}var sa={open:ra,mounted:$(e=>e.mounted),transitionStatus:$(e=>e.transitionStatus),floatingRootContext:$(e=>e.floatingRootContext),triggerCount:$(e=>e.triggerCount),preventUnmountingOnClose:$(e=>e.preventUnmountingOnClose),payload:$(e=>e.payload),activeTriggerId:na,activeTriggerElement:$(e=>e.mounted?e.activeTriggerElement:null),popupId:ia,isTriggerActive:$((e,t)=>t!==void 0&&na(e)===t),isOpenedByTrigger:$((e,t)=>aa(e,t)),isMountedByTrigger:$((e,t)=>t!==void 0&&na(e)===t&&e.mounted),triggerProps:$((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:$((e,t)=>oa(e,t)?ia(e):void 0),popupProps:$(e=>e.popupProps),popupElement:$(e=>e.popupElement),positionerElement:$(e=>e.positionerElement)},ca=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ni.startingStyle]=`startingStyle`,e[e.endingStyle=Ni.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),la=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),ua={[la.popupOpen]:``},da={[la.popupOpen]:``,[la.pressed]:``},fa={[ca.open]:``},pa={[ca.closed]:``},ma={[ca.anchorHidden]:``},ha={open(e){return e?ua:null}},ga={open(e){return e?da:null}},_a={open(e){return e?fa:pa},anchorHidden(e){return e?ma:null}};function va(e){return dr(e,`base-ui`)}function ya(e){return pr(19)?e:e?`true`:void 0}var ba=c.createContext(!1),xa=c.createContext(void 0);function Sa(e){let t=c.useContext(xa);if(e===!1&&t===void 0)throw Error(b(27));return t}var Ca={..._a,...Ii},wa=c.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Sa(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Pr(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Ca,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Ta=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Ea=function(e){return e[e.open=ca.open]=`open`,e[e.closed=ca.closed]=`closed`,e[e.startingStyle=ca.startingStyle]=`startingStyle`,e[e.endingStyle=ca.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Da=c.createContext(void 0);function Oa(){let e=c.useContext(Da);if(e===void 0)throw Error(b(26));return e}var ka=`ArrowUp`,Aa=`ArrowDown`,ja=`ArrowLeft`,Ma=`ArrowRight`,Na=`Home`,Pa=new Set([ja,Ma]),Fa=new Set([ja,Ma,Na,`End`]),Ia=new Set([ka,Aa]),La=new Set([ka,Aa,Na,`End`]),Ra=new Set([...Pa,...Ia]),za=new Set([...Ra,Na,`End`]),Ba=`Shift`,Va=new Set([Ba,`Control`,`Alt`,`Meta`]);function Ha(e){return U(e)&&e.tagName===`INPUT`}function Ua(e){return!!(Ha(e)&&e.selectionStart!=null||U(e)&&e.tagName===`TEXTAREA`)}function Wa(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=Ga(e,t,`left`),a=Ka(e),o=Ka(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=Ga(e,t,`top`),r=Ka(e),i=Ka(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 Ga(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 Ka(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 qa={..._a,...Ii,nestedDialogOpen(e){return e?{[Ea.nestedDialogOpen]:``}:null}},Ja=c.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,{store:c}=Sa(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`),C=s.id??S;Oa(),Ri({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let ee=o===void 0?Bi(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=Pr(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:C,"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:x,...zi,hidden:!m,onKeyDown(e){za.has(e.key)&&e.stopPropagation()},style:{[Ta.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:qa});return(0,Z.jsx)(hi,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:ee,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),Ya=c.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Z.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Xa=c.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Sa(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Z.jsx)(Da.Provider,{value:n,children:(0,Z.jsxs)(Xr,{ref:t,...r,children:[a&&o===!0&&(0,Z.jsx)(Ya,{ref:i.context.internalBackdropRef,inert:ya(!s)}),e.children]})}):null}),Za={},Qa={},$a=``;function eo(e){if(typeof document>`u`)return!1;let t=X(e);return B(t).innerWidth-t.documentElement.clientWidth>0}function to(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=X(e),n=t.documentElement,r=t.body,i=he(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function no(e){let t=X(e),n=t.documentElement,r=t.body,i=he(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function ro(e){let t=X(e),n=t.documentElement,r=t.body,i=B(n),a=0,o=0,s=!1,c=jt.create();if(ie&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Za={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},$a=n.style.scrollBehavior,Qa={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 u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=he(n)?n:r;if(s=to(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}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,Za),Object.assign(r.style,Qa),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=$a)}function d(){u(),c.request(l)}l();let f=J(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var io=new class{constructor(){T(this,`lockCount`,0),T(this,`restore`,null),T(this,`timeoutLock`,D.create()),T(this,`timeoutUnlock`,D.create()),T(this,`release`,()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)}),T(this,`unlock`,()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}lock(e){if(this.lockCount===0||this.restore!==null)return;let t=X(e).documentElement,n=B(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=Ke;return}this.restore=P||!eo(e)?no(e):ro(e)}};function ao(e=!0,t=null){v(()=>{if(e)return io.acquire(t)},[e,t])}function oo(e){let{store:t,actionsRef:n}=e,r=t.useState(`open`);Zi(t,r),Ji(t);let{forceUnmount:i}=Yi(r,t),a=c.useCallback(()=>{t.setOpen(!1,pt(dt))},[t]);c.useImperativeHandle(n,()=>({unmount:i,close:a}),[i,a])}function so({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[l,u]=c.useState(0),[d,f]=c.useState(0),p=l===0,m=vi(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=K(t);return p&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===n||e.context.backdropRef.current===n||G(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0:!1},escapeKey:p});return ao(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{u(e),f(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{u(0),f(0)}),c.useEffect(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+(n?1:0)),t?.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[n,r,l,d,t]),Xi(e,{activeTriggerProps:m.reference??q,inactiveTriggerProps:m.trigger??q,popupProps:m.floating??q,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var co={...sa,modal:$(e=>e.modal),nested:$(e=>e.nested),nestedOpenDialogCount:$(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:$(e=>e.nestedOpenDrawerCount),disablePointerDismissal:$(e=>e.disablePointerDismissal),openMethod:$(e=>e.openMethod),descriptionElementId:$(e=>e.descriptionElementId),titleElementId:$(e=>e.titleElementId),viewportElement:$(e=>e.viewportElement),role:$(e=>e.role)},lo=class e extends Oi{constructor(e,t,n=!1){let r=new Qi,i=uo(e);i.floatingRootContext=ta(r,t,n),super(i,{popupRef:c.createRef(),backdropRef:c.createRef(),internalBackdropRef:c.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},co),T(this,`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;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Ui(n,e,t.trigger),this.update(n)})}static useStore(t,n){return Vi(t,(t,r)=>new e(n,t,r),!0).store}};function uo(e={}){return{...ea(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function fo(e,t=`dialog`){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:l=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:p=null}=e,m=t===`drawer`,h=t===`alert-dialog`,g=h?!0:l,_=h||s,v=h?`alertdialog`:`dialog`,y=Sa(!0),b={modal:g,disablePointerDismissal:_,nested:!!y,role:v},x=lo.useStore(d?.store,{open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...b});yi(()=>{let e=r===void 0&&x.state.open===!1&&i===!0?{open:!0,activeTriggerId:p}:null;h?x.update(e?{...b,...e}:b):e&&x.update(e)}),x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,f),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let S=x.useState(`open`),C=x.useState(`mounted`),ee=x.useState(`payload`);oo({store:x,actionsRef:u});let w=S||C,T=c.useMemo(()=>({store:x}),[x]);return(0,Z.jsx)(ba.Provider,{value:!1,children:(0,Z.jsxs)(xa.Provider,{value:T,children:[w&&(0,Z.jsx)(so,{store:x,parentContext:y?.store.context,isDrawer:m}),typeof n==`function`?n({payload:ee}):n]})})}function po(e){return fo(e,c.useContext(ba)?`drawer`:`dialog`)}var mo=c.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Sa(),c=va(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Pr(`h2`,e,{ref:t,props:[{id:c},o]})}),ho=`_blink_150ot_1`,go=`_fourtyfive_150ot_13`,_o=`_mirror_150ot_17`,vo=`_subtle_150ot_21`,yo=`_primary_150ot_51`,bo=`_destructive_150ot_66`,xo=`_ghosted_150ot_92`,So=`_baseButton_150ot_140`,Co=`_loading_150ot_161`,wo=`_content_150ot_164`,To=`_loadingOverlay_150ot_174`,Eo=`_spinner_150ot_180`,Do=`_spin_150ot_180`,Oo=`_small_150ot_190`,ko=`_medium_150ot_195`,Ao=`_large_150ot_200`,jo=`_xlarge_150ot_205`,Mo=`_fluid_150ot_210`,No={blink:ho,fourtyfive:go,mirror:_o,subtle:vo,"subtle-white":`_subtle-white_150ot_35`,primary:yo,destructive:bo,"subtle-destructive":`_subtle-destructive_150ot_79`,ghosted:xo,"ghosted-white":`_ghosted-white_150ot_108`,"ghosted-destructive":`_ghosted-destructive_150ot_124`,baseButton:So,loading:Co,content:wo,loadingOverlay:To,spinner:Eo,spin:Do,small:Oo,medium:ko,large:Ao,xlarge:jo,fluid:Mo},Po=(0,c.forwardRef)(({className:e,children:t,variant:n=`subtle`,size:r=`medium`,fluid:i,loading:a,...c},l)=>(0,Z.jsxs)(`button`,{ref:l,className:o([No.baseButton,No[n],No[r],i&&No.fluid,a&&No.loading,e]),type:`button`,disabled:a||c.disabled,...c,children:[(0,Z.jsx)(`span`,{className:No.content,children:t}),a&&(0,Z.jsx)(`div`,{className:No.loadingOverlay,children:(0,Z.jsx)(s,{className:No.spinner})})]}));Po.displayName=`Button`;export{Di as $,De as $n,Bt as $t,ea as A,Ye as An,hn as At,Ki as B,We as Bn,Zt as Bt,wa as C,ot as Cn,T as Cr,Gn as Ct,_a as D,lt as Dn,h as Dr,Hn as Dt,la as E,st as En,v as Er,Vn as Et,Gi as F,Ge as Fn,Wt as Ft,qi as G,Pe as Gn,sn as Gt,Xi as H,G as Hn,Yt as Ht,Wi as I,He as In,Ht as It,Ii as J,Ee as Jn,Kt as Jt,Ri as K,Fe as Kn,cn as Kt,Bi as L,Re as Ln,Gt as Lt,sa as M,qe as Mn,yn as Mt,Qi as N,q as Nn,pn as Nt,ga as O,Ze as On,g as Or,Q as Ot,zi as P,Ke as Pn,_n as Pt,Oi as Q,z as Qn,dn as Qt,Ui as R,Ue as Rn,Vt as Rt,Wa as S,$e as Sn,O as Sr,qn as St,va as T,Qe as Tn,b as Tr,Bn as Tt,Zi as U,K as Un,$t as Ut,Yi as V,W as Vn,Qt as Vt,Vi as W,Le as Wn,Jt as Wt,ji as X,V as Xn,zt as Xt,Mi as Y,Ce as Yn,Xt as Yt,Ai as Z,je as Zn,Rt as Zt,Va as _,it as _n,ie as _r,Pr as _t,Xa as a,Mt as an,U as ar,ii as at,La as b,nt as bn,I as br,dr as bt,Aa as c,gt as cn,ge as cr,ti as ct,Ma as d,pt as dn,de as dr,Xr as dt,Lt as en,Ae as er,Ci as et,ka as f,mt as fn,le as fr,Yr as ft,Fa as g,at as gn,ae as gr,Ur as gt,Pa as h,ut as hn,se as hr,Hr as ht,ao as i,X as in,H as ir,hi as it,ta as j,ft as jn,mn as jt,ha as k,Xe as kn,u as kr,gn as kt,Ra as l,ht as ln,_e as lr,ni as lt,Na as m,et as mn,L as mr,Br as mt,mo as n,Pt as nn,B as nr,yi as nt,Ya as o,Y as on,Te as or,ai as ot,za as p,ct as pn,ue as pr,Vr as pt,Li as q,Ie as qn,un as qt,po as r,Ft as rn,Se as rr,vi as rt,Ja as s,St as sn,he as sr,ri as st,Po as t,It as tn,Oe as tr,$ as tt,ja as u,J as un,we as ur,Qr as ut,Ba as v,dt as vn,F as vr,jr as vt,ya as w,Je as wn,S as wr,Ln as wt,Ua as x,rt as xn,D as xr,Yn as xt,Ia as y,tt as yn,P as yr,br as yt,Ji as z,Ve as zn,qt as zt};
//# sourceMappingURL=Button-CsttsbOH.js.map