@yoopta/ui 6.0.0-beta.13 → 6.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-menu-list.js +1 -1
- package/dist/action-menu-list.js.map +1 -0
- package/dist/block-dnd.js.map +1 -0
- package/dist/block-options.js +1 -1
- package/dist/block-options.js.map +1 -0
- package/dist/chunks/_tslib-8f8de673.js +36 -0
- package/dist/chunks/_tslib-8f8de673.js.map +1 -0
- package/dist/chunks/floating-ui.react-b048728e.js +5 -0
- package/dist/chunks/floating-ui.react-d2303b03.js +4506 -0
- package/dist/chunks/floating-ui.react-d2303b03.js.map +1 -0
- package/dist/chunks/floating-ui.react-feaab622.js +4506 -0
- package/dist/chunks/floating-ui.react-feaab622.js.map +1 -0
- package/dist/chunks/highlight-color-picker-027fa4b4.js +93 -0
- package/dist/chunks/highlight-color-picker-027fa4b4.js.map +1 -0
- package/dist/chunks/highlight-color-picker-a1a292a9.js +1 -0
- package/dist/chunks/highlight-color-picker-a979e7a3.js +93 -0
- package/dist/chunks/highlight-color-picker-a979e7a3.js.map +1 -0
- package/dist/chunks/index-bfd2e7c4.js +6 -0
- package/dist/chunks/index-bfd2e7c4.js.map +1 -0
- package/dist/chunks/style-inject.es-746bb8ed.js +29 -0
- package/dist/chunks/style-inject.es-746bb8ed.js.map +1 -0
- package/dist/chunks/throttle-278836f4.js +45 -0
- package/dist/chunks/throttle-278836f4.js.map +1 -0
- package/dist/element-options.js +1 -1
- package/dist/element-options.js.map +1 -0
- package/dist/floating-block-actions.js.map +1 -0
- package/dist/floating-toolbar/floating-toolbar.d.ts.map +1 -1
- package/dist/floating-toolbar.js +1 -1
- package/dist/floating-toolbar.js.map +1 -0
- package/dist/highlight-color-picker.js +1 -1
- package/dist/highlight-color-picker.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -0
- package/dist/overlay.js +1 -1
- package/dist/overlay.js.map +1 -0
- package/dist/portal/Portal.d.ts.map +1 -1
- package/dist/portal.js +1 -1
- package/dist/portal.js.map +1 -0
- package/dist/selection-box.js.map +1 -0
- package/dist/slash-command-menu.js +1 -1
- package/dist/slash-command-menu.js.map +1 -0
- package/package.json +2 -2
package/dist/block-options.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{createContext as n,useContext as e,forwardRef as a,useCallback as r,isValidElement as s,cloneElement as p,useState as c,useMemo as l}from"react";import{d as u,u as b,c as d,e as y,g as k,
|
|
1
|
+
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{createContext as n,useContext as e,forwardRef as a,useCallback as r,isValidElement as s,cloneElement as p,useState as c,useMemo as l}from"react";import{d as u,u as b,c as d,e as y,g as k,h as g,j as h,o as m,f as v,s as x,a as f}from"./chunks/floating-ui.react-b048728e.js";import{s as O}from"./chunks/style-inject.es-e87a8d02.js";import{Overlay as w}from"./overlay.js";import{Portal as j}from"./portal.js";import{useYooptaEditor as N}from"@yoopta/editor";import"react-dom";const B=n(null),C=()=>{const o=e(B);if(!o)throw new Error("BlockOptions components must be used within <BlockOptions>");return o};O(":root{--yoopta-ui-block-options-bg:var(--yoopta-ui-background);--yoopta-ui-block-options-border:var(--yoopta-ui-border);--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--yoopta-ui-block-options-radius:0.5rem;--yoopta-ui-block-options-padding:4px;--yoopta-ui-block-options-min-width:220px;--yoopta-ui-block-options-z-index:200;--yoopta-ui-block-options-group-gap:1px;--yoopta-ui-block-options-button-padding-y:8px;--yoopta-ui-block-options-button-padding-x:12px;--yoopta-ui-block-options-button-font-size:0.875rem;--yoopta-ui-block-options-button-line-height:1.25rem;--yoopta-ui-block-options-button-color:var(--yoopta-ui-foreground);--yoopta-ui-block-options-button-bg:transparent;--yoopta-ui-block-options-button-hover:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-active:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-radius:0.375rem;--yoopta-ui-destructive:0 84.2% 60.2%;--yoopta-ui-destructive-foreground:210 40% 98%;--yoopta-ui-block-options-button-destructive-color:hsl(var(--yoopta-ui-destructive));--yoopta-ui-block-options-button-destructive-hover:hsl(var(--yoopta-ui-destructive)/0.1);--yoopta-ui-block-options-icon-size:1rem;--yoopta-ui-block-options-icon-gap:8px;--yoopta-ui-block-options-separator-color:var(--yoopta-ui-border);--yoopta-ui-block-options-separator-height:1px;--yoopta-ui-block-options-separator-margin:4px 0;--yoopta-ui-block-options-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}.yoopta-ui-block-options{background-color:hsl(var(--yoopta-ui-block-options-bg));border:1px solid hsl(var(--yoopta-ui-block-options-border));border-radius:var(--yoopta-ui-block-options-radius);box-shadow:var(--yoopta-ui-block-options-shadow);min-width:var(--yoopta-ui-block-options-min-width);padding:var(--yoopta-ui-block-options-padding);position:fixed;z-index:var(--yoopta-ui-block-options-z-index)}.yoopta-ui-block-options-content{display:flex;flex-direction:column;gap:var(--yoopta-ui-block-options-group-gap)}.yoopta-ui-block-options-group{display:flex;flex-direction:column;gap:1px}.yoopta-ui-block-options-button{align-items:center;background-color:var(--yoopta-ui-block-options-button-bg);border:none;border-radius:var(--yoopta-ui-block-options-button-radius);color:hsl(var(--yoopta-ui-block-options-button-color));cursor:pointer;display:flex;font-size:var(--yoopta-ui-block-options-button-font-size);font-weight:400;line-height:var(--yoopta-ui-block-options-button-line-height);outline:none;padding:var(--yoopta-ui-block-options-button-padding-y) var(--yoopta-ui-block-options-button-padding-x);text-align:left;transition:var(--yoopta-ui-block-options-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;width:100%}.yoopta-ui-block-options-button:hover{background-color:hsl(var(--yoopta-ui-block-options-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-block-options-button:active{background-color:hsl(var(--yoopta-ui-block-options-button-active))}.yoopta-ui-block-options-button:focus-visible{box-shadow:0 0 0 2px hsl(var(--yoopta-ui-background)),0 0 0 4px hsl(var(--yoopta-ui-ring));outline:none}.yoopta-ui-block-options-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-block-options-button-destructive{color:var(--yoopta-ui-block-options-button-destructive-color)}.yoopta-ui-block-options-button-destructive:hover{background-color:var(--yoopta-ui-block-options-button-destructive-hover);color:hsl(var(--yoopta-ui-destructive))}.yoopta-ui-block-options-button-icon{align-items:center;display:inline-flex;flex-shrink:0;justify-content:center;margin-right:var(--yoopta-ui-block-options-icon-gap)}.yoopta-ui-block-options-button-icon svg{height:var(--yoopta-ui-block-options-icon-size);width:var(--yoopta-ui-block-options-icon-size)}.yoopta-ui-block-options-button-text{flex:1}.yoopta-ui-block-options-separator{background-color:hsl(var(--yoopta-ui-block-options-separator-color));height:var(--yoopta-ui-block-options-separator-height);margin:var(--yoopta-ui-block-options-separator-margin)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}}");const $=({children:o,open:i,onOpenChange:n,defaultOpen:e=!1,anchor:a=null})=>{const[s,p]=c(e),[u,b]=c(null),d=h(),y=void 0!==i,k=y?i:s,g=null!=a?a:u,m=r(o=>{y||p(o),null==n||n(o)},[y,n]),v=l(()=>({open:k,onOpenChange:m,triggerRef:g,setTriggerRef:b,contentId:d}),[k,m,g,d]);return t(B.Provider,Object.assign({value:v},{children:o}))};$.displayName="BlockOptions";const z=a(({children:o,asChild:i=!1,className:n=""},e)=>{const{open:a,onOpenChange:c,setTriggerRef:l,contentId:b}=C(),d=r(o=>{o.stopPropagation(),c(!a)},[a,c]),y={ref:u([e,l]),onClick:d,"aria-expanded":a,"aria-haspopup":"menu","aria-controls":a?b:void 0};return i&&s(o)?p(o,y):t("button",Object.assign({type:"button",className:`yoopta-ui-block-options-trigger ${n}`},y,{children:o}))});z.displayName="BlockOptions.Trigger";const I=({children:o})=>t(j,Object.assign({id:"yoopta-ui-block-options-portal"},{children:o}));I.displayName="BlockOptions.Portal";const P=a(({children:o,className:i="",style:n,side:e="right",align:a="start",sideOffset:r=5},s)=>{const{open:p,onOpenChange:c,triggerRef:l,contentId:h}=C(),O="center"===a?e:`${e}-${a}`,{refs:j,floatingStyles:N,context:B}=b({elements:{reference:l},placement:O,open:p,onOpenChange:c,middleware:[m(r),v(),x({padding:8})],whileElementsMounted:f,strategy:"fixed"}),{isMounted:$,styles:z}=d(B,{duration:150,initial:{opacity:0},open:{opacity:1},close:{opacity:0}}),P=y(B,{outsidePress:!0,escapeKey:!0}),{getFloatingProps:E}=k([P]),S=u([j.setFloating,s]);return $?t(I,{children:t(w,Object.assign({lockScroll:!1,onClick:()=>c(!1)},{children:t(g,Object.assign({context:B,modal:!1},{children:t("div",Object.assign({ref:S,id:h,role:"menu","aria-orientation":"vertical",className:`yoopta-ui-block-options ${i}`,style:Object.assign(Object.assign(Object.assign({},N),z),n),contentEditable:!1},E({onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()}),{children:o}))}))}))}):null});P.displayName="BlockOptions.Content";const E=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,role:"group",className:`yoopta-ui-block-options-group ${i}`},{children:o})));E.displayName="BlockOptions.Group";const S=a((n,e)=>{var{children:a,onSelect:s,className:p="",disabled:c,icon:l,variant:u="default",keepOpen:b=!1}=n,d=o(n,["children","onSelect","className","disabled","icon","variant","keepOpen"]);const{onOpenChange:y}=C(),k=r(o=>{c||(null==s||s(o),b||y(!1))},[c,s,y,b]);return i("button",Object.assign({ref:e,type:"button",role:"menuitem",disabled:c,className:`yoopta-ui-block-options-button yoopta-ui-block-options-button-${u} ${p}`,onClick:k},d,{children:[l&&t("span",Object.assign({className:"yoopta-ui-block-options-button-icon"},{children:l})),t("span",Object.assign({className:"yoopta-ui-block-options-button-text"},{children:a}))]}))});S.displayName="BlockOptions.Item";const T=a(({className:o=""},i)=>t("div",{ref:i,role:"separator",className:`yoopta-ui-block-options-separator ${o}`}));T.displayName="BlockOptions.Separator";const R=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,className:`yoopta-ui-block-options-label ${i}`},{children:o})));R.displayName="BlockOptions.Label";const D=Object.assign($,{Root:$,Trigger:z,Portal:I,Content:P,Group:E,Item:S,Separator:T,Label:R}),q=()=>{const o=N();return{duplicateBlock:r(t=>{if(!t)throw new Error("Block ID is required to duplicate block");o.duplicateBlock({blockId:t,focus:!0})},[o]),copyBlockLink:r(t=>{var i;if(!t)throw new Error("Block ID is required to copy block link");const n=o.children[t];if(n){const t=`${window.location.origin}${window.location.pathname}#${n.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t);else{const o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}null===(i=o.emit)||void 0===i||i.call(o,"block:copy",n)}},[o]),deleteBlock:r(t=>{if(!t)throw new Error("Block ID is required to delete block");o.deleteBlock({blockId:t}),o.setPath({current:null})},[o])}};export{D as BlockOptions,q as useBlockActions,C as useBlockOptionsContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-options.js","sources":["../src/block-options/context.tsx","../src/block-options/block-options.tsx","../src/block-options/hooks.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type BlockOptionsContextValue = {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n triggerRef: HTMLElement | null;\n setTriggerRef: (ref: HTMLElement | null) => void;\n contentId: string;\n};\n\nexport const BlockOptionsContext = createContext<BlockOptionsContextValue | null>(null);\n\nexport const useBlockOptionsContext = () => {\n const context = useContext(BlockOptionsContext);\n if (!context) {\n throw new Error('BlockOptions components must be used within <BlockOptions>');\n }\n return context;\n};\n","import { cloneElement, forwardRef, isValidElement, useCallback, useMemo, useState } from 'react';\nimport type { CSSProperties, ReactElement, ReactNode } from 'react';\nimport {\n FloatingFocusManager,\n autoUpdate,\n flip,\n offset,\n shift,\n useDismiss,\n useFloating,\n useId,\n useInteractions,\n useMergeRefs,\n useTransitionStyles,\n} from '@floating-ui/react';\n\nimport { BlockOptionsContext, useBlockOptionsContext } from './context';\nimport { Overlay } from '../overlay';\nimport { Portal } from '../portal';\nimport './block-options.css';\n\ntype Placement = 'top' | 'right' | 'bottom' | 'left';\ntype Align = 'start' | 'center' | 'end';\n\ntype BlockOptionsRootProps = {\n children: ReactNode;\n /** Controlled open state */\n open?: boolean;\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Default open state for uncontrolled usage */\n defaultOpen?: boolean;\n /** External anchor element for positioning (use when no Trigger is present) */\n anchor?: HTMLElement | null;\n};\n\nconst BlockOptionsRoot = ({\n children,\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n defaultOpen = false,\n anchor = null,\n}: BlockOptionsRootProps) => {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const [internalTriggerRef, setInternalTriggerRef] = useState<HTMLElement | null>(null);\n const contentId = useId();\n\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n\n // Use external anchor if provided, otherwise use internal trigger ref\n const triggerRef = anchor ?? internalTriggerRef;\n\n const onOpenChange = useCallback(\n (newOpen: boolean) => {\n if (!isControlled) {\n setUncontrolledOpen(newOpen);\n }\n controlledOnOpenChange?.(newOpen);\n },\n [isControlled, controlledOnOpenChange],\n );\n\n const contextValue = useMemo(\n () => ({\n open,\n onOpenChange,\n triggerRef,\n setTriggerRef: setInternalTriggerRef,\n contentId,\n }),\n [open, onOpenChange, triggerRef, contentId],\n );\n\n return <BlockOptionsContext.Provider value={contextValue}>{children}</BlockOptionsContext.Provider>;\n};\n\nBlockOptionsRoot.displayName = 'BlockOptions';\n\ntype BlockOptionsTriggerProps = {\n children: ReactNode;\n /** Merge props onto child element instead of wrapping */\n asChild?: boolean;\n className?: string;\n};\n\nconst BlockOptionsTrigger = forwardRef<HTMLButtonElement, BlockOptionsTriggerProps>(\n ({ children, asChild = false, className = '' }, forwardedRef) => {\n const { open, onOpenChange, setTriggerRef, contentId } = useBlockOptionsContext();\n\n const handleClick = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n onOpenChange(!open);\n },\n [open, onOpenChange],\n );\n\n const mergedRef = useMergeRefs([forwardedRef, setTriggerRef]);\n\n const triggerProps = {\n ref: mergedRef,\n onClick: handleClick,\n 'aria-expanded': open,\n 'aria-haspopup': 'menu' as const,\n 'aria-controls': open ? contentId : undefined,\n };\n\n if (asChild && isValidElement(children)) {\n return cloneElement(children as ReactElement<Record<string, unknown>>, triggerProps);\n }\n\n return (\n <button type=\"button\" className={`yoopta-ui-block-options-trigger ${className}`} {...triggerProps}>\n {children}\n </button>\n );\n },\n);\n\nBlockOptionsTrigger.displayName = 'BlockOptions.Trigger';\n\ntype BlockOptionsPortalProps = {\n children: ReactNode;\n};\n\nconst BlockOptionsPortal = ({ children }: BlockOptionsPortalProps) => (\n <Portal id=\"yoopta-ui-block-options-portal\">{children}</Portal>\n);\n\nBlockOptionsPortal.displayName = 'BlockOptions.Portal';\n\ntype BlockOptionsContentProps = {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n /** Placement relative to trigger */\n side?: Placement;\n /** Alignment relative to trigger */\n align?: Align;\n /** Offset from trigger in pixels */\n sideOffset?: number;\n};\n\nconst BlockOptionsContent = forwardRef<HTMLDivElement, BlockOptionsContentProps>(\n ({ children, className = '', style, side = 'right', align = 'start', sideOffset = 5 }, forwardedRef) => {\n const { open, onOpenChange, triggerRef, contentId } = useBlockOptionsContext();\n\n const placement = align === 'center' ? side : (`${side}-${align}` as const);\n\n const { refs, floatingStyles, context } = useFloating({\n elements: {\n reference: triggerRef,\n },\n placement,\n open,\n onOpenChange,\n middleware: [offset(sideOffset), flip(), shift({ padding: 8 })],\n whileElementsMounted: autoUpdate,\n strategy: 'fixed',\n });\n\n const { isMounted, styles: transitionStyles } = useTransitionStyles(context, {\n duration: 150,\n initial: { opacity: 0 },\n open: { opacity: 1 },\n close: { opacity: 0 },\n });\n\n // Handle dismiss (outside click, escape key)\n const dismiss = useDismiss(context, {\n outsidePress: true,\n escapeKey: true,\n });\n\n const { getFloatingProps } = useInteractions([dismiss]);\n\n const contentRef = useMergeRefs([refs.setFloating, forwardedRef]);\n\n if (!isMounted) return null;\n\n return (\n <BlockOptionsPortal>\n <Overlay lockScroll={false} onClick={() => onOpenChange(false)}>\n <FloatingFocusManager context={context} modal={false}>\n <div\n ref={contentRef}\n id={contentId}\n role=\"menu\"\n aria-orientation=\"vertical\"\n className={`yoopta-ui-block-options ${className}`}\n style={{ ...floatingStyles, ...transitionStyles, ...style }}\n contentEditable={false}\n {...getFloatingProps({\n onClick: (e) => e.stopPropagation(),\n onMouseDown: (e) => e.stopPropagation(),\n })}\n >\n {children}\n </div>\n </FloatingFocusManager>\n </Overlay>\n </BlockOptionsPortal>\n );\n },\n);\n\nBlockOptionsContent.displayName = 'BlockOptions.Content';\n\ntype BlockOptionsGroupProps = {\n children: ReactNode;\n className?: string;\n};\n\nconst BlockOptionsGroup = forwardRef<HTMLDivElement, BlockOptionsGroupProps>(\n ({ children, className = '' }, ref) => (\n <div ref={ref} role=\"group\" className={`yoopta-ui-block-options-group ${className}`}>\n {children}\n </div>\n ),\n);\n\nBlockOptionsGroup.displayName = 'BlockOptions.Group';\n\ntype BlockOptionsItemProps = {\n children: ReactNode;\n /** Called when item is selected */\n onSelect?: (event: React.MouseEvent) => void;\n className?: string;\n disabled?: boolean;\n icon?: ReactNode;\n /** Visual variant */\n variant?: 'default' | 'destructive';\n /** Keep menu open after selection */\n keepOpen?: boolean;\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onSelect'>;\n\nconst BlockOptionsItem = forwardRef<HTMLButtonElement, BlockOptionsItemProps>(\n (\n { children, onSelect, className = '', disabled, icon, variant = 'default', keepOpen = false, ...props },\n ref,\n ) => {\n const { onOpenChange } = useBlockOptionsContext();\n\n const handleClick = useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled) return;\n\n onSelect?.(e);\n\n // Auto-close menu after selection (Radix behavior) unless keepOpen is true\n if (!keepOpen) {\n onOpenChange(false);\n }\n },\n [disabled, onSelect, onOpenChange, keepOpen],\n );\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n disabled={disabled}\n className={`yoopta-ui-block-options-button yoopta-ui-block-options-button-${variant} ${className}`}\n onClick={handleClick}\n {...props}\n >\n {icon && <span className=\"yoopta-ui-block-options-button-icon\">{icon}</span>}\n <span className=\"yoopta-ui-block-options-button-text\">{children}</span>\n </button>\n );\n },\n);\n\nBlockOptionsItem.displayName = 'BlockOptions.Item';\n\ntype BlockOptionsSeparatorProps = {\n className?: string;\n};\n\nconst BlockOptionsSeparator = forwardRef<HTMLDivElement, BlockOptionsSeparatorProps>(\n ({ className = '' }, ref) => (\n <div ref={ref} role=\"separator\" className={`yoopta-ui-block-options-separator ${className}`} />\n ),\n);\n\nBlockOptionsSeparator.displayName = 'BlockOptions.Separator';\n\ntype BlockOptionsLabelProps = {\n children: ReactNode;\n className?: string;\n};\n\nconst BlockOptionsLabel = forwardRef<HTMLDivElement, BlockOptionsLabelProps>(\n ({ children, className = '' }, ref) => (\n <div ref={ref} className={`yoopta-ui-block-options-label ${className}`}>\n {children}\n </div>\n ),\n);\n\nBlockOptionsLabel.displayName = 'BlockOptions.Label';\n\nexport const BlockOptions = Object.assign(BlockOptionsRoot, {\n Root: BlockOptionsRoot,\n Trigger: BlockOptionsTrigger,\n Portal: BlockOptionsPortal,\n Content: BlockOptionsContent,\n Group: BlockOptionsGroup,\n Item: BlockOptionsItem,\n Separator: BlockOptionsSeparator,\n Label: BlockOptionsLabel,\n});\n\nexport type {\n BlockOptionsRootProps,\n BlockOptionsTriggerProps,\n BlockOptionsContentProps,\n BlockOptionsGroupProps,\n BlockOptionsItemProps,\n BlockOptionsSeparatorProps,\n BlockOptionsLabelProps,\n};\n","import { useCallback } from 'react';\nimport { useYooptaEditor } from '@yoopta/editor';\n\n/**\n * Hook that provides common block actions (duplicate, copy link, delete)\n * Use this alongside BlockOptions component for easy action handling\n *\n * @example\n * ```tsx\n * const { duplicateBlock, deleteBlock, copyBlockLink } = useBlockActions();\n *\n * <BlockOptions.Item onSelect={() => duplicateBlock(blockId)}>\n * Duplicate\n * </BlockOptions.Item>\n * ```\n */\nexport const useBlockActions = () => {\n const editor = useYooptaEditor();\n\n const duplicateBlock = useCallback(\n (blockId: string) => {\n if (!blockId) {\n throw new Error('Block ID is required to duplicate block');\n }\n\n editor.duplicateBlock({ blockId, focus: true });\n },\n [editor],\n );\n\n const copyBlockLink = useCallback(\n (blockId: string) => {\n if (!blockId) {\n throw new Error('Block ID is required to copy block link');\n }\n\n const block = editor.children[blockId];\n if (block) {\n const url = `${window.location.origin}${window.location.pathname}#${block.id}`;\n\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard.writeText(url);\n } else {\n // Fallback for older browsers\n const textarea = document.createElement('textarea');\n textarea.value = url;\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n document.body.appendChild(textarea);\n textarea.select();\n document.execCommand('copy');\n document.body.removeChild(textarea);\n }\n\n editor.emit?.('block:copy', block);\n }\n },\n [editor],\n );\n\n const deleteBlock = useCallback(\n (blockId: string) => {\n if (!blockId) {\n throw new Error('Block ID is required to delete block');\n }\n\n editor.deleteBlock({ blockId });\n editor.setPath({ current: null });\n },\n [editor],\n );\n\n return {\n duplicateBlock,\n copyBlockLink,\n deleteBlock,\n };\n};\n\n// Re-export context hook for advanced usage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AA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,MAAA,EAAG,YAAY,EAAE,KAAK,CAAC,CAAC;AACpC,SAAA;AACH,KAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,OAAe,KAAI;QAClB,IAAI,CAAC,OAAO,EAAE;AACZ,YAAA,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;AACzD,SAAA;AAED,QAAA,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AACpC,KAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO;QACL,cAAc;QACd,aAAa;QACb,WAAW;KACZ,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function __rest(s, e) {
|
|
19
|
+
var t = {};
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
23
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
24
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
25
|
+
t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
31
|
+
var e = new Error(message);
|
|
32
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { __rest as _ };
|
|
36
|
+
//# sourceMappingURL=_tslib-8f8de673.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_tslib-8f8de673.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import*as e from"react";import{useLayoutEffect as t,useEffect as n,useRef as o}from"react";import*as r from"react-dom";function i(){return"undefined"!=typeof window}function l(e){return s(e)?(e.nodeName||"").toLowerCase():"#document"}function c(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function u(e){var t;return null==(t=(s(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function s(e){return!!i()&&(e instanceof Node||e instanceof c(e).Node)}function a(e){return!!i()&&(e instanceof Element||e instanceof c(e).Element)}function f(e){return!!i()&&(e instanceof HTMLElement||e instanceof c(e).HTMLElement)}function d(e){return!(!i()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof c(e).ShadowRoot)}const p=new Set(["inline","contents"]);function m(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=C(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!p.has(r)}const h=new Set(["table","td","th"]);function g(e){return h.has(l(e))}const v=[":popover-open",":modal"];function y(e){return v.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const w=["transform","translate","scale","rotate","perspective"],b=["transform","translate","scale","rotate","perspective","filter"],x=["paint","layout","strict","content"];function R(e){const t=E(),n=a(e)?C(e):e;return w.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||b.some(e=>(n.willChange||"").includes(e))||x.some(e=>(n.contain||"").includes(e))}function E(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const S=new Set(["html","body","#document"]);function A(e){return S.has(l(e))}function C(e){return c(e).getComputedStyle(e)}function L(e){return a(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function k(e){if("html"===l(e))return e;const t=e.assignedSlot||e.parentNode||d(e)&&e.host||u(e);return d(t)?t.host:t}function T(e){const t=k(e);return A(t)?e.ownerDocument?e.ownerDocument.body:e.body:f(t)&&m(t)?t:T(t)}function O(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=T(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),l=c(r);if(i){const e=M(l);return t.concat(l,l.visualViewport||[],m(r)?r:[],e&&n?O(e):[])}return t.concat(r,O(r,[],n))}function M(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function P(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function D(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&d(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function F(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function I(){const 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 N(e){return!I().includes("jsdom/")&&(!W()&&0===e.width&&0===e.height||W()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function W(){const e=/android/i;return e.test(F())||e.test(I())}function j(e){return(null==e?void 0:e.ownerDocument)||document}function B(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function V(e){return"composedPath"in e?e.composedPath()[0]:e.target}function H(e){e.preventDefault(),e.stopPropagation()}function q(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return f(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}(e))}const z=Math.min,K=Math.max,_=Math.round,U=Math.floor,X=e=>({x:e,y:e}),$={left:"right",right:"left",bottom:"top",top:"bottom"},Y={start:"end",end:"start"};function Z(e,t,n){return K(e,z(t,n))}function G(e,t){return"function"==typeof e?e(t):e}function J(e){return e.split("-")[0]}function Q(e){return e.split("-")[1]}function ee(e){return"x"===e?"y":"x"}function te(e){return"y"===e?"height":"width"}const ne=new Set(["top","bottom"]);function oe(e){return ne.has(J(e))?"y":"x"}function re(e){return ee(oe(e))}function ie(e){return e.replace(/start|end/g,e=>Y[e])}const le=["left","right"],ce=["right","left"],ue=["top","bottom"],se=["bottom","top"];function ae(e,t,n,o){const r=Q(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?ce:le:t?le:ce;case"left":case"right":return t?ue:se;default:return[]}}(J(e),"start"===n,o);return r&&(i=i.map(e=>e+"-"+r),t&&(i=i.concat(i.map(ie)))),i}function fe(e){return e.replace(/left|right|bottom|top/g,e=>$[e])}function de(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function pe(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}
|
|
2
|
+
/*!
|
|
3
|
+
* tabbable 6.4.0
|
|
4
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
+
*/var me=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),he="undefined"==typeof Element,ge=he?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ve=!he&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},ye=function(e,t){var n;void 0===t&&(t=!0);var o=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===o||"true"===o||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):ye(e.parentNode))},we=function(e,t,n){for(var o=[],r=Array.from(e);r.length;){var i=r.shift();if(!ye(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=l.length?l:i.children,u=we(c,!0,n);n.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{ge.call(i,me)&&n.filter(i)&&(t||!e.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!ye(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&a){var f=we(!0===s?i.children:s.children,!0,n);n.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else r.unshift.apply(r,i.children)}}return o},be=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},xe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!be(e)?0:e.tabIndex},Re=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ee=function(e){return"INPUT"===e.tagName},Se=function(e){return function(e){return Ee(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ve(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!r||r===e}(e)},Ae=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},Ce=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var r=ge.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ge.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ae(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,c=ve(e);if(l&&!l.shadowRoot&&!0===o(l))return Ae(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,o,r,i=e&&ve(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&l;){var u,s,a;c=!(null===(s=l=null===(u=i=ve(l))||void 0===u?void 0:u.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Le=function(e,t){return!(t.disabled||function(e){return Ee(e)&&"hidden"===e.type}(t)||Ce(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some(function(e){return"SUMMARY"===e.tagName})}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!!ge.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},ke=function(e,t){return!(Se(t)||xe(t)<0||!Le(e,t))},Te=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Oe=function(e){var t=[],n=[];return e.forEach(function(e,o){var r=!!e.scopeParent,i=r?e.scopeParent:e,l=function(e,t){var n=xe(e);return n<0&&t&&!be(e)?0:n}(i,r),c=r?Oe(e.candidates):i;0===l?r?t.push.apply(t,c):t.push(i):n.push({documentOrder:o,tabIndex:l,item:e,isScope:r,content:c})}),n.sort(Re).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Me=function(e,t){var n;return n=(t=t||{}).getShadowRoot?we([e],t.includeContainer,{filter:ke.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Te}):function(e,t,n){if(ye(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(me));return t&&ge.call(e,me)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,ke.bind(null,t)),Oe(n)};function Pe(e,t,n){let{reference:o,floating:r}=e;const i=oe(t),l=re(t),c=te(l),u=J(t),s="y"===i,a=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[c]/2-r[c]/2;let p;switch(u){case"top":p={x:a,y:o.y-r.height};break;case"bottom":p={x:a,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(Q(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function De(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:u}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=G(t,e),m=de(p),h=c[d?"floating"===f?"reference":"floating":f],g=pe(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(c.floating)),boundary:s,rootBoundary:a,strategy:u})),v="floating"===f?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=pe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:u}):v);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function Fe(e){const t=z(...e.map(e=>e.left)),n=z(...e.map(e=>e.top));return{x:t,y:n,width:K(...e.map(e=>e.right))-t,height:K(...e.map(e=>e.bottom))-n}}const Ie=new Set(["left","top"]);function Ne(e){const t=C(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=f(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,c=_(n)!==i||_(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function We(e){return a(e)?e:e.contextElement}function je(e){const t=We(e);if(!f(t))return X(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Ne(t);let l=(i?_(n.width):n.width)/o,c=(i?_(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Be=X(0);function Ve(e){const t=c(e);return E()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Be}function He(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=We(e);let l=X(1);t&&(o?a(o)&&(l=je(o)):l=je(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==c(e))&&t}(i,n,o)?Ve(i):X(0);let s=(r.left+u.x)/l.x,f=(r.top+u.y)/l.y,d=r.width/l.x,p=r.height/l.y;if(i){const e=c(i),t=o&&a(o)?c(o):o;let n=e,r=M(n);for(;r&&o&&t!==n;){const e=je(r),t=r.getBoundingClientRect(),o=C(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;s*=e.x,f*=e.y,d*=e.x,p*=e.y,s+=i,f+=l,n=c(r),r=M(n)}}return pe({width:d,height:p,x:s,y:f})}function qe(e,t){const n=L(e).scrollLeft;return t?t.left+n:He(u(e)).left+n}function ze(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qe(e,n),y:n.top+t.scrollTop}}const Ke=new Set(["absolute","fixed"]);function _e(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=c(e),o=u(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,a=0;if(r){i=r.width,l=r.height;const e=E();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,a=r.offsetTop)}const f=qe(o);if(f<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-t.clientWidth-r);l<=25&&(i-=l)}else f<=25&&(i+=f);return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)o=function(e){const t=u(e),n=L(e),o=e.ownerDocument.body,r=K(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=K(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+qe(e);const c=-n.scrollTop;return"rtl"===C(o).direction&&(l+=K(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(u(e));else if(a(t))o=function(e,t){const n=He(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=f(e)?je(e):X(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=Ve(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pe(o)}function Ue(e,t){const n=k(e);return!(n===t||!a(n)||A(n))&&("fixed"===C(n).position||Ue(n,t))}function Xe(e,t,n){const o=f(t),r=u(t),i="fixed"===n,c=He(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=X(0);function d(){a.x=qe(r)}if(o||!o&&!i)if(("body"!==l(t)||m(r))&&(s=L(t)),o){const e=He(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else r&&d();i&&!o&&r&&d();const p=!r||o||i?X(0):ze(r,s);return{x:c.left+s.scrollLeft-a.x-p.x,y:c.top+s.scrollTop-a.y-p.y,width:c.width,height:c.height}}function $e(e){return"static"===C(e).position}function Ye(e,t){if(!f(e)||"fixed"===C(e).position)return null;if(t)return t(e);let n=e.offsetParent;return u(e)===n&&(n=n.ownerDocument.body),n}function Ze(e,t){const n=c(e);if(y(e))return n;if(!f(e)){let t=k(e);for(;t&&!A(t);){if(a(t)&&!$e(t))return t;t=k(t)}return n}let o=Ye(e,t);for(;o&&g(o)&&$e(o);)o=Ye(o,t);return o&&A(o)&&$e(o)&&!R(o)?n:o||function(e){let t=k(e);for(;f(t)&&!A(t);){if(R(t))return t;if(y(t))return null;t=k(t)}return null}(e)||n}const Ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,c=u(o),s=!!t&&y(t.floating);if(o===c||s&&i)return n;let a={scrollLeft:0,scrollTop:0},d=X(1);const p=X(0),h=f(o);if((h||!h&&!i)&&(("body"!==l(o)||m(c))&&(a=L(o)),f(o))){const e=He(o);d=je(o),p.x=e.x+o.clientLeft,p.y=e.y+o.clientTop}const g=!c||h||i?X(0):ze(c,a);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+p.x+g.x,y:n.y*d.y-a.scrollTop*d.y+p.y+g.y}},getDocumentElement:u,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?y(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=O(e,[],!1).filter(e=>a(e)&&"body"!==l(e)),r=null;const i="fixed"===C(e).position;let c=i?k(e):e;for(;a(c)&&!A(c);){const t=C(c),n=R(c);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&Ke.has(r.position)||m(c)&&!n&&Ue(e,c))?o=o.filter(e=>e!==c):r=t,c=k(c)}return t.set(e,o),o}(t,this._c):[].concat(n),o],c=i[0],u=i.reduce((e,n)=>{const o=_e(t,n,r);return e.top=K(o.top,e.top),e.right=z(o.right,e.right),e.bottom=z(o.bottom,e.bottom),e.left=K(o.left,e.left),e},_e(t,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:Ze,getElementRects:async function(e){const t=this.getOffsetParent||Ze,n=this.getDimensions,o=await n(e.floating);return{reference:Xe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Ne(e);return{width:t,height:n}},getScale:je,isElement:a,isRTL:function(e){return"rtl"===C(e).direction}};function Je(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qe(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,a=We(e),f=r||i?[...a?O(a):[],...O(t)]:[];f.forEach(e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=a&&c?function(e,t){let n,o=null;const r=u(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(c,u){void 0===c&&(c=!1),void 0===u&&(u=1),i();const s=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=s;if(c||t(),!d||!p)return;const m={rootMargin:-U(f)+"px "+-U(r.clientWidth-(a+d))+"px "+-U(r.clientHeight-(f+p))+"px "+-U(a)+"px",threshold:K(0,z(1,u))||1};let h=!0;function g(t){const o=t[0].intersectionRatio;if(o!==u){if(!h)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||Je(s,e.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...m,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,m)}o.observe(e)}(!0),i}(a,n):null;let p,m=-1,h=null;l&&(h=new ResizeObserver(e=>{let[o]=e;o&&o.target===a&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),a&&!s&&h.observe(a),h.observe(t));let g=s?He(e):null;return s&&function t(){const o=He(e);g&&!Je(g,o)&&n();g=o,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const et=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=t,u=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=J(n),c=Q(n),u="y"===oe(n),s=Ie.has(l)?-1:1,a=i&&u?-1:1,f=G(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),u?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(o=c.arrow)&&o.alignmentOffset?{}:{x:r+u.x,y:i+u.y,data:{...u,placement:l}}}}},tt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=G(e,t),s={x:n,y:o},a=await De(t,u),f=oe(J(r)),d=ee(f);let p=s[d],m=s[f];if(i){const e="y"===d?"bottom":"right";p=Z(p+a["y"===d?"top":"left"],p,p-a[e])}if(l){const e="y"===f?"bottom":"right";m=Z(m+a["y"===f?"top":"left"],m,m-a[e])}const h=c.fn({...t,[d]:p,[f]:m});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:i,[f]:l}}}}}},nt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:u,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=G(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=J(r),y=oe(c),w=J(c)===c,b=await(null==u.isRTL?void 0:u.isRTL(s.floating)),x=d||(w||!h?[fe(c)]:function(e){const t=fe(e);return[ie(e),t,ie(t)]}(c)),R="none"!==m;!d&&R&&x.push(...ae(c,h,m,b));const E=[c,...x],S=await De(t,g),A=[];let C=(null==(o=i.flip)?void 0:o.overflows)||[];if(a&&A.push(S[v]),f){const e=function(e,t,n){void 0===n&&(n=!1);const o=Q(e),r=re(e),i=te(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=fe(l)),[l,fe(l)]}(r,l,b);A.push(S[e[0]],S[e[1]])}if(C=[...C,{placement:r,overflows:A}],!A.every(e=>e<=0)){var L,k;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=E[e];if(t){if(!("alignment"===f&&y!==oe(t))||C.every(e=>oe(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let n=null==(k=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:k.placement;if(!n)switch(p){case"bestFit":{var T;const e=null==(T=C.filter(e=>{if(R){const t=oe(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},ot=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:l,elements:c}=t,{apply:u=()=>{},...s}=G(e,t),a=await De(t,s),f=J(r),d=Q(r),p="y"===oe(r),{width:m,height:h}=i.floating;let g,v;"top"===f||"bottom"===f?(g=f,v=d===(await(null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(v=f,g="end"===d?"top":"bottom");const y=h-a.top-a.bottom,w=m-a.left-a.right,b=z(h-a[g],y),x=z(m-a[v],w),R=!t.middlewareData.shift;let E=b,S=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=w),null!=(o=t.middlewareData.shift)&&o.enabled.y&&(E=y),R&&!d){const e=K(a.left,0),t=K(a.right,0),n=K(a.top,0),o=K(a.bottom,0);p?S=m-2*(0!==e||0!==t?e+t:K(a.left,a.right)):E=h-2*(0!==n||0!==o?n+o:K(a.top,a.bottom))}await u({...t,availableWidth:S,availableHeight:E});const A=await l.getDimensions(c.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}},rt=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=t,{padding:c=2,x:u,y:s}=G(e,t),a=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),f=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let o=null;for(let e=0;e<t.length;e++){const r=t[e];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(e=>pe(Fe(e)))}(a),d=pe(Fe(a)),p=de(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=u&&null!=s)return f.find(e=>u>e.left-p.left&&u<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom)||d;if(f.length>=2){if("y"===oe(n)){const e=f[0],t=f[f.length-1],o="top"===J(n),r=e.top,i=t.bottom,l=o?e.left:t.left,c=o?e.right:t.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const e="left"===J(n),t=K(...f.map(e=>e.right)),o=z(...f.map(e=>e.left)),r=f.filter(n=>e?n.left===o:n.right===t),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:t,width:t-o,height:l-i,x:o,y:i}}return d}},floating:o.floating,strategy:l});return r.reference.x!==m.reference.x||r.reference.y!==m.reference.y||r.reference.width!==m.reference.width||r.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},it=(e,t,n)=>{const o=new Map,r={platform:Ge,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),u=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:a,y:f}=Pe(s,o,u),d=o,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:v,data:y,reset:w}=await h({x:a,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=g?g:a,f=null!=v?v:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:r}):w.rects),({x:a,y:f}=Pe(s,d,u))),n=-1)}return{x:a,y:f,placement:d,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var lt="undefined"!=typeof document?t:function(){};function ct(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!ct(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!e.$$typeof)&&!ct(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ut(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function st(e,t){const n=ut(e);return Math.round(t*n)/n}function at(t){const n=e.useRef(t);return lt(()=>{n.current=t}),n}const ft=(e,t)=>({...et(e),options:[e,t]}),dt=(e,t)=>({...tt(e),options:[e,t]}),pt=(e,t)=>({...nt(e),options:[e,t]}),mt=(e,t)=>({...ot(e),options:[e,t]}),ht=(e,t)=>({...rt(e),options:[e,t]});function gt(t){return e.useMemo(()=>t.every(e=>null==e)?null:e=>{t.forEach(t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)})},t)}const vt={...e},yt=vt.useInsertionEffect||(e=>e());function wt(t){const n=e.useRef(()=>{});return yt(()=>{n.current=t}),e.useCallback(function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return null==n.current?void 0:n.current(...t)},[])}var bt="undefined"!=typeof document?t:n;function xt(){return xt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},xt.apply(this,arguments)}let Rt=!1,Et=0;const St=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Et++;const At=vt.useId||function(){const[t,n]=e.useState(()=>Rt?St():void 0);return bt(()=>{null==t&&n(St())},[]),e.useEffect(()=>{Rt=!0},[]),t};const Ct=e.createContext(null),Lt=e.createContext(null),kt=()=>e.useContext(Lt);function Tt(e){return"data-floating-ui-"+e}function Ot(e){const t=o(e);return bt(()=>{t.current=e}),t}let Mt=0;function Pt(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Mt);const i=()=>null==e?void 0:e.focus({preventScroll:n});r?i():Mt=requestAnimationFrame(i)}function Dt(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),o=n;for(;o.length;)o=e.filter(e=>{var t;return null==(t=o)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(o);return n}let Ft=new WeakMap,It=new WeakSet,Nt={},Wt=0;const jt=e=>e&&(e.host||jt(e.parentNode));function Bt(e,t,n,o){const r="data-floating-ui-inert",i=o?"inert":n?"aria-hidden":null,c=(u=t,e.map(e=>{if(u.contains(e))return e;const t=jt(e);return u.contains(t)?t:null}).filter(e=>null!=e));var u;const s=new Set,a=new Set(c),f=[];Nt[r]||(Nt[r]=new WeakMap);const d=Nt[r];return c.forEach(function e(t){if(!t||s.has(t))return;s.add(t),t.parentNode&&e(t.parentNode)}),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,t=>{if("script"!==l(t))if(s.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,o=(Ft.get(t)||0)+1,l=(d.get(t)||0)+1;Ft.set(t,o),d.set(t,l),f.push(t),1===o&&n&&It.add(t),1===l&&t.setAttribute(r,""),!n&&i&&t.setAttribute(i,"true")}})}(t),s.clear(),Wt++,()=>{f.forEach(e=>{const t=(Ft.get(e)||0)-1,n=(d.get(e)||0)-1;Ft.set(e,t),d.set(e,n),t||(!It.has(e)&&i&&e.removeAttribute(i),It.delete(e)),n||e.removeAttribute(r)}),Wt--,Wt||(Ft=new WeakMap,Ft=new WeakMap,It=new WeakSet,Nt={})}}function Vt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=j(e[0]).body;return Bt(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Ht=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function qt(e,t){const n=Me(e,Ht());"prev"===t&&n.reverse();const o=n.indexOf(P(j(e)));return n.slice(o+1)[0]}function zt(){return qt(document.body,"next")}function Kt(){return qt(document.body,"prev")}function _t(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!D(n,o)}function Ut(e){Me(e,Ht()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function Xt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}const $t={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};function Yt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Zt=e.forwardRef(function(t,n){const[o,r]=e.useState();bt(()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Yt),()=>{document.removeEventListener("keydown",Yt)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,[Tt("focus-guard")]:"",style:$t};return e.createElement("span",xt({},t,i))}),Gt=e.createContext(null),Jt=Tt("portal");function Qt(t){const{children:n,id:o,root:i,preserveTabOrder:l=!0}=t,c=function(t){void 0===t&&(t={});const{id:n,root:o}=t,r=At(),i=en(),[l,c]=e.useState(null),u=e.useRef(null);return bt(()=>()=>{null==l||l.remove(),queueMicrotask(()=>{u.current=null})},[l]),bt(()=>{if(!r)return;if(u.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=r,t.setAttribute(Jt,""),e.appendChild(t),u.current=t,c(t)},[n,r]),bt(()=>{if(null===o)return;if(!r)return;if(u.current)return;let e=o||(null==i?void 0:i.portalNode);e&&!a(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=r,l.setAttribute(Jt,""),e=t||e,e.appendChild(l),u.current=l,c(l)},[n,o,r,i]),l}({id:o,root:i}),[u,s]=e.useState(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=null==u?void 0:u.modal,g=null==u?void 0:u.open,v=!!u&&!u.modal&&u.open&&l&&!(!i&&!c);return e.useEffect(()=>{if(c&&l&&!h)return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&_t(e)){("focusin"===e.type?Xt:Ut)(c)}}},[c,l,h]),e.useEffect(()=>{c&&(g||Xt(c))},[g,c]),e.createElement(Gt.Provider,{value:e.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:s}),[l,c])},v&&c&&e.createElement(Zt,{"data-type":"outside",ref:f,onFocus:e=>{if(_t(e,c)){var t;null==(t=p.current)||t.focus()}else{const e=Kt()||(null==u?void 0:u.refs.domReference.current);null==e||e.focus()}}}),v&&c&&e.createElement("span",{"aria-owns":c.id,style:$t}),c&&r.createPortal(n,c),v&&c&&e.createElement(Zt,{"data-type":"outside",ref:d,onFocus:e=>{if(_t(e,c)){var t;null==(t=m.current)||t.focus()}else{const t=zt()||(null==u?void 0:u.refs.domReference.current);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))}const en=()=>e.useContext(Gt),tn="data-floating-ui-focusable";let nn=[];function on(e){nn=nn.filter(e=>e.isConnected);let t=e;if(t&&"body"!==l(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ge.call(e,me)&&ke(t,e)}(t,Ht())){const e=Me(t,Ht())[0];e&&(t=e)}nn.push(t),nn.length>20&&(nn=nn.slice(-20))}}function rn(){return nn.slice().reverse().find(e=>e.isConnected)}const ln=e.forwardRef(function(t,n){return e.createElement("button",xt({},t,{type:"button",ref:n,tabIndex:-1,style:$t}))});function cn(t){const{context:n,children:o,disabled:r=!1,order:i=["content"],guards:l=!0,initialFocus:c=0,returnFocus:u=!0,restoreFocus:s=!1,modal:a=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:m,refs:h,nodeId:g,onOpenChange:v,events:y,dataRef:w,floatingId:b,elements:{domReference:x,floating:R}}=n,E="number"==typeof c&&c<0,S=q(x)&&E,A="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,C=Ot(i),L=Ot(c),k=Ot(u),T=kt(),O=en(),M=e.useRef(null),F=e.useRef(null),I=e.useRef(!1),B=e.useRef(!1),z=e.useRef(-1),K=null!=O,_=(U=R)?U.hasAttribute(tn)?U:U.querySelector("["+tn+"]")||U:null;var U;const X=wt(function(e){return void 0===e&&(e=_),e?Me(e,Ht()):[]}),$=wt(e=>{const t=X(e);return C.current.map(e=>x&&"reference"===e?x:_&&"floating"===e?_:t).filter(Boolean).flat()});function Y(t){return!r&&d&&a?e.createElement(ln,{ref:"start"===t?M:F,onClick:e=>v(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect(()=>{if(r)return;if(!a)return;function e(e){if("Tab"===e.key){D(_,P(j(_)))&&0===X().length&&!S&&H(e);const t=$(),n=V(e);"reference"===C.current[0]&&n===x&&(H(e),e.shiftKey?Pt(t[t.length-1]):Pt(t[1])),"floating"===C.current[1]&&n===_&&e.shiftKey&&(H(e),Pt(t[0]))}}const t=j(_);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,x,_,a,C,S,X,$]),e.useEffect(()=>{if(!r&&R)return R.addEventListener("focusin",e),()=>{R.removeEventListener("focusin",e)};function e(e){const t=V(e),n=X().indexOf(t);-1!==n&&(z.current=n)}},[r,R,X]),e.useEffect(()=>{if(!r&&p)return R&&f(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),R.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),R.removeEventListener("focusout",t)}):void 0;function e(){B.current=!0,setTimeout(()=>{B.current=!1})}function t(e){const t=e.relatedTarget;queueMicrotask(()=>{const n=!(D(x,t)||D(R,t)||D(t,R)||D(null==O?void 0:O.portalNode,t)||null!=t&&t.hasAttribute(Tt("focus-guard"))||T&&(Dt(T.nodesRef.current,g).find(e=>{var n,o;return D(null==(n=e.context)?void 0:n.elements.floating,t)||D(null==(o=e.context)?void 0:o.elements.domReference,t)})||function(e,t){var n;let o=[],r=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;r;){const t=e.find(e=>e.id===r);r=null==t?void 0:t.parentId,t&&(o=o.concat(t))}return o}(T.nodesRef.current,g).find(e=>{var n,o;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(s&&n&&P(j(_))===j(_).body){f(_)&&_.focus();const e=z.current,t=X(),n=t[e]||t[t.length-1]||_;f(n)&&n.focus()}!S&&a||!t||!n||B.current||t===rn()||(I.current=!0,v(!1,e,"focus-out"))})}},[r,x,R,_,a,g,T,O,v,p,s,X,S]),e.useEffect(()=>{var e;if(r)return;const t=Array.from((null==O||null==(e=O.portalNode)?void 0:e.querySelectorAll("["+Tt("portal")+"]"))||[]);if(R){const e=[R,...t,M.current,F.current,C.current.includes("reference")||S?x:null].filter(e=>null!=e),n=a||S?Vt(e,A,!A):Vt(e);return()=>{n()}}},[r,x,R,a,C,O,S,A]),bt(()=>{if(r||!f(_))return;const e=P(j(_));queueMicrotask(()=>{const t=$(_),n=L.current,o=("number"==typeof n?t[n]:n.current)||_,r=D(_,e);E||r||!m||Pt(o,{preventScroll:o===_})})},[r,m,_,E,$,L]),bt(()=>{if(r||!_)return;let e=!1;const t=j(_),n=P(t);let o=w.current.openEvent;function i(t){let{open:n,reason:r,event:i,nested:l}=t;n&&(o=i),"escape-key"===r&&h.domReference.current&&on(h.domReference.current),"hover"===r&&"mouseleave"===i.type&&(I.current=!0),"outside-press"===r&&(l?(I.current=!1,e=!0):I.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(W()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||N(i)))}on(n),y.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,$t),K&&x&&x.insertAdjacentElement("afterend",l),()=>{y.off("openchange",i);const n=P(t),r=D(R,n)||T&&Dt(T.nodesRef.current,g).some(e=>{var t;return D(null==(t=e.context)?void 0:t.elements.floating,n)});(r||o&&["click","mousedown"].includes(o.type))&&h.domReference.current&&on(h.domReference.current);const c="boolean"==typeof k.current?rn()||l:k.current.current||l;queueMicrotask(()=>{k.current&&!I.current&&f(c)&&(c===n||n===t.body||r)&&c.focus({preventScroll:e}),l.remove()})}},[r,R,_,k,w,h,y,T,g,K,x]),e.useEffect(()=>{queueMicrotask(()=>{I.current=!1})},[r]),bt(()=>{if(!r&&O)return O.setFocusManagerState({modal:a,closeOnFocusOut:p,open:m,onOpenChange:v,refs:h}),()=>{O.setFocusManagerState(null)}},[r,O,a,m,v,h,p]),bt(()=>{if(r)return;if(!_)return;if("function"!=typeof MutationObserver)return;if(E)return;const e=()=>{const e=_.getAttribute("tabindex"),t=X(),n=P(j(R)),o=t.indexOf(n);-1!==o&&(z.current=o),C.current.includes("floating")||n!==h.domReference.current&&0===t.length?"0"!==e&&_.setAttribute("tabindex","0"):"-1"!==e&&_.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(_,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[r,R,_,h,C,X,E]);const Z=!r&&A&&(!a||!S)&&(K||a);return e.createElement(e.Fragment,null,Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.beforeInsideRef,onFocus:e=>{if(a){const e=$();Pt("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(I.current=!1,_t(e,O.portalNode)){const e=zt()||x;null==e||e.focus()}else{var t;null==(t=O.beforeOutsideRef.current)||t.focus()}}}),!S&&Y("start"),o,Y("end"),Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.afterInsideRef,onFocus:e=>{if(a)Pt($()[0]);else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(p&&(I.current=!0),_t(e,O.portalNode)){const e=Kt()||x;null==e||e.focus()}else{var t;null==(t=O.afterOutsideRef.current)||t.focus()}}}))}let un=0;let sn=()=>{};const an=e.forwardRef(function(t,n){const{lockScroll:o=!1,...r}=t;return bt(()=>{if(o)return un++,1===un&&(sn=function(){const e=/iP(hone|ad|od)|iOS/.test(F()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,r=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var l,c;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(r-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}()),()=>{un--,0===un&&sn()}},[o]),e.createElement("div",xt({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}),fn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},pn=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 mn(t,n){void 0===n&&(n={});const{open:o,onOpenChange:r,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:d="pointerdown",referencePress:p=!1,referencePressEvent:m="pointerdown",ancestorScroll:h=!1,bubbles:g,capture:v}=n,y=kt(),w=wt("function"==typeof s?s:()=>!1),b="function"==typeof s?w:s,x=e.useRef(!1),R=e.useRef(!1),{escapeKey:S,outsidePress:L}=pn(g),{escapeKey:T,outsidePress:M}=pn(v),P=e.useRef(!1),F=wt(e=>{var t;if(!o||!c||!u||"Escape"!==e.key)return;if(P.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=y?Dt(y.nodesRef.current,n):[];if(!S&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),I=wt(e=>{var t;const n=()=>{var t;F(e),null==(t=V(e))||t.removeEventListener("keydown",n)};null==(t=V(e))||t.addEventListener("keydown",n)}),N=wt(e=>{var t;const n=x.current;x.current=!1;const o=R.current;if(R.current=!1,"click"===d&&o)return;if(n)return;if("function"==typeof b&&!b(e))return;const c=V(e),u="["+Tt("inert")+"]",s=j(i.floating).querySelectorAll(u);let p=a(c)?c:null;for(;p&&!A(p);){const e=k(p);if(A(e)||!a(e))break;p=e}if(s.length&&a(c)&&!c.matches("html,body")&&!D(c,i.floating)&&Array.from(s).every(e=>!D(p,e)))return;if(f(c)&&q){const t=c.clientWidth>0&&c.scrollWidth>c.clientWidth,n=c.clientHeight>0&&c.scrollHeight>c.clientHeight;let o=n&&e.offsetX>c.clientWidth;if(n){"rtl"===C(c).direction&&(o=e.offsetX<=c.offsetWidth-c.clientWidth)}if(o||t&&e.offsetY>c.clientHeight)return}const m=null==(t=l.current.floatingContext)?void 0:t.nodeId,h=y&&Dt(y.nodesRef.current,m).some(t=>{var n;return B(e,null==(n=t.context)?void 0:n.elements.floating)});if(B(e,i.floating)||B(e,i.domReference)||h)return;const g=y?Dt(y.nodesRef.current,m):[];if(g.length>0){let e=!0;if(g.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),W=wt(e=>{var t;const n=()=>{var t;N(e),null==(t=V(e))||t.removeEventListener(d,n)};null==(t=V(e))||t.addEventListener(d,n)});e.useEffect(()=>{if(!o||!c)return;l.current.__escapeKeyBubbles=S,l.current.__outsidePressBubbles=L;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),P.current=!0}function s(){e=window.setTimeout(()=>{P.current=!1},E()?5:0)}const f=j(i.floating);u&&(f.addEventListener("keydown",T?I:F,T),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",s)),b&&f.addEventListener(d,M?W:N,M);let p=[];return h&&(a(i.domReference)&&(p=O(i.domReference)),a(i.floating)&&(p=p.concat(O(i.floating))),!a(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(O(i.reference.contextElement)))),p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),p.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{u&&(f.removeEventListener("keydown",T?I:F,T),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",s)),b&&f.removeEventListener(d,M?W:N,M),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[l,i,u,b,d,o,r,h,c,S,L,F,T,I,N,M,W]),e.useEffect(()=>{x.current=!1},[b,d]);const H=e.useMemo(()=>({onKeyDown:F,[fn[m]]:e=>{p&&r(!1,e.nativeEvent,"reference-press")}}),[F,r,p,m]),q=e.useMemo(()=>({onKeyDown:F,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[dn[d]]:()=>{x.current=!0}}),[F,d]);return e.useMemo(()=>c?{reference:H,floating:q}:{},[c,H,q])}function hn(t){const{open:n=!1,onOpenChange:o,elements:r}=t,i=At(),l=e.useRef({}),[c]=e.useState(()=>function(){const e=new Map;return{emit(t,n){var o;null==(o=e.get(t))||o.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,(null==(o=e.get(t))?void 0:o.filter(e=>e!==n))||[])}}}()),u=null!=((null==(s=e.useContext(Ct))?void 0:s.id)||null);var s;const[a,f]=e.useState(r.reference),d=wt((e,t,n)=>{l.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)}),p=e.useMemo(()=>({setPositionReference:f}),[]),m=e.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return e.useMemo(()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:p}),[n,d,m,c,i,p])}function gn(t){void 0===t&&(t={});const{nodeId:n}=t,o=hn({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||o,l=i.elements,[c,u]=e.useState(null),[s,f]=e.useState(null),d=(null==l?void 0:l.domReference)||c,p=e.useRef(null),m=kt();bt(()=>{d&&(p.current=d)},[d]);const h=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:c,floating:u}={},transform:s=!0,whileElementsMounted:a,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(i);ct(m,i)||h(i);const[g,v]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=e.useCallback(e=>{e!==A.current&&(A.current=e,w(e))},[]),R=c||g,E=u||y,S=e.useRef(null),A=e.useRef(null),C=e.useRef(d),L=null!=a,k=at(a),T=at(l),O=at(f),M=e.useCallback(()=>{if(!S.current||!A.current)return;const e={placement:n,strategy:o,middleware:m};T.current&&(e.platform=T.current),it(S.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==O.current};P.current&&!ct(C.current,t)&&(C.current=t,r.flushSync(()=>{p(t)}))})},[m,n,o,T,O]);lt(()=>{!1===f&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[f]);const P=e.useRef(!1);lt(()=>(P.current=!0,()=>{P.current=!1}),[]),lt(()=>{if(R&&(S.current=R),E&&(A.current=E),R&&E){if(k.current)return k.current(R,E,M);M()}},[R,E,M,k,L]);const D=e.useMemo(()=>({reference:S,floating:A,setReference:b,setFloating:x}),[b,x]),F=e.useMemo(()=>({reference:R,floating:E}),[R,E]),I=e.useMemo(()=>{const e={position:o,left:0,top:0};if(!F.floating)return e;const t=st(F.floating,d.x),n=st(F.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...ut(F.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:n}},[o,s,F.floating,d.x,d.y]);return e.useMemo(()=>({...d,update:M,refs:D,elements:F,floatingStyles:I}),[d,M,D,F,I])}({...t,elements:{...l,...s&&{reference:s}}}),g=e.useCallback(e=>{const t=a(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),h.refs.setReference(t)},[h.refs]),v=e.useCallback(e=>{(a(e)||null===e)&&(p.current=e,u(e)),(a(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!a(e))&&h.refs.setReference(e)},[h.refs]),y=e.useMemo(()=>({...h.refs,setReference:v,setPositionReference:g,domReference:p}),[h.refs,v,g]),w=e.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=e.useMemo(()=>({...h,...i,refs:y,elements:w,nodeId:n}),[h,y,w,n,i]);return bt(()=>{i.dataRef.current.floatingContext=b;const e=null==m?void 0:m.nodesRef.current.find(e=>e.id===n);e&&(e.context=b)}),e.useMemo(()=>({...h,context:b,refs:y,elements:w}),[h,y,w,b])}const vn="active",yn="selected";function wn(e,t,n){const o=new Map,r="item"===n;let i=e;if(r&&e){const{[vn]:t,[yn]:n,...o}=e;i=o}return{..."floating"===n&&{tabIndex:-1,[tn]:""},...i,...t.map(t=>{const o=t?t[n]:null;return"function"==typeof o?e?o(e):null:o}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var l;r&&[vn,yn].includes(n)||(0===n.indexOf("on")?(o.has(n)||o.set(n,[]),"function"==typeof i&&(null==(l=o.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null==(e=o.get(n))?void 0:e.map(e=>e(...r)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}function bn(t){void 0===t&&(t=[]);const n=t.map(e=>null==e?void 0:e.reference),o=t.map(e=>null==e?void 0:e.floating),r=t.map(e=>null==e?void 0:e.item),i=e.useCallback(e=>wn(e,t,"reference"),n),l=e.useCallback(e=>wn(e,t,"floating"),o),c=e.useCallback(e=>wn(e,t,"item"),r);return e.useMemo(()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c}),[i,l,c])}const xn=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function Rn(e,t){return"function"==typeof e?e(t):e}function En(t,n){void 0===n&&(n={});const{open:o,elements:{floating:r}}=t,{duration:i=250}=n,l=("number"==typeof i?i:i.close)||0,[c,u]=e.useState("unmounted"),s=function(t,n){const[o,r]=e.useState(t);return t&&!o&&r(!0),e.useEffect(()=>{if(!t&&o){const e=setTimeout(()=>r(!1),n);return()=>clearTimeout(e)}},[t,o,n]),o}(o,l);return s||"close"!==c||u("unmounted"),bt(()=>{if(r){if(o){u("initial");const e=requestAnimationFrame(()=>{u("open")});return()=>{cancelAnimationFrame(e)}}u("close")}},[o,r]),{isMounted:s,status:c}}function Sn(t,n){void 0===n&&(n={});const{initial:o={opacity:0},open:r,close:i,common:l,duration:c=250}=n,u=t.placement,s=u.split("-")[0],a=e.useMemo(()=>({side:s,placement:u}),[s,u]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[m,h]=e.useState(()=>({...Rn(l,a),...Rn(o,a)})),{isMounted:g,status:v}=En(t,{duration:c}),y=Ot(o),w=Ot(r),b=Ot(i),x=Ot(l);return bt(()=>{const e=Rn(y.current,a),t=Rn(b.current,a),n=Rn(x.current,a),o=Rn(w.current,a)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===v&&h(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===v&&h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:d+"ms",...n,...o}),"close"===v){const o=t||e;h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:p+"ms",...n,...o})}},[p,b,y,w,x,d,v,a]),{isMounted:g,styles:m}}export{Qt as F,Qe as a,mt as b,Sn as c,gt as d,mn as e,pt as f,bn as g,cn as h,ht as i,At as j,an as k,ft as o,dt as s,gn as u};
|