burnout-components
Version:
A component library for burnout brands that contains common react-components and util functions used throughout it and it's portfolio companies
1 lines • 116 kB
JavaScript
import{jsx as e,jsxs as t,Fragment as n}from'react/jsx-runtime';import*as r from'react';import o,{useRef as i,useCallback as l,useEffect as a,useState as s,useMemo as u,useLayoutEffect as c,useContext as d,createContext as f,forwardRef as p,Fragment as m,isValidElement as h,cloneElement as g,createElement as v,useId as b,useReducer as y,useSyncExternalStore as x}from'react';import*as w from'react-dom';import{createPortal as E,flushSync as O}from'react-dom';import S from'@tiptap/extension-text-align';import L from'@tiptap/starter-kit';import{Bold as T,Italic as k,AlignLeft as C,AlignCenter as N,AlignRight as A,List as F,ListOrdered as P}from'lucide-react';import{useEditor as R,EditorContent as M}from'@tiptap/react';import{useStore as D,createFormHookContexts as I,createFormHook as H}from'@tanstack/react-form';function _({children:t,colorSwap:n,fit:r,onClick:o,red:i,type:l='submit',disabled:a}){return e('button',n?{disabled:a,onClick:o,type:l,className:`bg-burnout-dark-gray hover:bg-burnout-light-gray ${r?'w-fit':'w-full'} border-burnout-blue nice-hover-burnout hober:text-black cursor-pointer rounded-lg border-2 px-3 py-2 text-center font-bold text-white transition-all duration-200 ease-in-out`,children:t}:i?{disabled:a,onClick:o,type:l,className:(r?'w-fit':'w-full')+' border-burnout-blue nice-hover-burnout bg-burnout-red hover:bg-burnout-light-red cursor-pointer rounded-lg border-2 px-3 py-2 text-center font-bold text-white transition-all duration-200 ease-in-out',children:t}:{disabled:a,onClick:o,className:`bg-burnout-light-gray hover:bg-burnout-dark-gray border-burnout-blue text-burnout-black nice-hover-burnout border-2 ${r?'w-fit':'w-full'} cursor-pointer rounded-lg px-3 py-2 text-center font-bold transition-all duration-200 ease-in-out hover:text-white`,children:t})}function B({children:t,handleSubmit:n}){return e('form',{onSubmit:e=>{e.preventDefault(),n()},className:'flex flex-col gap-3',children:t})}function j({children:t,colorSwap:n,fit:r,onClick:o,red:i,type:l='submit',disabled:a}){return e('button',n?{disabled:a,onClick:o,type:l,className:`bg-monsterPurple/50 hover:bg-monsterPurpleHover/50 ${r?'w-fit':'w-full'} border-monsterPurple/50 hover:border-monsterPurpleHover/50 nice-hover-no-shadow nice-pop cursor-pointer rounded-lg border px-3 py-2 text-center font-bold text-white backdrop-blur-sm transition-all duration-300 ease-in-out`,children:t}:i?{disabled:a,onClick:o,type:l,className:(r?'w-fit':'w-full')+' nice-hover-no-shadow nice-pop cursor-pointer rounded-lg border border-red-600/50 bg-red-600/50 px-3 py-2 text-center font-bold text-white backdrop-blur-sm transition-all duration-300 ease-in-out hover:border-red-800/50 hover:bg-red-800/50',children:t}:{disabled:a,onClick:o,className:`bg-monsterGreen/50 hover:bg-monsterGreenHover/50 hover:border-monsterGreenHover/50 border-monsterGreen/50 nice-hover-no-shadow nice-pop border text-white ${r?'w-fit':'w-full'} cursor-pointer rounded-lg px-3 py-2 text-center font-bold transition-all duration-300 ease-in-out`,children:t})}function V({children:t,colorSwap:n,fit:r,onClick:o,red:i,type:l='submit',disabled:a}){return e('button',n?{disabled:a,onClick:o,type:l,className:`bg-monsterPurple hover:bg-monsterPurpleHover ${r?'w-fit':'w-full'} border-siteBackground nice-hover-burnout cursor-pointer rounded-lg border-2 px-3 py-2 text-center font-bold text-white transition-all duration-200 ease-in-out`,children:t}:i?{disabled:a,onClick:o,type:l,className:(r?'w-fit':'w-full')+' border-siteBackground nice-hover-burnout cursor-pointer rounded-lg border-2 bg-red-600 px-3 py-2 text-center font-bold text-white transition-all duration-200 ease-in-out hover:bg-red-800',children:t}:{disabled:a,onClick:o,className:`bg-monsterGreen hover:bg-monsterGreenHover border-siteBackground text-siteBackground nice-hover-burnout border-2 ${r?'w-fit':'w-full'} cursor-pointer rounded-lg px-3 py-2 text-center font-bold transition-all duration-200 ease-in-out`,children:t})}function W({meta:t}){return t.isTouched?t.errors.map((({message:t},n)=>e('p',{className:'mt-2 text-sm font-medium text-red-600 italic',children:t},n))):null}const q='undefined'!=typeof document?o.useLayoutEffect:()=>{};const $=e=>{var t;return null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document},G=e=>{if(e&&'window'in e&&e.window===e)return e;return $(e).defaultView||window};function z(e,t){return!(!t||!e)&&e.contains(t)}const U=(e=document)=>e.activeElement;function K(e){return e.target}function Y(e){var t;return'undefined'!=typeof window&&null!=window.navigator&&((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands.some((t=>e.test(t.brand))))||e.test(window.navigator.userAgent))}function X(e){var t;return'undefined'!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function Q(e){if('test'===process.env.NODE_ENV)return e;let t=null;return()=>(null==t&&(t=e()),t)}const Z=Q((()=>X(/^Mac/i))),J=Q((()=>X(/^iPhone/i))),ee=Q((()=>X(/^iPad/i)||Z()&&navigator.maxTouchPoints>1)),te=Q((()=>J()||ee()));Q((()=>Z()||te())),Q((()=>Y(/AppleWebKit/i)&&!ne()));const ne=Q((()=>Y(/Chrome/i))),re=Q((()=>Y(/Android/i)));function oe(){let e=i(new Map),t=l(((t,n,r,o)=>{let i=(null==o?void 0:o.once)?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:i,options:o}),t.addEventListener(n,i,o)}),[]),n=l(((t,n,r,o)=>{var i;let l=(null===(i=e.current.get(r))||void 0===i?void 0:i.fn)||r;t.removeEventListener(n,l,o),e.current.delete(r)}),[]),r=l((()=>{e.current.forEach(((e,t)=>{n(e.eventTarget,e.type,t,e.options)}))}),[n]);return a((()=>r),[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ie(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function le(e){let t=i({isFocused:!1,observer:null});q((()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}}),[]);let n=function(e){const t=i(null);return q((()=>{t.current=e}),[e]),l(((...e)=>{const n=t.current;return null==n?void 0:n(...e)}),[])}((t=>{null==e||e(t)}));return l((e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target,o=e=>{if(t.current.isFocused=!1,r.disabled){let t=ie(e);n(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};r.addEventListener('focusout',o,{once:!0}),t.current.observer=new MutationObserver((()=>{if(t.current.isFocused&&r.disabled){var e;null===(e=t.current.observer)||void 0===e||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent('blur',{relatedTarget:n})),r.dispatchEvent(new FocusEvent('focusout',{bubbles:!0,relatedTarget:n}))}})),t.current.observer.observe(r,{attributes:!0,attributeFilter:['disabled']})}}),[n])}Q((()=>Y(/Firefox/i)));let ae=null,se=new Set,ue=new Map,ce=!1,de=!1;const fe={Tab:!0,Escape:!0};function pe(e,t){for(let n of se)n(e,t)}function me(e){ce=!0,function(e){return!(e.metaKey||!Z()&&e.altKey||e.ctrlKey||'Control'===e.key||'Shift'===e.key||'Meta'===e.key)}(e)&&(ae='keyboard',pe('keyboard',e))}function he(e){ae='pointer','mousedown'!==e.type&&'pointerdown'!==e.type||(ce=!0,pe('pointer',e))}function ge(e){var t;(0===(t=e).mozInputSource&&t.isTrusted||(re()&&t.pointerType?'click'===t.type&&1===t.buttons:0===t.detail&&!t.pointerType))&&(ce=!0,ae='virtual')}function ve(e){e.target!==window&&e.target!==document&&e.isTrusted&&(ce||de||(ae='virtual',pe('virtual',e)),ce=!1,de=!1)}function be(){ce=!1,de=!0}function ye(e){if('undefined'==typeof window||ue.get(G(e)))return;const t=G(e),n=$(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ce=!0,r.apply(this,arguments)},n.addEventListener('keydown',me,!0),n.addEventListener('keyup',me,!0),n.addEventListener('click',ge,!0),t.addEventListener('focus',ve,!0),t.addEventListener('blur',be,!1),'undefined'!=typeof PointerEvent?(n.addEventListener('pointerdown',he,!0),n.addEventListener('pointermove',he,!0),n.addEventListener('pointerup',he,!0)):'test'===process.env.NODE_ENV&&(n.addEventListener('mousedown',he,!0),n.addEventListener('mousemove',he,!0),n.addEventListener('mouseup',he,!0)),t.addEventListener('beforeunload',(()=>{xe(e)}),{once:!0}),ue.set(t,{focus:r})}const xe=(e,t)=>{const n=G(e),r=$(e);t&&r.removeEventListener('DOMContentLoaded',t),ue.has(n)&&(n.HTMLElement.prototype.focus=ue.get(n).focus,r.removeEventListener('keydown',me,!0),r.removeEventListener('keyup',me,!0),r.removeEventListener('click',ge,!0),n.removeEventListener('focus',ve,!0),n.removeEventListener('blur',be,!1),'undefined'!=typeof PointerEvent?(r.removeEventListener('pointerdown',he,!0),r.removeEventListener('pointermove',he,!0),r.removeEventListener('pointerup',he,!0)):'test'===process.env.NODE_ENV&&(r.removeEventListener('mousedown',he,!0),r.removeEventListener('mousemove',he,!0),r.removeEventListener('mouseup',he,!0)),ue.delete(n))};function we(){return'pointer'!==ae}'undefined'!=typeof document&&function(e){const t=$(e);let n;'loading'!==t.readyState?ye(e):(n=()=>{ye(e)},t.addEventListener('DOMContentLoaded',n))}();const Ee=new Set(['checkbox','radio','range','color','file','image','button','submit','reset']);function Oe(e,t,n){ye(),a((()=>{let t=(t,r)=>{(function(e,t,n){let r=$(null==n?void 0:n.target);const o='undefined'!=typeof window?G(null==n?void 0:n.target).HTMLInputElement:HTMLInputElement,i='undefined'!=typeof window?G(null==n?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,l='undefined'!=typeof window?G(null==n?void 0:n.target).HTMLElement:HTMLElement,a='undefined'!=typeof window?G(null==n?void 0:n.target).KeyboardEvent:KeyboardEvent;return!((e=e||r.activeElement instanceof o&&!Ee.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof l&&r.activeElement.isContentEditable)&&'keyboard'===t&&n instanceof a&&!fe[n.key])})(!!(null==n?void 0:n.isTextInput),t,r)&&e(we())};return se.add(t),()=>{se.delete(t)}}),t)}function Se(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,a=i({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:u}=oe(),c=l((e=>{e.currentTarget.contains(e.target)&&a.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(a.current.isFocusWithin=!1,u(),n&&n(e),o&&o(!1))}),[n,o,a,u]),d=le(c),f=l((e=>{if(!e.currentTarget.contains(e.target))return;const t=$(e.target),n=U(t);if(!a.current.isFocusWithin&&n===K(e.nativeEvent)){r&&r(e),o&&o(!0),a.current.isFocusWithin=!0,d(e);let n=e.currentTarget;s(t,'focus',(e=>{if(a.current.isFocusWithin&&!z(n,e.target)){let r=new t.defaultView.FocusEvent('blur',{relatedTarget:e.target});!function(e,t){Object.defineProperty(e,'target',{value:t}),Object.defineProperty(e,'currentTarget',{value:t})}(r,n);let o=ie(r);c(o)}}),{capture:!0})}}),[r,o,d,s,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:c}}}let Le=!1,Te=0;function ke(){Le=!0,setTimeout((()=>{Le=!1}),50)}function Ce(e){'touch'===e.pointerType&&ke()}function Ne(){if('undefined'!=typeof document)return'undefined'!=typeof PointerEvent?document.addEventListener('pointerup',Ce):'test'===process.env.NODE_ENV&&document.addEventListener('touchend',ke),Te++,()=>{Te--,Te>0||('undefined'!=typeof PointerEvent?document.removeEventListener('pointerup',Ce):'test'===process.env.NODE_ENV&&document.removeEventListener('touchend',ke))}}function Ae(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=i({isFocused:!1,isFocusVisible:t||we()}),[a,u]=s(!1),[c,d]=s((()=>o.current.isFocused&&o.current.isFocusVisible)),f=l((()=>d(o.current.isFocused&&o.current.isFocusVisible)),[]),p=l((e=>{o.current.isFocused=e,u(e),f()}),[f]);Oe((e=>{o.current.isFocusVisible=e,f()}),[],{isTextInput:n});let{focusProps:m}=function(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const i=l((e=>{if(e.target===e.currentTarget)return r&&r(e),o&&o(!1),!0}),[r,o]),a=le(i),s=l((e=>{const t=$(e.target),r=t?U(t):U();e.target===e.currentTarget&&r===K(e.nativeEvent)&&(n&&n(e),o&&o(!0),a(e))}),[o,n,a]);return{focusProps:{onFocus:!t&&(n||o||r)?s:void 0,onBlur:t||!r&&!o?void 0:i}}}({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=Se({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}var Fe=Object.defineProperty,Pe=(e,t,n)=>(((e,t,n)=>{t in e?Fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,'symbol'!=typeof t?t+'':t,n),n);let Re=new class{constructor(){Pe(this,'current',this.detect()),Pe(this,'handoffState','pending'),Pe(this,'currentId',0)}set(e){this.current!==e&&(this.handoffState='pending',this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return'server'===this.current}get isClient(){return'client'===this.current}detect(){return'undefined'==typeof window||'undefined'==typeof document?'server':'client'}handoff(){'pending'===this.handoffState&&(this.handoffState='complete')}get isHandoffComplete(){return'complete'===this.handoffState}};function Me(e){var t,n;return Re.isServer?null:e?'ownerDocument'in e?e.ownerDocument:'current'in e?null!=(n=null==(t=e.current)?void 0:t.ownerDocument)?n:document:null:document}function De(e){'function'==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}function Ie(){let e=[],t={addEventListener:(e,n,r,o)=>(e.addEventListener(n,r,o),t.add((()=>e.removeEventListener(n,r,o)))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add((()=>cancelAnimationFrame(n)))},nextFrame:(...e)=>t.requestAnimationFrame((()=>t.requestAnimationFrame(...e))),setTimeout(...e){let n=setTimeout(...e);return t.add((()=>clearTimeout(n)))},microTask(...e){let n={current:!0};return De((()=>{n.current&&e[0]()})),t.add((()=>{n.current=!1}))},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add((()=>{Object.assign(e.style,{[t]:r})}))},group(e){let t=Ie();return e(t),this.add((()=>t.dispose()))},add:t=>(e.includes(t)||e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function He(){let[e]=s(Ie);return a((()=>()=>e.dispose()),[e]),e}let _e=(e,t)=>{Re.isServer?a(e,t):c(e,t)};function Be(e){let t=i(e);return _e((()=>{t.current=e}),[e]),t}let je=e=>{let t=Be(e);return o.useCallback(((...e)=>t.current(...e)),[t])};let Ve=f(void 0);function We(){return d(Ve)}function qe(...e){return Array.from(new Set(e.flatMap((e=>'string'==typeof e?e.split(' '):[])))).filter(Boolean).join(' ')}function $e(e,t,...n){if(e in t){let r=t[e];return'function'==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((e=>`"${e}"`)).join(', ')}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,$e),r}var Ge=(e=>(e[e.None=0]='None',e[e.RenderStrategy=1]='RenderStrategy',e[e.Static=2]='Static',e))(Ge||{}),ze=(e=>(e[e.Unmount=0]='Unmount',e[e.Hidden=1]='Hidden',e))(ze||{});function Ue(){let e=function(){let e=i([]),t=l((t=>{for(let n of e.current)null!=n&&('function'==typeof n?n(t):n.current=t)}),[]);return(...n)=>{if(!n.every((e=>null==e)))return e.current=n,t}}();return l((t=>function({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:l,mergeRefs:a}){a=null!=a?a:Ye;let s=Xe(t,e);if(i)return Ke(s,n,r,l,a);let u=null!=o?o:0;if(2&u){let{static:e=!1,...t}=s;if(e)return Ke(t,n,r,l,a)}if(1&u){let{unmount:e=!0,...t}=s;return $e(e?0:1,{0:()=>null,1:()=>Ke({...t,hidden:!0,style:{display:'none'}},n,r,l,a)})}return Ke(s,n,r,l,a)}({mergeRefs:e,...t})),[e])}function Ke(e,t={},n,r,o){let{as:i=n,children:l,refName:a='ref',...s}=et(e,['unmount','static']),u=void 0!==e.ref?{[a]:e.ref}:{},c='function'==typeof l?l(t):l;'className'in s&&s.className&&'function'==typeof s.className&&(s.className=s.className(t)),s['aria-labelledby']&&s['aria-labelledby']===s.id&&(s['aria-labelledby']=void 0);let d={};if(t){let e=!1,n=[];for(let[r,o]of Object.entries(t))'boolean'==typeof o&&(e=!0),!0===o&&n.push(r.replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`)));if(e){d['data-headlessui-state']=n.join(' ');for(let e of n)d[`data-${e}`]=''}}if(i===m&&(Object.keys(Je(s)).length>0||Object.keys(Je(d)).length>0)){if(h(c)&&!(Array.isArray(c)&&c.length>1)){let e=c.props,t=null==e?void 0:e.className,n='function'==typeof t?(...e)=>qe(t(...e),s.className):qe(t,s.className),r=n?{className:n}:{},i=Xe(c.props,Je(et(s,['ref'])));for(let e in d)e in i&&delete d[e];return g(c,Object.assign({},i,d,u,{ref:o(tt(c),u.ref)},r))}if(Object.keys(Je(s)).length>0)throw new Error(['Passing props on "Fragment"!','',`The current component <${r} /> is rendering a "Fragment".`,'However we need to passthrough the following props:',Object.keys(Je(s)).concat(Object.keys(Je(d))).map((e=>` - ${e}`)).join('\n'),'','You can apply a few solutions:',['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".','Render a single element as the child so that we can forward the props onto that element.'].map((e=>` - ${e}`)).join('\n')].join('\n'))}return v(i,Object.assign({},et(s,['ref']),i!==m&&u,i!==m&&d),c)}function Ye(...e){return e.every((e=>null==e))?void 0:t=>{for(let n of e)null!=n&&('function'==typeof n?n(t):n.current=t)}}function Xe(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith('on')&&'function'==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t['aria-disabled'])for(let e in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(n[e]=[e=>{var t;return null==(t=null==e?void 0:e.preventDefault)?void 0:t.call(e)}]);for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function Qe(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith('on')&&'function'==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];for(let e in n)Object.assign(t,{[e](...t){let r=n[e];for(let e of r)null==e||e(...t)}});return t}function Ze(e){var t;return Object.assign(p(e),{displayName:null!=(t=e.displayName)?t:e.name})}function Je(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function et(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function tt(e){return o.version.split('.')[0]>='19'?e.props.ref:e.ref}function nt(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ot(n,rt(t,r),o);return n}function rt(e,t){return e?e+'['+t+']':t}function ot(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ot(e,rt(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):'boolean'==typeof n?e.push([t,n?'1':'0']):'string'==typeof n?e.push([t,n]):'number'==typeof n?e.push([t,`${n}`]):null==n?e.push([t,'']):nt(n,t,e)}var it=(e=>(e[e.None=1]='None',e[e.Focusable=2]='Focusable',e[e.Hidden=4]='Hidden',e))(it||{});let lt=Ze((function(e,t){var n;let{features:r=1,...o}=e,i={ref:t,'aria-hidden':!(2&~r)||(null!=(n=o['aria-hidden'])?n:void 0),hidden:!(4&~r)||void 0,style:{position:'fixed',top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:'hidden',clip:'rect(0, 0, 0, 0)',whiteSpace:'nowrap',borderWidth:'0',...!(4&~r)&&!!(2&~r)&&{display:'none'}}};return Ue()({ourProps:i,theirProps:o,slot:{},defaultTag:'span',name:'Hidden'})})),at=f(null);function st({children:e}){let t=d(at);if(!t)return o.createElement(o.Fragment,null,e);let{target:n}=t;return n?E(o.createElement(o.Fragment,null,e),n):null}function ut({data:e,form:t,disabled:n,onReset:r,overrides:i}){let[l,u]=s(null),c=He();return a((()=>{if(r&&l)return c.addEventListener(l,'reset',r)}),[l,t,r]),o.createElement(st,null,o.createElement(ct,{setForm:u,formId:t}),nt(e).map((([e,r])=>o.createElement(lt,{features:it.Hidden,...Je({key:e,as:'input',type:'hidden',hidden:!0,readOnly:!0,form:t,disabled:n,name:e,value:r,...i})}))))}function ct({setForm:e,formId:t}){return a((()=>{if(t){let n=document.getElementById(t);n&&e(n)}}),[e,t]),t?null:o.createElement(lt,{features:it.Hidden,as:'input',type:'hidden',hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let n=t.closest('form');n&&e(n)}})}let dt=f(void 0);function ft(){return d(dt)}function pt(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=''===(null==t?void 0:t.getAttribute('disabled'));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}let mt=Symbol();function ht(...e){let t=i(e);a((()=>{t.current=e}),[e]);let n=je((e=>{for(let n of t.current)null!=n&&('function'==typeof n?n(e):n.current=e)}));return e.every((e=>null==e||(null==e?void 0:e[mt])))?void 0:n}let gt=f(null);function vt(){let e=d(gt);if(null===e){let e=new Error('You used a <Description /> component, but it is not inside a relevant parent.');throw Error.captureStackTrace&&Error.captureStackTrace(e,vt),e}return e}gt.displayName='DescriptionContext';let bt=Ze((function(e,t){let n=b(),r=We(),{id:o=`headlessui-description-${n}`,...i}=e,l=vt(),a=ht(t);_e((()=>l.register(o)),[o,l.register]);let s=r||!1,c=u((()=>({...l.slot,disabled:s})),[l.slot,s]),d={ref:a,...l.props,id:o};return Ue()({ourProps:d,theirProps:i,slot:c,defaultTag:'p',name:l.name||'Description'})}));Object.assign(bt,{});var yt=(e=>(e.Space=' ',e.Enter='Enter',e.Escape='Escape',e.Backspace='Backspace',e.Delete='Delete',e.ArrowLeft='ArrowLeft',e.ArrowUp='ArrowUp',e.ArrowRight='ArrowRight',e.ArrowDown='ArrowDown',e.Home='Home',e.End='End',e.PageUp='PageUp',e.PageDown='PageDown',e.Tab='Tab',e))(yt||{});let xt=f(null);function wt(){let e=d(xt);if(null===e){let e=new Error('You used a <Label /> component, but it is not inside a relevant parent.');throw Error.captureStackTrace&&Error.captureStackTrace(e,wt),e}return e}function Et(e){var t,n,r;let o=null!=(n=null==(t=d(xt))?void 0:t.value)?n:void 0;return(null!=(r=null==e?void 0:e.length)?r:0)>0?[o,...e].filter(Boolean).join(' '):o}xt.displayName='LabelContext';let Ot=Ze((function(e,t){var n;let r=b(),o=wt(),i=ft(),l=We(),{id:a=`headlessui-label-${r}`,htmlFor:s=(null!=i?i:null==(n=o.props)?void 0:n.htmlFor),passive:c=!1,...d}=e,f=ht(t);_e((()=>o.register(a)),[a,o.register]);let p=je((e=>{let t=e.currentTarget;if(t instanceof HTMLLabelElement&&e.preventDefault(),o.props&&'onClick'in o.props&&'function'==typeof o.props.onClick&&o.props.onClick(e),t instanceof HTMLLabelElement){let e=document.getElementById(t.htmlFor);if(e){let t=e.getAttribute('disabled');if('true'===t||''===t)return;let n=e.getAttribute('aria-disabled');if('true'===n||''===n)return;(e instanceof HTMLInputElement&&('radio'===e.type||'checkbox'===e.type)||'radio'===e.role||'checkbox'===e.role||'switch'===e.role)&&e.click(),e.focus({preventScroll:!0})}}})),m=l||!1,h=u((()=>({...o.slot,disabled:m})),[o.slot,m]),g={ref:f,...o.props,id:a,htmlFor:s,onClick:p};return c&&('onClick'in g&&(delete g.htmlFor,delete g.onClick),'onClick'in d&&delete d.onClick),Ue()({ourProps:g,theirProps:d,slot:h,defaultTag:s?'label':'div',name:o.name||'Label'})})),St=Object.assign(Ot,{});function Lt(e,t){return null!==e&&null!==t&&'object'==typeof e&&'object'==typeof t&&'id'in e&&'id'in t?e.id===t.id:e===t}function Tt(e,t=!1){let[n,r]=y((()=>({})),{}),o=u((()=>function(e){if(null===e)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}(e)),[e,n]);return _e((()=>{if(!e)return;let t=new ResizeObserver(r);return t.observe(e),()=>{t.disconnect()}}),[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let kt=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return void 0===t&&(t=this.factory(e),this.set(e,t)),t}};function Ct(e,t){let n=e(),r=new Set;return{getSnapshot:()=>n,subscribe:e=>(r.add(e),()=>r.delete(e)),dispatch(e,...o){let i=t[e].call(n,...o);i&&(n=i,r.forEach((e=>e())))}}}function Nt(e){return x(e.subscribe,e.getSnapshot,e.getSnapshot)}let At=new kt((()=>Ct((()=>[]),{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(-1===t)return this;let n=this.slice();return n.splice(t,1),n}})));function Ft(e,t){let n=At.get(t),r=b(),o=Nt(n);if(_e((()=>{if(e)return n.dispatch('ADD',r),()=>n.dispatch('REMOVE',r)}),[n,e]),!e)return!1;let i=o.indexOf(r),l=o.length;return-1===i&&(i=l,l+=1),i===l-1}let Pt=new Map,Rt=new Map;function Mt(e){var t;let n=null!=(t=Rt.get(e))?t:0;return Rt.set(e,n+1),0!==n||(Pt.set(e,{'aria-hidden':e.getAttribute('aria-hidden'),inert:e.inert}),e.setAttribute('aria-hidden','true'),e.inert=!0),()=>Dt(e)}function Dt(e){var t;let n=null!=(t=Rt.get(e))?t:1;if(1===n?Rt.delete(e):Rt.set(e,n-1),1!==n)return;let r=Pt.get(e);r&&(null===r['aria-hidden']?e.removeAttribute('aria-hidden'):e.setAttribute('aria-hidden',r['aria-hidden']),e.inert=r.inert,Pt.delete(e))}function It(e,{allowed:t,disallowed:n}={}){let r=Ft(e,'inert-others');_e((()=>{var e,o;if(!r)return;let i=Ie();for(let t of null!=(e=null==n?void 0:n())?e:[])t&&i.add(Mt(t));let l=null!=(o=null==t?void 0:t())?o:[];for(let e of l){if(!e)continue;let t=Me(e);if(!t)continue;let n=e.parentElement;for(;n&&n!==t.body;){for(let e of n.children)l.some((t=>e.contains(t)))||i.add(Mt(e));n=n.parentElement}}return i.dispose}),[r,t,n])}let Ht=['[contentEditable=true]','[tabindex]','a[href]','area[href]','button:not([disabled])','iframe','input:not([disabled])','select:not([disabled])','textarea:not([disabled])'].map((e=>`${e}:not([tabindex='-1'])`)).join(','),_t=['[data-autofocus]'].map((e=>`${e}:not([tabindex='-1'])`)).join(',');var Bt=(e=>(e[e.First=1]='First',e[e.Previous=2]='Previous',e[e.Next=4]='Next',e[e.Last=8]='Last',e[e.WrapAround=16]='WrapAround',e[e.NoScroll=32]='NoScroll',e[e.AutoFocus=64]='AutoFocus',e))(Bt||{}),jt=(e=>(e[e.Error=0]='Error',e[e.Overflow=1]='Overflow',e[e.Success=2]='Success',e[e.Underflow=3]='Underflow',e))(jt||{}),Vt=(e=>(e[e.Previous=-1]='Previous',e[e.Next=1]='Next',e))(Vt||{});function Wt(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(Ht)).sort(((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER))))}var qt=(e=>(e[e.Strict=0]='Strict',e[e.Loose=1]='Loose',e))(qt||{});function $t(e,t=0){var n;return e!==(null==(n=Me(e))?void 0:n.body)&&$e(t,{0:()=>e.matches(Ht),1(){let t=e;for(;null!==t;){if(t.matches(Ht))return!0;t=t.parentElement}return!1}})}var Gt=(e=>(e[e.Keyboard=0]='Keyboard',e[e.Mouse=1]='Mouse',e))(Gt||{});'undefined'!=typeof window&&'undefined'!=typeof document&&(document.addEventListener('keydown',(e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible='')}),!0),document.addEventListener('click',(e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible='')}),!0));let zt=['textarea','input'].join(',');function Ut(e,t=e=>e){return e.slice().sort(((e,n)=>{let r=t(e),o=t(n);if(null===r||null===o)return 0;let i=r.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function Kt(e,t){return function(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?Ut(e):e:64&t?function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(_t)).sort(((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER))))}(e):Wt(e);o.length>0&&l.length>1&&(l=l.filter((e=>!o.some((t=>null!=t&&'current'in t?(null==t?void 0:t.current)===e:t===e))))),r=null!=r?r:i.activeElement;let a,s=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error('Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last')})(),u=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,l.indexOf(r))-1;if(4&t)return Math.max(0,l.indexOf(r))+1;if(8&t)return l.length-1;throw new Error('Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last')})(),c=32&t?{preventScroll:!0}:{},d=0,f=l.length;do{if(d>=f||d+f<=0)return 0;let e=u+d;if(16&t)e=(e+f)%f;else{if(e<0)return 3;if(e>=f)return 1}a=l[e],null==a||a.focus(c),d+=s}while(a!==i.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,zt))&&n}(a)&&a.select(),2}(Wt(),t,{relativeTo:e})}function Yt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Xt(){return Yt()||/Android/gi.test(window.navigator.userAgent)}function Qt(e,t,n,r){let o=Be(n);a((()=>{if(e)return document.addEventListener(t,n,r),()=>document.removeEventListener(t,n,r);function n(e){o.current(e)}}),[e,t,r])}function Zt(e,t,n){let r=Ft(e,'outside-click'),o=Be(n),s=l(((e,n)=>{if(e.defaultPrevented)return;let r=n(e);if(null===r||!r.getRootNode().contains(r)||!r.isConnected)return;let i=function e(t){return'function'==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(t);for(let t of i)if(null!==t&&(t.contains(r)||e.composed&&e.composedPath().includes(t)))return;return!$t(r,qt.Loose)&&-1!==r.tabIndex&&e.preventDefault(),o.current(e,r)}),[o,t]),u=i(null);Qt(r,'pointerdown',(e=>{var t,n;u.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target}),!0),Qt(r,'mousedown',(e=>{var t,n;u.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target}),!0),Qt(r,'click',(e=>{Xt()||u.current&&(s(e,(()=>u.current)),u.current=null)}),!0);let c=i({x:0,y:0});Qt(r,'touchstart',(e=>{c.current.x=e.touches[0].clientX,c.current.y=e.touches[0].clientY}),!0),Qt(r,'touchend',(e=>{let t=e.changedTouches[0].clientX,n=e.changedTouches[0].clientY;if(!(Math.abs(t-c.current.x)>=30||Math.abs(n-c.current.y)>=30))return s(e,(()=>e.target instanceof HTMLElement?e.target:null))}),!0),function(e,t,n,r){let o=Be(n);a((()=>{if(e)return window.addEventListener(t,n,r),()=>window.removeEventListener(t,n,r);function n(e){o.current(e)}}),[e,t,r])}(r,'blur',(e=>s(e,(()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null))),!0)}function Jt(...e){return u((()=>Me(...e)),[...e])}function en(e,t){return u((()=>{var n;if(e.type)return e.type;let r=null!=(n=e.as)?n:'button';return'string'==typeof r&&'button'===r.toLowerCase()||'BUTTON'===(null==t?void 0:t.tagName)&&!t.hasAttribute('type')?'button':void 0}),[e.type,e.as,t])}function tn(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=null!=(n=t.defaultView)?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),i=Math.max(0,e-o);n.style(r,'paddingRight',`${i}px`)}}}function nn(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let rn=Ct((()=>new Map),{PUSH(e,t){var n;let r=null!=(n=this.get(e))?n:{doc:e,count:0,d:Ie(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:nn(n)},o=[Yt()?{before({doc:e,d:t,meta:n}){function r(e){return n.containers.flatMap((e=>e())).some((t=>t.contains(e)))}t.microTask((()=>{var n;if('auto'!==window.getComputedStyle(e.documentElement).scrollBehavior){let n=Ie();n.style(e.documentElement,'scrollBehavior','auto'),t.add((()=>t.microTask((()=>n.dispose()))))}let o=null!=(n=window.scrollY)?n:window.pageYOffset,i=null;t.addEventListener(e,'click',(t=>{if(t.target instanceof HTMLElement)try{let n=t.target.closest('a');if(!n)return;let{hash:o}=new URL(n.href),l=e.querySelector(o);l&&!r(l)&&(i=l)}catch{}}),!0),t.addEventListener(e,'touchstart',(e=>{if(e.target instanceof HTMLElement)if(r(e.target)){let n=e.target;for(;n.parentElement&&r(n.parentElement);)n=n.parentElement;t.style(n,'overscrollBehavior','contain')}else t.style(e.target,'touchAction','none')})),t.addEventListener(e,'touchmove',(e=>{if(e.target instanceof HTMLElement){if('INPUT'===e.target.tagName)return;if(r(e.target)){let t=e.target;for(;t.parentElement&&''!==t.dataset.headlessuiPortal&&!(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)t=t.parentElement;''===t.dataset.headlessuiPortal&&e.preventDefault()}else e.preventDefault()}}),{passive:!1}),t.add((()=>{var e;let t=null!=(e=window.scrollY)?e:window.pageYOffset;o!==t&&window.scrollTo(0,o),i&&i.isConnected&&(i.scrollIntoView({block:'nearest'}),i=null)}))}))}}:{},tn(),{before({doc:e,d:t}){t.style(e.documentElement,'overflow','hidden')}}];o.forEach((({before:e})=>null==e?void 0:e(r))),o.forEach((({after:e})=>null==e?void 0:e(r)))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});function on(e,t,n=()=>[document.body]){!function(e,t,n=()=>({containers:[]})){let r=Nt(rn),o=t?r.get(t):void 0,i=!!o&&o.count>0;_e((()=>{if(t&&e)return rn.dispatch('PUSH',t,n),()=>rn.dispatch('POP',t,n)}),[e,t])}(Ft(e,'scroll-lock'),t,(e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],n]}}))}function ln(e){return[e.screenX,e.screenY]}function an(){let e=i([-1,-1]);return{wasMoved(t){let n=ln(t);return(e.current[0]!==n[0]||e.current[1]!==n[1])&&(e.current=n,!0)},update(t){e.current=ln(t)}}}var sn,un;rn.subscribe((()=>{let e=rn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let e='hidden'===t.get(n.doc),r=0!==n.count;(r&&!e||!r&&e)&&rn.dispatch(n.count>0?'SCROLL_PREVENT':'SCROLL_ALLOW',n),0===n.count&&rn.dispatch('TEARDOWN',n)}})),'undefined'!=typeof process&&'undefined'!=typeof globalThis&&'undefined'!=typeof Element&&'test'===(null==(sn=null==process?void 0:process.env)?void 0:sn.NODE_ENV)&&void 0===(null==(un=null==Element?void 0:Element.prototype)?void 0:un.getAnimations)&&(Element.prototype.getAnimations=()=>(console.warn(['Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.','Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.','','Example usage:','```js','import { mockAnimationsApi } from \'jsdom-testing-mocks\'','mockAnimationsApi()','```'].join('\n')),[]));var cn=(e=>(e[e.None=0]='None',e[e.Closed=1]='Closed',e[e.Enter=2]='Enter',e[e.Leave=4]='Leave',e))(cn||{});function dn(e){let t={};for(let n in e)!0===e[n]&&(t[`data-${n}`]='');return t}function fn(e,t,n,r){let[o,a]=s(n),{hasFlag:u,addFlag:c,removeFlag:d}=function(e=0){let[t,n]=s(e),r=l((e=>n(e)),[t]),o=l((e=>n((t=>t|e))),[t]),i=l((e=>(t&e)===e),[t]),a=l((e=>n((t=>t&~e))),[n]),u=l((e=>n((t=>t^e))),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:i,removeFlag:a,toggleFlag:u}}(e&&o?3:0),f=i(!1),p=i(!1),m=He();return _e((()=>{if(e)return n&&a(!0),t?(null==void 0||undefined.call(r,n),function(e,{prepare:t,run:n,done:r,inFlight:o}){let i=Ie();return function(e,{inFlight:t,prepare:n}){if(null!=t&&t.current)return void n();let r=e.style.transition;e.style.transition='none',n(),e.offsetHeight,e.style.transition=r}(e,{prepare:t,inFlight:o}),i.nextFrame((()=>{n(),i.requestAnimationFrame((()=>{i.add(function(e,t){var n,r;let o=Ie();if(!e)return o.dispose;let i=!1;o.add((()=>{i=!0}));let l=null!=(r=null==(n=e.getAnimations)?void 0:n.call(e).filter((e=>e instanceof CSSTransition)))?r:[];return 0===l.length?(t(),o.dispose):(Promise.allSettled(l.map((e=>e.finished))).then((()=>{i||t()})),o.dispose)}(e,r))}))})),i.dispose}(t,{inFlight:f,prepare(){p.current?p.current=!1:p.current=f.current,f.current=!0,!p.current&&(n?(c(3),d(4)):(c(4),d(2)))},run(){p.current?n?(d(3),c(4)):(d(4),c(3)):n?d(1):c(1)},done(){p.current&&'function'==typeof t.getAnimations&&t.getAnimations().length>0||(f.current=!1,d(7),n||a(!1),null==void 0||undefined.call(r,n))}})):void(n&&c(3))}),[e,n,t,m]),e?[o,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function pn(){return'undefined'!=typeof window}function mn(e){return vn(e)?(e.nodeName||'').toLowerCase():'#document'}function hn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function gn(e){var t;return null==(t=(vn(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function vn(e){return!!pn()&&(e instanceof Node||e instanceof hn(e).Node)}function bn(e){return!!pn()&&(e instanceof Element||e instanceof hn(e).Element)}function yn(e){return!!pn()&&(e instanceof HTMLElement||e instanceof hn(e).HTMLElement)}function xn(e){return!(!pn()||'undefined'==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof hn(e).ShadowRoot)}function wn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=kn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!['inline','contents'].includes(o)}function En(e){return['table','td','th'].includes(mn(e))}function On(e){return[':popover-open',':modal'].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Sn(e){const t=Ln(),n=bn(e)?kn(e):e;return['transform','translate','scale','rotate','perspective'].some((e=>!!n[e]&&'none'!==n[e]))||!!n.containerType&&'normal'!==n.containerType||!t&&!!n.backdropFilter&&'none'!==n.backdropFilter||!t&&!!n.filter&&'none'!==n.filter||['transform','translate','scale','rotate','perspective','filter'].some((e=>(n.willChange||'').includes(e)))||['paint','layout','strict','content'].some((e=>(n.contain||'').includes(e)))}function Ln(){return!('undefined'==typeof CSS||!CSS.supports)&&CSS.supports('-webkit-backdrop-filter','none')}function Tn(e){return['html','body','#document'].includes(mn(e))}function kn(e){return hn(e).getComputedStyle(e)}function Cn(e){return bn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Nn(e){if('html'===mn(e))return e;const t=e.assignedSlot||e.parentNode||xn(e)&&e.host||gn(e);return xn(t)?t.host:t}function An(e){const t=Nn(e);return Tn(t)?e.ownerDocument?e.ownerDocument.body:e.body:yn(t)&&wn(t)?t:An(t)}function Fn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=An(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=hn(o);if(i){const e=Pn(l);return t.concat(l,l.visualViewport||[],wn(o)?o:[],e&&n?Fn(e):[])}return t.concat(o,Fn(o,[],n))}function Pn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Rn=Math.min,Mn=Math.max,Dn=Math.round,In=Math.floor,Hn=e=>({x:e,y:e}),_n={left:'right',right:'left',bottom:'top',top:'bottom'},Bn={start:'end',end:'start'};function jn(e,t,n){return Mn(e,Rn(t,n))}function Vn(e,t){return'function'==typeof e?e(t):e}function Wn(e){return e.split('-')[0]}function qn(e){return e.split('-')[1]}function $n(e){return'x'===e?'y':'x'}function Gn(e){return'y'===e?'height':'width'}function zn(e){return['top','bottom'].includes(Wn(e))?'y':'x'}function Un(e){return $n(zn(e))}function Kn(e){return e.replace(/start|end/g,(e=>Bn[e]))}function Yn(e){return e.replace(/left|right|bottom|top/g,(e=>_n[e]))}function Xn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Qn(e,t,n){let{reference:r,floating:o}=e;const i=zn(t),l=Un(t),a=Gn(l),s=Wn(t),u='y'===i,c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let p;switch(s){case'top':p={x:c,y:r.y-o.height};break;case'bottom':p={x:c,y:r.y+r.height};break;case'right':p={x:r.x+r.width,y:d};break;case'left':p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(qn(t)){case'start':p[l]-=f*(n&&u?-1:1);break;case'end':p[l]+=f*(n&&u?-1:1)}return p}async function Zn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:u='clippingAncestors',rootBoundary:c='viewport',elementContext:d='floating',altBoundary:f=!1,padding:p=0}=Vn(t,e),m=function(e){return'number'!=typeof e?(e=>({top:0,right:0,bottom:0,left:0,...e}))(e):{top:e,right:e,bottom:e,left:e}}(p),h=a[f?'floating'===d?'reference':'floating':d],g=Xn(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:s})),v='floating'===d?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},x=Xn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:b,strategy:s}):v);return{top:(g.top-x.top+m.top)/y.y,bottom:(x.bottom-g.bottom+m.bottom)/y.y,left:(g.left-x.left+m.left)/y.x,right:(x.right-g.right+m.right)/y.x}}function Jn(e){const t=kn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=yn(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,a=Dn(n)!==i||Dn(r)!==l;return a&&(n=i,r=l),{width:n,height:r,$:a}}function er(e){return bn(e)?e:e.contextElement}function tr(e){const t=er(e);if(!yn(t))return Hn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Jn(t);let l=(i?Dn(n.width):n.width)/r,a=(i?Dn(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}const nr=Hn(0);function rr(e){const t=hn(e);return Ln()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:nr}function or(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=er(e);let l=Hn(1);t&&(r?bn(r)&&(l=tr(r)):l=tr(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==hn(e))&&t}(i,n,r)?rr(i):Hn(0);let s=(o.left+a.x)/l.x,u=(o.top+a.y)/l.y,c=o.width/l.x,d=o.height/l.y;if(i){const e=hn(i),t=r&&bn(r)?hn(r):r;let n=e,o=Pn(n);for(;o&&r&&t!==n;){const e=tr(o),t=o.getBoundingClientRect(),r=kn(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,u*=e.y,c*=e.x,d*=e.y,s+=i,u+=l,n=hn(o),o=Pn(n)}}return Xn({width:c,height:d,x:s,y:u})}function ir(e,t){const n=Cn(e).scrollLeft;return t?t.left+n:or(gn(e)).left+n}function lr(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:ir(e,r)),y:r.top+t.scrollTop}}function ar(e,t,n){let r;if('viewport'===t)r=function(e,t){const n=hn(e),r=gn(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,s=0;if(o){i=o.width,l=o.height;const e=Ln();(!e||e&&'fixed'===t)&&(a=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n);else if('document'===t)r=function(e){const t=gn(e),n=Cn(e),r=e.ownerDocument.body,o=Mn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Mn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ir(e);const a=-n.scrollTop;return'rtl'===kn(r).direction&&(l+=Mn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(gn(e));else if(bn(t))r=function(e,t){const n=or(e,!0,'fixed'===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=yn(e)?tr(e):Hn(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=rr(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Xn(r)}function sr(e,t){const n=Nn(e);return!(n===t||!bn(n)||Tn(n))&&('fixed'===kn(n).position||sr(n,t))}function ur(e,t,n){const r=yn(t),o=gn(t),i='fixed'===n,l=or(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const s=Hn(0);function u(){s.x=ir(o)}if(r||!r&&!i)if(('body'!==mn(t)||wn(o))&&(a=Cn(t)),r){const e=or(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&u();i&&!r&&o&&u();const c=!o||r||i?Hn(0):lr(o,a);return{x:l.left+a.scrollLeft-s.x-c.x,y:l.top+a.scrollTop-s.y-c.y,width:l.width,height:l.height}}function cr(e){return'static'===kn(e).position}function dr(e,t){if(!yn(e)||'fixed'===kn(e).position)return null;if(t)return t(e);let n=e.offsetParent;return gn(e)===n&&(n=n.ownerDocument.body),n}function fr(e,t){const n=hn(e);if(On(e))return n;if(!yn(e)){let t=Nn(e);for(;t&&!Tn(t);){if(bn(t)&&!cr(t))return t;t=Nn(t)}return n}let r=dr(e,t);for(;r&&En(r)&&cr(r);)r=dr(r,t);return r&&Tn(r)&&cr(r)&&!Sn(r)?n:r||function(e){let t=Nn(e);for(;yn(t)&&!Tn(t);){if(Sn(t))return t;if(On(t))return null;t=Nn(t)}return null}(e)||n}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i='fixed'===o,l=gn(r),a=!!t&&On(t.floating);if(r===l||a&&i)return n;let s={scrollLeft:0,scrollTop:0},u=Hn(1);const c=Hn(0),d=yn(r);if((d||!d&&!i)&&(('body'!==mn(r)||wn(l))&&(s=Cn(r)),yn(r))){const e=or(r);u=tr(r),c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}const f=!l||d||i?Hn(0):lr(l,s,!0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-s.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-s.scrollTop*u.y+c.y+f.y}},getDocumentElement:gn,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...'clippingAncestors'===n?On(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Fn(e,[],!1).filter((e=>bn(e)&&'body'!==mn(e))),o=null;const i='fixed'===kn(e).position;let l=i?Nn(e):e;for(;bn(l)&&!Tn(l);){const t=kn(l),n=Sn(l);n||'fixed'!==t.position||(o=null),(i?!n&&!o:!n&&'static'===t.position&&o&&['absolute','fixed'].includes(o.position)||wn(l)&&!n&&sr(e,l))?r=r.filter((e=>e!==l)):o=t,l=Nn(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],a=i.reduce(((e,n)=>{const r=ar(t,n,o);return e.top=Mn(r.top,e.top),e.right=Rn(r.right,e.right),e.bottom=Rn(r.bottom,e.bottom),e.left=Mn(r.left,e.left),e}),ar(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:fr,getElementRects:async function(e){const t=this.getOffsetParent||fr,n=this.getDimensions,r=await n(e.floating);return{reference:ur(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Jn(e);return{width:t,height:n}},getScale:tr,isElement:bn,isRTL:function(e){return'rtl'===kn(e).direction}};function mr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hr(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l='function'==typeof ResizeObserver,layoutShift:a='function'==typeof IntersectionObserver,animationFrame:s=!1}=r,u=er(e),c=o||i?[...u?Fn(u):[],...Fn(t)]:[];c.forEach((e=>{o&&e.addEventListener('scroll',n,{passive:!0}),i&&e.addEventListener('resize',n)}));const d=u&&a?function(e,t){let n,r=null;const o=gn(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(a,s){void 0===a&&(a=!1),void 0===s&&(s=1),i();const u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:p}=u;if(a||t(),!f||!p)return;const m={rootMargin:-In(d)+'px '+-In(o.clientWidth-(c+f))+'px '+-In(o.clientHeight-(d+p))+'px '+-In(c)+'px',threshold:Mn(0,Rn(1,s))||1};let h=!0;function g(t){const r=t[0].intersectionRatio;if(r!==s){if(!h)return l();r?l(!1,r):n=setTimeout((()=>{l(!1,1e-7)}),1e3)}1!==r||mr(u,e.getBoundingClientRect())||l(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(u,n):null;let f,p=-1,m=null;l&&(m=new ResizeObserver((e=>{let[r]=e;r&&r.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=m)||e.observe(t)}))),n()})),u&&!s&&m.observe(u),m.observe(t));let h=s?or(e):null;return s&&function t(){const r=or(e);h&&!mr(h,r)&&n();h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;c.forEach((e=>{o&&e.removeEventListener('scroll',n),i&&e.removeEventListener('resize',n)})),null==d||d(),null==(e=m)||e.disconnect(),m=null,s&&cancelAnimationFrame(f)}}const gr=Zn,vr=e=>(void 0===e&&(e=0),{name:'offset',options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:a}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=Wn(n),a=qn(n),s='y'===zn(n),u=['left','top'].includes(l)?-1:1,c=i&&s?-1:1,d=Vn(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}='number'==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&'number'==typeof m&&(p='end'===a?-1*m:m),s?{x:p*c,y:f*u}:{x:f*u,y:p*c}}(t,e);return l===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}),br=e=>(void 0===e&&(e={}),{name:'shift',options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Vn(e,t),u={x:n,y:r},c=await Zn(t,s),d=zn(Wn(o)),f=$n(d);let p=u[f],m=u[d];if(i){const e='y'===f?'bottom':'right';p=jn(p+c['y'===f?'top':'left'],p,p-c[e])}if(l){const e='y'===d?'bottom':'right';m=jn(m+c['y'===d?'top':'left'],m,m-c[e])}const h=a.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:i,[d]:l}}}}}),yr=e=>(void 0===e&&(e={}),{name:'flip',options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p='bestFit',fallbackAxisSideDirection:m='none',flipAlignment:h=!0,...g}=Vn(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Wn(o),b=zn(a),y=Wn(a)===a,x=await(null==s.isRTL?void 0:s.isRTL(u.floating)),w=f||(y||!h?[Yn(a)]:function(e){const t=Yn(e);return[Kn(e),t,Kn(t)]}(a)),E='none'!==m;!f&&E&&w.push(...function(e,t,n,r){const o=qn(e);let i=((e,t,n)=>{const r=['left','right'],o=['right','left'],i=['top','bottom'],l=['bottom','top'];switch(e){case'top':case'bottom':return n?t?o:r:t?r:o;case'left':case'right':return t?i:l;default:return[]}})(Wn(e),'start'===n,