!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"substack@538433c"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fa5ea2a1-9645-4736-a37f-40071596722e",e._sentryDebugIdIdentifier="sentry-dbid-fa5ea2a1-9645-4736-a37f-40071596722e")}catch(e){}}(),(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["46393"],{44383:function(e,t,n){var r=n(76001);e.exports=n(38816)(function(e,t){return null==e?{}:r(e,t)})},38314:function(e,t,n){"use strict";n.d(t,{iQ:()=>$,we:()=>U,s9:()=>Q,XF:()=>N,Mk:()=>_,bv:()=>et,DL:()=>eo});var r=n(17402),o=n(43859);function u(e){let t=e.activeElement;for(;(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function l(e,t){if(!e||!t)return!1;let n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&(0,o.Ng)(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function i(){let e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function c(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}function s(){return/apple/i.test(navigator.vendor)}function a(){let e=/android/i;return e.test(i())||e.test(c())}function f(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function d(e){return(null==e?void 0:e.ownerDocument)||document}function v(e,t){return null!=t&&("composedPath"in e?e.composedPath().includes(t):null!=e.target&&t.contains(e.target))}function m(e){return"composedPath"in e?e.composedPath()[0]:e.target}var p=n(4006),g=n(49054),E=n(67535);let y={...r},h=y.useInsertionEffect||(e=>e());function b(e){let t=r.useRef(()=>{});return h(()=>{t.current=e}),r.useCallback(function(){for(var e=arguments.length,n=Array(e),r=0;r"floating-ui-"+Math.random().toString(36).slice(2,6)+x++,L=y.useId||function(){let[e,t]=r.useState(()=>R?C():void 0);return w(()=>{null==e&&t(C())},[]),r.useEffect(()=>{R=!0},[]),e},k=r.createContext(null),M=r.createContext(null),A=()=>{var e;return(null==(e=r.useContext(k))?void 0:e.id)||null};function P(e){return"data-floating-ui-"+e}function T(e){-1!==e.current&&(clearTimeout(e.current),e.current=-1)}function D(e){let t=(0,r.useRef)(e);return w(()=>{t.current=e}),t}let q=P("safe-polygon");function S(e,t,n){return n&&!f(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function _(e,t){void 0===t&&(t={});let{open:n,onOpenChange:u,dataRef:i,events:c,elements:s}=e,{enabled:a=!0,delay:v=0,handleClose:m=null,mouseOnly:p=!1,restMs:g=0,move:E=!0}=t,y=r.useContext(M),h=A(),R=D(m),x=D(v),C=D(n),L=r.useRef(),k=r.useRef(-1),P=r.useRef(),_=r.useRef(-1),I=r.useRef(!0),O=r.useRef(!1),K=r.useRef(()=>{}),Y=r.useRef(!1),j=r.useCallback(()=>{var e;let t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t},[i]);r.useEffect(()=>{if(a)return c.on("openchange",e),()=>{c.off("openchange",e)};function e(e){let{open:t}=e;t||(T(k),T(_),I.current=!0,Y.current=!1)}},[a,c]),r.useEffect(()=>{if(!a||!R.current||!n)return;function e(e){j()&&u(!1,e,"hover")}let t=d(s.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[s.floating,n,u,a,R,j]);let B=r.useCallback(function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");let r=S(x.current,"close",L.current);r&&!P.current?(T(k),k.current=window.setTimeout(()=>u(!1,e,n),r)):t&&(T(k),u(!1,e,n))},[x,u]),F=b(()=>{K.current(),P.current=void 0}),W=b(()=>{if(O.current){let e=d(s.floating).body;e.style.pointerEvents="",e.removeAttribute(q),O.current=!1}}),X=b(()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type));r.useEffect(()=>{if(a&&(0,o.vq)(s.domReference)){var e;let o=s.domReference;return n&&o.addEventListener("mouseleave",c),null==(e=s.floating)||e.addEventListener("mouseleave",c),E&&o.addEventListener("mousemove",t,{once:!0}),o.addEventListener("mouseenter",t),o.addEventListener("mouseleave",r),()=>{var e;n&&o.removeEventListener("mouseleave",c),null==(e=s.floating)||e.removeEventListener("mouseleave",c),E&&o.removeEventListener("mousemove",t),o.removeEventListener("mouseenter",t),o.removeEventListener("mouseleave",r)}}function t(e){if(T(k),I.current=!1,p&&!f(L.current)||g>0&&!S(x.current,"open"))return;let t=S(x.current,"open",L.current);t?k.current=window.setTimeout(()=>{C.current||u(!0,e,"hover")},t):n||u(!0,e,"hover")}function r(e){if(X())return;K.current();let t=d(s.floating);if(T(_),Y.current=!1,R.current&&i.current.floatingContext){n||T(k),P.current=R.current({...i.current.floatingContext,tree:y,x:e.clientX,y:e.clientY,onClose(){W(),F(),X()||B(e,!0,"safe-polygon")}});let r=P.current;t.addEventListener("mousemove",r),K.current=()=>{t.removeEventListener("mousemove",r)};return}"touch"===L.current&&l(s.floating,e.relatedTarget)||B(e)}function c(e){X()||i.current.floatingContext&&(null==R.current||R.current({...i.current.floatingContext,tree:y,x:e.clientX,y:e.clientY,onClose(){W(),F(),X()||B(e)}})(e))}},[s,a,e,p,g,E,B,F,W,u,n,C,y,x,R,i,X]),w(()=>{var e,t;if(a&&n&&null!=(e=R.current)&&e.__options.blockPointerEvents&&j()){O.current=!0;let e=s.floating;if((0,o.vq)(s.domReference)&&e){let n=d(s.floating).body;n.setAttribute(q,"");let r=s.domReference,o=null==y||null==(t=y.nodesRef.current.find(e=>e.id===h))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",r.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents="",e.style.pointerEvents=""}}}},[a,n,h,s,y,R,j]),w(()=>{n||(L.current=void 0,Y.current=!1,F(),W())},[n,F,W]),r.useEffect(()=>()=>{F(),T(k),T(_),W()},[a,s.domReference,F,W]);let N=r.useMemo(()=>{function e(e){L.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function r(){I.current||C.current||u(!0,t,"hover")}p&&!f(L.current)||n||0===g||Y.current&&e.movementX**2+e.movementY**2<2||(T(_),"touch"===L.current?r():(Y.current=!0,_.current=window.setTimeout(r,g)))}}},[p,u,n,C,g]),z=r.useMemo(()=>({onMouseEnter(){T(k)},onMouseLeave(e){X()||B(e.nativeEvent,!1)}}),[B,X]);return r.useMemo(()=>a?{reference:N,floating:z}:{},[a,N,z])}function I(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(r);return n}let O=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function K(e,t){let n=(0,g.Kr)(e,O());"prev"===t&&n.reverse();let r=n.indexOf(u(d(e)));return n.slice(r+1)[0]}function Y(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!l(n,r)}function j(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}let B={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},F=r.forwardRef(function(e,t){let[n,o]=r.useState();w(()=>{s()&&o("button")},[]);let u={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[P("focus-guard")]:"",style:B};return(0,p.Y)("span",{...e,...u})}),W=r.createContext(null),X=P("portal");function N(e){let{children:t,id:n,root:u,preserveTabOrder:l=!0}=e,i=function(e){void 0===e&&(e={});let{id:t,root:n}=e,u=L(),l=z(),[i,c]=r.useState(null),s=r.useRef(null);return w(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{s.current=null})},[i]),w(()=>{if(!u||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement("div");n.id=u,n.setAttribute(X,""),e.appendChild(n),s.current=n,c(n)},[t,u]),w(()=>{if(null===n||!u||s.current)return;let e=n||(null==l?void 0:l.portalNode);e&&!(0,o.vq)(e)&&(e=e.current),e=e||document.body;let r=null;t&&((r=document.createElement("div")).id=t,e.appendChild(r));let i=document.createElement("div");i.id=u,i.setAttribute(X,""),(e=r||e).appendChild(i),s.current=i,c(i)},[t,n,u,l]),i}({id:n,root:u}),[c,s]=r.useState(null),a=r.useRef(null),f=r.useRef(null),d=r.useRef(null),v=r.useRef(null),m=null==c?void 0:c.modal,E=null==c?void 0:c.open,y=!!c&&!c.modal&&c.open&&l&&!!(u||i);return r.useEffect(()=>{if(i&&l&&!m)return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){i&&Y(e)&&("focusin"===e.type?j:function(e){(0,g.Kr)(e,O()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})})(i)}},[i,l,m]),r.useEffect(()=>{!i||E||j(i)},[E,i]),(0,p.FD)(W.Provider,{value:r.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:v,portalNode:i,setFocusManagerState:s}),[l,i]),children:[y&&i&&(0,p.Y)(F,{"data-type":"outside",ref:a,onFocus:e=>{if(Y(e,i)){var t;null==(t=d.current)||t.focus()}else{let e=K(document.body,"prev")||(null==c?void 0:c.domReference);null==e||e.focus()}}}),y&&i&&(0,p.Y)("span",{"aria-owns":i.id,style:B}),i&&r.createPortal(t,i),y&&i&&(0,p.Y)(F,{"data-type":"outside",ref:f,onFocus:e=>{if(Y(e,i)){var t;null==(t=v.current)||t.focus()}else{let t=K(document.body,"next")||(null==c?void 0:c.domReference);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})}let z=()=>r.useContext(W),H={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},V={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Z=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function Q(e,t){void 0===t&&(t={});let{open:n,onOpenChange:u,elements:i,dataRef:c}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:f=!0,outsidePressEvent:p="pointerdown",referencePress:g=!1,referencePressEvent:E="pointerdown",ancestorScroll:y=!1,bubbles:h,capture:w}=t,R=r.useContext(M),x=b("function"==typeof f?f:()=>!1),C="function"==typeof f?x:f,L=r.useRef(!1),k=r.useRef(!1),{escapeKey:A,outsidePress:T}=Z(h),{escapeKey:D,outsidePress:q}=Z(w),S=r.useRef(!1),_=b(e=>{var t;if(!n||!s||!a||"Escape"!==e.key||S.current)return;let r=null==(t=c.current.floatingContext)?void 0:t.nodeId,o=R?I(R.nodesRef.current,r):[];if(!A&&(e.stopPropagation(),o.length>0)){let e=!0;if(o.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}u(!1,"nativeEvent"in e?e.nativeEvent:e,"escape-key")}),O=b(e=>{var t;let n=()=>{var t;_(e),null==(t=m(e))||t.removeEventListener("keydown",n)};null==(t=m(e))||t.addEventListener("keydown",n)}),K=b(e=>{var t;let n=L.current;L.current=!1;let r=k.current;if(k.current=!1,"click"===p&&r||n||"function"==typeof C&&!C(e))return;let s=m(e),a="["+P("inert")+"]",f=d(i.floating).querySelectorAll(a),g=(0,o.vq)(s)?s:null;for(;g&&!(0,o.eu)(g);){let e=(0,o.$4)(g);if((0,o.eu)(e)||!(0,o.vq)(e))break;g=e}if(f.length&&(0,o.vq)(s)&&!s.matches("html,body")&&!l(s,i.floating)&&Array.from(f).every(e=>!l(g,e)))return;if((0,o.sb)(s)&&B){let t=(0,o.eu)(s),n=(0,o.L9)(s),r=/auto|scroll/,u=t||r.test(n.overflowX),l=t||r.test(n.overflowY),i=u&&s.clientWidth>0&&s.scrollWidth>s.clientWidth,c=l&&s.clientHeight>0&&s.scrollHeight>s.clientHeight,a="rtl"===n.direction,f=c&&(a?e.offsetX<=s.offsetWidth-s.clientWidth:e.offsetX>s.clientWidth),d=i&&e.offsetY>s.clientHeight;if(f||d)return}let E=null==(t=c.current.floatingContext)?void 0:t.nodeId,y=R&&I(R.nodesRef.current,E).some(t=>{var n;return v(e,null==(n=t.context)?void 0:n.elements.floating)});if(v(e,i.floating)||v(e,i.domReference)||y)return;let h=R?I(R.nodesRef.current,E):[];if(h.length>0){let e=!0;if(h.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}u(!1,e,"outside-press")}),Y=b(e=>{var t;let n=()=>{var t;K(e),null==(t=m(e))||t.removeEventListener(p,n)};null==(t=m(e))||t.addEventListener(p,n)});r.useEffect(()=>{if(!n||!s)return;c.current.__escapeKeyBubbles=A,c.current.__outsidePressBubbles=T;let e=-1;function t(e){u(!1,e,"ancestor-scroll")}function r(){window.clearTimeout(e),S.current=!0}function l(){e=window.setTimeout(()=>{S.current=!1},5*!!(0,o.Tc)())}let f=d(i.floating);a&&(f.addEventListener("keydown",D?O:_,D),f.addEventListener("compositionstart",r),f.addEventListener("compositionend",l)),C&&f.addEventListener(p,q?Y:K,q);let v=[];return y&&((0,o.vq)(i.domReference)&&(v=(0,o.v9)(i.domReference)),(0,o.vq)(i.floating)&&(v=v.concat((0,o.v9)(i.floating))),!(0,o.vq)(i.reference)&&i.reference&&i.reference.contextElement&&(v=v.concat((0,o.v9)(i.reference.contextElement)))),(v=v.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})).forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{a&&(f.removeEventListener("keydown",D?O:_,D),f.removeEventListener("compositionstart",r),f.removeEventListener("compositionend",l)),C&&f.removeEventListener(p,q?Y:K,q),v.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[c,i,a,C,p,n,u,y,s,A,T,_,D,O,K,q,Y]),r.useEffect(()=>{L.current=!1},[C,p]);let j=r.useMemo(()=>({onKeyDown:_,...g&&{[H[E]]:e=>{u(!1,e.nativeEvent,"reference-press")},..."click"!==E&&{onClick(e){u(!1,e.nativeEvent,"reference-press")}}}}),[_,u,g,E]),B=r.useMemo(()=>({onKeyDown:_,onMouseDown(){k.current=!0},onMouseUp(){k.current=!0},[V[p]]:()=>{L.current=!0}}),[_,p]);return r.useMemo(()=>s?{reference:j,floating:B}:{},[s,j,B])}function U(e){void 0===e&&(e={});let{nodeId:t}=e,n=function(e){let{open:t=!1,onOpenChange:n,elements:o}=e,u=L(),l=r.useRef({}),[i]=r.useState(()=>{let e;return e=new Map,{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}),c=null!=A(),[s,a]=r.useState(o.reference),f=b((e,t,r)=>{l.current.openEvent=e?t:void 0,i.emit("openchange",{open:e,event:t,reason:r,nested:c}),null==n||n(e,t,r)}),d=r.useMemo(()=>({setPositionReference:a}),[]),v=r.useMemo(()=>({reference:s||o.reference||null,floating:o.floating||null,domReference:o.reference}),[s,o.reference,o.floating]);return r.useMemo(()=>({dataRef:l,open:t,onOpenChange:f,elements:v,events:i,floatingId:u,refs:d}),[t,f,v,i,u,d])}({...e,elements:{reference:null,floating:null,...e.elements}}),u=e.rootContext||n,l=u.elements,[i,c]=r.useState(null),[s,a]=r.useState(null),f=(null==l?void 0:l.domReference)||i,d=r.useRef(null),v=r.useContext(M);w(()=>{f&&(d.current=f)},[f]);let m=(0,E.we)({...e,elements:{...l,...s&&{reference:s}}}),p=r.useCallback(e=>{let t=(0,o.vq)(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a(t),m.refs.setReference(t)},[m.refs]),g=r.useCallback(e=>{((0,o.vq)(e)||null===e)&&(d.current=e,c(e)),((0,o.vq)(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!(0,o.vq)(e))&&m.refs.setReference(e)},[m.refs]),y=r.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:d}),[m.refs,g,p]),h=r.useMemo(()=>({...m.elements,domReference:f}),[m.elements,f]),R=r.useMemo(()=>({...m,...u,refs:y,elements:h,nodeId:t}),[m,y,h,t,u]);return w(()=>{u.dataRef.current.floatingContext=R;let e=null==v?void 0:v.nodesRef.current.find(e=>e.id===t);e&&(e.context=R)}),r.useMemo(()=>({...m,context:R,refs:y,elements:h}),[m,y,h,R])}function $(e,t){void 0===t&&(t={});let{open:n,onOpenChange:f,events:v,dataRef:p,elements:g}=e,{enabled:E=!0,visibleOnly:y=!0}=t,h=r.useRef(!1),b=r.useRef(-1),w=r.useRef(!0);r.useEffect(()=>{if(!E)return;let e=(0,o.zk)(g.domReference);function t(){!n&&(0,o.sb)(g.domReference)&&g.domReference===u(d(g.domReference))&&(h.current=!0)}function r(){w.current=!0}return e.addEventListener("blur",t),e.addEventListener("keydown",r,!0),()=>{e.removeEventListener("blur",t),e.removeEventListener("keydown",r,!0)}},[g.domReference,n,E]),r.useEffect(()=>{if(E)return v.on("openchange",e),()=>{v.off("openchange",e)};function e(e){let{reason:t}=e;("reference-press"===t||"escape-key"===t)&&(h.current=!0)}},[v,E]),r.useEffect(()=>()=>{T(b)},[]);let R=r.useMemo(()=>({onPointerDown(e){var t;t=e.nativeEvent,!c().includes("jsdom/")&&(!a()&&0===t.width&&0===t.height||a()&&1===t.width&&1===t.height&&0===t.pressure&&0===t.detail&&"mouse"===t.pointerType||t.width<1&&t.height<1&&0===t.pressure&&0===t.detail&&"touch"===t.pointerType)||(w.current=!1)},onMouseLeave(){h.current=!1},onFocus(e){if(h.current)return;let t=m(e.nativeEvent);if(y&&(0,o.vq)(t))try{if(s()&&i().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints)throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!w.current&&!((0,o.sb)(t)&&t.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")))return}f(!0,e.nativeEvent,"focus")},onBlur(e){h.current=!1;let t=e.relatedTarget,n=e.nativeEvent,r=(0,o.vq)(t)&&t.hasAttribute(P("focus-guard"))&&"outside"===t.getAttribute("data-type");b.current=window.setTimeout(()=>{var e;let o=u(g.domReference?g.domReference.ownerDocument:document);!t&&o===g.domReference||l(null==(e=p.current.floatingContext)?void 0:e.refs.floating.current,o)||l(g.domReference,o)||r||f(!1,n,"focus")})}}),[p,g.domReference,f,y]);return r.useMemo(()=>E?{reference:R}:{},[E,R])}let G="active",J="selected";function ee(e,t,n){let r=new Map,o="item"===n,u=e;if(o&&e){let{[G]:t,[J]:n,...r}=e;u=r}return{..."floating"===n&&{tabIndex:-1,"data-floating-ui-focusable":""},...u,...t.map(t=>{let r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,u]=t;if(!(o&&[G,J].includes(n)))if(0===n.indexOf("on")){if(r.has(n)||r.set(n,[]),"function"==typeof u){var l;null==(l=r.get(n))||l.push(u),e[n]=function(){for(var e,t=arguments.length,o=Array(t),u=0;ue(...o)).find(e=>void 0!==e)}}}else e[n]=u}),e),{})}}function et(e){void 0===e&&(e=[]);let t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),o=e.map(e=>null==e?void 0:e.item),u=r.useCallback(t=>ee(t,e,"reference"),t),l=r.useCallback(t=>ee(t,e,"floating"),n),i=r.useCallback(t=>ee(t,e,"item"),o);return r.useMemo(()=>({getReferenceProps:u,getFloatingProps:l,getItemProps:i}),[u,l,i])}let en=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function er(e,t){return"function"==typeof e?e(t):e}function eo(e,t){void 0===t&&(t={});let{initial:n={opacity:0},open:o,close:u,common:l,duration:i=250}=t,c=e.placement,s=c.split("-")[0],a=r.useMemo(()=>({side:s,placement:c}),[s,c]),f="number"==typeof i,d=(f?i:i.open)||0,v=(f?i:i.close)||0,[m,p]=r.useState(()=>({...er(l,a),...er(n,a)})),{isMounted:g,status:E}=function(e,t){void 0===t&&(t={});let{open:n,elements:{floating:o}}=e,{duration:u=250}=t,l=("number"==typeof u?u:u.close)||0,[i,c]=r.useState("unmounted"),s=function(e,t){let[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect(()=>{if(!e&&n){let e=setTimeout(()=>o(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(n,l);return s||"close"!==i||c("unmounted"),w(()=>{if(o){if(n){c("initial");let e=requestAnimationFrame(()=>{c("open")});return()=>{cancelAnimationFrame(e)}}c("close")}},[n,o]),{isMounted:s,status:i}}(e,{duration:i}),y=D(n),h=D(o),b=D(u),R=D(l);return w(()=>{let e=er(y.current,a),t=er(b.current,a),n=er(R.current,a),r=er(h.current,a)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===E&&p(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===E&&p({transitionProperty:Object.keys(r).map(en).join(","),transitionDuration:d+"ms",...n,...r}),"close"===E){let r=t||e;p({transitionProperty:Object.keys(r).map(en).join(","),transitionDuration:v+"ms",...n,...r})}},[v,b,y,h,R,d,E,a]),{isMounted:g,styles:m}}}}]);