@fuma-content/studio 1.0.0 → 1.0.2
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/build/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/build/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/build/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/build/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/build/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/build/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/build/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/build/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/build/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/build/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/build/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/build/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/build/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/build/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/build/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/build/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/build/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/build/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/build/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/build/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/build/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/build/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/build/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/build/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/build/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/build/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/build/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/build/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/build/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/build/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/build/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/build/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/build/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/build/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/build/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/build/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/build/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/build/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/build/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/build/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/build/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/build/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/build/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/build/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/build/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/build/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/build/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/build/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/build/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/build/client/assets/QueryClientProvider-DqiXnN2L.js +1 -0
- package/build/client/assets/actions-DkbV2Z0p.js +1 -0
- package/build/client/assets/actions-DpkI7OTF.js +1 -0
- package/build/client/assets/badge-CZkdLoIP.js +1 -0
- package/build/client/assets/button-Bm94vje1.js +41 -0
- package/build/client/assets/client-BWBqEatf.js +1 -0
- package/build/client/assets/client-Crg-pMcu.js +1 -0
- package/build/client/assets/client-DVneG3Rq.css +1 -0
- package/build/client/assets/client-OSVRoCKH.js +569 -0
- package/build/client/assets/dropdown-menu-EF-sTINr.js +1 -0
- package/build/client/assets/entry.rsc-D51PwnQL.js +1 -0
- package/build/client/assets/index-BdrDVoE8.js +1 -0
- package/build/client/assets/index-BpILsqFO.js +1 -0
- package/build/client/assets/index-Bx93mXy1.js +11 -0
- package/build/client/assets/index-CQRgqbuL.js +1 -0
- package/build/client/assets/index-DOs5iMXj.js +1 -0
- package/build/client/assets/index-DTzAH5JX.js +1 -0
- package/build/client/assets/layout-CnpYRqF0.js +1 -0
- package/build/client/assets/mdx-BNErtsK6.js +1 -0
- package/build/client/assets/page-DOzl4Kpa.js +1 -0
- package/build/client/assets/page-uNpJU_rv.js +1 -0
- package/build/client/assets/query-z9oLNeTD.js +1 -0
- package/build/client/assets/react-B8--K7an.js +10 -0
- package/build/client/assets/root-B_CXTQpA.js +1 -0
- package/build/client/assets/root-D3NoAGI1.js +1 -0
- package/build/client/assets/root-z8crlXSh.css +1 -0
- package/build/client/assets/route-DVneG3Rq.css +1 -0
- package/build/client/assets/router-a9jyj9wf.js +10 -0
- package/build/client/assets/separator-tWFpvpUX.js +1 -0
- package/build/client/assets/sidebar-BBYit8gY.js +12 -0
- package/build/client/assets/site-header-DQkKe-WA.js +1 -0
- package/build/client/assets/spinner-BdPhtfsc.js +1 -0
- package/build/client/assets/tooltip-Dvh-iHDG.js +16 -0
- package/build/client/assets/use-sync-ZgcwUdu_.js +9 -0
- package/build/client/assets/yaml-Cloe7OVn.js +32 -0
- package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +268 -0
- package/build/server/__ssr_build/assets/QueryClientProvider-DlvBH3OQ.js +30 -0
- package/build/server/__ssr_build/assets/actions-B50-3n-a.js +63 -0
- package/build/server/__ssr_build/assets/actions-BFtCTvOL.js +21 -0
- package/{src/components/ui/badge.tsx → build/server/__ssr_build/assets/badge-DYFvBSp8.js} +23 -28
- package/build/server/__ssr_build/assets/button-C_-b_vqm.js +4098 -0
- package/build/server/__ssr_build/assets/client--HXec13w.js +130 -0
- package/build/server/__ssr_build/assets/client-BqW9rGyi.js +116885 -0
- package/build/server/__ssr_build/assets/client-CU90j0R8.js +154 -0
- package/build/server/__ssr_build/assets/dropdown-menu-D2YyT3lP.js +1312 -0
- package/build/server/__ssr_build/assets/entry.rsc-Cg_DxYkh.js +12 -0
- package/build/server/__ssr_build/assets/index-B-gno69w.js +58 -0
- package/build/server/__ssr_build/assets/index-DBc0nhEL.js +288 -0
- package/build/server/__ssr_build/assets/index-Dtw6X3NW.js +1092 -0
- package/build/server/__ssr_build/assets/index-DvVNShHF.js +86 -0
- package/build/server/__ssr_build/assets/index-PpqpVA51.js +612 -0
- package/build/server/__ssr_build/assets/layout-CPnSx9PI.js +454 -0
- package/build/server/__ssr_build/assets/mdx-bmeV1kyx.js +44 -0
- package/build/server/__ssr_build/assets/page-BwoghW3K.js +38 -0
- package/build/server/__ssr_build/assets/page-HxttullC.js +89 -0
- package/build/server/__ssr_build/assets/query-C1_xUNXy.js +1975 -0
- package/build/server/__ssr_build/assets/root-CS7F-km4.js +16 -0
- package/build/server/__ssr_build/assets/root-D-Y-rGw5.js +73 -0
- package/build/server/__ssr_build/assets/separator-8UA_ceSq.js +49 -0
- package/build/server/__ssr_build/assets/sidebar-BzNOZeBO.js +13194 -0
- package/build/server/__ssr_build/assets/site-header-CXHKSzqk.js +13 -0
- package/build/server/__ssr_build/assets/spinner-BXcLlTNs.js +1291 -0
- package/build/server/__ssr_build/assets/tooltip-DZ4WdJt-.js +9553 -0
- package/build/server/__ssr_build/assets/use-sync-TRS0zL-Y.js +3404 -0
- package/build/server/__ssr_build/assets/yaml-BEdFfhvc.js +63 -0
- package/build/server/__ssr_build/index.js +36076 -0
- package/build/server/__vite_rsc_assets_manifest.js +268 -0
- package/build/server/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/build/server/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/build/server/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/build/server/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/build/server/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/build/server/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/build/server/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/build/server/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/build/server/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/build/server/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/build/server/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/build/server/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/build/server/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/build/server/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/build/server/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/build/server/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/build/server/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/build/server/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/build/server/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/build/server/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/build/server/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/build/server/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/build/server/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/build/server/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/build/server/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/build/server/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/build/server/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/build/server/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/build/server/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/build/server/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/build/server/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/build/server/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/build/server/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/build/server/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/build/server/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/build/server/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/build/server/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/build/server/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/build/server/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/build/server/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/build/server/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/build/server/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/build/server/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/build/server/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/build/server/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/build/server/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/build/server/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/build/server/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/build/server/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/build/server/assets/actions-C92yn6jE.js +61 -0
- package/build/server/assets/actions-CWWFIcb1.js +46 -0
- package/build/server/assets/actions-DZdN0IBq.js +73 -0
- package/build/server/assets/client-BdxXy6rH.js +13 -0
- package/build/server/assets/client-DLzFPnCR.js +13 -0
- package/build/server/assets/config-Cb909uq6.js +257 -0
- package/build/server/assets/index-X49ifkk3.js +9 -0
- package/build/server/assets/jsx-runtime.react-server-D3We4JeM.js +324 -0
- package/build/server/assets/layout-CRw_6FCt.js +2071 -0
- package/build/server/assets/page-BcrsPZbM.js +9 -0
- package/build/server/assets/page-zlF_Ew1s.js +72 -0
- package/build/server/assets/root-CVOXO6T9.js +23 -0
- package/build/server/assets/root-dGb6ch_9.js +38 -0
- package/build/server/assets/root-z8crlXSh.css +1 -0
- package/build/server/assets/route-DVneG3Rq.css +1 -0
- package/build/server/assets/route-Ds0B4hTo.js +44 -0
- package/build/server/assets/route-DvwlfKZg.js +21 -0
- package/build/server/assets/route-o-6k10r9.js +70774 -0
- package/build/server/index.js +17032 -0
- package/dist/bin/cli.d.mts +1 -0
- package/dist/bin/cli.mjs +71 -0
- package/dist/bin.mjs +14 -40
- package/dist/package.mjs +1 -1
- package/package.json +33 -32
- package/dist/index.d.mts +0 -52
- package/dist/index.mjs +0 -67
- package/dist/mdx/actions.mjs +0 -32
- package/dist/mdx/client.mjs +0 -167
- package/dist/src/components/code-editor/mdx.lazy.mjs +0 -19
- package/dist/src/components/code-editor/mdx.mjs +0 -44
- package/dist/src/components/code-editor/yaml.lazy.mjs +0 -22
- package/dist/src/components/code-editor/yaml.mjs +0 -63
- package/dist/src/components/editor/editor-base-kit.mjs +0 -41
- package/dist/src/components/editor/editor-kit.mjs +0 -73
- package/dist/src/components/editor/md.mjs +0 -42
- package/dist/src/components/editor/plugins/ai-kit.mjs +0 -68
- package/dist/src/components/editor/plugins/align-base-kit.mjs +0 -28
- package/dist/src/components/editor/plugins/align-kit.mjs +0 -30
- package/dist/src/components/editor/plugins/autoformat-kit.mjs +0 -214
- package/dist/src/components/editor/plugins/basic-blocks-base-kit.mjs +0 -22
- package/dist/src/components/editor/plugins/basic-blocks-kit.mjs +0 -51
- package/dist/src/components/editor/plugins/basic-marks-base-kit.mjs +0 -20
- package/dist/src/components/editor/plugins/basic-marks-kit.mjs +0 -28
- package/dist/src/components/editor/plugins/block-menu-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/block-placeholder-kit.mjs +0 -14
- package/dist/src/components/editor/plugins/block-selection-kit.mjs +0 -48
- package/dist/src/components/editor/plugins/callout-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/callout-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/code-block-base-kit.mjs +0 -16
- package/dist/src/components/editor/plugins/code-block-kit.mjs +0 -19
- package/dist/src/components/editor/plugins/column-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/column-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/comment-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/comment-kit.mjs +0 -53
- package/dist/src/components/editor/plugins/copilot-kit.mjs +0 -49
- package/dist/src/components/editor/plugins/cursor-overlay-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/date-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/date-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/discussion-kit.mjs +0 -94
- package/dist/src/components/editor/plugins/dnd-kit.mjs +0 -31
- package/dist/src/components/editor/plugins/emoji-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/exit-break-kit.mjs +0 -12
- package/dist/src/components/editor/plugins/fixed-toolbar-kit.mjs +0 -15
- package/dist/src/components/editor/plugins/floating-toolbar-kit.mjs +0 -15
- package/dist/src/components/editor/plugins/font-base-kit.mjs +0 -14
- package/dist/src/components/editor/plugins/font-kit.mjs +0 -19
- package/dist/src/components/editor/plugins/indent-base-kit.mjs +0 -17
- package/dist/src/components/editor/plugins/indent-kit.mjs +0 -20
- package/dist/src/components/editor/plugins/line-height-base-kit.mjs +0 -20
- package/dist/src/components/editor/plugins/line-height-kit.mjs +0 -22
- package/dist/src/components/editor/plugins/link-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/link-kit.mjs +0 -15
- package/dist/src/components/editor/plugins/list-base-kit.mjs +0 -19
- package/dist/src/components/editor/plugins/list-kit.mjs +0 -22
- package/dist/src/components/editor/plugins/markdown-kit.mjs +0 -17
- package/dist/src/components/editor/plugins/math-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/math-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/media-base-kit.mjs +0 -23
- package/dist/src/components/editor/plugins/media-kit.mjs +0 -37
- package/dist/src/components/editor/plugins/slash-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/suggestion-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/suggestion-kit.mjs +0 -50
- package/dist/src/components/editor/plugins/table-base-kit.mjs +0 -13
- package/dist/src/components/editor/plugins/table-kit.mjs +0 -15
- package/dist/src/components/editor/transforms.mjs +0 -125
- package/dist/src/components/editor/ui/ai-chat-editor.mjs +0 -21
- package/dist/src/components/editor/ui/ai-menu.mjs +0 -488
- package/dist/src/components/editor/ui/ai-node.mjs +0 -24
- package/dist/src/components/editor/ui/ai-toolbar-button.mjs +0 -23
- package/dist/src/components/editor/ui/align-toolbar-button.mjs +0 -71
- package/dist/src/components/editor/ui/block-context-menu.mjs +0 -130
- package/dist/src/components/editor/ui/block-discussion.mjs +0 -200
- package/dist/src/components/editor/ui/block-draggable.mjs +0 -265
- package/dist/src/components/editor/ui/block-list-static.mjs +0 -48
- package/dist/src/components/editor/ui/block-list.mjs +0 -47
- package/dist/src/components/editor/ui/block-selection.mjs +0 -28
- package/dist/src/components/editor/ui/block-suggestion.mjs +0 -319
- package/dist/src/components/editor/ui/blockquote-node-static.mjs +0 -14
- package/dist/src/components/editor/ui/blockquote-node.mjs +0 -16
- package/dist/src/components/editor/ui/callout-node-static.mjs +0 -29
- package/dist/src/components/editor/ui/callout-node.mjs +0 -50
- package/dist/src/components/editor/ui/caption.mjs +0 -39
- package/dist/src/components/editor/ui/code-block-node-static.mjs +0 -30
- package/dist/src/components/editor/ui/code-block-node.mjs +0 -121
- package/dist/src/components/editor/ui/code-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/code-node.mjs +0 -17
- package/dist/src/components/editor/ui/column-node-static.mjs +0 -32
- package/dist/src/components/editor/ui/column-node.mjs +0 -229
- package/dist/src/components/editor/ui/comment-node-static.mjs +0 -14
- package/dist/src/components/editor/ui/comment-node.mjs +0 -33
- package/dist/src/components/editor/ui/comment-toolbar-button.mjs +0 -23
- package/dist/src/components/editor/ui/comment.mjs +0 -422
- package/dist/src/components/editor/ui/cursor-overlay.mjs +0 -36
- package/dist/src/components/editor/ui/date-node-static.mjs +0 -32
- package/dist/src/components/editor/ui/date-node.mjs +0 -60
- package/dist/src/components/editor/ui/editor-static.mjs +0 -31
- package/dist/src/components/editor/ui/editor.mjs +0 -60
- package/dist/src/components/editor/ui/emoji-node.mjs +0 -46
- package/dist/src/components/editor/ui/emoji-toolbar-button.mjs +0 -415
- package/dist/src/components/editor/ui/equation-node-static.mjs +0 -65
- package/dist/src/components/editor/ui/equation-node.mjs +0 -159
- package/dist/src/components/editor/ui/equation-toolbar-button.mjs +0 -23
- package/dist/src/components/editor/ui/fixed-toolbar-buttons.mjs +0 -109
- package/dist/src/components/editor/ui/fixed-toolbar.mjs +0 -16
- package/dist/src/components/editor/ui/floating-toolbar-buttons.mjs +0 -54
- package/dist/src/components/editor/ui/floating-toolbar.mjs +0 -51
- package/dist/src/components/editor/ui/font-color-toolbar-button.mjs +0 -637
- package/dist/src/components/editor/ui/font-size-toolbar-button.mjs +0 -83
- package/dist/src/components/editor/ui/ghost-text.mjs +0 -22
- package/dist/src/components/editor/ui/heading-node-static.mjs +0 -60
- package/dist/src/components/editor/ui/heading-node.mjs +0 -62
- package/dist/src/components/editor/ui/highlight-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/highlight-node.mjs +0 -17
- package/dist/src/components/editor/ui/history-toolbar-button.mjs +0 -35
- package/dist/src/components/editor/ui/hr-node-static.mjs +0 -18
- package/dist/src/components/editor/ui/hr-node.mjs +0 -23
- package/dist/src/components/editor/ui/indent-toolbar-button.mjs +0 -29
- package/dist/src/components/editor/ui/inline-combobox.mjs +0 -148
- package/dist/src/components/editor/ui/insert-toolbar-button.mjs +0 -199
- package/dist/src/components/editor/ui/kbd-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/kbd-node.mjs +0 -17
- package/dist/src/components/editor/ui/line-height-toolbar-button.mjs +0 -56
- package/dist/src/components/editor/ui/link-node-static.mjs +0 -20
- package/dist/src/components/editor/ui/link-node.mjs +0 -28
- package/dist/src/components/editor/ui/link-toolbar-button.mjs +0 -21
- package/dist/src/components/editor/ui/link-toolbar.mjs +0 -141
- package/dist/src/components/editor/ui/list-toolbar-button.mjs +0 -131
- package/dist/src/components/editor/ui/mark-toolbar-button.mjs +0 -20
- package/dist/src/components/editor/ui/media-image-node-static.mjs +0 -32
- package/dist/src/components/editor/ui/media-image-node.mjs +0 -64
- package/dist/src/components/editor/ui/media-placeholder-node.mjs +0 -184
- package/dist/src/components/editor/ui/media-preview-dialog.mjs +0 -113
- package/dist/src/components/editor/ui/media-toolbar-button.mjs +0 -156
- package/dist/src/components/editor/ui/media-toolbar.mjs +0 -80
- package/dist/src/components/editor/ui/media-upload-toast.mjs +0 -39
- package/dist/src/components/editor/ui/media-video-node-static.mjs +0 -27
- package/dist/src/components/editor/ui/mode-toolbar-button.mjs +0 -112
- package/dist/src/components/editor/ui/paragraph-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/paragraph-node.mjs +0 -17
- package/dist/src/components/editor/ui/resize-handle.mjs +0 -43
- package/dist/src/components/editor/ui/slash-node.mjs +0 -228
- package/dist/src/components/editor/ui/suggestion-node-static.mjs +0 -24
- package/dist/src/components/editor/ui/suggestion-node.mjs +0 -111
- package/dist/src/components/editor/ui/suggestion-toolbar-button.mjs +0 -24
- package/dist/src/components/editor/ui/table-icons.mjs +0 -1310
- package/dist/src/components/editor/ui/table-node-static.mjs +0 -68
- package/dist/src/components/editor/ui/table-node.mjs +0 -375
- package/dist/src/components/editor/ui/table-toolbar-button.mjs +0 -190
- package/dist/src/components/editor/ui/turn-into-toolbar-button.mjs +0 -168
- package/dist/src/components/editor/use-chat.mjs +0 -80
- package/dist/src/components/json-schema-editor/client.mjs +0 -46
- package/dist/src/components/json-schema-editor/components/inputs.mjs +0 -438
- package/dist/src/components/json-schema-editor/get-default-values.mjs +0 -23
- package/dist/src/components/json-schema-editor/schema.mjs +0 -131
- package/dist/src/components/json-schema-editor/utils/merge-schema.mjs +0 -134
- package/dist/src/components/json-schema-editor/utils/schema-to-string.mjs +0 -53
- package/dist/src/components/ui/alert-dialog.mjs +0 -90
- package/dist/src/components/ui/avatar.mjs +0 -32
- package/dist/src/components/ui/button.mjs +0 -48
- package/dist/src/components/ui/calendar.mjs +0 -108
- package/dist/src/components/ui/checkbox.mjs +0 -23
- package/dist/src/components/ui/combobox.mjs +0 -53
- package/dist/src/components/ui/command.mjs +0 -42
- package/dist/src/components/ui/context-menu.mjs +0 -67
- package/dist/src/components/ui/dialog.mjs +0 -9
- package/dist/src/components/ui/dropdown-menu.mjs +0 -122
- package/dist/src/components/ui/input-group.mjs +0 -31
- package/dist/src/components/ui/input.mjs +0 -15
- package/dist/src/components/ui/label.mjs +0 -19
- package/dist/src/components/ui/popover.mjs +0 -37
- package/dist/src/components/ui/select.mjs +0 -80
- package/dist/src/components/ui/separator.mjs +0 -19
- package/dist/src/components/ui/spinner.mjs +0 -16
- package/dist/src/components/ui/tabs.mjs +0 -39
- package/dist/src/components/ui/textarea.mjs +0 -14
- package/dist/src/components/ui/toolbar.mjs +0 -183
- package/dist/src/components/ui/tooltip.mjs +0 -38
- package/dist/src/hooks/editor/use-is-creator.mjs +0 -19
- package/dist/src/hooks/use-upload-file.mjs +0 -73
- package/dist/src/lib/config.mjs +0 -34
- package/dist/src/lib/data/store.d.mts +0 -15
- package/dist/src/lib/lowlight.mjs +0 -7
- package/dist/src/lib/utils/deep-equal.mjs +0 -18
- package/dist/src/lib/utils/remove-undefined.mjs +0 -18
- package/dist/src/lib/utils.mjs +0 -10
- package/next.config.ts +0 -23
- package/postcss.config.mjs +0 -7
- package/src/app/(dashboard)/collection/[name]/[...slug]/page.client.tsx +0 -26
- package/src/app/(dashboard)/collection/[name]/[...slug]/page.tsx +0 -18
- package/src/app/(dashboard)/collection/[name]/page.client.tsx +0 -82
- package/src/app/(dashboard)/collection/[name]/page.tsx +0 -11
- package/src/app/(dashboard)/layout.tsx +0 -34
- package/src/app/(dashboard)/page.tsx +0 -38
- package/src/app/api/ai/command/prompts.ts +0 -313
- package/src/app/api/ai/command/route.ts +0 -203
- package/src/app/api/ai/command/utils.ts +0 -242
- package/src/app/api/ai/copilot/route.ts +0 -33
- package/src/app/api/uploadthing/route.ts +0 -5
- package/src/app/codeblock/LICENSE +0 -21
- package/src/app/codeblock/styles.css +0 -289
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -223
- package/src/app/layout.client.tsx +0 -15
- package/src/app/layout.tsx +0 -30
- package/src/components/app-sidebar.tsx +0 -162
- package/src/components/code-editor/mdx.lazy.tsx +0 -18
- package/src/components/code-editor/mdx.tsx +0 -48
- package/src/components/code-editor/yaml.lazy.tsx +0 -20
- package/src/components/code-editor/yaml.tsx +0 -71
- package/src/components/collection/actions.tsx +0 -41
- package/src/components/collection/client.tsx +0 -63
- package/src/components/collection/context.tsx +0 -24
- package/src/components/collection/document/actions.tsx +0 -83
- package/src/components/editor/editor-base-kit.tsx +0 -37
- package/src/components/editor/editor-kit.tsx +0 -87
- package/src/components/editor/md.tsx +0 -60
- package/src/components/editor/plugins/ai-kit.tsx +0 -102
- package/src/components/editor/plugins/align-base-kit.tsx +0 -16
- package/src/components/editor/plugins/align-kit.tsx +0 -18
- package/src/components/editor/plugins/autoformat-kit.tsx +0 -236
- package/src/components/editor/plugins/basic-blocks-base-kit.tsx +0 -34
- package/src/components/editor/plugins/basic-blocks-kit.tsx +0 -87
- package/src/components/editor/plugins/basic-marks-base-kit.tsx +0 -26
- package/src/components/editor/plugins/basic-marks-kit.tsx +0 -40
- package/src/components/editor/plugins/basic-nodes-kit.tsx +0 -6
- package/src/components/editor/plugins/block-menu-kit.tsx +0 -14
- package/src/components/editor/plugins/block-placeholder-kit.tsx +0 -17
- package/src/components/editor/plugins/block-selection-kit.tsx +0 -54
- package/src/components/editor/plugins/callout-base-kit.tsx +0 -5
- package/src/components/editor/plugins/callout-kit.tsx +0 -7
- package/src/components/editor/plugins/code-block-base-kit.tsx +0 -16
- package/src/components/editor/plugins/code-block-kit.tsx +0 -19
- package/src/components/editor/plugins/column-base-kit.tsx +0 -11
- package/src/components/editor/plugins/column-kit.tsx +0 -10
- package/src/components/editor/plugins/comment-base-kit.tsx +0 -5
- package/src/components/editor/plugins/comment-kit.tsx +0 -92
- package/src/components/editor/plugins/copilot-kit.tsx +0 -70
- package/src/components/editor/plugins/cursor-overlay-kit.tsx +0 -13
- package/src/components/editor/plugins/date-base-kit.tsx +0 -5
- package/src/components/editor/plugins/date-kit.tsx +0 -7
- package/src/components/editor/plugins/discussion-kit.tsx +0 -142
- package/src/components/editor/plugins/dnd-kit.tsx +0 -25
- package/src/components/editor/plugins/emoji-kit.tsx +0 -13
- package/src/components/editor/plugins/exit-break-kit.tsx +0 -12
- package/src/components/editor/plugins/fixed-toolbar-kit.tsx +0 -19
- package/src/components/editor/plugins/floating-toolbar-kit.tsx +0 -19
- package/src/components/editor/plugins/font-base-kit.tsx +0 -20
- package/src/components/editor/plugins/font-kit.tsx +0 -29
- package/src/components/editor/plugins/indent-base-kit.tsx +0 -13
- package/src/components/editor/plugins/indent-kit.tsx +0 -22
- package/src/components/editor/plugins/line-height-base-kit.tsx +0 -14
- package/src/components/editor/plugins/line-height-kit.tsx +0 -16
- package/src/components/editor/plugins/link-base-kit.tsx +0 -5
- package/src/components/editor/plugins/link-kit.tsx +0 -15
- package/src/components/editor/plugins/list-base-kit.tsx +0 -17
- package/src/components/editor/plugins/list-kit.tsx +0 -26
- package/src/components/editor/plugins/markdown-kit.tsx +0 -13
- package/src/components/editor/plugins/math-base-kit.tsx +0 -11
- package/src/components/editor/plugins/math-kit.tsx +0 -10
- package/src/components/editor/plugins/media-base-kit.tsx +0 -25
- package/src/components/editor/plugins/media-kit.tsx +0 -28
- package/src/components/editor/plugins/slash-kit.tsx +0 -18
- package/src/components/editor/plugins/suggestion-base-kit.tsx +0 -5
- package/src/components/editor/plugins/suggestion-kit.tsx +0 -83
- package/src/components/editor/plugins/table-base-kit.tsx +0 -20
- package/src/components/editor/plugins/table-kit.tsx +0 -22
- package/src/components/editor/settings-dialog.tsx +0 -418
- package/src/components/editor/transforms.ts +0 -193
- package/src/components/editor/types.ts +0 -149
- package/src/components/editor/ui/ai-chat-editor.tsx +0 -20
- package/src/components/editor/ui/ai-menu.tsx +0 -663
- package/src/components/editor/ui/ai-node.tsx +0 -40
- package/src/components/editor/ui/ai-toolbar-button.tsx +0 -23
- package/src/components/editor/ui/align-toolbar-button.tsx +0 -78
- package/src/components/editor/ui/block-context-menu.tsx +0 -154
- package/src/components/editor/ui/block-discussion.tsx +0 -318
- package/src/components/editor/ui/block-draggable.tsx +0 -464
- package/src/components/editor/ui/block-list-static.tsx +0 -75
- package/src/components/editor/ui/block-list.tsx +0 -72
- package/src/components/editor/ui/block-selection.tsx +0 -37
- package/src/components/editor/ui/block-suggestion.tsx +0 -438
- package/src/components/editor/ui/blockquote-node-static.tsx +0 -5
- package/src/components/editor/ui/blockquote-node.tsx +0 -7
- package/src/components/editor/ui/callout-node-static.tsx +0 -30
- package/src/components/editor/ui/callout-node.tsx +0 -64
- package/src/components/editor/ui/caption.tsx +0 -55
- package/src/components/editor/ui/code-block-node-static.tsx +0 -33
- package/src/components/editor/ui/code-block-node.tsx +0 -161
- package/src/components/editor/ui/code-node-static.tsx +0 -15
- package/src/components/editor/ui/code-node.tsx +0 -17
- package/src/components/editor/ui/column-node-static.tsx +0 -27
- package/src/components/editor/ui/column-node.tsx +0 -285
- package/src/components/editor/ui/comment-node-static.tsx +0 -12
- package/src/components/editor/ui/comment-node.tsx +0 -43
- package/src/components/editor/ui/comment-toolbar-button.tsx +0 -24
- package/src/components/editor/ui/comment.tsx +0 -577
- package/src/components/editor/ui/cursor-overlay.tsx +0 -66
- package/src/components/editor/ui/date-node-static.tsx +0 -45
- package/src/components/editor/ui/date-node.tsx +0 -86
- package/src/components/editor/ui/editor-static.tsx +0 -47
- package/src/components/editor/ui/editor.tsx +0 -120
- package/src/components/editor/ui/emoji-node.tsx +0 -65
- package/src/components/editor/ui/emoji-toolbar-button.tsx +0 -582
- package/src/components/editor/ui/equation-node-static.tsx +0 -94
- package/src/components/editor/ui/equation-node.tsx +0 -218
- package/src/components/editor/ui/equation-toolbar-button.tsx +0 -24
- package/src/components/editor/ui/fixed-toolbar-buttons.tsx +0 -135
- package/src/components/editor/ui/fixed-toolbar.tsx +0 -17
- package/src/components/editor/ui/floating-toolbar-buttons.tsx +0 -72
- package/src/components/editor/ui/floating-toolbar.tsx +0 -76
- package/src/components/editor/ui/font-color-toolbar-button.tsx +0 -804
- package/src/components/editor/ui/font-size-toolbar-button.tsx +0 -102
- package/src/components/editor/ui/ghost-text.tsx +0 -27
- package/src/components/editor/ui/heading-node-static.tsx +0 -54
- package/src/components/editor/ui/heading-node.tsx +0 -54
- package/src/components/editor/ui/highlight-node-static.tsx +0 -11
- package/src/components/editor/ui/highlight-node.tsx +0 -13
- package/src/components/editor/ui/history-toolbar-button.tsx +0 -41
- package/src/components/editor/ui/hr-node-static.tsx +0 -16
- package/src/components/editor/ui/hr-node.tsx +0 -28
- package/src/components/editor/ui/indent-toolbar-button.tsx +0 -27
- package/src/components/editor/ui/inline-combobox.tsx +0 -251
- package/src/components/editor/ui/insert-toolbar-button.tsx +0 -242
- package/src/components/editor/ui/kbd-node-static.tsx +0 -15
- package/src/components/editor/ui/kbd-node.tsx +0 -17
- package/src/components/editor/ui/line-height-toolbar-button.tsx +0 -66
- package/src/components/editor/ui/link-node-static.tsx +0 -21
- package/src/components/editor/ui/link-node.tsx +0 -37
- package/src/components/editor/ui/link-toolbar-button.tsx +0 -18
- package/src/components/editor/ui/link-toolbar.tsx +0 -196
- package/src/components/editor/ui/list-toolbar-button.tsx +0 -195
- package/src/components/editor/ui/mark-toolbar-button.tsx +0 -20
- package/src/components/editor/ui/media-image-node-static.tsx +0 -33
- package/src/components/editor/ui/media-image-node.tsx +0 -75
- package/src/components/editor/ui/media-placeholder-node.tsx +0 -235
- package/src/components/editor/ui/media-preview-dialog.tsx +0 -145
- package/src/components/editor/ui/media-toolbar-button.tsx +0 -202
- package/src/components/editor/ui/media-toolbar.tsx +0 -100
- package/src/components/editor/ui/media-upload-toast.tsx +0 -59
- package/src/components/editor/ui/media-video-node-static.tsx +0 -23
- package/src/components/editor/ui/mode-toolbar-button.tsx +0 -121
- package/src/components/editor/ui/paragraph-node-static.tsx +0 -13
- package/src/components/editor/ui/paragraph-node.tsx +0 -15
- package/src/components/editor/ui/resize-handle.tsx +0 -79
- package/src/components/editor/ui/slash-node.tsx +0 -274
- package/src/components/editor/ui/suggestion-node-static.tsx +0 -30
- package/src/components/editor/ui/suggestion-node.tsx +0 -157
- package/src/components/editor/ui/suggestion-toolbar-button.tsx +0 -25
- package/src/components/editor/ui/table-icons.tsx +0 -685
- package/src/components/editor/ui/table-node-static.tsx +0 -86
- package/src/components/editor/ui/table-node.tsx +0 -569
- package/src/components/editor/ui/table-toolbar-button.tsx +0 -260
- package/src/components/editor/ui/turn-into-toolbar-button.tsx +0 -176
- package/src/components/editor/use-chat.ts +0 -120
- package/src/components/icons/logo.tsx +0 -37
- package/src/components/json-schema-editor/client.tsx +0 -55
- package/src/components/json-schema-editor/components/inputs.tsx +0 -612
- package/src/components/json-schema-editor/get-default-values.ts +0 -29
- package/src/components/json-schema-editor/schema.tsx +0 -206
- package/src/components/json-schema-editor/utils/merge-schema.ts +0 -167
- package/src/components/json-schema-editor/utils/schema-to-string.ts +0 -87
- package/src/components/nav-user.tsx +0 -102
- package/src/components/site-header.tsx +0 -13
- package/src/components/ui/alert-dialog.tsx +0 -182
- package/src/components/ui/avatar.tsx +0 -96
- package/src/components/ui/button.tsx +0 -65
- package/src/components/ui/calendar.tsx +0 -186
- package/src/components/ui/checkbox.tsx +0 -29
- package/src/components/ui/combobox.tsx +0 -267
- package/src/components/ui/command.tsx +0 -180
- package/src/components/ui/context-menu.tsx +0 -161
- package/src/components/ui/dialog.tsx +0 -142
- package/src/components/ui/drawer.tsx +0 -120
- package/src/components/ui/dropdown-menu.tsx +0 -239
- package/src/components/ui/field.tsx +0 -224
- package/src/components/ui/input-group.tsx +0 -144
- package/src/components/ui/input.tsx +0 -19
- package/src/components/ui/label.tsx +0 -18
- package/src/components/ui/popover.tsx +0 -76
- package/src/components/ui/select.tsx +0 -182
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/sheet.tsx +0 -130
- package/src/components/ui/sidebar.tsx +0 -608
- package/src/components/ui/sonner.tsx +0 -45
- package/src/components/ui/spinner.tsx +0 -15
- package/src/components/ui/table.tsx +0 -89
- package/src/components/ui/tabs.tsx +0 -60
- package/src/components/ui/textarea.tsx +0 -18
- package/src/components/ui/toggle-group.tsx +0 -86
- package/src/components/ui/toggle.tsx +0 -45
- package/src/components/ui/toolbar.tsx +0 -365
- package/src/components/ui/tooltip.tsx +0 -57
- package/src/hooks/editor/use-is-creator.ts +0 -21
- package/src/hooks/use-mobile.ts +0 -19
- package/src/hooks/use-mounted.ts +0 -11
- package/src/hooks/use-upload-file.ts +0 -121
- package/src/lib/ai/markdown-joiner-transform.ts +0 -235
- package/src/lib/config.ts +0 -42
- package/src/lib/data/actions.ts +0 -46
- package/src/lib/data/boundary.client.tsx +0 -22
- package/src/lib/data/boundary.tsx +0 -22
- package/src/lib/data/query.ts +0 -9
- package/src/lib/data/store.ts +0 -52
- package/src/lib/lowlight.ts +0 -3
- package/src/lib/uploadthing.ts +0 -19
- package/src/lib/utils/deep-equal.ts +0 -37
- package/src/lib/utils/remove-undefined.ts +0 -21
- package/src/lib/utils/urls.ts +0 -6
- package/src/lib/utils.ts +0 -6
- package/tsconfig.build.json +0 -24
- package/tsconfig.json +0 -37
|
@@ -0,0 +1,4098 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports, i as reactDomExports, h as React, R as ReactDOM } from "../index.js";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
const mergeClasses = (...classes) => classes.filter((className, index2, array) => {
|
|
6
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
|
|
7
|
+
}).join(" ").trim();
|
|
8
|
+
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9
|
+
const toCamelCase = (string) => string.replace(
|
|
10
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
11
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
12
|
+
);
|
|
13
|
+
const toPascalCase = (string) => {
|
|
14
|
+
const camelCase = toCamelCase(string);
|
|
15
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
16
|
+
};
|
|
17
|
+
var defaultAttributes = {
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
+
width: 24,
|
|
20
|
+
height: 24,
|
|
21
|
+
viewBox: "0 0 24 24",
|
|
22
|
+
fill: "none",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: 2,
|
|
25
|
+
strokeLinecap: "round",
|
|
26
|
+
strokeLinejoin: "round"
|
|
27
|
+
};
|
|
28
|
+
const hasA11yProp = (props) => {
|
|
29
|
+
for (const prop in props) {
|
|
30
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
const Icon = reactExports.forwardRef(
|
|
37
|
+
({
|
|
38
|
+
color = "currentColor",
|
|
39
|
+
size: size2 = 24,
|
|
40
|
+
strokeWidth = 2,
|
|
41
|
+
absoluteStrokeWidth,
|
|
42
|
+
className = "",
|
|
43
|
+
children,
|
|
44
|
+
iconNode,
|
|
45
|
+
...rest
|
|
46
|
+
}, ref) => reactExports.createElement(
|
|
47
|
+
"svg",
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
...defaultAttributes,
|
|
51
|
+
width: size2,
|
|
52
|
+
height: size2,
|
|
53
|
+
stroke: color,
|
|
54
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size2) : strokeWidth,
|
|
55
|
+
className: mergeClasses("lucide", className),
|
|
56
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
57
|
+
...rest
|
|
58
|
+
},
|
|
59
|
+
[
|
|
60
|
+
...iconNode.map(([tag, attrs]) => reactExports.createElement(tag, attrs)),
|
|
61
|
+
...Array.isArray(children) ? children : [children]
|
|
62
|
+
]
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
const createLucideIcon = (iconName, iconNode) => {
|
|
66
|
+
const Component = reactExports.forwardRef(
|
|
67
|
+
({ className, ...props }, ref) => reactExports.createElement(Icon, {
|
|
68
|
+
ref,
|
|
69
|
+
iconNode,
|
|
70
|
+
className: mergeClasses(
|
|
71
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
72
|
+
`lucide-${iconName}`,
|
|
73
|
+
className
|
|
74
|
+
),
|
|
75
|
+
...props
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
Component.displayName = toPascalCase(iconName);
|
|
79
|
+
return Component;
|
|
80
|
+
};
|
|
81
|
+
const __iconNode = [
|
|
82
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
83
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
84
|
+
];
|
|
85
|
+
const X = createLucideIcon("x", __iconNode);
|
|
86
|
+
function setRef(ref, value) {
|
|
87
|
+
if (typeof ref === "function") {
|
|
88
|
+
return ref(value);
|
|
89
|
+
} else if (ref !== null && ref !== void 0) {
|
|
90
|
+
ref.current = value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function composeRefs(...refs) {
|
|
94
|
+
return (node) => {
|
|
95
|
+
let hasCleanup = false;
|
|
96
|
+
const cleanups = refs.map((ref) => {
|
|
97
|
+
const cleanup = setRef(ref, node);
|
|
98
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
99
|
+
hasCleanup = true;
|
|
100
|
+
}
|
|
101
|
+
return cleanup;
|
|
102
|
+
});
|
|
103
|
+
if (hasCleanup) {
|
|
104
|
+
return () => {
|
|
105
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
106
|
+
const cleanup = cleanups[i];
|
|
107
|
+
if (typeof cleanup == "function") {
|
|
108
|
+
cleanup();
|
|
109
|
+
} else {
|
|
110
|
+
setRef(refs[i], null);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function useComposedRefs(...refs) {
|
|
118
|
+
return reactExports.useCallback(composeRefs(...refs), refs);
|
|
119
|
+
}
|
|
120
|
+
// @__NO_SIDE_EFFECTS__
|
|
121
|
+
function createSlot(ownerName) {
|
|
122
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
123
|
+
const Slot2 = reactExports.forwardRef((props, forwardedRef) => {
|
|
124
|
+
const { children, ...slotProps } = props;
|
|
125
|
+
const childrenArray = reactExports.Children.toArray(children);
|
|
126
|
+
const slottable = childrenArray.find(isSlottable);
|
|
127
|
+
if (slottable) {
|
|
128
|
+
const newElement = slottable.props.children;
|
|
129
|
+
const newChildren = childrenArray.map((child) => {
|
|
130
|
+
if (child === slottable) {
|
|
131
|
+
if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
|
|
132
|
+
return reactExports.isValidElement(newElement) ? newElement.props.children : null;
|
|
133
|
+
} else {
|
|
134
|
+
return child;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
|
|
138
|
+
}
|
|
139
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
140
|
+
});
|
|
141
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
142
|
+
return Slot2;
|
|
143
|
+
}
|
|
144
|
+
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
145
|
+
// @__NO_SIDE_EFFECTS__
|
|
146
|
+
function createSlotClone(ownerName) {
|
|
147
|
+
const SlotClone = reactExports.forwardRef((props, forwardedRef) => {
|
|
148
|
+
const { children, ...slotProps } = props;
|
|
149
|
+
if (reactExports.isValidElement(children)) {
|
|
150
|
+
const childrenRef = getElementRef$1(children);
|
|
151
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
152
|
+
if (children.type !== reactExports.Fragment) {
|
|
153
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
154
|
+
}
|
|
155
|
+
return reactExports.cloneElement(children, props2);
|
|
156
|
+
}
|
|
157
|
+
return reactExports.Children.count(children) > 1 ? reactExports.Children.only(null) : null;
|
|
158
|
+
});
|
|
159
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
160
|
+
return SlotClone;
|
|
161
|
+
}
|
|
162
|
+
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
163
|
+
// @__NO_SIDE_EFFECTS__
|
|
164
|
+
function createSlottable(ownerName) {
|
|
165
|
+
const Slottable2 = ({ children }) => {
|
|
166
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
|
|
167
|
+
};
|
|
168
|
+
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
169
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
170
|
+
return Slottable2;
|
|
171
|
+
}
|
|
172
|
+
function isSlottable(child) {
|
|
173
|
+
return reactExports.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
174
|
+
}
|
|
175
|
+
function mergeProps(slotProps, childProps) {
|
|
176
|
+
const overrideProps = { ...childProps };
|
|
177
|
+
for (const propName in childProps) {
|
|
178
|
+
const slotPropValue = slotProps[propName];
|
|
179
|
+
const childPropValue = childProps[propName];
|
|
180
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
181
|
+
if (isHandler) {
|
|
182
|
+
if (slotPropValue && childPropValue) {
|
|
183
|
+
overrideProps[propName] = (...args) => {
|
|
184
|
+
const result = childPropValue(...args);
|
|
185
|
+
slotPropValue(...args);
|
|
186
|
+
return result;
|
|
187
|
+
};
|
|
188
|
+
} else if (slotPropValue) {
|
|
189
|
+
overrideProps[propName] = slotPropValue;
|
|
190
|
+
}
|
|
191
|
+
} else if (propName === "style") {
|
|
192
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
193
|
+
} else if (propName === "className") {
|
|
194
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return { ...slotProps, ...overrideProps };
|
|
198
|
+
}
|
|
199
|
+
function getElementRef$1(element) {
|
|
200
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
201
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
202
|
+
if (mayWarn) {
|
|
203
|
+
return element.ref;
|
|
204
|
+
}
|
|
205
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
206
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
207
|
+
if (mayWarn) {
|
|
208
|
+
return element.props.ref;
|
|
209
|
+
}
|
|
210
|
+
return element.props.ref || element.ref;
|
|
211
|
+
}
|
|
212
|
+
var NODES = [
|
|
213
|
+
"a",
|
|
214
|
+
"button",
|
|
215
|
+
"div",
|
|
216
|
+
"form",
|
|
217
|
+
"h2",
|
|
218
|
+
"h3",
|
|
219
|
+
"img",
|
|
220
|
+
"input",
|
|
221
|
+
"label",
|
|
222
|
+
"li",
|
|
223
|
+
"nav",
|
|
224
|
+
"ol",
|
|
225
|
+
"p",
|
|
226
|
+
"select",
|
|
227
|
+
"span",
|
|
228
|
+
"svg",
|
|
229
|
+
"ul"
|
|
230
|
+
];
|
|
231
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
232
|
+
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
233
|
+
const Node2 = reactExports.forwardRef((props, forwardedRef) => {
|
|
234
|
+
const { asChild, ...primitiveProps } = props;
|
|
235
|
+
const Comp = asChild ? Slot2 : node;
|
|
236
|
+
if (typeof window !== "undefined") {
|
|
237
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
238
|
+
}
|
|
239
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
240
|
+
});
|
|
241
|
+
Node2.displayName = `Primitive.${node}`;
|
|
242
|
+
return { ...primitive, [node]: Node2 };
|
|
243
|
+
}, {});
|
|
244
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
245
|
+
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
246
|
+
}
|
|
247
|
+
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
248
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
249
|
+
position: "absolute",
|
|
250
|
+
border: 0,
|
|
251
|
+
width: 1,
|
|
252
|
+
height: 1,
|
|
253
|
+
padding: 0,
|
|
254
|
+
margin: -1,
|
|
255
|
+
overflow: "hidden",
|
|
256
|
+
clip: "rect(0, 0, 0, 0)",
|
|
257
|
+
whiteSpace: "nowrap",
|
|
258
|
+
wordWrap: "normal"
|
|
259
|
+
});
|
|
260
|
+
var NAME$1 = "VisuallyHidden";
|
|
261
|
+
var VisuallyHidden = reactExports.forwardRef(
|
|
262
|
+
(props, forwardedRef) => {
|
|
263
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
264
|
+
Primitive.span,
|
|
265
|
+
{
|
|
266
|
+
...props,
|
|
267
|
+
ref: forwardedRef,
|
|
268
|
+
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
VisuallyHidden.displayName = NAME$1;
|
|
274
|
+
var Root$1 = VisuallyHidden;
|
|
275
|
+
function createContext2(rootComponentName, defaultContext) {
|
|
276
|
+
const Context = reactExports.createContext(defaultContext);
|
|
277
|
+
const Provider = (props) => {
|
|
278
|
+
const { children, ...context } = props;
|
|
279
|
+
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
280
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
281
|
+
};
|
|
282
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
283
|
+
function useContext2(consumerName) {
|
|
284
|
+
const context = reactExports.useContext(Context);
|
|
285
|
+
if (context) return context;
|
|
286
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
287
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
288
|
+
}
|
|
289
|
+
return [Provider, useContext2];
|
|
290
|
+
}
|
|
291
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
292
|
+
let defaultContexts = [];
|
|
293
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
294
|
+
const BaseContext = reactExports.createContext(defaultContext);
|
|
295
|
+
const index2 = defaultContexts.length;
|
|
296
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
297
|
+
const Provider = (props) => {
|
|
298
|
+
const { scope, children, ...context } = props;
|
|
299
|
+
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
300
|
+
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
301
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
302
|
+
};
|
|
303
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
304
|
+
function useContext2(consumerName, scope) {
|
|
305
|
+
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
306
|
+
const context = reactExports.useContext(Context);
|
|
307
|
+
if (context) return context;
|
|
308
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
309
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
310
|
+
}
|
|
311
|
+
return [Provider, useContext2];
|
|
312
|
+
}
|
|
313
|
+
const createScope = () => {
|
|
314
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
315
|
+
return reactExports.createContext(defaultContext);
|
|
316
|
+
});
|
|
317
|
+
return function useScope(scope) {
|
|
318
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
319
|
+
return reactExports.useMemo(
|
|
320
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
321
|
+
[scope, contexts]
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
createScope.scopeName = scopeName;
|
|
326
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
327
|
+
}
|
|
328
|
+
function composeContextScopes(...scopes) {
|
|
329
|
+
const baseScope = scopes[0];
|
|
330
|
+
if (scopes.length === 1) return baseScope;
|
|
331
|
+
const createScope = () => {
|
|
332
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
333
|
+
useScope: createScope2(),
|
|
334
|
+
scopeName: createScope2.scopeName
|
|
335
|
+
}));
|
|
336
|
+
return function useComposedScopes(overrideScopes) {
|
|
337
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
338
|
+
const scopeProps = useScope(overrideScopes);
|
|
339
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
340
|
+
return { ...nextScopes2, ...currentScope };
|
|
341
|
+
}, {});
|
|
342
|
+
return reactExports.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
createScope.scopeName = baseScope.scopeName;
|
|
346
|
+
return createScope;
|
|
347
|
+
}
|
|
348
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
349
|
+
return function handleEvent(event) {
|
|
350
|
+
originalEventHandler?.(event);
|
|
351
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
352
|
+
return ourEventHandler?.(event);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
var useLayoutEffect2 = globalThis?.document ? reactExports.useLayoutEffect : () => {
|
|
357
|
+
};
|
|
358
|
+
var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
359
|
+
function useControllableState({
|
|
360
|
+
prop,
|
|
361
|
+
defaultProp,
|
|
362
|
+
onChange = () => {
|
|
363
|
+
},
|
|
364
|
+
caller
|
|
365
|
+
}) {
|
|
366
|
+
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
367
|
+
defaultProp,
|
|
368
|
+
onChange
|
|
369
|
+
});
|
|
370
|
+
const isControlled = prop !== void 0;
|
|
371
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
372
|
+
{
|
|
373
|
+
const isControlledRef = reactExports.useRef(prop !== void 0);
|
|
374
|
+
reactExports.useEffect(() => {
|
|
375
|
+
const wasControlled = isControlledRef.current;
|
|
376
|
+
if (wasControlled !== isControlled) {
|
|
377
|
+
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
378
|
+
const to = isControlled ? "controlled" : "uncontrolled";
|
|
379
|
+
console.warn(
|
|
380
|
+
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
isControlledRef.current = isControlled;
|
|
384
|
+
}, [isControlled, caller]);
|
|
385
|
+
}
|
|
386
|
+
const setValue = reactExports.useCallback(
|
|
387
|
+
(nextValue) => {
|
|
388
|
+
if (isControlled) {
|
|
389
|
+
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
390
|
+
if (value2 !== prop) {
|
|
391
|
+
onChangeRef.current?.(value2);
|
|
392
|
+
}
|
|
393
|
+
} else {
|
|
394
|
+
setUncontrolledProp(nextValue);
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
398
|
+
);
|
|
399
|
+
return [value, setValue];
|
|
400
|
+
}
|
|
401
|
+
function useUncontrolledState({
|
|
402
|
+
defaultProp,
|
|
403
|
+
onChange
|
|
404
|
+
}) {
|
|
405
|
+
const [value, setValue] = reactExports.useState(defaultProp);
|
|
406
|
+
const prevValueRef = reactExports.useRef(value);
|
|
407
|
+
const onChangeRef = reactExports.useRef(onChange);
|
|
408
|
+
useInsertionEffect(() => {
|
|
409
|
+
onChangeRef.current = onChange;
|
|
410
|
+
}, [onChange]);
|
|
411
|
+
reactExports.useEffect(() => {
|
|
412
|
+
if (prevValueRef.current !== value) {
|
|
413
|
+
onChangeRef.current?.(value);
|
|
414
|
+
prevValueRef.current = value;
|
|
415
|
+
}
|
|
416
|
+
}, [value, prevValueRef]);
|
|
417
|
+
return [value, setValue, onChangeRef];
|
|
418
|
+
}
|
|
419
|
+
function isFunction(value) {
|
|
420
|
+
return typeof value === "function";
|
|
421
|
+
}
|
|
422
|
+
function useStateMachine(initialState, machine) {
|
|
423
|
+
return reactExports.useReducer((state, event) => {
|
|
424
|
+
const nextState = machine[state][event];
|
|
425
|
+
return nextState ?? state;
|
|
426
|
+
}, initialState);
|
|
427
|
+
}
|
|
428
|
+
var Presence = (props) => {
|
|
429
|
+
const { present, children } = props;
|
|
430
|
+
const presence = usePresence(present);
|
|
431
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : reactExports.Children.only(children);
|
|
432
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
433
|
+
const forceMount = typeof children === "function";
|
|
434
|
+
return forceMount || presence.isPresent ? reactExports.cloneElement(child, { ref }) : null;
|
|
435
|
+
};
|
|
436
|
+
Presence.displayName = "Presence";
|
|
437
|
+
function usePresence(present) {
|
|
438
|
+
const [node, setNode] = reactExports.useState();
|
|
439
|
+
const stylesRef = reactExports.useRef(null);
|
|
440
|
+
const prevPresentRef = reactExports.useRef(present);
|
|
441
|
+
const prevAnimationNameRef = reactExports.useRef("none");
|
|
442
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
443
|
+
const [state, send] = useStateMachine(initialState, {
|
|
444
|
+
mounted: {
|
|
445
|
+
UNMOUNT: "unmounted",
|
|
446
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
447
|
+
},
|
|
448
|
+
unmountSuspended: {
|
|
449
|
+
MOUNT: "mounted",
|
|
450
|
+
ANIMATION_END: "unmounted"
|
|
451
|
+
},
|
|
452
|
+
unmounted: {
|
|
453
|
+
MOUNT: "mounted"
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
reactExports.useEffect(() => {
|
|
457
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
458
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
459
|
+
}, [state]);
|
|
460
|
+
useLayoutEffect2(() => {
|
|
461
|
+
const styles = stylesRef.current;
|
|
462
|
+
const wasPresent = prevPresentRef.current;
|
|
463
|
+
const hasPresentChanged = wasPresent !== present;
|
|
464
|
+
if (hasPresentChanged) {
|
|
465
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
466
|
+
const currentAnimationName = getAnimationName(styles);
|
|
467
|
+
if (present) {
|
|
468
|
+
send("MOUNT");
|
|
469
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
470
|
+
send("UNMOUNT");
|
|
471
|
+
} else {
|
|
472
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
473
|
+
if (wasPresent && isAnimating) {
|
|
474
|
+
send("ANIMATION_OUT");
|
|
475
|
+
} else {
|
|
476
|
+
send("UNMOUNT");
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
prevPresentRef.current = present;
|
|
480
|
+
}
|
|
481
|
+
}, [present, send]);
|
|
482
|
+
useLayoutEffect2(() => {
|
|
483
|
+
if (node) {
|
|
484
|
+
let timeoutId;
|
|
485
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
486
|
+
const handleAnimationEnd = (event) => {
|
|
487
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
488
|
+
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
489
|
+
if (event.target === node && isCurrentAnimation) {
|
|
490
|
+
send("ANIMATION_END");
|
|
491
|
+
if (!prevPresentRef.current) {
|
|
492
|
+
const currentFillMode = node.style.animationFillMode;
|
|
493
|
+
node.style.animationFillMode = "forwards";
|
|
494
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
495
|
+
if (node.style.animationFillMode === "forwards") {
|
|
496
|
+
node.style.animationFillMode = currentFillMode;
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const handleAnimationStart = (event) => {
|
|
503
|
+
if (event.target === node) {
|
|
504
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
508
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
509
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
510
|
+
return () => {
|
|
511
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
512
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
513
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
514
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
515
|
+
};
|
|
516
|
+
} else {
|
|
517
|
+
send("ANIMATION_END");
|
|
518
|
+
}
|
|
519
|
+
}, [node, send]);
|
|
520
|
+
return {
|
|
521
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
522
|
+
ref: reactExports.useCallback((node2) => {
|
|
523
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
524
|
+
setNode(node2);
|
|
525
|
+
}, [])
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function getAnimationName(styles) {
|
|
529
|
+
return styles?.animationName || "none";
|
|
530
|
+
}
|
|
531
|
+
function getElementRef(element) {
|
|
532
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
533
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
534
|
+
if (mayWarn) {
|
|
535
|
+
return element.ref;
|
|
536
|
+
}
|
|
537
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
538
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
539
|
+
if (mayWarn) {
|
|
540
|
+
return element.props.ref;
|
|
541
|
+
}
|
|
542
|
+
return element.props.ref || element.ref;
|
|
543
|
+
}
|
|
544
|
+
var useReactId = React[" useId ".trim().toString()] || (() => void 0);
|
|
545
|
+
var count$1 = 0;
|
|
546
|
+
function useId(deterministicId) {
|
|
547
|
+
const [id, setId] = reactExports.useState(useReactId());
|
|
548
|
+
useLayoutEffect2(() => {
|
|
549
|
+
setId((reactId) => reactId ?? String(count$1++));
|
|
550
|
+
}, [deterministicId]);
|
|
551
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
552
|
+
}
|
|
553
|
+
function useCallbackRef$1(callback) {
|
|
554
|
+
const callbackRef = reactExports.useRef(callback);
|
|
555
|
+
reactExports.useEffect(() => {
|
|
556
|
+
callbackRef.current = callback;
|
|
557
|
+
});
|
|
558
|
+
return reactExports.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
559
|
+
}
|
|
560
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
561
|
+
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
562
|
+
reactExports.useEffect(() => {
|
|
563
|
+
const handleKeyDown = (event) => {
|
|
564
|
+
if (event.key === "Escape") {
|
|
565
|
+
onEscapeKeyDown(event);
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
569
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
570
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
571
|
+
}
|
|
572
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
573
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
574
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
575
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
576
|
+
var originalBodyPointerEvents;
|
|
577
|
+
var DismissableLayerContext = reactExports.createContext({
|
|
578
|
+
layers: /* @__PURE__ */ new Set(),
|
|
579
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
580
|
+
branches: /* @__PURE__ */ new Set()
|
|
581
|
+
});
|
|
582
|
+
var DismissableLayer = reactExports.forwardRef(
|
|
583
|
+
(props, forwardedRef) => {
|
|
584
|
+
const {
|
|
585
|
+
disableOutsidePointerEvents = false,
|
|
586
|
+
onEscapeKeyDown,
|
|
587
|
+
onPointerDownOutside,
|
|
588
|
+
onFocusOutside,
|
|
589
|
+
onInteractOutside,
|
|
590
|
+
onDismiss,
|
|
591
|
+
...layerProps
|
|
592
|
+
} = props;
|
|
593
|
+
const context = reactExports.useContext(DismissableLayerContext);
|
|
594
|
+
const [node, setNode] = reactExports.useState(null);
|
|
595
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
596
|
+
const [, force] = reactExports.useState({});
|
|
597
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
598
|
+
const layers = Array.from(context.layers);
|
|
599
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
600
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
601
|
+
const index2 = node ? layers.indexOf(node) : -1;
|
|
602
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
603
|
+
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
604
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
605
|
+
const target = event.target;
|
|
606
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
607
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
608
|
+
onPointerDownOutside?.(event);
|
|
609
|
+
onInteractOutside?.(event);
|
|
610
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
611
|
+
}, ownerDocument);
|
|
612
|
+
const focusOutside = useFocusOutside((event) => {
|
|
613
|
+
const target = event.target;
|
|
614
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
615
|
+
if (isFocusInBranch) return;
|
|
616
|
+
onFocusOutside?.(event);
|
|
617
|
+
onInteractOutside?.(event);
|
|
618
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
619
|
+
}, ownerDocument);
|
|
620
|
+
useEscapeKeydown((event) => {
|
|
621
|
+
const isHighestLayer = index2 === context.layers.size - 1;
|
|
622
|
+
if (!isHighestLayer) return;
|
|
623
|
+
onEscapeKeyDown?.(event);
|
|
624
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
625
|
+
event.preventDefault();
|
|
626
|
+
onDismiss();
|
|
627
|
+
}
|
|
628
|
+
}, ownerDocument);
|
|
629
|
+
reactExports.useEffect(() => {
|
|
630
|
+
if (!node) return;
|
|
631
|
+
if (disableOutsidePointerEvents) {
|
|
632
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
633
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
634
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
635
|
+
}
|
|
636
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
637
|
+
}
|
|
638
|
+
context.layers.add(node);
|
|
639
|
+
dispatchUpdate();
|
|
640
|
+
return () => {
|
|
641
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
642
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
646
|
+
reactExports.useEffect(() => {
|
|
647
|
+
return () => {
|
|
648
|
+
if (!node) return;
|
|
649
|
+
context.layers.delete(node);
|
|
650
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
651
|
+
dispatchUpdate();
|
|
652
|
+
};
|
|
653
|
+
}, [node, context]);
|
|
654
|
+
reactExports.useEffect(() => {
|
|
655
|
+
const handleUpdate = () => force({});
|
|
656
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
657
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
658
|
+
}, []);
|
|
659
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
660
|
+
Primitive.div,
|
|
661
|
+
{
|
|
662
|
+
...layerProps,
|
|
663
|
+
ref: composedRefs,
|
|
664
|
+
style: {
|
|
665
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
666
|
+
...props.style
|
|
667
|
+
},
|
|
668
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
669
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
670
|
+
onPointerDownCapture: composeEventHandlers(
|
|
671
|
+
props.onPointerDownCapture,
|
|
672
|
+
pointerDownOutside.onPointerDownCapture
|
|
673
|
+
)
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
679
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
680
|
+
var DismissableLayerBranch = reactExports.forwardRef((props, forwardedRef) => {
|
|
681
|
+
const context = reactExports.useContext(DismissableLayerContext);
|
|
682
|
+
const ref = reactExports.useRef(null);
|
|
683
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
684
|
+
reactExports.useEffect(() => {
|
|
685
|
+
const node = ref.current;
|
|
686
|
+
if (node) {
|
|
687
|
+
context.branches.add(node);
|
|
688
|
+
return () => {
|
|
689
|
+
context.branches.delete(node);
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
}, [context.branches]);
|
|
693
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
694
|
+
});
|
|
695
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
696
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
697
|
+
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
698
|
+
const isPointerInsideReactTreeRef = reactExports.useRef(false);
|
|
699
|
+
const handleClickRef = reactExports.useRef(() => {
|
|
700
|
+
});
|
|
701
|
+
reactExports.useEffect(() => {
|
|
702
|
+
const handlePointerDown = (event) => {
|
|
703
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
704
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
705
|
+
handleAndDispatchCustomEvent(
|
|
706
|
+
POINTER_DOWN_OUTSIDE,
|
|
707
|
+
handlePointerDownOutside,
|
|
708
|
+
eventDetail,
|
|
709
|
+
{ discrete: true }
|
|
710
|
+
);
|
|
711
|
+
};
|
|
712
|
+
const eventDetail = { originalEvent: event };
|
|
713
|
+
if (event.pointerType === "touch") {
|
|
714
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
715
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
716
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
717
|
+
} else {
|
|
718
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
719
|
+
}
|
|
720
|
+
} else {
|
|
721
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
722
|
+
}
|
|
723
|
+
isPointerInsideReactTreeRef.current = false;
|
|
724
|
+
};
|
|
725
|
+
const timerId = window.setTimeout(() => {
|
|
726
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
727
|
+
}, 0);
|
|
728
|
+
return () => {
|
|
729
|
+
window.clearTimeout(timerId);
|
|
730
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
731
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
732
|
+
};
|
|
733
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
734
|
+
return {
|
|
735
|
+
// ensures we check React component tree (not just DOM tree)
|
|
736
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
740
|
+
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
741
|
+
const isFocusInsideReactTreeRef = reactExports.useRef(false);
|
|
742
|
+
reactExports.useEffect(() => {
|
|
743
|
+
const handleFocus = (event) => {
|
|
744
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
745
|
+
const eventDetail = { originalEvent: event };
|
|
746
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
747
|
+
discrete: false
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
752
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
753
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
754
|
+
return {
|
|
755
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
756
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
function dispatchUpdate() {
|
|
760
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
761
|
+
document.dispatchEvent(event);
|
|
762
|
+
}
|
|
763
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
764
|
+
const target = detail.originalEvent.target;
|
|
765
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
766
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
767
|
+
if (discrete) {
|
|
768
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
769
|
+
} else {
|
|
770
|
+
target.dispatchEvent(event);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
774
|
+
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
775
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
776
|
+
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
777
|
+
var FocusScope = reactExports.forwardRef((props, forwardedRef) => {
|
|
778
|
+
const {
|
|
779
|
+
loop = false,
|
|
780
|
+
trapped = false,
|
|
781
|
+
onMountAutoFocus: onMountAutoFocusProp,
|
|
782
|
+
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
783
|
+
...scopeProps
|
|
784
|
+
} = props;
|
|
785
|
+
const [container, setContainer] = reactExports.useState(null);
|
|
786
|
+
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
787
|
+
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
788
|
+
const lastFocusedElementRef = reactExports.useRef(null);
|
|
789
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
790
|
+
const focusScope = reactExports.useRef({
|
|
791
|
+
paused: false,
|
|
792
|
+
pause() {
|
|
793
|
+
this.paused = true;
|
|
794
|
+
},
|
|
795
|
+
resume() {
|
|
796
|
+
this.paused = false;
|
|
797
|
+
}
|
|
798
|
+
}).current;
|
|
799
|
+
reactExports.useEffect(() => {
|
|
800
|
+
if (trapped) {
|
|
801
|
+
let handleFocusIn2 = function(event) {
|
|
802
|
+
if (focusScope.paused || !container) return;
|
|
803
|
+
const target = event.target;
|
|
804
|
+
if (container.contains(target)) {
|
|
805
|
+
lastFocusedElementRef.current = target;
|
|
806
|
+
} else {
|
|
807
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
808
|
+
}
|
|
809
|
+
}, handleFocusOut2 = function(event) {
|
|
810
|
+
if (focusScope.paused || !container) return;
|
|
811
|
+
const relatedTarget = event.relatedTarget;
|
|
812
|
+
if (relatedTarget === null) return;
|
|
813
|
+
if (!container.contains(relatedTarget)) {
|
|
814
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
815
|
+
}
|
|
816
|
+
}, handleMutations2 = function(mutations) {
|
|
817
|
+
const focusedElement = document.activeElement;
|
|
818
|
+
if (focusedElement !== document.body) return;
|
|
819
|
+
for (const mutation of mutations) {
|
|
820
|
+
if (mutation.removedNodes.length > 0) focus(container);
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
document.addEventListener("focusin", handleFocusIn2);
|
|
824
|
+
document.addEventListener("focusout", handleFocusOut2);
|
|
825
|
+
const mutationObserver = new MutationObserver(handleMutations2);
|
|
826
|
+
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
827
|
+
return () => {
|
|
828
|
+
document.removeEventListener("focusin", handleFocusIn2);
|
|
829
|
+
document.removeEventListener("focusout", handleFocusOut2);
|
|
830
|
+
mutationObserver.disconnect();
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
}, [trapped, container, focusScope.paused]);
|
|
834
|
+
reactExports.useEffect(() => {
|
|
835
|
+
if (container) {
|
|
836
|
+
focusScopesStack.add(focusScope);
|
|
837
|
+
const previouslyFocusedElement = document.activeElement;
|
|
838
|
+
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
839
|
+
if (!hasFocusedCandidate) {
|
|
840
|
+
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
841
|
+
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
842
|
+
container.dispatchEvent(mountEvent);
|
|
843
|
+
if (!mountEvent.defaultPrevented) {
|
|
844
|
+
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
845
|
+
if (document.activeElement === previouslyFocusedElement) {
|
|
846
|
+
focus(container);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return () => {
|
|
851
|
+
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
852
|
+
setTimeout(() => {
|
|
853
|
+
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
854
|
+
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
855
|
+
container.dispatchEvent(unmountEvent);
|
|
856
|
+
if (!unmountEvent.defaultPrevented) {
|
|
857
|
+
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
858
|
+
}
|
|
859
|
+
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
860
|
+
focusScopesStack.remove(focusScope);
|
|
861
|
+
}, 0);
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
865
|
+
const handleKeyDown = reactExports.useCallback(
|
|
866
|
+
(event) => {
|
|
867
|
+
if (!loop && !trapped) return;
|
|
868
|
+
if (focusScope.paused) return;
|
|
869
|
+
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
870
|
+
const focusedElement = document.activeElement;
|
|
871
|
+
if (isTabKey && focusedElement) {
|
|
872
|
+
const container2 = event.currentTarget;
|
|
873
|
+
const [first, last] = getTabbableEdges(container2);
|
|
874
|
+
const hasTabbableElementsInside = first && last;
|
|
875
|
+
if (!hasTabbableElementsInside) {
|
|
876
|
+
if (focusedElement === container2) event.preventDefault();
|
|
877
|
+
} else {
|
|
878
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
879
|
+
event.preventDefault();
|
|
880
|
+
if (loop) focus(first, { select: true });
|
|
881
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
882
|
+
event.preventDefault();
|
|
883
|
+
if (loop) focus(last, { select: true });
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
[loop, trapped, focusScope.paused]
|
|
889
|
+
);
|
|
890
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
891
|
+
});
|
|
892
|
+
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
893
|
+
function focusFirst(candidates, { select = false } = {}) {
|
|
894
|
+
const previouslyFocusedElement = document.activeElement;
|
|
895
|
+
for (const candidate of candidates) {
|
|
896
|
+
focus(candidate, { select });
|
|
897
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
function getTabbableEdges(container) {
|
|
901
|
+
const candidates = getTabbableCandidates(container);
|
|
902
|
+
const first = findVisible(candidates, container);
|
|
903
|
+
const last = findVisible(candidates.reverse(), container);
|
|
904
|
+
return [first, last];
|
|
905
|
+
}
|
|
906
|
+
function getTabbableCandidates(container) {
|
|
907
|
+
const nodes = [];
|
|
908
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
909
|
+
acceptNode: (node) => {
|
|
910
|
+
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
911
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
912
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
916
|
+
return nodes;
|
|
917
|
+
}
|
|
918
|
+
function findVisible(elements, container) {
|
|
919
|
+
for (const element of elements) {
|
|
920
|
+
if (!isHidden(element, { upTo: container })) return element;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
function isHidden(node, { upTo }) {
|
|
924
|
+
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
925
|
+
while (node) {
|
|
926
|
+
if (upTo !== void 0 && node === upTo) return false;
|
|
927
|
+
if (getComputedStyle(node).display === "none") return true;
|
|
928
|
+
node = node.parentElement;
|
|
929
|
+
}
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
function isSelectableInput(element) {
|
|
933
|
+
return element instanceof HTMLInputElement && "select" in element;
|
|
934
|
+
}
|
|
935
|
+
function focus(element, { select = false } = {}) {
|
|
936
|
+
if (element && element.focus) {
|
|
937
|
+
const previouslyFocusedElement = document.activeElement;
|
|
938
|
+
element.focus({ preventScroll: true });
|
|
939
|
+
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
940
|
+
element.select();
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
var focusScopesStack = createFocusScopesStack();
|
|
944
|
+
function createFocusScopesStack() {
|
|
945
|
+
let stack = [];
|
|
946
|
+
return {
|
|
947
|
+
add(focusScope) {
|
|
948
|
+
const activeFocusScope = stack[0];
|
|
949
|
+
if (focusScope !== activeFocusScope) {
|
|
950
|
+
activeFocusScope?.pause();
|
|
951
|
+
}
|
|
952
|
+
stack = arrayRemove(stack, focusScope);
|
|
953
|
+
stack.unshift(focusScope);
|
|
954
|
+
},
|
|
955
|
+
remove(focusScope) {
|
|
956
|
+
stack = arrayRemove(stack, focusScope);
|
|
957
|
+
stack[0]?.resume();
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
function arrayRemove(array, item) {
|
|
962
|
+
const updatedArray = [...array];
|
|
963
|
+
const index2 = updatedArray.indexOf(item);
|
|
964
|
+
if (index2 !== -1) {
|
|
965
|
+
updatedArray.splice(index2, 1);
|
|
966
|
+
}
|
|
967
|
+
return updatedArray;
|
|
968
|
+
}
|
|
969
|
+
function removeLinks(items) {
|
|
970
|
+
return items.filter((item) => item.tagName !== "A");
|
|
971
|
+
}
|
|
972
|
+
var PORTAL_NAME = "Portal";
|
|
973
|
+
var Portal = reactExports.forwardRef((props, forwardedRef) => {
|
|
974
|
+
const { container: containerProp, ...portalProps } = props;
|
|
975
|
+
const [mounted, setMounted] = reactExports.useState(false);
|
|
976
|
+
useLayoutEffect2(() => setMounted(true), []);
|
|
977
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
978
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
979
|
+
});
|
|
980
|
+
Portal.displayName = PORTAL_NAME;
|
|
981
|
+
var count = 0;
|
|
982
|
+
function useFocusGuards() {
|
|
983
|
+
reactExports.useEffect(() => {
|
|
984
|
+
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
985
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
986
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
987
|
+
count++;
|
|
988
|
+
return () => {
|
|
989
|
+
if (count === 1) {
|
|
990
|
+
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
991
|
+
}
|
|
992
|
+
count--;
|
|
993
|
+
};
|
|
994
|
+
}, []);
|
|
995
|
+
}
|
|
996
|
+
function createFocusGuard() {
|
|
997
|
+
const element = document.createElement("span");
|
|
998
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
999
|
+
element.tabIndex = 0;
|
|
1000
|
+
element.style.outline = "none";
|
|
1001
|
+
element.style.opacity = "0";
|
|
1002
|
+
element.style.position = "fixed";
|
|
1003
|
+
element.style.pointerEvents = "none";
|
|
1004
|
+
return element;
|
|
1005
|
+
}
|
|
1006
|
+
var __assign = function() {
|
|
1007
|
+
__assign = Object.assign || function __assign2(t) {
|
|
1008
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1009
|
+
s = arguments[i];
|
|
1010
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1011
|
+
}
|
|
1012
|
+
return t;
|
|
1013
|
+
};
|
|
1014
|
+
return __assign.apply(this, arguments);
|
|
1015
|
+
};
|
|
1016
|
+
function __rest(s, e) {
|
|
1017
|
+
var t = {};
|
|
1018
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1019
|
+
t[p] = s[p];
|
|
1020
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1021
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1022
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1023
|
+
t[p[i]] = s[p[i]];
|
|
1024
|
+
}
|
|
1025
|
+
return t;
|
|
1026
|
+
}
|
|
1027
|
+
function __spreadArray(to, from, pack) {
|
|
1028
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1029
|
+
if (ar || !(i in from)) {
|
|
1030
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1031
|
+
ar[i] = from[i];
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1035
|
+
}
|
|
1036
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
1037
|
+
var e = new Error(message);
|
|
1038
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1039
|
+
};
|
|
1040
|
+
var zeroRightClassName = "right-scroll-bar-position";
|
|
1041
|
+
var fullWidthClassName = "width-before-scroll-bar";
|
|
1042
|
+
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
1043
|
+
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
1044
|
+
function assignRef(ref, value) {
|
|
1045
|
+
if (typeof ref === "function") {
|
|
1046
|
+
ref(value);
|
|
1047
|
+
} else if (ref) {
|
|
1048
|
+
ref.current = value;
|
|
1049
|
+
}
|
|
1050
|
+
return ref;
|
|
1051
|
+
}
|
|
1052
|
+
function useCallbackRef(initialValue, callback) {
|
|
1053
|
+
var ref = reactExports.useState(function() {
|
|
1054
|
+
return {
|
|
1055
|
+
// value
|
|
1056
|
+
value: initialValue,
|
|
1057
|
+
// last callback
|
|
1058
|
+
callback,
|
|
1059
|
+
// "memoized" public interface
|
|
1060
|
+
facade: {
|
|
1061
|
+
get current() {
|
|
1062
|
+
return ref.value;
|
|
1063
|
+
},
|
|
1064
|
+
set current(value) {
|
|
1065
|
+
var last = ref.value;
|
|
1066
|
+
if (last !== value) {
|
|
1067
|
+
ref.value = value;
|
|
1068
|
+
ref.callback(value, last);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
})[0];
|
|
1074
|
+
ref.callback = callback;
|
|
1075
|
+
return ref.facade;
|
|
1076
|
+
}
|
|
1077
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect;
|
|
1078
|
+
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
1079
|
+
function useMergeRefs(refs, defaultValue) {
|
|
1080
|
+
var callbackRef = useCallbackRef(null, function(newValue) {
|
|
1081
|
+
return refs.forEach(function(ref) {
|
|
1082
|
+
return assignRef(ref, newValue);
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
useIsomorphicLayoutEffect(function() {
|
|
1086
|
+
var oldValue = currentValues.get(callbackRef);
|
|
1087
|
+
if (oldValue) {
|
|
1088
|
+
var prevRefs_1 = new Set(oldValue);
|
|
1089
|
+
var nextRefs_1 = new Set(refs);
|
|
1090
|
+
var current_1 = callbackRef.current;
|
|
1091
|
+
prevRefs_1.forEach(function(ref) {
|
|
1092
|
+
if (!nextRefs_1.has(ref)) {
|
|
1093
|
+
assignRef(ref, null);
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
nextRefs_1.forEach(function(ref) {
|
|
1097
|
+
if (!prevRefs_1.has(ref)) {
|
|
1098
|
+
assignRef(ref, current_1);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
currentValues.set(callbackRef, refs);
|
|
1103
|
+
}, [refs]);
|
|
1104
|
+
return callbackRef;
|
|
1105
|
+
}
|
|
1106
|
+
function ItoI(a) {
|
|
1107
|
+
return a;
|
|
1108
|
+
}
|
|
1109
|
+
function innerCreateMedium(defaults, middleware) {
|
|
1110
|
+
if (middleware === void 0) {
|
|
1111
|
+
middleware = ItoI;
|
|
1112
|
+
}
|
|
1113
|
+
var buffer = [];
|
|
1114
|
+
var assigned = false;
|
|
1115
|
+
var medium = {
|
|
1116
|
+
read: function() {
|
|
1117
|
+
if (assigned) {
|
|
1118
|
+
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
1119
|
+
}
|
|
1120
|
+
if (buffer.length) {
|
|
1121
|
+
return buffer[buffer.length - 1];
|
|
1122
|
+
}
|
|
1123
|
+
return defaults;
|
|
1124
|
+
},
|
|
1125
|
+
useMedium: function(data) {
|
|
1126
|
+
var item = middleware(data, assigned);
|
|
1127
|
+
buffer.push(item);
|
|
1128
|
+
return function() {
|
|
1129
|
+
buffer = buffer.filter(function(x) {
|
|
1130
|
+
return x !== item;
|
|
1131
|
+
});
|
|
1132
|
+
};
|
|
1133
|
+
},
|
|
1134
|
+
assignSyncMedium: function(cb) {
|
|
1135
|
+
assigned = true;
|
|
1136
|
+
while (buffer.length) {
|
|
1137
|
+
var cbs = buffer;
|
|
1138
|
+
buffer = [];
|
|
1139
|
+
cbs.forEach(cb);
|
|
1140
|
+
}
|
|
1141
|
+
buffer = {
|
|
1142
|
+
push: function(x) {
|
|
1143
|
+
return cb(x);
|
|
1144
|
+
},
|
|
1145
|
+
filter: function() {
|
|
1146
|
+
return buffer;
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
},
|
|
1150
|
+
assignMedium: function(cb) {
|
|
1151
|
+
assigned = true;
|
|
1152
|
+
var pendingQueue = [];
|
|
1153
|
+
if (buffer.length) {
|
|
1154
|
+
var cbs = buffer;
|
|
1155
|
+
buffer = [];
|
|
1156
|
+
cbs.forEach(cb);
|
|
1157
|
+
pendingQueue = buffer;
|
|
1158
|
+
}
|
|
1159
|
+
var executeQueue = function() {
|
|
1160
|
+
var cbs2 = pendingQueue;
|
|
1161
|
+
pendingQueue = [];
|
|
1162
|
+
cbs2.forEach(cb);
|
|
1163
|
+
};
|
|
1164
|
+
var cycle = function() {
|
|
1165
|
+
return Promise.resolve().then(executeQueue);
|
|
1166
|
+
};
|
|
1167
|
+
cycle();
|
|
1168
|
+
buffer = {
|
|
1169
|
+
push: function(x) {
|
|
1170
|
+
pendingQueue.push(x);
|
|
1171
|
+
cycle();
|
|
1172
|
+
},
|
|
1173
|
+
filter: function(filter) {
|
|
1174
|
+
pendingQueue = pendingQueue.filter(filter);
|
|
1175
|
+
return buffer;
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
return medium;
|
|
1181
|
+
}
|
|
1182
|
+
function createSidecarMedium(options) {
|
|
1183
|
+
if (options === void 0) {
|
|
1184
|
+
options = {};
|
|
1185
|
+
}
|
|
1186
|
+
var medium = innerCreateMedium(null);
|
|
1187
|
+
medium.options = __assign({ async: true, ssr: false }, options);
|
|
1188
|
+
return medium;
|
|
1189
|
+
}
|
|
1190
|
+
var SideCar$1 = function(_a) {
|
|
1191
|
+
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
1192
|
+
if (!sideCar) {
|
|
1193
|
+
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
1194
|
+
}
|
|
1195
|
+
var Target = sideCar.read();
|
|
1196
|
+
if (!Target) {
|
|
1197
|
+
throw new Error("Sidecar medium not found");
|
|
1198
|
+
}
|
|
1199
|
+
return reactExports.createElement(Target, __assign({}, rest));
|
|
1200
|
+
};
|
|
1201
|
+
SideCar$1.isSideCarExport = true;
|
|
1202
|
+
function exportSidecar(medium, exported) {
|
|
1203
|
+
medium.useMedium(exported);
|
|
1204
|
+
return SideCar$1;
|
|
1205
|
+
}
|
|
1206
|
+
var effectCar = createSidecarMedium();
|
|
1207
|
+
var nothing = function() {
|
|
1208
|
+
return;
|
|
1209
|
+
};
|
|
1210
|
+
var RemoveScroll = reactExports.forwardRef(function(props, parentRef) {
|
|
1211
|
+
var ref = reactExports.useRef(null);
|
|
1212
|
+
var _a = reactExports.useState({
|
|
1213
|
+
onScrollCapture: nothing,
|
|
1214
|
+
onWheelCapture: nothing,
|
|
1215
|
+
onTouchMoveCapture: nothing
|
|
1216
|
+
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
1217
|
+
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
1218
|
+
var SideCar2 = sideCar;
|
|
1219
|
+
var containerRef = useMergeRefs([ref, parentRef]);
|
|
1220
|
+
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
1221
|
+
return reactExports.createElement(
|
|
1222
|
+
reactExports.Fragment,
|
|
1223
|
+
null,
|
|
1224
|
+
enabled && reactExports.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
1225
|
+
forwardProps ? reactExports.cloneElement(reactExports.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : reactExports.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
1226
|
+
);
|
|
1227
|
+
});
|
|
1228
|
+
RemoveScroll.defaultProps = {
|
|
1229
|
+
enabled: true,
|
|
1230
|
+
removeScrollBar: true,
|
|
1231
|
+
inert: false
|
|
1232
|
+
};
|
|
1233
|
+
RemoveScroll.classNames = {
|
|
1234
|
+
fullWidth: fullWidthClassName,
|
|
1235
|
+
zeroRight: zeroRightClassName
|
|
1236
|
+
};
|
|
1237
|
+
var getNonce = function() {
|
|
1238
|
+
if (typeof __webpack_nonce__ !== "undefined") {
|
|
1239
|
+
return __webpack_nonce__;
|
|
1240
|
+
}
|
|
1241
|
+
return void 0;
|
|
1242
|
+
};
|
|
1243
|
+
function makeStyleTag() {
|
|
1244
|
+
if (!document)
|
|
1245
|
+
return null;
|
|
1246
|
+
var tag = document.createElement("style");
|
|
1247
|
+
tag.type = "text/css";
|
|
1248
|
+
var nonce = getNonce();
|
|
1249
|
+
if (nonce) {
|
|
1250
|
+
tag.setAttribute("nonce", nonce);
|
|
1251
|
+
}
|
|
1252
|
+
return tag;
|
|
1253
|
+
}
|
|
1254
|
+
function injectStyles(tag, css) {
|
|
1255
|
+
if (tag.styleSheet) {
|
|
1256
|
+
tag.styleSheet.cssText = css;
|
|
1257
|
+
} else {
|
|
1258
|
+
tag.appendChild(document.createTextNode(css));
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
function insertStyleTag(tag) {
|
|
1262
|
+
var head = document.head || document.getElementsByTagName("head")[0];
|
|
1263
|
+
head.appendChild(tag);
|
|
1264
|
+
}
|
|
1265
|
+
var stylesheetSingleton = function() {
|
|
1266
|
+
var counter = 0;
|
|
1267
|
+
var stylesheet = null;
|
|
1268
|
+
return {
|
|
1269
|
+
add: function(style) {
|
|
1270
|
+
if (counter == 0) {
|
|
1271
|
+
if (stylesheet = makeStyleTag()) {
|
|
1272
|
+
injectStyles(stylesheet, style);
|
|
1273
|
+
insertStyleTag(stylesheet);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
counter++;
|
|
1277
|
+
},
|
|
1278
|
+
remove: function() {
|
|
1279
|
+
counter--;
|
|
1280
|
+
if (!counter && stylesheet) {
|
|
1281
|
+
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
1282
|
+
stylesheet = null;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
};
|
|
1286
|
+
};
|
|
1287
|
+
var styleHookSingleton = function() {
|
|
1288
|
+
var sheet = stylesheetSingleton();
|
|
1289
|
+
return function(styles, isDynamic) {
|
|
1290
|
+
reactExports.useEffect(function() {
|
|
1291
|
+
sheet.add(styles);
|
|
1292
|
+
return function() {
|
|
1293
|
+
sheet.remove();
|
|
1294
|
+
};
|
|
1295
|
+
}, [styles && isDynamic]);
|
|
1296
|
+
};
|
|
1297
|
+
};
|
|
1298
|
+
var styleSingleton = function() {
|
|
1299
|
+
var useStyle = styleHookSingleton();
|
|
1300
|
+
var Sheet = function(_a) {
|
|
1301
|
+
var styles = _a.styles, dynamic = _a.dynamic;
|
|
1302
|
+
useStyle(styles, dynamic);
|
|
1303
|
+
return null;
|
|
1304
|
+
};
|
|
1305
|
+
return Sheet;
|
|
1306
|
+
};
|
|
1307
|
+
var zeroGap = {
|
|
1308
|
+
left: 0,
|
|
1309
|
+
top: 0,
|
|
1310
|
+
right: 0,
|
|
1311
|
+
gap: 0
|
|
1312
|
+
};
|
|
1313
|
+
var parse = function(x) {
|
|
1314
|
+
return parseInt(x || "", 10) || 0;
|
|
1315
|
+
};
|
|
1316
|
+
var getOffset = function(gapMode) {
|
|
1317
|
+
var cs = window.getComputedStyle(document.body);
|
|
1318
|
+
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
1319
|
+
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
1320
|
+
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
1321
|
+
return [parse(left), parse(top), parse(right)];
|
|
1322
|
+
};
|
|
1323
|
+
var getGapWidth = function(gapMode) {
|
|
1324
|
+
if (gapMode === void 0) {
|
|
1325
|
+
gapMode = "margin";
|
|
1326
|
+
}
|
|
1327
|
+
if (typeof window === "undefined") {
|
|
1328
|
+
return zeroGap;
|
|
1329
|
+
}
|
|
1330
|
+
var offsets = getOffset(gapMode);
|
|
1331
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
1332
|
+
var windowWidth = window.innerWidth;
|
|
1333
|
+
return {
|
|
1334
|
+
left: offsets[0],
|
|
1335
|
+
top: offsets[1],
|
|
1336
|
+
right: offsets[2],
|
|
1337
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
1338
|
+
};
|
|
1339
|
+
};
|
|
1340
|
+
var Style = styleSingleton();
|
|
1341
|
+
var lockAttribute = "data-scroll-locked";
|
|
1342
|
+
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
1343
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
1344
|
+
if (gapMode === void 0) {
|
|
1345
|
+
gapMode = "margin";
|
|
1346
|
+
}
|
|
1347
|
+
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
1348
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
1349
|
+
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
1350
|
+
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
1351
|
+
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
1352
|
+
};
|
|
1353
|
+
var getCurrentUseCounter = function() {
|
|
1354
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
1355
|
+
return isFinite(counter) ? counter : 0;
|
|
1356
|
+
};
|
|
1357
|
+
var useLockAttribute = function() {
|
|
1358
|
+
reactExports.useEffect(function() {
|
|
1359
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
1360
|
+
return function() {
|
|
1361
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
1362
|
+
if (newCounter <= 0) {
|
|
1363
|
+
document.body.removeAttribute(lockAttribute);
|
|
1364
|
+
} else {
|
|
1365
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
}, []);
|
|
1369
|
+
};
|
|
1370
|
+
var RemoveScrollBar = function(_a) {
|
|
1371
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
1372
|
+
useLockAttribute();
|
|
1373
|
+
var gap = reactExports.useMemo(function() {
|
|
1374
|
+
return getGapWidth(gapMode);
|
|
1375
|
+
}, [gapMode]);
|
|
1376
|
+
return reactExports.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
1377
|
+
};
|
|
1378
|
+
var passiveSupported = false;
|
|
1379
|
+
if (typeof window !== "undefined") {
|
|
1380
|
+
try {
|
|
1381
|
+
var options = Object.defineProperty({}, "passive", {
|
|
1382
|
+
get: function() {
|
|
1383
|
+
passiveSupported = true;
|
|
1384
|
+
return true;
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
window.addEventListener("test", options, options);
|
|
1388
|
+
window.removeEventListener("test", options, options);
|
|
1389
|
+
} catch (err) {
|
|
1390
|
+
passiveSupported = false;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
1394
|
+
var alwaysContainsScroll = function(node) {
|
|
1395
|
+
return node.tagName === "TEXTAREA";
|
|
1396
|
+
};
|
|
1397
|
+
var elementCanBeScrolled = function(node, overflow) {
|
|
1398
|
+
if (!(node instanceof Element)) {
|
|
1399
|
+
return false;
|
|
1400
|
+
}
|
|
1401
|
+
var styles = window.getComputedStyle(node);
|
|
1402
|
+
return (
|
|
1403
|
+
// not-not-scrollable
|
|
1404
|
+
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
1405
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
1406
|
+
);
|
|
1407
|
+
};
|
|
1408
|
+
var elementCouldBeVScrolled = function(node) {
|
|
1409
|
+
return elementCanBeScrolled(node, "overflowY");
|
|
1410
|
+
};
|
|
1411
|
+
var elementCouldBeHScrolled = function(node) {
|
|
1412
|
+
return elementCanBeScrolled(node, "overflowX");
|
|
1413
|
+
};
|
|
1414
|
+
var locationCouldBeScrolled = function(axis, node) {
|
|
1415
|
+
var ownerDocument = node.ownerDocument;
|
|
1416
|
+
var current = node;
|
|
1417
|
+
do {
|
|
1418
|
+
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
1419
|
+
current = current.host;
|
|
1420
|
+
}
|
|
1421
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
1422
|
+
if (isScrollable) {
|
|
1423
|
+
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
1424
|
+
if (scrollHeight > clientHeight) {
|
|
1425
|
+
return true;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
current = current.parentNode;
|
|
1429
|
+
} while (current && current !== ownerDocument.body);
|
|
1430
|
+
return false;
|
|
1431
|
+
};
|
|
1432
|
+
var getVScrollVariables = function(_a) {
|
|
1433
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
1434
|
+
return [
|
|
1435
|
+
scrollTop,
|
|
1436
|
+
scrollHeight,
|
|
1437
|
+
clientHeight
|
|
1438
|
+
];
|
|
1439
|
+
};
|
|
1440
|
+
var getHScrollVariables = function(_a) {
|
|
1441
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
1442
|
+
return [
|
|
1443
|
+
scrollLeft,
|
|
1444
|
+
scrollWidth,
|
|
1445
|
+
clientWidth
|
|
1446
|
+
];
|
|
1447
|
+
};
|
|
1448
|
+
var elementCouldBeScrolled = function(axis, node) {
|
|
1449
|
+
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
1450
|
+
};
|
|
1451
|
+
var getScrollVariables = function(axis, node) {
|
|
1452
|
+
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
1453
|
+
};
|
|
1454
|
+
var getDirectionFactor = function(axis, direction) {
|
|
1455
|
+
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
1456
|
+
};
|
|
1457
|
+
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
1458
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
1459
|
+
var delta = directionFactor * sourceDelta;
|
|
1460
|
+
var target = event.target;
|
|
1461
|
+
var targetInLock = endTarget.contains(target);
|
|
1462
|
+
var shouldCancelScroll = false;
|
|
1463
|
+
var isDeltaPositive = delta > 0;
|
|
1464
|
+
var availableScroll = 0;
|
|
1465
|
+
var availableScrollTop = 0;
|
|
1466
|
+
do {
|
|
1467
|
+
if (!target) {
|
|
1468
|
+
break;
|
|
1469
|
+
}
|
|
1470
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
1471
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
1472
|
+
if (position || elementScroll) {
|
|
1473
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
1474
|
+
availableScroll += elementScroll;
|
|
1475
|
+
availableScrollTop += position;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
var parent_1 = target.parentNode;
|
|
1479
|
+
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
1480
|
+
} while (
|
|
1481
|
+
// portaled content
|
|
1482
|
+
!targetInLock && target !== document.body || // self content
|
|
1483
|
+
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
1484
|
+
);
|
|
1485
|
+
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
1486
|
+
shouldCancelScroll = true;
|
|
1487
|
+
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
1488
|
+
shouldCancelScroll = true;
|
|
1489
|
+
}
|
|
1490
|
+
return shouldCancelScroll;
|
|
1491
|
+
};
|
|
1492
|
+
var getTouchXY = function(event) {
|
|
1493
|
+
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
1494
|
+
};
|
|
1495
|
+
var getDeltaXY = function(event) {
|
|
1496
|
+
return [event.deltaX, event.deltaY];
|
|
1497
|
+
};
|
|
1498
|
+
var extractRef = function(ref) {
|
|
1499
|
+
return ref && "current" in ref ? ref.current : ref;
|
|
1500
|
+
};
|
|
1501
|
+
var deltaCompare = function(x, y) {
|
|
1502
|
+
return x[0] === y[0] && x[1] === y[1];
|
|
1503
|
+
};
|
|
1504
|
+
var generateStyle = function(id) {
|
|
1505
|
+
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
1506
|
+
};
|
|
1507
|
+
var idCounter = 0;
|
|
1508
|
+
var lockStack = [];
|
|
1509
|
+
function RemoveScrollSideCar(props) {
|
|
1510
|
+
var shouldPreventQueue = reactExports.useRef([]);
|
|
1511
|
+
var touchStartRef = reactExports.useRef([0, 0]);
|
|
1512
|
+
var activeAxis = reactExports.useRef();
|
|
1513
|
+
var id = reactExports.useState(idCounter++)[0];
|
|
1514
|
+
var Style2 = reactExports.useState(styleSingleton)[0];
|
|
1515
|
+
var lastProps = reactExports.useRef(props);
|
|
1516
|
+
reactExports.useEffect(function() {
|
|
1517
|
+
lastProps.current = props;
|
|
1518
|
+
}, [props]);
|
|
1519
|
+
reactExports.useEffect(function() {
|
|
1520
|
+
if (props.inert) {
|
|
1521
|
+
document.body.classList.add("block-interactivity-".concat(id));
|
|
1522
|
+
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
1523
|
+
allow_1.forEach(function(el) {
|
|
1524
|
+
return el.classList.add("allow-interactivity-".concat(id));
|
|
1525
|
+
});
|
|
1526
|
+
return function() {
|
|
1527
|
+
document.body.classList.remove("block-interactivity-".concat(id));
|
|
1528
|
+
allow_1.forEach(function(el) {
|
|
1529
|
+
return el.classList.remove("allow-interactivity-".concat(id));
|
|
1530
|
+
});
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
return;
|
|
1534
|
+
}, [props.inert, props.lockRef.current, props.shards]);
|
|
1535
|
+
var shouldCancelEvent = reactExports.useCallback(function(event, parent) {
|
|
1536
|
+
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
1537
|
+
return !lastProps.current.allowPinchZoom;
|
|
1538
|
+
}
|
|
1539
|
+
var touch = getTouchXY(event);
|
|
1540
|
+
var touchStart = touchStartRef.current;
|
|
1541
|
+
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
1542
|
+
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
1543
|
+
var currentAxis;
|
|
1544
|
+
var target = event.target;
|
|
1545
|
+
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
1546
|
+
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
1547
|
+
return false;
|
|
1548
|
+
}
|
|
1549
|
+
var selection = window.getSelection();
|
|
1550
|
+
var anchorNode = selection && selection.anchorNode;
|
|
1551
|
+
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
1552
|
+
if (isTouchingSelection) {
|
|
1553
|
+
return false;
|
|
1554
|
+
}
|
|
1555
|
+
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1556
|
+
if (!canBeScrolledInMainDirection) {
|
|
1557
|
+
return true;
|
|
1558
|
+
}
|
|
1559
|
+
if (canBeScrolledInMainDirection) {
|
|
1560
|
+
currentAxis = moveDirection;
|
|
1561
|
+
} else {
|
|
1562
|
+
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
1563
|
+
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1564
|
+
}
|
|
1565
|
+
if (!canBeScrolledInMainDirection) {
|
|
1566
|
+
return false;
|
|
1567
|
+
}
|
|
1568
|
+
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
1569
|
+
activeAxis.current = currentAxis;
|
|
1570
|
+
}
|
|
1571
|
+
if (!currentAxis) {
|
|
1572
|
+
return true;
|
|
1573
|
+
}
|
|
1574
|
+
var cancelingAxis = activeAxis.current || currentAxis;
|
|
1575
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
1576
|
+
}, []);
|
|
1577
|
+
var shouldPrevent = reactExports.useCallback(function(_event) {
|
|
1578
|
+
var event = _event;
|
|
1579
|
+
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
1580
|
+
return;
|
|
1581
|
+
}
|
|
1582
|
+
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
1583
|
+
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
1584
|
+
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
1585
|
+
})[0];
|
|
1586
|
+
if (sourceEvent && sourceEvent.should) {
|
|
1587
|
+
if (event.cancelable) {
|
|
1588
|
+
event.preventDefault();
|
|
1589
|
+
}
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
if (!sourceEvent) {
|
|
1593
|
+
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
1594
|
+
return node.contains(event.target);
|
|
1595
|
+
});
|
|
1596
|
+
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
1597
|
+
if (shouldStop) {
|
|
1598
|
+
if (event.cancelable) {
|
|
1599
|
+
event.preventDefault();
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
}, []);
|
|
1604
|
+
var shouldCancel = reactExports.useCallback(function(name, delta, target, should) {
|
|
1605
|
+
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
1606
|
+
shouldPreventQueue.current.push(event);
|
|
1607
|
+
setTimeout(function() {
|
|
1608
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
1609
|
+
return e !== event;
|
|
1610
|
+
});
|
|
1611
|
+
}, 1);
|
|
1612
|
+
}, []);
|
|
1613
|
+
var scrollTouchStart = reactExports.useCallback(function(event) {
|
|
1614
|
+
touchStartRef.current = getTouchXY(event);
|
|
1615
|
+
activeAxis.current = void 0;
|
|
1616
|
+
}, []);
|
|
1617
|
+
var scrollWheel = reactExports.useCallback(function(event) {
|
|
1618
|
+
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1619
|
+
}, []);
|
|
1620
|
+
var scrollTouchMove = reactExports.useCallback(function(event) {
|
|
1621
|
+
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1622
|
+
}, []);
|
|
1623
|
+
reactExports.useEffect(function() {
|
|
1624
|
+
lockStack.push(Style2);
|
|
1625
|
+
props.setCallbacks({
|
|
1626
|
+
onScrollCapture: scrollWheel,
|
|
1627
|
+
onWheelCapture: scrollWheel,
|
|
1628
|
+
onTouchMoveCapture: scrollTouchMove
|
|
1629
|
+
});
|
|
1630
|
+
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
1631
|
+
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1632
|
+
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1633
|
+
return function() {
|
|
1634
|
+
lockStack = lockStack.filter(function(inst) {
|
|
1635
|
+
return inst !== Style2;
|
|
1636
|
+
});
|
|
1637
|
+
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
1638
|
+
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1639
|
+
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1640
|
+
};
|
|
1641
|
+
}, []);
|
|
1642
|
+
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
1643
|
+
return reactExports.createElement(
|
|
1644
|
+
reactExports.Fragment,
|
|
1645
|
+
null,
|
|
1646
|
+
inert ? reactExports.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
1647
|
+
removeScrollBar ? reactExports.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
1648
|
+
);
|
|
1649
|
+
}
|
|
1650
|
+
function getOutermostShadowParent(node) {
|
|
1651
|
+
var shadowParent = null;
|
|
1652
|
+
while (node !== null) {
|
|
1653
|
+
if (node instanceof ShadowRoot) {
|
|
1654
|
+
shadowParent = node.host;
|
|
1655
|
+
node = node.host;
|
|
1656
|
+
}
|
|
1657
|
+
node = node.parentNode;
|
|
1658
|
+
}
|
|
1659
|
+
return shadowParent;
|
|
1660
|
+
}
|
|
1661
|
+
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
1662
|
+
var ReactRemoveScroll = reactExports.forwardRef(function(props, ref) {
|
|
1663
|
+
return reactExports.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
1664
|
+
});
|
|
1665
|
+
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
1666
|
+
var getDefaultParent = function(originalTarget) {
|
|
1667
|
+
if (typeof document === "undefined") {
|
|
1668
|
+
return null;
|
|
1669
|
+
}
|
|
1670
|
+
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
1671
|
+
return sampleTarget.ownerDocument.body;
|
|
1672
|
+
};
|
|
1673
|
+
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
1674
|
+
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1675
|
+
var markerMap = {};
|
|
1676
|
+
var lockCount = 0;
|
|
1677
|
+
var unwrapHost = function(node) {
|
|
1678
|
+
return node && (node.host || unwrapHost(node.parentNode));
|
|
1679
|
+
};
|
|
1680
|
+
var correctTargets = function(parent, targets) {
|
|
1681
|
+
return targets.map(function(target) {
|
|
1682
|
+
if (parent.contains(target)) {
|
|
1683
|
+
return target;
|
|
1684
|
+
}
|
|
1685
|
+
var correctedTarget = unwrapHost(target);
|
|
1686
|
+
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
1687
|
+
return correctedTarget;
|
|
1688
|
+
}
|
|
1689
|
+
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
1690
|
+
return null;
|
|
1691
|
+
}).filter(function(x) {
|
|
1692
|
+
return Boolean(x);
|
|
1693
|
+
});
|
|
1694
|
+
};
|
|
1695
|
+
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
1696
|
+
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1697
|
+
if (!markerMap[markerName]) {
|
|
1698
|
+
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
1699
|
+
}
|
|
1700
|
+
var markerCounter = markerMap[markerName];
|
|
1701
|
+
var hiddenNodes = [];
|
|
1702
|
+
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
1703
|
+
var elementsToStop = new Set(targets);
|
|
1704
|
+
var keep = function(el) {
|
|
1705
|
+
if (!el || elementsToKeep.has(el)) {
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
elementsToKeep.add(el);
|
|
1709
|
+
keep(el.parentNode);
|
|
1710
|
+
};
|
|
1711
|
+
targets.forEach(keep);
|
|
1712
|
+
var deep = function(parent) {
|
|
1713
|
+
if (!parent || elementsToStop.has(parent)) {
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
Array.prototype.forEach.call(parent.children, function(node) {
|
|
1717
|
+
if (elementsToKeep.has(node)) {
|
|
1718
|
+
deep(node);
|
|
1719
|
+
} else {
|
|
1720
|
+
try {
|
|
1721
|
+
var attr = node.getAttribute(controlAttribute);
|
|
1722
|
+
var alreadyHidden = attr !== null && attr !== "false";
|
|
1723
|
+
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
1724
|
+
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
1725
|
+
counterMap.set(node, counterValue);
|
|
1726
|
+
markerCounter.set(node, markerValue);
|
|
1727
|
+
hiddenNodes.push(node);
|
|
1728
|
+
if (counterValue === 1 && alreadyHidden) {
|
|
1729
|
+
uncontrolledNodes.set(node, true);
|
|
1730
|
+
}
|
|
1731
|
+
if (markerValue === 1) {
|
|
1732
|
+
node.setAttribute(markerName, "true");
|
|
1733
|
+
}
|
|
1734
|
+
if (!alreadyHidden) {
|
|
1735
|
+
node.setAttribute(controlAttribute, "true");
|
|
1736
|
+
}
|
|
1737
|
+
} catch (e) {
|
|
1738
|
+
console.error("aria-hidden: cannot operate on ", node, e);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
};
|
|
1743
|
+
deep(parentNode);
|
|
1744
|
+
elementsToKeep.clear();
|
|
1745
|
+
lockCount++;
|
|
1746
|
+
return function() {
|
|
1747
|
+
hiddenNodes.forEach(function(node) {
|
|
1748
|
+
var counterValue = counterMap.get(node) - 1;
|
|
1749
|
+
var markerValue = markerCounter.get(node) - 1;
|
|
1750
|
+
counterMap.set(node, counterValue);
|
|
1751
|
+
markerCounter.set(node, markerValue);
|
|
1752
|
+
if (!counterValue) {
|
|
1753
|
+
if (!uncontrolledNodes.has(node)) {
|
|
1754
|
+
node.removeAttribute(controlAttribute);
|
|
1755
|
+
}
|
|
1756
|
+
uncontrolledNodes.delete(node);
|
|
1757
|
+
}
|
|
1758
|
+
if (!markerValue) {
|
|
1759
|
+
node.removeAttribute(markerName);
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
lockCount--;
|
|
1763
|
+
if (!lockCount) {
|
|
1764
|
+
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1765
|
+
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1766
|
+
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1767
|
+
markerMap = {};
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1770
|
+
};
|
|
1771
|
+
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
1772
|
+
if (markerName === void 0) {
|
|
1773
|
+
markerName = "data-aria-hidden";
|
|
1774
|
+
}
|
|
1775
|
+
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1776
|
+
var activeParentNode = getDefaultParent(originalTarget);
|
|
1777
|
+
if (!activeParentNode) {
|
|
1778
|
+
return function() {
|
|
1779
|
+
return null;
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
1783
|
+
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
1784
|
+
};
|
|
1785
|
+
function useSize(element) {
|
|
1786
|
+
const [size2, setSize] = reactExports.useState(void 0);
|
|
1787
|
+
useLayoutEffect2(() => {
|
|
1788
|
+
if (element) {
|
|
1789
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
1790
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
1791
|
+
if (!Array.isArray(entries)) {
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
if (!entries.length) {
|
|
1795
|
+
return;
|
|
1796
|
+
}
|
|
1797
|
+
const entry = entries[0];
|
|
1798
|
+
let width;
|
|
1799
|
+
let height;
|
|
1800
|
+
if ("borderBoxSize" in entry) {
|
|
1801
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
1802
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
1803
|
+
width = borderSize["inlineSize"];
|
|
1804
|
+
height = borderSize["blockSize"];
|
|
1805
|
+
} else {
|
|
1806
|
+
width = element.offsetWidth;
|
|
1807
|
+
height = element.offsetHeight;
|
|
1808
|
+
}
|
|
1809
|
+
setSize({ width, height });
|
|
1810
|
+
});
|
|
1811
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
1812
|
+
return () => resizeObserver.unobserve(element);
|
|
1813
|
+
} else {
|
|
1814
|
+
setSize(void 0);
|
|
1815
|
+
}
|
|
1816
|
+
}, [element]);
|
|
1817
|
+
return size2;
|
|
1818
|
+
}
|
|
1819
|
+
const sides = ["top", "right", "bottom", "left"];
|
|
1820
|
+
const min = Math.min;
|
|
1821
|
+
const max = Math.max;
|
|
1822
|
+
const round = Math.round;
|
|
1823
|
+
const floor = Math.floor;
|
|
1824
|
+
const createCoords = (v) => ({
|
|
1825
|
+
x: v,
|
|
1826
|
+
y: v
|
|
1827
|
+
});
|
|
1828
|
+
const oppositeSideMap = {
|
|
1829
|
+
left: "right",
|
|
1830
|
+
right: "left",
|
|
1831
|
+
bottom: "top",
|
|
1832
|
+
top: "bottom"
|
|
1833
|
+
};
|
|
1834
|
+
const oppositeAlignmentMap = {
|
|
1835
|
+
start: "end",
|
|
1836
|
+
end: "start"
|
|
1837
|
+
};
|
|
1838
|
+
function clamp(start, value, end) {
|
|
1839
|
+
return max(start, min(value, end));
|
|
1840
|
+
}
|
|
1841
|
+
function evaluate(value, param) {
|
|
1842
|
+
return typeof value === "function" ? value(param) : value;
|
|
1843
|
+
}
|
|
1844
|
+
function getSide(placement) {
|
|
1845
|
+
return placement.split("-")[0];
|
|
1846
|
+
}
|
|
1847
|
+
function getAlignment(placement) {
|
|
1848
|
+
return placement.split("-")[1];
|
|
1849
|
+
}
|
|
1850
|
+
function getOppositeAxis(axis) {
|
|
1851
|
+
return axis === "x" ? "y" : "x";
|
|
1852
|
+
}
|
|
1853
|
+
function getAxisLength(axis) {
|
|
1854
|
+
return axis === "y" ? "height" : "width";
|
|
1855
|
+
}
|
|
1856
|
+
const yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
1857
|
+
function getSideAxis(placement) {
|
|
1858
|
+
return yAxisSides.has(getSide(placement)) ? "y" : "x";
|
|
1859
|
+
}
|
|
1860
|
+
function getAlignmentAxis(placement) {
|
|
1861
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
1862
|
+
}
|
|
1863
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
1864
|
+
if (rtl === void 0) {
|
|
1865
|
+
rtl = false;
|
|
1866
|
+
}
|
|
1867
|
+
const alignment = getAlignment(placement);
|
|
1868
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1869
|
+
const length = getAxisLength(alignmentAxis);
|
|
1870
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
1871
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
1872
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
1873
|
+
}
|
|
1874
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
1875
|
+
}
|
|
1876
|
+
function getExpandedPlacements(placement) {
|
|
1877
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
1878
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
1879
|
+
}
|
|
1880
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
1881
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
1882
|
+
}
|
|
1883
|
+
const lrPlacement = ["left", "right"];
|
|
1884
|
+
const rlPlacement = ["right", "left"];
|
|
1885
|
+
const tbPlacement = ["top", "bottom"];
|
|
1886
|
+
const btPlacement = ["bottom", "top"];
|
|
1887
|
+
function getSideList(side, isStart, rtl) {
|
|
1888
|
+
switch (side) {
|
|
1889
|
+
case "top":
|
|
1890
|
+
case "bottom":
|
|
1891
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
1892
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
1893
|
+
case "left":
|
|
1894
|
+
case "right":
|
|
1895
|
+
return isStart ? tbPlacement : btPlacement;
|
|
1896
|
+
default:
|
|
1897
|
+
return [];
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
1901
|
+
const alignment = getAlignment(placement);
|
|
1902
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
1903
|
+
if (alignment) {
|
|
1904
|
+
list = list.map((side) => side + "-" + alignment);
|
|
1905
|
+
if (flipAlignment) {
|
|
1906
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
return list;
|
|
1910
|
+
}
|
|
1911
|
+
function getOppositePlacement(placement) {
|
|
1912
|
+
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
1913
|
+
}
|
|
1914
|
+
function expandPaddingObject(padding) {
|
|
1915
|
+
return {
|
|
1916
|
+
top: 0,
|
|
1917
|
+
right: 0,
|
|
1918
|
+
bottom: 0,
|
|
1919
|
+
left: 0,
|
|
1920
|
+
...padding
|
|
1921
|
+
};
|
|
1922
|
+
}
|
|
1923
|
+
function getPaddingObject(padding) {
|
|
1924
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
1925
|
+
top: padding,
|
|
1926
|
+
right: padding,
|
|
1927
|
+
bottom: padding,
|
|
1928
|
+
left: padding
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
function rectToClientRect(rect) {
|
|
1932
|
+
const {
|
|
1933
|
+
x,
|
|
1934
|
+
y,
|
|
1935
|
+
width,
|
|
1936
|
+
height
|
|
1937
|
+
} = rect;
|
|
1938
|
+
return {
|
|
1939
|
+
width,
|
|
1940
|
+
height,
|
|
1941
|
+
top: y,
|
|
1942
|
+
left: x,
|
|
1943
|
+
right: x + width,
|
|
1944
|
+
bottom: y + height,
|
|
1945
|
+
x,
|
|
1946
|
+
y
|
|
1947
|
+
};
|
|
1948
|
+
}
|
|
1949
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
1950
|
+
let {
|
|
1951
|
+
reference,
|
|
1952
|
+
floating
|
|
1953
|
+
} = _ref;
|
|
1954
|
+
const sideAxis = getSideAxis(placement);
|
|
1955
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1956
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
1957
|
+
const side = getSide(placement);
|
|
1958
|
+
const isVertical = sideAxis === "y";
|
|
1959
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
1960
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
1961
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
1962
|
+
let coords;
|
|
1963
|
+
switch (side) {
|
|
1964
|
+
case "top":
|
|
1965
|
+
coords = {
|
|
1966
|
+
x: commonX,
|
|
1967
|
+
y: reference.y - floating.height
|
|
1968
|
+
};
|
|
1969
|
+
break;
|
|
1970
|
+
case "bottom":
|
|
1971
|
+
coords = {
|
|
1972
|
+
x: commonX,
|
|
1973
|
+
y: reference.y + reference.height
|
|
1974
|
+
};
|
|
1975
|
+
break;
|
|
1976
|
+
case "right":
|
|
1977
|
+
coords = {
|
|
1978
|
+
x: reference.x + reference.width,
|
|
1979
|
+
y: commonY
|
|
1980
|
+
};
|
|
1981
|
+
break;
|
|
1982
|
+
case "left":
|
|
1983
|
+
coords = {
|
|
1984
|
+
x: reference.x - floating.width,
|
|
1985
|
+
y: commonY
|
|
1986
|
+
};
|
|
1987
|
+
break;
|
|
1988
|
+
default:
|
|
1989
|
+
coords = {
|
|
1990
|
+
x: reference.x,
|
|
1991
|
+
y: reference.y
|
|
1992
|
+
};
|
|
1993
|
+
}
|
|
1994
|
+
switch (getAlignment(placement)) {
|
|
1995
|
+
case "start":
|
|
1996
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1997
|
+
break;
|
|
1998
|
+
case "end":
|
|
1999
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
2000
|
+
break;
|
|
2001
|
+
}
|
|
2002
|
+
return coords;
|
|
2003
|
+
}
|
|
2004
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
2005
|
+
const {
|
|
2006
|
+
placement = "bottom",
|
|
2007
|
+
strategy = "absolute",
|
|
2008
|
+
middleware = [],
|
|
2009
|
+
platform: platform2
|
|
2010
|
+
} = config;
|
|
2011
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
2012
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
2013
|
+
let rects = await platform2.getElementRects({
|
|
2014
|
+
reference,
|
|
2015
|
+
floating,
|
|
2016
|
+
strategy
|
|
2017
|
+
});
|
|
2018
|
+
let {
|
|
2019
|
+
x,
|
|
2020
|
+
y
|
|
2021
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
2022
|
+
let statefulPlacement = placement;
|
|
2023
|
+
let middlewareData = {};
|
|
2024
|
+
let resetCount = 0;
|
|
2025
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
2026
|
+
const {
|
|
2027
|
+
name,
|
|
2028
|
+
fn
|
|
2029
|
+
} = validMiddleware[i];
|
|
2030
|
+
const {
|
|
2031
|
+
x: nextX,
|
|
2032
|
+
y: nextY,
|
|
2033
|
+
data,
|
|
2034
|
+
reset
|
|
2035
|
+
} = await fn({
|
|
2036
|
+
x,
|
|
2037
|
+
y,
|
|
2038
|
+
initialPlacement: placement,
|
|
2039
|
+
placement: statefulPlacement,
|
|
2040
|
+
strategy,
|
|
2041
|
+
middlewareData,
|
|
2042
|
+
rects,
|
|
2043
|
+
platform: platform2,
|
|
2044
|
+
elements: {
|
|
2045
|
+
reference,
|
|
2046
|
+
floating
|
|
2047
|
+
}
|
|
2048
|
+
});
|
|
2049
|
+
x = nextX != null ? nextX : x;
|
|
2050
|
+
y = nextY != null ? nextY : y;
|
|
2051
|
+
middlewareData = {
|
|
2052
|
+
...middlewareData,
|
|
2053
|
+
[name]: {
|
|
2054
|
+
...middlewareData[name],
|
|
2055
|
+
...data
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
if (reset && resetCount <= 50) {
|
|
2059
|
+
resetCount++;
|
|
2060
|
+
if (typeof reset === "object") {
|
|
2061
|
+
if (reset.placement) {
|
|
2062
|
+
statefulPlacement = reset.placement;
|
|
2063
|
+
}
|
|
2064
|
+
if (reset.rects) {
|
|
2065
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
2066
|
+
reference,
|
|
2067
|
+
floating,
|
|
2068
|
+
strategy
|
|
2069
|
+
}) : reset.rects;
|
|
2070
|
+
}
|
|
2071
|
+
({
|
|
2072
|
+
x,
|
|
2073
|
+
y
|
|
2074
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
2075
|
+
}
|
|
2076
|
+
i = -1;
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
return {
|
|
2080
|
+
x,
|
|
2081
|
+
y,
|
|
2082
|
+
placement: statefulPlacement,
|
|
2083
|
+
strategy,
|
|
2084
|
+
middlewareData
|
|
2085
|
+
};
|
|
2086
|
+
};
|
|
2087
|
+
async function detectOverflow(state, options) {
|
|
2088
|
+
var _await$platform$isEle;
|
|
2089
|
+
if (options === void 0) {
|
|
2090
|
+
options = {};
|
|
2091
|
+
}
|
|
2092
|
+
const {
|
|
2093
|
+
x,
|
|
2094
|
+
y,
|
|
2095
|
+
platform: platform2,
|
|
2096
|
+
rects,
|
|
2097
|
+
elements,
|
|
2098
|
+
strategy
|
|
2099
|
+
} = state;
|
|
2100
|
+
const {
|
|
2101
|
+
boundary = "clippingAncestors",
|
|
2102
|
+
rootBoundary = "viewport",
|
|
2103
|
+
elementContext = "floating",
|
|
2104
|
+
altBoundary = false,
|
|
2105
|
+
padding = 0
|
|
2106
|
+
} = evaluate(options, state);
|
|
2107
|
+
const paddingObject = getPaddingObject(padding);
|
|
2108
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
2109
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
2110
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
2111
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
2112
|
+
boundary,
|
|
2113
|
+
rootBoundary,
|
|
2114
|
+
strategy
|
|
2115
|
+
}));
|
|
2116
|
+
const rect = elementContext === "floating" ? {
|
|
2117
|
+
x,
|
|
2118
|
+
y,
|
|
2119
|
+
width: rects.floating.width,
|
|
2120
|
+
height: rects.floating.height
|
|
2121
|
+
} : rects.reference;
|
|
2122
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
2123
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
2124
|
+
x: 1,
|
|
2125
|
+
y: 1
|
|
2126
|
+
} : {
|
|
2127
|
+
x: 1,
|
|
2128
|
+
y: 1
|
|
2129
|
+
};
|
|
2130
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2131
|
+
elements,
|
|
2132
|
+
rect,
|
|
2133
|
+
offsetParent,
|
|
2134
|
+
strategy
|
|
2135
|
+
}) : rect);
|
|
2136
|
+
return {
|
|
2137
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
2138
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
2139
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
2140
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
const arrow$3 = (options) => ({
|
|
2144
|
+
name: "arrow",
|
|
2145
|
+
options,
|
|
2146
|
+
async fn(state) {
|
|
2147
|
+
const {
|
|
2148
|
+
x,
|
|
2149
|
+
y,
|
|
2150
|
+
placement,
|
|
2151
|
+
rects,
|
|
2152
|
+
platform: platform2,
|
|
2153
|
+
elements,
|
|
2154
|
+
middlewareData
|
|
2155
|
+
} = state;
|
|
2156
|
+
const {
|
|
2157
|
+
element,
|
|
2158
|
+
padding = 0
|
|
2159
|
+
} = evaluate(options, state) || {};
|
|
2160
|
+
if (element == null) {
|
|
2161
|
+
return {};
|
|
2162
|
+
}
|
|
2163
|
+
const paddingObject = getPaddingObject(padding);
|
|
2164
|
+
const coords = {
|
|
2165
|
+
x,
|
|
2166
|
+
y
|
|
2167
|
+
};
|
|
2168
|
+
const axis = getAlignmentAxis(placement);
|
|
2169
|
+
const length = getAxisLength(axis);
|
|
2170
|
+
const arrowDimensions = await platform2.getDimensions(element);
|
|
2171
|
+
const isYAxis = axis === "y";
|
|
2172
|
+
const minProp = isYAxis ? "top" : "left";
|
|
2173
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
2174
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
2175
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
2176
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
2177
|
+
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
2178
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
2179
|
+
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
2180
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
2181
|
+
}
|
|
2182
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
2183
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
2184
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
2185
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
2186
|
+
const min$1 = minPadding;
|
|
2187
|
+
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
2188
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
2189
|
+
const offset2 = clamp(min$1, center, max2);
|
|
2190
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
2191
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
2192
|
+
return {
|
|
2193
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
2194
|
+
data: {
|
|
2195
|
+
[axis]: offset2,
|
|
2196
|
+
centerOffset: center - offset2 - alignmentOffset,
|
|
2197
|
+
...shouldAddOffset && {
|
|
2198
|
+
alignmentOffset
|
|
2199
|
+
}
|
|
2200
|
+
},
|
|
2201
|
+
reset: shouldAddOffset
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2205
|
+
const flip$2 = function(options) {
|
|
2206
|
+
if (options === void 0) {
|
|
2207
|
+
options = {};
|
|
2208
|
+
}
|
|
2209
|
+
return {
|
|
2210
|
+
name: "flip",
|
|
2211
|
+
options,
|
|
2212
|
+
async fn(state) {
|
|
2213
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
2214
|
+
const {
|
|
2215
|
+
placement,
|
|
2216
|
+
middlewareData,
|
|
2217
|
+
rects,
|
|
2218
|
+
initialPlacement,
|
|
2219
|
+
platform: platform2,
|
|
2220
|
+
elements
|
|
2221
|
+
} = state;
|
|
2222
|
+
const {
|
|
2223
|
+
mainAxis: checkMainAxis = true,
|
|
2224
|
+
crossAxis: checkCrossAxis = true,
|
|
2225
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
2226
|
+
fallbackStrategy = "bestFit",
|
|
2227
|
+
fallbackAxisSideDirection = "none",
|
|
2228
|
+
flipAlignment = true,
|
|
2229
|
+
...detectOverflowOptions
|
|
2230
|
+
} = evaluate(options, state);
|
|
2231
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2232
|
+
return {};
|
|
2233
|
+
}
|
|
2234
|
+
const side = getSide(placement);
|
|
2235
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
2236
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
2237
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
2238
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
2239
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
2240
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
2241
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
2242
|
+
}
|
|
2243
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
2244
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2245
|
+
const overflows = [];
|
|
2246
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
2247
|
+
if (checkMainAxis) {
|
|
2248
|
+
overflows.push(overflow[side]);
|
|
2249
|
+
}
|
|
2250
|
+
if (checkCrossAxis) {
|
|
2251
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
2252
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
2253
|
+
}
|
|
2254
|
+
overflowsData = [...overflowsData, {
|
|
2255
|
+
placement,
|
|
2256
|
+
overflows
|
|
2257
|
+
}];
|
|
2258
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
2259
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
2260
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
2261
|
+
const nextPlacement = placements[nextIndex];
|
|
2262
|
+
if (nextPlacement) {
|
|
2263
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
2264
|
+
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
2265
|
+
// overflows the main axis.
|
|
2266
|
+
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
2267
|
+
return {
|
|
2268
|
+
data: {
|
|
2269
|
+
index: nextIndex,
|
|
2270
|
+
overflows: overflowsData
|
|
2271
|
+
},
|
|
2272
|
+
reset: {
|
|
2273
|
+
placement: nextPlacement
|
|
2274
|
+
}
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
2279
|
+
if (!resetPlacement) {
|
|
2280
|
+
switch (fallbackStrategy) {
|
|
2281
|
+
case "bestFit": {
|
|
2282
|
+
var _overflowsData$filter2;
|
|
2283
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
2284
|
+
if (hasFallbackAxisSideDirection) {
|
|
2285
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
2286
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
2287
|
+
// reading directions favoring greater width.
|
|
2288
|
+
currentSideAxis === "y";
|
|
2289
|
+
}
|
|
2290
|
+
return true;
|
|
2291
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
2292
|
+
if (placement2) {
|
|
2293
|
+
resetPlacement = placement2;
|
|
2294
|
+
}
|
|
2295
|
+
break;
|
|
2296
|
+
}
|
|
2297
|
+
case "initialPlacement":
|
|
2298
|
+
resetPlacement = initialPlacement;
|
|
2299
|
+
break;
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
if (placement !== resetPlacement) {
|
|
2303
|
+
return {
|
|
2304
|
+
reset: {
|
|
2305
|
+
placement: resetPlacement
|
|
2306
|
+
}
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
return {};
|
|
2311
|
+
}
|
|
2312
|
+
};
|
|
2313
|
+
};
|
|
2314
|
+
function getSideOffsets(overflow, rect) {
|
|
2315
|
+
return {
|
|
2316
|
+
top: overflow.top - rect.height,
|
|
2317
|
+
right: overflow.right - rect.width,
|
|
2318
|
+
bottom: overflow.bottom - rect.height,
|
|
2319
|
+
left: overflow.left - rect.width
|
|
2320
|
+
};
|
|
2321
|
+
}
|
|
2322
|
+
function isAnySideFullyClipped(overflow) {
|
|
2323
|
+
return sides.some((side) => overflow[side] >= 0);
|
|
2324
|
+
}
|
|
2325
|
+
const hide$2 = function(options) {
|
|
2326
|
+
if (options === void 0) {
|
|
2327
|
+
options = {};
|
|
2328
|
+
}
|
|
2329
|
+
return {
|
|
2330
|
+
name: "hide",
|
|
2331
|
+
options,
|
|
2332
|
+
async fn(state) {
|
|
2333
|
+
const {
|
|
2334
|
+
rects
|
|
2335
|
+
} = state;
|
|
2336
|
+
const {
|
|
2337
|
+
strategy = "referenceHidden",
|
|
2338
|
+
...detectOverflowOptions
|
|
2339
|
+
} = evaluate(options, state);
|
|
2340
|
+
switch (strategy) {
|
|
2341
|
+
case "referenceHidden": {
|
|
2342
|
+
const overflow = await detectOverflow(state, {
|
|
2343
|
+
...detectOverflowOptions,
|
|
2344
|
+
elementContext: "reference"
|
|
2345
|
+
});
|
|
2346
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
2347
|
+
return {
|
|
2348
|
+
data: {
|
|
2349
|
+
referenceHiddenOffsets: offsets,
|
|
2350
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
2351
|
+
}
|
|
2352
|
+
};
|
|
2353
|
+
}
|
|
2354
|
+
case "escaped": {
|
|
2355
|
+
const overflow = await detectOverflow(state, {
|
|
2356
|
+
...detectOverflowOptions,
|
|
2357
|
+
altBoundary: true
|
|
2358
|
+
});
|
|
2359
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
2360
|
+
return {
|
|
2361
|
+
data: {
|
|
2362
|
+
escapedOffsets: offsets,
|
|
2363
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
2364
|
+
}
|
|
2365
|
+
};
|
|
2366
|
+
}
|
|
2367
|
+
default: {
|
|
2368
|
+
return {};
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
};
|
|
2374
|
+
const originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
2375
|
+
async function convertValueToCoords(state, options) {
|
|
2376
|
+
const {
|
|
2377
|
+
placement,
|
|
2378
|
+
platform: platform2,
|
|
2379
|
+
elements
|
|
2380
|
+
} = state;
|
|
2381
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
2382
|
+
const side = getSide(placement);
|
|
2383
|
+
const alignment = getAlignment(placement);
|
|
2384
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
2385
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
2386
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
2387
|
+
const rawValue = evaluate(options, state);
|
|
2388
|
+
let {
|
|
2389
|
+
mainAxis,
|
|
2390
|
+
crossAxis,
|
|
2391
|
+
alignmentAxis
|
|
2392
|
+
} = typeof rawValue === "number" ? {
|
|
2393
|
+
mainAxis: rawValue,
|
|
2394
|
+
crossAxis: 0,
|
|
2395
|
+
alignmentAxis: null
|
|
2396
|
+
} : {
|
|
2397
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
2398
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
2399
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
2400
|
+
};
|
|
2401
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
2402
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
2403
|
+
}
|
|
2404
|
+
return isVertical ? {
|
|
2405
|
+
x: crossAxis * crossAxisMulti,
|
|
2406
|
+
y: mainAxis * mainAxisMulti
|
|
2407
|
+
} : {
|
|
2408
|
+
x: mainAxis * mainAxisMulti,
|
|
2409
|
+
y: crossAxis * crossAxisMulti
|
|
2410
|
+
};
|
|
2411
|
+
}
|
|
2412
|
+
const offset$2 = function(options) {
|
|
2413
|
+
if (options === void 0) {
|
|
2414
|
+
options = 0;
|
|
2415
|
+
}
|
|
2416
|
+
return {
|
|
2417
|
+
name: "offset",
|
|
2418
|
+
options,
|
|
2419
|
+
async fn(state) {
|
|
2420
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
2421
|
+
const {
|
|
2422
|
+
x,
|
|
2423
|
+
y,
|
|
2424
|
+
placement,
|
|
2425
|
+
middlewareData
|
|
2426
|
+
} = state;
|
|
2427
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
2428
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2429
|
+
return {};
|
|
2430
|
+
}
|
|
2431
|
+
return {
|
|
2432
|
+
x: x + diffCoords.x,
|
|
2433
|
+
y: y + diffCoords.y,
|
|
2434
|
+
data: {
|
|
2435
|
+
...diffCoords,
|
|
2436
|
+
placement
|
|
2437
|
+
}
|
|
2438
|
+
};
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
};
|
|
2442
|
+
const shift$2 = function(options) {
|
|
2443
|
+
if (options === void 0) {
|
|
2444
|
+
options = {};
|
|
2445
|
+
}
|
|
2446
|
+
return {
|
|
2447
|
+
name: "shift",
|
|
2448
|
+
options,
|
|
2449
|
+
async fn(state) {
|
|
2450
|
+
const {
|
|
2451
|
+
x,
|
|
2452
|
+
y,
|
|
2453
|
+
placement
|
|
2454
|
+
} = state;
|
|
2455
|
+
const {
|
|
2456
|
+
mainAxis: checkMainAxis = true,
|
|
2457
|
+
crossAxis: checkCrossAxis = false,
|
|
2458
|
+
limiter = {
|
|
2459
|
+
fn: (_ref) => {
|
|
2460
|
+
let {
|
|
2461
|
+
x: x2,
|
|
2462
|
+
y: y2
|
|
2463
|
+
} = _ref;
|
|
2464
|
+
return {
|
|
2465
|
+
x: x2,
|
|
2466
|
+
y: y2
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
},
|
|
2470
|
+
...detectOverflowOptions
|
|
2471
|
+
} = evaluate(options, state);
|
|
2472
|
+
const coords = {
|
|
2473
|
+
x,
|
|
2474
|
+
y
|
|
2475
|
+
};
|
|
2476
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2477
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
2478
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
2479
|
+
let mainAxisCoord = coords[mainAxis];
|
|
2480
|
+
let crossAxisCoord = coords[crossAxis];
|
|
2481
|
+
if (checkMainAxis) {
|
|
2482
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
2483
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
2484
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
2485
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
2486
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
2487
|
+
}
|
|
2488
|
+
if (checkCrossAxis) {
|
|
2489
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
2490
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
2491
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
2492
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
2493
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
2494
|
+
}
|
|
2495
|
+
const limitedCoords = limiter.fn({
|
|
2496
|
+
...state,
|
|
2497
|
+
[mainAxis]: mainAxisCoord,
|
|
2498
|
+
[crossAxis]: crossAxisCoord
|
|
2499
|
+
});
|
|
2500
|
+
return {
|
|
2501
|
+
...limitedCoords,
|
|
2502
|
+
data: {
|
|
2503
|
+
x: limitedCoords.x - x,
|
|
2504
|
+
y: limitedCoords.y - y,
|
|
2505
|
+
enabled: {
|
|
2506
|
+
[mainAxis]: checkMainAxis,
|
|
2507
|
+
[crossAxis]: checkCrossAxis
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
};
|
|
2513
|
+
};
|
|
2514
|
+
const limitShift$2 = function(options) {
|
|
2515
|
+
if (options === void 0) {
|
|
2516
|
+
options = {};
|
|
2517
|
+
}
|
|
2518
|
+
return {
|
|
2519
|
+
options,
|
|
2520
|
+
fn(state) {
|
|
2521
|
+
const {
|
|
2522
|
+
x,
|
|
2523
|
+
y,
|
|
2524
|
+
placement,
|
|
2525
|
+
rects,
|
|
2526
|
+
middlewareData
|
|
2527
|
+
} = state;
|
|
2528
|
+
const {
|
|
2529
|
+
offset: offset2 = 0,
|
|
2530
|
+
mainAxis: checkMainAxis = true,
|
|
2531
|
+
crossAxis: checkCrossAxis = true
|
|
2532
|
+
} = evaluate(options, state);
|
|
2533
|
+
const coords = {
|
|
2534
|
+
x,
|
|
2535
|
+
y
|
|
2536
|
+
};
|
|
2537
|
+
const crossAxis = getSideAxis(placement);
|
|
2538
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
2539
|
+
let mainAxisCoord = coords[mainAxis];
|
|
2540
|
+
let crossAxisCoord = coords[crossAxis];
|
|
2541
|
+
const rawOffset = evaluate(offset2, state);
|
|
2542
|
+
const computedOffset = typeof rawOffset === "number" ? {
|
|
2543
|
+
mainAxis: rawOffset,
|
|
2544
|
+
crossAxis: 0
|
|
2545
|
+
} : {
|
|
2546
|
+
mainAxis: 0,
|
|
2547
|
+
crossAxis: 0,
|
|
2548
|
+
...rawOffset
|
|
2549
|
+
};
|
|
2550
|
+
if (checkMainAxis) {
|
|
2551
|
+
const len = mainAxis === "y" ? "height" : "width";
|
|
2552
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
2553
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
2554
|
+
if (mainAxisCoord < limitMin) {
|
|
2555
|
+
mainAxisCoord = limitMin;
|
|
2556
|
+
} else if (mainAxisCoord > limitMax) {
|
|
2557
|
+
mainAxisCoord = limitMax;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
if (checkCrossAxis) {
|
|
2561
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
2562
|
+
const len = mainAxis === "y" ? "width" : "height";
|
|
2563
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
2564
|
+
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
2565
|
+
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
2566
|
+
if (crossAxisCoord < limitMin) {
|
|
2567
|
+
crossAxisCoord = limitMin;
|
|
2568
|
+
} else if (crossAxisCoord > limitMax) {
|
|
2569
|
+
crossAxisCoord = limitMax;
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
return {
|
|
2573
|
+
[mainAxis]: mainAxisCoord,
|
|
2574
|
+
[crossAxis]: crossAxisCoord
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
};
|
|
2578
|
+
};
|
|
2579
|
+
const size$2 = function(options) {
|
|
2580
|
+
if (options === void 0) {
|
|
2581
|
+
options = {};
|
|
2582
|
+
}
|
|
2583
|
+
return {
|
|
2584
|
+
name: "size",
|
|
2585
|
+
options,
|
|
2586
|
+
async fn(state) {
|
|
2587
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
2588
|
+
const {
|
|
2589
|
+
placement,
|
|
2590
|
+
rects,
|
|
2591
|
+
platform: platform2,
|
|
2592
|
+
elements
|
|
2593
|
+
} = state;
|
|
2594
|
+
const {
|
|
2595
|
+
apply = () => {
|
|
2596
|
+
},
|
|
2597
|
+
...detectOverflowOptions
|
|
2598
|
+
} = evaluate(options, state);
|
|
2599
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2600
|
+
const side = getSide(placement);
|
|
2601
|
+
const alignment = getAlignment(placement);
|
|
2602
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
2603
|
+
const {
|
|
2604
|
+
width,
|
|
2605
|
+
height
|
|
2606
|
+
} = rects.floating;
|
|
2607
|
+
let heightSide;
|
|
2608
|
+
let widthSide;
|
|
2609
|
+
if (side === "top" || side === "bottom") {
|
|
2610
|
+
heightSide = side;
|
|
2611
|
+
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
2612
|
+
} else {
|
|
2613
|
+
widthSide = side;
|
|
2614
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
2615
|
+
}
|
|
2616
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
2617
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
2618
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
2619
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
2620
|
+
const noShift = !state.middlewareData.shift;
|
|
2621
|
+
let availableHeight = overflowAvailableHeight;
|
|
2622
|
+
let availableWidth = overflowAvailableWidth;
|
|
2623
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
2624
|
+
availableWidth = maximumClippingWidth;
|
|
2625
|
+
}
|
|
2626
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
2627
|
+
availableHeight = maximumClippingHeight;
|
|
2628
|
+
}
|
|
2629
|
+
if (noShift && !alignment) {
|
|
2630
|
+
const xMin = max(overflow.left, 0);
|
|
2631
|
+
const xMax = max(overflow.right, 0);
|
|
2632
|
+
const yMin = max(overflow.top, 0);
|
|
2633
|
+
const yMax = max(overflow.bottom, 0);
|
|
2634
|
+
if (isYAxis) {
|
|
2635
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
2636
|
+
} else {
|
|
2637
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
await apply({
|
|
2641
|
+
...state,
|
|
2642
|
+
availableWidth,
|
|
2643
|
+
availableHeight
|
|
2644
|
+
});
|
|
2645
|
+
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
2646
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
2647
|
+
return {
|
|
2648
|
+
reset: {
|
|
2649
|
+
rects: true
|
|
2650
|
+
}
|
|
2651
|
+
};
|
|
2652
|
+
}
|
|
2653
|
+
return {};
|
|
2654
|
+
}
|
|
2655
|
+
};
|
|
2656
|
+
};
|
|
2657
|
+
function hasWindow() {
|
|
2658
|
+
return typeof window !== "undefined";
|
|
2659
|
+
}
|
|
2660
|
+
function getNodeName(node) {
|
|
2661
|
+
if (isNode(node)) {
|
|
2662
|
+
return (node.nodeName || "").toLowerCase();
|
|
2663
|
+
}
|
|
2664
|
+
return "#document";
|
|
2665
|
+
}
|
|
2666
|
+
function getWindow(node) {
|
|
2667
|
+
var _node$ownerDocument;
|
|
2668
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
2669
|
+
}
|
|
2670
|
+
function getDocumentElement(node) {
|
|
2671
|
+
var _ref;
|
|
2672
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
2673
|
+
}
|
|
2674
|
+
function isNode(value) {
|
|
2675
|
+
if (!hasWindow()) {
|
|
2676
|
+
return false;
|
|
2677
|
+
}
|
|
2678
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
2679
|
+
}
|
|
2680
|
+
function isElement(value) {
|
|
2681
|
+
if (!hasWindow()) {
|
|
2682
|
+
return false;
|
|
2683
|
+
}
|
|
2684
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
2685
|
+
}
|
|
2686
|
+
function isHTMLElement(value) {
|
|
2687
|
+
if (!hasWindow()) {
|
|
2688
|
+
return false;
|
|
2689
|
+
}
|
|
2690
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
2691
|
+
}
|
|
2692
|
+
function isShadowRoot(value) {
|
|
2693
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
2694
|
+
return false;
|
|
2695
|
+
}
|
|
2696
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
2697
|
+
}
|
|
2698
|
+
const invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
2699
|
+
function isOverflowElement(element) {
|
|
2700
|
+
const {
|
|
2701
|
+
overflow,
|
|
2702
|
+
overflowX,
|
|
2703
|
+
overflowY,
|
|
2704
|
+
display
|
|
2705
|
+
} = getComputedStyle$1(element);
|
|
2706
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
2707
|
+
}
|
|
2708
|
+
const tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
2709
|
+
function isTableElement(element) {
|
|
2710
|
+
return tableElements.has(getNodeName(element));
|
|
2711
|
+
}
|
|
2712
|
+
const topLayerSelectors = [":popover-open", ":modal"];
|
|
2713
|
+
function isTopLayer(element) {
|
|
2714
|
+
return topLayerSelectors.some((selector) => {
|
|
2715
|
+
try {
|
|
2716
|
+
return element.matches(selector);
|
|
2717
|
+
} catch (_e) {
|
|
2718
|
+
return false;
|
|
2719
|
+
}
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
const transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
|
|
2723
|
+
const willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
|
|
2724
|
+
const containValues = ["paint", "layout", "strict", "content"];
|
|
2725
|
+
function isContainingBlock(elementOrCss) {
|
|
2726
|
+
const webkit = isWebKit();
|
|
2727
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
2728
|
+
return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
|
|
2729
|
+
}
|
|
2730
|
+
function getContainingBlock(element) {
|
|
2731
|
+
let currentNode = getParentNode(element);
|
|
2732
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2733
|
+
if (isContainingBlock(currentNode)) {
|
|
2734
|
+
return currentNode;
|
|
2735
|
+
} else if (isTopLayer(currentNode)) {
|
|
2736
|
+
return null;
|
|
2737
|
+
}
|
|
2738
|
+
currentNode = getParentNode(currentNode);
|
|
2739
|
+
}
|
|
2740
|
+
return null;
|
|
2741
|
+
}
|
|
2742
|
+
function isWebKit() {
|
|
2743
|
+
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
2744
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
2745
|
+
}
|
|
2746
|
+
const lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
2747
|
+
function isLastTraversableNode(node) {
|
|
2748
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
2749
|
+
}
|
|
2750
|
+
function getComputedStyle$1(element) {
|
|
2751
|
+
return getWindow(element).getComputedStyle(element);
|
|
2752
|
+
}
|
|
2753
|
+
function getNodeScroll(element) {
|
|
2754
|
+
if (isElement(element)) {
|
|
2755
|
+
return {
|
|
2756
|
+
scrollLeft: element.scrollLeft,
|
|
2757
|
+
scrollTop: element.scrollTop
|
|
2758
|
+
};
|
|
2759
|
+
}
|
|
2760
|
+
return {
|
|
2761
|
+
scrollLeft: element.scrollX,
|
|
2762
|
+
scrollTop: element.scrollY
|
|
2763
|
+
};
|
|
2764
|
+
}
|
|
2765
|
+
function getParentNode(node) {
|
|
2766
|
+
if (getNodeName(node) === "html") {
|
|
2767
|
+
return node;
|
|
2768
|
+
}
|
|
2769
|
+
const result = (
|
|
2770
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
2771
|
+
node.assignedSlot || // DOM Element detected.
|
|
2772
|
+
node.parentNode || // ShadowRoot detected.
|
|
2773
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
2774
|
+
getDocumentElement(node)
|
|
2775
|
+
);
|
|
2776
|
+
return isShadowRoot(result) ? result.host : result;
|
|
2777
|
+
}
|
|
2778
|
+
function getNearestOverflowAncestor(node) {
|
|
2779
|
+
const parentNode = getParentNode(node);
|
|
2780
|
+
if (isLastTraversableNode(parentNode)) {
|
|
2781
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
2782
|
+
}
|
|
2783
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
2784
|
+
return parentNode;
|
|
2785
|
+
}
|
|
2786
|
+
return getNearestOverflowAncestor(parentNode);
|
|
2787
|
+
}
|
|
2788
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
2789
|
+
var _node$ownerDocument2;
|
|
2790
|
+
if (list === void 0) {
|
|
2791
|
+
list = [];
|
|
2792
|
+
}
|
|
2793
|
+
if (traverseIframes === void 0) {
|
|
2794
|
+
traverseIframes = true;
|
|
2795
|
+
}
|
|
2796
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
2797
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
2798
|
+
const win = getWindow(scrollableAncestor);
|
|
2799
|
+
if (isBody) {
|
|
2800
|
+
const frameElement = getFrameElement(win);
|
|
2801
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
2802
|
+
}
|
|
2803
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
2804
|
+
}
|
|
2805
|
+
function getFrameElement(win) {
|
|
2806
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
2807
|
+
}
|
|
2808
|
+
function getCssDimensions(element) {
|
|
2809
|
+
const css = getComputedStyle$1(element);
|
|
2810
|
+
let width = parseFloat(css.width) || 0;
|
|
2811
|
+
let height = parseFloat(css.height) || 0;
|
|
2812
|
+
const hasOffset = isHTMLElement(element);
|
|
2813
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
2814
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
2815
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
2816
|
+
if (shouldFallback) {
|
|
2817
|
+
width = offsetWidth;
|
|
2818
|
+
height = offsetHeight;
|
|
2819
|
+
}
|
|
2820
|
+
return {
|
|
2821
|
+
width,
|
|
2822
|
+
height,
|
|
2823
|
+
$: shouldFallback
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
function unwrapElement(element) {
|
|
2827
|
+
return !isElement(element) ? element.contextElement : element;
|
|
2828
|
+
}
|
|
2829
|
+
function getScale(element) {
|
|
2830
|
+
const domElement = unwrapElement(element);
|
|
2831
|
+
if (!isHTMLElement(domElement)) {
|
|
2832
|
+
return createCoords(1);
|
|
2833
|
+
}
|
|
2834
|
+
const rect = domElement.getBoundingClientRect();
|
|
2835
|
+
const {
|
|
2836
|
+
width,
|
|
2837
|
+
height,
|
|
2838
|
+
$
|
|
2839
|
+
} = getCssDimensions(domElement);
|
|
2840
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
2841
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
2842
|
+
if (!x || !Number.isFinite(x)) {
|
|
2843
|
+
x = 1;
|
|
2844
|
+
}
|
|
2845
|
+
if (!y || !Number.isFinite(y)) {
|
|
2846
|
+
y = 1;
|
|
2847
|
+
}
|
|
2848
|
+
return {
|
|
2849
|
+
x,
|
|
2850
|
+
y
|
|
2851
|
+
};
|
|
2852
|
+
}
|
|
2853
|
+
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
2854
|
+
function getVisualOffsets(element) {
|
|
2855
|
+
const win = getWindow(element);
|
|
2856
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
2857
|
+
return noOffsets;
|
|
2858
|
+
}
|
|
2859
|
+
return {
|
|
2860
|
+
x: win.visualViewport.offsetLeft,
|
|
2861
|
+
y: win.visualViewport.offsetTop
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2864
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
2865
|
+
if (isFixed === void 0) {
|
|
2866
|
+
isFixed = false;
|
|
2867
|
+
}
|
|
2868
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
2869
|
+
return false;
|
|
2870
|
+
}
|
|
2871
|
+
return isFixed;
|
|
2872
|
+
}
|
|
2873
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
2874
|
+
if (includeScale === void 0) {
|
|
2875
|
+
includeScale = false;
|
|
2876
|
+
}
|
|
2877
|
+
if (isFixedStrategy === void 0) {
|
|
2878
|
+
isFixedStrategy = false;
|
|
2879
|
+
}
|
|
2880
|
+
const clientRect = element.getBoundingClientRect();
|
|
2881
|
+
const domElement = unwrapElement(element);
|
|
2882
|
+
let scale = createCoords(1);
|
|
2883
|
+
if (includeScale) {
|
|
2884
|
+
if (offsetParent) {
|
|
2885
|
+
if (isElement(offsetParent)) {
|
|
2886
|
+
scale = getScale(offsetParent);
|
|
2887
|
+
}
|
|
2888
|
+
} else {
|
|
2889
|
+
scale = getScale(element);
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
2893
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
2894
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
2895
|
+
let width = clientRect.width / scale.x;
|
|
2896
|
+
let height = clientRect.height / scale.y;
|
|
2897
|
+
if (domElement) {
|
|
2898
|
+
const win = getWindow(domElement);
|
|
2899
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
2900
|
+
let currentWin = win;
|
|
2901
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
2902
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2903
|
+
const iframeScale = getScale(currentIFrame);
|
|
2904
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2905
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
2906
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2907
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2908
|
+
x *= iframeScale.x;
|
|
2909
|
+
y *= iframeScale.y;
|
|
2910
|
+
width *= iframeScale.x;
|
|
2911
|
+
height *= iframeScale.y;
|
|
2912
|
+
x += left;
|
|
2913
|
+
y += top;
|
|
2914
|
+
currentWin = getWindow(currentIFrame);
|
|
2915
|
+
currentIFrame = getFrameElement(currentWin);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
return rectToClientRect({
|
|
2919
|
+
width,
|
|
2920
|
+
height,
|
|
2921
|
+
x,
|
|
2922
|
+
y
|
|
2923
|
+
});
|
|
2924
|
+
}
|
|
2925
|
+
function getWindowScrollBarX(element, rect) {
|
|
2926
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
2927
|
+
if (!rect) {
|
|
2928
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
2929
|
+
}
|
|
2930
|
+
return rect.left + leftScroll;
|
|
2931
|
+
}
|
|
2932
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
2933
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
2934
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
2935
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
2936
|
+
return {
|
|
2937
|
+
x,
|
|
2938
|
+
y
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2941
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
2942
|
+
let {
|
|
2943
|
+
elements,
|
|
2944
|
+
rect,
|
|
2945
|
+
offsetParent,
|
|
2946
|
+
strategy
|
|
2947
|
+
} = _ref;
|
|
2948
|
+
const isFixed = strategy === "fixed";
|
|
2949
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2950
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
2951
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
2952
|
+
return rect;
|
|
2953
|
+
}
|
|
2954
|
+
let scroll = {
|
|
2955
|
+
scrollLeft: 0,
|
|
2956
|
+
scrollTop: 0
|
|
2957
|
+
};
|
|
2958
|
+
let scale = createCoords(1);
|
|
2959
|
+
const offsets = createCoords(0);
|
|
2960
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2961
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2962
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
2963
|
+
scroll = getNodeScroll(offsetParent);
|
|
2964
|
+
}
|
|
2965
|
+
if (isHTMLElement(offsetParent)) {
|
|
2966
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2967
|
+
scale = getScale(offsetParent);
|
|
2968
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2969
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2973
|
+
return {
|
|
2974
|
+
width: rect.width * scale.x,
|
|
2975
|
+
height: rect.height * scale.y,
|
|
2976
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
2977
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
2978
|
+
};
|
|
2979
|
+
}
|
|
2980
|
+
function getClientRects(element) {
|
|
2981
|
+
return Array.from(element.getClientRects());
|
|
2982
|
+
}
|
|
2983
|
+
function getDocumentRect(element) {
|
|
2984
|
+
const html = getDocumentElement(element);
|
|
2985
|
+
const scroll = getNodeScroll(element);
|
|
2986
|
+
const body = element.ownerDocument.body;
|
|
2987
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
2988
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2989
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2990
|
+
const y = -scroll.scrollTop;
|
|
2991
|
+
if (getComputedStyle$1(body).direction === "rtl") {
|
|
2992
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2993
|
+
}
|
|
2994
|
+
return {
|
|
2995
|
+
width,
|
|
2996
|
+
height,
|
|
2997
|
+
x,
|
|
2998
|
+
y
|
|
2999
|
+
};
|
|
3000
|
+
}
|
|
3001
|
+
const SCROLLBAR_MAX = 25;
|
|
3002
|
+
function getViewportRect(element, strategy) {
|
|
3003
|
+
const win = getWindow(element);
|
|
3004
|
+
const html = getDocumentElement(element);
|
|
3005
|
+
const visualViewport = win.visualViewport;
|
|
3006
|
+
let width = html.clientWidth;
|
|
3007
|
+
let height = html.clientHeight;
|
|
3008
|
+
let x = 0;
|
|
3009
|
+
let y = 0;
|
|
3010
|
+
if (visualViewport) {
|
|
3011
|
+
width = visualViewport.width;
|
|
3012
|
+
height = visualViewport.height;
|
|
3013
|
+
const visualViewportBased = isWebKit();
|
|
3014
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
3015
|
+
x = visualViewport.offsetLeft;
|
|
3016
|
+
y = visualViewport.offsetTop;
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
3020
|
+
if (windowScrollbarX <= 0) {
|
|
3021
|
+
const doc = html.ownerDocument;
|
|
3022
|
+
const body = doc.body;
|
|
3023
|
+
const bodyStyles = getComputedStyle(body);
|
|
3024
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
3025
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
3026
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
3027
|
+
width -= clippingStableScrollbarWidth;
|
|
3028
|
+
}
|
|
3029
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
3030
|
+
width += windowScrollbarX;
|
|
3031
|
+
}
|
|
3032
|
+
return {
|
|
3033
|
+
width,
|
|
3034
|
+
height,
|
|
3035
|
+
x,
|
|
3036
|
+
y
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
3039
|
+
const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
3040
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
3041
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
3042
|
+
const top = clientRect.top + element.clientTop;
|
|
3043
|
+
const left = clientRect.left + element.clientLeft;
|
|
3044
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
3045
|
+
const width = element.clientWidth * scale.x;
|
|
3046
|
+
const height = element.clientHeight * scale.y;
|
|
3047
|
+
const x = left * scale.x;
|
|
3048
|
+
const y = top * scale.y;
|
|
3049
|
+
return {
|
|
3050
|
+
width,
|
|
3051
|
+
height,
|
|
3052
|
+
x,
|
|
3053
|
+
y
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
3057
|
+
let rect;
|
|
3058
|
+
if (clippingAncestor === "viewport") {
|
|
3059
|
+
rect = getViewportRect(element, strategy);
|
|
3060
|
+
} else if (clippingAncestor === "document") {
|
|
3061
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
3062
|
+
} else if (isElement(clippingAncestor)) {
|
|
3063
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
3064
|
+
} else {
|
|
3065
|
+
const visualOffsets = getVisualOffsets(element);
|
|
3066
|
+
rect = {
|
|
3067
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
3068
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
3069
|
+
width: clippingAncestor.width,
|
|
3070
|
+
height: clippingAncestor.height
|
|
3071
|
+
};
|
|
3072
|
+
}
|
|
3073
|
+
return rectToClientRect(rect);
|
|
3074
|
+
}
|
|
3075
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
3076
|
+
const parentNode = getParentNode(element);
|
|
3077
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
3078
|
+
return false;
|
|
3079
|
+
}
|
|
3080
|
+
return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
3081
|
+
}
|
|
3082
|
+
function getClippingElementAncestors(element, cache) {
|
|
3083
|
+
const cachedResult = cache.get(element);
|
|
3084
|
+
if (cachedResult) {
|
|
3085
|
+
return cachedResult;
|
|
3086
|
+
}
|
|
3087
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
3088
|
+
let currentContainingBlockComputedStyle = null;
|
|
3089
|
+
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
3090
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
3091
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
3092
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
3093
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
3094
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
3095
|
+
currentContainingBlockComputedStyle = null;
|
|
3096
|
+
}
|
|
3097
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
3098
|
+
if (shouldDropCurrentNode) {
|
|
3099
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
3100
|
+
} else {
|
|
3101
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
3102
|
+
}
|
|
3103
|
+
currentNode = getParentNode(currentNode);
|
|
3104
|
+
}
|
|
3105
|
+
cache.set(element, result);
|
|
3106
|
+
return result;
|
|
3107
|
+
}
|
|
3108
|
+
function getClippingRect(_ref) {
|
|
3109
|
+
let {
|
|
3110
|
+
element,
|
|
3111
|
+
boundary,
|
|
3112
|
+
rootBoundary,
|
|
3113
|
+
strategy
|
|
3114
|
+
} = _ref;
|
|
3115
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
3116
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
3117
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
3118
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
3119
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
3120
|
+
accRect.top = max(rect.top, accRect.top);
|
|
3121
|
+
accRect.right = min(rect.right, accRect.right);
|
|
3122
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
3123
|
+
accRect.left = max(rect.left, accRect.left);
|
|
3124
|
+
return accRect;
|
|
3125
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
3126
|
+
return {
|
|
3127
|
+
width: clippingRect.right - clippingRect.left,
|
|
3128
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
3129
|
+
x: clippingRect.left,
|
|
3130
|
+
y: clippingRect.top
|
|
3131
|
+
};
|
|
3132
|
+
}
|
|
3133
|
+
function getDimensions(element) {
|
|
3134
|
+
const {
|
|
3135
|
+
width,
|
|
3136
|
+
height
|
|
3137
|
+
} = getCssDimensions(element);
|
|
3138
|
+
return {
|
|
3139
|
+
width,
|
|
3140
|
+
height
|
|
3141
|
+
};
|
|
3142
|
+
}
|
|
3143
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
3144
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
3145
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
3146
|
+
const isFixed = strategy === "fixed";
|
|
3147
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
3148
|
+
let scroll = {
|
|
3149
|
+
scrollLeft: 0,
|
|
3150
|
+
scrollTop: 0
|
|
3151
|
+
};
|
|
3152
|
+
const offsets = createCoords(0);
|
|
3153
|
+
function setLeftRTLScrollbarOffset() {
|
|
3154
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
3155
|
+
}
|
|
3156
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
3157
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
3158
|
+
scroll = getNodeScroll(offsetParent);
|
|
3159
|
+
}
|
|
3160
|
+
if (isOffsetParentAnElement) {
|
|
3161
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
3162
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
3163
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
3164
|
+
} else if (documentElement) {
|
|
3165
|
+
setLeftRTLScrollbarOffset();
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
3169
|
+
setLeftRTLScrollbarOffset();
|
|
3170
|
+
}
|
|
3171
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
3172
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
3173
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
3174
|
+
return {
|
|
3175
|
+
x,
|
|
3176
|
+
y,
|
|
3177
|
+
width: rect.width,
|
|
3178
|
+
height: rect.height
|
|
3179
|
+
};
|
|
3180
|
+
}
|
|
3181
|
+
function isStaticPositioned(element) {
|
|
3182
|
+
return getComputedStyle$1(element).position === "static";
|
|
3183
|
+
}
|
|
3184
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
3185
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
|
|
3186
|
+
return null;
|
|
3187
|
+
}
|
|
3188
|
+
if (polyfill) {
|
|
3189
|
+
return polyfill(element);
|
|
3190
|
+
}
|
|
3191
|
+
let rawOffsetParent = element.offsetParent;
|
|
3192
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
3193
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
3194
|
+
}
|
|
3195
|
+
return rawOffsetParent;
|
|
3196
|
+
}
|
|
3197
|
+
function getOffsetParent(element, polyfill) {
|
|
3198
|
+
const win = getWindow(element);
|
|
3199
|
+
if (isTopLayer(element)) {
|
|
3200
|
+
return win;
|
|
3201
|
+
}
|
|
3202
|
+
if (!isHTMLElement(element)) {
|
|
3203
|
+
let svgOffsetParent = getParentNode(element);
|
|
3204
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
3205
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
3206
|
+
return svgOffsetParent;
|
|
3207
|
+
}
|
|
3208
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
3209
|
+
}
|
|
3210
|
+
return win;
|
|
3211
|
+
}
|
|
3212
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
3213
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
3214
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
3215
|
+
}
|
|
3216
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
3217
|
+
return win;
|
|
3218
|
+
}
|
|
3219
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
3220
|
+
}
|
|
3221
|
+
const getElementRects = async function(data) {
|
|
3222
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
3223
|
+
const getDimensionsFn = this.getDimensions;
|
|
3224
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
3225
|
+
return {
|
|
3226
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
3227
|
+
floating: {
|
|
3228
|
+
x: 0,
|
|
3229
|
+
y: 0,
|
|
3230
|
+
width: floatingDimensions.width,
|
|
3231
|
+
height: floatingDimensions.height
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3234
|
+
};
|
|
3235
|
+
function isRTL(element) {
|
|
3236
|
+
return getComputedStyle$1(element).direction === "rtl";
|
|
3237
|
+
}
|
|
3238
|
+
const platform = {
|
|
3239
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
3240
|
+
getDocumentElement,
|
|
3241
|
+
getClippingRect,
|
|
3242
|
+
getOffsetParent,
|
|
3243
|
+
getElementRects,
|
|
3244
|
+
getClientRects,
|
|
3245
|
+
getDimensions,
|
|
3246
|
+
getScale,
|
|
3247
|
+
isElement,
|
|
3248
|
+
isRTL
|
|
3249
|
+
};
|
|
3250
|
+
function rectsAreEqual(a, b) {
|
|
3251
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
3252
|
+
}
|
|
3253
|
+
function observeMove(element, onMove) {
|
|
3254
|
+
let io = null;
|
|
3255
|
+
let timeoutId;
|
|
3256
|
+
const root = getDocumentElement(element);
|
|
3257
|
+
function cleanup() {
|
|
3258
|
+
var _io;
|
|
3259
|
+
clearTimeout(timeoutId);
|
|
3260
|
+
(_io = io) == null || _io.disconnect();
|
|
3261
|
+
io = null;
|
|
3262
|
+
}
|
|
3263
|
+
function refresh(skip, threshold) {
|
|
3264
|
+
if (skip === void 0) {
|
|
3265
|
+
skip = false;
|
|
3266
|
+
}
|
|
3267
|
+
if (threshold === void 0) {
|
|
3268
|
+
threshold = 1;
|
|
3269
|
+
}
|
|
3270
|
+
cleanup();
|
|
3271
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
3272
|
+
const {
|
|
3273
|
+
left,
|
|
3274
|
+
top,
|
|
3275
|
+
width,
|
|
3276
|
+
height
|
|
3277
|
+
} = elementRectForRootMargin;
|
|
3278
|
+
if (!skip) {
|
|
3279
|
+
onMove();
|
|
3280
|
+
}
|
|
3281
|
+
if (!width || !height) {
|
|
3282
|
+
return;
|
|
3283
|
+
}
|
|
3284
|
+
const insetTop = floor(top);
|
|
3285
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
3286
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
3287
|
+
const insetLeft = floor(left);
|
|
3288
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
3289
|
+
const options = {
|
|
3290
|
+
rootMargin,
|
|
3291
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
3292
|
+
};
|
|
3293
|
+
let isFirstUpdate = true;
|
|
3294
|
+
function handleObserve(entries) {
|
|
3295
|
+
const ratio = entries[0].intersectionRatio;
|
|
3296
|
+
if (ratio !== threshold) {
|
|
3297
|
+
if (!isFirstUpdate) {
|
|
3298
|
+
return refresh();
|
|
3299
|
+
}
|
|
3300
|
+
if (!ratio) {
|
|
3301
|
+
timeoutId = setTimeout(() => {
|
|
3302
|
+
refresh(false, 1e-7);
|
|
3303
|
+
}, 1e3);
|
|
3304
|
+
} else {
|
|
3305
|
+
refresh(false, ratio);
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
3309
|
+
refresh();
|
|
3310
|
+
}
|
|
3311
|
+
isFirstUpdate = false;
|
|
3312
|
+
}
|
|
3313
|
+
try {
|
|
3314
|
+
io = new IntersectionObserver(handleObserve, {
|
|
3315
|
+
...options,
|
|
3316
|
+
// Handle <iframe>s
|
|
3317
|
+
root: root.ownerDocument
|
|
3318
|
+
});
|
|
3319
|
+
} catch (_e) {
|
|
3320
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
3321
|
+
}
|
|
3322
|
+
io.observe(element);
|
|
3323
|
+
}
|
|
3324
|
+
refresh(true);
|
|
3325
|
+
return cleanup;
|
|
3326
|
+
}
|
|
3327
|
+
function autoUpdate(reference, floating, update, options) {
|
|
3328
|
+
if (options === void 0) {
|
|
3329
|
+
options = {};
|
|
3330
|
+
}
|
|
3331
|
+
const {
|
|
3332
|
+
ancestorScroll = true,
|
|
3333
|
+
ancestorResize = true,
|
|
3334
|
+
elementResize = typeof ResizeObserver === "function",
|
|
3335
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
3336
|
+
animationFrame = false
|
|
3337
|
+
} = options;
|
|
3338
|
+
const referenceEl = unwrapElement(reference);
|
|
3339
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
3340
|
+
ancestors.forEach((ancestor) => {
|
|
3341
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
3342
|
+
passive: true
|
|
3343
|
+
});
|
|
3344
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
3345
|
+
});
|
|
3346
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
3347
|
+
let reobserveFrame = -1;
|
|
3348
|
+
let resizeObserver = null;
|
|
3349
|
+
if (elementResize) {
|
|
3350
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
3351
|
+
let [firstEntry] = _ref;
|
|
3352
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
3353
|
+
resizeObserver.unobserve(floating);
|
|
3354
|
+
cancelAnimationFrame(reobserveFrame);
|
|
3355
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
3356
|
+
var _resizeObserver;
|
|
3357
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
3358
|
+
});
|
|
3359
|
+
}
|
|
3360
|
+
update();
|
|
3361
|
+
});
|
|
3362
|
+
if (referenceEl && !animationFrame) {
|
|
3363
|
+
resizeObserver.observe(referenceEl);
|
|
3364
|
+
}
|
|
3365
|
+
resizeObserver.observe(floating);
|
|
3366
|
+
}
|
|
3367
|
+
let frameId;
|
|
3368
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
3369
|
+
if (animationFrame) {
|
|
3370
|
+
frameLoop();
|
|
3371
|
+
}
|
|
3372
|
+
function frameLoop() {
|
|
3373
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
3374
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
3375
|
+
update();
|
|
3376
|
+
}
|
|
3377
|
+
prevRefRect = nextRefRect;
|
|
3378
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
3379
|
+
}
|
|
3380
|
+
update();
|
|
3381
|
+
return () => {
|
|
3382
|
+
var _resizeObserver2;
|
|
3383
|
+
ancestors.forEach((ancestor) => {
|
|
3384
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
3385
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
3386
|
+
});
|
|
3387
|
+
cleanupIo == null || cleanupIo();
|
|
3388
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
3389
|
+
resizeObserver = null;
|
|
3390
|
+
if (animationFrame) {
|
|
3391
|
+
cancelAnimationFrame(frameId);
|
|
3392
|
+
}
|
|
3393
|
+
};
|
|
3394
|
+
}
|
|
3395
|
+
const offset$1 = offset$2;
|
|
3396
|
+
const shift$1 = shift$2;
|
|
3397
|
+
const flip$1 = flip$2;
|
|
3398
|
+
const size$1 = size$2;
|
|
3399
|
+
const hide$1 = hide$2;
|
|
3400
|
+
const arrow$2 = arrow$3;
|
|
3401
|
+
const limitShift$1 = limitShift$2;
|
|
3402
|
+
const computePosition = (reference, floating, options) => {
|
|
3403
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3404
|
+
const mergedOptions = {
|
|
3405
|
+
platform,
|
|
3406
|
+
...options
|
|
3407
|
+
};
|
|
3408
|
+
const platformWithCache = {
|
|
3409
|
+
...mergedOptions.platform,
|
|
3410
|
+
_c: cache
|
|
3411
|
+
};
|
|
3412
|
+
return computePosition$1(reference, floating, {
|
|
3413
|
+
...mergedOptions,
|
|
3414
|
+
platform: platformWithCache
|
|
3415
|
+
});
|
|
3416
|
+
};
|
|
3417
|
+
var isClient = typeof document !== "undefined";
|
|
3418
|
+
var noop = function noop2() {
|
|
3419
|
+
};
|
|
3420
|
+
var index = isClient ? reactExports.useLayoutEffect : noop;
|
|
3421
|
+
function deepEqual(a, b) {
|
|
3422
|
+
if (a === b) {
|
|
3423
|
+
return true;
|
|
3424
|
+
}
|
|
3425
|
+
if (typeof a !== typeof b) {
|
|
3426
|
+
return false;
|
|
3427
|
+
}
|
|
3428
|
+
if (typeof a === "function" && a.toString() === b.toString()) {
|
|
3429
|
+
return true;
|
|
3430
|
+
}
|
|
3431
|
+
let length;
|
|
3432
|
+
let i;
|
|
3433
|
+
let keys;
|
|
3434
|
+
if (a && b && typeof a === "object") {
|
|
3435
|
+
if (Array.isArray(a)) {
|
|
3436
|
+
length = a.length;
|
|
3437
|
+
if (length !== b.length) return false;
|
|
3438
|
+
for (i = length; i-- !== 0; ) {
|
|
3439
|
+
if (!deepEqual(a[i], b[i])) {
|
|
3440
|
+
return false;
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
return true;
|
|
3444
|
+
}
|
|
3445
|
+
keys = Object.keys(a);
|
|
3446
|
+
length = keys.length;
|
|
3447
|
+
if (length !== Object.keys(b).length) {
|
|
3448
|
+
return false;
|
|
3449
|
+
}
|
|
3450
|
+
for (i = length; i-- !== 0; ) {
|
|
3451
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
3452
|
+
return false;
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
for (i = length; i-- !== 0; ) {
|
|
3456
|
+
const key = keys[i];
|
|
3457
|
+
if (key === "_owner" && a.$$typeof) {
|
|
3458
|
+
continue;
|
|
3459
|
+
}
|
|
3460
|
+
if (!deepEqual(a[key], b[key])) {
|
|
3461
|
+
return false;
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
return true;
|
|
3465
|
+
}
|
|
3466
|
+
return a !== a && b !== b;
|
|
3467
|
+
}
|
|
3468
|
+
function getDPR(element) {
|
|
3469
|
+
if (typeof window === "undefined") {
|
|
3470
|
+
return 1;
|
|
3471
|
+
}
|
|
3472
|
+
const win = element.ownerDocument.defaultView || window;
|
|
3473
|
+
return win.devicePixelRatio || 1;
|
|
3474
|
+
}
|
|
3475
|
+
function roundByDPR(element, value) {
|
|
3476
|
+
const dpr = getDPR(element);
|
|
3477
|
+
return Math.round(value * dpr) / dpr;
|
|
3478
|
+
}
|
|
3479
|
+
function useLatestRef(value) {
|
|
3480
|
+
const ref = reactExports.useRef(value);
|
|
3481
|
+
index(() => {
|
|
3482
|
+
ref.current = value;
|
|
3483
|
+
});
|
|
3484
|
+
return ref;
|
|
3485
|
+
}
|
|
3486
|
+
function useFloating(options) {
|
|
3487
|
+
if (options === void 0) {
|
|
3488
|
+
options = {};
|
|
3489
|
+
}
|
|
3490
|
+
const {
|
|
3491
|
+
placement = "bottom",
|
|
3492
|
+
strategy = "absolute",
|
|
3493
|
+
middleware = [],
|
|
3494
|
+
platform: platform2,
|
|
3495
|
+
elements: {
|
|
3496
|
+
reference: externalReference,
|
|
3497
|
+
floating: externalFloating
|
|
3498
|
+
} = {},
|
|
3499
|
+
transform = true,
|
|
3500
|
+
whileElementsMounted,
|
|
3501
|
+
open
|
|
3502
|
+
} = options;
|
|
3503
|
+
const [data, setData] = reactExports.useState({
|
|
3504
|
+
x: 0,
|
|
3505
|
+
y: 0,
|
|
3506
|
+
strategy,
|
|
3507
|
+
placement,
|
|
3508
|
+
middlewareData: {},
|
|
3509
|
+
isPositioned: false
|
|
3510
|
+
});
|
|
3511
|
+
const [latestMiddleware, setLatestMiddleware] = reactExports.useState(middleware);
|
|
3512
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
3513
|
+
setLatestMiddleware(middleware);
|
|
3514
|
+
}
|
|
3515
|
+
const [_reference, _setReference] = reactExports.useState(null);
|
|
3516
|
+
const [_floating, _setFloating] = reactExports.useState(null);
|
|
3517
|
+
const setReference = reactExports.useCallback((node) => {
|
|
3518
|
+
if (node !== referenceRef.current) {
|
|
3519
|
+
referenceRef.current = node;
|
|
3520
|
+
_setReference(node);
|
|
3521
|
+
}
|
|
3522
|
+
}, []);
|
|
3523
|
+
const setFloating = reactExports.useCallback((node) => {
|
|
3524
|
+
if (node !== floatingRef.current) {
|
|
3525
|
+
floatingRef.current = node;
|
|
3526
|
+
_setFloating(node);
|
|
3527
|
+
}
|
|
3528
|
+
}, []);
|
|
3529
|
+
const referenceEl = externalReference || _reference;
|
|
3530
|
+
const floatingEl = externalFloating || _floating;
|
|
3531
|
+
const referenceRef = reactExports.useRef(null);
|
|
3532
|
+
const floatingRef = reactExports.useRef(null);
|
|
3533
|
+
const dataRef = reactExports.useRef(data);
|
|
3534
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
3535
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
3536
|
+
const platformRef = useLatestRef(platform2);
|
|
3537
|
+
const openRef = useLatestRef(open);
|
|
3538
|
+
const update = reactExports.useCallback(() => {
|
|
3539
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
3540
|
+
return;
|
|
3541
|
+
}
|
|
3542
|
+
const config = {
|
|
3543
|
+
placement,
|
|
3544
|
+
strategy,
|
|
3545
|
+
middleware: latestMiddleware
|
|
3546
|
+
};
|
|
3547
|
+
if (platformRef.current) {
|
|
3548
|
+
config.platform = platformRef.current;
|
|
3549
|
+
}
|
|
3550
|
+
computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
|
|
3551
|
+
const fullData = {
|
|
3552
|
+
...data2,
|
|
3553
|
+
// The floating element's position may be recomputed while it's closed
|
|
3554
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
3555
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
3556
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
3557
|
+
isPositioned: openRef.current !== false
|
|
3558
|
+
};
|
|
3559
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
3560
|
+
dataRef.current = fullData;
|
|
3561
|
+
reactDomExports.flushSync(() => {
|
|
3562
|
+
setData(fullData);
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
});
|
|
3566
|
+
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
3567
|
+
index(() => {
|
|
3568
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
3569
|
+
dataRef.current.isPositioned = false;
|
|
3570
|
+
setData((data2) => ({
|
|
3571
|
+
...data2,
|
|
3572
|
+
isPositioned: false
|
|
3573
|
+
}));
|
|
3574
|
+
}
|
|
3575
|
+
}, [open]);
|
|
3576
|
+
const isMountedRef = reactExports.useRef(false);
|
|
3577
|
+
index(() => {
|
|
3578
|
+
isMountedRef.current = true;
|
|
3579
|
+
return () => {
|
|
3580
|
+
isMountedRef.current = false;
|
|
3581
|
+
};
|
|
3582
|
+
}, []);
|
|
3583
|
+
index(() => {
|
|
3584
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
3585
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
3586
|
+
if (referenceEl && floatingEl) {
|
|
3587
|
+
if (whileElementsMountedRef.current) {
|
|
3588
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
3589
|
+
}
|
|
3590
|
+
update();
|
|
3591
|
+
}
|
|
3592
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
3593
|
+
const refs = reactExports.useMemo(() => ({
|
|
3594
|
+
reference: referenceRef,
|
|
3595
|
+
floating: floatingRef,
|
|
3596
|
+
setReference,
|
|
3597
|
+
setFloating
|
|
3598
|
+
}), [setReference, setFloating]);
|
|
3599
|
+
const elements = reactExports.useMemo(() => ({
|
|
3600
|
+
reference: referenceEl,
|
|
3601
|
+
floating: floatingEl
|
|
3602
|
+
}), [referenceEl, floatingEl]);
|
|
3603
|
+
const floatingStyles = reactExports.useMemo(() => {
|
|
3604
|
+
const initialStyles = {
|
|
3605
|
+
position: strategy,
|
|
3606
|
+
left: 0,
|
|
3607
|
+
top: 0
|
|
3608
|
+
};
|
|
3609
|
+
if (!elements.floating) {
|
|
3610
|
+
return initialStyles;
|
|
3611
|
+
}
|
|
3612
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
3613
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
3614
|
+
if (transform) {
|
|
3615
|
+
return {
|
|
3616
|
+
...initialStyles,
|
|
3617
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
3618
|
+
...getDPR(elements.floating) >= 1.5 && {
|
|
3619
|
+
willChange: "transform"
|
|
3620
|
+
}
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
return {
|
|
3624
|
+
position: strategy,
|
|
3625
|
+
left: x,
|
|
3626
|
+
top: y
|
|
3627
|
+
};
|
|
3628
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
3629
|
+
return reactExports.useMemo(() => ({
|
|
3630
|
+
...data,
|
|
3631
|
+
update,
|
|
3632
|
+
refs,
|
|
3633
|
+
elements,
|
|
3634
|
+
floatingStyles
|
|
3635
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
3636
|
+
}
|
|
3637
|
+
const arrow$1 = (options) => {
|
|
3638
|
+
function isRef(value) {
|
|
3639
|
+
return {}.hasOwnProperty.call(value, "current");
|
|
3640
|
+
}
|
|
3641
|
+
return {
|
|
3642
|
+
name: "arrow",
|
|
3643
|
+
options,
|
|
3644
|
+
fn(state) {
|
|
3645
|
+
const {
|
|
3646
|
+
element,
|
|
3647
|
+
padding
|
|
3648
|
+
} = typeof options === "function" ? options(state) : options;
|
|
3649
|
+
if (element && isRef(element)) {
|
|
3650
|
+
if (element.current != null) {
|
|
3651
|
+
return arrow$2({
|
|
3652
|
+
element: element.current,
|
|
3653
|
+
padding
|
|
3654
|
+
}).fn(state);
|
|
3655
|
+
}
|
|
3656
|
+
return {};
|
|
3657
|
+
}
|
|
3658
|
+
if (element) {
|
|
3659
|
+
return arrow$2({
|
|
3660
|
+
element,
|
|
3661
|
+
padding
|
|
3662
|
+
}).fn(state);
|
|
3663
|
+
}
|
|
3664
|
+
return {};
|
|
3665
|
+
}
|
|
3666
|
+
};
|
|
3667
|
+
};
|
|
3668
|
+
const offset = (options, deps) => ({
|
|
3669
|
+
...offset$1(options),
|
|
3670
|
+
options: [options, deps]
|
|
3671
|
+
});
|
|
3672
|
+
const shift = (options, deps) => ({
|
|
3673
|
+
...shift$1(options),
|
|
3674
|
+
options: [options, deps]
|
|
3675
|
+
});
|
|
3676
|
+
const limitShift = (options, deps) => ({
|
|
3677
|
+
...limitShift$1(options),
|
|
3678
|
+
options: [options, deps]
|
|
3679
|
+
});
|
|
3680
|
+
const flip = (options, deps) => ({
|
|
3681
|
+
...flip$1(options),
|
|
3682
|
+
options: [options, deps]
|
|
3683
|
+
});
|
|
3684
|
+
const size = (options, deps) => ({
|
|
3685
|
+
...size$1(options),
|
|
3686
|
+
options: [options, deps]
|
|
3687
|
+
});
|
|
3688
|
+
const hide = (options, deps) => ({
|
|
3689
|
+
...hide$1(options),
|
|
3690
|
+
options: [options, deps]
|
|
3691
|
+
});
|
|
3692
|
+
const arrow = (options, deps) => ({
|
|
3693
|
+
...arrow$1(options),
|
|
3694
|
+
options: [options, deps]
|
|
3695
|
+
});
|
|
3696
|
+
var NAME = "Arrow";
|
|
3697
|
+
var Arrow$1 = reactExports.forwardRef((props, forwardedRef) => {
|
|
3698
|
+
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
3699
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3700
|
+
Primitive.svg,
|
|
3701
|
+
{
|
|
3702
|
+
...arrowProps,
|
|
3703
|
+
ref: forwardedRef,
|
|
3704
|
+
width,
|
|
3705
|
+
height,
|
|
3706
|
+
viewBox: "0 0 30 10",
|
|
3707
|
+
preserveAspectRatio: "none",
|
|
3708
|
+
children: props.asChild ? children : /* @__PURE__ */ jsxRuntimeExports.jsx("polygon", { points: "0,0 30,0 15,10" })
|
|
3709
|
+
}
|
|
3710
|
+
);
|
|
3711
|
+
});
|
|
3712
|
+
Arrow$1.displayName = NAME;
|
|
3713
|
+
var Root = Arrow$1;
|
|
3714
|
+
var POPPER_NAME = "Popper";
|
|
3715
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
3716
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
3717
|
+
var Popper = (props) => {
|
|
3718
|
+
const { __scopePopper, children } = props;
|
|
3719
|
+
const [anchor, setAnchor] = reactExports.useState(null);
|
|
3720
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
3721
|
+
};
|
|
3722
|
+
Popper.displayName = POPPER_NAME;
|
|
3723
|
+
var ANCHOR_NAME = "PopperAnchor";
|
|
3724
|
+
var PopperAnchor = reactExports.forwardRef(
|
|
3725
|
+
(props, forwardedRef) => {
|
|
3726
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
3727
|
+
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
3728
|
+
const ref = reactExports.useRef(null);
|
|
3729
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
3730
|
+
const anchorRef = reactExports.useRef(null);
|
|
3731
|
+
reactExports.useEffect(() => {
|
|
3732
|
+
const previousAnchor = anchorRef.current;
|
|
3733
|
+
anchorRef.current = virtualRef?.current || ref.current;
|
|
3734
|
+
if (previousAnchor !== anchorRef.current) {
|
|
3735
|
+
context.onAnchorChange(anchorRef.current);
|
|
3736
|
+
}
|
|
3737
|
+
});
|
|
3738
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
3739
|
+
}
|
|
3740
|
+
);
|
|
3741
|
+
PopperAnchor.displayName = ANCHOR_NAME;
|
|
3742
|
+
var CONTENT_NAME = "PopperContent";
|
|
3743
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
3744
|
+
var PopperContent = reactExports.forwardRef(
|
|
3745
|
+
(props, forwardedRef) => {
|
|
3746
|
+
const {
|
|
3747
|
+
__scopePopper,
|
|
3748
|
+
side = "bottom",
|
|
3749
|
+
sideOffset = 0,
|
|
3750
|
+
align = "center",
|
|
3751
|
+
alignOffset = 0,
|
|
3752
|
+
arrowPadding = 0,
|
|
3753
|
+
avoidCollisions = true,
|
|
3754
|
+
collisionBoundary = [],
|
|
3755
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
3756
|
+
sticky = "partial",
|
|
3757
|
+
hideWhenDetached = false,
|
|
3758
|
+
updatePositionStrategy = "optimized",
|
|
3759
|
+
onPlaced,
|
|
3760
|
+
...contentProps
|
|
3761
|
+
} = props;
|
|
3762
|
+
const context = usePopperContext(CONTENT_NAME, __scopePopper);
|
|
3763
|
+
const [content, setContent] = reactExports.useState(null);
|
|
3764
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
3765
|
+
const [arrow$12, setArrow] = reactExports.useState(null);
|
|
3766
|
+
const arrowSize = useSize(arrow$12);
|
|
3767
|
+
const arrowWidth = arrowSize?.width ?? 0;
|
|
3768
|
+
const arrowHeight = arrowSize?.height ?? 0;
|
|
3769
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
3770
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
3771
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
3772
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
3773
|
+
const detectOverflowOptions = {
|
|
3774
|
+
padding: collisionPadding,
|
|
3775
|
+
boundary: boundary.filter(isNotNull),
|
|
3776
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
3777
|
+
altBoundary: hasExplicitBoundaries
|
|
3778
|
+
};
|
|
3779
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
3780
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
3781
|
+
strategy: "fixed",
|
|
3782
|
+
placement: desiredPlacement,
|
|
3783
|
+
whileElementsMounted: (...args) => {
|
|
3784
|
+
const cleanup = autoUpdate(...args, {
|
|
3785
|
+
animationFrame: updatePositionStrategy === "always"
|
|
3786
|
+
});
|
|
3787
|
+
return cleanup;
|
|
3788
|
+
},
|
|
3789
|
+
elements: {
|
|
3790
|
+
reference: context.anchor
|
|
3791
|
+
},
|
|
3792
|
+
middleware: [
|
|
3793
|
+
offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
3794
|
+
avoidCollisions && shift({
|
|
3795
|
+
mainAxis: true,
|
|
3796
|
+
crossAxis: false,
|
|
3797
|
+
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
3798
|
+
...detectOverflowOptions
|
|
3799
|
+
}),
|
|
3800
|
+
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
3801
|
+
size({
|
|
3802
|
+
...detectOverflowOptions,
|
|
3803
|
+
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
3804
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
3805
|
+
const contentStyle = elements.floating.style;
|
|
3806
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
3807
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
3808
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
3809
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
3810
|
+
}
|
|
3811
|
+
}),
|
|
3812
|
+
arrow$12 && arrow({ element: arrow$12, padding: arrowPadding }),
|
|
3813
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
3814
|
+
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
3815
|
+
]
|
|
3816
|
+
});
|
|
3817
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
3818
|
+
const handlePlaced = useCallbackRef$1(onPlaced);
|
|
3819
|
+
useLayoutEffect2(() => {
|
|
3820
|
+
if (isPositioned) {
|
|
3821
|
+
handlePlaced?.();
|
|
3822
|
+
}
|
|
3823
|
+
}, [isPositioned, handlePlaced]);
|
|
3824
|
+
const arrowX = middlewareData.arrow?.x;
|
|
3825
|
+
const arrowY = middlewareData.arrow?.y;
|
|
3826
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
3827
|
+
const [contentZIndex, setContentZIndex] = reactExports.useState();
|
|
3828
|
+
useLayoutEffect2(() => {
|
|
3829
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
3830
|
+
}, [content]);
|
|
3831
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3832
|
+
"div",
|
|
3833
|
+
{
|
|
3834
|
+
ref: refs.setFloating,
|
|
3835
|
+
"data-radix-popper-content-wrapper": "",
|
|
3836
|
+
style: {
|
|
3837
|
+
...floatingStyles,
|
|
3838
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
3839
|
+
// keep off the page when measuring
|
|
3840
|
+
minWidth: "max-content",
|
|
3841
|
+
zIndex: contentZIndex,
|
|
3842
|
+
["--radix-popper-transform-origin"]: [
|
|
3843
|
+
middlewareData.transformOrigin?.x,
|
|
3844
|
+
middlewareData.transformOrigin?.y
|
|
3845
|
+
].join(" "),
|
|
3846
|
+
// hide the content if using the hide middleware and should be hidden
|
|
3847
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
3848
|
+
// as if the PopperContent isn't there at all
|
|
3849
|
+
...middlewareData.hide?.referenceHidden && {
|
|
3850
|
+
visibility: "hidden",
|
|
3851
|
+
pointerEvents: "none"
|
|
3852
|
+
}
|
|
3853
|
+
},
|
|
3854
|
+
dir: props.dir,
|
|
3855
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3856
|
+
PopperContentProvider,
|
|
3857
|
+
{
|
|
3858
|
+
scope: __scopePopper,
|
|
3859
|
+
placedSide,
|
|
3860
|
+
onArrowChange: setArrow,
|
|
3861
|
+
arrowX,
|
|
3862
|
+
arrowY,
|
|
3863
|
+
shouldHideArrow: cannotCenterArrow,
|
|
3864
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3865
|
+
Primitive.div,
|
|
3866
|
+
{
|
|
3867
|
+
"data-side": placedSide,
|
|
3868
|
+
"data-align": placedAlign,
|
|
3869
|
+
...contentProps,
|
|
3870
|
+
ref: composedRefs,
|
|
3871
|
+
style: {
|
|
3872
|
+
...contentProps.style,
|
|
3873
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
3874
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
3875
|
+
animation: !isPositioned ? "none" : void 0
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
)
|
|
3879
|
+
}
|
|
3880
|
+
)
|
|
3881
|
+
}
|
|
3882
|
+
);
|
|
3883
|
+
}
|
|
3884
|
+
);
|
|
3885
|
+
PopperContent.displayName = CONTENT_NAME;
|
|
3886
|
+
var ARROW_NAME = "PopperArrow";
|
|
3887
|
+
var OPPOSITE_SIDE = {
|
|
3888
|
+
top: "bottom",
|
|
3889
|
+
right: "left",
|
|
3890
|
+
bottom: "top",
|
|
3891
|
+
left: "right"
|
|
3892
|
+
};
|
|
3893
|
+
var PopperArrow = reactExports.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
3894
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
3895
|
+
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
3896
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
3897
|
+
return (
|
|
3898
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
3899
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
3900
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
3901
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3902
|
+
"span",
|
|
3903
|
+
{
|
|
3904
|
+
ref: contentContext.onArrowChange,
|
|
3905
|
+
style: {
|
|
3906
|
+
position: "absolute",
|
|
3907
|
+
left: contentContext.arrowX,
|
|
3908
|
+
top: contentContext.arrowY,
|
|
3909
|
+
[baseSide]: 0,
|
|
3910
|
+
transformOrigin: {
|
|
3911
|
+
top: "",
|
|
3912
|
+
right: "0 0",
|
|
3913
|
+
bottom: "center 0",
|
|
3914
|
+
left: "100% 0"
|
|
3915
|
+
}[contentContext.placedSide],
|
|
3916
|
+
transform: {
|
|
3917
|
+
top: "translateY(100%)",
|
|
3918
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
3919
|
+
bottom: `rotate(180deg)`,
|
|
3920
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
3921
|
+
}[contentContext.placedSide],
|
|
3922
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
3923
|
+
},
|
|
3924
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3925
|
+
Root,
|
|
3926
|
+
{
|
|
3927
|
+
...arrowProps,
|
|
3928
|
+
ref: forwardedRef,
|
|
3929
|
+
style: {
|
|
3930
|
+
...arrowProps.style,
|
|
3931
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
3932
|
+
display: "block"
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3935
|
+
)
|
|
3936
|
+
}
|
|
3937
|
+
)
|
|
3938
|
+
);
|
|
3939
|
+
});
|
|
3940
|
+
PopperArrow.displayName = ARROW_NAME;
|
|
3941
|
+
function isNotNull(value) {
|
|
3942
|
+
return value !== null;
|
|
3943
|
+
}
|
|
3944
|
+
var transformOrigin = (options) => ({
|
|
3945
|
+
name: "transformOrigin",
|
|
3946
|
+
options,
|
|
3947
|
+
fn(data) {
|
|
3948
|
+
const { placement, rects, middlewareData } = data;
|
|
3949
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
3950
|
+
const isArrowHidden = cannotCenterArrow;
|
|
3951
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
3952
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
3953
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
3954
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
3955
|
+
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
3956
|
+
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
3957
|
+
let x = "";
|
|
3958
|
+
let y = "";
|
|
3959
|
+
if (placedSide === "bottom") {
|
|
3960
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
3961
|
+
y = `${-arrowHeight}px`;
|
|
3962
|
+
} else if (placedSide === "top") {
|
|
3963
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
3964
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
3965
|
+
} else if (placedSide === "right") {
|
|
3966
|
+
x = `${-arrowHeight}px`;
|
|
3967
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
3968
|
+
} else if (placedSide === "left") {
|
|
3969
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
3970
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
3971
|
+
}
|
|
3972
|
+
return { data: { x, y } };
|
|
3973
|
+
}
|
|
3974
|
+
});
|
|
3975
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
3976
|
+
const [side, align = "center"] = placement.split("-");
|
|
3977
|
+
return [side, align];
|
|
3978
|
+
}
|
|
3979
|
+
var Root2 = Popper;
|
|
3980
|
+
var Anchor = PopperAnchor;
|
|
3981
|
+
var Content = PopperContent;
|
|
3982
|
+
var Arrow = PopperArrow;
|
|
3983
|
+
function cn(...inputs) {
|
|
3984
|
+
return twMerge(clsx(inputs));
|
|
3985
|
+
}
|
|
3986
|
+
const buttonVariants = cva(
|
|
3987
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-4xl border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
|
|
3988
|
+
{
|
|
3989
|
+
variants: {
|
|
3990
|
+
variant: {
|
|
3991
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
3992
|
+
outline: "border-border bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
3993
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
3994
|
+
ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
3995
|
+
destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
|
|
3996
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
3997
|
+
},
|
|
3998
|
+
size: {
|
|
3999
|
+
default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
|
|
4000
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
|
|
4001
|
+
sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
4002
|
+
lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
4003
|
+
icon: "size-9",
|
|
4004
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
4005
|
+
"icon-sm": "size-8",
|
|
4006
|
+
"icon-lg": "size-10"
|
|
4007
|
+
}
|
|
4008
|
+
},
|
|
4009
|
+
defaultVariants: {
|
|
4010
|
+
variant: "default",
|
|
4011
|
+
size: "default"
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
);
|
|
4015
|
+
function Button({
|
|
4016
|
+
className,
|
|
4017
|
+
variant = "default",
|
|
4018
|
+
size: size2 = "default",
|
|
4019
|
+
asChild = false,
|
|
4020
|
+
...props
|
|
4021
|
+
}) {
|
|
4022
|
+
const Comp = asChild ? Slot : "button";
|
|
4023
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4024
|
+
Comp,
|
|
4025
|
+
{
|
|
4026
|
+
"data-slot": "button",
|
|
4027
|
+
"data-variant": variant,
|
|
4028
|
+
"data-size": size2,
|
|
4029
|
+
className: cn(buttonVariants({ variant, size: size2, className })),
|
|
4030
|
+
...props
|
|
4031
|
+
}
|
|
4032
|
+
);
|
|
4033
|
+
}
|
|
4034
|
+
export {
|
|
4035
|
+
getAlignment as $,
|
|
4036
|
+
Anchor as A,
|
|
4037
|
+
Button as B,
|
|
4038
|
+
Content as C,
|
|
4039
|
+
DismissableLayer as D,
|
|
4040
|
+
dispatchDiscreteCustomEvent as E,
|
|
4041
|
+
FocusScope as F,
|
|
4042
|
+
createContext2 as G,
|
|
4043
|
+
Root$1 as H,
|
|
4044
|
+
isHTMLElement as I,
|
|
4045
|
+
isShadowRoot as J,
|
|
4046
|
+
floor as K,
|
|
4047
|
+
getNodeName as L,
|
|
4048
|
+
isNode as M,
|
|
4049
|
+
getWindow as N,
|
|
4050
|
+
getComputedStyle$1 as O,
|
|
4051
|
+
Primitive as P,
|
|
4052
|
+
isLastTraversableNode as Q,
|
|
4053
|
+
Root2 as R,
|
|
4054
|
+
Slot as S,
|
|
4055
|
+
getParentNode as T,
|
|
4056
|
+
getOverflowAncestors as U,
|
|
4057
|
+
VISUALLY_HIDDEN_STYLES as V,
|
|
4058
|
+
isWebKit as W,
|
|
4059
|
+
X,
|
|
4060
|
+
evaluate as Y,
|
|
4061
|
+
getPaddingObject as Z,
|
|
4062
|
+
getAlignmentAxis as _,
|
|
4063
|
+
createContextScope as a,
|
|
4064
|
+
clamp as a0,
|
|
4065
|
+
getAxisLength as a1,
|
|
4066
|
+
hide as a2,
|
|
4067
|
+
size as a3,
|
|
4068
|
+
getSide as a4,
|
|
4069
|
+
getSideAxis as a5,
|
|
4070
|
+
shift as a6,
|
|
4071
|
+
limitShift as a7,
|
|
4072
|
+
isOverflowElement as a8,
|
|
4073
|
+
composeEventHandlers as b,
|
|
4074
|
+
createLucideIcon as c,
|
|
4075
|
+
createSlottable as d,
|
|
4076
|
+
useCallbackRef$1 as e,
|
|
4077
|
+
useLayoutEffect2 as f,
|
|
4078
|
+
Presence as g,
|
|
4079
|
+
useControllableState as h,
|
|
4080
|
+
useSize as i,
|
|
4081
|
+
createPopperScope as j,
|
|
4082
|
+
useId as k,
|
|
4083
|
+
Portal as l,
|
|
4084
|
+
hideOthers as m,
|
|
4085
|
+
ReactRemoveScroll as n,
|
|
4086
|
+
createSlot as o,
|
|
4087
|
+
useFocusGuards as p,
|
|
4088
|
+
Arrow as q,
|
|
4089
|
+
composeRefs as r,
|
|
4090
|
+
cn as s,
|
|
4091
|
+
isElement as t,
|
|
4092
|
+
useComposedRefs as u,
|
|
4093
|
+
buttonVariants as v,
|
|
4094
|
+
useFloating as w,
|
|
4095
|
+
autoUpdate as x,
|
|
4096
|
+
offset as y,
|
|
4097
|
+
flip as z
|
|
4098
|
+
};
|