commspliant-html-editor 0.0.4 → 0.0.6
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/README.md +58 -4
- package/dist/commspliant-html-editor.css +1 -1
- package/dist/components/Editor.d.ts +1 -1
- package/dist/components/Editor.d.ts.map +1 -1
- package/dist/components/MultiPageVisualSurface.d.ts.map +1 -1
- package/dist/components/VisualSurface.d.ts.map +1 -1
- package/dist/core/cellProperties.d.ts +2 -0
- package/dist/core/cellProperties.d.ts.map +1 -1
- package/dist/core/commandTypes.d.ts +37 -3
- package/dist/core/commandTypes.d.ts.map +1 -1
- package/dist/core/commands.d.ts.map +1 -1
- package/dist/core/comments/anchors.d.ts +12 -0
- package/dist/core/comments/anchors.d.ts.map +1 -0
- package/dist/core/comments/constants.d.ts +5 -0
- package/dist/core/comments/constants.d.ts.map +1 -0
- package/dist/core/comments/sanitize.d.ts +2 -0
- package/dist/core/comments/sanitize.d.ts.map +1 -0
- package/dist/core/comments/threads.d.ts +6 -0
- package/dist/core/comments/threads.d.ts.map +1 -0
- package/dist/core/customActions.d.ts.map +1 -1
- package/dist/core/flowBreakInsert.d.ts +2 -0
- package/dist/core/flowBreakInsert.d.ts.map +1 -0
- package/dist/core/horizontalRule.d.ts.map +1 -1
- package/dist/core/pageBreak.d.ts +5 -0
- package/dist/core/pageBreak.d.ts.map +1 -0
- package/dist/core/pageCanvasLayout.d.ts +19 -0
- package/dist/core/pageCanvasLayout.d.ts.map +1 -0
- package/dist/core/pageProperties.d.ts.map +1 -1
- package/dist/core/pageZoom.d.ts +9 -0
- package/dist/core/pageZoom.d.ts.map +1 -0
- package/dist/core/paragraphBox.d.ts +11 -0
- package/dist/core/paragraphBox.d.ts.map +1 -1
- package/dist/core/paragraphBreak.d.ts +19 -0
- package/dist/core/paragraphBreak.d.ts.map +1 -0
- package/dist/core/paragraphProperties.d.ts.map +1 -1
- package/dist/core/textAlign.d.ts +2 -0
- package/dist/core/textAlign.d.ts.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/types.d.ts +40 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/icons/CommentIcon.d.ts +3 -0
- package/dist/icons/CommentIcon.d.ts.map +1 -0
- package/dist/icons/CommentsVisibleIcon.d.ts +3 -0
- package/dist/icons/CommentsVisibleIcon.d.ts.map +1 -0
- package/dist/icons/PageBreakIcon.d.ts +3 -0
- package/dist/icons/PageBreakIcon.d.ts.map +1 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6862 -5712
- package/dist/modules/comments/CommentPanel.d.ts +13 -0
- package/dist/modules/comments/CommentPanel.d.ts.map +1 -0
- package/dist/modules/comments/catalog.d.ts +4 -0
- package/dist/modules/comments/catalog.d.ts.map +1 -0
- package/dist/modules/comments/commands.d.ts +4 -0
- package/dist/modules/comments/commands.d.ts.map +1 -0
- package/dist/modules/comments/index.d.ts +4 -0
- package/dist/modules/comments/index.d.ts.map +1 -0
- package/dist/modules/contextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/modules/format/ParagraphPropertiesFields.d.ts.map +1 -1
- package/dist/modules/insert/catalog.d.ts.map +1 -1
- package/dist/modules/insert/commands.d.ts +1 -1
- package/dist/modules/insert/commands.d.ts.map +1 -1
- package/dist/modules/table/CellPropertiesFields.d.ts.map +1 -1
- package/dist/modules/view/catalog.d.ts.map +1 -1
- package/dist/modules/view/commands.d.ts +4 -2
- package/dist/modules/view/commands.d.ts.map +1 -1
- package/dist/modules/view/pageZoomPersistence.d.ts +6 -0
- package/dist/modules/view/pageZoomPersistence.d.ts.map +1 -0
- package/dist/toolbar/EditorToolbar.d.ts +3 -1
- package/dist/toolbar/EditorToolbar.d.ts.map +1 -1
- package/dist/toolbar/IconNav.d.ts +3 -1
- package/dist/toolbar/IconNav.d.ts.map +1 -1
- package/dist/toolbar/MenuBar.d.ts +3 -1
- package/dist/toolbar/MenuBar.d.ts.map +1 -1
- package/dist/toolbar/commentsChrome.d.ts +11 -0
- package/dist/toolbar/commentsChrome.d.ts.map +1 -0
- package/dist/toolbar/defaultLayout.d.ts.map +1 -1
- package/dist/types.d.ts +58 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),Zc=require("react-dom");function Hm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"audio",children:[o.jsx("path",{d:"M9 18V5l12-2v13"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("circle",{cx:"18",cy:"16",r:"3"})]})}function _a({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-center",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M7 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Qc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-justify",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function Ia({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-left",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Fa({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-right",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M10 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function zm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bold",children:[o.jsx("path",{d:"M7 5h6.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 12h7.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 5v14"})]})}function Om({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bookmark",children:o.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v16l-7-4-7 4V5a1 1 0 0 1 1-1z"})})}function eu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bullet-list",children:[o.jsx("path",{d:"M9 6h12"}),o.jsx("path",{d:"M9 12h12"}),o.jsx("path",{d:"M9 18h12"}),o.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"})]})}function Km({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"cell-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("rect",{x:"12.5",y:"4.5",width:"8",height:"7",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function $m({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"clear-formatting",children:[o.jsx("path",{d:"M4 5h12"}),o.jsx("path",{d:"M10 5v8"}),o.jsx("path",{d:"m14 15 6 6"}),o.jsx("path",{d:"m20 15-6 6"})]})}function Me({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"close",children:[o.jsx("path",{d:"M18 6L6 18"}),o.jsx("path",{d:"M6 6l12 12"})]})}function Um({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 616.23 542.09",width:"45",height:"40","aria-hidden":"true","data-icon":"commspliant-shield",children:o.jsxs("g",{transform:"translate(129.79555,688.75474)",children:[o.jsx("path",{fill:"#334E68",d:"m 92.41768,-326.31771 a 0.3,0.3 0 0 1 0.48,0.05 q 5.04,8.55 15.34,22.7 5.5,7.55 11.93,14.77 11.84,13.3 12.69,14.16 11.29,11.41 26.17,23.51 c 4.66,3.79 9.84,8.83 15.07,12.39 18.71,12.72 34.7,23.08 52.84,31.97 q 15.29,7.5 16.67,8.12 5.77,2.59 8.73,3.54 c 1.66,0.54 2.74,-0.25 4.17,-0.93 q 27.98,-13.14 49.38,-25.74 21.15,-12.47 41.94,-29.56 1.28,-1.05 12.72,-11.11 c 11.11,-9.78 22.59,-22.12 30.48,-31.94 q 10.87,-13.52 16.67,-23.55 c 3.7,-6.41 7.66,-12.73 10.29,-18.63 q 9.41,-21.06 13.67,-35.18 8.51,-28.19 9.46,-61.31 0.96,-33.72 0.31,-64.55 -0.09,-4.4 2.81,-7.26 5.42,-5.33 7.5,-7.38 c 6.37,-6.25 11.24,-13.29 18.07,-19.23 q 7.84,-6.84 14.74,-16.11 0.14,-0.19 0.39,-0.15 0.61,0.1 0.52,0.7 -0.37,2.69 -0.35,4.95 c 0.37,45.85 0.81,76.35 -0.95,110.71 q -0.66,12.89 -2.71,28.52 -2.84,21.57 -7.17,36.03 -2.02,6.75 -5.4,17.5 c -5.64,17.94 -13.55,35.09 -23.13,50.9 q -1.72,2.86 -12.91,19.22 c -10.81,15.81 -22.83,29.61 -35.06,41.83 q -4.06,4.07 -17.47,16.38 -9.77,8.98 -18.52,15.14 -19.27,13.56 -32.8,21.84 c -8.27,5.05 -17.73,9.75 -26.22,14.7 q -3.66,2.13 -10.7,5.47 -27.19,12.89 -34.36,16.16 -3.92,1.79 -7.2,0.44 -3.47,-1.43 -11.46,-4.85 c -9.07,-3.89 -16.98,-8.27 -24.9,-11.89 -8.4,-3.84 -18.78,-9.89 -28.06,-15.14 q -43.25,-24.5 -76.54,-56.22 -11.98,-11.41 -24.94,-26.56 -12.76,-14.92 -26.13,-34.48 a 0.43,0.44 56.8 0 1 0.13,-0.61 c 12.12,-7.82 23.12,-17.82 33.81,-29.32 z"}),o.jsx("path",{fill:"#334E68",d:"m -128.82232,-375.77771 a 0.96,0.96 0 0 1 -0.8,-1.51 l 28.86,-41.82 a 3.24,3.2 6.2 0 1 1.45,-1.15 q 0.69,-0.27 3.64,-0.32 15.37,-0.27 46.58,-0.45 12.44,-0.07 19.69,-1.84 c 26.32,-6.42 44.55,-29.39 47.76,-55.67 q 1.05,-8.54 0.87,-20.92 c -0.55,-39.95 0.23,-77.15 -0.1,-117.57 a 0.94,0.95 85.4 0 1 0.81,-0.94 c 35.7,-5.08 70.26,-12.78 104.11,-23.86 q 9.4,-3.07 22.28,-7.05 8.6,-2.65 22.1,-7.58 18.33,-6.69 43.02,-16.74 23.04,-9.38 35.12,-15.34 1.17,-0.58 3.29,0.39 c 14.96,6.81 34.27,13.39 42.79,16.68 q 14.24,5.5 27.59,10.33 23.24,8.41 27.7,10.07 2.01,0.75 9.42,3.41 5.07,1.82 9.47,3.13 40.54,12.1 57.07,16.58 2.54,0.68 4.26,0.82 a 0.48,0.48 0 0 1 0.32,0.79 l -33.68,37.82 a 0.58,0.58 0 0 1 -0.68,0.13 q -3.43,-1.67 -5.84,-2.43 -8.74,-2.79 -47.37,-15.63 -8.92,-2.96 -17.51,-6.16 c -17.92,-6.67 -32.21,-11.74 -65.83,-24.24 -2.89,-1.08 -8.28,-3.56 -11.57,-2.33 -11.44,4.27 -27.67,11.24 -40.6,15.93 q -8.12,2.94 -26.33,9.89 c -21.86,8.35 -43.57,14.34 -67.25,21.47 q -20.07,6.03 -48.78,11.52 a 0.71,0.7 84.6 0 0 -0.57,0.7 q 0.1,95.52 0.1,95.57 c -0.53,30.1 -14.63,58.57 -36,79.25 -10.83,10.49 -23.5,17.98 -37.57,23.68 -10.14,4.1 -18.76,4.57 -31.18,4.79 q -3.1,0.05 -86.64,0.6 z"}),o.jsx("path",{fill:"#C9A227",d:"m 169.86768,-422.45771 q 0.04,-0.4 0.24,-0.59 c 3.41,-3.3 5.96,-6.99 9.56,-10.8 q 10.13,-10.72 15.25,-16.65 2.05,-2.38 5.38,-4.3 a 0.68,0.69 53.4 0 1 0.84,0.12 l 49.51,50.92 a 1.06,1.06 0 0 0 1.52,0 q 17.38,-17.8 26.4,-27.94 c 6.36,-7.14 15.04,-14.76 20.1,-20.56 q 10.29,-11.81 17.14,-18.67 7.41,-7.41 17.44,-18.41 13.85,-15.18 23.56,-24.67 c 3.68,-3.59 5.5,-6.17 8.54,-10.08 2.38,-3.06 4.42,-4.87 8.16,-8.31 6.16,-5.66 10.48,-11.49 16.47,-17.22 6.29,-6.03 12.87,-14.23 18.87,-20.24 q 5.56,-5.56 13.49,-14.45 c 6.79,-7.6 12.13,-13.02 18.46,-19.66 4.83,-5.06 9.88,-11.22 15.21,-16.21 a 1.91,1.91 0 0 1 1.3,-0.51 h 28.15 a 0.83,0.83 0 0 1 0.83,0.82 q 0.28,14.3 0.03,31.53 c -0.07,4.93 -1.9,6.19 -5.19,9.51 -5.86,5.92 -12.79,12.1 -18.21,18.16 q -6.63,7.4 -16.64,16.86 c -2.68,2.53 -6.31,6.91 -8.5,9.17 -8.76,9.01 -14.72,16.05 -22.55,23.36 q -1.37,1.28 -9.09,9.75 -4.93,5.41 -24.32,25.01 c -9.96,10.07 -19.18,20.45 -27.83,28.95 q -11.52,11.33 -20.29,20.96 c -19.16,21.01 -41.14,42.93 -58.64,61.61 q -10.7,11.42 -22.21,22 a 1.97,1.94 24 0 1 -1.38,0.52 q -1.9,-0.06 -3.83,-2.08 c -19.01,-19.93 -45.74,-44.39 -67.08,-67.5 q -5.05,-5.47 -10.42,-9.75 -0.31,-0.24 -0.27,-0.65 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 351.58768,-544.71771 a 0.41,0.41 0 0 1 0.17,0.69 q -15.9,15.29 -29.64,31.76 a 1.16,1.19 33.7 0 1 -1.44,0.3 c -5.87,-3 -10.72,-6.65 -16.97,-10.42 -17.2,-10.37 -38.83,-14.16 -59.18,-13.16 -12.15,0.6 -23.67,3.62 -34.54,8.11 -5.15,2.13 -9.08,4.66 -14.86,8.63 q -14.63,10.05 -22.02,17.75 -6.98,7.27 -17.47,22.45 c -5.11,7.4 -9.03,15.18 -13.55,23.27 q -5.09,9.08 -10.38,20.93 c -4.39,9.81 -8.53,17.45 -13.72,27.5 q -6,11.58 -11.58,19.91 c -6.74,10.09 -11.32,17.91 -17.68,26.12 -4.94,6.38 -10.92,12.4 -15.22,17.55 q -3.48,4.18 -9.33,9.51 c -20.66,18.83 -45.19,33.15 -72.9,38.24 q -15.17,2.79 -26.21,3.08 -22.84,0.6 -52.01,0.23 a 0.29,0.29 0 0 1 -0.24,-0.43 c 6.02,-10.58 11.85,-19.61 23.29,-37.61 q 2.27,-3.58 5.02,-6.38 a 3.39,3.4 24.3 0 1 2.63,-1 q 16.4,1.07 32.77,-1.23 c 15.39,-2.16 29.33,-7.66 42.1,-15.59 q 4.42,-2.75 14.17,-10.6 3.58,-2.89 14.27,-14.03 6.08,-6.33 9.69,-12.1 c 3.25,-5.19 7.59,-10.59 11.55,-17.24 q 16.77,-28.19 29.52,-56.84 c 4.49,-10.08 8.7,-16.87 15.5,-28.37 q 5.49,-9.29 14.18,-21.09 5.94,-8.07 12.61,-14.76 12.65,-12.7 13.8,-13.72 5.51,-4.84 19.01,-13.66 49.89,-32.59 109.07,-20.31 7.95,1.65 15.41,4.34 14.58,5.25 20.68,8.05 c 10.41,4.78 21.11,12.36 31.15,19.28 a 2.65,2.62 70.1 0 0 0.78,0.37 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 143.16768,-394.65771 q 0.46,0.11 0.45,0.6 -0.03,2.2 0.62,4.89 2.72,11.27 9.81,22.88 7.25,11.89 15.4,22.7 c 4.71,6.26 10.61,13.06 17.11,18.9 9.38,8.42 15.79,14.58 25.02,21.29 q 13.29,9.65 15.1,10.72 10.62,6.29 20.67,12.58 1.94,1.22 4,1.86 a 2.56,2.59 42.2 0 0 1.81,-0.1 c 7.1,-3.08 12.92,-6.7 21.76,-11.78 q 6.63,-3.81 11.42,-7.45 c 4.56,-3.47 9.98,-6.63 14.83,-10.52 q 18.45,-14.82 32.58,-32 6.8,-8.28 11.17,-16.16 c 7.76,-14.01 13.11,-25.52 16.26,-40.82 1.49,-7.23 1.56,-11.99 2.41,-21.26 a 3.66,3.67 70 0 1 1.06,-2.26 q 9.34,-9.27 20.72,-20.12 c 6.47,-6.15 12.23,-13.51 18.33,-19.07 a 0.67,0.67 0 0 1 1.11,0.43 q 1.92,19.96 1.77,37.52 -0.18,19.95 -4.43,40.76 -3.4,16.65 -11.34,32.24 -0.55,1.09 -4.75,9.06 -3,5.69 -5.08,8.85 c -9.56,14.55 -19.75,27.73 -31.99,39.39 q -7.6,7.24 -9.98,9.35 -10.58,9.37 -24.17,18.04 c -4.91,3.14 -9.19,7.11 -13.77,9.89 q -24.03,14.58 -42.68,23.19 -3.32,1.53 -8.02,-0.31 -1.97,-0.78 -11.41,-5.19 c -8.92,-4.17 -16.04,-8.65 -24.58,-13.03 q -6.75,-3.47 -13.06,-7.8 -18.87,-12.96 -21.03,-14.68 -15.47,-12.4 -29.21,-26.05 -5.39,-5.35 -13.86,-16.13 -6.45,-8.2 -14.56,-19.38 c -3.42,-4.72 -6.19,-10.2 -9.49,-14.45 a 1.33,1.32 44.2 0 1 -0.03,-1.59 c 5.8,-7.95 10.64,-13.7 15.23,-21.14 q 8.66,-14.03 14.39,-23.68 a 0.38,0.39 23.4 0 1 0.41,-0.17 z"})]})})}function Wm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"custom-action",children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("path",{d:"M9 8.5c0-1 .7-1.5 1.5-1.5S12 7.5 12 8.5c0 1.2-3 1.2-3 3.2"}),o.jsx("path",{d:"M10.5 14v.5"}),o.jsx("path",{d:"M15 10v4"}),o.jsx("path",{d:"M13 12h4"})]})}function Gm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"custom-css",children:[o.jsx("path",{d:"M8 6h12"}),o.jsx("path",{d:"M8 12h12"}),o.jsx("path",{d:"M8 18h8"}),o.jsx("path",{d:"M4 6h.01"}),o.jsx("path",{d:"M4 12h.01"}),o.jsx("path",{d:"M4 18h.01"})]})}function Vm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"customize-toolbar",children:[o.jsx("rect",{x:"3",y:"4",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"14",y:"4",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"3",y:"13",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"14",y:"13",width:"7",height:"7",rx:"1"})]})}function qm({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"dark-mode",children:o.jsx("path",{d:"M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z"})})}function tu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-color",children:[o.jsx("path",{d:"M6 18L12 4l6 14"}),o.jsx("path",{d:"M8.5 13h7"})]})}function Ym({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-family",children:[o.jsx("path",{d:"M4 18L9 6l5 12"}),o.jsx("path",{d:"M6.2 13h5.6"}),o.jsx("path",{d:"M16 18V9"}),o.jsx("path",{d:"M16 9h5"})]})}function Xm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-properties",children:[o.jsx("path",{d:"M4 20h4"}),o.jsx("path",{d:"M6 20V6"}),o.jsx("path",{d:"M4 6h4"}),o.jsx("path",{d:"M12 20V9"}),o.jsx("path",{d:"M12 9h8"}),o.jsx("path",{d:"M16 9v11"})]})}function Jm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-size",children:[o.jsx("path",{d:"M4 18V8h3"}),o.jsx("path",{d:"M4 8h8"}),o.jsx("path",{d:"M10 8v10"}),o.jsx("path",{d:"M16 18V12h2"}),o.jsx("path",{d:"M16 12h5"}),o.jsx("path",{d:"M19 12v6"})]})}function Zm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"format-brush",children:[o.jsx("path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08"}),o.jsx("path",{d:"M7.07 14.94c-1.66 0-3 1.34-3 3v2.06h2.06c1.66 0 3-1.34 3-3v-2.06Z"}),o.jsx("path",{d:"M7.07 14.94 4.01 18"})]})}function Qm({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"fullscreen",children:[o.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),o.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),o.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),o.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})}function nu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"highlight-color",children:[o.jsx("path",{d:"M15.5 4.5l4 4-9 9H6.5v-4.5z"}),o.jsx("path",{d:"M13.5 6.5l4 4"}),o.jsx("path",{d:"M4 20h8"})]})}function ef({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"horizontalRule",children:o.jsx("path",{d:"M4 12h16"})})}function tf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"html",children:[o.jsx("path",{d:"M8 8l-4 4 4 4"}),o.jsx("path",{d:"M16 8l4 4-4 4"})]})}function ru({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"image",children:[o.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),o.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),o.jsx("path",{d:"m21 15-4.5-4.5L7 20"})]})}function nf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"indent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M4 9l4 3-4 3"})]})}function rf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"italic",children:[o.jsx("path",{d:"M10 4h9"}),o.jsx("path",{d:"M5 20h9"}),o.jsx("path",{d:"M14 4L8 20"})]})}function of({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"light-mode",children:[o.jsx("circle",{cx:"12",cy:"12",r:"4"}),o.jsx("path",{d:"M12 2v2"}),o.jsx("path",{d:"M12 20v2"}),o.jsx("path",{d:"M4.93 4.93l1.41 1.41"}),o.jsx("path",{d:"M17.66 17.66l1.41 1.41"}),o.jsx("path",{d:"M2 12h2"}),o.jsx("path",{d:"M20 12h2"}),o.jsx("path",{d:"M4.93 19.07l1.41-1.41"}),o.jsx("path",{d:"M17.66 6.34l1.41-1.41"})]})}function af({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"link",children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function lf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"menu",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function sf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"merge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h5"}),o.jsx("path",{d:"M16 12h5"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M9 9l3 3-3 3"}),o.jsx("path",{d:"M15 9l-3 3 3 3"})]})}function ou({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"numbered-list",children:[o.jsx("path",{d:"M10 6h11"}),o.jsx("path",{d:"M10 12h11"}),o.jsx("path",{d:"M10 18h11"}),o.jsx("path",{d:"M4 5v3h2"}),o.jsx("path",{d:"M4 11h2l-2 2h2"}),o.jsx("path",{d:"M4 19h2"}),o.jsx("path",{d:"M4 17h2v2"})]})}function cf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"open",children:[o.jsx("path",{d:"M3 7h6l2 2h10v3"}),o.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}function uf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"outdent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M8 9l-4 3 4 3"})]})}function iu({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"page-properties",children:[o.jsx("path",{d:"M6 3h8l6 6v12H6z"}),o.jsx("path",{d:"M14 3v6h6"})]})}function df({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"paragraph-properties",children:[o.jsx("path",{d:"M13 4H9a4 4 0 0 0 0 8h2"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("path",{d:"M11 4v16"})]})}function mf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"preview",children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("path",{d:"M14 2v6h6"}),o.jsx("path",{d:"M8 13h8"}),o.jsx("path",{d:"M8 17h5"})]})}function ff({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"paragraph-style",children:[o.jsx("path",{d:"M5 6h14"}),o.jsx("path",{d:"M5 10h10"}),o.jsx("path",{d:"M5 14h14"}),o.jsx("path",{d:"M5 18h8"})]})}function pf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"plus",children:[o.jsx("path",{d:"M12 5v14"}),o.jsx("path",{d:"M5 12h14"})]})}function gf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"print",children:[o.jsx("path",{d:"M6 9V3h12v6"}),o.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M6 14h12v8H6z"})]})}function hf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"read-aloud",children:[o.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),o.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function bf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"redo",children:[o.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),o.jsx("path",{d:"M17 6l4 4-4 4"})]})}function yf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"row-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function xf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"save",children:[o.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),o.jsx("path",{d:"M15 3v6H9V3"}),o.jsx("path",{d:"M8 21v-7h8v7"})]})}function Ki({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-column",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("rect",{x:"9.5",y:"5",width:"5",height:"14",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Ws({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"})]})}function $i({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-row",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"4",y:"10.5",width:"16",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function wf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"strikethrough",children:[o.jsx("path",{d:"M6 7.5C6 5.5 8 4 12 4s6 1.5 6 3.5-1.8 2.8-6 3.5"}),o.jsx("path",{d:"M6 16.5C6 18.5 8 20 12 20s6-1.5 6-3.5c0-1-.5-1.8-1.8-2.5"}),o.jsx("path",{d:"M4 12h16"})]})}function Cf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"underline",children:[o.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),o.jsx("path",{d:"M5 20h14"})]})}function Sf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"undo",children:[o.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),o.jsx("path",{d:"M7 6L3 10l4 4"})]})}function vf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"unmerge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M9 9l-3 3 3 3"}),o.jsx("path",{d:"M15 9l3 3-3 3"})]})}function kf({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"visual",children:[o.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Af({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"youtube",children:[o.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3"}),o.jsx("path",{d:"m10 9 6 3-6 3V9Z",fill:"currentColor",stroke:"none"})]})}const pe="---";function Tt(e){return e===pe}function er(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Ba=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","insertPage","visual","html","customizeToolbar","toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom","lightMode","darkMode","preview","readAloud","fullscreen","bold","italic","underline","strikethrough","clearFormatting","formatBrush","fontSize","fontFamily","paragraphStyle","fontProperties","customCss","paragraphProperties","pageProperties","imageProperties","fontColor","highlightColor","alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","bulletList","numberedList","table","insertRowBelow","insertRowBefore","deleteRow","insertColumnAfter","insertColumnBefore","deleteColumn","mergeCells","unmergeCells","tableProperties","cellProperties","rowProperties"]),Df=new Set(["file","edit","insert","table","view","format"]),au="custom",lu="custom";function su(e){return`custom:${e}`}function Pf(e){return e==="menu"||e==="both"}function jf(e){return e==="toolbar"||e==="both"}function cu(e){return e.map(t=>er(t)?{submenu:t.submenu,items:cu(t.items)}:t)}function Ef(e){return{menus:e.menus.map(t=>({id:t.id,items:cu(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function uu(e){return Tt(e)?!0:er(e)?e.items.every(uu):Ba.has(e)}function du(e,t){for(const n of e)if(n===t||er(n)&&du(n.items,t))return!0;return!1}function Rf(e){const t=e.tooltip??e.label;return{id:e.id,command:su(e.id),icon:e.icon??Wm,label:e.label,ariaLabel:e.label,tooltip:t}}function Tf(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Df.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===au&&!r)e.menus[n]={id:n,labelKey:"menuCustom",ariaKey:"menuCustomAria"};else{const i=r??n;e.menus[n]={id:n,label:i,ariaLabel:i}}t.menus.some(i=>i.id===n)||t.menus.push({id:n,items:[]})}function Nf(e,t,n){if(e.groups[n]||(n===lu?e.groups[n]={id:n,labelKey:"toolbarGroupCustom"}:e.groups[n]={id:n,label:n}),!t.iconGroups.some(r=>r.id===n)){const r={id:n,items:[]},i=t.iconGroups.findIndex(a=>a.items.includes("fullscreen"));i===-1?t.iconGroups.push(r):t.iconGroups.splice(i,0,r)}}function Mf(e,t,n){var a,l;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},i=Ef(n);for(const u of e??[])if(!(Ba.has(u.id)||Tt(u.id))){if(r.items[u.id]=Rf(u),Pf(u.showIn)){const m=((a=u.menu)==null?void 0:a.id)??au;Tf(r,i,m,(l=u.menu)==null?void 0:l.label);const p=i.menus.find(g=>g.id===m);if(p&&!du(p.items,u.id)){const g=p.items[p.items.length-1];g!==void 0&&!Tt(g)&&p.items.every(uu)&&p.items.push(pe),p.items.push(u.id)}}if(jf(u.showIn)){const m=u.toolbarGroup??lu;Nf(r,i,m);const p=i.iconGroups.find(g=>g.id===m);p&&!p.items.includes(u.id)&&p.items.push(u.id)}}return{catalog:r,layout:i}}function Lf(e,t){const n={};for(const r of e??[])Ba.has(r.id)||Tt(r.id)||(n[su(r.id)]=()=>r.onAction(t()));return n}function _f(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const If="_chrome_boy0f_1",Ff={chrome:If},mu=s.createContext(!1);function Bf({dark:e,children:t}){return o.jsx(mu.Provider,{value:e,children:t})}function Hf(){return s.useContext(mu)}function la(e){return{className:Ff.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function ae({children:e}){const t=Hf(),n=la(t);return Zc.createPortal(o.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function Ha(e,t){const n=e[t];n==null||n()}const za={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Switch to visual mode",modeHtmlAria:"Switch to HTML mode",modeFullscreen:"Full screen",modeFullscreenAria:"Toggle full screen",modeLight:"Light mode",modeLightAria:"Switch to light mode",modeDark:"Dark mode",modeDarkAria:"Switch to dark mode",exitFullscreenAria:"Exit full screen",visualEditorAria:"Visual editor",htmlEditorAria:"HTML editor",menuFile:"File",menuFileAria:"File menu",menuEdit:"Edit",menuEditAria:"Edit menu",menuInsert:"Insert",menuInsertAria:"Insert menu",menuView:"View",menuViewAria:"View menu",menuFormat:"Format",menuFormatAria:"Format menu",menuFont:"Fonts",menuFontAria:"Fonts submenu",menuParagraph:"Paragraph",menuParagraphAria:"Paragraph submenu",menuParagraphStyles:"Paragraph styles",menuParagraphStylesAria:"Paragraph styles submenu",menuPage:"Page",menuPageAria:"Page submenu",menuToolbar:"Toolbar",menuToolbarAria:"Toolbar submenu",menuToolbarPosition:"Position",menuToolbarPositionAria:"Toolbar position submenu",toolbarPositionTop:"Top",toolbarPositionTopAria:"Dock toolbar at the top",toolbarPositionLeft:"Left",toolbarPositionLeftAria:"Dock toolbar on the left",toolbarPositionRight:"Right",toolbarPositionRightAria:"Dock toolbar on the right",toolbarPositionBottom:"Bottom",toolbarPositionBottomAria:"Dock toolbar at the bottom",menuImage:"Image",menuImageAria:"Image properties",menuInsertRow:"Row",menuInsertRowAria:"Insert or delete row",menuInsertColumn:"Column",menuInsertColumnAria:"Insert or delete column",menuTable:"Table",menuTableAria:"Table menu",menuCustom:"Custom",menuCustomAria:"Custom menu",menuHamburgerAria:"Open menu",menuCloseAria:"Close menu",menuOverlayAria:"Editor menu",brandMarkAria:"CommsPliant HTML editor",commandSave:"Save",commandSaveAria:"Save as HTML file",commandOpen:"Open",commandOpenAria:"Open HTML file",htmlFileDropOverlay:"Drop HTML file to open",commandPrint:"Print",commandPrintAria:"Print document",commandUndo:"Undo",commandUndoAria:"Undo",commandRedo:"Redo",commandRedoAria:"Redo",commandCut:"Cut",commandCutAria:"Cut",commandCopy:"Copy",commandCopyAria:"Copy",commandDelete:"Delete",commandDeleteAria:"Delete",commandLink:"Link",commandLinkAria:"Link",commandBookmark:"Bookmark",commandBookmarkAria:"Bookmark",commandImage:"Image",commandImageAria:"Insert image",commandAudio:"Audio",commandAudioAria:"Insert audio",commandYoutube:"YouTube video",commandYoutubeAria:"Insert YouTube video",commandImageProperties:"Image properties…",commandImagePropertiesAria:"Image properties",commandTable:"Table",commandTableAria:"Insert table",commandHorizontalRule:"Horizontal line",commandHorizontalRuleAria:"Insert horizontal line",commandInsertPage:"Page",commandInsertPageAria:"Insert new page",commandTableProperties:"Table properties…",commandTablePropertiesAria:"Table properties",commandCellProperties:"Cell properties…",commandCellPropertiesAria:"Cell properties",commandRowProperties:"Row properties…",commandRowPropertiesAria:"Row properties",commandInsertRowBelow:"Add below",commandInsertRowBelowAria:"Add row below",commandInsertRowBefore:"Add before",commandInsertRowBeforeAria:"Add row before",commandDeleteRow:"Delete",commandDeleteRowAria:"Delete row",commandInsertColumnAfter:"Add after",commandInsertColumnAfterAria:"Add column after",commandInsertColumnBefore:"Add before",commandInsertColumnBeforeAria:"Add column before",commandDeleteColumn:"Delete",commandDeleteColumnAria:"Delete column",commandMergeCells:"Merge cells",commandMergeCellsAria:"Merge selected cells",commandUnmergeCells:"Unmerge cells",commandUnmergeCellsAria:"Split merged cells",contextMenuAria:"Editor context menu",commandBold:"Bold",commandBoldAria:"Bold",commandItalic:"Italic",commandItalicAria:"Italic",commandUnderline:"Underline",commandUnderlineAria:"Underline",commandStrikethrough:"Strikethrough",commandStrikethroughAria:"Strikethrough",commandClearFormatting:"Reset formatting",commandClearFormattingAria:"Reset formatting",commandFormatBrush:"Format brush",commandFormatBrushAria:"Copy formatting",commandFontSize:"Font size",commandFontSizeAria:"Font size",commandFontSizeUnitAria:"Font size unit",commandFontFamily:"Font",commandFontFamilyAria:"Font family",commandFontProperties:"Font properties…",commandFontPropertiesAria:"Font properties",commandCustomCss:"Custom CSS",commandCustomCssAria:"Custom CSS",commandParagraphProperties:"Paragraph properties…",commandParagraphPropertiesAria:"Paragraph properties",commandPageProperties:"Page properties…",commandPagePropertiesAria:"Page properties",commandFontColor:"Font color",commandFontColorAria:"Font color",commandHighlightColor:"Highlight color",commandHighlightColorAria:"Highlight color",commandParagraphStyle:"Styles",commandParagraphStyleAria:"Paragraph styles",commandAlignLeft:"Align left",commandAlignLeftAria:"Align left",commandAlignCenter:"Align center",commandAlignCenterAria:"Align center",commandAlignRight:"Align right",commandAlignRightAria:"Align right",commandAlignJustify:"Justify",commandAlignJustifyAria:"Justify",commandIndent:"Increase indent",commandIndentAria:"Increase indent",commandOutdent:"Decrease indent",commandOutdentAria:"Decrease indent",commandBulletList:"Bullet list",commandBulletListAria:"Bullet list",commandNumberedList:"Numbered list",commandNumberedListAria:"Numbered list",commandCustomizeToolbar:"Customize toolbar",commandCustomizeToolbarAria:"Customize toolbar",commandPreview:"Preview",commandPreviewAria:"Preview document",commandReadAloud:"Read aloud",commandReadAloudAria:"Read selection or document aloud",styleParagraph:"Paragraph",styleHeading1:"Heading 1",styleHeading2:"Heading 2",styleHeading3:"Heading 3",styleHeading4:"Heading 4",styleHeading5:"Heading 5",styleHeading6:"Heading 6",styleAddNew:"Add new",styleAddNewAria:"Add new paragraph style",customStyleDialogAddTitle:"Add paragraph style",customStyleDialogEditTitle:"Edit paragraph style",customStyleDialogTabFont:"Font",customStyleDialogTabParagraph:"Paragraph",customStyleDialogName:"Name",customStyleDialogDelete:"Delete",customStyleDialogDeleteConfirm:"Delete this paragraph style?",customStyleDialogCloseAria:"Close",customStyleLoading:"Loading paragraph styles",colorAutomatic:"Automatic",colorNone:"No color",colorCustom:"Custom color",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Pick from screen",colorRecent:"Recent colors",fontDialogTitle:"Font properties",fontDialogTabGeneral:"General",fontDialogFamily:"Font",fontFamilyDefault:"Default",fontDialogSize:"Size",fontDialogUnit:"Unit",fontDialogStyle:"Style",fontDialogOk:"OK",fontDialogCancel:"Cancel",linkDialogTitle:"Insert link",linkDialogTabLink:"Link",linkDialogTabBookmark:"Bookmark",linkDialogHref:"URL",linkDialogHoverTitle:"Title",linkDialogTargetBlank:"Open in a new tab",linkDialogTextDecorationNone:"No underline",linkDialogHover:"On hover",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Hover color",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"Custom hover HTML",linkDialogBookmark:"Bookmark",linkDialogBookmarkEmpty:"No bookmarks in this document.",linkDialogSelect:"Select",bookmarkDialogTitle:"Insert bookmark",bookmarkDialogName:"Bookmark name",bookmarkDialogHelp:"Start with a letter. Use only letters, numbers, hyphens, and underscores. Must be unique in the document.",bookmarkDialogHelpAria:"Bookmark name format",bookmarkDialogCloseAria:"Close",bookmarkDialogErrorEmpty:"Enter a bookmark name.",bookmarkDialogErrorInvalid:"Start with a letter. Use only letters, numbers, hyphens, and underscores.",bookmarkDialogErrorDuplicate:"A bookmark with this name already exists.",customCssDialogTitle:"Custom CSS",customCssDialogField:"CSS",customCssDialogFieldAria:"Custom CSS declarations",customCssDialogCloseAria:"Close",imageDialogTitle:"Insert image",imageDialogSource:"Source",imageDialogFile:"File",imageDialogChooseFile:"Choose file",imageDialogUrl:"Image URL",imageDialogAlt:"Alt text",imageDialogTitleField:"Title",imageDialogCloseAria:"Close",imageDialogErrorEmpty:"Choose a file or enter an image URL.",imageDialogErrorInvalid:"Enter a valid image URL.",imageDialogErrorType:"Use a JPEG, PNG, GIF, WebP, BMP, or AVIF image.",imageDialogErrorTooLarge:"Choose an image smaller than 2 MB.",audioDialogTitle:"Insert audio",audioDialogSource:"Source",audioDialogFile:"File",audioDialogChooseFile:"Choose file",audioDialogUrl:"Audio URL",audioDialogTitleField:"Title",audioDialogCloseAria:"Close",audioDialogErrorEmpty:"Choose a file or enter an audio URL.",audioDialogErrorInvalid:"Enter a valid audio URL.",audioDialogErrorType:"Use an MP3, WAV, OGG, AAC, WebM, or M4A audio file.",audioDialogErrorTooLarge:"Choose an audio file smaller than 5 MB.",youtubeDialogTitle:"Insert YouTube video",youtubeDialogUrl:"YouTube URL",youtubeDialogTitleField:"Title",youtubeDialogCloseAria:"Close",youtubeDialogErrorEmpty:"Enter a YouTube URL.",youtubeDialogErrorInvalid:"Enter a valid YouTube URL.",imagePropertiesDialogTitle:"Image properties",imagePropertiesDialogCloseAria:"Close",imagePropertiesTabAlignment:"Alignment",imagePropertiesTabBorder:"Border & margin",imagePropertiesTabAdvanced:"Advanced",imagePropertiesTabHover:"Hover",imagePropertiesSize:"Size",imagePropertiesSizeMode:"Size mode",imagePropertiesSizeWidth:"Width only",imagePropertiesSizeHeight:"Height only",imagePropertiesSizeLock:"Lock together",imagePropertiesWidth:"Width",imagePropertiesHeight:"Height",imagePropertiesWidthAria:"Image width",imagePropertiesHeightAria:"Image height",imagePropertiesSizeUnitAria:"Image size unit",imagePropertiesFit:"Fit",imagePropertiesFitDefault:"Default",imagePropertiesFitFill:"Fill",imagePropertiesFitContain:"Contain",imagePropertiesFitCover:"Cover",imagePropertiesFitNoneValue:"None",imagePropertiesFitScaleDown:"Scale down",imagePropertiesPosition:"Position",imagePropertiesPositionDefault:"Default",imagePropertiesPositionCenter:"Center",imagePropertiesPositionTop:"Top",imagePropertiesPositionBottom:"Bottom",imagePropertiesPositionLeft:"Left",imagePropertiesPositionRight:"Right",imagePropertiesPositionTopLeft:"Top left",imagePropertiesPositionTopRight:"Top right",imagePropertiesPositionBottomLeft:"Bottom left",imagePropertiesPositionBottomRight:"Bottom right",imagePropertiesRotation:"Rotation",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"Hover CSS",imagePropertiesHoverCssAria:"Custom hover CSS",imagePropertiesHoverHelp:"CSS applied when the pointer is over the image.",imageResizeHandleEastAria:"Resize image width, keep aspect ratio",imageResizeHandleSouthAria:"Resize image height, keep aspect ratio",imageResizeHandleSouthEastAria:"Resize image freely",tableDialogTitle:"Insert table",tableDialogCloseAria:"Close",tableDialogRows:"Rows",tableDialogColumns:"Columns",tableDialogSize:"Size",tableDialogGridAria:"Table size grid",tableDialogInsert:"Insert",tablePropertiesDialogTitle:"Table properties",tablePropertiesDialogCloseAria:"Close",tablePropertiesCollapse:"Border collapse",tablePropertiesCollapseCollapse:"Collapse",tablePropertiesCollapseSeparate:"Separate",tablePropertiesSpacing:"Border spacing",tablePropertiesWidth:"Width",cellPropertiesDialogTitle:"Cell properties",cellPropertiesDialogCloseAria:"Close",cellPropertiesColor:"Text color",cellPropertiesVerticalAlign:"Vertical align",cellPropertiesVerticalAlignDefault:"Default",cellPropertiesVerticalAlignTop:"Top",cellPropertiesVerticalAlignMiddle:"Middle",cellPropertiesVerticalAlignBottom:"Bottom",cellPropertiesVerticalAlignBaseline:"Baseline",cellPropertiesWidth:"Width",cellPropertiesColSpan:"Column span",cellPropertiesRowSpan:"Row span",rowPropertiesDialogTitle:"Row properties",rowPropertiesDialogCloseAria:"Close",rowPropertiesHeight:"Height",paragraphDialogTitle:"Paragraph properties",pageDialogTitle:"Page properties",pageDialogTabBackgroundImage:"Background Image",pageDialogTabPrint:"Print",pageAtRuleSize:"Page size",pageAtRuleSizeAuto:"Auto",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Letter",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Custom",pageAtRuleWidth:"Width",pageAtRuleHeight:"Height",pageAtRuleOrientation:"Orientation",pageAtRuleOrientationNone:"Default",pageAtRuleOrientationPortrait:"Portrait",pageAtRuleOrientationLandscape:"Landscape",pageAtRuleMargins:"Page margins",pageAtRuleReset:"Reset print settings",pageAtRuleResetAria:"Remove @page print settings from this page",pageBackgroundImagePreview:"Preview",pageBackgroundImagePreviewAlt:"Page background image preview",pageBackgroundImageClear:"Remove background image",pageBackgroundImageCurrent:"Image selected",paragraphDialogTabBorder:"Border",paragraphDialogTabBackground:"Background",paragraphDialogAlignment:"Alignment",paragraphDialogLists:"Lists",paragraphDialogSpacing:"Spacing",paragraphDialogMargin:"Margin",paragraphDialogPadding:"Padding",paragraphDialogLineHeight:"Line height",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Same on all sides",paragraphDialogSideTop:"Top",paragraphDialogSideRight:"Right",paragraphDialogSideBottom:"Bottom",paragraphDialogSideLeft:"Left",paragraphDialogBorder:"Border",paragraphDialogBorderStyle:"Style",paragraphDialogBorderWidth:"Width",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Corner radius",paragraphDialogBoxShadow:"Box shadow",paragraphDialogShadowOffsetX:"Offset X",paragraphDialogShadowOffsetY:"Offset Y",paragraphDialogShadowBlur:"Blur",paragraphDialogShadowSpread:"Spread",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Inset",paragraphDialogLengthUnitAria:"Unit",paragraphDialogBorderStyleNone:"None",paragraphDialogBorderStyleSolid:"Solid",paragraphDialogBorderStyleDotted:"Dotted",paragraphDialogBorderStyleDashed:"Dashed",paragraphDialogBorderStyleDouble:"Double",paragraphDialogBorderStyleGroove:"Groove",paragraphDialogBorderStyleRidge:"Ridge",paragraphDialogBorderStyleInset:"Inset",paragraphDialogBorderStyleOutset:"Outset",paragraphDialogBackgroundColor:"Background color",paragraphDialogOpacity:"Opacity",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Formatting toolbar",toolbarGroupFile:"File",toolbarGroupPrint:"Print",toolbarGroupEdit:"Edit",toolbarGroupInsert:"Insert",toolbarGroupTable:"Table",toolbarGroupFont:"Fonts",toolbarGroupAlign:"Align",toolbarGroupParagraph:"Paragraph",toolbarGroupView:"View",toolbarGroupFullscreen:"Full screen",toolbarGroupCustom:"Custom",customizeToolbarDialogTitle:"Customize toolbar",customizeToolbarDialogReset:"Reset",customizeToolbarDialogClose:"Close",customizeToolbarDialogCloseAria:"Close",customizeToolbarDialogLoading:"Loading toolbar settings",customizeToolbarItemVisible:"Show on toolbar",customizeToolbarDragHandle:"Drag to reorder group",customizeToolbarMoveUp:"Move group up",customizeToolbarMoveDown:"Move group down",previewDialogTitle:"Document preview",previewDialogClose:"Close",previewDialogCloseAria:"Close"},zf={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Cambiar al modo visual",modeHtmlAria:"Cambiar al modo HTML",modeFullscreen:"Pantalla completa",modeFullscreenAria:"Activar o desactivar pantalla completa",modeLight:"Modo claro",modeLightAria:"Cambiar al modo claro",modeDark:"Modo oscuro",modeDarkAria:"Cambiar al modo oscuro",exitFullscreenAria:"Salir de pantalla completa",visualEditorAria:"Editor visual",htmlEditorAria:"Editor HTML",menuFile:"Archivo",menuFileAria:"Menú Archivo",menuEdit:"Editar",menuEditAria:"Menú Editar",menuInsert:"Insertar",menuInsertAria:"Menú Insertar",menuView:"Vista",menuViewAria:"Menú Vista",menuFormat:"Formato",menuFormatAria:"Menú Formato",menuFont:"Fuentes",menuFontAria:"Submenú Fuentes",menuParagraph:"Párrafo",menuParagraphAria:"Submenú Párrafo",menuParagraphStyles:"Estilos de párrafo",menuParagraphStylesAria:"Submenú Estilos de párrafo",menuPage:"Página",menuPageAria:"Submenú Página",menuToolbar:"Barra de herramientas",menuToolbarAria:"Submenú Barra de herramientas",menuToolbarPosition:"Posición",menuToolbarPositionAria:"Submenú Posición de la barra de herramientas",toolbarPositionTop:"Arriba",toolbarPositionTopAria:"Acoplar la barra de herramientas arriba",toolbarPositionLeft:"Izquierda",toolbarPositionLeftAria:"Acoplar la barra de herramientas a la izquierda",toolbarPositionRight:"Derecha",toolbarPositionRightAria:"Acoplar la barra de herramientas a la derecha",toolbarPositionBottom:"Abajo",toolbarPositionBottomAria:"Acoplar la barra de herramientas abajo",menuImage:"Imagen",menuImageAria:"Propiedades de imagen",menuInsertRow:"Fila",menuInsertRowAria:"Insertar o eliminar fila",menuInsertColumn:"Columna",menuInsertColumnAria:"Insertar o eliminar columna",menuTable:"Tabla",menuTableAria:"Menú Tabla",menuCustom:"Personalizado",menuCustomAria:"Menú personalizado",menuHamburgerAria:"Abrir menú",menuCloseAria:"Cerrar menú",menuOverlayAria:"Menú del editor",brandMarkAria:"Editor HTML de CommsPliant",commandSave:"Guardar",commandSaveAria:"Guardar como archivo HTML",commandOpen:"Abrir",commandOpenAria:"Abrir archivo HTML",htmlFileDropOverlay:"Suelte un archivo HTML para abrirlo",commandPrint:"Imprimir",commandPrintAria:"Imprimir documento",commandUndo:"Deshacer",commandUndoAria:"Deshacer",commandRedo:"Rehacer",commandRedoAria:"Rehacer",commandCut:"Cortar",commandCutAria:"Cortar",commandCopy:"Copiar",commandCopyAria:"Copiar",commandDelete:"Eliminar",commandDeleteAria:"Eliminar",commandLink:"Enlace",commandLinkAria:"Enlace",commandBookmark:"Marcador",commandBookmarkAria:"Marcador",commandImage:"Imagen",commandImageAria:"Insertar imagen",commandAudio:"Audio",commandAudioAria:"Insertar audio",commandYoutube:"Vídeo de YouTube",commandYoutubeAria:"Insertar vídeo de YouTube",commandImageProperties:"Propiedades de imagen…",commandImagePropertiesAria:"Propiedades de imagen",commandTable:"Tabla",commandTableAria:"Insertar tabla",commandHorizontalRule:"Línea horizontal",commandHorizontalRuleAria:"Insertar línea horizontal",commandInsertPage:"Página",commandInsertPageAria:"Insertar página nueva",commandTableProperties:"Propiedades de tabla…",commandTablePropertiesAria:"Propiedades de tabla",commandCellProperties:"Propiedades de celda…",commandCellPropertiesAria:"Propiedades de celda",commandRowProperties:"Propiedades de fila…",commandRowPropertiesAria:"Propiedades de fila",commandInsertRowBelow:"Añadir debajo",commandInsertRowBelowAria:"Añadir fila debajo",commandInsertRowBefore:"Añadir antes",commandInsertRowBeforeAria:"Añadir fila antes",commandDeleteRow:"Eliminar",commandDeleteRowAria:"Eliminar fila",commandInsertColumnAfter:"Añadir después",commandInsertColumnAfterAria:"Añadir columna después",commandInsertColumnBefore:"Añadir antes",commandInsertColumnBeforeAria:"Añadir columna antes",commandDeleteColumn:"Eliminar",commandDeleteColumnAria:"Eliminar columna",commandMergeCells:"Combinar celdas",commandMergeCellsAria:"Combinar las celdas seleccionadas",commandUnmergeCells:"Separar celdas",commandUnmergeCellsAria:"Dividir las celdas combinadas",contextMenuAria:"Menú contextual del editor",commandBold:"Negrita",commandBoldAria:"Negrita",commandItalic:"Cursiva",commandItalicAria:"Cursiva",commandUnderline:"Subrayado",commandUnderlineAria:"Subrayado",commandStrikethrough:"Tachado",commandStrikethroughAria:"Tachado",commandClearFormatting:"Restablecer formato",commandClearFormattingAria:"Restablecer formato",commandFormatBrush:"Copiar formato",commandFormatBrushAria:"Copiar formato",commandFontSize:"Tamaño de fuente",commandFontSizeAria:"Tamaño de fuente",commandFontSizeUnitAria:"Unidad de tamaño de fuente",commandFontFamily:"Fuente",commandFontFamilyAria:"Familia tipográfica",commandFontProperties:"Propiedades de fuente…",commandFontPropertiesAria:"Propiedades de fuente",commandCustomCss:"CSS personalizado",commandCustomCssAria:"CSS personalizado",commandParagraphProperties:"Propiedades de párrafo…",commandParagraphPropertiesAria:"Propiedades de párrafo",commandPageProperties:"Propiedades de página…",commandPagePropertiesAria:"Propiedades de página",commandFontColor:"Color de fuente",commandFontColorAria:"Color de fuente",commandHighlightColor:"Color de resaltado",commandHighlightColorAria:"Color de resaltado",commandParagraphStyle:"Estilos",commandParagraphStyleAria:"Estilos de párrafo",commandAlignLeft:"Alinear a la izquierda",commandAlignLeftAria:"Alinear a la izquierda",commandAlignCenter:"Alinear al centro",commandAlignCenterAria:"Alinear al centro",commandAlignRight:"Alinear a la derecha",commandAlignRightAria:"Alinear a la derecha",commandAlignJustify:"Justificar",commandAlignJustifyAria:"Justificar",commandIndent:"Aumentar sangría",commandIndentAria:"Aumentar sangría",commandOutdent:"Disminuir sangría",commandOutdentAria:"Disminuir sangría",commandBulletList:"Lista con viñetas",commandBulletListAria:"Lista con viñetas",commandNumberedList:"Lista numerada",commandNumberedListAria:"Lista numerada",commandCustomizeToolbar:"Personalizar barra de herramientas",commandCustomizeToolbarAria:"Personalizar barra de herramientas",commandPreview:"Vista previa",commandPreviewAria:"Vista previa del documento",commandReadAloud:"Leer en voz alta",commandReadAloudAria:"Leer la selección o el documento en voz alta",styleParagraph:"Párrafo",styleHeading1:"Encabezado 1",styleHeading2:"Encabezado 2",styleHeading3:"Encabezado 3",styleHeading4:"Encabezado 4",styleHeading5:"Encabezado 5",styleHeading6:"Encabezado 6",styleAddNew:"Añadir nuevo",styleAddNewAria:"Añadir un estilo de párrafo",customStyleDialogAddTitle:"Añadir estilo de párrafo",customStyleDialogEditTitle:"Editar estilo de párrafo",customStyleDialogTabFont:"Fuente",customStyleDialogTabParagraph:"Párrafo",customStyleDialogName:"Nombre",customStyleDialogDelete:"Eliminar",customStyleDialogDeleteConfirm:"¿Eliminar este estilo de párrafo?",customStyleDialogCloseAria:"Cerrar",customStyleLoading:"Cargando estilos de párrafo",colorAutomatic:"Automático",colorNone:"Sin color",colorCustom:"Color personalizado",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Seleccionar de la pantalla",colorRecent:"Colores recientes",fontDialogTitle:"Propiedades de fuente",fontDialogTabGeneral:"General",fontDialogFamily:"Fuente",fontFamilyDefault:"Predeterminada",fontDialogSize:"Tamaño",fontDialogUnit:"Unidad",fontDialogStyle:"Estilo",fontDialogOk:"Aceptar",fontDialogCancel:"Cancelar",linkDialogTitle:"Insertar enlace",linkDialogTabLink:"Enlace",linkDialogTabBookmark:"Marcador",linkDialogHref:"URL",linkDialogHoverTitle:"Título",linkDialogTargetBlank:"Abrir en una pestaña nueva",linkDialogTextDecorationNone:"Sin subrayado",linkDialogHover:"Al pasar el cursor",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Color al pasar el cursor",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"HTML personalizado al pasar el cursor",linkDialogBookmark:"Marcador",linkDialogBookmarkEmpty:"No hay marcadores en este documento.",linkDialogSelect:"Seleccionar",bookmarkDialogTitle:"Insertar marcador",bookmarkDialogName:"Nombre del marcador",bookmarkDialogHelp:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos. Debe ser único en el documento.",bookmarkDialogHelpAria:"Formato del nombre del marcador",bookmarkDialogCloseAria:"Cerrar",bookmarkDialogErrorEmpty:"Introduce un nombre de marcador.",bookmarkDialogErrorInvalid:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos.",bookmarkDialogErrorDuplicate:"Ya existe un marcador con este nombre.",customCssDialogTitle:"CSS personalizado",customCssDialogField:"CSS",customCssDialogFieldAria:"Declaraciones CSS personalizadas",customCssDialogCloseAria:"Cerrar",imageDialogTitle:"Insertar imagen",imageDialogSource:"Origen",imageDialogFile:"Archivo",imageDialogChooseFile:"Elegir archivo",imageDialogUrl:"URL de la imagen",imageDialogAlt:"Texto alternativo",imageDialogTitleField:"Título",imageDialogCloseAria:"Cerrar",imageDialogErrorEmpty:"Elige un archivo o introduce una URL de imagen.",imageDialogErrorInvalid:"Introduce una URL de imagen válida.",imageDialogErrorType:"Usa una imagen JPEG, PNG, GIF, WebP, BMP o AVIF.",imageDialogErrorTooLarge:"Elige una imagen de menos de 2 MB.",audioDialogTitle:"Insertar audio",audioDialogSource:"Origen",audioDialogFile:"Archivo",audioDialogChooseFile:"Elegir archivo",audioDialogUrl:"URL del audio",audioDialogTitleField:"Título",audioDialogCloseAria:"Cerrar",audioDialogErrorEmpty:"Elige un archivo o introduce una URL de audio.",audioDialogErrorInvalid:"Introduce una URL de audio válida.",audioDialogErrorType:"Usa un archivo de audio MP3, WAV, OGG, AAC, WebM o M4A.",audioDialogErrorTooLarge:"Elige un archivo de audio de menos de 5 MB.",youtubeDialogTitle:"Insertar vídeo de YouTube",youtubeDialogUrl:"URL de YouTube",youtubeDialogTitleField:"Título",youtubeDialogCloseAria:"Cerrar",youtubeDialogErrorEmpty:"Introduce una URL de YouTube.",youtubeDialogErrorInvalid:"Introduce una URL de YouTube válida.",imagePropertiesDialogTitle:"Propiedades de imagen",imagePropertiesDialogCloseAria:"Cerrar",imagePropertiesTabAlignment:"Alineación",imagePropertiesTabBorder:"Borde y margen",imagePropertiesTabAdvanced:"Avanzado",imagePropertiesTabHover:"Al pasar el puntero",imagePropertiesSize:"Tamaño",imagePropertiesSizeMode:"Modo de tamaño",imagePropertiesSizeWidth:"Solo ancho",imagePropertiesSizeHeight:"Solo alto",imagePropertiesSizeLock:"Bloquear juntos",imagePropertiesWidth:"Ancho",imagePropertiesHeight:"Alto",imagePropertiesWidthAria:"Ancho de la imagen",imagePropertiesHeightAria:"Alto de la imagen",imagePropertiesSizeUnitAria:"Unidad de tamaño de imagen",imagePropertiesFit:"Ajuste",imagePropertiesFitDefault:"Predeterminado",imagePropertiesFitFill:"Rellenar",imagePropertiesFitContain:"Contener",imagePropertiesFitCover:"Cubrir",imagePropertiesFitNoneValue:"Ninguno",imagePropertiesFitScaleDown:"Reducir",imagePropertiesPosition:"Posición",imagePropertiesPositionDefault:"Predeterminada",imagePropertiesPositionCenter:"Centro",imagePropertiesPositionTop:"Arriba",imagePropertiesPositionBottom:"Abajo",imagePropertiesPositionLeft:"Izquierda",imagePropertiesPositionRight:"Derecha",imagePropertiesPositionTopLeft:"Arriba izquierda",imagePropertiesPositionTopRight:"Arriba derecha",imagePropertiesPositionBottomLeft:"Abajo izquierda",imagePropertiesPositionBottomRight:"Abajo derecha",imagePropertiesRotation:"Rotación",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"CSS al pasar el puntero",imagePropertiesHoverCssAria:"CSS personalizado al pasar el puntero",imagePropertiesHoverHelp:"CSS que se aplica cuando el puntero está sobre la imagen.",imageResizeHandleEastAria:"Redimensionar el ancho de la imagen, mantener la proporción",imageResizeHandleSouthAria:"Redimensionar el alto de la imagen, mantener la proporción",imageResizeHandleSouthEastAria:"Redimensionar la imagen sin mantener la proporción",tableDialogTitle:"Insertar tabla",tableDialogCloseAria:"Cerrar",tableDialogRows:"Filas",tableDialogColumns:"Columnas",tableDialogSize:"Tamaño",tableDialogGridAria:"Cuadrícula de tamaño de tabla",tableDialogInsert:"Insertar",tablePropertiesDialogTitle:"Propiedades de tabla",tablePropertiesDialogCloseAria:"Cerrar",tablePropertiesCollapse:"Contracción de bordes",tablePropertiesCollapseCollapse:"Contraídos",tablePropertiesCollapseSeparate:"Separados",tablePropertiesSpacing:"Espaciado de bordes",tablePropertiesWidth:"Ancho",cellPropertiesDialogTitle:"Propiedades de celda",cellPropertiesDialogCloseAria:"Cerrar",cellPropertiesColor:"Color de texto",cellPropertiesVerticalAlign:"Alineación vertical",cellPropertiesVerticalAlignDefault:"Predeterminada",cellPropertiesVerticalAlignTop:"Arriba",cellPropertiesVerticalAlignMiddle:"Centro",cellPropertiesVerticalAlignBottom:"Abajo",cellPropertiesVerticalAlignBaseline:"Línea base",cellPropertiesWidth:"Ancho",cellPropertiesColSpan:"Columnas",cellPropertiesRowSpan:"Filas",rowPropertiesDialogTitle:"Propiedades de fila",rowPropertiesDialogCloseAria:"Cerrar",rowPropertiesHeight:"Alto",paragraphDialogTitle:"Propiedades de párrafo",pageDialogTitle:"Propiedades de página",pageDialogTabBackgroundImage:"Imagen de fondo",pageDialogTabPrint:"Impresión",pageAtRuleSize:"Tamaño de página",pageAtRuleSizeAuto:"Automático",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Carta",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Personalizado",pageAtRuleWidth:"Ancho",pageAtRuleHeight:"Alto",pageAtRuleOrientation:"Orientación",pageAtRuleOrientationNone:"Predeterminada",pageAtRuleOrientationPortrait:"Vertical",pageAtRuleOrientationLandscape:"Horizontal",pageAtRuleMargins:"Márgenes de página",pageAtRuleReset:"Restablecer impresión",pageAtRuleResetAria:"Quitar la configuración @page de impresión de esta página",pageBackgroundImagePreview:"Vista previa",pageBackgroundImagePreviewAlt:"Vista previa de la imagen de fondo de página",pageBackgroundImageClear:"Quitar imagen de fondo",pageBackgroundImageCurrent:"Imagen seleccionada",paragraphDialogTabBorder:"Borde",paragraphDialogTabBackground:"Fondo",paragraphDialogAlignment:"Alineación",paragraphDialogLists:"Listas",paragraphDialogSpacing:"Espaciado",paragraphDialogMargin:"Margen",paragraphDialogPadding:"Relleno",paragraphDialogLineHeight:"Interlineado",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Igual en todos los lados",paragraphDialogSideTop:"Superior",paragraphDialogSideRight:"Derecho",paragraphDialogSideBottom:"Inferior",paragraphDialogSideLeft:"Izquierdo",paragraphDialogBorder:"Borde",paragraphDialogBorderStyle:"Estilo",paragraphDialogBorderWidth:"Grosor",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Radio de esquina",paragraphDialogBoxShadow:"Sombra",paragraphDialogShadowOffsetX:"Desplazamiento X",paragraphDialogShadowOffsetY:"Desplazamiento Y",paragraphDialogShadowBlur:"Desenfoque",paragraphDialogShadowSpread:"Extensión",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Interior",paragraphDialogLengthUnitAria:"Unidad",paragraphDialogBorderStyleNone:"Ninguno",paragraphDialogBorderStyleSolid:"Sólido",paragraphDialogBorderStyleDotted:"Punteado",paragraphDialogBorderStyleDashed:"Discontinuo",paragraphDialogBorderStyleDouble:"Doble",paragraphDialogBorderStyleGroove:"Surco",paragraphDialogBorderStyleRidge:"Relieve",paragraphDialogBorderStyleInset:"Hundido",paragraphDialogBorderStyleOutset:"Saliente",paragraphDialogBackgroundColor:"Color de fondo",paragraphDialogOpacity:"Opacidad",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Barra de herramientas",toolbarGroupFile:"Archivo",toolbarGroupPrint:"Imprimir",toolbarGroupEdit:"Editar",toolbarGroupInsert:"Insertar",toolbarGroupTable:"Tabla",toolbarGroupFont:"Fuentes",toolbarGroupAlign:"Alinear",toolbarGroupParagraph:"Párrafo",toolbarGroupView:"Vista",toolbarGroupFullscreen:"Pantalla completa",toolbarGroupCustom:"Personalizado",customizeToolbarDialogTitle:"Personalizar barra de herramientas",customizeToolbarDialogReset:"Restablecer",customizeToolbarDialogClose:"Cerrar",customizeToolbarDialogCloseAria:"Cerrar",customizeToolbarDialogLoading:"Cargando la configuración de la barra",customizeToolbarItemVisible:"Mostrar en la barra",customizeToolbarDragHandle:"Arrastrar para reordenar el grupo",customizeToolbarMoveUp:"Mover el grupo hacia arriba",customizeToolbarMoveDown:"Mover el grupo hacia abajo",previewDialogTitle:"Vista previa del documento",previewDialogClose:"Cerrar",previewDialogCloseAria:"Cerrar"},Of={en:za,es:zf},fu=s.createContext(e=>za[e]);function Kf({locale:e="en",children:t}){const n=s.useMemo(()=>{const r=Of[e]??za;return i=>r[i]},[e]);return o.jsx(fu.Provider,{value:n,children:t})}function U(){return s.useContext(fu)}const $f="_menu_labh4_1",Uf="_item_labh4_17",Wf="_separator_labh4_57",Ui={menu:$f,item:Uf,separator:Wf},$r=8,Gf=[{type:"item",command:"deleteSelection",labelKey:"commandDelete",ariaKey:"commandDeleteAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"cut",labelKey:"commandCut",ariaKey:"commandCutAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"copy",labelKey:"commandCopy",ariaKey:"commandCopyAria",enabled:e=>e==="text"||e==="image"},{type:"separator"},{type:"item",command:"openLinkDialog",labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:e=>e!=="image"},{type:"separator"},{type:"item",command:"openFontProperties",labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openParagraphProperties",labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openImageProperties",labelKey:"commandImageProperties",ariaKey:"commandImagePropertiesAria",enabled:e=>e==="image"},{type:"item",command:"openTableProperties",labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"openCellProperties",labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"openRowProperties",labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"mergeCells",labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:(e,t)=>t.canMergeCells},{type:"item",command:"unmergeCells",labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:(e,t)=>t.canUnmergeCells}];function Gs(){return'[role="menuitem"]:not(:disabled)'}function Vf({open:e,x:t,y:n,kind:r,inTable:i=!1,canMergeCells:a=!1,canUnmergeCells:l=!1,commands:u,onClose:m}){const p=U(),g=s.useId(),h=s.useRef(null);if(s.useLayoutEffect(()=>{var C;if(!e)return;const b=h.current;if(!b)return;const x=b.getBoundingClientRect(),y=Math.max($r,Math.min(t,window.innerWidth-x.width-$r)),S=Math.max($r,Math.min(n,window.innerHeight-x.height-$r));b.style.left=`${y}px`,b.style.top=`${S}px`,(C=b.querySelector(Gs()))==null||C.focus()},[e,t,n,r]),s.useEffect(()=>{if(!e)return;const b=C=>{var A;(A=h.current)!=null&&A.contains(C.target)||m()},x=C=>{C.key==="Escape"&&(C.preventDefault(),C.stopPropagation(),m())},y=()=>{m()},S=C=>{var A;if((A=h.current)!=null&&A.contains(C.target)){C.preventDefault();return}C.defaultPrevented||m()};return document.addEventListener("pointerdown",b),document.addEventListener("keydown",x,!0),window.addEventListener("scroll",y,!0),document.addEventListener("contextmenu",S),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",x,!0),window.removeEventListener("scroll",y,!0),document.removeEventListener("contextmenu",S)}},[e,m]),!e)return null;const w=b=>{var A;if(b.key!=="ArrowDown"&&b.key!=="ArrowUp")return;const x=[...((A=h.current)==null?void 0:A.querySelectorAll(Gs()))??[]];if(x.length===0)return;const y=x.indexOf(document.activeElement),S=b.key==="ArrowDown"?1:-1,C=x[(y+S+x.length)%x.length];b.preventDefault(),C==null||C.focus()};return o.jsx(ae,{children:o.jsxs("div",{ref:h,className:Ui.menu,role:"menu","aria-labelledby":g,style:{left:t,top:n},onMouseDown:b=>b.preventDefault(),onKeyDown:w,children:[o.jsx("span",{id:g,hidden:!0,children:p("contextMenuAria")}),Gf.map((b,x)=>{if(b.type==="separator")return o.jsx("div",{role:"separator",className:Ui.separator},`separator-${x}`);const y=b.enabled(r,{inTable:i,canMergeCells:a,canUnmergeCells:l});return o.jsx("button",{type:"button",role:"menuitem",className:Ui.item,"aria-label":p(b.ariaKey),disabled:!y,onClick:()=>{y&&(m(),Ha(u,b.command))},children:p(b.labelKey)},b.command)})]})})}function qf(e){return e==="touch"||e==="pen"}function Yf(e,t){return e.button===2||e.ctrlKey?!0:!qf(t)}const Xn="data-page",co="data-page-bg",uo="commspliant-background";function ct(e){return e instanceof HTMLElement&&(e.id===uo||e.hasAttribute(co))}function Xf(e){return e.hasAttribute(Xn)&&e.parentElement?e.parentElement:e}function Oa(e){const t=Xf(e),n=new Set,r=[],i=a=>{a instanceof HTMLElement&&ct(a)&&!n.has(a)&&(n.add(a),r.push(a))};i(t.querySelector(`#${uo}`));for(const a of t.querySelectorAll(`[${co}]`))i(a);return i(t),r}function Ka(e){return Oa(e)[0]??null}function io(e){let t=!1;return e.style.width!=="100%"&&(e.style.width="100%",t=!0),e.style.height!=="100%"&&(e.style.height="100%",t=!0),t}function pu(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(Xn)}function gu(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function Jf(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function tr(e){return gu(e).find(n=>n.hasAttribute(Xn))??null}function Zf(e){if(Jf(e))return null;const t=gu(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||ct(n)?null:n}function Qf(e){const t=tr(e);if(t)return io(t),t;const n=Zf(e);if(n)return n.setAttribute(Xn,""),io(n),n;const r=document.createElement("div");for(r.setAttribute(Xn,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),io(r),r}function $a(e){return tr(e)??e}const Vs=["background-color","background-image","background-size","background-position","background-repeat","opacity"];function qs(e,t,n){const r=(t==null?void 0:t.style.getPropertyValue(n).trim())??"";r?e.style.setProperty(n,r):e.style.removeProperty(n)}function Po(e){const t=tr(e),n=t?Ka(t):null;if(qs(e,t,"background-color"),n)for(const r of Vs)r!=="background-color"&&qs(e,n,r);else for(const r of Vs)r!=="background-color"&&e.style.removeProperty(r)}const mo="<!-- wysiwyg-page-separator -->",sa="data-page-surface";function xt(e){const t=e.trim();return t?t.includes(mo)?e.split(mo).map(n=>n.trim()):[e]:[""]}function lt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
|
|
2
|
-
${
|
|
3
|
-
`)}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("react"),xl=require("react-dom");function cp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"audio",children:[o.jsx("path",{d:"M9 18V5l12-2v13"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("circle",{cx:"18",cy:"16",r:"3"})]})}function Jo({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-center",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M7 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function nd({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-justify",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function Qo({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-left",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function ei({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"align-right",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M10 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function up({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bold",children:[o.jsx("path",{d:"M7 5h6.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 12h7.5a3.5 3.5 0 0 1 0 7H7z"}),o.jsx("path",{d:"M7 5v14"})]})}function dp({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bookmark",children:o.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v16l-7-4-7 4V5a1 1 0 0 1 1-1z"})})}function rd({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"bullet-list",children:[o.jsx("path",{d:"M9 6h12"}),o.jsx("path",{d:"M9 12h12"}),o.jsx("path",{d:"M9 18h12"}),o.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"})]})}function mp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"cell-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("rect",{x:"12.5",y:"4.5",width:"8",height:"7",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function fp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"clear-formatting",children:[o.jsx("path",{d:"M4 5h12"}),o.jsx("path",{d:"M10 5v8"}),o.jsx("path",{d:"m14 15 6 6"}),o.jsx("path",{d:"m20 15-6 6"})]})}function _e({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"close",children:[o.jsx("path",{d:"M18 6L6 18"}),o.jsx("path",{d:"M6 6l12 12"})]})}function Ic({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"comment",children:o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"})})}function pp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"comments-visible",children:[o.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"}),o.jsx("path",{d:"M8 9h8M8 13h5"})]})}function gp({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 616.23 542.09",width:"45",height:"40","aria-hidden":"true","data-icon":"commspliant-shield",children:o.jsxs("g",{transform:"translate(129.79555,688.75474)",children:[o.jsx("path",{fill:"#334E68",d:"m 92.41768,-326.31771 a 0.3,0.3 0 0 1 0.48,0.05 q 5.04,8.55 15.34,22.7 5.5,7.55 11.93,14.77 11.84,13.3 12.69,14.16 11.29,11.41 26.17,23.51 c 4.66,3.79 9.84,8.83 15.07,12.39 18.71,12.72 34.7,23.08 52.84,31.97 q 15.29,7.5 16.67,8.12 5.77,2.59 8.73,3.54 c 1.66,0.54 2.74,-0.25 4.17,-0.93 q 27.98,-13.14 49.38,-25.74 21.15,-12.47 41.94,-29.56 1.28,-1.05 12.72,-11.11 c 11.11,-9.78 22.59,-22.12 30.48,-31.94 q 10.87,-13.52 16.67,-23.55 c 3.7,-6.41 7.66,-12.73 10.29,-18.63 q 9.41,-21.06 13.67,-35.18 8.51,-28.19 9.46,-61.31 0.96,-33.72 0.31,-64.55 -0.09,-4.4 2.81,-7.26 5.42,-5.33 7.5,-7.38 c 6.37,-6.25 11.24,-13.29 18.07,-19.23 q 7.84,-6.84 14.74,-16.11 0.14,-0.19 0.39,-0.15 0.61,0.1 0.52,0.7 -0.37,2.69 -0.35,4.95 c 0.37,45.85 0.81,76.35 -0.95,110.71 q -0.66,12.89 -2.71,28.52 -2.84,21.57 -7.17,36.03 -2.02,6.75 -5.4,17.5 c -5.64,17.94 -13.55,35.09 -23.13,50.9 q -1.72,2.86 -12.91,19.22 c -10.81,15.81 -22.83,29.61 -35.06,41.83 q -4.06,4.07 -17.47,16.38 -9.77,8.98 -18.52,15.14 -19.27,13.56 -32.8,21.84 c -8.27,5.05 -17.73,9.75 -26.22,14.7 q -3.66,2.13 -10.7,5.47 -27.19,12.89 -34.36,16.16 -3.92,1.79 -7.2,0.44 -3.47,-1.43 -11.46,-4.85 c -9.07,-3.89 -16.98,-8.27 -24.9,-11.89 -8.4,-3.84 -18.78,-9.89 -28.06,-15.14 q -43.25,-24.5 -76.54,-56.22 -11.98,-11.41 -24.94,-26.56 -12.76,-14.92 -26.13,-34.48 a 0.43,0.44 56.8 0 1 0.13,-0.61 c 12.12,-7.82 23.12,-17.82 33.81,-29.32 z"}),o.jsx("path",{fill:"#334E68",d:"m -128.82232,-375.77771 a 0.96,0.96 0 0 1 -0.8,-1.51 l 28.86,-41.82 a 3.24,3.2 6.2 0 1 1.45,-1.15 q 0.69,-0.27 3.64,-0.32 15.37,-0.27 46.58,-0.45 12.44,-0.07 19.69,-1.84 c 26.32,-6.42 44.55,-29.39 47.76,-55.67 q 1.05,-8.54 0.87,-20.92 c -0.55,-39.95 0.23,-77.15 -0.1,-117.57 a 0.94,0.95 85.4 0 1 0.81,-0.94 c 35.7,-5.08 70.26,-12.78 104.11,-23.86 q 9.4,-3.07 22.28,-7.05 8.6,-2.65 22.1,-7.58 18.33,-6.69 43.02,-16.74 23.04,-9.38 35.12,-15.34 1.17,-0.58 3.29,0.39 c 14.96,6.81 34.27,13.39 42.79,16.68 q 14.24,5.5 27.59,10.33 23.24,8.41 27.7,10.07 2.01,0.75 9.42,3.41 5.07,1.82 9.47,3.13 40.54,12.1 57.07,16.58 2.54,0.68 4.26,0.82 a 0.48,0.48 0 0 1 0.32,0.79 l -33.68,37.82 a 0.58,0.58 0 0 1 -0.68,0.13 q -3.43,-1.67 -5.84,-2.43 -8.74,-2.79 -47.37,-15.63 -8.92,-2.96 -17.51,-6.16 c -17.92,-6.67 -32.21,-11.74 -65.83,-24.24 -2.89,-1.08 -8.28,-3.56 -11.57,-2.33 -11.44,4.27 -27.67,11.24 -40.6,15.93 q -8.12,2.94 -26.33,9.89 c -21.86,8.35 -43.57,14.34 -67.25,21.47 q -20.07,6.03 -48.78,11.52 a 0.71,0.7 84.6 0 0 -0.57,0.7 q 0.1,95.52 0.1,95.57 c -0.53,30.1 -14.63,58.57 -36,79.25 -10.83,10.49 -23.5,17.98 -37.57,23.68 -10.14,4.1 -18.76,4.57 -31.18,4.79 q -3.1,0.05 -86.64,0.6 z"}),o.jsx("path",{fill:"#C9A227",d:"m 169.86768,-422.45771 q 0.04,-0.4 0.24,-0.59 c 3.41,-3.3 5.96,-6.99 9.56,-10.8 q 10.13,-10.72 15.25,-16.65 2.05,-2.38 5.38,-4.3 a 0.68,0.69 53.4 0 1 0.84,0.12 l 49.51,50.92 a 1.06,1.06 0 0 0 1.52,0 q 17.38,-17.8 26.4,-27.94 c 6.36,-7.14 15.04,-14.76 20.1,-20.56 q 10.29,-11.81 17.14,-18.67 7.41,-7.41 17.44,-18.41 13.85,-15.18 23.56,-24.67 c 3.68,-3.59 5.5,-6.17 8.54,-10.08 2.38,-3.06 4.42,-4.87 8.16,-8.31 6.16,-5.66 10.48,-11.49 16.47,-17.22 6.29,-6.03 12.87,-14.23 18.87,-20.24 q 5.56,-5.56 13.49,-14.45 c 6.79,-7.6 12.13,-13.02 18.46,-19.66 4.83,-5.06 9.88,-11.22 15.21,-16.21 a 1.91,1.91 0 0 1 1.3,-0.51 h 28.15 a 0.83,0.83 0 0 1 0.83,0.82 q 0.28,14.3 0.03,31.53 c -0.07,4.93 -1.9,6.19 -5.19,9.51 -5.86,5.92 -12.79,12.1 -18.21,18.16 q -6.63,7.4 -16.64,16.86 c -2.68,2.53 -6.31,6.91 -8.5,9.17 -8.76,9.01 -14.72,16.05 -22.55,23.36 q -1.37,1.28 -9.09,9.75 -4.93,5.41 -24.32,25.01 c -9.96,10.07 -19.18,20.45 -27.83,28.95 q -11.52,11.33 -20.29,20.96 c -19.16,21.01 -41.14,42.93 -58.64,61.61 q -10.7,11.42 -22.21,22 a 1.97,1.94 24 0 1 -1.38,0.52 q -1.9,-0.06 -3.83,-2.08 c -19.01,-19.93 -45.74,-44.39 -67.08,-67.5 q -5.05,-5.47 -10.42,-9.75 -0.31,-0.24 -0.27,-0.65 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 351.58768,-544.71771 a 0.41,0.41 0 0 1 0.17,0.69 q -15.9,15.29 -29.64,31.76 a 1.16,1.19 33.7 0 1 -1.44,0.3 c -5.87,-3 -10.72,-6.65 -16.97,-10.42 -17.2,-10.37 -38.83,-14.16 -59.18,-13.16 -12.15,0.6 -23.67,3.62 -34.54,8.11 -5.15,2.13 -9.08,4.66 -14.86,8.63 q -14.63,10.05 -22.02,17.75 -6.98,7.27 -17.47,22.45 c -5.11,7.4 -9.03,15.18 -13.55,23.27 q -5.09,9.08 -10.38,20.93 c -4.39,9.81 -8.53,17.45 -13.72,27.5 q -6,11.58 -11.58,19.91 c -6.74,10.09 -11.32,17.91 -17.68,26.12 -4.94,6.38 -10.92,12.4 -15.22,17.55 q -3.48,4.18 -9.33,9.51 c -20.66,18.83 -45.19,33.15 -72.9,38.24 q -15.17,2.79 -26.21,3.08 -22.84,0.6 -52.01,0.23 a 0.29,0.29 0 0 1 -0.24,-0.43 c 6.02,-10.58 11.85,-19.61 23.29,-37.61 q 2.27,-3.58 5.02,-6.38 a 3.39,3.4 24.3 0 1 2.63,-1 q 16.4,1.07 32.77,-1.23 c 15.39,-2.16 29.33,-7.66 42.1,-15.59 q 4.42,-2.75 14.17,-10.6 3.58,-2.89 14.27,-14.03 6.08,-6.33 9.69,-12.1 c 3.25,-5.19 7.59,-10.59 11.55,-17.24 q 16.77,-28.19 29.52,-56.84 c 4.49,-10.08 8.7,-16.87 15.5,-28.37 q 5.49,-9.29 14.18,-21.09 5.94,-8.07 12.61,-14.76 12.65,-12.7 13.8,-13.72 5.51,-4.84 19.01,-13.66 49.89,-32.59 109.07,-20.31 7.95,1.65 15.41,4.34 14.58,5.25 20.68,8.05 c 10.41,4.78 21.11,12.36 31.15,19.28 a 2.65,2.62 70.1 0 0 0.78,0.37 z"}),o.jsx("path",{fill:"#5B7B9C",d:"m 143.16768,-394.65771 q 0.46,0.11 0.45,0.6 -0.03,2.2 0.62,4.89 2.72,11.27 9.81,22.88 7.25,11.89 15.4,22.7 c 4.71,6.26 10.61,13.06 17.11,18.9 9.38,8.42 15.79,14.58 25.02,21.29 q 13.29,9.65 15.1,10.72 10.62,6.29 20.67,12.58 1.94,1.22 4,1.86 a 2.56,2.59 42.2 0 0 1.81,-0.1 c 7.1,-3.08 12.92,-6.7 21.76,-11.78 q 6.63,-3.81 11.42,-7.45 c 4.56,-3.47 9.98,-6.63 14.83,-10.52 q 18.45,-14.82 32.58,-32 6.8,-8.28 11.17,-16.16 c 7.76,-14.01 13.11,-25.52 16.26,-40.82 1.49,-7.23 1.56,-11.99 2.41,-21.26 a 3.66,3.67 70 0 1 1.06,-2.26 q 9.34,-9.27 20.72,-20.12 c 6.47,-6.15 12.23,-13.51 18.33,-19.07 a 0.67,0.67 0 0 1 1.11,0.43 q 1.92,19.96 1.77,37.52 -0.18,19.95 -4.43,40.76 -3.4,16.65 -11.34,32.24 -0.55,1.09 -4.75,9.06 -3,5.69 -5.08,8.85 c -9.56,14.55 -19.75,27.73 -31.99,39.39 q -7.6,7.24 -9.98,9.35 -10.58,9.37 -24.17,18.04 c -4.91,3.14 -9.19,7.11 -13.77,9.89 q -24.03,14.58 -42.68,23.19 -3.32,1.53 -8.02,-0.31 -1.97,-0.78 -11.41,-5.19 c -8.92,-4.17 -16.04,-8.65 -24.58,-13.03 q -6.75,-3.47 -13.06,-7.8 -18.87,-12.96 -21.03,-14.68 -15.47,-12.4 -29.21,-26.05 -5.39,-5.35 -13.86,-16.13 -6.45,-8.2 -14.56,-19.38 c -3.42,-4.72 -6.19,-10.2 -9.49,-14.45 a 1.33,1.32 44.2 0 1 -0.03,-1.59 c 5.8,-7.95 10.64,-13.7 15.23,-21.14 q 8.66,-14.03 14.39,-23.68 a 0.38,0.39 23.4 0 1 0.41,-0.17 z"})]})})}function hp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"custom-action",children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("path",{d:"M9 8.5c0-1 .7-1.5 1.5-1.5S12 7.5 12 8.5c0 1.2-3 1.2-3 3.2"}),o.jsx("path",{d:"M10.5 14v.5"}),o.jsx("path",{d:"M15 10v4"}),o.jsx("path",{d:"M13 12h4"})]})}function bp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"custom-css",children:[o.jsx("path",{d:"M8 6h12"}),o.jsx("path",{d:"M8 12h12"}),o.jsx("path",{d:"M8 18h8"}),o.jsx("path",{d:"M4 6h.01"}),o.jsx("path",{d:"M4 12h.01"}),o.jsx("path",{d:"M4 18h.01"})]})}function yp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"customize-toolbar",children:[o.jsx("rect",{x:"3",y:"4",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"14",y:"4",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"3",y:"13",width:"7",height:"7",rx:"1"}),o.jsx("rect",{x:"14",y:"13",width:"7",height:"7",rx:"1"})]})}function xp({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"dark-mode",children:o.jsx("path",{d:"M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z"})})}function od({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-color",children:[o.jsx("path",{d:"M6 18L12 4l6 14"}),o.jsx("path",{d:"M8.5 13h7"})]})}function Cp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-family",children:[o.jsx("path",{d:"M4 18L9 6l5 12"}),o.jsx("path",{d:"M6.2 13h5.6"}),o.jsx("path",{d:"M16 18V9"}),o.jsx("path",{d:"M16 9h5"})]})}function wp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-properties",children:[o.jsx("path",{d:"M4 20h4"}),o.jsx("path",{d:"M6 20V6"}),o.jsx("path",{d:"M4 6h4"}),o.jsx("path",{d:"M12 20V9"}),o.jsx("path",{d:"M12 9h8"}),o.jsx("path",{d:"M16 9v11"})]})}function vp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"font-size",children:[o.jsx("path",{d:"M4 18V8h3"}),o.jsx("path",{d:"M4 8h8"}),o.jsx("path",{d:"M10 8v10"}),o.jsx("path",{d:"M16 18V12h2"}),o.jsx("path",{d:"M16 12h5"}),o.jsx("path",{d:"M19 12v6"})]})}function Sp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"format-brush",children:[o.jsx("path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08"}),o.jsx("path",{d:"M7.07 14.94c-1.66 0-3 1.34-3 3v2.06h2.06c1.66 0 3-1.34 3-3v-2.06Z"}),o.jsx("path",{d:"M7.07 14.94 4.01 18"})]})}function kp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"fullscreen",children:[o.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),o.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),o.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),o.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})}function id({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"highlight-color",children:[o.jsx("path",{d:"M15.5 4.5l4 4-9 9H6.5v-4.5z"}),o.jsx("path",{d:"M13.5 6.5l4 4"}),o.jsx("path",{d:"M4 20h8"})]})}function Ap({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"horizontalRule",children:o.jsx("path",{d:"M4 12h16"})})}function Pp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"html",children:[o.jsx("path",{d:"M8 8l-4 4 4 4"}),o.jsx("path",{d:"M16 8l4 4-4 4"})]})}function ad({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"image",children:[o.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),o.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),o.jsx("path",{d:"m21 15-4.5-4.5L7 20"})]})}function Dp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"indent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M4 9l4 3-4 3"})]})}function jp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"italic",children:[o.jsx("path",{d:"M10 4h9"}),o.jsx("path",{d:"M5 20h9"}),o.jsx("path",{d:"M14 4L8 20"})]})}function Ep({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"light-mode",children:[o.jsx("circle",{cx:"12",cy:"12",r:"4"}),o.jsx("path",{d:"M12 2v2"}),o.jsx("path",{d:"M12 20v2"}),o.jsx("path",{d:"M4.93 4.93l1.41 1.41"}),o.jsx("path",{d:"M17.66 17.66l1.41 1.41"}),o.jsx("path",{d:"M2 12h2"}),o.jsx("path",{d:"M20 12h2"}),o.jsx("path",{d:"M4.93 19.07l1.41-1.41"}),o.jsx("path",{d:"M17.66 6.34l1.41-1.41"})]})}function Rp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"link",children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function Tp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"menu",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}function Np({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"merge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 12h5"}),o.jsx("path",{d:"M16 12h5"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M9 9l3 3-3 3"}),o.jsx("path",{d:"M15 9l-3 3 3 3"})]})}function ld({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"numbered-list",children:[o.jsx("path",{d:"M10 6h11"}),o.jsx("path",{d:"M10 12h11"}),o.jsx("path",{d:"M10 18h11"}),o.jsx("path",{d:"M4 5v3h2"}),o.jsx("path",{d:"M4 11h2l-2 2h2"}),o.jsx("path",{d:"M4 19h2"}),o.jsx("path",{d:"M4 17h2v2"})]})}function Mp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"open",children:[o.jsx("path",{d:"M3 7h6l2 2h10v3"}),o.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}function _p({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"outdent",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M12 12h8"}),o.jsx("path",{d:"M4 18h16"}),o.jsx("path",{d:"M8 9l-4 3 4 3"})]})}function Lp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"pageBreak",children:[o.jsx("path",{d:"M4 10h16",strokeDasharray:"3 2"}),o.jsx("path",{d:"M14 10v8"}),o.jsx("path",{d:"M18 14h4v4h-4z"})]})}function sd({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"page-properties",children:[o.jsx("path",{d:"M6 3h8l6 6v12H6z"}),o.jsx("path",{d:"M14 3v6h6"})]})}function Ip({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"paragraph-properties",children:[o.jsx("path",{d:"M13 4H9a4 4 0 0 0 0 8h2"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("path",{d:"M11 4v16"})]})}function Fp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"preview",children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("path",{d:"M14 2v6h6"}),o.jsx("path",{d:"M8 13h8"}),o.jsx("path",{d:"M8 17h5"})]})}function Bp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"paragraph-style",children:[o.jsx("path",{d:"M5 6h14"}),o.jsx("path",{d:"M5 10h10"}),o.jsx("path",{d:"M5 14h14"}),o.jsx("path",{d:"M5 18h8"})]})}function Hp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"plus",children:[o.jsx("path",{d:"M12 5v14"}),o.jsx("path",{d:"M5 12h14"})]})}function zp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"print",children:[o.jsx("path",{d:"M6 9V3h12v6"}),o.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),o.jsx("path",{d:"M6 14h12v8H6z"})]})}function Op({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"read-aloud",children:[o.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),o.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function Kp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"redo",children:[o.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),o.jsx("path",{d:"M17 6l4 4-4 4"})]})}function $p({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"row-properties",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Up({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"save",children:[o.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),o.jsx("path",{d:"M15 3v6H9V3"}),o.jsx("path",{d:"M8 21v-7h8v7"})]})}function Sa({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-column",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"}),o.jsx("rect",{x:"9.5",y:"5",width:"5",height:"14",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Fc({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("path",{d:"M9 4v16"}),o.jsx("path",{d:"M15 4v16"})]})}function ka({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"table-row",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M3 10h18"}),o.jsx("path",{d:"M3 16h18"}),o.jsx("rect",{x:"4",y:"10.5",width:"16",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Wp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"strikethrough",children:[o.jsx("path",{d:"M6 7.5C6 5.5 8 4 12 4s6 1.5 6 3.5-1.8 2.8-6 3.5"}),o.jsx("path",{d:"M6 16.5C6 18.5 8 20 12 20s6-1.5 6-3.5c0-1-.5-1.8-1.8-2.5"}),o.jsx("path",{d:"M4 12h16"})]})}function Gp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"underline",children:[o.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),o.jsx("path",{d:"M5 20h14"})]})}function Vp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"undo",children:[o.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),o.jsx("path",{d:"M7 6L3 10l4 4"})]})}function Zp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"unmerge-cells",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),o.jsx("path",{d:"M12 4v16"}),o.jsx("path",{d:"M3 12h18"}),o.jsx("path",{d:"M9 9l-3 3 3 3"}),o.jsx("path",{d:"M15 9l3 3-3 3"})]})}function qp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"visual",children:[o.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Yp({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true","data-icon":"youtube",children:[o.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3"}),o.jsx("path",{d:"m10 9 6 3-6 3V9Z",fill:"currentColor",stroke:"none"})]})}const ue="---";function zt(e){return e===ue}function gr(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Cl=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","pageBreak","insertPage","visual","html","customizeToolbar","toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom","lightMode","darkMode","preview","readAloud","fullscreen","bold","italic","underline","strikethrough","clearFormatting","formatBrush","fontSize","fontFamily","paragraphStyle","fontProperties","customCss","paragraphProperties","pageProperties","imageProperties","fontColor","highlightColor","alignLeft","alignCenter","alignRight","alignJustify","indent","outdent","bulletList","numberedList","table","insertRowBelow","insertRowBefore","deleteRow","insertColumnAfter","insertColumnBefore","deleteColumn","mergeCells","unmergeCells","tableProperties","cellProperties","rowProperties"]),Xp=new Set(["file","edit","insert","table","view","format"]),cd="custom",ud="custom";function dd(e){return`custom:${e}`}function Jp(e){return e==="menu"||e==="both"}function Qp(e){return e==="toolbar"||e==="both"}function md(e){return e.map(t=>gr(t)?{submenu:t.submenu,items:md(t.items)}:t)}function eg(e){return{menus:e.menus.map(t=>({id:t.id,items:md(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function fd(e){return zt(e)?!0:gr(e)?e.items.every(fd):Cl.has(e)}function pd(e,t){for(const n of e)if(n===t||gr(n)&&pd(n.items,t))return!0;return!1}function tg(e){const t=e.tooltip??e.label;return{id:e.id,command:dd(e.id),icon:e.icon??hp,label:e.label,ariaLabel:e.label,tooltip:t}}function ng(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Xp.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===cd&&!r)e.menus[n]={id:n,labelKey:"menuCustom",ariaKey:"menuCustomAria"};else{const i=r??n;e.menus[n]={id:n,label:i,ariaLabel:i}}t.menus.some(i=>i.id===n)||t.menus.push({id:n,items:[]})}function rg(e,t,n){if(e.groups[n]||(n===ud?e.groups[n]={id:n,labelKey:"toolbarGroupCustom"}:e.groups[n]={id:n,label:n}),!t.iconGroups.some(r=>r.id===n)){const r={id:n,items:[]},i=t.iconGroups.findIndex(a=>a.items.includes("fullscreen"));i===-1?t.iconGroups.push(r):t.iconGroups.splice(i,0,r)}}function og(e,t,n){var a,l;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},i=eg(n);for(const u of e??[])if(!(Cl.has(u.id)||zt(u.id))){if(r.items[u.id]=tg(u),Jp(u.showIn)){const m=((a=u.menu)==null?void 0:a.id)??cd;ng(r,i,m,(l=u.menu)==null?void 0:l.label);const p=i.menus.find(g=>g.id===m);if(p&&!pd(p.items,u.id)){const g=p.items[p.items.length-1];g!==void 0&&!zt(g)&&p.items.every(fd)&&p.items.push(ue),p.items.push(u.id)}}if(Qp(u.showIn)){const m=u.toolbarGroup??ud;rg(r,i,m);const p=i.iconGroups.find(g=>g.id===m);p&&!p.items.includes(u.id)&&p.items.push(u.id)}}return{catalog:r,layout:i}}function ig(e,t){const n={};for(const r of e??[])Cl.has(r.id)||zt(r.id)||(n[dd(r.id)]=()=>r.onAction(t()));return n}function ag(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const lg="_chrome_boy0f_1",sg={chrome:lg},gd=c.createContext(!1);function cg({dark:e,children:t}){return o.jsx(gd.Provider,{value:e,children:t})}function ug(){return c.useContext(gd)}function Ka(e){return{className:sg.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function se({children:e}){const t=ug(),n=Ka(t);return xl.createPortal(o.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function wl(e,t){const n=e[t];n==null||n()}const vl={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Switch to visual mode",modeHtmlAria:"Switch to HTML mode",modeFullscreen:"Full screen",modeFullscreenAria:"Toggle full screen",modeLight:"Light mode",modeLightAria:"Switch to light mode",modeDark:"Dark mode",modeDarkAria:"Switch to dark mode",exitFullscreenAria:"Exit full screen",visualEditorAria:"Visual editor",htmlEditorAria:"HTML editor",menuFile:"File",menuFileAria:"File menu",menuEdit:"Edit",menuEditAria:"Edit menu",menuInsert:"Insert",menuInsertAria:"Insert menu",menuView:"View",menuViewAria:"View menu",menuFormat:"Format",menuFormatAria:"Format menu",menuFont:"Fonts",menuFontAria:"Fonts submenu",menuParagraph:"Paragraph",menuParagraphAria:"Paragraph submenu",menuParagraphStyles:"Paragraph styles",menuParagraphStylesAria:"Paragraph styles submenu",menuPage:"Page",menuPageAria:"Page submenu",menuToolbar:"Toolbar",menuToolbarAria:"Toolbar submenu",menuToolbarPosition:"Position",menuToolbarPositionAria:"Toolbar position submenu",toolbarPositionTop:"Top",toolbarPositionTopAria:"Dock toolbar at the top",toolbarPositionLeft:"Left",toolbarPositionLeftAria:"Dock toolbar on the left",toolbarPositionRight:"Right",toolbarPositionRightAria:"Dock toolbar on the right",toolbarPositionBottom:"Bottom",toolbarPositionBottomAria:"Dock toolbar at the bottom",menuImage:"Image",menuImageAria:"Image properties",menuInsertRow:"Row",menuInsertRowAria:"Insert or delete row",menuInsertColumn:"Column",menuInsertColumnAria:"Insert or delete column",menuTable:"Table",menuTableAria:"Table menu",menuCustom:"Custom",menuCustomAria:"Custom menu",menuHamburgerAria:"Open menu",menuCloseAria:"Close menu",menuOverlayAria:"Editor menu",brandMarkAria:"CommsPliant HTML editor",commandSave:"Save",commandSaveAria:"Save as HTML file",commandOpen:"Open",commandOpenAria:"Open HTML file",htmlFileDropOverlay:"Drop HTML file to open",commandPrint:"Print",commandPrintAria:"Print document",commandUndo:"Undo",commandUndoAria:"Undo",commandRedo:"Redo",commandRedoAria:"Redo",commandCut:"Cut",commandCutAria:"Cut",commandCopy:"Copy",commandCopyAria:"Copy",commandDelete:"Delete",commandDeleteAria:"Delete",commandLink:"Link",commandLinkAria:"Link",commandBookmark:"Bookmark",commandBookmarkAria:"Bookmark",commandImage:"Image",commandImageAria:"Insert image",commandAudio:"Audio",commandAudioAria:"Insert audio",commandYoutube:"YouTube video",commandYoutubeAria:"Insert YouTube video",commandImageProperties:"Image properties…",commandImagePropertiesAria:"Image properties",commandTable:"Table",commandTableAria:"Insert table",commandHorizontalRule:"Horizontal line",commandHorizontalRuleAria:"Insert horizontal line",commandPageBreak:"Page break",commandPageBreakAria:"Insert page break",commandInsertPage:"Page",commandInsertPageAria:"Insert new page",commandTableProperties:"Table properties…",commandTablePropertiesAria:"Table properties",commandCellProperties:"Cell properties…",commandCellPropertiesAria:"Cell properties",commandRowProperties:"Row properties…",commandRowPropertiesAria:"Row properties",commandInsertRowBelow:"Add below",commandInsertRowBelowAria:"Add row below",commandInsertRowBefore:"Add before",commandInsertRowBeforeAria:"Add row before",commandDeleteRow:"Delete",commandDeleteRowAria:"Delete row",commandInsertColumnAfter:"Add after",commandInsertColumnAfterAria:"Add column after",commandInsertColumnBefore:"Add before",commandInsertColumnBeforeAria:"Add column before",commandDeleteColumn:"Delete",commandDeleteColumnAria:"Delete column",commandMergeCells:"Merge cells",commandMergeCellsAria:"Merge selected cells",commandUnmergeCells:"Unmerge cells",commandUnmergeCellsAria:"Split merged cells",contextMenuAria:"Editor context menu",commandBold:"Bold",commandBoldAria:"Bold",commandItalic:"Italic",commandItalicAria:"Italic",commandUnderline:"Underline",commandUnderlineAria:"Underline",commandStrikethrough:"Strikethrough",commandStrikethroughAria:"Strikethrough",commandClearFormatting:"Reset formatting",commandClearFormattingAria:"Reset formatting",commandFormatBrush:"Format brush",commandFormatBrushAria:"Copy formatting",commandFontSize:"Font size",commandFontSizeAria:"Font size",commandFontSizeUnitAria:"Font size unit",commandFontFamily:"Font",commandFontFamilyAria:"Font family",commandFontProperties:"Font properties…",commandFontPropertiesAria:"Font properties",commandCustomCss:"Custom CSS",commandCustomCssAria:"Custom CSS",commandParagraphProperties:"Paragraph properties…",commandParagraphPropertiesAria:"Paragraph properties",commandPageProperties:"Page properties…",commandPagePropertiesAria:"Page properties",commandFontColor:"Font color",commandFontColorAria:"Font color",commandHighlightColor:"Highlight color",commandHighlightColorAria:"Highlight color",commandParagraphStyle:"Styles",commandParagraphStyleAria:"Paragraph styles",commandAlignLeft:"Align left",commandAlignLeftAria:"Align left",commandAlignCenter:"Align center",commandAlignCenterAria:"Align center",commandAlignRight:"Align right",commandAlignRightAria:"Align right",commandAlignJustify:"Justify",commandAlignJustifyAria:"Justify",commandIndent:"Increase indent",commandIndentAria:"Increase indent",commandOutdent:"Decrease indent",commandOutdentAria:"Decrease indent",commandBulletList:"Bullet list",commandBulletListAria:"Bullet list",commandNumberedList:"Numbered list",commandNumberedListAria:"Numbered list",commandCustomizeToolbar:"Customize toolbar",commandCustomizeToolbarAria:"Customize toolbar",commandPreview:"Preview",commandPreviewAria:"Preview document",commandReadAloud:"Read aloud",commandReadAloudAria:"Read selection or document aloud",styleParagraph:"Paragraph",styleHeading1:"Heading 1",styleHeading2:"Heading 2",styleHeading3:"Heading 3",styleHeading4:"Heading 4",styleHeading5:"Heading 5",styleHeading6:"Heading 6",styleAddNew:"Add new",styleAddNewAria:"Add new paragraph style",customStyleDialogAddTitle:"Add paragraph style",customStyleDialogEditTitle:"Edit paragraph style",customStyleDialogTabFont:"Font",customStyleDialogTabParagraph:"Paragraph",customStyleDialogName:"Name",customStyleDialogDelete:"Delete",customStyleDialogDeleteConfirm:"Delete this paragraph style?",customStyleDialogCloseAria:"Close",customStyleLoading:"Loading paragraph styles",colorAutomatic:"Automatic",colorNone:"No color",colorCustom:"Custom color",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Pick from screen",colorRecent:"Recent colors",fontDialogTitle:"Font properties",fontDialogTabGeneral:"General",fontDialogFamily:"Font",fontFamilyDefault:"Default",fontDialogSize:"Size",fontDialogUnit:"Unit",fontDialogStyle:"Style",fontDialogOk:"OK",fontDialogCancel:"Cancel",linkDialogTitle:"Insert link",linkDialogTabLink:"Link",linkDialogTabBookmark:"Bookmark",linkDialogHref:"URL",linkDialogHoverTitle:"Title",linkDialogTargetBlank:"Open in a new tab",linkDialogTextDecorationNone:"No underline",linkDialogHover:"On hover",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Hover color",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"Custom hover HTML",linkDialogBookmark:"Bookmark",linkDialogBookmarkEmpty:"No bookmarks in this document.",linkDialogSelect:"Select",bookmarkDialogTitle:"Insert bookmark",bookmarkDialogName:"Bookmark name",bookmarkDialogHelp:"Start with a letter. Use only letters, numbers, hyphens, and underscores. Must be unique in the document.",bookmarkDialogHelpAria:"Bookmark name format",bookmarkDialogCloseAria:"Close",bookmarkDialogErrorEmpty:"Enter a bookmark name.",bookmarkDialogErrorInvalid:"Start with a letter. Use only letters, numbers, hyphens, and underscores.",bookmarkDialogErrorDuplicate:"A bookmark with this name already exists.",customCssDialogTitle:"Custom CSS",customCssDialogField:"CSS",customCssDialogFieldAria:"Custom CSS declarations",customCssDialogCloseAria:"Close",imageDialogTitle:"Insert image",imageDialogSource:"Source",imageDialogFile:"File",imageDialogChooseFile:"Choose file",imageDialogUrl:"Image URL",imageDialogAlt:"Alt text",imageDialogTitleField:"Title",imageDialogCloseAria:"Close",imageDialogErrorEmpty:"Choose a file or enter an image URL.",imageDialogErrorInvalid:"Enter a valid image URL.",imageDialogErrorType:"Use a JPEG, PNG, GIF, WebP, BMP, or AVIF image.",imageDialogErrorTooLarge:"Choose an image smaller than 2 MB.",audioDialogTitle:"Insert audio",audioDialogSource:"Source",audioDialogFile:"File",audioDialogChooseFile:"Choose file",audioDialogUrl:"Audio URL",audioDialogTitleField:"Title",audioDialogCloseAria:"Close",audioDialogErrorEmpty:"Choose a file or enter an audio URL.",audioDialogErrorInvalid:"Enter a valid audio URL.",audioDialogErrorType:"Use an MP3, WAV, OGG, AAC, WebM, or M4A audio file.",audioDialogErrorTooLarge:"Choose an audio file smaller than 5 MB.",youtubeDialogTitle:"Insert YouTube video",youtubeDialogUrl:"YouTube URL",youtubeDialogTitleField:"Title",youtubeDialogCloseAria:"Close",youtubeDialogErrorEmpty:"Enter a YouTube URL.",youtubeDialogErrorInvalid:"Enter a valid YouTube URL.",imagePropertiesDialogTitle:"Image properties",imagePropertiesDialogCloseAria:"Close",imagePropertiesTabAlignment:"Alignment",imagePropertiesTabBorder:"Border & margin",imagePropertiesTabAdvanced:"Advanced",imagePropertiesTabHover:"Hover",imagePropertiesSize:"Size",imagePropertiesSizeMode:"Size mode",imagePropertiesSizeWidth:"Width only",imagePropertiesSizeHeight:"Height only",imagePropertiesSizeLock:"Lock together",imagePropertiesWidth:"Width",imagePropertiesHeight:"Height",imagePropertiesWidthAria:"Image width",imagePropertiesHeightAria:"Image height",imagePropertiesSizeUnitAria:"Image size unit",imagePropertiesFit:"Fit",imagePropertiesFitDefault:"Default",imagePropertiesFitFill:"Fill",imagePropertiesFitContain:"Contain",imagePropertiesFitCover:"Cover",imagePropertiesFitNoneValue:"None",imagePropertiesFitScaleDown:"Scale down",imagePropertiesPosition:"Position",imagePropertiesPositionDefault:"Default",imagePropertiesPositionCenter:"Center",imagePropertiesPositionTop:"Top",imagePropertiesPositionBottom:"Bottom",imagePropertiesPositionLeft:"Left",imagePropertiesPositionRight:"Right",imagePropertiesPositionTopLeft:"Top left",imagePropertiesPositionTopRight:"Top right",imagePropertiesPositionBottomLeft:"Bottom left",imagePropertiesPositionBottomRight:"Bottom right",imagePropertiesRotation:"Rotation",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"Hover CSS",imagePropertiesHoverCssAria:"Custom hover CSS",imagePropertiesHoverHelp:"CSS applied when the pointer is over the image.",imageResizeHandleEastAria:"Resize image width, keep aspect ratio",imageResizeHandleSouthAria:"Resize image height, keep aspect ratio",imageResizeHandleSouthEastAria:"Resize image freely",tableDialogTitle:"Insert table",tableDialogCloseAria:"Close",tableDialogRows:"Rows",tableDialogColumns:"Columns",tableDialogSize:"Size",tableDialogGridAria:"Table size grid",tableDialogInsert:"Insert",tablePropertiesDialogTitle:"Table properties",tablePropertiesDialogCloseAria:"Close",tablePropertiesCollapse:"Border collapse",tablePropertiesCollapseCollapse:"Collapse",tablePropertiesCollapseSeparate:"Separate",tablePropertiesSpacing:"Border spacing",tablePropertiesWidth:"Width",cellPropertiesDialogTitle:"Cell properties",cellPropertiesDialogCloseAria:"Close",cellPropertiesColor:"Text color",cellPropertiesVerticalAlign:"Vertical align",cellPropertiesVerticalAlignDefault:"Default",cellPropertiesVerticalAlignTop:"Top",cellPropertiesVerticalAlignMiddle:"Middle",cellPropertiesVerticalAlignBottom:"Bottom",cellPropertiesVerticalAlignBaseline:"Baseline",cellPropertiesWidth:"Width",cellPropertiesColSpan:"Column span",cellPropertiesRowSpan:"Row span",rowPropertiesDialogTitle:"Row properties",rowPropertiesDialogCloseAria:"Close",rowPropertiesHeight:"Height",paragraphDialogTitle:"Paragraph properties",pageDialogTitle:"Page properties",pageDialogTabBackgroundImage:"Background Image",pageDialogTabPrint:"Print",pageAtRuleSize:"Page size",pageAtRuleSizeAuto:"Auto",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Letter",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Custom",pageAtRuleWidth:"Width",pageAtRuleHeight:"Height",pageAtRuleOrientation:"Orientation",pageAtRuleOrientationNone:"Default",pageAtRuleOrientationPortrait:"Portrait",pageAtRuleOrientationLandscape:"Landscape",pageAtRuleMargins:"Page margins",pageAtRuleReset:"Reset print settings",pageAtRuleResetAria:"Remove @page print settings from this page",menuZoom:"Zoom",menuZoomAria:"Zoom submenu",pageZoomFitWidth:"Fit width",pageZoomFitWidthAria:"Fit page width to the editor",pageZoomFitPage:"Fit page",pageZoomFitPageAria:"Fit entire page to the editor",pageZoom50:"50%",pageZoom50Aria:"Zoom to 50 percent",pageZoom75:"75%",pageZoom75Aria:"Zoom to 75 percent",pageZoom100:"100%",pageZoom100Aria:"Zoom to 100 percent",pageZoom125:"125%",pageZoom125Aria:"Zoom to 125 percent",pageZoom150:"150%",pageZoom150Aria:"Zoom to 150 percent",pageZoom200:"200%",pageZoom200Aria:"Zoom to 200 percent",pageBackgroundImagePreview:"Preview",pageBackgroundImagePreviewAlt:"Page background image preview",pageBackgroundImageClear:"Remove background image",pageBackgroundImageCurrent:"Image selected",paragraphDialogTabBorder:"Border",paragraphDialogTabBackground:"Background",paragraphDialogAlignment:"Alignment",paragraphDialogLists:"Lists",paragraphDialogSpacing:"Spacing",paragraphDialogMargin:"Margin",paragraphDialogPadding:"Padding",paragraphDialogLineHeight:"Line height",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Same on all sides",paragraphDialogSideTop:"Top",paragraphDialogSideRight:"Right",paragraphDialogSideBottom:"Bottom",paragraphDialogSideLeft:"Left",paragraphDialogBorder:"Border",paragraphDialogBorderStyle:"Style",paragraphDialogBorderWidth:"Width",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Corner radius",paragraphDialogBoxShadow:"Box shadow",paragraphDialogShadowOffsetX:"Offset X",paragraphDialogShadowOffsetY:"Offset Y",paragraphDialogShadowBlur:"Blur",paragraphDialogShadowSpread:"Spread",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Inset",paragraphDialogLengthUnitAria:"Unit",paragraphDialogBorderStyleNone:"None",paragraphDialogBorderStyleSolid:"Solid",paragraphDialogBorderStyleDotted:"Dotted",paragraphDialogBorderStyleDashed:"Dashed",paragraphDialogBorderStyleDouble:"Double",paragraphDialogBorderStyleGroove:"Groove",paragraphDialogBorderStyleRidge:"Ridge",paragraphDialogBorderStyleInset:"Inset",paragraphDialogBorderStyleOutset:"Outset",paragraphDialogBackgroundColor:"Background color",paragraphDialogOpacity:"Opacity",paragraphDialogPageBreaks:"Page breaks",paragraphDialogBreakInside:"Break inside",paragraphDialogBreakAfter:"Break after",paragraphDialogBreakBefore:"Break before",paragraphDialogBreakAuto:"Auto",paragraphDialogBreakAvoid:"Avoid",paragraphDialogBreakPage:"Page",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Formatting toolbar",toolbarGroupFile:"File",toolbarGroupPrint:"Print",toolbarGroupEdit:"Edit",toolbarGroupInsert:"Insert",toolbarGroupTable:"Table",toolbarGroupFont:"Fonts",toolbarGroupAlign:"Align",toolbarGroupParagraph:"Paragraph",toolbarGroupView:"View",toolbarGroupFullscreen:"Full screen",toolbarGroupCustom:"Custom",customizeToolbarDialogTitle:"Customize toolbar",customizeToolbarDialogReset:"Reset",customizeToolbarDialogClose:"Close",customizeToolbarDialogCloseAria:"Close",customizeToolbarDialogLoading:"Loading toolbar settings",customizeToolbarItemVisible:"Show on toolbar",customizeToolbarDragHandle:"Drag to reorder group",customizeToolbarMoveUp:"Move group up",customizeToolbarMoveDown:"Move group down",previewDialogTitle:"Document preview",previewDialogClose:"Close",previewDialogCloseAria:"Close",commandAddComment:"Add comment",commandAddCommentAria:"Add comment on selection",commandInsertComment:"Comment",commandInsertCommentAria:"Insert comment on selection",showComments:"Show comments",hideComments:"Hide comments",toggleCommentsVisibleAria:"Toggle comment visibility",commentPanelTitle:"Comment",commentPlaceholder:"Write a comment…",commentReplyPlaceholder:"Write a reply…",commentPost:"Post",commentEmpty:"No messages yet.",commentPanelCloseAria:"Close comment panel"},dg={modeVisual:"Visual",modeHtml:"HTML",modeVisualAria:"Cambiar al modo visual",modeHtmlAria:"Cambiar al modo HTML",modeFullscreen:"Pantalla completa",modeFullscreenAria:"Activar o desactivar pantalla completa",modeLight:"Modo claro",modeLightAria:"Cambiar al modo claro",modeDark:"Modo oscuro",modeDarkAria:"Cambiar al modo oscuro",exitFullscreenAria:"Salir de pantalla completa",visualEditorAria:"Editor visual",htmlEditorAria:"Editor HTML",menuFile:"Archivo",menuFileAria:"Menú Archivo",menuEdit:"Editar",menuEditAria:"Menú Editar",menuInsert:"Insertar",menuInsertAria:"Menú Insertar",menuView:"Vista",menuViewAria:"Menú Vista",menuFormat:"Formato",menuFormatAria:"Menú Formato",menuFont:"Fuentes",menuFontAria:"Submenú Fuentes",menuParagraph:"Párrafo",menuParagraphAria:"Submenú Párrafo",menuParagraphStyles:"Estilos de párrafo",menuParagraphStylesAria:"Submenú Estilos de párrafo",menuPage:"Página",menuPageAria:"Submenú Página",menuToolbar:"Barra de herramientas",menuToolbarAria:"Submenú Barra de herramientas",menuToolbarPosition:"Posición",menuToolbarPositionAria:"Submenú Posición de la barra de herramientas",toolbarPositionTop:"Arriba",toolbarPositionTopAria:"Acoplar la barra de herramientas arriba",toolbarPositionLeft:"Izquierda",toolbarPositionLeftAria:"Acoplar la barra de herramientas a la izquierda",toolbarPositionRight:"Derecha",toolbarPositionRightAria:"Acoplar la barra de herramientas a la derecha",toolbarPositionBottom:"Abajo",toolbarPositionBottomAria:"Acoplar la barra de herramientas abajo",menuImage:"Imagen",menuImageAria:"Propiedades de imagen",menuInsertRow:"Fila",menuInsertRowAria:"Insertar o eliminar fila",menuInsertColumn:"Columna",menuInsertColumnAria:"Insertar o eliminar columna",menuTable:"Tabla",menuTableAria:"Menú Tabla",menuCustom:"Personalizado",menuCustomAria:"Menú personalizado",menuHamburgerAria:"Abrir menú",menuCloseAria:"Cerrar menú",menuOverlayAria:"Menú del editor",brandMarkAria:"Editor HTML de CommsPliant",commandSave:"Guardar",commandSaveAria:"Guardar como archivo HTML",commandOpen:"Abrir",commandOpenAria:"Abrir archivo HTML",htmlFileDropOverlay:"Suelte un archivo HTML para abrirlo",commandPrint:"Imprimir",commandPrintAria:"Imprimir documento",commandUndo:"Deshacer",commandUndoAria:"Deshacer",commandRedo:"Rehacer",commandRedoAria:"Rehacer",commandCut:"Cortar",commandCutAria:"Cortar",commandCopy:"Copiar",commandCopyAria:"Copiar",commandDelete:"Eliminar",commandDeleteAria:"Eliminar",commandLink:"Enlace",commandLinkAria:"Enlace",commandBookmark:"Marcador",commandBookmarkAria:"Marcador",commandImage:"Imagen",commandImageAria:"Insertar imagen",commandAudio:"Audio",commandAudioAria:"Insertar audio",commandYoutube:"Vídeo de YouTube",commandYoutubeAria:"Insertar vídeo de YouTube",commandImageProperties:"Propiedades de imagen…",commandImagePropertiesAria:"Propiedades de imagen",commandTable:"Tabla",commandTableAria:"Insertar tabla",commandHorizontalRule:"Línea horizontal",commandHorizontalRuleAria:"Insertar línea horizontal",commandPageBreak:"Salto de página",commandPageBreakAria:"Insertar salto de página",commandInsertPage:"Página",commandInsertPageAria:"Insertar página nueva",commandTableProperties:"Propiedades de tabla…",commandTablePropertiesAria:"Propiedades de tabla",commandCellProperties:"Propiedades de celda…",commandCellPropertiesAria:"Propiedades de celda",commandRowProperties:"Propiedades de fila…",commandRowPropertiesAria:"Propiedades de fila",commandInsertRowBelow:"Añadir debajo",commandInsertRowBelowAria:"Añadir fila debajo",commandInsertRowBefore:"Añadir antes",commandInsertRowBeforeAria:"Añadir fila antes",commandDeleteRow:"Eliminar",commandDeleteRowAria:"Eliminar fila",commandInsertColumnAfter:"Añadir después",commandInsertColumnAfterAria:"Añadir columna después",commandInsertColumnBefore:"Añadir antes",commandInsertColumnBeforeAria:"Añadir columna antes",commandDeleteColumn:"Eliminar",commandDeleteColumnAria:"Eliminar columna",commandMergeCells:"Combinar celdas",commandMergeCellsAria:"Combinar las celdas seleccionadas",commandUnmergeCells:"Separar celdas",commandUnmergeCellsAria:"Dividir las celdas combinadas",contextMenuAria:"Menú contextual del editor",commandBold:"Negrita",commandBoldAria:"Negrita",commandItalic:"Cursiva",commandItalicAria:"Cursiva",commandUnderline:"Subrayado",commandUnderlineAria:"Subrayado",commandStrikethrough:"Tachado",commandStrikethroughAria:"Tachado",commandClearFormatting:"Restablecer formato",commandClearFormattingAria:"Restablecer formato",commandFormatBrush:"Copiar formato",commandFormatBrushAria:"Copiar formato",commandFontSize:"Tamaño de fuente",commandFontSizeAria:"Tamaño de fuente",commandFontSizeUnitAria:"Unidad de tamaño de fuente",commandFontFamily:"Fuente",commandFontFamilyAria:"Familia tipográfica",commandFontProperties:"Propiedades de fuente…",commandFontPropertiesAria:"Propiedades de fuente",commandCustomCss:"CSS personalizado",commandCustomCssAria:"CSS personalizado",commandParagraphProperties:"Propiedades de párrafo…",commandParagraphPropertiesAria:"Propiedades de párrafo",commandPageProperties:"Propiedades de página…",commandPagePropertiesAria:"Propiedades de página",commandFontColor:"Color de fuente",commandFontColorAria:"Color de fuente",commandHighlightColor:"Color de resaltado",commandHighlightColorAria:"Color de resaltado",commandParagraphStyle:"Estilos",commandParagraphStyleAria:"Estilos de párrafo",commandAlignLeft:"Alinear a la izquierda",commandAlignLeftAria:"Alinear a la izquierda",commandAlignCenter:"Alinear al centro",commandAlignCenterAria:"Alinear al centro",commandAlignRight:"Alinear a la derecha",commandAlignRightAria:"Alinear a la derecha",commandAlignJustify:"Justificar",commandAlignJustifyAria:"Justificar",commandIndent:"Aumentar sangría",commandIndentAria:"Aumentar sangría",commandOutdent:"Disminuir sangría",commandOutdentAria:"Disminuir sangría",commandBulletList:"Lista con viñetas",commandBulletListAria:"Lista con viñetas",commandNumberedList:"Lista numerada",commandNumberedListAria:"Lista numerada",commandCustomizeToolbar:"Personalizar barra de herramientas",commandCustomizeToolbarAria:"Personalizar barra de herramientas",commandPreview:"Vista previa",commandPreviewAria:"Vista previa del documento",commandReadAloud:"Leer en voz alta",commandReadAloudAria:"Leer la selección o el documento en voz alta",styleParagraph:"Párrafo",styleHeading1:"Encabezado 1",styleHeading2:"Encabezado 2",styleHeading3:"Encabezado 3",styleHeading4:"Encabezado 4",styleHeading5:"Encabezado 5",styleHeading6:"Encabezado 6",styleAddNew:"Añadir nuevo",styleAddNewAria:"Añadir un estilo de párrafo",customStyleDialogAddTitle:"Añadir estilo de párrafo",customStyleDialogEditTitle:"Editar estilo de párrafo",customStyleDialogTabFont:"Fuente",customStyleDialogTabParagraph:"Párrafo",customStyleDialogName:"Nombre",customStyleDialogDelete:"Eliminar",customStyleDialogDeleteConfirm:"¿Eliminar este estilo de párrafo?",customStyleDialogCloseAria:"Cerrar",customStyleLoading:"Cargando estilos de párrafo",colorAutomatic:"Automático",colorNone:"Sin color",colorCustom:"Color personalizado",colorHex:"Hex",colorRgbR:"R",colorRgbG:"G",colorRgbB:"B",colorPickFromScreen:"Seleccionar de la pantalla",colorRecent:"Colores recientes",fontDialogTitle:"Propiedades de fuente",fontDialogTabGeneral:"General",fontDialogFamily:"Fuente",fontFamilyDefault:"Predeterminada",fontDialogSize:"Tamaño",fontDialogUnit:"Unidad",fontDialogStyle:"Estilo",fontDialogOk:"Aceptar",fontDialogCancel:"Cancelar",linkDialogTitle:"Insertar enlace",linkDialogTabLink:"Enlace",linkDialogTabBookmark:"Marcador",linkDialogHref:"URL",linkDialogHoverTitle:"Título",linkDialogTargetBlank:"Abrir en una pestaña nueva",linkDialogTextDecorationNone:"Sin subrayado",linkDialogHover:"Al pasar el cursor",linkDialogHoverColor:"Color",linkDialogHoverColorField:"Color al pasar el cursor",linkDialogHoverHtml:"HTML",linkDialogHoverHtmlAria:"HTML personalizado al pasar el cursor",linkDialogBookmark:"Marcador",linkDialogBookmarkEmpty:"No hay marcadores en este documento.",linkDialogSelect:"Seleccionar",bookmarkDialogTitle:"Insertar marcador",bookmarkDialogName:"Nombre del marcador",bookmarkDialogHelp:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos. Debe ser único en el documento.",bookmarkDialogHelpAria:"Formato del nombre del marcador",bookmarkDialogCloseAria:"Cerrar",bookmarkDialogErrorEmpty:"Introduce un nombre de marcador.",bookmarkDialogErrorInvalid:"Empieza por una letra. Usa solo letras, números, guiones y guiones bajos.",bookmarkDialogErrorDuplicate:"Ya existe un marcador con este nombre.",customCssDialogTitle:"CSS personalizado",customCssDialogField:"CSS",customCssDialogFieldAria:"Declaraciones CSS personalizadas",customCssDialogCloseAria:"Cerrar",imageDialogTitle:"Insertar imagen",imageDialogSource:"Origen",imageDialogFile:"Archivo",imageDialogChooseFile:"Elegir archivo",imageDialogUrl:"URL de la imagen",imageDialogAlt:"Texto alternativo",imageDialogTitleField:"Título",imageDialogCloseAria:"Cerrar",imageDialogErrorEmpty:"Elige un archivo o introduce una URL de imagen.",imageDialogErrorInvalid:"Introduce una URL de imagen válida.",imageDialogErrorType:"Usa una imagen JPEG, PNG, GIF, WebP, BMP o AVIF.",imageDialogErrorTooLarge:"Elige una imagen de menos de 2 MB.",audioDialogTitle:"Insertar audio",audioDialogSource:"Origen",audioDialogFile:"Archivo",audioDialogChooseFile:"Elegir archivo",audioDialogUrl:"URL del audio",audioDialogTitleField:"Título",audioDialogCloseAria:"Cerrar",audioDialogErrorEmpty:"Elige un archivo o introduce una URL de audio.",audioDialogErrorInvalid:"Introduce una URL de audio válida.",audioDialogErrorType:"Usa un archivo de audio MP3, WAV, OGG, AAC, WebM o M4A.",audioDialogErrorTooLarge:"Elige un archivo de audio de menos de 5 MB.",youtubeDialogTitle:"Insertar vídeo de YouTube",youtubeDialogUrl:"URL de YouTube",youtubeDialogTitleField:"Título",youtubeDialogCloseAria:"Cerrar",youtubeDialogErrorEmpty:"Introduce una URL de YouTube.",youtubeDialogErrorInvalid:"Introduce una URL de YouTube válida.",imagePropertiesDialogTitle:"Propiedades de imagen",imagePropertiesDialogCloseAria:"Cerrar",imagePropertiesTabAlignment:"Alineación",imagePropertiesTabBorder:"Borde y margen",imagePropertiesTabAdvanced:"Avanzado",imagePropertiesTabHover:"Al pasar el puntero",imagePropertiesSize:"Tamaño",imagePropertiesSizeMode:"Modo de tamaño",imagePropertiesSizeWidth:"Solo ancho",imagePropertiesSizeHeight:"Solo alto",imagePropertiesSizeLock:"Bloquear juntos",imagePropertiesWidth:"Ancho",imagePropertiesHeight:"Alto",imagePropertiesWidthAria:"Ancho de la imagen",imagePropertiesHeightAria:"Alto de la imagen",imagePropertiesSizeUnitAria:"Unidad de tamaño de imagen",imagePropertiesFit:"Ajuste",imagePropertiesFitDefault:"Predeterminado",imagePropertiesFitFill:"Rellenar",imagePropertiesFitContain:"Contener",imagePropertiesFitCover:"Cubrir",imagePropertiesFitNoneValue:"Ninguno",imagePropertiesFitScaleDown:"Reducir",imagePropertiesPosition:"Posición",imagePropertiesPositionDefault:"Predeterminada",imagePropertiesPositionCenter:"Centro",imagePropertiesPositionTop:"Arriba",imagePropertiesPositionBottom:"Abajo",imagePropertiesPositionLeft:"Izquierda",imagePropertiesPositionRight:"Derecha",imagePropertiesPositionTopLeft:"Arriba izquierda",imagePropertiesPositionTopRight:"Arriba derecha",imagePropertiesPositionBottomLeft:"Abajo izquierda",imagePropertiesPositionBottomRight:"Abajo derecha",imagePropertiesRotation:"Rotación",imagePropertiesRotationUnit:"deg",imagePropertiesHoverCss:"CSS al pasar el puntero",imagePropertiesHoverCssAria:"CSS personalizado al pasar el puntero",imagePropertiesHoverHelp:"CSS que se aplica cuando el puntero está sobre la imagen.",imageResizeHandleEastAria:"Redimensionar el ancho de la imagen, mantener la proporción",imageResizeHandleSouthAria:"Redimensionar el alto de la imagen, mantener la proporción",imageResizeHandleSouthEastAria:"Redimensionar la imagen sin mantener la proporción",tableDialogTitle:"Insertar tabla",tableDialogCloseAria:"Cerrar",tableDialogRows:"Filas",tableDialogColumns:"Columnas",tableDialogSize:"Tamaño",tableDialogGridAria:"Cuadrícula de tamaño de tabla",tableDialogInsert:"Insertar",tablePropertiesDialogTitle:"Propiedades de tabla",tablePropertiesDialogCloseAria:"Cerrar",tablePropertiesCollapse:"Contracción de bordes",tablePropertiesCollapseCollapse:"Contraídos",tablePropertiesCollapseSeparate:"Separados",tablePropertiesSpacing:"Espaciado de bordes",tablePropertiesWidth:"Ancho",cellPropertiesDialogTitle:"Propiedades de celda",cellPropertiesDialogCloseAria:"Cerrar",cellPropertiesColor:"Color de texto",cellPropertiesVerticalAlign:"Alineación vertical",cellPropertiesVerticalAlignDefault:"Predeterminada",cellPropertiesVerticalAlignTop:"Arriba",cellPropertiesVerticalAlignMiddle:"Centro",cellPropertiesVerticalAlignBottom:"Abajo",cellPropertiesVerticalAlignBaseline:"Línea base",cellPropertiesWidth:"Ancho",cellPropertiesColSpan:"Columnas",cellPropertiesRowSpan:"Filas",rowPropertiesDialogTitle:"Propiedades de fila",rowPropertiesDialogCloseAria:"Cerrar",rowPropertiesHeight:"Alto",paragraphDialogTitle:"Propiedades de párrafo",pageDialogTitle:"Propiedades de página",pageDialogTabBackgroundImage:"Imagen de fondo",pageDialogTabPrint:"Impresión",pageAtRuleSize:"Tamaño de página",pageAtRuleSizeAuto:"Automático",pageAtRuleSizeA4:"A4",pageAtRuleSizeLetter:"Carta",pageAtRuleSizeLegal:"Legal",pageAtRuleSizeCustom:"Personalizado",pageAtRuleWidth:"Ancho",pageAtRuleHeight:"Alto",pageAtRuleOrientation:"Orientación",pageAtRuleOrientationNone:"Predeterminada",pageAtRuleOrientationPortrait:"Vertical",pageAtRuleOrientationLandscape:"Horizontal",pageAtRuleMargins:"Márgenes de página",pageAtRuleReset:"Restablecer impresión",pageAtRuleResetAria:"Quitar la configuración @page de impresión de esta página",menuZoom:"Zoom",menuZoomAria:"Submenú Zoom",pageZoomFitWidth:"Ajustar ancho",pageZoomFitWidthAria:"Ajustar el ancho de la página al editor",pageZoomFitPage:"Ajustar página",pageZoomFitPageAria:"Ajustar toda la página al editor",pageZoom50:"50 %",pageZoom50Aria:"Zoom al 50 por ciento",pageZoom75:"75 %",pageZoom75Aria:"Zoom al 75 por ciento",pageZoom100:"100 %",pageZoom100Aria:"Zoom al 100 por ciento",pageZoom125:"125 %",pageZoom125Aria:"Zoom al 125 por ciento",pageZoom150:"150 %",pageZoom150Aria:"Zoom al 150 por ciento",pageZoom200:"200 %",pageZoom200Aria:"Zoom al 200 por ciento",pageBackgroundImagePreview:"Vista previa",pageBackgroundImagePreviewAlt:"Vista previa de la imagen de fondo de página",pageBackgroundImageClear:"Quitar imagen de fondo",pageBackgroundImageCurrent:"Imagen seleccionada",paragraphDialogTabBorder:"Borde",paragraphDialogTabBackground:"Fondo",paragraphDialogAlignment:"Alineación",paragraphDialogLists:"Listas",paragraphDialogSpacing:"Espaciado",paragraphDialogMargin:"Margen",paragraphDialogPadding:"Relleno",paragraphDialogLineHeight:"Interlineado",paragraphDialogLineHeightNormal:"Normal",paragraphDialogLineHeightUnitless:"×",paragraphDialogLinkSides:"Igual en todos los lados",paragraphDialogSideTop:"Superior",paragraphDialogSideRight:"Derecho",paragraphDialogSideBottom:"Inferior",paragraphDialogSideLeft:"Izquierdo",paragraphDialogBorder:"Borde",paragraphDialogBorderStyle:"Estilo",paragraphDialogBorderWidth:"Grosor",paragraphDialogBorderColor:"Color",paragraphDialogBorderRadius:"Radio de esquina",paragraphDialogBoxShadow:"Sombra",paragraphDialogShadowOffsetX:"Desplazamiento X",paragraphDialogShadowOffsetY:"Desplazamiento Y",paragraphDialogShadowBlur:"Desenfoque",paragraphDialogShadowSpread:"Extensión",paragraphDialogShadowColor:"Color",paragraphDialogShadowInset:"Interior",paragraphDialogLengthUnitAria:"Unidad",paragraphDialogBorderStyleNone:"Ninguno",paragraphDialogBorderStyleSolid:"Sólido",paragraphDialogBorderStyleDotted:"Punteado",paragraphDialogBorderStyleDashed:"Discontinuo",paragraphDialogBorderStyleDouble:"Doble",paragraphDialogBorderStyleGroove:"Surco",paragraphDialogBorderStyleRidge:"Relieve",paragraphDialogBorderStyleInset:"Hundido",paragraphDialogBorderStyleOutset:"Saliente",paragraphDialogBackgroundColor:"Color de fondo",paragraphDialogOpacity:"Opacidad",paragraphDialogPageBreaks:"Saltos de página",paragraphDialogBreakInside:"Evitar corte interno",paragraphDialogBreakAfter:"Salto después",paragraphDialogBreakBefore:"Salto antes",paragraphDialogBreakAuto:"Automático",paragraphDialogBreakAvoid:"Evitar",paragraphDialogBreakPage:"Página",fontSizeUnitPt:"pt",fontSizeUnitPx:"px",fontSizeUnitEm:"em",fontSizeUnitRem:"rem",fontSizeUnitPercent:"%",fontSizeUnitPc:"pc",toolbarAria:"Barra de herramientas",toolbarGroupFile:"Archivo",toolbarGroupPrint:"Imprimir",toolbarGroupEdit:"Editar",toolbarGroupInsert:"Insertar",toolbarGroupTable:"Tabla",toolbarGroupFont:"Fuentes",toolbarGroupAlign:"Alinear",toolbarGroupParagraph:"Párrafo",toolbarGroupView:"Vista",toolbarGroupFullscreen:"Pantalla completa",toolbarGroupCustom:"Personalizado",customizeToolbarDialogTitle:"Personalizar barra de herramientas",customizeToolbarDialogReset:"Restablecer",customizeToolbarDialogClose:"Cerrar",customizeToolbarDialogCloseAria:"Cerrar",customizeToolbarDialogLoading:"Cargando la configuración de la barra",customizeToolbarItemVisible:"Mostrar en la barra",customizeToolbarDragHandle:"Arrastrar para reordenar el grupo",customizeToolbarMoveUp:"Mover el grupo hacia arriba",customizeToolbarMoveDown:"Mover el grupo hacia abajo",previewDialogTitle:"Vista previa del documento",previewDialogClose:"Cerrar",previewDialogCloseAria:"Cerrar",commandAddComment:"Añadir comentario",commandAddCommentAria:"Añadir comentario en la selección",commandInsertComment:"Comentario",commandInsertCommentAria:"Insertar comentario en la selección",showComments:"Mostrar comentarios",hideComments:"Ocultar comentarios",toggleCommentsVisibleAria:"Alternar visibilidad de comentarios",commentPanelTitle:"Comentario",commentPlaceholder:"Escribe un comentario…",commentReplyPlaceholder:"Escribe una respuesta…",commentPost:"Publicar",commentEmpty:"Aún no hay mensajes.",commentPanelCloseAria:"Cerrar panel de comentarios"},mg={en:vl,es:dg},hd=c.createContext(e=>vl[e]);function fg({locale:e="en",children:t}){const n=c.useMemo(()=>{const r=mg[e]??vl;return i=>r[i]},[e]);return o.jsx(hd.Provider,{value:n,children:t})}function W(){return c.useContext(hd)}const pg="_menu_c1m45_1",gg="_item_c1m45_19",hg="_separator_c1m45_59",Aa={menu:pg,item:gg,separator:hg},uo=8,bg=[{type:"item",command:"deleteSelection",labelKey:"commandDelete",ariaKey:"commandDeleteAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"cut",labelKey:"commandCut",ariaKey:"commandCutAria",enabled:e=>e==="text"||e==="image"},{type:"item",command:"copy",labelKey:"commandCopy",ariaKey:"commandCopyAria",enabled:e=>e==="text"||e==="image"},{type:"separator"},{type:"item",command:"openLinkDialog",labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:e=>e!=="image"},{type:"separator"},{type:"item",command:"openFontProperties",labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openParagraphProperties",labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"openImageProperties",labelKey:"commandImageProperties",ariaKey:"commandImagePropertiesAria",enabled:e=>e==="image"},{type:"item",command:"openTableProperties",labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"openCellProperties",labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"openRowProperties",labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:(e,t)=>t.inTable},{type:"item",command:"mergeCells",labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:(e,t)=>t.canMergeCells},{type:"item",command:"unmergeCells",labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:(e,t)=>t.canUnmergeCells}];function yg(e,t){const n=[];let r=!1;for(const i of bg){if(i.type==="separator"){n.length>0&&(r=!0);continue}i.enabled(e,t)&&(r&&(n.push({type:"separator"}),r=!1),n.push(i))}return n}function Bc(){return'[role="menuitem"]:not(:disabled)'}function xg({open:e,x:t,y:n,kind:r,inTable:i=!1,canMergeCells:a=!1,canUnmergeCells:l=!1,commands:u,onClose:m}){const p=W(),g=c.useId(),h=c.useRef(null);if(c.useLayoutEffect(()=>{var k;if(!e)return;const x=h.current;if(!x)return;const b=x.getBoundingClientRect(),S=Math.max(uo,Math.min(t,window.innerWidth-b.width-uo)),v=Math.max(uo,Math.min(n,window.innerHeight-b.height-uo));x.style.left=`${S}px`,x.style.top=`${v}px`,(k=x.querySelector(Bc()))==null||k.focus()},[e,t,n,r]),c.useEffect(()=>{if(!e)return;const x=k=>{var P;(P=h.current)!=null&&P.contains(k.target)||m()},b=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),m())},S=()=>{m()},v=k=>{var P;if((P=h.current)!=null&&P.contains(k.target)){k.preventDefault();return}k.defaultPrevented||m()};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",b,!0),window.addEventListener("scroll",S,!0),document.addEventListener("contextmenu",v),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",b,!0),window.removeEventListener("scroll",S,!0),document.removeEventListener("contextmenu",v)}},[e,m]),!e)return null;const C=yg(r,{inTable:i,canMergeCells:a,canUnmergeCells:l}),y=x=>{var P;if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;const b=[...((P=h.current)==null?void 0:P.querySelectorAll(Bc()))??[]];if(b.length===0)return;const S=b.indexOf(document.activeElement),v=x.key==="ArrowDown"?1:-1,k=b[(S+v+b.length)%b.length];x.preventDefault(),k==null||k.focus()};return o.jsx(se,{children:o.jsxs("div",{ref:h,className:Aa.menu,role:"menu","aria-labelledby":g,style:{left:t,top:n},onMouseDown:x=>x.preventDefault(),onKeyDown:y,children:[o.jsx("span",{id:g,hidden:!0,children:p("contextMenuAria")}),C.map((x,b)=>x.type==="separator"?o.jsx("div",{role:"separator",className:Aa.separator},`separator-${b}`):o.jsx("button",{type:"button",role:"menuitem",className:Aa.item,"aria-label":p(x.ariaKey),onClick:()=>{m(),wl(u,x.command)},children:p(x.labelKey)},x.command))]})})}function Cg(e){return e==="touch"||e==="pen"}function wg(e,t){return e.button===2||e.ctrlKey?!0:!Cg(t)}const ur="data-page",No="data-page-bg",Mo="commspliant-background";function gt(e){return e instanceof HTMLElement&&(e.id===Mo||e.hasAttribute(No))}function vg(e){return e.hasAttribute(ur)&&e.parentElement?e.parentElement:e}function Sl(e){const t=vg(e),n=new Set,r=[],i=a=>{a instanceof HTMLElement&>(a)&&!n.has(a)&&(n.add(a),r.push(a))};i(t.querySelector(`#${Mo}`));for(const a of t.querySelectorAll(`[${No}]`))i(a);return i(t),r}function kl(e){return Sl(e)[0]??null}function jo(e){let t=!1;return e.style.width!=="100%"&&(e.style.width="100%",t=!0),e.style.height!=="100%"&&(e.style.height="100%",t=!0),t}function bd(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(ur)}function yd(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function Sg(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function hr(e){return yd(e).find(n=>n.hasAttribute(ur))??null}function kg(e){if(Sg(e))return null;const t=yd(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||gt(n)?null:n}function Ag(e){const t=hr(e);if(t)return jo(t),t;const n=kg(e);if(n)return n.setAttribute(ur,""),jo(n),n;const r=document.createElement("div");for(r.setAttribute(ur,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),jo(r),r}function Al(e){return hr(e)??e}const Hc=["background-color","background-image","background-size","background-position","background-repeat","opacity"];function zc(e,t,n){const r=(t==null?void 0:t.style.getPropertyValue(n).trim())??"";r?e.style.setProperty(n,r):e.style.removeProperty(n)}function ti(e){const t=hr(e),n=t?kl(t):null;if(zc(e,t,"background-color"),n)for(const r of Hc)r!=="background-color"&&zc(e,n,r);else for(const r of Hc)r!=="background-color"&&e.style.removeProperty(r)}const _o="<!-- wysiwyg-page-separator -->",$a="data-page-surface";function Pt(e){const t=e.trim();return t?t.includes(_o)?e.split(_o).map(n=>n.trim()):[e]:[""]}function mt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
|
|
2
|
+
${_o}
|
|
3
|
+
`)}function Ua(){return"<p></p>"}function Oc(e){return e.length===0?[Ua()]:e.map(t=>t.trim())}function Eo(e,t){const n=e.querySelector(`[${$a}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${$a}]`)][t]??null)}function Pl(e){return typeof e.text=="function"?e.text():new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result??"")),r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsText(e)})}function Pg(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function mo(e){var r;if(!e)return!1;if(Array.from(e.types??[]).includes("Files")||e.files&&e.files.length>0)return!0;const n=e.items;if(n){for(let i=0;i<n.length;i++)if(((r=n[i])==null?void 0:r.kind)==="file")return!0}return!1}function Dg(e){var r;const t=[],n=e.files;if(n)for(let i=0;i<n.length;i++){const a=((r=n.item)==null?void 0:r.call(n,i))??n[i];a&&t.push(a)}if(t.length===0&&e.items)for(let i=0;i<e.items.length;i++){const a=e.items[i];if((a==null?void 0:a.kind)!=="file")continue;const l=a.getAsFile();l&&t.push(l)}return t}function jg(e){return e?Dg(e).find(Pg)??null:null}const xd={description:"HTML",accept:{"text/html":[".html",".htm"]}},Eg="document.html";function Cd(){return window}function wd(e){return e instanceof DOMException&&e.name==="AbortError"}function Rg(e,t){const n=new Blob([e],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=t,i.rel="noopener",document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function Tg(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept=".html,.htm,text/html",t.hidden=!0;const n=r=>{t.remove(),e(r)};t.addEventListener("change",()=>{var i;const r=(i=t.files)==null?void 0:i[0];if(!r){n(null);return}Pl(r).then(a=>n(a),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function Ng(e,t=Eg){const n=Cd().showSaveFilePicker;if(typeof n=="function"){try{const i=await(await n({suggestedName:t,types:[xd]})).createWritable();await i.write(e),await i.close()}catch(r){if(wd(r))return;throw r}return}Rg(e,t)}async function Mg(){const e=Cd().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[xd]}),n=await t.getFile();return await Pl(n)}catch(t){if(wd(t))return null;throw t}return Tg()}const _g=new Set(["span","strong","b","em","i","u","s","strike","del"]);function ae(e,t){return t?e===t||e.contains(t):!1}function ht(e){return _g.has(e.tagName.toLowerCase())}function Lg(e,t){const n=document.createRange();return n.selectNodeContents(t),e.compareBoundaryPoints(Range.END_TO_START,n)<0&&e.compareBoundaryPoints(Range.START_TO_END,n)>0}function ze(e){const t=e.commonAncestorContainer;if(t.nodeType===Node.TEXT_NODE)return t.nodeValue?[t]:[];const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let i;for(;i=r.nextNode();)i.nodeValue&&Lg(e,i)&&n.push(i);return n}function pt(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType===Node.TEXT_NODE){const a=t;if(n>0&&n<a.length){const l=a.splitText(n);e.setStart(l,0),e.endContainer===a&&e.setEnd(l,e.endOffset-n)}}const r=e.endContainer,i=e.endOffset;if(r.nodeType===Node.TEXT_NODE){const a=r;i>0&&i<a.length&&(a.splitText(i),e.setEnd(a,a.length))}}function Wt(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function We(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function Gt(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<=-1||n.length===1)return;const i=e.parentNode;if(!i)return;const a=n.slice(0,r),l=n.slice(r+1);if(a.length>0){const u=e.cloneNode(!1);for(const m of a)u.appendChild(m);i.insertBefore(u,e)}if(l.length>0){const u=e.cloneNode(!1);for(const m of l)u.appendChild(m);i.insertBefore(u,e.nextSibling)}}function an(e){if(e.length===0)return;const t=e[0],n=e[e.length-1],r=document.createRange();r.setStart(t,0),r.setEnd(n,n.data.length);const i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function br(e,t){const n=e.parentElement;if(n&&n.tagName.toLowerCase()==="span"&&n.childNodes.length===1)return t(n),n;const r=document.createElement("span");return t(r),n==null||n.insertBefore(r,e),r.appendChild(e),r}const ni="data-wysiwyg-font",Ig=[{name:"Arial",family:"Arial, Helvetica, sans-serif"},{name:"Arial Black",family:"'Arial Black', Gadget, sans-serif"},{name:"Comic Sans MS",family:"'Comic Sans MS', Textile, cursive"},{name:"Courier New",family:"'Courier New', Courier, monospace"},{name:"Georgia",family:"Georgia, serif"},{name:"Helvetica",family:"Helvetica, Arial, sans-serif"},{name:"Impact",family:"Impact, Charcoal, sans-serif"},{name:"Lucida Console",family:"'Lucida Console', Monaco, monospace"},{name:"Lucida Sans Unicode",family:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif"},{name:"Palatino Linotype",family:"'Palatino Linotype', Palatino, serif"},{name:"Tahoma",family:"Tahoma, Geneva, sans-serif"},{name:"Times New Roman",family:"'Times New Roman', Times, serif"},{name:"Trebuchet MS",family:"'Trebuchet MS', Helvetica, sans-serif"},{name:"Verdana",family:"Verdana, Geneva, sans-serif"}];function dr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function yr(e,t){return e===t?!0:!e||!t?!1:dr(e)===dr(t)}function vd(e=[]){var r;const t=[],n=new Set;for(const i of[...Ig,...e]){const a=i.family.trim();if(!a)continue;const l=dr(a);if(n.has(l))continue;n.add(l);const u=(r=i.css)==null?void 0:r.trim();t.push({name:i.name.trim()||a,family:a,...u?{css:u}:{}})}return t}function Fg(e,t){return e?t.find(n=>yr(n.family,e))??null:null}function Bg(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Hg(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function ri(e){const t=new Set,n=[];for(const r of e){const i=r.trim();!i||!Bg(i)||t.has(i)||(t.add(i),n.push(i))}return n}function zg(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/&/g,"&")}const Og=new RegExp(`<link\\b[^>]*\\b${ni}\\b[^>]*>`,"gi");function jt(e){if(!e.includes(ni))return{hrefs:[],body:e};const t=[],n=e.replace(Og,r=>{var a,l;const i=((a=r.match(/\bhref\s*=\s*"([^"]*)"/i))==null?void 0:a[1])??((l=r.match(/\bhref\s*=\s*'([^']*)'/i))==null?void 0:l[1]);return i&&t.push(zg(i)),""});return{hrefs:ri(t),body:n}}function fo(e,t){const n=ri(t);return n.length===0?e:`${n.map(i=>`<link rel="stylesheet" href="${Hg(i)}" ${ni}="">`).join("")}${e}`}function Kg(e,t){const n=dr(t);if(!n)return!1;const r=new DOMParser().parseFromString(e,"text/html"),i=r.createTreeWalker(r.body,NodeFilter.SHOW_ELEMENT);let a=i.currentNode;for(;a;){if(a instanceof HTMLElement){const l=a.style.fontFamily;if(l&&dr(l)===n)return!0}a=i.nextNode()}return!1}function po(e,t,n=[]){const r=jt(t).hrefs,i=n.filter(a=>a.css&&Kg(e,a.family)).map(a=>a.css??"");return ri([...r,...i])}function $g(e,t=[]){const n=jt(e).hrefs,r=t.map(i=>i.css??"");return ri([...n,...r])}function Ug(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Sd(e){return e.style.fontFamily.trim()||null}function Dl(e,t){let n=Ug(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Sd(n);if(r)return r;n=n.parentElement}return null}function Wa(e){return e instanceof HTMLElement&&Sd(e)!==null}function jl(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Wg(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!ht(r)||!Wa(r)){n=r;continue}if(Gt(r,n),Wa(r)&&(jl(r),Wt(r))){We(r);continue}n=r}}function kd(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function Ad(e){const t=kd(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:ze(t).filter(u=>u.data.length>0),i=(n.length>0?n:[t.startContainer]).map(u=>Dl(e,u)),a=i[0]??null;return i.every(u=>yr(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function Ga(e,t){const n=kd(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;pt(n);const i=ze(n).filter(a=>a.data.length>0);for(const a of i){const l=Dl(e,a);if(r===null){if(l===null)continue;Wg(e,a);continue}yr(l,r)||br(a,u=>{u.style.fontFamily=r})}return an(i),!0}function Gg(e,t){if(t){if(t.value===null){jl(e);return}e.style.fontFamily=t.value}}function Vg(e){return e!=null}function Zg(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function qg(e){var r,i,a;let t=e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0?e.startContainer:e.startContainer.childNodes[e.startOffset]??e.startContainer.lastChild??e.startContainer;if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset>0){const l=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(l,e.startContainer.nextSibling),l}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const l=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(l,e.startContainer),l}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function Va(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!ht(r)||!Wa(r)){n=r;continue}if(Gt(r,n),jl(r),Wt(r)){We(r);continue}n=r.isConnected?r:t}return t}function Yg(e,t){Zg(t);const n=qg(t);return Va(e,n)}function Xg(e,t,n){return!!(n&&n.value===null&&Dl(e,t))}const Jg=`
|
|
4
4
|
@page {
|
|
5
5
|
margin: 0;
|
|
6
6
|
}
|
|
@@ -89,8 +89,8 @@ img {
|
|
|
89
89
|
height: auto;
|
|
90
90
|
vertical-align: middle;
|
|
91
91
|
}
|
|
92
|
-
`.trim();function fa(e,t,n=""){const{hrefs:r,body:i}=Rt(t),a=e.createElement("meta");a.setAttribute("charset","utf-8");const l=e.createElement("title");l.textContent=n;const u=e.createElement("style");u.textContent=Dp;const m=r.map(p=>{const g=e.createElement("link");return g.rel="stylesheet",g.href=p,g});e.head.replaceChildren(a,l,u,...m),e.title=n,e.body.innerHTML=i}const Va=["pt","px","em","rem","%"],Wt="pt",Pp={pt:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],px:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],em:[.5,.75,1,1.25,1.5,2,2.5,3],rem:[.5,.75,1,1.25,1.5,2,2.5,3],"%":[50,75,100,125,150,200,250,300]},jp={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},Ep=new Set(Va),Rp=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function Ro(e){return Ep.has(e)}function De(e){return Math.round(e*100)/100}function Z(e){const t=De(e);return Number.isInteger(t),String(t)}function qa(e,t){return`${Z(e)}${t}`}function Ya(e){const t=e.trim();if(!t)return null;const n=t.match(Rp);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return{value:r,unit:i}}function Tp(e,t){const n=e.trim();if(!n)return null;const r=Ya(n);if(r)return Ro(r.unit)?Gt(r.value,r.unit):null;const i=Number(n.replace(",","."));return Number.isFinite(i)?Gt(i,t):null}function Gt(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=jp[t];return{value:De(Math.min(r,Math.max(n,e))),unit:t}}function vu(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return De(e);case"pt":return De(e*.75);case"em":return De(e/i);case"rem":return De(e/a);case"%":return De(e/i*100)}}function Np(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return e;case"pt":return e*(4/3);case"em":return e*i;case"rem":return e*a;case"%":return e/100*i}}function ku(e,t,n,r,i){if(t===n)return De(e);const a=Np(e,t,r,i);return vu(a,n,r,i)}const Xa="pt",Mp=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,Lp=/^[+-]?0(?:\.0+)?$/;function Pe(e){return`${Z(e.value)}${e.unit}`}function je(e){const t=e.trim();if(!t)return null;if(Lp.test(t))return{value:0,unit:"px"};const n=t.match(Mp);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return Ro(i)?{value:De(r),unit:i}:null}function Zn(e,t,n){const r=e.trim();if(!r)return null;const i=je(r);if(i)return!n&&i.value<0?{...i,value:0}:i;const a=Number(r.replace(",","."));return Number.isFinite(a)?!n&&a<0?{value:0,unit:t}:{value:De(a),unit:t}:null}function Bt(e){return e.value>=0?e:{value:0,unit:e.unit}}function qe(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Vr(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function _p(e,t){return t?e===t||e.contains(t):!1}function Xs(e,t){var a;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0,i;for(;i=n.nextNode();){if(i===t||t.contains(i)||t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)return r;r+=((a=i.textContent)==null?void 0:a.length)??0}return r}function Js(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return Xs(e,t)+n;let r=0;const i=t.childNodes;for(let l=0;l<n&&l<i.length;l+=1)r+=((a=i[l].textContent)==null?void 0:a.length)??0;return Xs(e,t)+r}function Zs(e,t){var l,u;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=Math.max(0,t),i,a=null;for(;i=n.nextNode();){a=i;const m=((l=i.textContent)==null?void 0:l.length)??0;if(r<=m)return{node:i,offset:r};r-=m}return a?{node:a,offset:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function Ja(e,t,n){const r=document.createRange(),i=Zs(e,t),a=Zs(e,n);return r.setStart(i.node,i.offset),r.setEnd(a.node,a.offset),r}function Au(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Qs(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function Ip(e,t){return t.mode!=="visual"?null:t.visualRange&&Au(t.visualRange,e)?t.visualRange:Ja(e,t.start,t.end)}function at(e){var n;if(e.mode==="html"&&e.htmlEl){const r=e.htmlEl.selectionStart,i=e.htmlEl.selectionEnd;return{mode:"html",text:e.htmlEl.value.slice(r,i),collapsed:r===i,start:r,end:i,visualRange:null}}const t=e.visualEl;if(e.mode==="visual"&&t){const r=window.getSelection();if(r&&r.rangeCount>0){const a=r.getRangeAt(0);if(_p(t,a.commonAncestorContainer)){const l=Js(t,a.startContainer,a.startOffset),u=Js(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(l,u),end:Math.max(l,u),visualRange:a.cloneRange()}}}const i=((n=t.textContent)==null?void 0:n.length)??0;return{mode:"visual",text:"",collapsed:!0,start:i,end:i,visualRange:null}}return{mode:e.mode,text:"",collapsed:!0,start:0,end:0,visualRange:null}}function ec(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Fp(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),l=e.snapshot.start,u=e.snapshot.end,m=e.asHtml?e.content:ec(e.content);e.setHtml(a.slice(0,l)+m+a.slice(u));const p=e.htmlEl;if(p){const g=l+m.length;p.focus(),p.setSelectionRange(g,g)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:ec(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&Au(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??Ja(t,e.snapshot.start,e.snapshot.end);if(r.deleteContents(),e.content)if(e.asHtml){const a=r.createContextualFragment(e.content),l=a.lastChild;r.insertNode(a),l&&(r.setStartAfter(l),r.collapse(!0))}else{const a=document.createTextNode(e.content);r.insertNode(a),r.setStartAfter(a),r.collapse(!0)}const i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r),e.setHtml(t.innerHTML)}const Za=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),Du=new Set(["table","thead","tbody","tr","td","th"]),Qa=new Set([...Du,"ul","ol","li","pre","hr"]);function ce(e){return e.tagName.toLowerCase()}function or(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function el(e){return e instanceof HTMLElement&&(ce(e)==="ul"||ce(e)==="ol")}function Ye(e){return e instanceof HTMLElement&&ce(e)==="li"}function dt(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function tl(e){const t=e.collapsed?[]:Le(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function fn(e,t,n){var m,p,g;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let w=0,b;for(;b=h.nextNode();){if(b===t)return w+n;w+=((m=b.textContent)==null?void 0:m.length)??0}return w}let r=0;const i=t.childNodes;for(let h=0;h<n&&h<i.length;h+=1)r+=((p=i[h].textContent)==null?void 0:p.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=0,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return l+r;l+=((g=u.textContent)==null?void 0:g.length)??0}return l+r}function nl(e,t,n){const r=Ja(e,t,n),i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function xn(e,t){const n=dt(e);if(!n)return!1;const r=fn(e,n.startContainer,n.startOffset),i=fn(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=t();return nl(e,a,l),u}function rl(e,t){if(ce(e)===t)return e;const n=document.createElement(t);for(const r of[...e.attributes])n.setAttribute(r.name,r.value);for(;e.firstChild;)n.appendChild(e.firstChild);return e.replaceWith(n),n}function nt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function Bp(e,t){let n=or(t);for(;n&&n!==e;){if(pu(n,e)||ct(n)){n=n.parentElement;continue}const r=ce(n);if(Za.has(r)&&n instanceof HTMLElement)return n;if(Du.has(r)||r==="pre")return null;n=n.parentElement}return null}function wn(e){const t=dt(e);if(!t)return[];const n=new Set,r=[];for(const i of tl(t)){const a=Bp(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function pa(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ce(e);return Za.has(t)||Qa.has(t)?!1:ut(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Hp(e,t){let n=or(t);for(;n&&n!==e;){if(Qa.has(ce(n)))return!0;n=n.parentElement}return!1}function zp(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Op(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&pa(n[i-1]);)i-=1;for(;a<n.length-1&&pa(n[a+1]);)a+=1;return n.slice(i,a+1)}function ga(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&ct(t)))return t;return null}function Kp(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&&ct(r)?ga(e):r}return n.startContainer===t&&e!==t?ga(e):zp(e,n.startContainer)}function $p(e,t){const n=$a(e);if(Hp(e,t.startContainer))return null;if(!ga(n)){const l=document.createElement("p");return l.appendChild(document.createElement("br")),n.appendChild(l),l}const r=Kp(n,e,t);if(!r||r instanceof HTMLElement&&ct(r)||r instanceof Element&&Qa.has(ce(r))||r instanceof HTMLElement&&Za.has(ce(r))||!pa(r))return null;const i=Op(n,r),a=document.createElement("p");n.insertBefore(a,i[0]);for(const l of i)a.appendChild(l);return a}function ir(e){const t=wn(e);if(t.length>0)return t;const n=dt(e);if(!n)return[];const r=$p(e,n);return r?[r]:[]}function pn(e){const t=e.parentElement;return t&&el(t)?t:null}function Pu(e){if(e.length===0)return[];const t=[[e[0]]];for(let n=1;n<e.length;n+=1){const r=e[n-1],i=e[n];r.parentNode===i.parentNode&&Up(r,i)?t[t.length-1].push(i):t.push([i])}return t}function Up(e,t){var r;let n=e.nextSibling;for(;n;){if(n===t)return!0;if(n.nodeType===Node.TEXT_NODE&&!((r=n.textContent)!=null&&r.trim())){n=n.nextSibling;continue}return!1}return!1}function Wp(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Wi(e){const t=e.trim().match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=t[4]===void 0?1:Number(t[4]);return[n,r,i,a].every(l=>Number.isFinite(l))?{r:n,g:r,b:i,a}:null}function Gi(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Vi(e){const t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?t:/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:null}const Gp={black:"#000000",silver:"#c0c0c0",gray:"#808080",grey:"#808080",white:"#ffffff",maroon:"#800000",red:"#ff0000",purple:"#800080",fuchsia:"#ff00ff",magenta:"#ff00ff",green:"#008000",lime:"#00ff00",olive:"#808000",yellow:"#ffff00",navy:"#000080",blue:"#0000ff",teal:"#008080",aqua:"#00ffff",cyan:"#00ffff",orange:"#ffa500"};function Vp(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function be(e){const t=e.trim();if(!t||Vp(t))return null;const n=Vi(t);if(n)return n;const r=Wi(t);if(r)return r.a===0?null:Gi(r.r,r.g,r.b);const i=Gp[t.toLowerCase()];if(i)return i;const a=document.createElement("canvas").getContext("2d");if(!a)return null;a.fillStyle="#010203";try{a.fillStyle=t}catch{return null}const l=String(a.fillStyle);if(l==="#010203"){const m=Vi(t);if(m==="#010203")return m;const p=Wi(t);return p&&Gi(p.r,p.g,p.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(l.startsWith("#"))return Vi(l);const u=Wi(l);return!u||u.a===0?null:Gi(u.r,u.g,u.b)}function ju(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?be(n):null}function fo(e,t,n){let r=Wp(t);for(;r&&r!==e&&r instanceof HTMLElement;){const i=ju(r,n);if(i)return i;r=r.parentElement}return null}function po(e,t){return e instanceof HTMLElement?ju(e,t)!==null:!1}function ol(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function Eu(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function qp(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ut(i)||!po(i,n)){r=i;continue}if(Ft(i,r),po(i,n)&&(ol(i,n),It(i))){Oe(i);continue}r=i}}function Ru(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function go(e,t){const n=Ru(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:Le(n).filter(m=>m.data.length>0),a=(r.length>0?r:[n.startContainer]).map(m=>fo(e,m,t)),l=a[0]??null;return a.every(m=>m===l)?{value:l,mixed:!1}:{value:null,mixed:!0}}function Wn(e,t,n){const r=Ru(e);if(!r||r.collapsed)return!1;const i=n===null?null:be(n);if(n!==null&&i===null)return!1;St(r);const a=Le(r).filter(l=>l.data.length>0);for(const l of a){const u=fo(e,l,t);if(i===null){if(u===null)continue;qp(e,l,t);continue}u!==i&&nr(l,m=>{Eu(m,t,i)})}return Yt(a),!0}function tc(e,t,n){if(n.value===null){ol(e,t);return}const r=be(n.value);r&&Eu(e,t,r)}function Yp(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function Xp(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function Jp(e){var r,i,a;let t=e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0?e.startContainer:e.startContainer.childNodes[e.startOffset]??e.startContainer.lastChild??e.startContainer;if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset>0){const l=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(l,e.startContainer.nextSibling),l}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const l=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(l,e.startContainer),l}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function Tu(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ut(i)||!n.some(a=>po(i,a))){r=i;continue}Ft(i,r);for(const a of n)po(i,a)&&ol(i,a);if(It(i)){Oe(i);continue}r=i.isConnected?i:t}return t}function Zp(e,t,n){Xp(t);const r=Jp(t);return Tu(e,r,n)}function Qp(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&fo(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&fo(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Te=["top","right","bottom","left"],To=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],rt={top:null,right:null,bottom:null,left:null},il={style:"none",width:null,color:null},eg=new Set(To),nc={value:0,unit:"px"};function tg(){return{margin:{...rt},padding:{...rt},lineHeight:null,border:{...il},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null}}function al(){const e=tg();return{margin:e.margin,marginMixed:!1,padding:e.padding,paddingMixed:!1,lineHeight:e.lineHeight,lineHeightMixed:!1,border:e.border,borderMixed:!1,borderRadius:e.borderRadius,radiusMixed:!1,boxShadow:e.boxShadow,shadowMixed:!1,backgroundColor:e.backgroundColor,backgroundMixed:!1,opacity:e.opacity,opacityMixed:!1}}function vt(e,t){return Te.every(n=>qe(e[n],t[n]))}function Nu(e,t){return e===t?!0:!e||!t||e.kind!==t.kind?!1:e.kind==="normal"||t.kind==="normal"?!0:e.kind==="number"&&t.kind==="number"?e.value===t.value:e.kind==="length"&&t.kind==="length"&&e.value===t.value&&e.unit===t.unit}function Mu(e,t){return e.style===t.style&&qe(e.width,t.width)&&e.color===t.color}function Lu(e,t){return e===t?!0:!e||!t?!1:qe(e.offsetX,t.offsetX)&&qe(e.offsetY,t.offsetY)&&qe(e.blur,t.blur)&&qe(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function ng(e){return e.kind==="normal"?"normal":e.kind==="number"?Z(e.value):Pe({value:e.value,unit:e.unit})}function rg(e){const t=e.trim();if(!t)return null;if(t.endsWith("%")){const r=Number(t.slice(0,-1).trim().replace(",","."));return Number.isFinite(r)?Nt(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?Nt(n):null}function Nt(e){return De(Math.min(1,Math.max(0,e)))}function ho(e){return De(Nt(e)*100)}function _u(e){return Nt(e/100)}function Iu(e){return Z(Nt(e))}function og(e){const t=e.trim();if(!t)return null;if(t.toLowerCase()==="normal")return{kind:"normal"};if(/^[+]?(?:\d+(?:\.\d+)?|\.\d+)$/.test(t)){const r=Number(t);return!Number.isFinite(r)||r<0?null:{kind:"number",value:De(r)}}const n=je(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function ig(e,t){const n=[];let r="",i=0;for(const a of e){if(a==="("){i+=1,r+=a;continue}if(a===")"){i=Math.max(0,i-1),r+=a;continue}if(a===t&&i===0){r.trim()&&n.push(r.trim()),r="";continue}r+=a}return r.trim()&&n.push(r.trim()),n}function ag(e){const t=[];let n="",r=0;for(const i of e){if(i==="("){r+=1,n+=i;continue}if(i===")"){r=Math.max(0,r-1),n+=i;continue}if(/\s/.test(i)&&r===0){n&&t.push(n),n="";continue}n+=i}return n&&t.push(n),t}function lg(e){const t=[Pe(e.offsetX),Pe(e.offsetY),Pe(e.blur),Pe(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function sg(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=ig(t,",")[0];if(!n)return null;const r=ag(n);let i=!1,a=null;const l=[];for(const u of r){if(u.toLowerCase()==="inset"){i=!0;continue}const m=je(u);if(m){l.push(m);continue}const p=be(u);if(p){a=p;continue}return null}return l.length<2||l.length>4?null:{offsetX:l[0],offsetY:l[1],blur:l[2]??nc,spread:l[3]??nc,color:a,inset:i}}function an(e,t){return je(e.style.getPropertyValue(t))}function cg(e,t,n,r){const i=n&&r?Bt(n):n,a=i?Pe(i):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function rc(e,t){return{top:an(e,`${t}-top`),right:an(e,`${t}-right`),bottom:an(e,`${t}-bottom`),left:an(e,`${t}-left`)}}function oc(e,t,n,r){let i=!1;for(const a of Te)cg(e,`${t}-${a}`,n[a],r)&&(i=!0);return i}function ug(e){const t=e.trim().toLowerCase();return eg.has(t)?t:"none"}function Fu(e){const t=ug(e.style.borderStyle||e.style.borderTopStyle),n=an(e,"border-width")??an(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,i=r?be(r):null;return{style:t,width:n,color:i}}function dg(e,t){const n=Fu(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?Bt(t.width):null,color:t.color};return Mu(n,r)?!1:r.style==="none"?(e.style.removeProperty("border"),e.style.removeProperty("border-style"),e.style.removeProperty("border-width"),e.style.removeProperty("border-color"),!0):(e.style.borderStyle=r.style,r.width?e.style.borderWidth=Pe(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function Bu(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return je(n)}function mg(e,t){const n=t?Bt(t):null,r=Bu(e);return qe(r,n)?!1:(n?e.style.borderRadius=Pe(n):e.style.removeProperty("border-radius"),!0)}function Hu(e){return sg(e.style.boxShadow)}function fg(e,t){const n=Hu(e),r=t?{...t,blur:Bt(t.blur)}:null;return Lu(n,r)?!1:(r?e.style.boxShadow=lg(r):e.style.removeProperty("box-shadow"),!0)}function zu(e){return og(e.style.lineHeight)}function pg(e,t){const n=zu(e);return Nu(n,t)?!1:(t?e.style.lineHeight=ng(t):e.style.removeProperty("line-height"),!0)}function Ou(e){const t=e.style.backgroundColor;return t?be(t):null}function gg(e,t){const n=t?be(t):null;return Ou(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Ku(e){return rg(e.style.opacity)}function hg(e,t){const n=Ku(e),r=t===null?null:Nt(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Iu(r),!0)}function Cn(e){return{margin:rc(e,"margin"),padding:rc(e,"padding"),lineHeight:zu(e),border:Fu(e),borderRadius:Bu(e),boxShadow:Hu(e),backgroundColor:Ou(e),opacity:Ku(e)}}function Sn(e,t){let n=!1;return!t.marginMixed&&oc(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&oc(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&pg(e,t.lineHeight)&&(n=!0),!t.borderMixed&&dg(e,t.border)&&(n=!0),!t.radiusMixed&&mg(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&fg(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&gg(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&hg(e,t.opacity)&&(n=!0),n&&nt(e),n}function bg(e){const t=al(),n=wn(e);if(n.length===0)return t;const r=n.map(Cn),i=r[0];return{margin:i.margin,marginMixed:r.some(a=>!vt(a.margin,i.margin)),padding:i.padding,paddingMixed:r.some(a=>!vt(a.padding,i.padding)),lineHeight:i.lineHeight,lineHeightMixed:r.some(a=>!Nu(a.lineHeight,i.lineHeight)),border:i.border,borderMixed:r.some(a=>!Mu(a.border,i.border)),borderRadius:i.borderRadius,radiusMixed:r.some(a=>!qe(a.borderRadius,i.borderRadius)),boxShadow:i.boxShadow,shadowMixed:r.some(a=>!Lu(a.boxShadow,i.boxShadow)),backgroundColor:i.backgroundColor,backgroundMixed:r.some(a=>a.backgroundColor!==i.backgroundColor),opacity:i.opacity,opacityMixed:r.some(a=>a.opacity!==i.opacity)}}function yg(e,t){return xn(e,()=>{const n=ir(e);if(n.length===0)return!1;let r=!1;for(const i of n)Sn(i,t)&&(r=!0);return r})}const bo="data-page-at-rule";function Vt(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...rt},marginMixed:!1}}function ll(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function $u(e){return e.body.innerHTML}function Uu(e){var r;const n=ll(e).querySelector(`style[${bo}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function qr(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?je(r[1].trim()):null}function xg(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...rt};const n=t[1].trim().split(/\s+/).map(u=>je(u)),[r,i=r,a=r,l=i]=n;return{top:r??null,right:i??null,bottom:a??null,left:l??null}}function wg(e){const t=e.match(/(?:^|[\s{;])size\s*:\s*([^;]+)/i);if(!t)return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null};const n=t[1].trim().toLowerCase();if(n==="auto")return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null};if(n==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:null};if(n==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:null};if(n==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:null};const r=n.includes("landscape"),i=n.includes("portrait"),a=r?"landscape":i?"portrait":null,u=n.replace(/\b(landscape|portrait)\b/g,"").trim().split(/\s+/).filter(Boolean);if(u.length>=2){const m=je(u[0]),p=je(u[1]);if(m&&p)return{sizePreset:"custom",customWidth:m,customHeight:p,orientation:a}}return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:a}}function Cg(e){const t=Vt();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],i=wg(r),a={top:qr(r,"top"),right:qr(r,"right"),bottom:qr(r,"bottom"),left:qr(r,"left")},u=Te.some(m=>a[m]!==null)?a:xg(r);return{...i,margin:u,marginMixed:!1}}function Wu(e){return Cg(Uu(e))}function Sg(e){const t=Te.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?Pe(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:Te.map(r=>e[r]?`margin-${r}: ${Pe(e[r])};`:null).filter(Boolean).join(" ")}function vg(e){if(e.sizePreset==="auto"&&!e.orientation)return null;const t=[];return e.sizePreset==="A4"?t.push("A4"):e.sizePreset==="letter"?t.push("letter"):e.sizePreset==="legal"?t.push("legal"):e.sizePreset==="custom"&&e.customWidth&&e.customHeight&&t.push(Pe(e.customWidth),Pe(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function kg(e){const t=vg(e),n=Sg(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function Ag(e){const t=ll(e);for(const n of t.querySelectorAll(`style[${bo}]`))n.remove();return $u(t)}function Dg(e,t){const n=ll(e);let r=n.querySelector(`style[${bo}]`);return r||(r=n.createElement("style"),r.setAttribute(bo,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,$u(n)}function Pg(e,t){const n=kg(t);return n?Dg(e,n):Gu(e)}function Gu(e){return Ag(e)}function jg(e){const t=e.map(n=>Uu(n)).filter(n=>!!n);return t.length===0?"":t.join(`
|
|
93
|
-
`)}const Eg=1e3;function Vu(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.right="0",e.style.bottom="0",e.style.width="0",e.style.height="0",e.style.border="0",document.body.append(e);const t=e.contentDocument,n=e.contentWindow;return!t||!n?(e.remove(),null):{iframe:e,doc:t,win:n}}function qu(e,t,n,r){fa(e,r);let i=!1;const a=()=>{i||(i=!0,n.remove())};t.addEventListener("afterprint",a),t.focus(),t.print(),window.setTimeout(a,Eg)}function Rg(e){const t=Vu();t&&qu(t.doc,t.win,t.iframe,e)}function Tg(e){const t=Vu();if(!t)return;const n=[],r=[];for(const u of e){const m=Rt(u);n.push(...m.hrefs),r.push(m.body)}const i=r.map((u,m)=>`<div style="${m<r.length-1?"page-break-after: always;":""}">${u}</div>`).join(""),a=jg(e),l=[a?`<style>${a}</style>`:"",...Array.from(new Set(n)).map(u=>`<link rel="stylesheet" href="${u}" />`),i].filter(Boolean).join("");qu(t.doc,t.win,t.iframe,l)}function Ng(e){return{save:async()=>{if(e.onSave){const n=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(n);return}const t=e.isMultiPagesEnabled()?e.getActivePageHtml():e.getHtml();await ap(t)},open:async()=>{const t=e.onOpen?await e.onOpen():await lp();if(t!==null){if(Array.isArray(t)){e.setHtml(lt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(lt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){Tg(e.getAllPagesHtml());return}Rg(e.getHtml())}}}function Mg(e){return{toggleBold:()=>{e.toggleFontMark("bold")},toggleItalic:()=>{e.toggleFontMark("italic")},toggleUnderline:()=>{e.toggleFontMark("underline")},toggleStrikethrough:()=>{e.toggleFontMark("strikethrough")},clearFormatting:()=>{e.clearFormatting()},toggleFormatBrush:()=>{e.toggleFormatBrush()},setFontSize:(t,n)=>{e.setFontSize(t,n)},setFontSizeUnit:t=>{e.setFontSizeUnit(t)},setFontFamily:t=>{e.setFontFamily(t)},setFontColor:t=>{e.setFontColor(t)},setHighlightColor:t=>{e.setHighlightColor(t)},setParagraphStyle:t=>{e.setParagraphStyle(t)},alignLeft:()=>{e.setTextAlign("left")},alignCenter:()=>{e.setTextAlign("center")},alignRight:()=>{e.setTextAlign("right")},alignJustify:()=>{e.setTextAlign("justify")},indent:()=>{e.indent()},outdent:()=>{e.outdent()},toggleBulletList:()=>{e.toggleList("ul")},toggleNumberedList:()=>{e.toggleList("ol")},openFontProperties:t=>{e.openFontProperties(t??"general")},applyFontProperties:t=>{e.applyFontProperties(t)},openParagraphProperties:t=>{e.openParagraphProperties(t??"general")},applyParagraphProperties:t=>{e.applyParagraphProperties(t)},openPageProperties:t=>{e.openPageProperties(t??"font")},applyPageProperties:t=>{e.applyPageProperties(t)},openCustomParagraphStyleDialog:t=>{e.openCustomParagraphStyleDialog(t)},applyCustomParagraphStyle:t=>{e.applyCustomParagraphStyle(t)},openCustomCss:()=>{e.openCustomCss()},applyCustomCss:t=>{e.applyCustomCss(t)}}}function Lg(e){return{isBold:()=>e.isFontMarkActive("bold"),isItalic:()=>e.isFontMarkActive("italic"),isUnderline:()=>e.isFontMarkActive("underline"),isStrikethrough:()=>e.isFontMarkActive("strikethrough"),getFontSize:()=>e.getFontSize(),getFontSizeUnit:()=>e.getFontSizeUnit(),isFontSizeMixed:()=>e.isFontSizeMixed(),getFontFamily:()=>e.getFontFamily(),isFontFamilyMixed:()=>e.isFontFamilyMixed(),getFontFaces:()=>e.getFontFaces(),getFontColor:()=>e.getFontColor(),isFontColorMixed:()=>e.isFontColorMixed(),getHighlightColor:()=>e.getHighlightColor(),isHighlightColorMixed:()=>e.isHighlightColorMixed(),getParagraphStyle:()=>e.getParagraphStyle(),isParagraphStyleMixed:()=>e.isParagraphStyleMixed(),isAlignLeft:()=>e.getTextAlign()==="left"&&!e.isTextAlignMixed(),isAlignCenter:()=>e.getTextAlign()==="center"&&!e.isTextAlignMixed(),isAlignRight:()=>e.getTextAlign()==="right"&&!e.isTextAlignMixed(),isAlignJustify:()=>e.getTextAlign()==="justify"&&!e.isTextAlignMixed(),canOutdent:()=>e.canOutdent(),isBulletList:()=>e.isBulletList(),isNumberedList:()=>e.isNumberedList(),hasTextSelection:()=>e.hasTextSelection(),isFormatBrushActive:()=>e.isFormatBrushActive(),customParagraphStylesEnabled:()=>e.customParagraphStylesEnabled(),getCustomParagraphStyles:()=>e.getCustomParagraphStyles(),isCustomParagraphStylesLoading:()=>e.isCustomParagraphStylesLoading()}}function _g(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function Ig(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function Fg(e){return{openLinkDialog:t=>{e.openLinkDialog(t)},applyLink:t=>{e.applyLink(t)},openBookmarkDialog:()=>{e.openBookmarkDialog()},applyBookmark:t=>{e.applyBookmark(t)},openImageDialog:()=>{e.openImageDialog()},applyImage:t=>{e.applyImage(t)},openAudioDialog:()=>{e.openAudioDialog()},applyAudio:t=>{e.applyAudio(t)},openYoutubeDialog:()=>{e.openYoutubeDialog()},applyYoutube:t=>{e.applyYoutube(t)},openImageProperties:t=>{e.openImageProperties(t)},applyImageProperties:t=>{e.applyImageProperties(t)},insertHorizontalRule:()=>{e.insertHorizontalRule()},insertPage:()=>{e.insertPage()}}}function Bg(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),canInsertPage:()=>e.isMultiPagesEnabled()&&e.getMode()==="visual"}}function Hg(e){return{openTableDialog:()=>{e.openTableDialog()},applyTable:t=>{e.applyTable(t)},openTableProperties:()=>{e.openTableProperties()},applyTableProperties:t=>{e.applyTableProperties(t)},openCellProperties:()=>{e.openCellProperties()},applyCellProperties:t=>{e.applyCellProperties(t)},openRowProperties:()=>{e.openRowProperties()},applyRowProperties:t=>{e.applyRowProperties(t)},insertRowBelow:()=>{e.insertRowBelow()},insertRowBefore:()=>{e.insertRowBefore()},deleteRow:()=>{e.deleteRow()},insertColumnAfter:()=>{e.insertColumnAfter()},insertColumnBefore:()=>{e.insertColumnBefore()},deleteColumn:()=>{e.deleteColumn()},mergeCells:()=>{e.mergeCells()},unmergeCells:()=>{e.unmergeCells()}}}function zg(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}function Og(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},toggleReadAloud:()=>{e.toggleReadAloud()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function Kg(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom",isReadingAloud:()=>e.isReadingAloud(),canReadAloud:()=>e.canReadAloud()}}function $g(e){return{...Ng(e),..._g(e),..._f(e),...Fg(e),...Hg(e),...Og(e),...Mg(e)}}function Ug(e){return{...Kg(e),...Ig(e),...Bg(e),...zg(e),...Lg(e)}}function yo(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Wg(e){const t=e.style.fontSize;if(!t)return null;const n=Ya(t);return!n||!Ro(n.unit)?null:{value:n.value,unit:n.unit}}function Yu(e,t){let n=yo(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Wg(n);if(r)return r;n=n.parentElement}return null}function Gg(e,t){const n=yo(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function Xu(e,t){var a;let n=yo(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,m=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(m)&&m>0?m:16}n=n.parentElement}const r=((a=yo(t))==null?void 0:a.parentElement)??e,i=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(i)&&i>0?i:16}function Ju(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function Vg(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function ic(e=Wt){return{value:null,unit:e,mixed:!1}}function Zu(e,t=Wt){const n=window.getSelection();if(!n||n.rangeCount===0)return ic(t);const r=n.getRangeAt(0);if(!se(e,r.commonAncestorContainer))return ic(t);const i=r.collapsed?[]:Le(r).filter(p=>p.data.length>0),a=i.length>0?i:[r.startContainer],l=a.map(p=>Yu(e,p)),u=l[0];if(l.every(p=>Vg(p,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(l.every(p=>p===null)){const p=a.map(h=>Gg(h,e)),g=p[0];if(p.every(h=>Math.abs(h-g)<.05)){const h=Xu(e,a[0]),w=Ju(e);return{value:vu(g,t,h,w),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function qg(e,t){return{parentPx:Xu(e,t),rootPx:Ju(e)}}function Yg(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function ha(e,t,n){const r=Gt(t,n);if(!r)return!1;const i=Yg(e);if(!i||i.collapsed)return!1;const a=qa(r.value,r.unit);St(i);const l=Le(i).filter(u=>u.data.length>0);for(const u of l){const m=Yu(e,u);m&&m.value===r.value&&m.unit===r.unit||nr(u,p=>{p.style.fontSize=a})}return Yt(l),!0}function Xg(e,t){e.style.fontSize=qa(t.value,t.unit)}function Jg(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Zg(e){return e.trim().toLowerCase()}function ba(e){const t={};for(const n of e.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=Zg(r.slice(0,i)),l=r.slice(i+1).trim();a&&(t[a]=l)}return t}function Qu(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function Qg(e,t){const n={...e};for(const[r,i]of Object.entries(t))i.trim()?n[r]=i:delete n[r];return n}function eh(e){const t=e.trim();if(!t)return"";const n=t.split(";").map(r=>r.trim()).filter(Boolean);return n.length===0?"":n.map(r=>`${r};`).join(`
|
|
94
|
-
`)}function No(e){const t=ba(e);return Qu(t)}function th(e,t){let n=Jg(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function ed(e){const t=dt(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:Le(t).filter(m=>m.data.length>0),a=(n.length>0?n:[t.startContainer]).map(m=>th(e,m)).map(m=>m.trim()),l=a[0]??"";return a.every(m=>m===l)?{value:l||null,mixed:!1}:{value:null,mixed:!0}}function td(e,t){const n=ba(e.style.cssText),r=ba(t),i=Qg(n,r),a=Qu(i);a?e.style.cssText=a:e.removeAttribute("style")}function nd(e,t){const n=No(t);if(!n)return!1;const r=dt(e);if(!r||r.collapsed)return!1;St(r);const i=Le(r).filter(a=>a.data.length>0);if(i.length===0)return!1;for(const a of i)nr(a,l=>{td(l,n),It(l)&&Oe(l)});return Yt(i),!0}function nh(e,t){const n=No(t);n&&td(e,n)}function rh(e){return!!(e&&No(e))}const Xe=["bold","italic","underline","strikethrough"],ln={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},oh=new Set(["underline","line-through","overline"]);function Ct(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function ih(e,t){return Xe.every(n=>e[n]===t[n])}function ah(e){return Xe.some(t=>e[t]!==void 0)}function rd(e,t){const n={...e};if(!t)return n;for(const r of Xe){const i=t[r];i!==void 0&&(n[r]=i)}return n}function lh(e,t,n){const r=e[n]??t[n],i={...e,[n]:!r};return i[n]===t[n]&&delete i[n],i}function Mt(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>oh.has(n))}function gn(e,t){if(t.length===0){e.style.textDecorationLine="",e.style.removeProperty("text-decoration-line"),e.style.textDecoration&&(e.style.textDecoration="",e.style.removeProperty("text-decoration"));return}e.style.textDecorationLine=t.join(" ")}function od(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(ln.bold.has(r))return!0;const l=n.style.fontWeight;if(!l)return null;if(l==="bold"||l==="bolder")return!0;const u=Number(l);return Number.isNaN(u)?l==="normal"||l==="lighter"?!1:null:u>=700}if(t==="italic"){if(ln.italic.has(r))return!0;const l=n.style.fontStyle;return l?l==="italic"||l==="oblique"?!0:l==="normal"?!1:null:null}if(t==="underline"){if(ln.underline.has(r))return!0;const l=n.style.textDecorationLine||n.style.textDecoration;if(!l)return null;if(l==="none")return!1;const u=Mt(n);return u.includes("underline")?!0:u.length>0?!1:null}if(ln.strikethrough.has(r))return!0;const i=n.style.textDecorationLine||n.style.textDecoration;if(!i)return null;if(i==="none")return!1;const a=Mt(n);return a.includes("line-through")?!0:a.length>0?!1:null}function xo(e,t){return od(e,t)===!0}function hn(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const i=od(r,n);if(i!==null)return i;r=r.parentElement}return!1}function id(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=Mt(e);r.includes("underline")||r.push("underline"),gn(e,r);return}const n=Mt(e);n.includes("line-through")||n.push("line-through"),gn(e,n)}function ad(e,t){if(t==="bold"){e.style.fontWeight="",e.style.removeProperty("font-weight");return}if(t==="italic"){e.style.fontStyle="",e.style.removeProperty("font-style");return}if(t==="underline"){gn(e,Mt(e).filter(n=>n!=="underline"));return}gn(e,Mt(e).filter(n=>n!=="line-through"))}function sh(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=Mt(e).filter(i=>i!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}gn(e,r);return}const n=Mt(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}gn(e,n)}function ch(e,t){nr(e,n=>id(n,t))}function uh(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ut(i)||!xo(i,n)){r=i;continue}if(Ft(i,r),xo(i,n)){if(ln[n].has(i.tagName.toLowerCase())){Oe(i);continue}if(ad(i,n),It(i)){Oe(i);continue}}r=i}}function dh(e,t,n){const r=Le(t).filter(i=>i.data.length>0);return r.length===0?hn(e,t.startContainer,n):r.every(i=>hn(e,i,n))}function mh(e,t,n,r){St(t);const i=Le(t).filter(a=>a.data.length>0);for(const a of i)r?hn(e,a,n)||ch(a,n):uh(e,a,n);Yt(i)}function sn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Ct();const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return Ct();if(n.collapsed)return ya(e,n);const r=Le(n).filter(a=>a.data.length>0);if(r.length===0)return ya(e,n);const i=Ct();for(const a of Xe)i[a]=hn(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const l of Xe)i[l]=i[l]&&hn(e,r[a],l);return i}function ya(e,t){const n=Ct();for(const r of Xe)n[r]=hn(e,t.startContainer,r);return n}function xa(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!se(e,r.commonAncestorContainer)||r.collapsed)return!1;const i=dh(e,r,t);return mh(e,r,t,!i),!0}function fh(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function ph(e,t,n){var a,l,u;fh(t);let r=t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0?t.startContainer:t.startContainer.childNodes[t.startOffset]??t.startContainer.lastChild??t.startContainer;if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset>0){const m=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(m,t.startContainer.nextSibling),r=m}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const m=document.createTextNode("");(l=t.startContainer.parentNode)==null||l.insertBefore(m,t.startContainer),r=m}else{const m=document.createTextNode("");r&&r!==t.startContainer?(u=r.parentNode)==null||u.insertBefore(m,r):t.startContainer.appendChild(m),r=m}let i=r;for(;i.parentElement&&i.parentElement!==e;){const m=i.parentElement;if(!ut(m)){i=m;continue}if(!n.some(g=>xo(m,g))){i=m;continue}Ft(m,i);for(const g of n)if(xo(m,g)){if(ln[g].has(m.tagName.toLowerCase())){Oe(m);break}if(ad(m,g),It(m)){Oe(m);break}}i=m.isConnected?m:r}return r}function gh(e,t,n){for(const r of Xe)n[r]!==t[r]&&(n[r]?id(e,r):sh(e,r))}function hh(e,t,n,r,i,a,l){var A,v;const u=window.getSelection();if(!u||u.rangeCount===0)return;const m=u.getRangeAt(0);if(!se(e,m.commonAncestorContainer))return;const p=ya(e,m),g=rd(p,n),h=Xe.filter(j=>p[j]&&!g[j]),w=Qp(e,m.startContainer,i),b=Ap(e,m.startContainer,a);let x=null;h.length>0?(x=ph(e,m,h),w.length>0&&Tu(e,x,w),b&&ma(e,x)):w.length>0?(x=Zp(e,m,w),b&&ma(e,x)):b?x=kp(e,m):m.deleteContents();const y=document.createElement("span");gh(y,p,g),r&&Xg(y,r),i!=null&&i.color&&tc(y,"color",i.color),i!=null&&i.backgroundColor&&tc(y,"backgroundColor",i.backgroundColor),a&&wp(y,a),l&&nh(y,l),y.textContent=t;const S=y.style.cssText.trim()?y:document.createTextNode(t);x?((A=x.parentNode)==null||A.insertBefore(S,x),x.nodeType===Node.TEXT_NODE&&!x.data&&((v=x.parentNode)==null||v.removeChild(x))):m.insertNode(S);const C=document.createRange();C.selectNodeContents(S),C.collapse(!1),u.removeAllRanges(),u.addRange(C)}const wo=["p","h1","h2","h3","h4","h5","h6"],bh=new Set(wo),ld=new Set([...wo,"div"]),Mo=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),yh=()=>({tag:null,mixed:!1});function sd(e){return bh.has(e)}function xh(e){return sd(e)?e:e==="div"?"p":null}function wh(e){return e instanceof Element&&Mo.has(ce(e))}function cd(e){return e instanceof HTMLElement&&!ct(e)&&ld.has(ce(e))}function wa(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ce(e);return ld.has(t)||Mo.has(t)?!1:ut(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Ch(e,t){let n=or(t);for(;n&&n!==e;){if(Mo.has(ce(n)))return!0;n=n.parentElement}return!1}function ud(e,t){let n=or(t);for(;n&&n!==e;){if(pu(n,e)){n=n.parentElement;continue}if(cd(n))return n;if(Mo.has(ce(n)))return null;n=n.parentElement}return null}function Sh(e,t){const n=new Set,r=[];for(const i of tl(t)){const a=ud(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function vh(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function kh(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&wa(n[i-1]);)i-=1;for(;a<n.length-1&&wa(n[a+1]);)a+=1;return n.slice(i,a+1)}function Ca(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&ct(t)))return t;return null}function Ah(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&&ct(r)?Ca(e):r}return n.startContainer===t&&e!==t?Ca(e):vh(e,n.startContainer)}function Dh(e,t,n){const r=$a(e);if(Ch(e,t.startContainer))return!1;if(!Ca(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const i=Ah(r,e,t);if(!i||i instanceof HTMLElement&&ct(i)||wh(i)||cd(i)||!wa(i))return!1;const a=kh(r,i),l=document.createElement(n);r.insertBefore(l,a[0]);for(const u of a)l.appendChild(u);return!0}function Ph(e){const t=dt(e);if(!t)return yh();const n=tl(t).map(i=>{const a=ud(e,i);return a?xh(ce(a)):null}),r=n[0];return n.every(i=>i===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function jh(e,t){if(!sd(t))return!1;const n=dt(e);if(!n)return!1;const r=fn(e,n.startContainer,n.startOffset),i=fn(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=Sh(e,n);let m=!1;if(u.length===0)m=Dh(e,n,t);else for(const p of u)ce(p)!==t&&(rl(p,t),m=!0);return nl(e,a,l),m}function sl(e){if(!Ye(e))return null;const t=pn(e);if(!t)return null;const n=ce(t);return n==="ul"||n==="ol"?n:null}function dd(e){const t=wn(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(sl),r=n[0];return n.every(i=>i===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function Eh(e,t,n){const r=[...e.children].filter(i=>el(i));for(const i of r)t.insertBefore(i,n)}function md(e){const t=pn(e),n=document.createElement("p");for(const p of[...e.attributes])n.setAttribute(p.name,p.value);for(n.style.marginLeft="",nt(n);e.firstChild&&!el(e.firstChild);)n.appendChild(e.firstChild);const r=[];let i=e.nextElementSibling;for(;i;)r.push(i),i=i.nextElementSibling;const a=(t==null?void 0:t.parentNode)??e.parentNode;if(!t||!a)return e.replaceWith(n),n;const l=Ye(a)?a.parentNode??a:a,u=Ye(a)?a.nextSibling:t.nextSibling;e.remove();let m=null;if(r.length>0){m=document.createElement(t.tagName);for(const p of r)m.appendChild(p)}return l.insertBefore(n,u),m&&l.insertBefore(m,n.nextSibling),Eh(e,l,n.nextSibling),t.childElementCount===0&&t.remove(),n}function Rh(e){if(Ye(e))return e;const t=rl(e,"li");return t.style.marginLeft="",nt(t),t}function fd(e,t){if(e.length===0)return!1;if(e.every(Ye)){const a=pn(e[0]);if(a&&e.every(l=>l.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return ce(a)===t?!1:(rl(a,t),!0)}const n=e[0],r=n.parentNode;if(!r)return!1;const i=document.createElement(t);r.insertBefore(i,n);for(const a of e){const l=Ye(a)?pn(a):null;i.appendChild(Rh(a)),l&&l!==i&&l.childElementCount===0&&l.remove()}return!0}function pd(e){let t=!1;for(const n of[...e].reverse())Ye(n)&&(md(n),t=!0);return t}function Th(e,t){return xn(e,()=>{const n=ir(e);if(n.length===0)return!1;if(n.every(a=>sl(a)===t))return pd(n);let i=!1;for(const a of Pu(n))fd(a,t)&&(i=!0);return i})}function Nh(e,t){return xn(e,()=>{const n=ir(e);if(n.length===0)return!1;if(t===null)return pd(n);if(n.every(a=>sl(a)===t))return!1;let i=!1;for(const a of Pu(n))fd(a,t)&&(i=!0);return i})}const gd=40;function cl(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function hd(e,t){if(t<=0){e.style.marginLeft="",nt(e);return}e.style.marginLeft=`${t}px`}function Mh(e){let t=e.previousElementSibling;for(;t;){if(Ye(t))return t;t=t.previousElementSibling}return null}function Lh(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(ce(n)==="ul"||ce(n)==="ol"))return n}return null}function _h(e){const t=Mh(e);if(!t)return!1;const n=pn(e);if(!n)return!1;const r=ce(n)==="ol"?"ol":"ul";let i=Lh(t);return(!i||ce(i)!==r)&&(i=document.createElement(r),t.appendChild(i)),i.appendChild(e),!0}function Ih(e){const t=pn(e);if(!t)return!1;const n=t.parentElement;if(n&&Ye(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return md(e),!0}function Fh(e){return wn(e).some(n=>Ye(n)||cl(n)>0)}function Bh(e){return xn(e,()=>{const t=ir(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Ye(r)){_h(r)&&(n=!0);continue}hd(r,cl(r)+gd),n=!0}return n})}function Hh(e){return xn(e,()=>{const t=wn(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Ye(r)){Ih(r)&&(n=!0);continue}const i=cl(r);i<=0||(hd(r,Math.max(0,i-gd)),n=!0)}return n})}const bd=["left","center","right","justify"];function zh(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function Oh(e){return zh(e.style.textAlign)}function yd(e){const t=wn(e);if(t.length===0)return dt(e)?{align:"left",mixed:!1}:{align:null,mixed:!1};const n=t.map(Oh),r=n[0];return n.every(i=>i===r)?{align:r,mixed:!1}:{align:null,mixed:!0}}function xd(e,t){return bd.includes(t)?xn(e,()=>{const n=ir(e);if(n.length===0)return!1;let r=!1;for(const i of n)i.style.textAlign!==t&&(i.style.textAlign=t,r=!0);return r}):!1}function Gn(){return{...al(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function ac(e){const t=bg(e),n=yd(e),r=dd(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function wd(e,t){let n=!1;return!t.alignMixed&&t.align&&xd(e,t.align)&&(n=!0),t.listMixed||Nh(e,t.list)&&(n=!0),yg(e,t)&&(n=!0),n}function Kh(e,t){return wd(e,Sa(t))}function Cd(e){return{align:e.alignMixed?void 0:e.align??"left",list:e.listMixed?void 0:e.list,margin:e.marginMixed?void 0:e.margin,padding:e.paddingMixed?void 0:e.padding,lineHeight:e.lineHeightMixed?void 0:e.lineHeight,border:e.borderMixed?void 0:e.border,borderRadius:e.radiusMixed?void 0:e.borderRadius,boxShadow:e.shadowMixed?void 0:e.boxShadow,backgroundColor:e.backgroundMixed?void 0:e.backgroundColor,opacity:e.opacityMixed?void 0:e.opacity}}function Sa(e){const t=Gn();return e?{align:e.align??t.align,alignMixed:e.align===void 0,list:e.list===void 0?t.list:e.list,listMixed:e.list===void 0,margin:e.margin??t.margin,marginMixed:e.margin===void 0,padding:e.padding??t.padding,paddingMixed:e.padding===void 0,lineHeight:e.lineHeight===void 0?t.lineHeight:e.lineHeight,lineHeightMixed:e.lineHeight===void 0,border:e.border??t.border,borderMixed:e.border===void 0,borderRadius:e.borderRadius===void 0?t.borderRadius:e.borderRadius,radiusMixed:e.borderRadius===void 0,boxShadow:e.boxShadow===void 0?t.boxShadow:e.boxShadow,shadowMixed:e.boxShadow===void 0,backgroundColor:e.backgroundColor===void 0?t.backgroundColor:e.backgroundColor,backgroundMixed:e.backgroundColor===void 0,opacity:e.opacity===void 0?t.opacity:e.opacity,opacityMixed:e.opacity===void 0}:{...t,alignMixed:!0,listMixed:!0,marginMixed:!0,paddingMixed:!0,lineHeightMixed:!0,borderMixed:!0,radiusMixed:!0,shadowMixed:!0,backgroundMixed:!0,opacityMixed:!0}}const $h=2*1024*1024,Uh="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",Wh=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),Gh=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),Vh=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,qh=/^(javascript|vbscript|file|blob):/i;function Yh(e={}){return{src:"",alt:"",title:"",...e}}function vn(e){const t=e.trim();if(!t)return"empty";if(qh.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return Vh.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function Xh(e){return e.size>$h?"tooLarge":tb(e)?null:"type"}function Jh(e){const t=Xh(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(vn(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function Zh(e,t){e.setAttribute("src",t.src.trim());const n=t.alt.trim(),r=t.title.trim();n?e.setAttribute("alt",n):e.removeAttribute("alt"),r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",Qh(e,t.css)}function Qh(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function eb(e,t){const n=Yh(t);if(vn(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!se(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("img");return Zh(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function va(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function qi(e,t){if(!se(e,t)||t===e)return!1;const n=document.createRange();n.selectNode(t);const r=window.getSelection();return r?(r.removeAllRanges(),r.addRange(n),!0):!1}function tb(e){const t=e.type.trim().toLowerCase();if(t&&Wh.has(t))return!0;const n=nb(e.name);return!!(!t&&n&&Gh.has(n))}function nb(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Sd=["%","px","pt","pc","em","rem"],rb="%",ob={"%":[25,50,75,100,125,150,200],px:[50,100,150,200,300,400,600,800],pt:[36,48,72,96,144,192,288],pc:[3,4,6,8,12,16,24],em:[2,4,6,8,12,16,24],rem:[2,4,6,8,12,16,24]},bn={"%":{min:1,max:1e3},px:{min:1,max:4e3},pt:{min:1,max:3e3},pc:{min:.1,max:250},em:{min:.1,max:200},rem:{min:.1,max:200}},ib=new Set(Sd),ab=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function lb(e){return ib.has(e)}function cn(e){return`${Z(e.value)}${e.unit}`}function Co(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(ab);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return lb(i)?yn(r,i):null}function lc(e,t){const n=e.trim();if(!n)return null;const r=Co(n);if(r)return r;const i=Number(n.replace(",","."));return Number.isFinite(i)?yn(i,t):null}function yn(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=bn[t];return{value:De(Math.min(r,Math.max(n,e))),unit:t}}function Vn(e,t,n){const r=n>0?n:1;if(e==="width"){const a=yn(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:yn(t.value*r,t.unit)??t,height:t}}const lo="data-hover-css",ul=["fill","contain","cover","none","scale-down"],dl=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],sb=new Set(ul),cb=new Set(dl),sc="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",ub="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",db=/^-?[a-z][a-z0-9-]*$/i,mb=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,ka=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function vd(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...rt},border:{...il},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function fb(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function pb(e,t){const n=e.objectFit;if(n!=="cover"&&n!=="contain"&&n!=="fill"||e.width&&e.height||!e.width&&!e.height)return e;if(e.width){const r=Vn("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=Vn("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function gb(e){const t=[];for(const n of e.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim().toLowerCase(),l=r.slice(i+1).trim();!a||!l||db.test(a)&&(a==="behavior"||a.endsWith("binding")||mb.test(l)||t.push(`${a}: ${l}`))}return t.join("; ")}function qn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return null;if(n.startContainer instanceof HTMLImageElement)return n.startContainer;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const r=n.startContainer.childNodes[n.startOffset];if(r instanceof HTMLImageElement&&se(e,r))return r}return va(e,n.commonAncestorContainer)}function hb(e){const t=qn(e);return t?kd(t):null}function kd(e){const t=Cn(e),n=Cb(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,i=yb(e);return vd({sizeMode:i.sizeMode,width:i.width,height:i.height,align:n,margin:r,border:t.border,borderRadius:t.borderRadius,boxShadow:t.boxShadow,opacity:t.opacity,objectFit:Dd(e),objectPosition:Ab(e),rotateDeg:Pd(e),hoverCss:e.getAttribute(lo)??""})}function Ad(e,t){let n=!1;return xb(e,t)&&(n=!0),Sn(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:rt,paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:t.opacity,opacityMixed:!1})&&(n=!0),Sb(e,t.align)&&(n=!0),vb(e,t.objectFit)&&(n=!0),kb(e,t.objectPosition)&&(n=!0),Pb(e,t.rotateDeg)&&(n=!0),jb(e,t.hoverCss)&&(n=!0),n}function bb(e,t){const n=qn(e);return n?Ad(n,t):!1}function yb(e){const t=Co(e.style.width),n=Co(e.style.height);return t&&n?{sizeMode:"lock",width:t,height:n}:n&&!t?{sizeMode:"height",width:null,height:n}:{sizeMode:"width",width:t,height:null}}function xb(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=wb(t);return r.width?e.style.width=cn(r.width):e.style.removeProperty("width"),r.height?e.style.height=cn(r.height):e.style.height="auto",r.width||r.height?e.style.removeProperty("max-width"):e.style.maxWidth="100%",n.width!==e.style.width||n.height!==e.style.height||n.maxWidth!==e.style.maxWidth}function wb(e){return e.sizeMode==="width"?{sizeMode:"width",width:e.width,height:null}:e.sizeMode==="height"?{sizeMode:"height",width:null,height:e.height}:{sizeMode:"lock",width:e.width,height:e.height}}function Cb(e){const t=e.style.float.trim().toLowerCase();if(t==="left")return"left";if(t==="right")return"right";const n=e.style.display.trim().toLowerCase(),r=e.style.marginLeft.trim().toLowerCase(),i=e.style.marginRight.trim().toLowerCase();return n==="block"&&r==="auto"&&i==="auto"?"center":null}function Sb(e,t){const n={float:e.style.float,display:e.style.display,marginLeft:e.style.marginLeft,marginRight:e.style.marginRight};return t==="left"?(e.style.float="left",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="right"?(e.style.float="right",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="center"?(e.style.removeProperty("float"),e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto"):(e.style.removeProperty("float"),e.style.display.trim().toLowerCase()==="block"&&e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")),n.float!==e.style.float||n.display!==e.style.display||n.marginLeft!==e.style.marginLeft||n.marginRight!==e.style.marginRight}function Dd(e){const t=e.style.objectFit.trim().toLowerCase();return sb.has(t)?t:null}function vb(e,t){return Dd(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function kb(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.objectPosition=n:e.style.removeProperty("object-position"),!0)}function Ab(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(cb.has(t),t):null}function Pd(e){const t=ka.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?De(n):null}function Db(e){const t=e.trim();return t?ka.test(t)&&t.replace(ka,"").trim()==="":!0}function Pb(e,t){const n=Pd(e),r=t===null||t===0?null:De(t);return n===r?!1:r===null?Db(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${Z(r)}deg)`,!0)}function jb(e,t){const n=gb(t),r=e.getAttribute(lo)??"",i=e.getAttribute("onmouseover")??"";return r===n&&(n&&i===sc||!n&&!i)?!1:n?(e.setAttribute(lo,n),e.setAttribute("onmouseover",sc),e.setAttribute("onmouseout",ub),!0):(e.removeAttribute(lo),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const mn={value:100,unit:"%"},Eb=new Set(ul),Rb=new Set(dl),Tb=new Set(["cover","contain","scale-down","none"]),cc={contain:"contain",cover:"cover",auto:"none"},uc={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function ml(){return{src:null,opacity:null,fit:null,position:null,width:{...mn},height:null}}function jd(e){return e!=null&&Tb.has(e)}function Ed(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?Nt(n):null}function Nb(e,t){const n=Ed(e),r=t===null?null:Nt(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Iu(r),!0)}function Rd(e){const t=e.style.backgroundImage.trim();if(!t||t==="none")return null;const n=/^url\(\s*["']?(.+?)["']?\s*\)$/i.exec(t);return n&&n[1].trim()||null}function Mb(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function Lb(e,t){const n=Rd(e),r=(t==null?void 0:t.trim())??"",i=r&&vn(r)===null?r:null;return n===i?!1:(i?e.style.backgroundImage=Mb(i):e.style.removeProperty("background-image"),!0)}function Td(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Yi(e){return!e||e==="auto"?null:Co(e)}function _b(e){return jd(e.fit)&&e.fit?uc[e.fit]:e.fit==="fill"?uc.fill:e.width&&e.height?`${cn(e.width)} ${cn(e.height)}`:e.width?cn(e.width):e.height?`auto ${cn(e.height)}`:null}function Ib(e){const t=Td(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...mn},height:{...mn}};if(cc[t])return{fit:cc[t],width:null,height:null};if(Eb.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:Yi(n[0]),height:null}:n.length===2?{fit:null,width:Yi(n[0]),height:Yi(n[1])}:{fit:null,width:null,height:null}}function Fb(e,t){const n=Td(e.style.backgroundSize),r=_b(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function Bb(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Rb.has(t),t):null}function Hb(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.backgroundPosition=n:e.style.removeProperty("background-position"),!0)}function Aa(e){let t=!1;return e.id!==uo&&(e.id=uo,t=!0),e.hasAttribute(co)||(e.setAttribute(co,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function Nd(e){const t=e.getAttribute("style");return e.style.position="absolute",e.style.inset="0",e.style.zIndex="-1",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.getAttribute("style")!==t}function zb(e){const t=Oa(e),n=t[0]??null;if(n){let i=Aa(n);for(const a of t.slice(1))a.remove(),i=!0;return(n.parentNode!==e||n!==e.firstChild)&&(e.insertBefore(n,e.firstChild),i=!0),{layer:n,changed:i}}const r=document.createElement("div");return Aa(r),Nd(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function Ob(e){const t=Oa(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function dc(e){let t=!1;return Ka(e)?(e.style.position!=="relative"&&(e.style.position="relative",t=!0),e.style.isolation!=="isolate"&&(e.style.isolation="isolate",t=!0)):(e.style.position==="relative"&&(e.style.removeProperty("position"),t=!0),e.style.isolation==="isolate"&&(e.style.removeProperty("isolation"),t=!0)),t}function Kb(e){const t=Ka(e);if(!t)return ml();const n=Ib(t);return{src:Rd(t),opacity:Ed(t),fit:n.fit,position:Bb(t),width:n.width,height:n.height}}function $b(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&vn(n)===null)){const m=Ob(e),p=dc(e);return(m||p)&&nt(e),m||p}const i=zb(e),a=i.layer;let l=i.changed;return Aa(a)&&(l=!0),Nd(a)&&(l=!0),dc(e)&&(l=!0),Lb(a,n)&&(l=!0),Fb(a,t)&&(l=!0),Hb(a,t.position)&&(l=!0),Nb(a,t.opacity)&&(l=!0),l&&(nt(a),nt(e)),l}function Ub(){return{size:null,unit:Wt,marks:Ct(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function Da(){return{font:Ub(),box:al(),backgroundImage:ml(),atRule:Vt()}}function Wb(e){const t=e.style.fontSize,n=t?Ya(t):null,r=n&&Ro(n.unit)?{value:n.value,unit:n.unit}:null,i=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),l={bold:a==="bold"||Number(a)>=700,italic:e.style.fontStyle.trim().toLowerCase()==="italic",underline:/\bunderline\b/.test(i),strikethrough:/\bline-through\b/.test(i)},u=e.style.color,m=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??Wt,marks:l,fontFamily:m||null,fontFamilyMixed:!1,fontColor:u?be(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function Gb(e,t){const n=e.style.fontSize,r=t.size===null?null:Gt(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const i=qa(r.value,r.unit);return n===i?!1:(e.style.fontSize=i,!0)}function Vb(e,t){var i;if(t.fontFamilyMixed)return!1;const n=(i=t.fontFamily)!=null&&i.trim()?t.fontFamily.trim():null,r=e.style.fontFamily.trim()||null;return rr(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function qb(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?be(t.fontColor):null;return(e.style.color?be(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Yb(e,t){let n=!1;const r=t.bold?"bold":"";e.style.fontWeight!==r&&(r?e.style.fontWeight=r:e.style.removeProperty("font-weight"),n=!0);const i=t.italic?"italic":"";e.style.fontStyle!==i&&(i?e.style.fontStyle=i:e.style.removeProperty("font-style"),n=!0);const a=[];t.underline&&a.push("underline"),t.strikethrough&&a.push("line-through");const l=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==l&&(l?e.style.textDecoration=l:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function Xb(e,t){let n=!1;return Gb(e,t)&&(n=!0),Vb(e,t)&&(n=!0),qb(e,t)&&(n=!0),Yb(e,t.marks)&&(n=!0),n&&nt(e),n}function Jb(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function Zb(e){const t=tr(e);if(!t)return Da();const n=Cn(t);return{font:Wb(t),box:{margin:n.margin,marginMixed:!1,padding:n.padding,paddingMixed:!1,lineHeight:n.lineHeight,lineHeightMixed:!1,border:n.border,borderMixed:!1,borderRadius:n.borderRadius,radiusMixed:!1,boxShadow:n.boxShadow,shadowMixed:!1,backgroundColor:n.backgroundColor,backgroundMixed:!1,opacity:n.opacity,opacityMixed:!1},backgroundImage:Kb(t),atRule:Wu(e.innerHTML)}}function Qb(e,t){const n=dt(e),r=n?fn(e,n.startContainer,n.startOffset):null,i=n?fn(e,n.endContainer,n.endOffset):null,a=tr(e),l=Qf(e);io(l);const u=Xb(l,t.font),m=Sn(l,Jb(t)),p=$b(l,t.backgroundImage);Po(e);const g=Wu(e.innerHTML),h=Pg(e.innerHTML,t.atRule);h!==e.innerHTML&&(e.innerHTML=h);const w=JSON.stringify(g)!==JSON.stringify(t.atRule);return r!==null&&i!==null&&nl(e,Math.min(r,i),Math.max(r,i)),!a||u||m||p||w}function ey(e){const t=Gu(e.innerHTML);return t===e.innerHTML?!1:(e.innerHTML=t,Po(e),!0)}const fl="data-hover-html",ty="noopener noreferrer",ny="var n=this._hoverBox;if(!n){n=document.createElement('div');n.style.cssText='position:absolute;z-index:2147483646;background:#fff;border:1px solid #c8c8c8;border-radius:4px;padding:0.35rem 0.5rem;color:#222;max-width:18rem';this._hoverBox=n}n.innerHTML=this.getAttribute('data-hover-html')||'';var r=this.getBoundingClientRect();n.style.left=r.left+window.scrollX+'px';n.style.top=r.bottom+4+window.scrollY+'px';document.body.appendChild(n)",ry="this._hoverBox&&this._hoverBox.remove()",oy=/^(#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*(?:0|0?\.\d+|1))?\s*\))$/;function Lo(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function iy(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function Qn(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&iy(n))return n;n=n.parentNode}return null}function Md(e){return oy.test(e)}function ay(e){var i;const t=e.getAttribute("onmouseover")??"",n=/this\.style\.color\s*=\s*'([^']+)'/.exec(t),r=((i=n==null?void 0:n[1])==null?void 0:i.trim())??"";return r&&Md(r)?r:null}function Ld(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function ly(e){const t=e.getAttribute(fl)??"",n=ay(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:Ld(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function _d(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return null;const r=Qn(e,n.commonAncestorContainer);return r?ly(r):null}function sy(e){return _d(e)!==null}function cy(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(fl)}function uy(e,t){var r;if(cy(e),t.hoverMode==="html"){const i=t.hoverHtml.trim();if(!i)return;e.setAttribute(fl,i),e.setAttribute("onmouseover",ny),e.setAttribute("onmouseout",ry);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!Md(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function pl(e,t){const n=Lo(t);e.setAttribute("href",n.href);const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),n.targetBlank?(e.setAttribute("target","_blank"),e.setAttribute("rel",ty)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":Ld(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),uy(e,n)}function dy(e,t){const n=new Set;for(const r of t){const i=Qn(e,r);i&&!n.has(i)&&n.add(i)}for(const r of n)Oe(r)}function my(e,t,n){St(t);const r=Le(t).filter(u=>u.data.length>0);dy(e,r),r.length>0&&Yt(r);const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);St(a);const l=document.createElement("a");pl(l,n);try{return a.surroundContents(l),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(l.appendChild(u),a.insertNode(l),!0):!1}}function fy(e,t){const n=document.createElement("a");pl(n,t),n.textContent=t.href,e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();return r==null||r.removeAllRanges(),r==null||r.addRange(e),!0}function py(e,t){const n=t.href.trim();if(!n)return!1;const r=Lo({...t,href:n}),i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!se(e,a.commonAncestorContainer))return!1;const l=Qn(e,a.startContainer),u=Qn(e,a.endContainer);return l&&l===u?(pl(l,r),!0):a.collapsed?fy(a,r):my(e,a,r)}const gy=/^[A-Za-z][A-Za-z0-9_-]*$/,Id="";function Pa(e){var r;const t=$a(e),n=new Set;for(const i of t.querySelectorAll("[id]")){if(i===t)continue;const a=i.id.trim();a&&n.add(a)}for(const i of t.querySelectorAll("a[name]")){const a=(r=i.getAttribute("name"))==null?void 0:r.trim();a&&n.add(a)}return[...n].sort((i,a)=>i.localeCompare(a)).map(i=>({id:i}))}function hy(e){return new Set(Pa(e).map(t=>t.id))}function Fd(e,t){const n=e.trim();return n?gy.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function mc(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Id)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function by(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Id)),(r=e.parentNode)==null||r.insertBefore(n,e)}function yy(e,t){const n=t.trim();if(Fd(n,hy(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!se(e,i.commonAncestorContainer))return!1;const a=Qn(e,i.startContainer);if(a)return by(a,n),!0;if(i.collapsed)return mc(i,n),!0;St(i);const l=document.createElement("span");l.id=n;try{return i.surroundContents(l),!0}catch{return mc(i,n),!0}}function Bd(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n:null}function xy(e){const t=Bd(e);if(!t||t.collapsed)return null;const n=document.createElement("div");n.appendChild(t.cloneContents());const r=n.innerHTML;if(!r)return null;let i=t.toString();if(!i){const a=n.querySelector("img");i=(a==null?void 0:a.getAttribute("alt"))??(a==null?void 0:a.getAttribute("src"))??""}return{html:r,text:i}}function Hd(e){const t=Bd(e);if(!t||t.collapsed)return!1;t.deleteContents();const n=window.getSelection();return n==null||n.removeAllRanges(),n==null||n.addRange(t),!0}async function wy(e){const t=navigator.clipboard;if(!t)return!1;try{if(typeof ClipboardItem=="function"&&typeof t.write=="function"){const n=new ClipboardItem({"text/plain":new Blob([e.text],{type:"text/plain"}),"text/html":new Blob([e.html],{type:"text/html"})});return await t.write([n]),!0}if(typeof t.writeText=="function")return await t.writeText(e.text),!0}catch{if(typeof t.writeText=="function")try{return await t.writeText(e.text),!0}catch{return!1}return!1}return!1}async function zd(e){const t=xy(e);return t?wy(t):!1}async function Cy(e){return await zd(e)?Hd(e):!1}const Sy=new Set(["strong","b","em","i","u","s","strike","del"]),vy=["font","font-weight","font-style","font-family","font-size","color","background","background-color","text-decoration","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness"];function ky(e){for(const t of vy)e.style.removeProperty(t)}function Ay(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!ut(r)){n=r;continue}if(Ft(r,n),Sy.has(r.tagName.toLowerCase())){Oe(r);continue}if(ky(r),It(r)){Oe(r);continue}n=r.isConnected?r:t}}function Dy(e){const t=dt(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;St(t);const r=Le(t).filter(i=>i.data.length>0);if(r.length===0)return!1;for(const i of r)Ay(e,i);return Yt(r),e.innerHTML!==n}function Py(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function jy(e){const t=sn(e),n=Zu(e),r=Su(e),i=go(e,"color"),a=go(e,"backgroundColor"),l=ed(e);return{size:n.mixed?null:n.value,unit:n.unit,marks:t,fontFamily:r.mixed?null:r.value,fontFamilyMixed:r.mixed,fontColor:i.mixed?null:i.value,fontColorMixed:i.mixed,highlightColor:a.mixed?null:a.value,highlightColorMixed:a.mixed,customCss:l.mixed?null:l.value,customCssMixed:l.mixed}}function Ey(e,t){t.size!==null&&ha(e,t.size,t.unit);const n=sn(e);for(const r of Xe)t.marks[r]!==n[r]&&xa(e,r);return t.fontFamilyMixed||da(e,t.fontFamily),t.fontColorMixed||Wn(e,"color",t.fontColor),t.highlightColorMixed||Wn(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&nd(e,t.customCss),!0}function so(){return typeof window<"u"&&"speechSynthesis"in window}function Ry(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function fc(e,t){const n=e.text.trim();return n||Ry(t)||null}function Ty(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!so())return;if(t.speaking){t.cancel(),n();return}const i=new SpeechSynthesisUtterance(r);i.onend=n,i.onerror=n,t.speak(i),n()},isSpeaking(){return so()&&t.speaking},cancel(){so()&&t.speaking&&(t.cancel(),n())}}}const Ny=5*1024*1024,My="audio/mpeg,audio/mp3,audio/wav,audio/x-wav,audio/ogg,audio/aac,audio/webm,audio/mp4,audio/x-m4a,.mp3,.wav,.ogg,.aac,.webm,.m4a",Ly=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),_y=new Set(["mp3","wav","ogg","aac","webm","m4a"]),Iy=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,Fy=/^(javascript|vbscript|file|blob):/i;function By(e={}){return{src:"",title:"",...e}}function gl(e){const t=e.trim();if(!t)return"empty";if(Fy.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return Iy.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function Hy(e){return e.size>Ny?"tooLarge":Uy(e)?null:"type"}function zy(e){const t=Hy(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(gl(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function Oy(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",Ky(e,t.css)}function Ky(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function $y(e,t){const n=By(t);if(gl(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!se(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("audio");return Oy(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function Uy(e){const t=e.type.trim().toLowerCase();if(t&&Ly.has(t))return!0;const n=Wy(e.name);return!!(!t&&n&&_y.has(n))}function Wy(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Od=/^(javascript|vbscript|file|blob):/i,Gy=[/(?:youtube\.com\/watch\?(?:[^&]*&)*v=|youtube\.com\/watch\?v=)([\w-]{11})/i,/youtu\.be\/([\w-]{11})/i,/youtube\.com\/embed\/([\w-]{11})/i,/youtube\.com\/shorts\/([\w-]{11})/i];function Vy(e={}){return{url:"",title:"",...e}}function qy(e={}){return{src:"",title:"",...e}}function _o(e){const t=e.trim();if(!t)return null;for(const n of Gy){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function Kd(e){return`https://www.youtube.com/embed/${e}`}function $d(e){const t=e.trim();return t?Od.test(t)?"invalid":_o(t)?null:"invalid":"empty"}function Yy(e){const t=e.trim();if(!t)return"empty";if(Od.test(t))return"invalid";if(_o(t))return null;if(t.toLowerCase().startsWith("data:"))return/^data:video\//i.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function Ud(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function Wd(e,t,n){e.setAttribute("src",t),e.setAttribute("frameborder","0"),e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),e.setAttribute("allowfullscreen","");const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.width="560px",e.style.aspectRatio="16 / 9",e.style.border="0",Ud(e,n.css)}function Xy(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",Ud(e,t.css)}function Jy(e,t){const n=Vy(t);if($d(n.url))return!1;const r=_o(n.url);if(!r)return!1;const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!se(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const l=document.createElement("iframe");return Wd(l,Kd(r),n),a.insertNode(l),a.setStartAfter(l),a.collapse(!0),i.removeAllRanges(),i.addRange(a),!0}function Zy(e,t){const n=qy(t);if(Yy(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!se(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=_o(n.src);if(a){const l=document.createElement("iframe");Wd(l,Kd(a),{title:n.title,css:n.css}),i.insertNode(l),i.setStartAfter(l)}else{const l=document.createElement("video");Xy(l,n),i.insertNode(l),i.setStartAfter(l)}return i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}const Qy="1em 0",ex="1px solid #d0d0d0",tx=new Set(["p","h1","h2","h3","h4","h5","h6"]),nx=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function rx(e){var a;const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return!1;n.collapsed||n.deleteContents();const r=ox(),i=ix(e,n.startContainer);if(i){const l=ax(i,n);return(a=i.parentNode)==null||a.insertBefore(r,l),gc(r),!0}return n.insertNode(r),lx(e,r),ux(r),gc(r),!0}function ox(){const e=document.createElement("hr");return e.style.margin=Qy,e.style.border="0",e.style.borderTop=ex,e}function ix(e,t){let n=or(t);for(;n&&n!==e;){const r=ce(n);if(tx.has(r)&&n instanceof HTMLElement)return n;if(nx.has(r))return null;n=n.parentElement}return null}function ax(e,t){var a;const n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(e,e.childNodes.length);const r=n.extractContents(),i=e.cloneNode(!1);return i.appendChild(r),pc(e),pc(i),(a=e.parentNode)==null||a.insertBefore(i,e.nextSibling),i}function lx(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!sx(n))return;Ft(n,t),Oe(n)}}function sx(e){const t=ce(e);return ut(e)||t==="a"}function pc(e){cx(e)&&e.appendChild(document.createElement("br"))}function cx(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol, hr")===null}function ux(e){var n;if(e.nextSibling)return;const t=document.createElement("p");t.appendChild(document.createElement("br")),(n=e.parentNode)==null||n.insertBefore(t,e.nextSibling)}function gc(e){const t=e.nextSibling,n=document.createRange();t instanceof HTMLElement||t?(n.setStart(t,0),n.collapse(!0)):(n.setStartAfter(e),n.collapse(!0));const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}const kt=16;function hc(e){return Math.min(bn.px.max,Math.max(kt,e))}function dx(e){return e.width>0&&e.height>0?e.width/e.height:1}function mx(e,t){const n=Math.max(kt,kt*t),r=Math.min(bn.px.max,bn.px.max*t),i=Math.min(r,Math.max(n,e));return{width:i,height:i/t}}function fx(e,t){const n=Math.max(kt,kt/t),r=Math.min(bn.px.max,bn.px.max/t),i=Math.min(r,Math.max(n,e));return{width:i*t,height:i}}function px(e,t,n){const r=dx(t);return e==="e"?mx(t.width+n.x,r):e==="s"?fx(t.height+n.y,r):{width:hc(t.width+n.x),height:hc(t.height+n.y)}}function gx(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:kt,height:r>0?r:kt}}function hx(e,t,n){const r=yn(Math.max(kt,t),"px"),i=yn(Math.max(kt,n),"px");return!r||!i?!1:Ad(e,{...kd(e),sizeMode:"lock",width:r,height:i})}function Io(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function qt(e,t,n){const r=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(n));r<=1?e.removeAttribute("colspan"):e.colSpan=r,i<=1?e.removeAttribute("rowspan"):e.rowSpan=i}function Ke(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let i=0;for(let a=0;a<t;a+=1){const l=e.rows[a];let u=0;for(const m of Array.from(l.cells)){for(;n[a][u];)u+=1;const p=Io(m),g={cell:m,originRow:a,originCol:u,rowSpan:p.rowSpan,colSpan:p.colSpan};r.push(g);for(let h=0;h<p.rowSpan;h+=1){const w=a+h;if(w>=t)break;for(let b=0;b<p.colSpan;b+=1)n[w][u+b]=g}u+=p.colSpan,i=Math.max(i,u)}i=Math.max(i,n[a].length)}return{table:e,slots:n,unique:r,rowCount:t,colCount:i}}function So(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function ot(e,t){return e.unique.find(n=>n.cell===t)??null}function Gd(e,t){return e.originRow<t.minRow||e.originCol<t.minCol||e.originRow+e.rowSpan-1>t.maxRow||e.originCol+e.colSpan-1>t.maxCol}function Vd(e){if(e.length===0)return null;let t=1/0,n=-1/0,r=1/0,i=-1/0;for(const a of e)t=Math.min(t,a.originRow),n=Math.max(n,a.originRow+a.rowSpan-1),r=Math.min(r,a.originCol),i=Math.max(i,a.originCol+a.colSpan-1);return{minRow:t,maxRow:n,minCol:r,maxCol:i}}function bx(e,t){const n=new Set,r=[];for(let i=t.minRow;i<=t.maxRow;i+=1)for(let a=t.minCol;a<=t.maxCol;a+=1){const l=So(e,i,a);!l||n.has(l.cell)||(n.add(l.cell),r.push(l.cell))}return r}function qd(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=So(e,t.minRow,t.minCol);if(!n||n.originRow!==t.minRow||n.originCol!==t.minCol)return null;const r=new Set,i=[];for(let a=t.minRow;a<=t.maxRow;a+=1)for(let l=t.minCol;l<=t.maxCol;l+=1){const u=So(e,a,l);if(!u||Gd(u,t))return null;r.has(u.cell)||(r.add(u.cell),i.push(u.cell))}return{origin:n,cells:i,colSpan:t.maxCol-t.minCol+1,rowSpan:t.maxRow-t.minRow+1}}function yx(e,t,n,r){const i={minRow:t.originRow,maxRow:t.originRow+r-1,minCol:t.originCol,maxCol:t.originCol+n-1};if(i.maxRow>=e.rowCount||i.maxCol>=e.colCount)return!1;for(let a=i.minRow;a<=i.maxRow;a+=1)for(let l=i.minCol;l<=i.maxCol;l+=1){const u=So(e,a,l);if(!u)return!1;if(u.cell!==t.cell&&Gd(u,i))return!1}return!0}const bc=10,un=1,dn=50,xx="1px solid #000",wx="0.25em",Cx=new Set(["td","th"]);function Yd(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=un&&t>=un&&e<=dn&&t<=dn}function Ne(e,t){return yl(e,t,n=>n instanceof HTMLTableElement)}function vo(e,t){return yl(e,t,n=>Nx(n))}function Sx(e,t){return yl(e,t,n=>n instanceof HTMLTableRowElement)}function hl(e){return Ne(e,xl(e))}function mt(e){return vo(e,xl(e))}function Xd(e){return Sx(e,xl(e))}function vx(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function bl(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!se(e,n.commonAncestorContainer))return[];const r=vo(e,n.startContainer),i=vo(e,n.endContainer);if(!r)return[];if(!i||r===i)return[r];const a=Ne(e,r);if(!a||Ne(e,i)!==a)return[r];const l=Ke(a),u=ot(l,r),m=ot(l,i);if(!u||!m)return[r];const p=Vd([u,m]);if(!p)return[r];const g=bx(l,p);return g.length>0?g:[r]}function kx(e,t){if(!Yd(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!se(e,r.commonAncestorContainer))return!1;const i=document.createElement("table");i.style.borderCollapse="collapse",i.style.width="100%";const a=document.createElement("tbody");for(let u=0;u<t.rows;u+=1){const m=document.createElement("tr");for(let p=0;p<t.cols;p+=1)m.appendChild(Mx("td"));a.appendChild(m)}i.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(i),Fx(e,i);const l=i.querySelector("td, th");return l instanceof HTMLTableCellElement&&Re(l),!0}function ja(e,t){var h,w,b,x;const n=mt(e);if(!n)return!1;const r=Ne(e,n);if(!r)return!1;const i=Ke(r),a=ot(i,n);if(!a)return!1;const l=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const y of i.unique)if(y.originRow<l&&y.originRow+y.rowSpan>l){qt(y.cell,y.colSpan,y.rowSpan+1);for(let S=y.originCol;S<y.originCol+y.colSpan;S+=1)u.add(S)}const m=document.createElement("tr"),p=Math.min(l,i.rowCount-1);for(let y=0;y<i.colCount;y+=1){if(u.has(y))continue;const S=((w=(h=i.slots[p])==null?void 0:h[y])==null?void 0:w.cell)??n;m.appendChild(wl(S))}if(l>=r.rows.length)(b=r.rows[r.rows.length-1].parentNode)==null||b.appendChild(m);else{const y=r.rows[l];(x=y.parentNode)==null||x.insertBefore(m,y)}const g=_x(m,i.colCount,u,a.originCol);return Re(g||n),!0}function yc(e,t){var p,g,h,w;const n=mt(e);if(!n)return!1;const r=Ne(e,n);if(!r)return!1;const i=Ke(r),a=ot(i,n);if(!a)return!1;const l=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const b of i.unique)if(b.originCol<l&&b.originCol+b.colSpan>l){qt(b.cell,b.colSpan+1,b.rowSpan);for(let x=b.originRow;x<b.originRow+b.rowSpan;x+=1)u.add(x)}let m=null;for(let b=0;b<i.rowCount;b+=1){if(u.has(b))continue;const x=((g=(p=i.slots[b])==null?void 0:p[Math.min(l,Math.max(0,i.colCount-1))])==null?void 0:g.cell)??((w=(h=i.slots[b])==null?void 0:h[Math.max(0,l-1)])==null?void 0:w.cell)??n,y=wl(x);Cl(r,b,l,y),b===a.originRow&&(m=y)}return m&&Re(m),!0}function Ax(e){var w,b;const t=mt(e);if(!t)return!1;const n=Ne(e,t);if(!n)return!1;const r=Ke(n),i=ot(r,t);if(!i)return!1;if(r.rowCount<=1)return Ea(e,n);const a=i.originRow,l=a+1,u=[];for(const x of r.unique)x.originRow<=a&&x.originRow+x.rowSpan>a&&(x.originRow<a?qt(x.cell,x.colSpan,x.rowSpan-1):x.originRow===a&&x.rowSpan>1&&u.push(x));u.sort((x,y)=>x.originCol-y.originCol);for(const x of u)qt(x.cell,x.colSpan,x.rowSpan-1),Cl(n,l,x.originCol,x.cell);const m=i.originCol;n.rows[a].remove();const p=n.rows[Math.min(a,n.rows.length-1)],g=Ke(n),h=(b=(w=g.slots[Math.min(a,g.rowCount-1)])==null?void 0:w[Math.min(m,Math.max(0,g.colCount-1))])==null?void 0:b.cell;return h?Re(h):p!=null&&p.cells[0]?Re(p.cells[0]):Hx(n),!0}function Dx(e){var p,g,h;const t=mt(e);if(!t)return!1;const n=Ne(e,t);if(!n)return!1;const r=Ke(n),i=ot(r,t);if(!i)return!1;if(r.colCount<=1)return Ea(e,n);const a=i.originCol,l=i.originRow;for(const w of r.unique)a<w.originCol||a>=w.originCol+w.colSpan||(w.colSpan===1?w.cell.remove():qt(w.cell,w.colSpan-1,w.rowSpan));const u=Ke(n);if(u.colCount===0||u.unique.length===0)return Ea(e,n);const m=((g=(p=u.slots[Math.min(l,u.rowCount-1)])==null?void 0:p[Math.min(a,u.colCount-1)])==null?void 0:g.cell)??((h=u.unique[0])==null?void 0:h.cell);return m&&Re(m),!0}function Px(e,t){const n=mt(e);if(!n)return!1;const r=Ne(e,n);if(!r)return!1;const i=vx(r),a=i.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Re(i[a-1]),{changed:!1});if(a<i.length-1)return Re(i[a+1]),{changed:!1};const l=n.parentElement;if(!ja(e,"below"))return!1;const u=l instanceof HTMLTableRowElement?l.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Re(u.cells[0]),{changed:!0}}function jx(e,t){return!se(e,t)||t===e?!1:(Re(t),!0)}function xc(e){return Jd(e)!==null}function wc(e){const t=mt(e);if(!t)return!1;const n=Io(t);return n.colSpan>1||n.rowSpan>1}function Ex(e){const t=Jd(e);if(!t)return!1;const n=Ne(e,t.origin.cell);return n?Zd(n,t):!1}function Rx(e){const t=mt(e);if(!t)return!1;const n=Ne(e,t);return n?Qd(n,t):!1}function Tx(e,t,n){const r=mt(e);if(!r)return!1;const i=Ne(e,r);if(!i)return!1;const a=Ke(i),l=ot(a,r);if(!l)return!1;const u=Math.min(a.colCount-l.originCol,Math.max(1,Math.floor(t))),m=Math.min(a.rowCount-l.originRow,Math.max(1,Math.floor(n)));if(u===l.colSpan&&m===l.rowSpan||!yx(a,l,u,m))return!1;if((l.colSpan>1||l.rowSpan>1)&&Qd(i,r),u===1&&m===1)return Re(r),!0;const p=Ke(i),g=qd(p,{minRow:l.originRow,maxRow:l.originRow+m-1,minCol:l.originCol,maxCol:l.originCol+u-1});return g?Zd(i,g):!0}function yl(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function Nx(e){return Cx.has(e.tagName.toLowerCase())}function xl(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return se(e,n.commonAncestorContainer)?n.startContainer:null}function Jd(e){const t=bl(e);if(t.length<2)return null;const n=Ne(e,t[0]);if(!n)return null;const r=Ke(n),i=[];for(const u of t){const m=ot(r,u);if(!m)return null;i.push(m)}const a=Vd(i);if(!a)return null;const l=qd(r,a);return!l||l.cells.length<2?null:l}function Zd(e,t){const n=t.origin.cell,r=Ke(e),i=t.cells.map(a=>ot(r,a)).filter(a=>a!==null).sort((a,l)=>a.originRow-l.originRow||a.originCol-l.originCol);for(const a of i)a.cell!==n&&Ix(n,a.cell);qt(n,t.colSpan,t.rowSpan);for(const a of i)a.cell!==n&&a.cell.remove();return Re(n),!0}function Qd(e,t){const n=Ke(e),r=ot(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;qt(t,1,1);for(let i=r.originRow;i<r.originRow+r.rowSpan;i+=1)for(let a=r.originCol;a<r.originCol+r.colSpan;a+=1)i===r.originRow&&a===r.originCol||Cl(e,i,a,wl(t));return Re(t),!0}function Mx(e){const t=document.createElement(e);return t.style.border=xx,t.style.padding=wx,t.appendChild(document.createElement("br")),t}function wl(e){const t=e.cloneNode(!1);for(t.removeAttribute("colspan"),t.removeAttribute("rowspan");t.firstChild;)t.removeChild(t.firstChild);return t.appendChild(document.createElement("br")),t}function Lx(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Cl(e,t,n,r){const i=e.rows[t];if(!i)return;const a=Ke(e);let l=0;for(const u of Array.from(i.cells)){if(u===r)continue;const m=ot(a,u);if(!m||m.originCol>=n)break;l+=1}Lx(i,l,r)}function _x(e,t,n,r){let i=0;for(let a=0;a<t;a+=1)if(!n.has(a)){if(a>=r)return e.cells[i]??null;i+=1}return e.cells[e.cells.length-1]??null}function Cc(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol, hr")===null}function Ix(e,t){if(!(e===t||Cc(t)))for(Cc(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function Fx(e,t){var i;const n=t.parentElement;if(!n||n===e)return;const r=n.tagName.toLowerCase();r==="td"||r==="th"||(r==="p"||/^h[1-6]$/.test(r))&&((i=n.parentNode)==null||i.insertBefore(t,n.nextSibling),Bx(n)&&n.remove())}function Bx(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol")===null}function Ea(e,t){if(!t.parentNode||!se(e,t))return!1;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),t.remove();const i=window.getSelection();return i&&(i.removeAllRanges(),i.addRange(r)),!0}function Re(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Hx(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function zx(e={}){return{border:{...il},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function Ox(e){const t=Cn(e);return{border:t.border,borderCollapse:Wx(e),borderSpacing:em(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:je(e.style.width)}}function Kx(e,t){let n=Sn(e,{margin:{top:null,right:null,bottom:null,left:null},marginMixed:!0,padding:{top:null,right:null,bottom:null,left:null},paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0});return Gx(e,t.borderCollapse)&&(n=!0),Vx(e,t.borderCollapse,t.borderSpacing)&&(n=!0),qx(e,t.width)&&(n=!0),n&&nt(e),n}function $x(e){const t=hl(e);return t?Ox(t):null}function Ux(e,t){const n=hl(e);return n?Kx(n,t):!1}function Wx(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function Gx(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function em(e){const t=e.style.borderSpacing.trim();return t?je(t.split(/\s+/)[0]??""):null}function Vx(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?Bt(n):null,i=em(e);return qe(i,r)?!1:(r?e.style.borderSpacing=Pe(r):e.style.removeProperty("border-spacing"),!0)}function qx(e,t){const n=t?Bt(t):null,r=je(e.style.width);return qe(r,n)?!1:(n?e.style.width=Pe(n):e.style.removeProperty("width"),!0)}const Fo=["top","middle","bottom","baseline"],Yx=new Set(Fo);function Xx(e={}){return{backgroundColor:null,color:null,padding:{...rt},verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function Jx(e){const t=Cn(e);return{backgroundColor:t.backgroundColor,color:tm(e),padding:t.padding,verticalAlign:nm(e),width:je(e.style.width),...Io(e)}}function Zx(e,t){let n=Sn(e,{margin:{...rt},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:t.backgroundColor,backgroundMixed:!1,opacity:null,opacityMixed:!0});return tw(e,t.color)&&(n=!0),nw(e,t.verticalAlign)&&(n=!0),rw(e,t.width)&&(n=!0),n&&nt(e),n}function Qx(e){const t=mt(e);return t?Jx(t):null}function ew(e,t){const n=bl(e);if(n.length===0)return!1;let r=!1;for(const a of n)Zx(a,t)&&(r=!0);const i=mt(e);if(i){const a=Io(i);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&Tx(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function tm(e){const t=e.style.color;return t?be(t):null}function tw(e,t){const n=t?be(t):null;return tm(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function nm(e){const t=e.style.verticalAlign.trim().toLowerCase();return Yx.has(t)?t:null}function nw(e,t){return nm(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function rw(e,t){const n=t?Bt(t):null,r=je(e.style.width);return qe(r,n)?!1:(n?e.style.width=Pe(n):e.style.removeProperty("width"),!0)}const ow=new Set(Fo);function iw(e={}){return{backgroundColor:null,color:null,padding:{...rt},height:null,verticalAlign:null,...e}}function aw(e){const t=e.cells[0],n=t?Cn(t).padding:{...rt};return{backgroundColor:rm(e),color:om(e),padding:n,height:je(e.style.height),verticalAlign:im(e)}}function lw(e,t){let n=!1;uw(e,t.backgroundColor)&&(n=!0),dw(e,t.color)&&(n=!0),fw(e,t.height)&&(n=!0),mw(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))Sn(r,{margin:{...rt},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0})&&(n=!0);return n&&nt(e),n}function sw(e){const t=Xd(e);return t?aw(t):null}function cw(e,t){const n=Xd(e);return n?lw(n,t):!1}function rm(e){const t=e.style.backgroundColor;return t?be(t):null}function uw(e,t){const n=t?be(t):null;return rm(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function om(e){const t=e.style.color;return t?be(t):null}function dw(e,t){const n=t?be(t):null;return om(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function im(e){const t=e.style.verticalAlign.trim().toLowerCase();return ow.has(t)?t:null}function mw(e,t){return im(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function fw(e,t){const n=t?Bt(t):null,r=je(e.style.height);return qe(r,n)?!1:(n?e.style.height=Pe(n):e.style.removeProperty("height"),!0)}const pw=1e3;function gw(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function hw({onAutoSave:e,getHtml:t}){const n=s.useRef(e);n.current=e;const r=s.useRef(t);r.current=t;const i=s.useRef(null),a=e!=null;s.useEffect(()=>{if(!a){i.current=null;return}i.current=r.current();const l=window.setInterval(()=>{const u=n.current;if(!u)return;const m=r.current();m!==i.current&&(i.current=m,queueMicrotask(()=>gw(u,m)))},pw);return()=>{window.clearInterval(l)}},[a])}function Xi({value:e,defaultValue:t,onChange:n}){const[r,i]=s.useState(t),a=e!==void 0,l=a?e:r,u=s.useCallback(m=>{a||i(m),n==null||n(m)},[a,n]);return[l,u]}const Sc=8,vc=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#9900ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#d9d2e9","#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#8e7cc3","#660000","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#351c75"],bw=8;let Ra=[];const Ta=new Set;function kc(){return Ra}function yw(e){const t=be(e);t&&(Ra=[t,...Ra.filter(n=>n!==t)].slice(0,bw),Ta.forEach(n=>n()))}function xw(e){return Ta.add(e),()=>{Ta.delete(e)}}function Yr(e){const t=be(e);return t?{r:Number.parseInt(t.slice(1,3),16),g:Number.parseInt(t.slice(3,5),16),b:Number.parseInt(t.slice(5,7),16)}:null}function $t(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Ji({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,l=Math.max(r,i,a),u=Math.min(r,i,a),m=l-u;let p=0;return m!==0&&(l===r?p=(i-a)/m%6:l===i?p=(a-r)/m+2:p=(r-i)/m+4,p*=60,p<0&&(p+=360)),{h:p,s:l===0?0:m/l,v:l}}function Zi({h:e,s:t,v:n}){const r=(e%360+360)%360,i=n*t,a=i*(1-Math.abs(r/60%2-1)),l=n-i;let u=0,m=0,p=0;return r<60?(u=i,m=a):r<120?(u=a,m=i):r<180?(m=i,p=a):r<240?(m=a,p=i):r<300?(u=a,p=i):(u=i,p=a),{r:Math.round((u+l)*255),g:Math.round((m+l)*255),b:Math.round((p+l)*255)}}function am(){return typeof window<"u"&&"EyeDropper"in window}async function ww(){if(!am())return null;const e=window.EyeDropper;try{const t=await new e().open();return be(t.sRGBHex)}catch{return null}}const Cw="_picker_ag1yo_1",Sw="_none_ag1yo_12",vw="_customToggle_ag1yo_13",kw="_eyedrop_ag1yo_14",Aw="_swatch_ag1yo_48",Dw="_field_ag1yo_49",Pw="_grid_ag1yo_54",jw="_recents_ag1yo_55",Ew="_sectionLabel_ag1yo_84",Rw="_custom_ag1yo_13",Tw="_sv_ag1yo_95",Nw="_svThumb_ag1yo_105",Mw="_hue_ag1yo_116",Lw="_rgbRow_ag1yo_155",_w="_hexRow_ag1yo_156",Ae={picker:Cw,none:Sw,customToggle:vw,eyedrop:kw,swatch:Aw,field:Dw,grid:Pw,recents:jw,sectionLabel:Ew,custom:Rw,sv:Tw,svThumb:Nw,hue:Mw,rgbRow:Lw,hexRow:_w};function Iw(e){if(!/^\d+$/.test(e.trim()))return null;const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(255,t)):null}function Sl({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:i,menu:a=!1,fallbackCustom:l="#000000",onChange:u,onCommit:m}){const p=U(),g=s.useId(),h=a?"menuitemradio":"option",w=t?null:e,b=Yr(w??l)??{r:0,g:0,b:0},[x,y]=s.useState(!1),[S,C]=s.useState(()=>Ji(b)),[A,v]=s.useState(()=>({r:String(b.r),g:String(b.g),b:String(b.b)})),[j,D]=s.useState(()=>$t(b.r,b.g,b.b)),[T,M]=s.useState(()=>[...kc()]),F=s.useRef(null),R=s.useRef($t(b.r,b.g,b.b));s.useEffect(()=>xw(()=>M([...kc()])),[]),s.useEffect(()=>{const N=Yr(w??l);if(!N)return;const V=Ji(N);C(V),v({r:String(N.r),g:String(N.g),b:String(N.b)}),D($t(N.r,N.g,N.b))},[w,l]);const E=(N,V,re)=>{N&&(R.current=N),re&&N&&yw(N),u(N),V&&(m==null||m(N))},P=(N,V,re)=>{const G=$t(N.r,N.g,N.b);C(Ji(N)),v({r:String(N.r),g:String(N.g),b:String(N.b)}),D(G),E(G,V,re)},L=(N,V,re)=>{const G=Zi(N),ge=$t(G.r,G.g,G.b);C(N),v({r:String(G.r),g:String(G.g),b:String(G.b)}),D(ge),E(ge,V,re)},$=N=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(N.key))return;const re=[...N.currentTarget.querySelectorAll("button")],G=re.findIndex(Ce=>Ce===document.activeElement);if(G<0)return;N.preventDefault();const ge=N.key==="ArrowLeft"?-1:N.key==="ArrowRight"?1:N.key==="ArrowUp"?-Sc:Sc,Ee=re[Math.max(0,Math.min(re.length-1,G+ge))];Ee==null||Ee.focus()},K=(N,V)=>{const re=F.current;if(!re||i)return;const G=re.getBoundingClientRect(),ge=Math.max(0,Math.min(1,(N.clientX-G.left)/G.width)),Ee=Math.max(0,Math.min(1,1-(N.clientY-G.top)/G.height));L({h:S.h,s:ge,v:Ee},V,V)},X=N=>{i||(N.currentTarget.setPointerCapture(N.pointerId),K(N,!1))},J=Zi({h:S.h,s:1,v:1}),me=$t(J.r,J.g,J.b),Y=Zi(S),fe=$t(Y.r,Y.g,Y.b),ne=new Set(vc),ie=T.filter(N=>!ne.has(N));return o.jsxs("div",{className:Ae.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[o.jsx("button",{type:"button",className:Ae.none,role:h,"aria-checked":a?w===null&&!t:void 0,"aria-selected":a?void 0:w===null&&!t,disabled:i,onClick:()=>E(null,!0,!1),children:n}),o.jsx("div",{className:Ae.grid,role:a?"group":"none",onKeyDown:$,children:vc.map(N=>{const V=w===N;return o.jsx("button",{type:"button",className:Ae.swatch,role:h,"aria-label":N,"aria-checked":a?V:void 0,"aria-selected":a?void 0:V,disabled:i,style:{backgroundColor:N},onMouseDown:re=>re.preventDefault(),onClick:()=>E(N,!0,!1)},N)})}),ie.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:Ae.sectionLabel,children:p("colorRecent")}),o.jsx("div",{className:Ae.recents,role:a?"group":"none","aria-label":p("colorRecent"),children:ie.map(N=>o.jsx("button",{type:"button",className:Ae.swatch,role:h,"aria-label":N,"aria-checked":a?w===N:void 0,"aria-selected":a?void 0:w===N,disabled:i,style:{backgroundColor:N},onMouseDown:V=>V.preventDefault(),onClick:()=>E(N,!0,!1)},N))})]}):null,o.jsx("button",{type:"button",className:Ae.customToggle,disabled:i,"aria-expanded":x,onClick:()=>y(N=>!N),children:p("colorCustom")}),x?o.jsxs("div",{className:Ae.custom,children:[o.jsx("div",{ref:F,className:Ae.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${me})`},onPointerDown:X,onPointerMove:N=>{N.currentTarget.hasPointerCapture(N.pointerId)&&K(N,!1)},onPointerUp:N=>{K(N,!0)},children:o.jsx("span",{className:Ae.svThumb,style:{left:`${S.s*100}%`,top:`${(1-S.v)*100}%`}})}),o.jsx("input",{className:Ae.hue,type:"range",min:0,max:360,value:Math.round(S.h),disabled:i,"aria-label":p("colorCustom"),onChange:N=>L({...S,h:Number(N.target.value)},!1,!1),onPointerUp:()=>E(R.current,!0,!0)}),o.jsx("div",{className:Ae.rgbRow,children:["r","g","b"].map(N=>o.jsxs("div",{className:Ae.field,children:[o.jsx("label",{htmlFor:`${g}-${N}`,children:p(N==="r"?"colorRgbR":N==="g"?"colorRgbG":"colorRgbB")}),o.jsx("input",{id:`${g}-${N}`,inputMode:"numeric",value:A[N],disabled:i,onChange:V=>{v(re=>({...re,[N]:V.target.value}))},onBlur:()=>{const V=Iw(A[N]);if(V===null){v({r:String(Y.r),g:String(Y.g),b:String(Y.b)});return}P({...Y,[N]:V},!0,!0)},onKeyDown:V=>{V.key==="Enter"&&V.currentTarget.blur()}})]},N))}),o.jsx("div",{className:Ae.hexRow,children:o.jsxs("div",{className:Ae.field,children:[o.jsx("label",{htmlFor:`${g}-hex`,children:p("colorHex")}),o.jsx("input",{id:`${g}-hex`,value:j,disabled:i,onChange:N=>D(N.target.value),onBlur:()=>{const N=be(j);if(!N){D(fe);return}const V=Yr(N);V&&P(V,!0,!0)},onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur()}})]})}),am()?o.jsx("button",{type:"button",className:Ae.eyedrop,disabled:i,onClick:()=>{ww().then(N=>{if(!N)return;const V=Yr(N);V&&P(V,!0,!0)})},children:p("colorPickFromScreen")}):null]}):null]})}const Fw="_wrap_xzhkl_1",Bw="_button_xzhkl_8",Hw="_icon_xzhkl_18",zw="_bar_xzhkl_24",Ow="_barEmpty_xzhkl_33",Kw="_popover_xzhkl_43",Ut={wrap:Fw,button:Bw,icon:Hw,bar:zw,barEmpty:Ow,popover:Kw},$w="_field_1knrr_1",Uw="_label_1knrr_8",Ww="_button_1knrr_12",Gw="_swatch_1knrr_37",Vw="_swatchEmpty_1knrr_44",Kn={field:$w,label:Uw,button:Ww,swatch:Gw,swatchEmpty:Vw},Xr=4;function Je({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:i,fallbackCustom:a,onChange:l}){const u=s.useId(),m=s.useRef(null),p=s.useRef(null),g=s.useRef(null),[h,w]=s.useState(!1),[b,x]=s.useState({top:0,left:0}),y=s.useCallback(()=>{const A=p.current,v=g.current;if(!A)return;const j=A.getBoundingClientRect(),D=(v==null?void 0:v.offsetHeight)??0,T=(v==null?void 0:v.offsetWidth)??240;let M=j.bottom;M+D>window.innerHeight-Xr&&(M=Math.max(Xr,j.top-D));const F=Math.min(Math.max(j.left,Xr),window.innerWidth-T-Xr);x({top:M,left:F})},[]);s.useLayoutEffect(()=>{if(!h)return;y();const A=()=>y();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[h,y]),s.useEffect(()=>{if(!h)return;const A=j=>{var T,M;const D=j.target;(T=m.current)!=null&&T.contains(D)||(M=g.current)!=null&&M.contains(D)||w(!1)},v=j=>{var D;j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),w(!1),(D=p.current)==null||D.focus())};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",v,!0),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",v,!0)}},[h]);const S=`${Kn.swatch}${!n||r?` ${Kn.swatchEmpty}`:""}`,C=n&&!r?{backgroundColor:n}:void 0;return o.jsxs("div",{className:Kn.field,ref:m,children:[o.jsx("span",{className:Kn.label,children:e}),o.jsx("button",{ref:p,type:"button",className:Kn.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:i,onClick:()=>w(A=>!A),children:o.jsx("span",{className:S,style:C})}),h?o.jsx(ae,{children:o.jsx("div",{ref:g,id:u,className:Ut.popover,style:{top:b.top,left:b.left,zIndex:1400},children:o.jsx(Sl,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:i,fallbackCustom:a,onChange:l,onCommit:()=>w(!1)})})}):null]})}const Qi=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],qw="_toolbar_2uk4l_1",Yw="_menuBar_2uk4l_35",Xw="_menuBarDesktop_2uk4l_43",Jw="_brandMark_2uk4l_49",Zw="_brandMarkIcon_2uk4l_56",Qw="_menuBarCompact_2uk4l_68",e1="_menuWrap_2uk4l_91",t1="_menuButton_2uk4l_97",n1="_iconButton_2uk4l_98",r1="_menuItem_2uk4l_99",o1="_hamburgerButton_2uk4l_142",i1="_iconNav_2uk4l_149",a1="_iconNavMain_2uk4l_160",l1="_iconNavEnd_2uk4l_169",s1="_iconGroup_2uk4l_185",c1="_tooltipTrigger_2uk4l_276",u1="_menu_2uk4l_35",d1="_submenuWrap_2uk4l_304",m1="_submenu_2uk4l_304",f1="_submenuTrigger_2uk4l_314",p1="_menuOverlay_2uk4l_329",g1="_menuOverlayHeader_2uk4l_341",h1="_menuOverlayTitle_2uk4l_351",b1="_menuOverlayBody_2uk4l_357",y1="_menuSeparator_2uk4l_408",x1="_icon_2uk4l_98",w1="_tooltip_2uk4l_276",C1="_tooltipElevated_2uk4l_493",q={toolbar:qw,menuBar:Yw,menuBarDesktop:Xw,brandMark:Jw,brandMarkIcon:Zw,menuBarCompact:Qw,menuWrap:e1,menuButton:t1,iconButton:n1,menuItem:r1,hamburgerButton:o1,iconNav:i1,iconNavMain:a1,iconNavEnd:l1,iconGroup:s1,tooltipTrigger:c1,menu:u1,submenuWrap:d1,submenu:m1,submenuTrigger:f1,menuOverlay:p1,menuOverlayHeader:g1,menuOverlayTitle:h1,menuOverlayBody:b1,menuSeparator:y1,icon:x1,tooltip:w1,tooltipElevated:C1},S1=400,Ac=6,ea=4;function Lt({label:e,children:t,className:n,elevated:r}){const i=s.useRef(null),a=s.useRef(null),l=s.useRef(null),u=s.useRef(!1),m=s.useRef(!1),[p,g]=s.useState(!1),[h,w]=s.useState({top:0,left:0}),b=s.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),x=s.useCallback(C=>{if(!(u.current||m.current)){b(),g(!1);return}if(C||m.current){b(),g(!0);return}b(),l.current=setTimeout(()=>{l.current=null,g(!0)},S1)},[b]),y=s.useCallback(()=>{const C=i.current,A=a.current;if(!C||!A)return;const v=C.getBoundingClientRect(),j=A.offsetWidth,D=A.offsetHeight;let T=v.bottom+Ac;T+D>window.innerHeight-ea&&(T=v.top-Ac-D);let M=v.left+v.width/2-j/2;M=Math.min(Math.max(M,ea),window.innerWidth-j-ea),w({top:T,left:M})},[]);s.useEffect(()=>()=>b(),[b]),s.useEffect(()=>{const C=i.current;if(!C)return;const A=()=>{m.current=!0,x(!0)},v=()=>{m.current=!1,x(!1)};return C.addEventListener("focusin",A),C.addEventListener("focusout",v),()=>{C.removeEventListener("focusin",A),C.removeEventListener("focusout",v)}},[x]),s.useLayoutEffect(()=>{if(!p)return;y();const C=()=>y();return window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[p,e,y]);const S=n?`${q.tooltipTrigger} ${n}`:q.tooltipTrigger;return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,className:S,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,x(!1)},onMouseLeave:()=>{u.current=!1,x(!1)},children:t}),p?o.jsx(ae,{children:o.jsx("span",{ref:a,className:r?`${q.tooltip} ${q.tooltipElevated}`:q.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const v1="_wrap_1097y_1",k1="_wrapToolbar_1097y_7",A1="_field_1097y_12",D1="_trigger_1097y_20",P1="_chevron_1097y_50",j1="_list_1097y_73",E1="_listInline_1097y_88",R1="_option_1097y_96",T1="_separator_1097y_125",tt={wrap:v1,wrapToolbar:k1,field:A1,trigger:D1,chevron:P1,list:j1,listInline:E1,option:R1,separator:T1};function N1({value:e,mixed:t=!1,fonts:n,disabled:r,listId:i,listRef:a,inline:l,style:u,onSelect:m}){const p=U(),g=!t&&e===null;return o.jsxs("ul",{ref:a,id:i,className:l?`${tt.list} ${tt.listInline}`:tt.list,role:"listbox","aria-label":p("commandFontFamilyAria"),style:u,children:[o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:tt.option,role:"option","aria-checked":g,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>m(null),children:p("fontFamilyDefault")})}),o.jsx("li",{className:tt.separator,role:"separator"}),n.map(h=>{const w=!t&&rr(e,h.family);return o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:tt.option,role:"option","aria-checked":w,disabled:r,style:{fontFamily:h.family},onMouseDown:b=>b.preventDefault(),onClick:()=>m(h.family),children:h.name})},h.family)})]})}function M1(e,t,n,r){var i;return t?"":e===null?r:((i=dp(e,n))==null?void 0:i.name)??e}const Jr=4;function lm({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:i,toolbar:a=!1,triggerId:l,onChange:u}){const m=U(),p=s.useId(),g=s.useRef(null),h=s.useRef(null),w=s.useRef(null),[b,x]=s.useState(!1),[y,S]=s.useState({top:0,left:0,width:0}),C=M1(e,t,n,m("fontFamilyDefault")),A=s.useCallback(()=>{const j=h.current,D=w.current;if(!j)return;const T=j.getBoundingClientRect(),M=(D==null?void 0:D.offsetHeight)??0,F=Math.max(T.width,(D==null?void 0:D.offsetWidth)??0);let R=T.bottom;R+M>window.innerHeight-Jr&&(R=Math.max(Jr,T.top-M));const E=Math.min(Math.max(T.left,Jr),window.innerWidth-F-Jr);S({top:R,left:E,width:F})},[]);s.useLayoutEffect(()=>{if(!b)return;A();const j=()=>A();return window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[b,A,n.length]),s.useEffect(()=>{if(!b)return;const j=T=>{var F,R;const M=T.target;(F=g.current)!=null&&F.contains(M)||(R=w.current)!=null&&R.contains(M)||x(!1)},D=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),x(!1))};return document.addEventListener("pointerdown",j),document.addEventListener("keydown",D,!0),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("keydown",D,!0)}},[b]);const v=o.jsxs("div",{className:`${tt.wrap}${a?` ${tt.wrapToolbar}`:""}`,ref:g,children:[o.jsxs("div",{className:tt.field,ref:h,children:[o.jsx("button",{type:"button",id:l,className:tt.trigger,disabled:r,"aria-label":a?m("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":b?p:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:j=>j.preventDefault(),onClick:()=>x(j=>!j),children:C}),o.jsx("span",{className:tt.chevron,"aria-hidden":"true"})]}),b?o.jsx(ae,{children:o.jsx(N1,{listRef:w,listId:p,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:y.top,left:y.left,minWidth:y.width},onSelect:j=>{u(j),x(!1)}})}):null]});return i?o.jsx(Lt,{label:i,children:v}):v}function L1({commands:e,queries:t,disabled:n}){const r=U(),i=!!(n||!t.isVisualMode());return o.jsx(lm,{family:t.isFontFamilyMixed()?null:t.getFontFamily(),mixed:t.isFontFamilyMixed(),fonts:t.getFontFaces(),disabled:i,tooltip:r("commandFontFamily"),toolbar:!0,onChange:a=>{e.setFontFamily(a)}})}const _1="_wrap_192bz_1",I1="_wrapToolbar_192bz_9",F1="_field_192bz_14",B1="_input_192bz_22",H1="_toggle_192bz_41",z1="_chevron_192bz_42",O1="_unit_192bz_80",K1="_list_192bz_110",$1="_option_192bz_125",xe={wrap:_1,wrapToolbar:I1,field:F1,input:B1,toggle:H1,chevron:z1,unit:O1,list:K1,option:$1},Zr=4,U1={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function sm({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:i,tooltip:a,sizeInputId:l,toolbar:u=!1}){const m=U(),p=s.useId(),g=s.useRef(null),h=s.useRef(null),w=s.useRef(null),[b,x]=s.useState(()=>e===null?"":Z(e)),[y,S]=s.useState(!1),[C,A]=s.useState(!1),[v,j]=s.useState({top:0,left:0,width:0});s.useEffect(()=>{y||x(e===null?"":Z(e))},[e,y]);const D=s.useCallback(()=>{const E=h.current,P=w.current;if(!E)return;const L=E.getBoundingClientRect(),$=(P==null?void 0:P.offsetHeight)??0;let K=L.bottom;K+$>window.innerHeight-Zr&&(K=Math.max(Zr,L.top-$));const X=Math.min(Math.max(L.left,Zr),window.innerWidth-Math.max(L.width,72)-Zr);j({top:K,left:X,width:L.width})},[]);s.useLayoutEffect(()=>{if(!C)return;D();const E=()=>D();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[C,D]),s.useEffect(()=>{if(!C)return;const E=L=>{var K,X;const $=L.target;(K=g.current)!=null&&K.contains($)||(X=w.current)!=null&&X.contains($)||A(!1)},P=L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),A(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",P,!0)}},[C]);const T=E=>{const P=Tp(E,t);if(!P){x(e===null?"":Z(e));return}n(P.value,P.unit),x(Z(P.value))},M=Pp[t],F=C?o.jsx(ae,{children:o.jsx("ul",{ref:w,className:xe.list,role:"listbox",id:p,style:{top:v.top,left:v.left,minWidth:v.width},children:M.map(E=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:xe.option,role:"option","aria-selected":e===E,onMouseDown:P=>P.preventDefault(),onClick:()=>{n(E,t),x(Z(E)),A(!1)},children:Z(E)})},E))})}):null,R=o.jsxs("div",{className:`${xe.wrap}${u?` ${xe.wrapToolbar}`:""}`,ref:g,children:[o.jsxs("div",{className:xe.field,ref:h,children:[o.jsx("input",{id:l,className:xe.input,value:b,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":C,"aria-controls":p,role:"combobox",inputMode:"decimal",onFocus:()=>S(!0),onBlur:()=>{S(!1),T(b)},onChange:E=>x(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),T(b),A(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),A(!0))}}),o.jsx("button",{type:"button",className:xe.toggle,tabIndex:-1,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-expanded":C,"aria-controls":p,onMouseDown:E=>E.preventDefault(),onClick:()=>A(E=>!E)})]}),o.jsxs("div",{className:xe.field,children:[o.jsx("select",{className:xe.unit,value:t,disabled:i,"aria-label":m("commandFontSizeUnitAria"),onChange:E=>{r(E.target.value)},children:Va.map(E=>o.jsx("option",{value:E,children:m(U1[E])},E))}),o.jsx("span",{className:xe.chevron,"aria-hidden":"true"})]}),F]});return a?o.jsx(Lt,{label:a,children:R}):R}const W1="_backdrop_1bzww_1",G1="_dialog_1bzww_12",V1="_dialogWide_1bzww_28",q1="_header_1bzww_32",Y1="_tabs_1bzww_39",X1="_tab_1bzww_39",J1="_body_1bzww_71",Z1="_field_1bzww_79",Q1="_label_1bzww_85",eC="_sizeRow_1bzww_89",tC="_fileRow_1bzww_95",nC="_fileName_1bzww_101",rC="_previewImage_1bzww_108",oC="_marks_1bzww_118",iC="_mark_1bzww_118",aC="_actions_1bzww_133",lC="_actionsSpread_1bzww_140",sC="_actionsEnd_1bzww_144",cC="_headerRow_1bzww_149",uC="_close_1bzww_161",dC="_nameSection_1bzww_178",mC="_nameInput_1bzww_182",fC="_labelRow_1bzww_199",pC="_help_1bzww_205",gC="_textInput_1bzww_223",hC="_fullSelect_1bzww_235",bC="_error_1bzww_239",yC="_emptyHint_1bzww_244",xC="_action_1bzww_133",wC="_textarea_1bzww_255",CC="_actionDanger_1bzww_269",SC="_confirmBody_1bzww_275",vC="_nestedPanel_1bzww_283",kC="_spinnerWrap_1bzww_294",AC="_spinner_1bzww_294",DC="_actionPrimary_1bzww_329",PC="_iconButton_1bzww_343",jC="_select_1bzww_344",EC="_lengthInput_1bzww_345",RC="_lengthUnit_1bzww_346",TC="_group_1bzww_354",NC="_nestedGroup_1bzww_364",MC="_subLabel_1bzww_374",LC="_iconRow_1bzww_378",_C="_lengthField_1bzww_410",IC="_sideLabel_1bzww_416",FC="_lengthRow_1bzww_420",BC="_sideGrid_1bzww_448",HC="_shadowGrid_1bzww_449",d={backdrop:W1,dialog:G1,dialogWide:V1,header:q1,tabs:Y1,tab:X1,body:J1,field:Z1,label:Q1,sizeRow:eC,fileRow:tC,fileName:nC,previewImage:rC,marks:oC,mark:iC,actions:aC,actionsSpread:lC,actionsEnd:sC,headerRow:cC,close:uC,nameSection:dC,nameInput:mC,labelRow:fC,help:pC,textInput:gC,fullSelect:hC,error:bC,emptyHint:yC,action:xC,textarea:wC,actionDanger:CC,confirmBody:SC,nestedPanel:vC,spinnerWrap:kC,spinner:AC,actionPrimary:DC,iconButton:PC,select:jC,lengthInput:EC,lengthUnit:RC,group:TC,nestedGroup:NC,subLabel:MC,iconRow:LC,lengthField:_C,sideLabel:IC,lengthRow:FC,sideGrid:BC,shadowGrid:HC},zC={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function vl({tab:e,value:t,fonts:n,disabled:r,onTabChange:i,onChange:a}){const l=U(),u=s.useId(),m=s.useId(),p=n??xu(),g=Qi.find(h=>h.id===e)??Qi[0];return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("fontDialogTitle"),children:Qi.map(h=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":h.id===e,disabled:!h.implemented,onClick:()=>i(h.id),children:l(h.labelKey)},h.id))}),o.jsx("div",{className:d.body,role:"tabpanel",children:g.implemented?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("fontDialogFamily")}),o.jsx(lm,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:p,disabled:r,triggerId:m,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("fontDialogSize")}),o.jsx("div",{className:d.sizeRow,children:o.jsx(sm,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,w)=>{a({...t,size:h,unit:w})},onUnitChange:h=>{const w=t.size!==null?ku(t.size,t.unit,h,16,16):t.size;a({...t,size:w,unit:h})}})})]}),o.jsx("div",{className:d.field,children:o.jsx(Je,{label:l("commandFontColor"),noneLabel:l("colorAutomatic"),value:t.fontColor,mixed:t.fontColorMixed,disabled:r,onChange:h=>{a({...t,fontColor:h,fontColorMixed:!1})}})}),o.jsx("div",{className:d.field,children:o.jsx(Je,{label:l("commandHighlightColor"),noneLabel:l("colorNone"),value:t.highlightColor,mixed:t.highlightColorMixed,disabled:r,fallbackCustom:"#ffff00",onChange:h=>{a({...t,highlightColor:h,highlightColorMixed:!1})}})}),o.jsxs("fieldset",{className:d.marks,children:[o.jsx("legend",{className:d.label,children:l("fontDialogStyle")}),Xe.map(h=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.marks[h],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[h]:!t.marks[h]}})}}),l(zC[h].label)]},h))]})]}):null})]})}const Dc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function OC({open:e,tab:t,size:n,unit:r,marks:i,fontFamily:a=null,fontFamilyMixed:l=!1,fontColor:u,fontColorMixed:m=!1,highlightColor:p,highlightColorMixed:g=!1,fonts:h,disabled:w,onTabChange:b,onApply:x,onClose:y}){const S=U(),C=s.useId(),A=s.useRef(null),[v,j]=s.useState({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:p,fontColorMixed:m,highlightColorMixed:g});return s.useEffect(()=>{e&&j({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:p,fontColorMixed:m,highlightColorMixed:g})},[e,n,r,i,a,l,u,m,p,g]),s.useEffect(()=>{if(!e)return;const D=A.current,T=D==null?void 0:D.querySelector(Dc);T==null||T.focus();const M=F=>{if(F.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;F.preventDefault(),F.stopPropagation(),y();return}if(F.key!=="Tab"||!D)return;const R=[...D.querySelectorAll(Dc)];if(R.length===0)return;const E=R[0],P=R[R.length-1];F.shiftKey&&document.activeElement===E?(F.preventDefault(),P.focus()):!F.shiftKey&&document.activeElement===P&&(F.preventDefault(),E.focus())};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[e,y]),e?o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:y,children:o.jsxs("div",{ref:A,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":C,onMouseDown:D=>D.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:C,children:S("fontDialogTitle")}),o.jsx(vl,{tab:t,value:v,fonts:h,disabled:w,onTabChange:b,onChange:j}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:y,children:S("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:w,onClick:()=>x(v),children:S("fontDialogOk")})]})]})})}):null}const KC={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function we({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:i,inputId:a,onChange:l}){const u=U(),m=s.useId(),p=a??m,g=(t==null?void 0:t.unit)??Xa,[h,w]=s.useState(()=>t?Z(t.value):""),[b,x]=s.useState(!1);s.useEffect(()=>{b||w(t?Z(t.value):"")},[t,b]);const y=S=>{const C=S.trim();if(!C){l(null),w("");return}const A=Zn(C,g,r);if(!A){w(t?Z(t.value):"");return}l(A),w(Z(A.value))};return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:p,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:p,className:d.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),y(h)},onChange:S=>w(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),y(h),S.currentTarget.blur())}}),o.jsx("select",{className:d.lengthUnit,value:g,disabled:n,"aria-label":i??u("paragraphDialogLengthUnitAria"),onChange:S=>{const C=S.target.value;if(t){l({value:t.value,unit:C});return}if(h.trim()){const A=Zn(h,C,r);l(A)}},children:Va.map(S=>o.jsx("option",{value:S,children:u(KC[S])},S))})]})]})}function kl({shadow:e,disabled:t,onChange:n}){const r=U();return o.jsxs("div",{className:d.shadowGrid,children:[o.jsx(we,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetX:i??{value:0,unit:"px"}})}}),o.jsx(we,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetY:i??{value:0,unit:"px"}})}}),o.jsx(we,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:i=>{n({...e,blur:i??{value:0,unit:"px"}})}}),o.jsx(we,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:i=>{n({...e,spread:i??{value:0,unit:"px"}})}}),o.jsx(Je,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:i=>{n({...e,color:i})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const cm=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],um=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],$C={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},UC={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function dm({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const i=U(),a=s.useId(),l=s.useId();return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:i(e)}),o.jsx(WC,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("imagePropertiesFit")}),o.jsxs("select",{id:a,className:d.select,value:t.fit??"",disabled:n,onChange:u=>{const m=u.target.value;r({...t,fit:m||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesFitDefault")}),ul.map(u=>o.jsx("option",{value:u,children:i($C[u])},u))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("imagePropertiesPosition")}),o.jsxs("select",{id:l,className:d.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesPositionDefault")}),dl.map(u=>o.jsx("option",{value:u,children:i(UC[u])},u))]})]})]})}function WC({value:e,disabled:t,onChange:n}){const r=U(),i=s.useId(),a=e===null?null:ho(e),[l,u]=s.useState(()=>a===null?"":Z(a)),[m,p]=s.useState(!1);s.useEffect(()=>{m||u(a===null?"":Z(a))},[a,m]);const g=h=>{const w=h.trim();if(!w){n(null),u("");return}const b=Number(w.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":Z(a));return}const x=_u(b);n(x),u(Z(ho(x)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>u(h.target.value),onBlur:()=>{p(!1),g(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const Qr=4,GC={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function ko({label:e,inputAria:t,value:n,disabled:r,onChange:i}){const a=U(),l=s.useId(),u=s.useId(),m=s.useRef(null),p=s.useRef(null),g=s.useRef(null),h=(n==null?void 0:n.unit)??rb,[w,b]=s.useState(()=>n?Z(n.value):""),[x,y]=s.useState(!1),[S,C]=s.useState(!1),[A,v]=s.useState({top:0,left:0,width:0});s.useEffect(()=>{x||b(n?Z(n.value):"")},[n,x]);const j=s.useCallback(()=>{const R=p.current,E=g.current;if(!R)return;const P=R.getBoundingClientRect(),L=(E==null?void 0:E.offsetHeight)??0;let $=P.bottom;$+L>window.innerHeight-Qr&&($=Math.max(Qr,P.top-L));const K=Math.min(Math.max(P.left,Qr),window.innerWidth-Math.max(P.width,72)-Qr);v({top:$,left:K,width:P.width})},[]);s.useLayoutEffect(()=>{if(!S)return;j();const R=()=>j();return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[S,j]),s.useEffect(()=>{if(!S)return;const R=P=>{var $,K;const L=P.target;($=m.current)!=null&&$.contains(L)||(K=g.current)!=null&&K.contains(L)||C(!1)},E=P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),C(!1))};return document.addEventListener("pointerdown",R),document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("pointerdown",R),document.removeEventListener("keydown",E,!0)}},[S]);const D=R=>{const E=R.trim();if(!E){i(null),b("");return}const P=lc(E,h);if(!P){b(n?Z(n.value):"");return}i(P),b(Z(P.value))},T=ob[h],M=(n==null?void 0:n.value)??null,F=S?o.jsx(ae,{children:o.jsx("ul",{ref:g,className:xe.list,role:"listbox",id:l,style:{top:A.top,left:A.left,minWidth:A.width},children:T.map(R=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:xe.option,role:"option","aria-selected":M===R,onMouseDown:E=>E.preventDefault(),onClick:()=>{i({value:R,unit:h}),b(Z(R)),C(!1)},children:Z(R)})},R))})}):null;return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:u,children:e}),o.jsxs("div",{className:`${xe.wrap} ${d.lengthRow}`,ref:m,children:[o.jsxs("div",{className:xe.field,ref:p,children:[o.jsx("input",{id:u,className:xe.input,value:w,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":S,"aria-controls":l,role:"combobox",inputMode:"decimal",onFocus:()=>y(!0),onBlur:()=>{y(!1),D(w)},onChange:R=>b(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),D(w),C(!1),R.currentTarget.blur()),R.key==="ArrowDown"&&(R.preventDefault(),C(!0))}}),o.jsx("button",{type:"button",className:xe.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":S,"aria-controls":l,onMouseDown:R=>R.preventDefault(),onClick:()=>C(R=>!R)})]}),o.jsxs("div",{className:xe.field,children:[o.jsx("select",{className:xe.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:R=>{const E=R.target.value;if(n){i({value:n.value,unit:E});return}w.trim()&&i(lc(w,E))},children:Sd.map(R=>o.jsx("option",{value:R,children:a(GC[R])},R))}),o.jsx("span",{className:xe.chevron,"aria-hidden":"true"})]}),F]})]})}const VC={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},qC={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function mm({src:e,disabled:t,customImagePicker:n,onSrcChange:r,onCustomPick:i,onSourceChange:a}){const l=U(),u=s.useId(),m=s.useId(),p=s.useRef(null),[g,h]=s.useState(()=>e.startsWith("data:")?"file":e.trim()?"url":"file"),[w,b]=s.useState(()=>e.startsWith("data:")?"":e),[x,y]=s.useState(""),[S,C]=s.useState(null),[A,v]=s.useState(!1);s.useEffect(()=>{a==null||a(g)},[a,g]);const j=g==="file"&&e.startsWith("data:")?e:g==="url"?w:"",D=g==="custom"?null:vn(j),T=g==="custom"?null:g==="file"&&S?qC[S]:D&&(g==="file"||w.trim().length>0)?VC[D]:null,M=()=>{t||!n||i==null||i()},F=R=>{var P;const E=(P=R.target.files)==null?void 0:P[0];E&&(v(!0),C(null),Jh(E).then(L=>{y(E.name),h("file"),r(L),v(!1)},L=>{const $=L instanceof Error?L.message:"";y(""),h("file"),C($==="tooLarge"||$==="type"?$:"type"),v(!1),p.current&&(p.current.value="")}))};return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("imageDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("imageDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="file",disabled:t,onClick:()=>h("file"),children:l("imageDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="url",disabled:t,onClick:()=>h("url"),children:l("imageDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="custom",disabled:t,onClick:()=>h("custom"),children:n.text}):null]}),g==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:p,type:"file",accept:Uh,hidden:!0,disabled:t,"aria-label":l("imageDialogChooseFile"),onChange:F}),o.jsx("button",{type:"button",className:d.action,disabled:t||A,onClick:()=>{var R;return(R=p.current)==null?void 0:R.click()},children:l("imageDialogChooseFile")}),x?o.jsx("span",{className:d.fileName,children:x}):null,e.startsWith("data:")&&!x?o.jsx("span",{className:d.fileName,children:l("pageBackgroundImageCurrent")}):null]}):null,g==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("imageDialogUrl")}),o.jsx("input",{id:u,className:d.textInput,value:w,disabled:t,"aria-invalid":T!==null,"aria-describedby":T?m:void 0,onChange:R=>{const E=R.target.value;b(E),r(E.trim())}})]}):null,g==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:M,children:n.buttonCaption})]}):null,T?o.jsx("p",{id:m,className:d.error,children:l(T)}):null]})}function YC(e){return vn(e.trim())===null}function XC(e){return jd(e)?{width:null,height:null}:e==="fill"?{width:{...mn},height:{...mn}}:{width:{...mn},height:null}}function JC({value:e,disabled:t,customImagePicker:n,onCustomImagePick:r,onChange:i}){const a=U(),l=e.src??"",u=(m,p)=>{i({...e,fit:null,[m]:p})};return o.jsxs(o.Fragment,{children:[l?o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:a("pageBackgroundImagePreview")}),o.jsx("img",{className:d.previewImage,src:l,alt:a("pageBackgroundImagePreviewAlt")}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:()=>{i({...e,src:null})},children:a("pageBackgroundImageClear")})]}):null,o.jsx(mm,{src:l,disabled:t,customImagePicker:n,onCustomPick:r,onSrcChange:m=>{i({...e,src:m.trim()||null})}}),l?o.jsxs(o.Fragment,{children:[o.jsx(ko,{label:a("imagePropertiesWidth"),inputAria:a("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:m=>u("width",m)}),o.jsx(ko,{label:a("imagePropertiesHeight"),inputAria:a("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:m=>u("height",m)}),o.jsx(dm,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:m=>{const p=m.fit===e.fit?{width:e.width,height:e.height}:XC(m.fit);i({...e,opacity:m.opacity,fit:m.fit,position:m.position,...p})}})]}):null]})}const ZC={left:Ia,center:_a,right:Fa,justify:Qc},QC={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},eS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},tS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},nS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},rS={value:1,unit:"pt"},oS={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function $n(e){return{top:e,right:e,bottom:e,left:e}}function Pc(e){for(const t of Te)if(e[t])return e[t];return null}function iS(){const e=[...cm];for(const t of um)e.some(n=>n.id===t.id)||e.push(t);return e}function Al({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:i="paragraphDialogTitle",backgroundImage:a,customImagePicker:l,onCustomImagePick:u,onBackgroundImageChange:m,onTabChange:p,onChange:g}){const h=U(),w=r?iS().filter(v=>r.includes(v.id)):cm,b=s.useId(),[x,y]=s.useState(()=>vt(t.margin,$n(t.margin.top))),[S,C]=s.useState(()=>vt(t.padding,$n(t.padding.top))),A=(v,j,D,T)=>{const M=t[v],F=j?$n(T):{...M,[D]:T};g({...t,[v]:F,[`${v}Mixed`]:!1})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":h(i),children:w.map(v=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":v.id===e,disabled:!v.implemented,onClick:()=>p(v.id),children:h(v.labelKey)},v.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":h("paragraphDialogAlignment"),children:bd.map(v=>{const j=ZC[v],D=!t.alignMixed&&t.align===v;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":D,"aria-label":h(QC[v].aria),disabled:n,onClick:()=>{g({...t,align:v,alignMixed:!1})},children:o.jsx(j,{})},v)})})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogLists")}),o.jsxs("div",{className:d.iconRow,children:[o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":h("commandBulletListAria"),disabled:n,onClick:()=>{const v=!t.listMixed&&t.list==="ul"?null:"ul";g({...t,list:v,listMixed:!1})},children:o.jsx(eu,{})}),o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":h("commandNumberedListAria"),disabled:n,onClick:()=>{const v=!t.listMixed&&t.list==="ol"?null:"ol";g({...t,list:v,listMixed:!1})},children:o.jsx(ou,{})})]})]})]}):null,e==="spacing"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogSpacing")}),o.jsx(jc,{legend:h("paragraphDialogMargin"),sides:t.margin,linked:x,disabled:n,allowNegative:!0,onLinkedChange:v=>{y(v),v&&g({...t,margin:$n(Pc(t.margin)),marginMixed:!1})},onSideChange:(v,j)=>A("margin",x,v,j)}),o.jsx(jc,{legend:h("paragraphDialogPadding"),sides:t.padding,linked:S,disabled:n,onLinkedChange:v=>{C(v),v&&g({...t,padding:$n(Pc(t.padding)),paddingMixed:!1})},onSideChange:(v,j)=>A("padding",S,v,j)}),o.jsx(lS,{value:t.lineHeight,disabled:n,onChange:v=>{g({...t,lineHeight:v,lineHeightMixed:!1})}})]}):null,e==="border"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:h("paragraphDialogBorderStyle")}),o.jsx("select",{id:b,className:d.select,value:t.border.style,disabled:n,onChange:v=>{const j=v.target.value;g({...t,border:{style:j,width:j==="none"?null:t.border.width??rS,color:j==="none"?null:t.border.color},borderMixed:!1})},children:To.map(v=>o.jsx("option",{value:v,children:h(tS[v])},v))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(we,{label:h("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:v=>{g({...t,border:{...t.border,width:v},borderMixed:!1})}}),o.jsx(Je,{label:h("paragraphDialogBorderColor"),noneLabel:h("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:v=>{g({...t,border:{...t.border,color:v},borderMixed:!1})}})]}):null,o.jsx(we,{label:h("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:v=>{g({...t,borderRadius:v,radiusMixed:!1})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{g({...t,boxShadow:t.boxShadow?null:oS,shadowMixed:!1})}}),h("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(kl,{shadow:t.boxShadow,disabled:n,onChange:v=>{g({...t,boxShadow:v,shadowMixed:!1})}}):null]}):null,e==="background"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogTabBackground")}),o.jsx(Je,{label:h("paragraphDialogBackgroundColor"),noneLabel:h("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:v=>{g({...t,backgroundColor:v,backgroundMixed:!1})}}),o.jsx(aS,{value:t.opacity,disabled:n,onChange:v=>{g({...t,opacity:v,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&m?o.jsx(JC,{value:a,disabled:n,customImagePicker:l,onCustomImagePick:u,onChange:m}):null]})]})}function aS({value:e,disabled:t,onChange:n}){const r=U(),i=s.useId(),a=e===null?null:ho(e),[l,u]=s.useState(()=>a===null?"":Z(a)),[m,p]=s.useState(!1);s.useEffect(()=>{m||u(a===null?"":Z(a))},[a,m]);const g=h=>{const w=h.trim();if(!w){n(null),u("");return}const b=Number(w.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":Z(a));return}const x=_u(b);n(x),u(Z(ho(x)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>u(h.target.value),onBlur:()=>{p(!1),g(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function jc({legend:e,sides:t,linked:n,disabled:r,allowNegative:i=!1,onLinkedChange:a,onSideChange:l}){const u=U(),m=n?["top"]:Te;return o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:e}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),u("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:m.map(p=>o.jsx(we,{label:n?e:u(eS[p]),value:t[p],disabled:r,allowNegative:i,onChange:g=>l(p,g)},p))})]})}function lS({value:e,disabled:t,onChange:n}){const r=U(),i=s.useId(),a=sS(e),l=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,m]=s.useState(()=>l===null?"":Z(l)),p=(e==null?void 0:e.kind)==="length"?e.unit:Xa;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogLineHeight")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:a==="normal"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:g=>m(g.target.value),onBlur:()=>{const g=u.trim();if(!g){n(null);return}if(a==="number"||a==="empty"){const w=Number(g.replace(",","."));if(!Number.isFinite(w)||w<0){m(l===null?"":Z(l));return}n({kind:"number",value:w}),m(Z(w));return}const h=Zn(g,p,!1);if(!h){m(l===null?"":Z(l));return}n({kind:"length",value:h.value,unit:h.unit}),m(Z(h.value))}}),o.jsxs("select",{className:d.lengthUnit,value:a==="length"?p:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:g=>{const h=g.target.value;if(h==="empty"){n(null),m("");return}if(h==="normal"){n({kind:"normal"}),m("");return}if(h==="number"){const y=Number((u||"1.5").replace(",",".")),S=Number.isFinite(y)&&y>=0?y:1.5;n({kind:"number",value:S}),m(Z(S));return}const w=h,b=Zn(u||"1",w,!1),x=(b==null?void 0:b.value)??1;n({kind:"length",value:x,unit:w}),m(Z(x))},children:[o.jsx("option",{value:"empty"}),o.jsx("option",{value:"normal",children:r("paragraphDialogLineHeightNormal")}),o.jsx("option",{value:"number",children:r("paragraphDialogLineHeightUnitless")}),["pt","px","em","rem","%"].map(g=>o.jsx("option",{value:g,children:r(nS[g])},g))]})]})]})}function sS(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const Ec='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function cS({open:e,tab:t,value:n,disabled:r,onTabChange:i,onApply:a,onClose:l}){const u=U(),m=s.useId(),p=s.useRef(null),[g,h]=s.useState(n);return s.useEffect(()=>{e&&h(n)},[e,n]),s.useEffect(()=>{if(!e)return;const w=p.current,b=w==null?void 0:w.querySelector(Ec);b==null||b.focus();const x=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),l();return}if(y.key!=="Tab"||!w)return;const S=[...w.querySelectorAll(Ec)];if(S.length===0)return;const C=S[0],A=S[S.length-1];y.shiftKey&&document.activeElement===C?(y.preventDefault(),A.focus()):!y.shiftKey&&document.activeElement===A&&(y.preventDefault(),C.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,l]),e?o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:l,children:o.jsxs("div",{ref:p,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":m,onMouseDown:w=>w.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:m,children:u("paragraphDialogTitle")}),o.jsx(Al,{tab:t,value:g,disabled:r,onTabChange:i,onChange:h}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:l,children:u("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:r,onClick:()=>a(g),children:u("fontDialogOk")})]})]})})}):null}const uS=["auto","A4","letter","legal","custom"],dS={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},mS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Rc(e){return e===null?"":Z(e.value)}function fS({value:e,disabled:t,onChange:n,onReset:r}){const i=U(),a=s.useId(),[l,u]=s.useState(!0),m=e??Vt(),p=(g,h)=>{if(l){n({...m,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...m,margin:{...m.margin,[g]:h},marginMixed:!1})};return o.jsxs("div",{className:d.panel,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("pageAtRuleSize")}),o.jsx("select",{id:a,className:d.select,disabled:t,value:m.sizePreset,onChange:g=>n({...m,sizePreset:g.target.value}),children:uS.map(g=>o.jsx("option",{value:g,children:i(dS[g])},g))})]}),m.sizePreset==="custom"?o.jsxs("div",{className:d.sideGrid,children:[o.jsx(ta,{label:i("pageAtRuleWidth"),value:m.customWidth,disabled:t,onChange:g=>n({...m,customWidth:g})}),o.jsx(ta,{label:i("pageAtRuleHeight"),value:m.customHeight,disabled:t,onChange:g=>n({...m,customHeight:g})})]}):null,o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:i("pageAtRuleOrientation")}),o.jsx("div",{className:d.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([g,h])=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"radio",name:"page-orientation",checked:(m.orientation??"none")===g,disabled:t,onChange:()=>n({...m,orientation:g==="none"?null:g})}),i(h)]},g))})]}),o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:i("pageAtRuleMargins")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:l,disabled:t,onChange:()=>u(!l)}),i("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(l?["top"]:Te).map(g=>o.jsx(ta,{label:i(l?"pageAtRuleMargins":mS[g]),value:m.margin[g],disabled:t,onChange:h=>p(g,h)},g))})]}),o.jsx("div",{className:d.actions,children:o.jsx("button",{type:"button",className:d.action,disabled:t,"aria-label":i("pageAtRuleResetAria"),onClick:r,children:i("pageAtRuleReset")})})]})}function ta({label:e,value:t,disabled:n,onChange:r}){const i=U(),a=s.useId(),[l,u]=s.useState(()=>Rc(t)),m=(t==null?void 0:t.unit)??Xa;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:a,className:d.lengthInput,value:l,disabled:n,inputMode:"decimal",onChange:p=>u(p.target.value),onBlur:()=>{const p=l.trim();if(!p){r(null);return}const g=Zn(p,m,!1);if(!g){u(Rc(t));return}r(g),u(Z(g.value))}}),o.jsxs("select",{className:d.lengthUnit,disabled:n,value:m,"aria-label":i("paragraphDialogLengthUnitAria"),onChange:p=>{const g=p.target.value;t&&r({...t,unit:g})},children:[o.jsx("option",{value:"pt",children:i("fontSizeUnitPt")}),o.jsx("option",{value:"px",children:i("fontSizeUnitPx")}),o.jsx("option",{value:"em",children:i("fontSizeUnitEm")}),o.jsx("option",{value:"rem",children:i("fontSizeUnitRem")}),o.jsx("option",{value:"%",children:i("fontSizeUnitPercent")})]})]})]})}const Tc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',pS=um.map(e=>e.id);function gS(e){return{...Gn(),...e}}function hS(e){const{align:t,alignMixed:n,list:r,listMixed:i,...a}=e;return a}function bS({open:e,tab:t,value:n,fonts:r,disabled:i,customImagePicker:a,onCustomImagePick:l,onTabChange:u,onApply:m,onResetAtRule:p,onClose:g}){const h=U(),w=s.useId(),b=s.useRef(null),[x,y]=s.useState("general"),[S,C]=s.useState("spacing"),[A,v]=s.useState(n.font),[j,D]=s.useState(n.box),[T,M]=s.useState(n.backgroundImage),[F,R]=s.useState(n.atRule??Vt());if(s.useEffect(()=>{e&&(y("general"),C("spacing"),v(n.font),D(n.box),M(n.backgroundImage??ml()),R(n.atRule??Vt()))},[e,n]),s.useEffect(()=>{if(!e)return;const P=b.current,L=P==null?void 0:P.querySelector(Tc);L==null||L.focus();const $=K=>{if(K.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;K.preventDefault(),K.stopPropagation(),g();return}if(K.key!=="Tab"||!P)return;const X=[...P.querySelectorAll(Tc)];if(X.length===0)return;const J=X[0],me=X[X.length-1];K.shiftKey&&document.activeElement===J?(K.preventDefault(),me.focus()):!K.shiftKey&&document.activeElement===me&&(K.preventDefault(),J.focus())};return document.addEventListener("keydown",$,!0),()=>document.removeEventListener("keydown",$,!0)},[e,g]),!e)return null;const E=h("pageDialogTitle");return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:g,children:o.jsxs("div",{ref:b,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":w,onMouseDown:P=>P.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:w,children:E}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":E,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="font",onClick:()=>u("font"),children:h("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="paragraph",onClick:()=>u("paragraph"),children:h("customStyleDialogTabParagraph")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="print",onClick:()=>u("print"),children:h("pageDialogTabPrint")})]}),t==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(vl,{tab:x,value:A,fonts:r,disabled:i,onTabChange:y,onChange:v})}):t==="paragraph"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(Al,{tab:S,value:gS(j),disabled:i,tabs:pS,tablistLabelKey:"pageDialogTitle",backgroundImage:T,customImagePicker:a,onCustomImagePick:l,onBackgroundImageChange:M,onTabChange:P=>{P!=="general"&&C(P)},onChange:P=>D(hS(P))})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(fS,{value:F,disabled:i,onChange:R,onReset:()=>{R(Vt()),p==null||p()}})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:g,children:h("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>m({font:A,box:j,backgroundImage:T,atRule:F}),children:h("fontDialogOk")})]})]})})})}const Nc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function yS(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Mc(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamily??null,fontFamilyMixed:!1,fontColor:e.fontColor,highlightColor:e.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}}function xS(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamilyMixed?null:e.fontFamily,fontColor:e.fontColorMixed?null:e.fontColor,highlightColor:e.highlightColorMixed?null:e.highlightColor}}function wS({open:e,mode:t,styleId:n,name:r="",font:i,paragraph:a,canDelete:l=!1,busy:u,disabled:m,fonts:p,defaultOuterTab:g="font",onSave:h,onDelete:w,onClose:b}){const x=U(),y=s.useId(),S=s.useId(),C=s.useRef(null),[A,v]=s.useState(r),[j,D]=s.useState(g),[T,M]=s.useState("general"),[F,R]=s.useState("general"),[E,P]=s.useState(()=>Mc(i)),[L,$]=s.useState(()=>Sa(a)),[K,X]=s.useState(!1);if(s.useEffect(()=>{e&&(v(r),D(g),M("general"),R("general"),P(Mc(i)),$(Sa(a)),X(!1))},[e,r,i,a,g]),s.useEffect(()=>{if(!e)return;const ne=C.current,ie=ne==null?void 0:ne.querySelector(Nc);ie==null||ie.focus();const N=V=>{if(V.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if(V.preventDefault(),V.stopPropagation(),K){X(!1);return}b();return}if(V.key!=="Tab"||!ne)return;const re=[...ne.querySelectorAll(Nc)];if(re.length===0)return;const G=re[0],ge=re[re.length-1];V.shiftKey&&document.activeElement===G?(V.preventDefault(),ge.focus()):!V.shiftKey&&document.activeElement===ge&&(V.preventDefault(),G.focus())};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[e,b,K]),!e)return null;const J=x(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),me=A.trim().length>0,Y=!!(m||u),fe=()=>{const ne=A.trim();ne&&h({id:n??yS(),name:ne,font:xS(E),paragraph:Cd(L)})};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:b,children:o.jsxs("div",{ref:C,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,"aria-busy":u||void 0,onMouseDown:ne=>ne.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:y,children:J}),o.jsx("button",{type:"button",className:d.close,"aria-label":x("customStyleDialogCloseAria"),onClick:b,children:o.jsx(Me,{})})]}),K?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.confirmBody,children:x("customStyleDialogDeleteConfirm")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:Y,onClick:()=>X(!1),children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y||!n,onClick:()=>{n&&(w==null||w(n))},children:x("customStyleDialogDelete")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.nameSection,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:S,children:x("customStyleDialogName")}),o.jsx("input",{id:S,className:d.nameInput,value:A,disabled:Y,onChange:ne=>v(ne.target.value)})]})}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":J,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":j==="font",onClick:()=>D("font"),children:x("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":j==="paragraph",onClick:()=>D("paragraph"),children:x("customStyleDialogTabParagraph")})]}),j==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(vl,{tab:T,value:E,fonts:p,disabled:Y,onTabChange:M,onChange:P})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(Al,{tab:F,value:L,disabled:Y,onTabChange:R,onChange:$})}),o.jsxs("div",{className:t==="edit"&&l?`${d.actions} ${d.actionsSpread}`:d.actions,children:[t==="edit"&&l?o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y,onClick:()=>X(!0),children:x("customStyleDialogDelete")}):null,o.jsxs("div",{className:d.actionsEnd,children:[o.jsx("button",{type:"button",className:d.action,onClick:b,children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:Y||!me,onClick:fe,children:x("fontDialogOk")})]})]})]})]})})})}const CS='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function SS({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=U(),l=s.useId(),u=s.useId(),m=s.useRef(null),p=s.useRef(null),[g,h]=s.useState(t);if(s.useEffect(()=>{e&&h(t)},[e,t]),s.useEffect(()=>{var y;if(!e)return;(y=p.current)==null||y.focus();const b=m.current,x=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),i();return}if(S.key!=="Tab"||!b)return;const C=[...b.querySelectorAll(CS)];if(C.length===0)return;const A=C[0],v=C[C.length-1];S.shiftKey&&document.activeElement===A?(S.preventDefault(),v.focus()):!S.shiftKey&&document.activeElement===v&&(S.preventDefault(),A.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,i]),!e)return null;const w=()=>{n||r(g)};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("customCssDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("customCssDialogCloseAria"),onClick:i,children:o.jsx(Me,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:a("customCssDialogField")}),o.jsx("textarea",{ref:p,id:u,className:d.textarea,value:g,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:b=>h(b.target.value)})]})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:w,children:a("fontDialogOk")})]})]})})})}const Lc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',vS={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function kS({open:e,existingIds:t,disabled:n,onApply:r,onClose:i}){const a=U(),l=s.useId(),u=s.useId(),m=s.useId(),p=s.useRef(null),[g,h]=s.useState(""),[w,b]=s.useState(!1),x=s.useMemo(()=>new Set(t),[t]),y=Fd(g,x);if(s.useEffect(()=>{e&&(h(""),b(!1))},[e]),s.useEffect(()=>{if(!e)return;const v=p.current,j=v==null?void 0:v.querySelector(Lc);j==null||j.focus();const D=T=>{if(T.key==="Escape"){T.preventDefault(),T.stopPropagation(),i();return}if(T.key!=="Tab"||!v)return;const M=[...v.querySelectorAll(Lc)];if(M.length===0)return;const F=M[0],R=M[M.length-1];T.shiftKey&&document.activeElement===F?(T.preventDefault(),R.focus()):!T.shiftKey&&document.activeElement===R&&(T.preventDefault(),F.focus())};return document.addEventListener("keydown",D,!0),()=>document.removeEventListener("keydown",D,!0)},[e,i]),!e)return null;const S=w||g.trim().length>0?y:null,C=y===null&&!n,A=()=>{b(!0),!(y||n)&&r(g.trim())};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:p,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:v=>v.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("bookmarkDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:i,children:o.jsx(Me,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsxs("div",{className:d.labelRow,children:[o.jsx("label",{className:d.label,htmlFor:u,children:a("bookmarkDialogName")}),o.jsx(Lt,{label:a("bookmarkDialogHelp"),elevated:!0,children:o.jsx("button",{type:"button",className:d.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),o.jsx("input",{id:u,className:d.textInput,value:g,disabled:n,"aria-invalid":S!==null,"aria-describedby":S?m:void 0,onChange:v=>h(v.target.value)}),S?o.jsx("p",{id:m,className:d.error,children:a(vS[S])}):null]})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!C,onClick:A,children:a("fontDialogOk")})]})]})})})}const _c='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',AS={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},DS={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function PS({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=U(),u=s.useId(),m=s.useId(),p=s.useId(),g=s.useId(),h=s.useRef(null),w=s.useRef(null),[b,x]=s.useState("file"),[y,S]=s.useState(""),[C,A]=s.useState(""),[v,j]=s.useState(""),[D,T]=s.useState(""),[M,F]=s.useState(null),[R,E]=s.useState(!1);if(s.useEffect(()=>{e&&(x("file"),S(""),A(""),j(""),T(""),F(null),E(!1),w.current&&(w.current.value=""))},[e]),s.useEffect(()=>{if(!e)return;const Y=h.current,fe=Y==null?void 0:Y.querySelector(_c);fe==null||fe.focus();const ne=ie=>{if(ie.key==="Escape"){ie.preventDefault(),ie.stopPropagation(),a();return}if(ie.key!=="Tab"||!Y)return;const N=[...Y.querySelectorAll(_c)];if(N.length===0)return;const V=N[0],re=N[N.length-1];ie.shiftKey&&document.activeElement===V?(ie.preventDefault(),re.focus()):!ie.shiftKey&&document.activeElement===re&&(ie.preventDefault(),V.focus())};return document.addEventListener("keydown",ne,!0),()=>document.removeEventListener("keydown",ne,!0)},[e,a]),!e)return null;const P=b==="file"?C:b==="url"?y:"",L=b==="custom"?null:gl(P),$=b==="custom"?null:b==="file"&&M?DS[M]:L&&(b==="file"||y.trim().length>0)?AS[L]:null,K=b!=="custom"&&L===null&&!(b==="file"&&M)&&!t&&!R,X=()=>{t||!n||i==null||i()},J=()=>{K&&r({src:P.trim(),title:D.trim()})},me=Y=>{var ne;const fe=(ne=Y.target.files)==null?void 0:ne[0];fe&&(E(!0),F(null),zy(fe).then(ie=>{A(ie),j(fe.name),x("file"),E(!1)},ie=>{const N=ie instanceof Error?ie.message:"";A(""),j(""),x("file"),F(N==="tooLarge"||N==="type"?N:"type"),E(!1),w.current&&(w.current.value="")}))};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:Y=>Y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("audioDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("audioDialogCloseAria"),onClick:a,children:o.jsx(Me,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":b==="file",disabled:t,onClick:()=>x("file"),children:l("audioDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":b==="url",disabled:t,onClick:()=>x("url"),children:l("audioDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":b==="custom",disabled:t,onClick:()=>x("custom"),children:n.text}):null]}),b==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:w,type:"file",accept:My,hidden:!0,disabled:t,"aria-label":l("audioDialogChooseFile"),onChange:me}),o.jsx("button",{type:"button",className:d.action,disabled:t||R,onClick:()=>{var Y;return(Y=w.current)==null?void 0:Y.click()},children:l("audioDialogChooseFile")}),v?o.jsx("span",{className:d.fileName,children:v}):null]}):null,b==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("audioDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:y,disabled:t,"aria-invalid":$!==null,"aria-describedby":$?g:void 0,onChange:Y=>S(Y.target.value)})]}):null,b==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:X,children:n.buttonCaption})]}):null]}),b!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("audioDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:D,disabled:t,onChange:Y=>T(Y.target.value)})]}):null,$?o.jsx("p",{id:g,className:d.error,children:l($)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),b!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!K,onClick:J,children:l("fontDialogOk")}):null]})]})})})}const Ic='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])';function jS({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=U(),u=s.useId(),m=s.useId(),p=s.useId(),g=s.useRef(null),[h,w]=s.useState(""),[b,x]=s.useState(""),[y,S]=s.useState(""),[C,A]=s.useState("file");if(s.useEffect(()=>{e&&(w(""),x(""),S(""),A("file"))},[e]),s.useEffect(()=>{if(!e)return;const D=g.current,T=D==null?void 0:D.querySelector(Ic);T==null||T.focus();const M=F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),a();return}if(F.key!=="Tab"||!D)return;const R=[...D.querySelectorAll(Ic)];if(R.length===0)return;const E=R[0],P=R[R.length-1];F.shiftKey&&document.activeElement===E?(F.preventDefault(),P.focus()):!F.shiftKey&&document.activeElement===P&&(F.preventDefault(),E.focus())};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[e,a]),!e)return null;const v=YC(h)&&!t,j=()=>{v&&r({src:h.trim(),alt:b.trim(),title:y.trim()})};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:g,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("imageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("imageDialogCloseAria"),onClick:a,children:o.jsx(Me,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx(mm,{src:h,disabled:t,customImagePicker:n,onCustomPick:i,onSourceChange:A,onSrcChange:w}),C!=="custom"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imageDialogAlt")}),o.jsx("input",{id:m,className:d.textInput,value:b,disabled:t,onChange:D=>x(D.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imageDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:y,disabled:t,onChange:D=>S(D.target.value)})]})]}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),C!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!v,onClick:j,children:l("fontDialogOk")}):null]})]})})})}const ES=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"alignment",labelKey:"imagePropertiesTabAlignment",implemented:!0},{id:"border",labelKey:"imagePropertiesTabBorder",implemented:!0},{id:"advanced",labelKey:"imagePropertiesTabAdvanced",implemented:!0},{id:"hover",labelKey:"imagePropertiesTabHover",implemented:!0}],RS={left:Ia,center:_a,right:Fa},TS=["left","center","right"],NS={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},MS=["width","height","lock"],LS={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},_S={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},IS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},FS={value:1,unit:"pt"},BS={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function na(e){return{top:e,right:e,bottom:e,left:e}}function HS(e){for(const t of Te)if(e[t])return e[t];return null}function zS({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:i,onChange:a}){const l=U(),u=s.useId(),m=s.useId(),p=s.useId(),[g,h]=s.useState(()=>vt(t.margin,na(t.margin.top))),w=t.align==="center",b=(y,S)=>{if(t.sizeMode==="lock"&&S){const C=Vn(y,S,n);a({...t,width:C.width,height:C.height});return}a({...t,[y]:S})},x=y=>{if(y==="width"){a({...t,sizeMode:y,height:null});return}if(y==="height"){a({...t,sizeMode:y,width:null});return}if(t.width){const S=Vn("width",t.width,n);a({...t,sizeMode:y,width:S.width,height:S.height});return}if(t.height){const S=Vn("height",t.height,n);a({...t,sizeMode:y,width:S.width,height:S.height});return}a({...t,sizeMode:y})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("imagePropertiesDialogTitle"),children:ES.map(y=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":y.id===e,disabled:!y.implemented,onClick:()=>i(y.id),children:l(y.labelKey)},y.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesSize")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("imagePropertiesSizeMode"),children:MS.map(y=>o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":t.sizeMode===y,disabled:r,onClick:()=>x(y),children:l(LS[y])},y))}),o.jsx(ko,{label:l("imagePropertiesWidth"),inputAria:l("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:y=>b("width",y)}),o.jsx(ko,{label:l("imagePropertiesHeight"),inputAria:l("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:y=>b("height",y)})]}):null,e==="alignment"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("paragraphDialogAlignment"),children:TS.map(y=>{const S=RS[y];return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":t.align===y,"aria-label":l(NS[y]),disabled:r,onClick:()=>{a({...t,align:t.align===y?null:y})},children:o.jsx(S,{})},y)})})]}):null,e==="border"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogMargin")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:g,disabled:r||w,onChange:()=>{const y=!g;h(y),y&&a({...t,margin:na(HS(t.margin))})}}),l("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(g?["top"]:Te).map(y=>o.jsx(we,{label:l(g?"paragraphDialogMargin":_S[y]),value:t.margin[y],disabled:r||w&&(y==="left"||y==="right"),allowNegative:!0,onChange:S=>{const C=g?na(S):{...t.margin,[y]:S};a({...t,margin:C})}},y))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("paragraphDialogBorderStyle")}),o.jsx("select",{id:u,className:d.select,value:t.border.style,disabled:r,onChange:y=>{const S=y.target.value;a({...t,border:{style:S,width:S==="none"?null:t.border.width??FS,color:S==="none"?null:t.border.color}})},children:To.map(y=>o.jsx("option",{value:y,children:l(IS[y])},y))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(we,{label:l("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:y=>{a({...t,border:{...t.border,width:y}})}}),o.jsx(Je,{label:l("paragraphDialogBorderColor"),noneLabel:l("colorNone"),value:t.border.color,disabled:r,onChange:y=>{a({...t,border:{...t.border,color:y}})}})]}):null,o.jsx(we,{label:l("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:y=>{a({...t,borderRadius:y})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:BS})}}),l("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(kl,{shadow:t.boxShadow,disabled:r,onChange:y=>{a({...t,boxShadow:y})}}):null]})]}):null,e==="advanced"?o.jsxs(o.Fragment,{children:[o.jsx(dm,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:y=>{a(pb({...t,opacity:y.opacity,objectFit:y.fit,objectPosition:y.position},n))}}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesRotation")}),o.jsx("div",{className:d.field,children:o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:m,className:d.lengthInput,value:t.rotateDeg===null?"":Z(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":l("imagePropertiesRotation"),onChange:y=>{const S=y.target.value.trim();if(!S){a({...t,rotateDeg:null});return}const C=Number(S.replace(",","."));Number.isFinite(C)&&a({...t,rotateDeg:C})}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:l("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesTabHover")}),o.jsx("p",{className:d.emptyHint,children:l("imagePropertiesHoverHelp")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imagePropertiesHoverCss")}),o.jsx("textarea",{id:p,className:d.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":l("imagePropertiesHoverCssAria"),onChange:y=>{a({...t,hoverCss:y.target.value})}})]})]}):null]})]})}const Fc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function OS({open:e,tab:t,value:n,aspectRatio:r=1,disabled:i,onTabChange:a,onApply:l,onClose:u}){const m=U(),p=s.useId(),g=s.useRef(null),[h,w]=s.useState(n);return s.useEffect(()=>{e&&w(n)},[e,n]),s.useEffect(()=>{if(!e)return;const b=g.current,x=b==null?void 0:b.querySelector(Fc);x==null||x.focus();const y=S=>{if(S.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;S.preventDefault(),S.stopPropagation(),u();return}if(S.key!=="Tab"||!b)return;const C=[...b.querySelectorAll(Fc)];if(C.length===0)return;const A=C[0],v=C[C.length-1];S.shiftKey&&document.activeElement===A?(S.preventDefault(),v.focus()):!S.shiftKey&&document.activeElement===v&&(S.preventDefault(),A.focus())};return document.addEventListener("keydown",y,!0),()=>document.removeEventListener("keydown",y,!0)},[e,u]),e?o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:u,children:o.jsxs("div",{ref:g,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":p,onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:p,children:m("imagePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":m("imagePropertiesDialogCloseAria"),onClick:u,children:o.jsx(Me,{})})]}),o.jsx(zS,{tab:t,value:h,aspectRatio:r,disabled:i,onTabChange:a,onChange:w}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:u,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l(h),children:m("fontDialogOk")})]})]})})}):null}const KS="_frame_bwkh8_1",$S="_handle_bwkh8_9",US="_handleEast_bwkh8_29",WS="_handleSouth_bwkh8_37",GS="_handleSouthEast_bwkh8_45",Yn={frame:KS,handle:$S,handleEast:US,handleSouth:WS,handleSouthEast:GS};function Un(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const VS=[{handle:"e",className:Yn.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:Yn.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:Yn.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function ra(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function qS({img:e,onResize:t,onResizeEnd:n}){const r=U(),i=s.useRef(null),a=s.useRef(e),l=s.useRef(t),u=s.useRef(n),m=s.useRef(null);a.current=e,l.current=t,u.current=n;const p=C=>{const A=i.current;A&&(A.style.left=`${C.left}px`,A.style.top=`${C.top}px`,A.style.width=`${C.width}px`,A.style.height=`${C.height}px`)};s.useLayoutEffect(()=>{p(Un(e));const C=()=>{e.isConnected&&p(Un(e))};return window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[e]);const g=(C,A)=>{const v=m.current,j=a.current;if(!v||!j)return;const D=px(v.handle,v.start,{x:C-v.originX,y:A-v.originY});l.current(D.width,D.height),j.isConnected&&p(Un(j))},h=()=>{if(!m.current)return;m.current=null;const C=a.current;u.current(),C!=null&&C.isConnected&&p(Un(C))};s.useLayoutEffect(()=>{const C=v=>{if(!m.current)return;const j=ra(v);j&&g(j.x,j.y)},A=()=>{h()};return document.addEventListener("pointermove",C),document.addEventListener("pointerup",A),document.addEventListener("pointercancel",A),document.addEventListener("mousemove",C),document.addEventListener("mouseup",A),()=>{document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",A),document.removeEventListener("pointercancel",A),document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",A)}},[]);const w=(C,A)=>{const v=ra(A);v&&(m.current={handle:C,start:gx(a.current),originX:v.x,originY:v.y})},b=C=>A=>{A.preventDefault(),A.stopPropagation(),w(C,A);try{A.currentTarget.setPointerCapture(A.pointerId)}catch{}},x=C=>A=>{A.preventDefault(),A.stopPropagation(),w(C,A)},y=C=>{const A=ra(C);A&&g(A.x,A.y)};if(!e.isConnected)return null;const S=Un(e);return Zc.createPortal(o.jsx("div",{ref:i,className:Yn.frame,"data-image-resize-overlay":"",style:{left:S.left,top:S.top,width:S.width,height:S.height},children:VS.map(C=>o.jsx("button",{type:"button",className:`${Yn.handle} ${C.className}`,style:{cursor:C.cursor},"aria-label":r(C.ariaKey),"data-resize-handle":C.handle,onPointerDown:b(C.handle),onPointerMove:y,onPointerUp:h,onPointerCancel:h,onMouseDown:x(C.handle),onMouseMove:y,onMouseUp:h},C.handle))}),document.body)}const Bc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function YS({open:e,tab:t,href:n,title:r,targetBlank:i,textDecorationNone:a,hoverMode:l,hoverColor:u,hoverHtml:m,bookmarks:p,selectedBookmarkId:g,disabled:h,onTabChange:w,onApply:b,onClose:x}){const y=U(),S=s.useId(),C=s.useId(),A=s.useId(),v=s.useId(),j=s.useId(),D=s.useRef(null),[T,M]=s.useState(n),[F,R]=s.useState(r),[E,P]=s.useState(i),[L,$]=s.useState(a),[K,X]=s.useState(l),[J,me]=s.useState(u),[Y,fe]=s.useState(m),[ne,ie]=s.useState(g);if(s.useEffect(()=>{e&&(M(n),R(r),P(i),$(a),X(l),me(u),fe(m),ie(g))},[e,n,r,i,a,l,u,m,g]),s.useEffect(()=>{if(!e)return;const G=D.current,ge=G==null?void 0:G.querySelector(Bc);ge==null||ge.focus();const Ee=Ce=>{if(Ce.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;Ce.preventDefault(),Ce.stopPropagation(),x();return}if(Ce.key!=="Tab"||!G)return;const Ht=[...G.querySelectorAll(Bc)];if(Ht.length===0)return;const ar=Ht[0],kn=Ht[Ht.length-1];Ce.shiftKey&&document.activeElement===ar?(Ce.preventDefault(),kn.focus()):!Ce.shiftKey&&document.activeElement===kn&&(Ce.preventDefault(),ar.focus())};return document.addEventListener("keydown",Ee,!0),()=>document.removeEventListener("keydown",Ee,!0)},[e,x,t,K]),!e)return null;const N=()=>Lo({title:F,targetBlank:E,textDecorationNone:L,hoverMode:K,hoverColor:J,hoverHtml:Y}),V=()=>{const G=T.trim();!G||h||b({...N(),href:G})},re=()=>{!ne||h||b({...N(),href:`#${ne}`})};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:x,children:o.jsxs("div",{ref:D,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":S,onMouseDown:G=>G.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:S,children:y("linkDialogTitle")}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":y("linkDialogTitle"),children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="link",onClick:()=>w("link"),children:y("linkDialogTabLink")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>w("bookmark"),children:y("linkDialogTabBookmark")})]}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[t==="link"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:C,children:y("linkDialogHref")}),o.jsx("input",{id:C,className:d.textInput,value:T,disabled:h,onChange:G=>M(G.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:A,children:y("linkDialogHoverTitle")}),o.jsx("input",{id:A,className:d.textInput,value:F,disabled:h,onChange:G=>R(G.target.value)})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:E,disabled:h,onChange:G=>P(G.target.checked)}),y("linkDialogTargetBlank")]})]}):p.length===0?o.jsx("p",{className:d.emptyHint,children:y("linkDialogBookmarkEmpty")}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:v,children:y("linkDialogBookmark")}),o.jsxs("select",{id:v,className:`${d.select} ${d.fullSelect}`,value:ne,disabled:h,onChange:G=>ie(G.target.value),children:[o.jsx("option",{value:""}),p.map(G=>o.jsx("option",{value:G.id,children:G.id},G.id))]})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:L,disabled:h,onChange:G=>$(G.target.checked)}),y("linkDialogTextDecorationNone")]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:y("linkDialogHover")}),o.jsxs("div",{className:d.sizeRow,role:"group","aria-label":y("linkDialogHover"),children:[o.jsx("button",{type:"button",className:d.action,"aria-pressed":K==="color",disabled:h,onClick:()=>X("color"),children:y("linkDialogHoverColor")}),o.jsx("button",{type:"button",className:d.action,"aria-pressed":K==="html",disabled:h,onClick:()=>X("html"),children:y("linkDialogHoverHtml")})]}),K==="color"?o.jsx(Je,{label:y("linkDialogHoverColorField"),noneLabel:y("colorNone"),value:J,disabled:h,onChange:me}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:j,children:y("linkDialogHoverHtmlAria")}),o.jsx("textarea",{id:j,className:d.textarea,value:Y,disabled:h,spellCheck:!1,onChange:G=>fe(G.target.value)})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:h||!ne,onClick:re,children:y("linkDialogSelect")}),o.jsx("button",{type:"button",className:d.action,onClick:x,children:y("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:h||!T.trim(),onClick:V,children:y("fontDialogOk")})]})]})})})}const Hc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',zc={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function XS({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=U(),u=s.useId(),m=s.useId(),p=s.useId(),g=s.useId(),h=s.useRef(null),[w,b]=s.useState("url"),[x,y]=s.useState(""),[S,C]=s.useState("");if(s.useEffect(()=>{e&&(b("url"),y(""),C(""))},[e]),s.useEffect(()=>{if(!e)return;const M=h.current,F=M==null?void 0:M.querySelector(Hc);F==null||F.focus();const R=E=>{if(E.key==="Escape"){E.preventDefault(),E.stopPropagation(),a();return}if(E.key!=="Tab"||!M)return;const P=[...M.querySelectorAll(Hc)];if(P.length===0)return;const L=P[0],$=P[P.length-1];E.shiftKey&&document.activeElement===L?(E.preventDefault(),$.focus()):!E.shiftKey&&document.activeElement===$&&(E.preventDefault(),L.focus())};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[e,a]),!e)return null;const A=w==="custom"?null:$d(x),v=w==="custom"?null:A&&x.trim().length>0?zc[A]:A==="empty"&&x.trim().length===0?null:A?zc[A]:null,j=w!=="custom"&&A===null&&!t&&x.trim().length>0,D=()=>{t||!n||i==null||i()},T=()=>{j&&r({url:x.trim(),title:S.trim()})};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:M=>M.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("youtubeDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("youtubeDialogCloseAria"),onClick:a,children:o.jsx(Me,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":w==="url",disabled:t,onClick:()=>b("url"),children:l("youtubeDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":w==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),w==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("youtubeDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:x,disabled:t,"aria-invalid":v!==null,"aria-describedby":v?g:void 0,onChange:M=>y(M.target.value)})]}):null,w==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:D,children:n.buttonCaption})]}):null]}),w!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("youtubeDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:S,disabled:t,onChange:M=>C(M.target.value)})]}):null,v?o.jsx("p",{id:g,className:d.error,children:l(v)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),w!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!j,onClick:T,children:l("fontDialogOk")}):null]})]})})})}const JS="_grid_1bpma_1",ZS="_cell_1bpma_8",QS="_sizeLabel_1bpma_27",ev="_sizeFields_1bpma_33",tv="_numberInput_1bpma_37",on={grid:JS,cell:ZS,sizeLabel:QS,sizeFields:ev,numberInput:tv},Oc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',Et={rows:3,cols:3};function nv({open:e,disabled:t,onApply:n,onClose:r}){const i=U(),a=s.useId(),l=s.useId(),u=s.useId(),m=s.useRef(null),[p,g]=s.useState(Et.rows),[h,w]=s.useState(Et.cols),[b,x]=s.useState(String(Et.rows)),[y,S]=s.useState(String(Et.cols)),[C,A]=s.useState(!1);if(s.useEffect(()=>{e&&(g(Et.rows),w(Et.cols),x(String(Et.rows)),S(String(Et.cols)),A(!1))},[e]),s.useEffect(()=>{if(!e)return;const R=m.current,E=R==null?void 0:R.querySelector(Oc);E==null||E.focus();const P=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),r();return}if(L.key!=="Tab"||!R)return;const $=[...R.querySelectorAll(Oc)];if($.length===0)return;const K=$[0],X=$[$.length-1];L.shiftKey&&document.activeElement===K?(L.preventDefault(),X.focus()):!L.shiftKey&&document.activeElement===X&&(L.preventDefault(),K.focus())};return document.addEventListener("keydown",P,!0),()=>document.removeEventListener("keydown",P,!0)},[e,r]),!e)return null;const j=Yd(p,h)&&!t,D=(R,E)=>{const P=Math.min(dn,Math.max(un,R)),L=Math.min(dn,Math.max(un,E));g(P),w(L),x(String(P)),S(String(L))},T=(R,E)=>{const P=Number.parseInt(R,10);if(!Number.isFinite(P)){E==="rows"?x(String(p)):S(String(h));return}A(!0),E==="rows"?D(P,h):D(p,P)},M=(R,E)=>{const P=R.replace(/\D/g,"");if(E==="rows"?x(P):S(P),P==="")return;const L=Number.parseInt(P,10);Number.isFinite(L)&&(A(!0),E==="rows"?D(L,h):D(p,L))},F=R=>{(R.key==="e"||R.key==="E"||R.key==="+"||R.key==="-"||R.key===".")&&R.preventDefault()};return o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:r,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:R=>R.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:a,children:i("tableDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":i("tableDialogCloseAria"),onClick:r,children:o.jsx(Me,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx("div",{className:on.grid,role:"grid","aria-label":i("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:bc},(R,E)=>Array.from({length:bc},(P,L)=>{const $=E+1,K=L+1,X=$<=p&&K<=h;return o.jsx("button",{type:"button",className:on.cell,role:"gridcell","data-active":X?"true":void 0,"aria-label":`${$} × ${K}`,"aria-pressed":X&&$===p&&K===h,disabled:t,onMouseEnter:()=>{C||D($,K)},onClick:()=>{A(!0),D($,K)}},`${$}-${K}`)}))}),o.jsxs("p",{className:on.sizeLabel,children:[i("tableDialogSize"),": ",p," × ",h]}),o.jsxs("div",{className:`${d.sizeRow} ${on.sizeFields}`,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("tableDialogRows")}),o.jsx("input",{id:l,className:on.numberInput,type:"number",inputMode:"numeric",min:un,max:dn,step:1,value:b,disabled:t,onKeyDown:F,onChange:R=>M(R.target.value,"rows"),onBlur:()=>T(b,"rows")})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:i("tableDialogColumns")}),o.jsx("input",{id:u,className:on.numberInput,type:"number",inputMode:"numeric",min:un,max:dn,step:1,value:y,disabled:t,onKeyDown:F,onChange:R=>M(R.target.value,"cols"),onBlur:()=>T(y,"cols")})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:r,children:i("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!j,onClick:()=>{j&&n({rows:p,cols:h})},children:i("tableDialogInsert")})]})]})})})}const rv={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},ov={value:1,unit:"pt"},iv={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function av({value:e,disabled:t,onChange:n}){const r=U(),i=s.useId(),a=s.useId();return o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("tablePropertiesWidth")}),o.jsx(we,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:l=>n({...e,width:l})}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("tablePropertiesCollapse")}),o.jsxs("select",{id:i,className:d.select,value:e.borderCollapse,disabled:t,onChange:l=>{const u=l.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:u,borderSpacing:u==="separate"?e.borderSpacing:null})},children:[o.jsx("option",{value:"collapse",children:r("tablePropertiesCollapseCollapse")}),o.jsx("option",{value:"separate",children:r("tablePropertiesCollapseSeparate")})]})]}),e.borderCollapse==="separate"?o.jsx(we,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:l=>n({...e,borderSpacing:l})}):null]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),o.jsx("select",{id:a,className:d.select,value:e.border.style,disabled:t,onChange:l=>{const u=l.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??ov,color:u==="none"?null:e.border.color}})},children:To.map(l=>o.jsx("option",{value:l,children:r(rv[l])},l))})]}),e.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(we,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:l=>n({...e,border:{...e.border,width:l}})}),o.jsx(Je,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:l=>n({...e,border:{...e.border,color:l}})})]}):null,o.jsx(we,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:l=>n({...e,borderRadius:l})}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:iv})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?o.jsx(kl,{shadow:e.boxShadow,disabled:t,onChange:l=>n({...e,boxShadow:l})}):null]})]})}const Kc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function lv({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=U(),l=s.useId(),u=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(Kc);h==null||h.focus();const w=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),i();return}if(b.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(Kc)];if(x.length===0)return;const y=x[0],S=x[x.length-1];b.shiftKey&&document.activeElement===y?(b.preventDefault(),S.focus()):!b.shiftKey&&document.activeElement===S&&(b.preventDefault(),y.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("tablePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:i,children:o.jsx(Me,{})})]}),o.jsx(av,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const sv={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},cv={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function eo(e){return{top:e,right:e,bottom:e,left:e}}function oa(e){for(const t of Te)if(e[t])return e[t];return null}function uv({value:e,disabled:t,onChange:n}){const r=U(),i=s.useId(),a=s.useId(),l=s.useId(),[u,m]=s.useState(()=>vt(e.padding,eo(oa(e.padding))));return s.useEffect(()=>{m(vt(e.padding,eo(oa(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(Je,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:p=>n({...e,backgroundColor:p})}),o.jsx(Je,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:p=>n({...e,color:p})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:u,disabled:t,onChange:()=>{const p=!u;m(p),p&&n({...e,padding:eo(oa(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(u?["top"]:Te).map(p=>o.jsx(we,{label:r(u?"paragraphDialogPadding":sv[p]),value:e.padding[p],disabled:t,onChange:g=>{const h=u?eo(g):{...e.padding,[p]:g};n({...e,padding:h})}},p))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:p=>{const g=p.target.value;n({...e,verticalAlign:g||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Fo.map(p=>o.jsx("option",{value:p,children:r(cv[p])},p))]})]}),o.jsx(we,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:p=>n({...e,width:p})}),o.jsxs("div",{className:d.sizeRow,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("cellPropertiesColSpan")}),o.jsx("input",{id:a,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:p=>{const g=Number.parseInt(p.target.value,10);n({...e,colSpan:Number.isFinite(g)?Math.max(1,g):1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:r("cellPropertiesRowSpan")}),o.jsx("input",{id:l,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:p=>{const g=Number.parseInt(p.target.value,10);n({...e,rowSpan:Number.isFinite(g)?Math.max(1,g):1})}})]})]})]})}const $c='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function dv({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=U(),l=s.useId(),u=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector($c);h==null||h.focus();const w=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),i();return}if(b.key!=="Tab"||!g)return;const x=[...g.querySelectorAll($c)];if(x.length===0)return;const y=x[0],S=x[x.length-1];b.shiftKey&&document.activeElement===y?(b.preventDefault(),S.focus()):!b.shiftKey&&document.activeElement===S&&(b.preventDefault(),y.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("cellPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:i,children:o.jsx(Me,{})})]}),o.jsx(uv,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const mv={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},fv={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function to(e){return{top:e,right:e,bottom:e,left:e}}function ia(e){for(const t of Te)if(e[t])return e[t];return null}function pv({value:e,disabled:t,onChange:n}){const r=U(),i=s.useId(),[a,l]=s.useState(()=>vt(e.padding,to(ia(e.padding))));return s.useEffect(()=>{l(vt(e.padding,to(ia(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(Je,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),o.jsx(Je,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const u=!a;l(u),u&&n({...e,padding:to(ia(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Te).map(u=>o.jsx(we,{label:r(a?"paragraphDialogPadding":mv[u]),value:e.padding[u],disabled:t,onChange:m=>{const p=a?to(m):{...e.padding,[u]:m};n({...e,padding:p})}},u))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:u=>{const m=u.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Fo.map(u=>o.jsx("option",{value:u,children:r(fv[u])},u))]})]}),o.jsx(we,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}const Uc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function gv({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=U(),l=s.useId(),u=s.useRef(null),[m,p]=s.useState(t);return s.useEffect(()=>{e&&p(t)},[e,t]),s.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(Uc);h==null||h.focus();const w=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),i();return}if(b.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(Uc)];if(x.length===0)return;const y=x[0],S=x[x.length-1];b.shiftKey&&document.activeElement===y?(b.preventDefault(),S.focus()):!b.shiftKey&&document.activeElement===S&&(b.preventDefault(),y.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,i]),e?o.jsx(ae,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("rowPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:i,children:o.jsx(Me,{})})]}),o.jsx(pv,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const hv="_backdrop_9d3gw_1",bv="_dialog_9d3gw_12",yv="_headerRow_9d3gw_29",xv="_header_9d3gw_29",wv="_close_9d3gw_44",Cv="_body_9d3gw_66",Sv="_frame_9d3gw_75",vv="_actions_9d3gw_83",kv="_action_9d3gw_83",yt={backdrop:hv,dialog:bv,headerRow:yv,header:xv,close:wv,body:Cv,frame:Sv,actions:vv,action:kv},Wc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Av({open:e,html:t,onClose:n}){const r=U(),i=s.useId(),a=s.useRef(null),l=s.useRef(null);return s.useEffect(()=>{if(!e)return;const u=a.current,m=u==null?void 0:u.querySelector(Wc);m==null||m.focus();const p=g=>{if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),n();return}if(g.key!=="Tab"||!u)return;const h=[...u.querySelectorAll(Wc)];if(h.length===0)return;const w=h[0],b=h[h.length-1];g.shiftKey&&document.activeElement===w?(g.preventDefault(),b.focus()):!g.shiftKey&&document.activeElement===b&&(g.preventDefault(),w.focus())};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[e,n]),s.useEffect(()=>{var m;if(!e)return;const u=(m=l.current)==null?void 0:m.contentDocument;u&&fa(u,t,r("previewDialogTitle"))},[e,t,r]),e?o.jsx(ae,{children:o.jsx("div",{className:yt.backdrop,role:"presentation",onMouseDown:n,children:o.jsxs("div",{ref:a,className:yt.dialog,role:"dialog","aria-modal":"true","aria-labelledby":i,onMouseDown:u=>u.stopPropagation(),children:[o.jsxs("div",{className:yt.headerRow,children:[o.jsx("h2",{className:yt.header,id:i,children:r("previewDialogTitle")}),o.jsx("button",{type:"button",className:yt.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:o.jsx(Me,{})})]}),o.jsx("div",{className:yt.body,children:o.jsx("iframe",{ref:l,className:yt.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var m;const u=(m=l.current)==null?void 0:m.contentDocument;u&&fa(u,t,r("previewDialogTitle"))}})}),o.jsx("div",{className:yt.actions,children:o.jsx("button",{type:"button",className:yt.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const fm="commspliant-html-editor.darkMode";function Dv(e){return typeof e=="boolean"?e:null}function Gc(){try{const e=localStorage.getItem(fm);return e?Dv(JSON.parse(e)):null}catch{return null}}function Pv(e){try{localStorage.setItem(fm,JSON.stringify(e))}catch{}}const pm="commspliant-html-editor.toolbarPosition",jv=["top","left","right","bottom"];function gm(e){return typeof e=="string"&&jv.includes(e)?e:null}function Vc(){try{const e=localStorage.getItem(pm);return e?gm(JSON.parse(e)):null}catch{return null}}function Ev(e){try{localStorage.setItem(pm,JSON.stringify(e))}catch{}}function Rv({enabled:e,onHtml:t}){const[n,r]=s.useState(!1),i=s.useRef(0),a=s.useRef(e),l=s.useRef(t);a.current=e,l.current=t;const u=s.useCallback(()=>{i.current=0,r(!1)},[]);s.useEffect(()=>{e||u()},[e,u]);const m=s.useCallback(w=>{!a.current||!Ur(w.dataTransfer)||(w.preventDefault(),i.current+=1,r(!0))},[]),p=s.useCallback(w=>{!a.current||!Ur(w.dataTransfer)||(w.preventDefault(),w.dataTransfer&&(w.dataTransfer.dropEffect="copy"))},[]),g=s.useCallback(w=>{if(!a.current||!Ur(w.dataTransfer))return;const b=w.relatedTarget;b instanceof Node&&w.currentTarget.contains(b)||(i.current=Math.max(0,i.current-1),i.current===0&&r(!1))},[]),h=s.useCallback(w=>{if(!a.current||!Ur(w.dataTransfer))return;w.preventDefault(),u();const b=np(w.dataTransfer);b&&Ua(b).then(x=>{a.current&&l.current(x)},()=>{})},[u]);return{dragging:n,onDragEnter:m,onDragOver:p,onDragLeave:g,onDrop:h}}const Tv={menus:{edit:{id:"edit",labelKey:"menuEdit",ariaKey:"menuEditAria"}},submenus:{page:{id:"page",labelKey:"menuPage",ariaKey:"menuPageAria"}},groups:{edit:{id:"edit",labelKey:"toolbarGroupEdit"}},items:{undo:{id:"undo",command:"undo",icon:Sf,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:bf,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:iu,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"}}},Nv=400,qc=100;function Mv(e){let t=[],n=e,r=[],i=!1,a=!1,l=0;function u(){t.length<=qc||t.splice(0,t.length-qc)}function m(b){t.push(b),u()}function p(b,x){if(i){n=b,i=!1;return}if(b===n)return;const y=Date.now(),S=(x==null?void 0:x.coalesce)===!0;if(S&&a&&y-l<Nv){n=b,l=y;return}m(n),n=b,r=[],l=y,a=S}function g(){return t.length===0?null:(a=!1,r.push(n),n=t.pop(),n)}function h(){return r.length===0?null:(a=!1,m(n),n=r.pop(),n)}function w(b){if(i){n=b,i=!1;return}b!==n&&(m(n),n=b,r=[],a=!1)}return{record:p,undo:g,redo:h,canUndo:()=>t.length>0,canRedo:()=>r.length>0,syncExternal:w,markApplying:()=>{i=!0}}}function _t(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function Ao(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):_t(e,t):""}const st="fullscreen",Na="commspliant-html-editor.toolbarCustomization";function Ma(e){const t=e.filter(n=>n!==st);return e.includes(st)?[...t,st]:t}function Dl(e,t){if(!t||t.length===0)return Ma(e);const n=new Set(e),r=t.filter(l=>n.has(l)),i=new Set(r),a=[...r];for(let l=0;l<e.length;l++){const u=e[l];if(i.has(u))continue;let m=0;for(let p=l-1;p>=0;p--){const g=e[p],h=a.indexOf(g);if(h>=0){m=h+1;break}}a.splice(m,0,u),i.add(u)}return Ma(a)}function Lv(e,t){const n=new Map(e.map(l=>[l.id,l])),r=Dl(e.map(l=>l.id),t==null?void 0:t.groupOrder),i=new Set((t==null?void 0:t.hiddenItemIds)??[]),a=[];for(const l of r){const u=n.get(l);if(!u)continue;const m=u.items.filter(p=>!i.has(p));m.length!==0&&a.push({id:l,items:m})}return a}function _v(e){if(e==null||typeof e!="object")return null;const t=e,n=Array.isArray(t.groupOrder)?t.groupOrder.filter(i=>typeof i=="string"):[],r=Array.isArray(t.hiddenItemIds)?[...new Set(t.hiddenItemIds.filter(i=>typeof i=="string"))]:[];return n.length===0&&r.length===0?null:{groupOrder:n,hiddenItemIds:r}}function Iv(){try{const e=localStorage.getItem(Na);return e?_v(JSON.parse(e)):null}catch{return null}}function Fv(e){try{if(!e){localStorage.removeItem(Na);return}localStorage.setItem(Na,JSON.stringify(e))}catch{}}function Pl(e,t){return Dl(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function Bv(e,t,n,r){const i=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?i.delete(n):i.add(n),{groupOrder:Pl(e,t),hiddenItemIds:[...i]}}function hm(e,t,n,r){const i=Pl(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===st||r===st)return{groupOrder:i,hiddenItemIds:a};const l=i.indexOf(n),u=i.indexOf(r);if(l<0||u<0||l===u)return{groupOrder:i,hiddenItemIds:a};const m=[...i],[p]=m.splice(l,1);return m.splice(u,0,p),{groupOrder:Ma(m),hiddenItemIds:a}}function Yc(e,t,n,r){const i=Pl(e,t),a=i.filter(m=>m!==st),l=a.indexOf(n),u=l+r;return l<0||u<0||u>=a.length?{groupOrder:i,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:hm(e,t,n,a[u])}const Hv="_backdrop_1dasl_1",zv="_dialog_1dasl_12",Ov="_header_1dasl_28",Kv="_body_1dasl_35",$v="_group_1dasl_43",Uv="_groupDragging_1dasl_49",Wv="_groupDropTarget_1dasl_53",Gv="_groupHeader_1dasl_58",Vv="_groupTitle_1dasl_66",qv="_dragHandle_1dasl_71",Yv="_moveButton_1dasl_72",Xv="_items_1dasl_113",Jv="_item_1dasl_113",Zv="_itemIcon_1dasl_129",Qv="_itemTitle_1dasl_138",e0="_itemCheckbox_1dasl_145",t0="_actions_1dasl_149",n0="_action_1dasl_149",r0="_spinnerWrap_1dasl_184",o0="_spinner_1dasl_184",de={backdrop:Hv,dialog:zv,header:Ov,body:Kv,group:$v,groupDragging:Uv,groupDropTarget:Wv,groupHeader:Gv,groupTitle:Vv,dragHandle:qv,moveButton:Yv,items:Xv,item:Jv,itemIcon:Zv,itemTitle:Qv,itemCheckbox:e0,actions:t0,action:n0,spinnerWrap:r0,spinner:o0},Xc='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function i0(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"currentColor",children:[o.jsx("circle",{cx:"5",cy:"4",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"4",r:"1.2"}),o.jsx("circle",{cx:"5",cy:"8",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"8",r:"1.2"}),o.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"12",r:"1.2"})]})}function a0({open:e,catalog:t,groups:n,settings:r,loading:i=!1,busy:a=!1,disabled:l,onChange:u,onReset:m,onClose:p}){const g=U(),h=s.useId(),w=s.useRef(null),[b,x]=s.useState(null),[y,S]=s.useState(null),C=Dl(n.map(P=>P.id),r==null?void 0:r.groupOrder),A=new Set((r==null?void 0:r.hiddenItemIds)??[]),v=new Map(n.map(P=>[P.id,P])),j=C.map(P=>v.get(P)).filter(P=>!!P),D=l||a||i;if(s.useEffect(()=>{e||(x(null),S(null))},[e]),s.useEffect(()=>{if(!e)return;const P=w.current,L=P==null?void 0:P.querySelector(Xc);L==null||L.focus();const $=K=>{if(K.key==="Escape"){K.preventDefault(),K.stopPropagation(),p();return}if(K.key!=="Tab"||!P)return;const X=[...P.querySelectorAll(Xc)];if(X.length===0)return;const J=X[0],me=X[X.length-1];K.shiftKey&&document.activeElement===J?(K.preventDefault(),me.focus()):!K.shiftKey&&document.activeElement===me&&(K.preventDefault(),J.focus())};return document.addEventListener("keydown",$,!0),()=>document.removeEventListener("keydown",$,!0)},[e,p]),!e)return null;const T=j.map(P=>P.id).filter(P=>P!==st),M=(P,L)=>{if(D||L===st){P.preventDefault();return}P.dataTransfer.setData("text/plain",L),P.dataTransfer.effectAllowed="move",x(L)},F=(P,L)=>{D||L===st||!b||b===L||(P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),S(L))},R=(P,L)=>{var K;P.preventDefault();const $=((K=P.dataTransfer)==null?void 0:K.getData("text/plain"))||b;x(null),S(null),!(!$||$===L||D)&&u(hm(r,n,$,L))},E=()=>{x(null),S(null)};return o.jsx(ae,{children:o.jsx("div",{className:de.backdrop,role:"presentation",onMouseDown:p,children:o.jsxs("div",{ref:w,className:de.dialog,role:"dialog","aria-modal":"true","aria-labelledby":h,"aria-busy":i||a?!0:void 0,onMouseDown:P=>P.stopPropagation(),children:[o.jsx("h2",{className:de.header,id:h,children:g("customizeToolbarDialogTitle")}),o.jsx("div",{className:de.body,children:i?o.jsx("div",{className:de.spinnerWrap,role:"status","aria-live":"polite","aria-label":g("customizeToolbarDialogLoading"),children:o.jsx("span",{className:de.spinner,"aria-hidden":"true"})}):j.map(P=>{const L=t.groups[P.id],$=L?_t(g,L):P.id,K=P.id===st,X=T.indexOf(P.id);return o.jsxs("section",{className:[de.group,b===P.id?de.groupDragging:"",y===P.id?de.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":P.id,"aria-label":$,onDragOver:J=>F(J,P.id),onDrop:J=>R(J,P.id),onDragLeave:()=>{y===P.id&&S(null)},children:[o.jsxs("div",{className:de.groupHeader,children:[o.jsx("button",{type:"button",className:de.dragHandle,draggable:!D&&!K,disabled:D||K,"aria-label":g("customizeToolbarDragHandle"),onDragStart:J=>M(J,P.id),onDragEnd:E,children:o.jsx(i0,{})}),o.jsx("span",{className:de.groupTitle,children:$}),o.jsx("button",{type:"button",className:de.moveButton,disabled:D||K||X<=0,"aria-label":g("customizeToolbarMoveUp"),onClick:()=>u(Yc(r,n,P.id,-1)),children:"↑"}),o.jsx("button",{type:"button",className:de.moveButton,disabled:D||K||X<0||X>=T.length-1,"aria-label":g("customizeToolbarMoveDown"),onClick:()=>u(Yc(r,n,P.id,1)),children:"↓"})]}),o.jsx("div",{className:de.items,children:P.items.map(J=>{const me=t.items[J];if(!me)return null;const Y=me.icon,fe=_t(g,me),ne=`${h}-${P.id}-${J}`,ie=!A.has(J);return o.jsxs("label",{className:de.item,htmlFor:ne,children:[o.jsx("span",{className:de.itemIcon,"aria-hidden":"true",children:Y?o.jsx(Y,{}):fe.slice(0,2)}),o.jsx("span",{className:de.itemTitle,children:fe}),o.jsx("input",{id:ne,className:de.itemCheckbox,type:"checkbox",checked:ie,disabled:D,"aria-label":`${fe}: ${g("customizeToolbarItemVisible")}`,onChange:N=>u(Bv(r,n,J,N.target.checked))})]},J)})})]},P.id)})}),o.jsxs("div",{className:de.actions,children:[o.jsx("button",{type:"button",className:de.action,disabled:D,onClick:m,children:g("customizeToolbarDialogReset")}),o.jsx("button",{type:"button",className:de.action,"aria-label":g("customizeToolbarDialogCloseAria"),onClick:p,children:g("customizeToolbarDialogClose")})]})]})})})}function l0(e,t){if(!t)return e;const n=t.menus,r=t.toolbar;if(n===void 0&&r===void 0)return e;const i=n===void 0?e.menus:e.menus.filter(l=>n.includes(l.id)),a=r===void 0?e.iconGroups:e.iconGroups.map(l=>({id:l.id,items:l.items.filter(u=>r.includes(u))})).filter(l=>l.items.length>0);return{menus:i,iconGroups:a}}const s0={menus:{file:{id:"file",labelKey:"menuFile",ariaKey:"menuFileAria"}},groups:{file:{id:"file",labelKey:"toolbarGroupFile"},print:{id:"print",labelKey:"toolbarGroupPrint"}},items:{save:{id:"save",command:"save",icon:xf,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:cf,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:gf,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},no=4;function bm({icon:e,value:t,mixed:n,noneKey:r,labelKey:i,ariaKey:a,fallbackCustom:l,disabled:u,onChange:m}){const p=U(),g=s.useId(),h=s.useRef(null),w=s.useRef(null),b=s.useRef(null),[x,y]=s.useState(!1),[S,C]=s.useState({top:0,left:0}),A=s.useCallback(()=>{const M=w.current,F=b.current;if(!M)return;const R=M.getBoundingClientRect(),E=(F==null?void 0:F.offsetHeight)??0,P=(F==null?void 0:F.offsetWidth)??200;let L=R.bottom;L+E>window.innerHeight-no&&(L=Math.max(no,R.top-E));const $=Math.min(Math.max(R.left,no),window.innerWidth-P-no);C({top:L,left:$})},[]);s.useLayoutEffect(()=>{if(!x)return;A();const M=()=>A();return window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[x,A]),s.useEffect(()=>{if(!x)return;const M=R=>{var P,L;const E=R.target;(P=h.current)!=null&&P.contains(E)||(L=b.current)!=null&&L.contains(E)||y(!1)},F=R=>{var E;R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),y(!1),(E=w.current)==null||E.focus())};return document.addEventListener("pointerdown",M),document.addEventListener("keydown",F,!0),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("keydown",F,!0)}},[x]);const v=M=>{m(M)},j=`${Ut.bar}${!t||n?` ${Ut.barEmpty}`:""}`,D=t&&!n?{backgroundColor:t}:void 0,T=o.jsxs("div",{className:Ut.wrap,ref:h,children:[o.jsxs("button",{ref:w,type:"button",className:`${q.iconButton} ${Ut.button}`,"aria-label":p(a),"aria-expanded":x,"aria-haspopup":"listbox","aria-controls":x?g:void 0,disabled:u,onMouseDown:M=>M.preventDefault(),onClick:()=>y(M=>!M),children:[o.jsx(e,{className:`${q.icon} ${Ut.icon}`}),o.jsx("span",{className:j,style:D})]}),x?o.jsx(ae,{children:o.jsx("div",{ref:b,id:g,className:Ut.popover,style:{top:S.top,left:S.left},children:o.jsx(Sl,{value:t,mixed:n,noneLabel:p(r),ariaLabel:p(a),disabled:u,fallbackCustom:l,onChange:v,onCommit:()=>y(!1)})})}):null]});return o.jsx(Lt,{label:p(i),children:T})}function c0({commands:e,queries:t,disabled:n}){return o.jsx(bm,{icon:tu,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function u0({commands:e,queries:t,disabled:n}){const r=U(),i=!!(n||!t.isVisualMode());return o.jsx(sm,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:i,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,l)=>{e.setFontSize(a,l)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function d0({commands:e,queries:t,disabled:n}){return o.jsx(bm,{icon:nu,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function m0({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=U(),a=!!(n||!t.isVisualMode());return o.jsx(Sl,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:i("colorNone"),ariaLabel:i("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:l=>e.setHighlightColor(l),onCommit:()=>r==null?void 0:r()})}const f0="_wrap_2cawp_1",p0="_wrapToolbar_2cawp_7",g0="_field_2cawp_12",h0="_trigger_2cawp_20",b0="_chevron_2cawp_46",y0="_list_2cawp_69",x0="_option_2cawp_84",w0="_separator_2cawp_113",wt={wrap:f0,wrapToolbar:p0,field:g0,trigger:h0,chevron:b0,list:y0,option:x0,separator:w0},La={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},C0={p:{fontSize:"1rem",fontWeight:"400"},h1:{fontSize:"1.75rem",fontWeight:"600"},h2:{fontSize:"1.5rem",fontWeight:"600"},h3:{fontSize:"1.25rem",fontWeight:"600"},h4:{fontSize:"1.125rem",fontWeight:"600"},h5:{fontSize:"1rem",fontWeight:"600"},h6:{fontSize:"0.875rem",fontWeight:"600"}};function Jc(){const e=U();return o.jsx("div",{className:d.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:o.jsx("span",{className:d.spinner,"aria-hidden":"true"})})}function ym({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:i,listRef:a,style:l,customStylesEnabled:u=!1,customStyles:m=[],customStylesLoading:p=!1,onSelect:g,onSelectCustom:h,onAddNew:w}){const b=U(),x=t?null:e,y=u,S=!!(r&&u&&w);return r?o.jsxs(o.Fragment,{children:[wo.map(C=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitemradio","aria-checked":x===C,disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>g(C),children:b(La[C])},C)),y?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,y&&p?o.jsx(Jc,{}):null,y&&!p?m.map(C=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitem",disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>h==null?void 0:h(C.id),children:C.name},C.id)):null,S?o.jsxs(o.Fragment,{children:[y&&(p||m.length>0)?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,o.jsxs("button",{type:"button",className:q.menuItem,role:"menuitem","aria-label":b("styleAddNewAria"),disabled:n,onMouseDown:C=>C.preventDefault(),onClick:()=>w==null?void 0:w(),children:[o.jsx(pf,{className:q.icon}),b("styleAddNew")]})]}):null]}):o.jsxs("ul",{ref:a,className:wt.list,role:"listbox",id:i,style:l,"aria-label":b("commandParagraphStyleAria"),"aria-busy":y&&p?!0:void 0,children:[wo.map(C=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:wt.option,role:"option","aria-selected":x===C,disabled:n,style:C0[C],onMouseDown:A=>A.preventDefault(),onClick:()=>g(C),children:b(La[C])})},C)),y&&(p||m.length>0)?o.jsx("li",{role:"separator",className:wt.separator}):null,y&&p?o.jsx("li",{role:"presentation",children:o.jsx(Jc,{})}):null,y&&!p?m.map(C=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:wt.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>h==null?void 0:h(C.id),children:C.name})},C.id)):null]})}const ro=4;function S0({commands:e,queries:t,disabled:n}){const r=U(),i=s.useId(),a=s.useRef(null),l=s.useRef(null),u=s.useRef(null),[m,p]=s.useState(!1),[g,h]=s.useState({top:0,left:0,width:0}),w=!!(n||!t.isVisualMode()),b=t.isParagraphStyleMixed(),x=b?null:t.getParagraphStyle(),y=x?r(La[x]):"",S=t.customParagraphStylesEnabled(),C=S?t.getCustomParagraphStyles():[],A=S&&t.isCustomParagraphStylesLoading(),v=s.useCallback(()=>{const D=l.current,T=u.current;if(!D)return;const M=D.getBoundingClientRect(),F=(T==null?void 0:T.offsetHeight)??0,R=Math.max(M.width,(T==null?void 0:T.offsetWidth)??0);let E=M.bottom;E+F>window.innerHeight-ro&&(E=Math.max(ro,M.top-F));const P=Math.min(Math.max(M.left,ro),window.innerWidth-R-ro);h({top:E,left:P,width:R})},[]);s.useLayoutEffect(()=>{if(!m)return;v();const D=()=>v();return window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[m,v,C.length,A]),s.useEffect(()=>{if(!m)return;const D=M=>{var R,E;const F=M.target;(R=a.current)!=null&&R.contains(F)||(E=u.current)!=null&&E.contains(F)||p(!1)},T=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopPropagation(),p(!1))};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",T,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",T,!0)}},[m]);const j=o.jsxs("div",{className:`${wt.wrap} ${wt.wrapToolbar}`,ref:a,children:[o.jsxs("div",{className:wt.field,ref:l,children:[o.jsx("button",{type:"button",className:wt.trigger,disabled:w,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?i:void 0,onMouseDown:D=>D.preventDefault(),onClick:()=>p(D=>!D),children:y}),o.jsx("span",{className:wt.chevron,"aria-hidden":"true"})]}),m?o.jsx(ae,{children:o.jsx(ym,{listRef:u,listId:i,value:x,mixed:b,disabled:w,customStylesEnabled:S,customStyles:C,customStylesLoading:A,style:{top:g.top,left:g.left,minWidth:g.width},onSelect:D=>{e.setParagraphStyle(D),p(!1)},onSelectCustom:D=>{e.applyCustomParagraphStyle(D),p(!1)}})}):null]});return o.jsx(Lt,{label:r("commandParagraphStyle"),children:j})}function v0({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),l=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),m=u?t.getCustomParagraphStyles():[],p=u&&t.isCustomParagraphStylesLoading();return o.jsx(ym,{menu:!0,value:l,mixed:a,disabled:i,customStylesEnabled:u,customStyles:m,customStylesLoading:p,onSelect:g=>{e.setParagraphStyle(g),r==null||r()},onSelectCustom:g=>{e.openCustomParagraphStyleDialog(g),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const k0={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:v0,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:m0,enabled:"isVisualMode"},paragraph:{id:"paragraph",labelKey:"menuParagraph",ariaKey:"menuParagraphAria"}},groups:{font:{id:"font",labelKey:"toolbarGroupFont"},align:{id:"align",labelKey:"toolbarGroupAlign"},paragraph:{id:"paragraph",labelKey:"toolbarGroupParagraph"}},items:{fontFamily:{id:"fontFamily",widget:L1,icon:Ym,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:S0,icon:ff,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:u0,icon:Jm,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:Xm,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:Gm,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:df,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:ru,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:c0,icon:tu,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:d0,icon:nu,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:zm,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:rf,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Cf,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:wf,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:$m,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:Zm,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:Ia,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:_a,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:Fa,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Qc,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:nf,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:uf,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:eu,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:ou,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},A0={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:af,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:Om,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:ru,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},audio:{id:"audio",command:"openAudioDialog",icon:Hm,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:Af,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:ef,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},insertPage:{id:"insertPage",command:"insertPage",icon:iu,labelKey:"commandInsertPage",ariaKey:"commandInsertPageAria",enabled:"canInsertPage"}}},D0={menus:{table:{id:"table",labelKey:"menuTable",ariaKey:"menuTableAria"}},submenus:{insertRow:{id:"insertRow",labelKey:"menuInsertRow",ariaKey:"menuInsertRowAria",enabled:"isInTable"},insertColumn:{id:"insertColumn",labelKey:"menuInsertColumn",ariaKey:"menuInsertColumnAria",enabled:"isInTable"}},groups:{table:{id:"table",labelKey:"toolbarGroupTable"}},items:{table:{id:"table",command:"openTableDialog",icon:Ws,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:$i,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:$i,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:$i,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Ki,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Ki,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Ki,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:sf,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:vf,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:Ws,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:Km,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:yf,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},P0={menus:{view:{id:"view",labelKey:"menuView",ariaKey:"menuViewAria"}},submenus:{toolbar:{id:"toolbar",labelKey:"menuToolbar",ariaKey:"menuToolbarAria"},toolbarPosition:{id:"toolbarPosition",labelKey:"menuToolbarPosition",ariaKey:"menuToolbarPositionAria"}},groups:{view:{id:"view",labelKey:"toolbarGroupView"},fullscreen:{id:"fullscreen",labelKey:"toolbarGroupFullscreen"}},items:{visual:{id:"visual",command:"setVisualMode",icon:kf,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:tf,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:Vm,labelKey:"commandCustomizeToolbar",ariaKey:"commandCustomizeToolbarAria"},toolbarPositionTop:{id:"toolbarPositionTop",command:"setToolbarPositionTop",labelKey:"toolbarPositionTop",ariaKey:"toolbarPositionTopAria",active:"isToolbarPositionTop"},toolbarPositionLeft:{id:"toolbarPositionLeft",command:"setToolbarPositionLeft",labelKey:"toolbarPositionLeft",ariaKey:"toolbarPositionLeftAria",active:"isToolbarPositionLeft"},toolbarPositionRight:{id:"toolbarPositionRight",command:"setToolbarPositionRight",labelKey:"toolbarPositionRight",ariaKey:"toolbarPositionRightAria",active:"isToolbarPositionRight"},toolbarPositionBottom:{id:"toolbarPositionBottom",command:"setToolbarPositionBottom",labelKey:"toolbarPositionBottom",ariaKey:"toolbarPositionBottomAria",active:"isToolbarPositionBottom"},lightMode:{id:"lightMode",command:"setLightMode",icon:of,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:qm,labelKey:"modeDark",ariaKey:"modeDarkAria",active:"isDarkMode"},preview:{id:"preview",command:"openDocumentPreview",icon:mf,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:hf,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:Qm,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function j0(...e){return{menus:Object.assign({},...e.map(t=>t.menus)),submenus:Object.assign({},...e.map(t=>t.submenus??{})),groups:Object.assign({},...e.map(t=>t.groups)),items:Object.assign({},...e.map(t=>t.items))}}const E0=j0(s0,Tv,A0,D0,P0,k0),R0={menus:[{id:"file",items:["save","open",pe,"print"]},{id:"edit",items:["undo","redo",pe,{submenu:"page",items:["pageProperties"]}]},{id:"insert",items:["link","bookmark",pe,"image","audio","youtube","table","horizontalRule","insertPage"]},{id:"table",items:["table",pe,{submenu:"insertRow",items:["insertRowBelow","insertRowBefore","deleteRow"]},{submenu:"insertColumn",items:["insertColumnAfter","insertColumnBefore","deleteColumn"]},pe,"mergeCells","unmergeCells",pe,"tableProperties","cellProperties","rowProperties"]},{id:"view",items:["visual","html",pe,{submenu:"toolbar",items:["customizeToolbar",pe,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},pe,"lightMode","darkMode",pe,"preview","readAloud","fullscreen"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},pe,{submenu:"font",items:["fontProperties","customCss",pe,{submenu:"highlightColor",items:[]},pe,"bold","italic","underline","strikethrough"]},pe,"clearFormatting",pe,{submenu:"paragraph",items:["paragraphProperties",pe,"alignLeft","alignCenter","alignRight","alignJustify",pe,"indent","outdent",pe,"bulletList","numberedList"]},pe,"imageProperties"]}],iconGroups:[{id:"file",items:["save","open"]},{id:"print",items:["print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark","image","table","horizontalRule"]},{id:"table",items:["mergeCells","unmergeCells"]},{id:"font",items:["fontFamily","paragraphStyle","fontSize","fontColor","highlightColor","customCss","formatBrush","bold","italic","underline","strikethrough","clearFormatting"]},{id:"align",items:["alignLeft","alignCenter","alignRight","alignJustify"]},{id:"paragraph",items:["indent","outdent","bulletList","numberedList"]},{id:"view",items:["visual","html","preview","readAloud"]},{id:"fullscreen",items:["fullscreen"]}]},oo="fullscreen";function T0(e){const t=[];let n=null;for(const r of e){const i=r.items.filter(a=>a!==oo);i.length>0&&t.push({id:r.id,items:i}),r.items.includes(oo)&&(n={id:oo,items:[oo]})}return{main:t,trailing:n}}function N0({groups:e,catalog:t,commands:n,queries:r,disabled:i}){const a=U(),{main:l,trailing:u}=T0(e),m=p=>{const g=t.groups[p.id];return o.jsx("div",{className:q.iconGroup,role:"group","aria-label":g?_t(a,g):void 0,"data-toolbar-group":p.id,children:p.items.map(h=>{const w=t.items[h];if(!w)return null;const b=w.enabled?!r[w.enabled]():!1;if(w.widget){const C=w.widget;return o.jsx(C,{commands:n,queries:r,disabled:i||b},h)}if(!w.icon||!w.command)return null;const x=w.icon,y=w.command,S=w.active?r[w.active]():void 0;return o.jsx(Lt,{label:w.tooltip??_t(a,w),children:o.jsx("button",{type:"button",className:q.iconButton,"aria-label":Ao(a,w),"aria-pressed":S,disabled:i||b,onPointerDown:C=>C.preventDefault(),onMouseDown:C=>C.preventDefault(),onClick:()=>{Ha(n,y)},children:o.jsx(x,{className:q.icon})})},h)})},p.id)};return o.jsxs("div",{className:q.iconNav,role:"toolbar","aria-label":a("toolbarAria"),children:[l.length>0?o.jsx("div",{className:q.iconNavMain,children:l.map(m)}):null,u?o.jsx("div",{className:q.iconNavEnd,children:m(u)}):null]})}const M0=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function L0(e){const t={};for(const n of M0){const r=getComputedStyle(e).getPropertyValue(n).trim();if(r){t[n]=r;continue}let i=e;for(;i;){const a=i.style.getPropertyValue(n).trim();if(a){t[n]=a;break}i=i.parentElement}}return t}function _0({menus:e,catalog:t,commands:n,queries:r,disabled:i,compact:a,openMenuId:l,onOpenMenuIdChange:u}){const m=U(),[p,g]=s.useState(!1),[h,w]=s.useState({}),b=s.useRef(null),x=s.useRef(null),y=s.useRef(null),S=s.useRef(null),C=s.useCallback(()=>{g(!1),u(null)},[u]);s.useLayoutEffect(()=>{!p||!b.current||w(L0(b.current))},[p]),s.useEffect(()=>{var v;p&&((v=y.current)==null||v.focus())},[p]),s.useEffect(()=>{if(!p)return;const v=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=v}},[p]),s.useEffect(()=>{if(!p)return;const v=D=>{var T;if(D.key==="Escape"){if(D.preventDefault(),D.stopPropagation(),l){u(null);return}C(),(T=x.current)==null||T.focus()}},j=D=>{var T;S.current&&!S.current.contains(D.target)&&(C(),(T=x.current)==null||T.focus())};return document.addEventListener("keydown",v,!0),document.addEventListener("pointerdown",j),()=>{document.removeEventListener("keydown",v,!0),document.removeEventListener("pointerdown",j)}},[p,l,u,C]);const A=v=>e.map(j=>{const D=t.menus[j.id];return D?o.jsx(F0,{def:D,itemIds:j.items,catalog:t,commands:n,queries:r,disabled:i,variant:v,open:(v==="overlay"||!p)&&l===j.id,onOpenChange:T=>u(T?j.id:null),onItemRun:v==="overlay"?()=>{var T;C(),(T=x.current)==null||T.focus()}:void 0},`${v}-${j.id}`):null});return o.jsxs("div",{className:q.menuBar,ref:b,children:[o.jsx(Lt,{label:m("brandMarkAria"),children:o.jsx("span",{className:q.brandMark,role:"img","aria-label":m("brandMarkAria"),children:o.jsx(Um,{className:q.brandMarkIcon})})}),o.jsx("div",{className:q.menuBarCompact,hidden:a===void 0?void 0:!a,children:o.jsx(Lt,{label:m("menuHamburgerAria"),children:o.jsx("button",{ref:x,type:"button",className:`${q.menuButton} ${q.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":p,"aria-label":m("menuHamburgerAria"),disabled:i,onClick:()=>{if(p){C();return}u(null),g(!0)},children:o.jsx(lf,{className:q.icon})})})}),o.jsx("div",{className:q.menuBarDesktop,hidden:a===void 0?void 0:a,children:A("dropdown")}),p?o.jsx(ae,{children:o.jsx("div",{className:q.toolbar,"data-menu-overlay-portal":"",style:h,children:o.jsxs("div",{ref:S,className:q.menuOverlay,role:"dialog","aria-modal":"true","aria-label":m("menuOverlayAria"),children:[o.jsxs("div",{className:q.menuOverlayHeader,children:[o.jsx("span",{className:q.menuOverlayTitle,children:m("menuOverlayAria")}),o.jsx("button",{ref:y,type:"button",className:q.iconButton,"aria-label":m("menuCloseAria"),onClick:()=>{var v;C(),(v=x.current)==null||v.focus()},children:o.jsx(Me,{className:q.icon})})]}),o.jsx("div",{className:q.menuOverlayBody,children:A("overlay")})]})})}):null]})}function Do(e,t){var n,r;if(Tt(e))return!1;if(er(e)){const i=(n=t.submenus)==null?void 0:n[e.submenu];return i?i.panel?!0:e.items.some(a=>Do(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function I0(e,t,n){if(!Tt(e[t])||!e.slice(t+1).some(a=>Do(a,n)))return!1;let i=!1;for(let a=t-1;a>=0;a--){const l=e[a];if(Tt(l)){i=!0;continue}if(Do(l,n))return!i}return!1}function F0({def:e,itemIds:t,catalog:n,commands:r,queries:i,disabled:a,variant:l,open:u,onOpenChange:m,onItemRun:p}){const g=U(),h=s.useRef(null),w=l==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[b,x]=s.useState(null);s.useEffect(()=>{u||x(null)},[u]),s.useEffect(()=>{if(!u||l==="overlay")return;const S=A=>{h.current&&!h.current.contains(A.target)&&m(!1)},C=A=>{if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),b){x(null);return}m(!1)}};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",C,!0),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",C,!0)}},[u,b,m,l]);const y=()=>{m(!1),p==null||p()};return o.jsxs("div",{className:q.menuWrap,ref:h,children:[o.jsx("button",{type:"button",className:q.menuButton,"aria-haspopup":"menu","aria-expanded":u,"aria-controls":w,"aria-label":Ao(g,e),disabled:a,onClick:()=>m(!u),children:_t(g,e)}),u?o.jsx("div",{className:q.menu,role:"menu",id:w,children:o.jsx(xm,{entries:t,catalog:n,commands:r,queries:i,disabled:a,variant:l,onClose:y,openSubmenuId:b,onOpenSubmenuIdChange:x})}):null]})}function xm({entries:e,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,openSubmenuId:u,onOpenSubmenuIdChange:m}){return o.jsx(o.Fragment,{children:e.map((p,g)=>{if(Tt(p))return I0(e,g,t)?o.jsx("div",{role:"separator",className:q.menuSeparator},`separator-${g}`):null;if(er(p))return o.jsx(H0,{entry:p,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,open:u===p.submenu,onOpenChange:w=>m==null?void 0:m(w?p.submenu:null)},`submenu-${p.submenu}-${g}`);const h=t.items[p];return!h||!h.command?null:o.jsx(B0,{item:h,commands:n,queries:r,disabled:i,onClose:l},p)})})}function B0({item:e,commands:t,queries:n,disabled:r,onClose:i}){const a=U();if(!e.command)return null;const l=e.icon,u=e.command,m=e.active?n[e.active]():void 0,p=e.enabled?!n[e.enabled]():!1,g=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return o.jsxs("button",{type:"button",role:g,className:q.menuItem,"aria-checked":m,disabled:r||p,onClick:()=>{i(),Ha(t,u)},children:[l?o.jsx(l,{className:q.icon}):null,_t(a,e)]})}function H0({entry:e,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,open:u,onOpenChange:m}){var D;const p=U(),g=s.useRef(null),h=s.useRef(null),[w,b]=s.useState(null),x=(D=t.submenus)==null?void 0:D[e.submenu],y=a==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,S=x==null?void 0:x.panel,C=x!=null&&x.enabled?!r[x.enabled]():!1,A=a==="overlay";if(s.useEffect(()=>{u||b(null)},[u]),!x||!S&&!e.items.some(T=>Do(T,t)))return null;const v=T=>{(T.key==="ArrowRight"||T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),m(!0),requestAnimationFrame(()=>{var F;const M=(F=h.current)==null?void 0:F.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');M==null||M.focus()}))},j=T=>{var M;T.key==="ArrowLeft"&&(T.preventDefault(),T.stopPropagation(),m(!1),(M=g.current)==null||M.focus())};return o.jsxs("div",{className:q.submenuWrap,onMouseEnter:A?void 0:()=>m(!0),onMouseLeave:A?void 0:()=>m(!1),children:[o.jsx("button",{ref:g,type:"button",role:"menuitem",className:`${q.menuItem} ${q.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":u,"aria-controls":y,"aria-label":Ao(p,x),disabled:i||C,onClick:()=>m(A?!u:!0),onKeyDown:v,children:_t(p,x)}),u?o.jsx("div",{ref:h,className:`${q.menu} ${q.submenu}`,role:"menu",id:y,"aria-label":Ao(p,x),onKeyDown:j,children:S?o.jsx(S,{commands:n,queries:r,disabled:i||C,onMenuClose:l}):o.jsx(xm,{entries:e.items,catalog:t,commands:n,queries:r,disabled:i,variant:a,onClose:l,openSubmenuId:w,onOpenSubmenuIdChange:b})}):null]})}function aa({catalog:e,layout:t,commands:n,queries:r,disabled:i,menuVisible:a=!0,toolbarVisible:l=!0,compact:u,position:m="top"}){const[p,g]=s.useState(null);return!a&&!l?null:o.jsxs("div",{className:q.toolbar,"data-compact":u?"":void 0,"data-toolbar-position":m,children:[a?o.jsx(_0,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:i,compact:u,openMenuId:p,onOpenMenuIdChange:g}):null,l?o.jsx(N0,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:i}):null]})}const z0="_root_22r24_1",O0="_fullscreen_22r24_36",K0="_exitFullscreen_22r24_48",$0="_exitFullscreenIcon_22r24_79",U0="_menuChrome_22r24_94",W0="_body_22r24_105",G0="_iconChrome_22r24_135",V0="_workspace_22r24_179",q0="_htmlFileDropOverlay_22r24_191",Y0="_surface_22r24_205",X0="_visual_22r24_212",J0="_multiPageContainer_22r24_235",Z0="_pageBlock_22r24_242",Q0="_pageGap_22r24_248",ek="_pageSurface_22r24_254",tk="_html_22r24_191",he={root:z0,fullscreen:O0,exitFullscreen:K0,exitFullscreenIcon:$0,menuChrome:U0,body:W0,iconChrome:G0,workspace:V0,htmlFileDropOverlay:q0,surface:Y0,visual:X0,multiPageContainer:J0,pageBlock:Z0,pageGap:Q0,pageSurface:ek,html:tk},nk=s.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i},a){const l=U();return o.jsx("textarea",{ref:a,className:`${he.surface} ${he.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:i,"aria-label":l("htmlEditorAria"),spellCheck:!1})}),rk=s.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i,onBeforeInput:a,onPointerDown:l,onMouseUp:u,onContextMenu:m},p){const g=U(),h=s.useRef(null),w=s.useRef(a);w.current=a;const b=x=>{h.current=x,typeof p=="function"?p(x):p&&(p.current=x)};return s.useLayoutEffect(()=>{const x=h.current;x&&(x.innerHTML!==t&&(x.innerHTML=t),Po(x))},[t]),s.useLayoutEffect(()=>{const x=h.current;if(!x)return;const y=S=>{var C;(C=w.current)==null||C.call(w,S)};return x.addEventListener("beforeinput",y),()=>x.removeEventListener("beforeinput",y)},[]),o.jsx("div",{ref:b,className:`${he.surface} ${he.visual}`,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":g("visualEditorAria"),"aria-disabled":i||void 0,"data-placeholder":r,onPointerDown:l,onMouseUp:u,onContextMenu:m,onInput:x=>{n(x.currentTarget.innerHTML)}})}),ok=s.forwardRef(function({pages:t,activePageIndex:n,onActivePageIndexChange:r,onPageChange:i,placeholder:a,disabled:l,onBeforeInput:u,onPointerDown:m,onMouseUp:p,onContextMenu:g},h){const w=U(),b=s.useRef(null),x=s.useRef(n);x.current=n;const y=s.useRef(u);y.current=u;const S=s.useRef(t);S.current=t,s.useImperativeHandle(h,()=>({getContainer:()=>b.current,getActivePageRoot:()=>{const v=b.current;return v?ao(v,x.current):null},getActivePageIndex:()=>x.current,flushPageHtml:v=>{var D;const j=b.current;return j?((D=ao(j,v))==null?void 0:D.innerHTML)??null:null}}));const C=s.useCallback((v,j)=>{const D=Rt(j).body;v.innerHTML!==D&&(v.innerHTML=D),Po(v)},[]);s.useLayoutEffect(()=>{const v=b.current;if(v)for(let j=0;j<t.length;j+=1){const D=ao(v,j);D&&C(D,t[j]??"")}},[t,C]),s.useLayoutEffect(()=>{const v=b.current;if(!v)return;const j=D=>{var T;(T=y.current)==null||T.call(y,D)};return v.addEventListener("beforeinput",j),()=>v.removeEventListener("beforeinput",j)},[]);const A=v=>{v!==n&&r(v)};return o.jsx("div",{ref:b,className:he.multiPageContainer,children:t.map((v,j)=>o.jsxs("div",{className:he.pageBlock,children:[j>0?o.jsx("div",{className:he.pageGap,"aria-hidden":"true"}):null,o.jsx("div",{className:`${he.surface} ${he.visual} ${he.pageSurface}`,[sa]:"","data-page-index":j,contentEditable:!l,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":w("visualEditorAria"),"aria-disabled":l||void 0,"data-placeholder":j===0?a:void 0,onFocus:()=>A(j),onPointerDown:m,onMouseUp:p,onContextMenu:g,onInput:D=>{i(j,D.currentTarget.innerHTML)}})]},j))})});function ik({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:i,onOpen:a,mode:l,defaultMode:u="visual",onModeChange:m,fullscreen:p,defaultFullscreen:g=!1,onFullscreenChange:h,placeholder:w,disabled:b,readOnly:x=!1,className:y,locale:S="en",toolbarBackground:C,menuColor:A,menuBackground:v,menuFontSize:j,menuFontFamily:D,border:T,menuVisible:M=!0,toolbarVisible:F=!0,allowedChrome:R,customActions:E,customFonts:P,transformHtml:L,loadCustomParagraphStyles:$,onSaveCustomParagraphStyle:K,onDeleteCustomParagraphStyle:X,customImagePicker:J,disableBuiltinImageInsert:me,customAudioPicker:Y,disableBuiltinAudioInsert:fe,customVideoPicker:ne,disableBuiltinVideoInsert:ie,disableHtmlFileDrop:N=!1,toolbarCustomization:V,darkMode:re=!1,darkModePersistence:G,toolbarPosition:ge="top",toolbarPositionPersistence:Ee,enableMultiPages:Ce=!1,pages:Ht,defaultPages:ar,onPagesChange:kn}){const ee=!!(b||x),wm=Ys(ar??(t.trim()?[t]:[ca()])),Cm=Ce?lt(wm):t,Sm=Ce&&Ht!==void 0?lt(Ys(Ht)):e,[_e,jl]=Xi({value:Sm,defaultValue:Cm,onChange:Ce?void 0:n}),[$e,El]=Xi({value:l,defaultValue:u,onChange:m}),[ft,An]=Xi({value:p,defaultValue:g,onChange:h}),B=s.useRef(null),lr=s.useRef(null),Ie=s.useRef(null),Ue=s.useRef(Ce);Ue.current=Ce;const sr=s.useRef(kn);sr.current=kn;const[Bo,Rl]=s.useState(0),Dn=s.useRef(Bo);Dn.current=Bo;const Ho=s.useRef(null);Ho.current===null&&(Ho.current=Mv(_e));const We=Ho.current,ye=s.useRef(_e);ye.current=_e;const cr=s.useRef(!0),zo=s.useRef(""),Xt=s.useRef(null),z=s.useRef($e);z.current=$e;const Tl=s.useRef(ft);Tl.current=ft;const Se=s.useRef(null),[,vm]=s.useState(0),Pn=s.useRef(null);Pn.current===null&&(Pn.current=Ty(()=>{vm(c=>c+1)}));const ur=s.useRef(L);ur.current=L;const Ge=s.useRef({}),Fe=s.useRef(null),Ve=s.useRef(null),Ze=s.useRef(null),Qe=s.useRef(null),At=s.useRef(null),Be=s.useRef(null),[dr,Oo]=s.useState(Ct),Ko=s.useRef(dr);Ko.current=dr;const pt=s.useRef(Wt),[jn,mr]=s.useState({value:null,unit:Wt,mixed:!1}),Dt=s.useRef(jn);Dt.current=jn;const[En,$o]=s.useState({value:null,mixed:!1}),Rn=s.useRef(En);Rn.current=En;const[Tn,Uo]=s.useState({value:null,mixed:!1}),Nn=s.useRef(Tn);Nn.current=Tn;const[Mn,Wo]=s.useState({value:null,mixed:!1}),Ln=s.useRef(Mn);Ln.current=Mn;const[Go,Vo]=s.useState({tag:null,mixed:!1}),qo=s.useRef(Go);qo.current=Go;const[Nl,Yo]=s.useState({align:"left",mixed:!1}),Xo=s.useRef(Nl);Xo.current=Nl;const[Ml,Jo]=s.useState({type:null,mixed:!1}),_n=s.useRef(Ml);_n.current=Ml;const[Ll,Zo]=s.useState(!1),_l=s.useRef(Ll);_l.current=Ll;const[Qo,ei]=s.useState(!1),Il=s.useRef(Qo);Il.current=Qo;const[ti,Fl]=s.useState(!1),fr=s.useRef(ti);fr.current=ti;const pr=s.useRef(null),gr=s.useRef(null),[Bl,Hl]=s.useState(!1),zl=s.useRef(Bl);zl.current=Bl;const[In,hr]=s.useState({open:!1,tab:"general"}),[ni,Ol]=s.useState(!1),[Fn,Kl]=s.useState({open:!1,html:""}),[ri,br]=s.useState(null),[km,oi]=s.useState(!1),[Am,ii]=s.useState(!1),[Jt,yr]=s.useState(()=>G?re:Gc()??re),[et,xr]=s.useState(()=>Ee?ge:Vc()??ge),[zt,wr]=s.useState({open:!1,tab:"general",value:Gn()}),[Cr,ai]=s.useState({open:!1,value:""}),[Ot,Zt]=s.useState({open:!1,tab:"font",value:Da()}),[li,$l]=s.useState([]),[si,ci]=s.useState(!1),[Dm,Sr]=s.useState(!1),[ve,Bn]=s.useState({open:!1}),[He,vr]=s.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[ui,di]=s.useState({open:!1,existingIds:[]}),[Pm,kr]=s.useState({open:!1}),[jm,Ar]=s.useState({open:!1}),[Em,Hn]=s.useState({open:!1}),[Dr,Pr]=s.useState({open:!1,tab:"general",value:vd(),aspectRatio:1}),[mi,fi]=s.useState({open:!1}),[jr,pi]=s.useState({open:!1,value:zx()}),[Er,gi]=s.useState({open:!1,value:Xx()}),[Rr,hi]=s.useState({open:!1,value:iw()}),[Kt,bi]=s.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1}),[ke,Qt]=s.useState(null),Ul=s.useRef(ke);Ul.current=ke;const[yi,Wl]=s.useState(!1),Gl=s.useRef(yi);Gl.current=yi;const[xi,Vl]=s.useState(!1),ql=s.useRef(xi);ql.current=xi;const[wi,Yl]=s.useState(!1),Xl=s.useRef(wi);Xl.current=wi;const Jl=s.useRef(void 0),Tr=s.useRef(li);Tr.current=li;const Zl=s.useRef(si);Zl.current=si;const Ci=!!($&&K),Si=s.useRef(Ci);Si.current=Ci;const Ql=s.useRef($);Ql.current=$;const es=s.useRef(K);es.current=K;const ts=s.useRef(X);ts.current=X;const ns=s.useRef(i);ns.current=i;const rs=s.useRef(a);rs.current=a;const os=s.useRef(J);os.current=J;const is=s.useRef(Y);is.current=Y;const as=s.useRef(ne);as.current=ne;const ls=s.useRef(V);ls.current=V;const ss=s.useRef(G);ss.current=G;const cs=s.useRef(Ee);cs.current=Ee;const us=s.useRef(Jt);us.current=Jt;const ds=s.useRef(et);ds.current=et;const ms=s.useRef(me);ms.current=me;const fs=s.useRef(fe);fs.current=fe;const ps=s.useRef(ie);ps.current=ie;const vi=s.useRef(0),zn=s.useRef(0),gs=s.useRef(0),Nr=s.useRef(0),hs=s.useRef(0),Mr=s.useRef(0),bs=s.useRef(0),Pt=s.useMemo(()=>xu(P),[P]),en=s.useRef(Pt);en.current=Pt;const ki=s.useMemo(()=>bp(_e,Pt).join(`
|
|
95
|
-
`),[
|
|
96
|
-
`):[]).map(k=>{const H=document.createElement("link");return H.rel="stylesheet",H.href=k,H.setAttribute(jo,""),document.head.append(H),H});return()=>{for(const k of f)k.remove()}},[ki]);const Lr=s.useCallback(async()=>{const c=Ql.current;if(!c)return;const f=++vi.current;ci(!0);try{const k=await c();if(f!==vi.current)return;$l(k)}catch{}finally{f===vi.current&&ci(!1)}},[]);s.useEffect(()=>{if(!$||!K){$l([]),ci(!1);return}Lr()},[$,K,Lr]);const ys=s.useCallback(async c=>{br(c);const f=ls.current;if(f!=null&&f.load&&f.save){const k=++gs.current;ii(!0);try{await f.save(c)}catch{}finally{k===gs.current&&ii(!1)}return}Fv(c)},[]);s.useEffect(()=>{const c=V;if(!(c!=null&&c.load)||!c.save){br(Iv()),oi(!1),ii(!1);return}const f=++zn.current;return oi(!0),(async()=>{try{const k=await c.load();if(f!==zn.current)return;br(k)}catch{if(f!==zn.current)return;br(null)}finally{f===zn.current&&oi(!1)}})(),()=>{zn.current+=1}},[V]);const xs=s.useCallback(async c=>{yr(c);const f=ss.current;if(f!=null&&f.load&&f.save){const k=++hs.current;try{await f.save(c)}catch{}finally{if(k!==hs.current)return}return}Pv(c)},[]);s.useEffect(()=>{const c=G;if(!(c!=null&&c.load)||!c.save){yr(Gc()??re);return}const f=++Nr.current;return(async()=>{try{const k=await c.load();if(f!==Nr.current)return;yr(typeof k=="boolean"?k:re)}catch{if(f!==Nr.current)return;yr(re)}})(),()=>{Nr.current+=1}},[G,re]);const ws=s.useCallback(async c=>{xr(c);const f=cs.current;if(f!=null&&f.load&&f.save){const k=++bs.current;try{await f.save(c)}catch{}finally{if(k!==bs.current)return}return}Ev(c)},[]);s.useEffect(()=>{const c=Ee;if(!(c!=null&&c.load)||!c.save){xr(Vc()??ge);return}const f=++Mr.current;return(async()=>{try{const k=await c.load();if(f!==Mr.current)return;xr(gm(k)??ge)}catch{if(f!==Mr.current)return;xr(ge)}})(),()=>{Mr.current+=1}},[Ee,ge]);const tn=s.useCallback(c=>{var k,H;const f=((k=ur.current)==null?void 0:k.call(ur,c))??c;return f!==ye.current&&(cr.current=!0),jl(f),Ue.current&&((H=sr.current)==null||H.call(sr,xt(f),Dn.current)),f},[jl]),ue=s.useCallback((c,f)=>{const k=tn(c);return We.record(k,{coalesce:f}),k},[tn,We]),Tm=s.useCallback(c=>{if(Ue.current){const f=xt(ye.current),k=Dn.current,H=[...f];H[k]=c,ue(lt(H),!1);return}ue(c,!1)},[ue]),On=Rv({enabled:!ee&&!N,onHtml:Tm}),oe=s.useCallback((c,f)=>ue(Wr(c,Gr(c,ye.current,en.current)),f),[ue]),_r=s.useCallback((c,f)=>Wr(c,Gr(c,f,en.current)),[]),gt=s.useCallback(()=>{const c=lr.current;return(c==null?void 0:c.getContainer())?xt(ye.current).map((H,W)=>{const Q=c==null?void 0:c.flushPageHtml(W);return Q===null?H:_r(Q,H)}):xt(ye.current)},[_r]),Ai=s.useCallback((c,f,k)=>{const H=xt(ye.current),W=[...H];W[c]=_r(f,H[c]??""),ue(lt(W),k)},[ue,_r]),te=s.useCallback((c,f)=>{var H;if(!Ue.current){oe(c.innerHTML,f);return}const k=(H=lr.current)==null?void 0:H.getContainer();if(!k){oe(c.innerHTML,f);return}for(let W=0;W<xt(ye.current).length;W+=1)if(ao(k,W)===c){Ai(W,c.innerHTML,f);return}oe(c.innerHTML,f)},[Ai,oe]),Cs=s.useCallback(()=>{const c=Ue.current?gt():xt(ye.current);return c[Dn.current]??c[0]??""},[gt]),Ir=s.useCallback(()=>Ue.current?gt():[ye.current],[gt]),Ss=s.useCallback(()=>{if(!Ue.current||z.current!=="visual")return;const c=gt(),f=Dn.current+1,k=[...c];k.splice(f,0,ca()),ue(lt(k),!1),Rl(f)},[gt,ue]),Fr=s.useCallback(()=>{const c=We.undo();c!==null&&(We.markApplying(),tn(c))},[tn,We]),Br=s.useCallback(()=>{const c=We.redo();c!==null&&(We.markApplying(),tn(c))},[tn,We]);s.useEffect(()=>{We.syncExternal(_e)},[_e,We]);const _=s.useCallback(()=>{Se.current=at({mode:z.current,visualEl:B.current,htmlEl:Ie.current})},[]),it=s.useCallback(c=>{if(!c||z.current!=="visual"){Wl(!1),Vl(!1),Yl(!1);return}Wl(hl(c)!==null),Vl(xc(c)),Yl(wc(c))},[]),Di=s.useCallback(()=>{const c=at({mode:z.current,visualEl:B.current,htmlEl:Ie.current}),f=Se.current;Qs(f,c)||(Se.current=c)},[]),Pi=s.useCallback(()=>{const c=B.current;if(z.current!=="visual"||!c){mr({value:null,unit:pt.current,mixed:!1});return}const f=Zu(c,pt.current);Fe.current&&(f.value=Fe.current.value,f.unit=Fe.current.unit,f.mixed=!1),pt.current=f.unit,mr(k=>k.value===f.value&&k.unit===f.unit&&k.mixed===f.mixed?k:f)},[]),ji=s.useCallback(()=>{const c=B.current;if(z.current!=="visual"||!c){$o({value:null,mixed:!1});return}const f=Su(c);Ve.current&&(f.value=Ve.current.value,f.mixed=!1),$o(k=>k.value===f.value&&k.mixed===f.mixed?k:f)},[]),Ei=s.useCallback(()=>{const c=B.current;if(z.current!=="visual"||!c){Uo({value:null,mixed:!1}),Wo({value:null,mixed:!1});return}const f=go(c,"color");Ze.current&&(f.value=Ze.current.value,f.mixed=!1);const k=go(c,"backgroundColor");Qe.current&&(k.value=Qe.current.value,k.mixed=!1),Uo(H=>H.value===f.value&&H.mixed===f.mixed?H:f),Wo(H=>H.value===k.value&&H.mixed===k.mixed?H:k)},[]),Ri=s.useCallback(()=>{const c=B.current;if(z.current!=="visual"||!c){Vo({tag:null,mixed:!1});return}const f=Ph(c);Vo(k=>k.tag===f.tag&&k.mixed===f.mixed?k:f)},[]),Ti=s.useCallback(()=>{const c=B.current;if(z.current!=="visual"||!c){Yo({align:null,mixed:!1}),Jo({type:null,mixed:!1}),Zo(!1),Hl(!1);return}const f=yd(c);Yo(Q=>Q.align===f.align&&Q.mixed===f.mixed?Q:f);const k=dd(c);Jo(Q=>Q.type===k.type&&Q.mixed===k.mixed?Q:k);const H=Fh(c);Zo(Q=>Q===H?Q:H);const W=sy(c);Hl(Q=>Q===W?Q:W)},[]),I=s.useCallback(()=>{const c=B.current;if(z.current!=="visual"||!c){Oo(Ct()),ei(!1),Pi(),ji(),Ei(),Ri(),Ti();return}const f=Se.current,k=!!(f&&!f.collapsed);ei(W=>W===k?W:k);const H=rd(sn(c),Ge.current);Oo(W=>ih(W,H)?W:H),Pi(),ji(),Ei(),Ri(),Ti()},[Pi,ji,Ei,Ri,Ti]),vs=s.useCallback(()=>{const c=Se.current,f=Be.current;!f||!c||c.collapsed&&c.start===f.start&&c.end===f.end||(Ge.current={},Fe.current=null,Ve.current=null,Ze.current=null,Qe.current=null,At.current=null,Be.current=null)},[]);s.useEffect(()=>{cr.current=!0},[_e]),s.useEffect(()=>{if($e==="visual"){I();return}Ge.current={},Fe.current=null,Ve.current=null,Ze.current=null,Qe.current=null,At.current=null,Be.current=null,Oo(Ct()),mr({value:null,unit:pt.current,mixed:!1}),$o({value:null,mixed:!1}),Uo({value:null,mixed:!1}),Wo({value:null,mixed:!1}),Vo({tag:null,mixed:!1}),Yo({align:null,mixed:!1}),Jo({type:null,mixed:!1}),Zo(!1),ei(!1)},[$e,I]);const nn=s.useCallback((c,f,k)=>{Fp({snapshot:c,visualEl:B.current,htmlEl:Ie.current,getHtml:()=>z.current==="visual"&&B.current?B.current.innerHTML:ye.current,setHtml:H=>{if(z.current==="visual"){oe(Rt(H).body,!1);return}ue(H,!1)},content:f,asHtml:k})},[ue,oe]),ks=s.useCallback(c=>{if(z.current==="visual"&&c==="html"){if(Ue.current){const f=lt(gt());f!==ye.current&&ue(f,!0)}else if(B.current){const f=B.current.innerHTML,k=Wr(f,Gr(f,ye.current,en.current));k!==ye.current&&ue(k,!0)}}El(c)},[ue,El,gt]);s.useEffect(()=>{if(!ft)return;const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}},[ft]),s.useEffect(()=>{if(!ft)return;const c=f=>{f.key==="Escape"&&(f.defaultPrevented||In.open||Cr.open||zt.open||Ot.open||mi.open||jr.open||Er.open||Rr.open||ni||Fn.open||(f.preventDefault(),An(!1)))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[ft,An,In.open,Cr.open,zt.open,Ot.open,mi.open,jr.open,Er.open,Rr.open,ni,Fn.open]),s.useEffect(()=>{const c=()=>{if(z.current!=="visual"||!B.current)return;const f=window.getSelection();if(!f||f.rangeCount===0)return;const k=f.anchorNode;!k||!B.current.contains(k)&&B.current!==k||Xt.current===null&&(Xt.current=window.requestAnimationFrame(()=>{Xt.current=null;const H=B.current;!H||z.current!=="visual"||(_(),vs(),I(),Qt(qn(H)),it(H))}))};return document.addEventListener("selectionchange",c),()=>{document.removeEventListener("selectionchange",c),Xt.current!==null&&(window.cancelAnimationFrame(Xt.current),Xt.current=null)}},[_,vs,I,it]),s.useEffect(()=>{if($e!=="html")return;const c=Ie.current;if(!c)return;const f=()=>_();return c.addEventListener("select",f),c.addEventListener("keyup",f),c.addEventListener("mouseup",f),()=>{c.removeEventListener("select",f),c.removeEventListener("keyup",f),c.removeEventListener("mouseup",f)}},[$e,_]),s.useLayoutEffect(()=>{if($e!=="visual"||ee){Qt(null);return}const c=B.current;if(!c)return;const f=qn(c);Qt(k=>f||(k&&k.isConnected&&c.contains(k)?k:null))},[_e,$e,ee]);const O=s.useCallback(c=>{const f=at({mode:"visual",visualEl:c,htmlEl:Ie.current}),k=Se.current,H=Qs(k,f)?k:f.visualRange?f:k??f;Se.current=H,c.focus();const W=Ip(c,H);if(W){const Q=window.getSelection();try{Q==null||Q.removeAllRanges(),Q==null||Q.addRange(W),Se.current={...H,visualRange:W}}catch{}}return Se.current??H},[]),ht=s.useCallback(()=>{pr.current=null,gr.current=null,Fl(!1)},[]),As=s.useCallback(()=>{if(!fr.current||!pr.current||!gr.current||z.current!=="visual")return;const c=B.current;if(!c)return;_();const f=Se.current;!f||f.collapsed||Py(f,gr.current)||(O(c),Ey(c,pr.current),te(c,!1),_(),I(),ht())},[_,O,oe,I,ht]),Ds=s.useCallback(()=>{if(z.current!=="visual"){ht();return}if(fr.current){ht();return}const c=B.current;if(!c){ht();return}const f=O(c);if(f.collapsed){ht();return}pr.current=jy(c),gr.current={...f},Fl(!0),_()},[ht,O,_]),Ps=s.useCallback(()=>{As()},[As]);s.useEffect(()=>{($e!=="visual"||ee)&&ht()},[$e,ee,ht]);const Ni=s.useCallback((c,f)=>{if(z.current!=="visual")return;const k=B.current;if(!k)return;const H=f??pt.current,W=Gt(c,H);if(!W)return;pt.current=W.unit;const Q=O(k);if(Q.collapsed){Fe.current=W,Be.current={start:Q.start,end:Q.end},I();return}Fe.current=null,ha(k,W.value,W.unit)&&(te(k,!1),_(),I())},[O,oe,_,I]),js=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(!f)return;const k=O(f);if(k.collapsed){Ve.current={value:c},Be.current={start:k.start,end:k.end},I();return}Ve.current=null,da(f,c)&&(te(f,!1),_(),I())},[O,oe,_,I]),Mi=s.useCallback((c,f)=>{if(z.current!=="visual")return;const k=B.current;if(!k)return;const H=O(k),W=c==="color"?Ze:Qe;if(H.collapsed){W.current={value:f},Be.current={start:H.start,end:H.end},I();return}W.current=null,Wn(k,c,f)&&(te(k,!1),_(),I())},[O,oe,_,I]),Li=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(!f)return;const k=O(f);if(hr({open:!1,tab:"general"}),k.collapsed){if(c.size!==null){const ze=Gt(c.size,c.unit);ze&&(Fe.current=ze,pt.current=ze.unit)}const W=sn(f),Q={};for(const ze of Xe)c.marks[ze]!==W[ze]&&(Q[ze]=c.marks[ze]);Ge.current=Q,c.fontColorMixed||(Ze.current={value:c.fontColor}),c.highlightColorMixed||(Qe.current={value:c.highlightColor}),c.fontFamilyMixed||(Ve.current={value:c.fontFamily}),Be.current={start:k.start,end:k.end},I();return}if(Ge.current={},Fe.current=null,Ve.current=null,Ze.current=null,Qe.current=null,Be.current=null,c.size!==null){const W=Gt(c.size,c.unit);W&&(pt.current=W.unit,ha(f,W.value,W.unit))}const H=sn(f);for(const W of Xe)c.marks[W]!==H[W]&&xa(f,W);c.fontFamilyMixed||da(f,c.fontFamily),c.fontColorMixed||Wn(f,"color",c.fontColor),c.highlightColorMixed||Wn(f,"backgroundColor",c.highlightColor),te(f,!1),_(),I()},[O,oe,_,I]),Es=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),wr(k=>({...k,open:!1})),!wd(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Rs=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(!f)return;const k=O(f);if(ai(H=>({...H,open:!1})),!No(c)){_(),I();return}if(k.collapsed){At.current=c,Be.current={start:k.start,end:k.end},I();return}if(At.current=null,!nd(f,c)){_(),I();return}te(f,!1),_(),I()},[O,oe,_,I]),Ts=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),Zt(k=>({...k,open:!1})),!Qb(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Ns=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),vr(k=>({...k,open:!1})),!py(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Ms=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),di(k=>({...k,open:!1})),!yy(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Hr=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),kr({open:!1}),!eb(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),zr=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),Ar({open:!1}),!$y(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Ls=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),Hn({open:!1}),!Jy(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),_s=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),fi({open:!1}),!kx(f,c)){_(),I();return}te(f,!1),_(),I(),it(f)}},[O,oe,_,I,it]),Is=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),pi(k=>({...k,open:!1})),!Ux(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Fs=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),gi(k=>({...k,open:!1})),!ew(f,c)){_(),I();return}te(f,!1),_(),I(),it(f)}},[O,oe,_,I,it]),Bs=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),hi(k=>({...k,open:!1})),!cw(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),bt=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),!c(f)){_(),I();return}te(f,!1),_(),I(),it(f)}},[O,oe,_,I,it]),_i=s.useCallback(c=>{Hr({src:c.src,alt:c.alt??"",title:c.title??"",css:c.css})},[Hr]),Ii=s.useCallback(c=>{zr({src:c.src,title:c.title??"",css:c.css})},[zr]),Fi=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),Hn({open:!1}),!Zy(f,{src:c.src,title:c.title??"",css:c.css})){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Hs=s.useCallback(c=>{if(z.current!=="visual")return;const f=B.current;if(f){if(O(f),Pr(k=>({...k,open:!1})),!bb(f,c)){_(),I();return}te(f,!1),_(),I()}},[O,oe,_,I]),Nm=s.useCallback((c,f)=>{ke!=null&&ke.isConnected&&hx(ke,c,f)},[ke]),Mm=s.useCallback(()=>{const c=B.current;!c||!(ke!=null&&ke.isConnected)||(te(c,!1),qi(c,ke),_(),I())},[ke,oe,_,I]),jt=s.useCallback(()=>{if(Ue.current){if(z.current==="visual"){const c=gt(),f=lt(c);if(f!==ye.current)return ue(f,!0)}return ye.current}if(z.current==="visual"&&B.current){const c=B.current.innerHTML,f=Wr(c,Gr(c,ye.current,en.current));if(f!==ye.current)return ue(f,!0)}return ye.current},[ue]),Bi=s.useCallback(()=>{if(!cr.current&&zo.current)return zo.current;const c=JSON.stringify(Ir());return zo.current=c,cr.current=!1,c},[Ir]),Lm=s.useCallback(()=>Ue.current?Bi():jt(),[jt,Bi]);hw({onAutoSave:r?()=>{const c=Ue.current?JSON.parse(Bi()):jt();return r(c)}:void 0,getHtml:Lm}),s.useEffect(()=>()=>{var c;(c=Pn.current)==null||c.cancel()},[]);const le=s.useMemo(()=>({getHtml:jt,setHtml:c=>{ue(c,!1)},getMode:()=>z.current,setMode:ks,getFullscreen:()=>Tl.current,setFullscreen:An,getDarkMode:()=>us.current,setDarkMode:c=>{xs(c)},getToolbarPosition:()=>ds.current,setToolbarPosition:c=>{ws(c)},openCustomizeToolbar:()=>{Ol(!0)},openDocumentPreview:()=>{Kl({open:!0,html:jt()})},toggleReadAloud:()=>{const c=Pn.current;if(!c)return;const f=Se.current??at({mode:z.current,visualEl:B.current,htmlEl:Ie.current}),k=fc(Vr(f),jt());k&&c.toggle(k)},isReadingAloud:()=>{var c;return((c=Pn.current)==null?void 0:c.isSpeaking())??!1},canReadAloud:()=>{if(!so())return!1;const c=Se.current??at({mode:z.current,visualEl:B.current,htmlEl:Ie.current});return fc(Vr(c),jt())!==null},undo:Fr,redo:Br,canUndo:()=>We.canUndo(),canRedo:()=>We.canRedo(),getSelection:()=>{const c=Se.current??at({mode:z.current,visualEl:B.current,htmlEl:Ie.current});return Vr(c)},insertText:c=>{const f=Se.current??at({mode:z.current,visualEl:B.current,htmlEl:Ie.current});nn(f,c,!1)},insertHtml:(c,f)=>{const k=Se.current??at({mode:z.current,visualEl:B.current,htmlEl:Ie.current}),H=f===void 0;nn(k,H?c:f,H)},toggleFontMark:c=>{if(z.current!=="visual")return;const f=B.current;if(!f)return;const k=O(f);if(k.collapsed){const H=sn(f);Ge.current=lh(Ge.current,H,c),Be.current={start:k.start,end:k.end},I();return}Ge.current={},Be.current=null,xa(f,c)&&(te(f,!1),_(),I())},clearFormatting:()=>{if(z.current!=="visual")return;const c=B.current;!c||O(c).collapsed||(Ge.current={},Fe.current=null,Ve.current=null,Ze.current=null,Qe.current=null,At.current=null,Be.current=null,Dy(c)&&(te(c,!1),_(),I()))},toggleFormatBrush:Ds,isFormatBrushActive:()=>fr.current,isFontMarkActive:c=>Ko.current[c],hasTextSelection:()=>z.current==="visual"&&Il.current,setFontSize:(c,f)=>{Ni(c,f)},setFontSizeUnit:c=>{var ze;const f=B.current,k=Dt.current;if(z.current!=="visual"||!f||k.value===null||k.mixed){pt.current=c,mr(Oi=>({...Oi,unit:c}));return}const H=O(f),W=qg(f,((ze=H.visualRange)==null?void 0:ze.startContainer)??f),Q=ku(k.value,k.unit,c,W.parentPx,W.rootPx);Ni(Q,c)},getFontSize:()=>Dt.current.value,getFontSizeUnit:()=>Dt.current.unit,isFontSizeMixed:()=>Dt.current.mixed,setFontFamily:c=>{js(c)},getFontFamily:()=>Rn.current.value,isFontFamilyMixed:()=>Rn.current.mixed,getFontFaces:()=>en.current,setFontColor:c=>{Mi("color",c)},setHighlightColor:c=>{Mi("backgroundColor",c)},getFontColor:()=>Nn.current.value,isFontColorMixed:()=>Nn.current.mixed,getHighlightColor:()=>Ln.current.value,isHighlightColorMixed:()=>Ln.current.mixed,setParagraphStyle:c=>{if(z.current!=="visual")return;const f=B.current;f&&(O(f),jh(f,c)&&(te(f,!1),_(),I()))},getParagraphStyle:()=>qo.current.tag,isParagraphStyleMixed:()=>qo.current.mixed,setTextAlign:c=>{if(z.current!=="visual")return;const f=B.current;f&&(O(f),xd(f,c)&&(te(f,!1),_(),I()))},getTextAlign:()=>Xo.current.align,isTextAlignMixed:()=>Xo.current.mixed,indent:()=>{if(z.current!=="visual")return;const c=B.current;c&&(O(c),Bh(c)&&(te(c,!1),_(),I()))},outdent:()=>{if(z.current!=="visual")return;const c=B.current;c&&(O(c),Hh(c)&&(te(c,!1),_(),I()))},canOutdent:()=>z.current==="visual"&&_l.current,toggleList:c=>{if(z.current!=="visual")return;const f=B.current;f&&(O(f),Th(f,c)&&(te(f,!1),_(),I()))},isBulletList:()=>_n.current.type==="ul"&&!_n.current.mixed,isNumberedList:()=>_n.current.type==="ol"&&!_n.current.mixed,openFontProperties:c=>{z.current==="visual"&&hr({open:!0,tab:c??"general"})},applyFontProperties:c=>{Li(c)},openCustomCss:()=>{if(z.current!=="visual")return;const c=B.current;c&&O(c);const f=c?ed(c):{value:null,mixed:!1},k=f.mixed||!f.value?"":eh(f.value);ai({open:!0,value:k})},applyCustomCss:c=>{Rs(c)},openParagraphProperties:c=>{if(z.current!=="visual")return;const f=B.current;f&&O(f),wr({open:!0,tab:c??"general",value:f?ac(f):Gn()})},applyParagraphProperties:c=>{Es(c)},openPageProperties:c=>{if(z.current!=="visual")return;const f=B.current;f&&O(f),Zt({open:!0,tab:c??"font",value:f?Zb(f):Da()})},applyPageProperties:c=>{Ts(c)},openCustomParagraphStyleDialog:c=>{if(z.current!=="visual"||!Si.current)return;if(c){const k=Tr.current.find(H=>H.id===c);if(!k)return;Bn({open:!0,mode:"edit",style:k});return}const f=B.current;f&&O(f),Bn({open:!0,mode:"create",font:{size:Dt.current.mixed?null:Dt.current.value,unit:Dt.current.unit,marks:{...Ko.current},fontFamily:Rn.current.mixed?null:Rn.current.value,fontColor:Nn.current.mixed?null:Nn.current.value,highlightColor:Ln.current.mixed?null:Ln.current.value},paragraph:Cd(f?ac(f):Gn())})},applyCustomParagraphStyle:c=>{const f=Tr.current.find(H=>H.id===c);if(!f||(Li({size:f.font.size,unit:f.font.unit,marks:f.font.marks,fontFamily:f.font.fontFamily??null,fontFamilyMixed:!1,fontColor:f.font.fontColor,highlightColor:f.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!f.paragraph))return;const k=B.current;!k||z.current!=="visual"||(O(k),Kh(k,f.paragraph)&&(te(k,!1),_(),I()))},customParagraphStylesEnabled:()=>Si.current,getCustomParagraphStyles:()=>Tr.current,isCustomParagraphStylesLoading:()=>Zl.current,openLinkDialog:c=>{if(z.current!=="visual")return;const f=B.current;f&&O(f);const k=f?_d(f):Lo(),H=f?Pa(f):[],W=(k==null?void 0:k.href)??"",Q=W.startsWith("#")?W.slice(1):"",ze=H.some(Oi=>Oi.id===Q)?Q:"";vr({open:!0,tab:c??"link",href:W,title:(k==null?void 0:k.title)??"",targetBlank:(k==null?void 0:k.targetBlank)??!1,textDecorationNone:(k==null?void 0:k.textDecorationNone)??!1,hoverMode:(k==null?void 0:k.hoverMode)??"color",hoverColor:(k==null?void 0:k.hoverColor)??null,hoverHtml:(k==null?void 0:k.hoverHtml)??"",bookmarks:H,selectedBookmarkId:ze})},applyLink:c=>{Ns(c)},openBookmarkDialog:()=>{if(z.current!=="visual")return;const c=B.current;c&&O(c),di({open:!0,existingIds:c?Pa(c).map(f=>f.id):[]})},applyBookmark:c=>{Ms(c)},openImageDialog:()=>{if(z.current!=="visual")return;const c=B.current;c&&O(c);const f=os.current;if(ms.current&&f){f.onPick(_i);return}kr({open:!0})},applyImage:c=>{Hr(c)},openAudioDialog:()=>{if(z.current!=="visual")return;const c=B.current;c&&O(c);const f=is.current;if(fs.current&&f){f.onPick(Ii);return}Ar({open:!0})},applyAudio:c=>{zr(c)},openYoutubeDialog:()=>{if(z.current!=="visual")return;const c=B.current;c&&O(c);const f=as.current;if(ps.current&&f){f.onPick(Fi);return}Hn({open:!0})},applyYoutube:c=>{Ls(c)},openImageProperties:c=>{if(z.current!=="visual")return;const f=B.current;if(!f)return;O(f);const k=qn(f),H=hb(f);!k||!H||Pr({open:!0,tab:c??"general",value:H,aspectRatio:fb(k)})},applyImageProperties:c=>{Hs(c)},insertHorizontalRule:()=>{if(z.current!=="visual")return;const c=B.current;c&&(O(c),rx(c)&&(te(c,!1),_(),I()))},insertPage:()=>{Ss()},isMultiPagesEnabled:()=>Ue.current,getActivePageHtml:()=>Cs(),getAllPagesHtml:()=>Ir(),openTableDialog:()=>{if(z.current!=="visual")return;const c=B.current;c&&O(c),fi({open:!0})},applyTable:c=>{_s(c)},openTableProperties:()=>{if(z.current!=="visual")return;const c=B.current;if(!c)return;O(c);const f=$x(c);f&&pi({open:!0,value:f})},applyTableProperties:c=>{Is(c)},openCellProperties:()=>{if(z.current!=="visual")return;const c=B.current;if(!c)return;O(c);const f=Qx(c);f&&gi({open:!0,value:f})},applyCellProperties:c=>{Fs(c)},openRowProperties:()=>{if(z.current!=="visual")return;const c=B.current;if(!c)return;O(c);const f=sw(c);f&&hi({open:!0,value:f})},applyRowProperties:c=>{Bs(c)},insertRowBelow:()=>{bt(c=>ja(c,"below"))},insertRowBefore:()=>{bt(c=>ja(c,"before"))},deleteRow:()=>{bt(c=>Ax(c))},insertColumnAfter:()=>{bt(c=>yc(c,"after"))},insertColumnBefore:()=>{bt(c=>yc(c,"before"))},deleteColumn:()=>{bt(c=>Dx(c))},mergeCells:()=>{bt(c=>Ex(c))},unmergeCells:()=>{bt(c=>Rx(c))},cut:async()=>{if(z.current!=="visual")return;const c=B.current;c&&(O(c),await Cy(c)&&(te(c,!1),_(),I()))},copy:async()=>{if(z.current!=="visual")return;const c=B.current;c&&(O(c),await zd(c))},deleteSelection:()=>{if(z.current!=="visual")return;const c=B.current;c&&(O(c),Hd(c)&&(te(c,!1),_(),I()))},isLink:()=>zl.current,isImageSelected:()=>z.current==="visual"&&Ul.current!==null,isInTable:()=>z.current==="visual"&&Gl.current,canMergeCells:()=>z.current==="visual"&&ql.current,canUnmergeCells:()=>z.current==="visual"&&Xl.current,...i!=null?{onSave:c=>ns.current(c)}:{},...a!=null?{onOpen:()=>rs.current()}:{}}),[ue,oe,te,ks,An,xs,ws,nn,Fr,Br,_,I,O,Ni,js,Mi,Li,Rs,Es,Ts,Ns,Ms,Hr,zr,Ls,Hs,_s,Is,Fs,Bs,bt,_i,Ii,Fi,jt,Cs,Ir,Ss,Ds,i,a]),zs=s.useCallback(()=>{const c=Se.current??at({mode:z.current,visualEl:B.current,htmlEl:Ie.current});return{mode:c.mode,selection:Vr(c),getHtml:le.getHtml,setHtml:f=>{ue(f,!1)},insertText:f=>nn(c,f,!1),insertHtml:(f,k)=>{const H=k===void 0;nn(c,H?f:k,H)}}},[nn,le.getHtml,ue]),{catalog:Or,layout:Os}=s.useMemo(()=>Mf(E,E0,R0),[E]),Kr=s.useMemo(()=>l0(Os,R),[Os,R]),Hi=s.useMemo(()=>({...Kr,iconGroups:Lv(Kr.iconGroups,ri)}),[Kr,ri]),rn=s.useMemo(()=>({...$g(le),...Lf(E,zs)}),[le,E,zs]),zi=s.useMemo(()=>Ug(le),[le,dr,jn,En,Tn,Mn,Go,li,si,Ci,Pt,ke,yi,xi,wi,Qo,ti,Jt,et]),Ks=s.useCallback(c=>{if(ee||c.inputType!=="insertText"&&c.inputType!=="insertReplacementText"||!c.data||!ah(Ge.current)&&!Fe.current&&!Cp(Ve.current)&&!Yp({color:Ze.current,backgroundColor:Qe.current})&&!rh(At.current))return;const f=B.current;f&&(c.preventDefault(),hh(f,c.data,Ge.current,Fe.current,{color:Ze.current,backgroundColor:Qe.current},Ve.current,At.current),Ge.current={},Fe.current=null,Ve.current=null,Ze.current=null,Qe.current=null,At.current=null,Be.current=null,te(f,!0),_(),I())},[ee,oe,_,I]),$s=s.useCallback(c=>{if(ee||!Yf(c,Jl.current))return;c.preventDefault(),c.stopPropagation();const f=B.current;if(!f)return;O(f);const k=va(f,c.target),H=vo(f,c.target);H&&!bl(f).includes(H)&&jx(f,H);const W={inTable:Ne(f,c.target)!==null,canMergeCells:xc(f),canUnmergeCells:wc(f)};if(k){qi(f,k),_(),Qt(k),bi({open:!0,x:c.clientX,y:c.clientY,kind:"image",...W,inTable:Ne(f,k)!==null});return}const Q=at({mode:"visual",visualEl:f,htmlEl:Ie.current});Se.current=Q,bi({open:!0,x:c.clientX,y:c.clientY,kind:Q.collapsed?"caret":"text",...W})},[ee,_,O]),Us=s.useCallback(c=>{if(Jl.current=c.pointerType,ee)return;const f=B.current;if(!f)return;const k=va(f,c.target);if(!k){Qt(null);return}c.preventDefault(),qi(f,k),_(),Qt(k)},[ee,_]),_m=s.useCallback(c=>{if(ee)return;if(c.key==="Tab"&&!c.ctrlKey&&!c.metaKey&&!c.altKey){if(z.current!=="visual")return;const k=B.current;if(!k)return;const H=c.target;if(!(H instanceof Node)||!k.contains(H))return;O(k);const W=Px(k,c.shiftKey);if(!W)return;c.preventDefault(),typeof W=="object"&&W.changed&&te(k,!1),_(),I(),it(k);return}if(!(c.ctrlKey||c.metaKey))return;const f=c.key.toLowerCase();if(f==="z"&&!c.shiftKey){c.preventDefault(),Fr();return}if(f==="z"&&c.shiftKey||f==="y"){c.preventDefault(),Br();return}if(f==="b"&&!c.shiftKey){c.preventDefault(),le.toggleFontMark("bold");return}if(f==="i"&&!c.shiftKey){c.preventDefault(),le.toggleFontMark("italic");return}if(f==="u"&&!c.shiftKey){c.preventDefault(),le.toggleFontMark("underline");return}if(f==="x"&&c.shiftKey){c.preventDefault(),le.toggleFontMark("strikethrough");return}f==="p"&&!c.shiftKey&&(c.preventDefault(),rn.print())},[ee,Fr,Br,le,rn,O,oe,_,I,it]),Im=[he.root,la(Jt).className,ft?he.fullscreen:"",y].filter(Boolean).join(" "),Fm=ak({toolbarBackground:C,menuColor:A,menuBackground:v,menuFontSize:j,menuFontFamily:D,border:T}),Bm=la(Jt)["data-wysiwyg-theme"];return o.jsx(Kf,{locale:S,children:o.jsx(Bf,{dark:Jt,children:o.jsxs("div",{className:Im,style:Fm,"data-fullscreen":ft?"":void 0,"data-wysiwyg-theme":Bm,"data-toolbar-position":et,onKeyDown:_m,children:[M?o.jsx("div",{className:he.menuChrome,onPointerDownCapture:Di,children:o.jsx(aa,{catalog:Or,layout:Hi,commands:rn,queries:zi,disabled:ee,menuVisible:!0,toolbarVisible:!1})}):null,o.jsxs("div",{className:he.body,"data-icon-dock":F?et:void 0,children:[F&&(et==="top"||et==="left")?o.jsx("div",{className:he.iconChrome,onPointerDownCapture:Di,children:o.jsx(aa,{catalog:Or,layout:Hi,commands:rn,queries:zi,disabled:ee,menuVisible:!1,toolbarVisible:!0,position:et})}):null,o.jsxs("div",{className:he.workspace,onDragEnter:On.onDragEnter,onDragOver:On.onDragOver,onDragLeave:On.onDragLeave,onDrop:On.onDrop,children:[$e==="visual"?Ce?o.jsx(ok,{ref:lr,pages:Rm,activePageIndex:Bo,onActivePageIndexChange:c=>{var k;Rl(c);const f=(k=lr.current)==null?void 0:k.getActivePageRoot();f instanceof HTMLDivElement&&(B.current=f)},onPageChange:(c,f)=>Ai(c,f,!0),onBeforeInput:Ks,onPointerDown:c=>{c.currentTarget instanceof HTMLDivElement&&(B.current=c.currentTarget),Us(c)},onMouseUp:Ps,onContextMenu:$s,placeholder:w,disabled:ee}):o.jsx(rk,{ref:B,html:Rt(_e).body,onChange:c=>oe(c,!0),onBeforeInput:Ks,onPointerDown:Us,onMouseUp:Ps,onContextMenu:$s,placeholder:w,disabled:ee}):o.jsx(nk,{ref:Ie,html:_e,onChange:c=>ue(c,!0),placeholder:w,disabled:ee}),On.dragging?o.jsx(sk,{}):null]}),F&&(et==="bottom"||et==="right")?o.jsx("div",{className:he.iconChrome,onPointerDownCapture:Di,children:o.jsx(aa,{catalog:Or,layout:Hi,commands:rn,queries:zi,disabled:ee,menuVisible:!1,toolbarVisible:!0,position:et})}):null]}),ft?o.jsx(lk,{onClick:()=>An(!1)}):null,o.jsx(a0,{open:ni,catalog:Or,groups:Kr.iconGroups,settings:ri,loading:km,busy:Am,disabled:ee,onChange:c=>{ys(c)},onReset:()=>{ys(null)},onClose:()=>Ol(!1)}),o.jsx(Av,{open:Fn.open,html:Fn.html,onClose:()=>Kl({open:!1,html:Fn.html})}),o.jsx(OC,{open:In.open,tab:In.tab,size:jn.value,unit:jn.unit,marks:dr,fontFamily:En.value,fontFamilyMixed:En.mixed,fontColor:Tn.value,fontColorMixed:Tn.mixed,highlightColor:Mn.value,highlightColorMixed:Mn.mixed,fonts:Pt,disabled:ee,onTabChange:c=>hr({open:!0,tab:c}),onApply:c=>le.applyFontProperties(c),onClose:()=>hr({open:!1,tab:In.tab})}),o.jsx(cS,{open:zt.open,tab:zt.tab,value:zt.value,disabled:ee,onTabChange:c=>wr({...zt,open:!0,tab:c}),onApply:c=>le.applyParagraphProperties(c),onClose:()=>wr({...zt,open:!1})}),o.jsx(SS,{open:Cr.open,value:Cr.value,disabled:ee,onApply:c=>le.applyCustomCss(c),onClose:()=>ai(c=>({...c,open:!1}))}),o.jsx(bS,{open:Ot.open,tab:Ot.tab,value:Ot.value,fonts:Pt,disabled:ee,customImagePicker:J,onCustomImagePick:()=>{J==null||J.onPick(c=>{Zt(f=>({...f,tab:"paragraph",value:{...f.value,backgroundImage:{...f.value.backgroundImage,src:c.src}}}))})},onTabChange:c=>Zt({...Ot,open:!0,tab:c}),onApply:c=>le.applyPageProperties(c),onResetAtRule:()=>{const c=B.current;!c||z.current!=="visual"||ey(c)&&(te(c,!1),Zt(f=>({...f,value:{...f.value,atRule:Vt()}})))},onClose:()=>Zt({...Ot,open:!1})}),o.jsx(wS,{open:ve.open,mode:ve.open?ve.mode:"create",styleId:ve.open&&ve.mode==="edit"?ve.style.id:void 0,name:ve.open&&ve.mode==="edit"?ve.style.name:"",font:ve.open?ve.mode==="edit"?ve.style.font:ve.font:{size:null,unit:Wt,marks:Ct(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:ve.open?ve.mode==="edit"?ve.style.paragraph:ve.paragraph:void 0,canDelete:!!X,fonts:Pt,busy:Dm,disabled:ee,onSave:async c=>{const f=es.current;if(f){Sr(!0);try{await f(c),Bn({open:!1}),await Lr()}finally{Sr(!1)}}},onDelete:async c=>{const f=ts.current;if(f){Sr(!0);try{await f(c),Bn({open:!1}),await Lr()}finally{Sr(!1)}}},onClose:()=>Bn({open:!1})}),o.jsx(YS,{open:He.open,tab:He.tab,href:He.href,title:He.title,targetBlank:He.targetBlank,textDecorationNone:He.textDecorationNone,hoverMode:He.hoverMode,hoverColor:He.hoverColor,hoverHtml:He.hoverHtml,bookmarks:He.bookmarks,selectedBookmarkId:He.selectedBookmarkId,disabled:ee,onTabChange:c=>vr({...He,open:!0,tab:c}),onApply:c=>le.applyLink(c),onClose:()=>vr({...He,open:!1})}),o.jsx(kS,{open:ui.open,existingIds:ui.existingIds,disabled:ee,onApply:c=>le.applyBookmark(c),onClose:()=>di({...ui,open:!1})}),o.jsx(jS,{open:Pm.open,disabled:ee,customImagePicker:J,onApply:c=>le.applyImage(c),onCustomPick:()=>{kr({open:!1}),J==null||J.onPick(_i)},onClose:()=>kr({open:!1})}),o.jsx(PS,{open:jm.open,disabled:ee,customAudioPicker:Y,onApply:c=>le.applyAudio(c),onCustomPick:()=>{Ar({open:!1}),Y==null||Y.onPick(Ii)},onClose:()=>Ar({open:!1})}),o.jsx(XS,{open:Em.open,disabled:ee,customVideoPicker:ne,onApply:c=>le.applyYoutube(c),onCustomPick:()=>{Hn({open:!1}),ne==null||ne.onPick(Fi)},onClose:()=>Hn({open:!1})}),o.jsx(OS,{open:Dr.open,tab:Dr.tab,value:Dr.value,aspectRatio:Dr.aspectRatio,disabled:ee,onTabChange:c=>Pr(f=>({...f,tab:c})),onApply:c=>le.applyImageProperties(c),onClose:()=>Pr(c=>({...c,open:!1}))}),o.jsx(nv,{open:mi.open,disabled:ee,onApply:c=>le.applyTable(c),onClose:()=>fi({open:!1})}),o.jsx(lv,{open:jr.open,value:jr.value,disabled:ee,onApply:c=>le.applyTableProperties(c),onClose:()=>pi(c=>({...c,open:!1}))}),o.jsx(dv,{open:Er.open,value:Er.value,disabled:ee,onApply:c=>le.applyCellProperties(c),onClose:()=>gi(c=>({...c,open:!1}))}),o.jsx(gv,{open:Rr.open,value:Rr.value,disabled:ee,onApply:c=>le.applyRowProperties(c),onClose:()=>hi(c=>({...c,open:!1}))}),$e==="visual"&&!ee&&(ke!=null&&ke.isConnected)?o.jsx(qS,{img:ke,onResize:Nm,onResizeEnd:Mm}):null,o.jsx(Vf,{open:Kt.open,x:Kt.x,y:Kt.y,kind:Kt.kind,inTable:Kt.inTable,canMergeCells:Kt.canMergeCells,canUnmergeCells:Kt.canUnmergeCells,commands:rn,onClose:()=>bi(c=>({...c,open:!1}))})]})})})}function ak({toolbarBackground:e,menuColor:t,menuBackground:n,menuFontSize:r,menuFontFamily:i,border:a}){const l={};return e&&(l["--wysiwyg-toolbar-background"]=e),t&&(l["--wysiwyg-menu-color"]=t),n&&(l["--wysiwyg-menu-background"]=n),r&&(l["--wysiwyg-menu-font-size"]=r),i&&(l["--wysiwyg-menu-font-family"]=i),a==="none"?(l["--wysiwyg-border-width"]="0",l["--wysiwyg-border-radius"]="0",l["--wysiwyg-border-shadow"]="none"):a&&(a.width&&(l["--wysiwyg-border-width"]=a.width),a.color&&(l["--wysiwyg-border-color"]=a.color),a.radius&&(l["--wysiwyg-border-radius"]=a.radius),a.shadow&&(l["--wysiwyg-border-shadow"]=a.shadow)),Object.keys(l).length?l:void 0}function lk({onClick:e}){const t=U();return o.jsx("button",{type:"button",className:he.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:o.jsx(Me,{className:he.exitFullscreenIcon})})}function sk(){const e=U();return o.jsx("div",{className:he.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}exports.Editor=ik;exports.PAGE_SEPARATOR=mo;exports.joinPagesToHtml=lt;exports.splitPagesFromHtml=xt;
|
|
92
|
+
`.trim();function Za(e,t,n=""){const{hrefs:r,body:i}=jt(t),a=e.createElement("meta");a.setAttribute("charset","utf-8");const l=e.createElement("title");l.textContent=n;const u=e.createElement("style");u.textContent=Jg;const m=r.map(p=>{const g=e.createElement("link");return g.rel="stylesheet",g.href=p,g});e.head.replaceChildren(a,l,u,...m),e.title=n,e.body.innerHTML=i}const El=["pt","px","em","rem","%"],tn="pt",Qg={pt:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],px:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],em:[.5,.75,1,1.25,1.5,2,2.5,3],rem:[.5,.75,1,1.25,1.5,2,2.5,3],"%":[50,75,100,125,150,200,250,300]},eh={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},th=new Set(El),nh=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function oi(e){return th.has(e)}function Ee(e){return Math.round(e*100)/100}function Q(e){const t=Ee(e);return Number.isInteger(t),String(t)}function Rl(e,t){return`${Q(e)}${t}`}function Tl(e){const t=e.trim();if(!t)return null;const n=t.match(nh);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return{value:r,unit:i}}function rh(e,t){const n=e.trim();if(!n)return null;const r=Tl(n);if(r)return oi(r.unit)?nn(r.value,r.unit):null;const i=Number(n.replace(",","."));return Number.isFinite(i)?nn(i,t):null}function nn(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=eh[t];return{value:Ee(Math.min(r,Math.max(n,e))),unit:t}}function Pd(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return Ee(e);case"pt":return Ee(e*.75);case"em":return Ee(e/i);case"rem":return Ee(e/a);case"%":return Ee(e/i*100)}}function oh(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return e;case"pt":return e*(4/3);case"em":return e*i;case"rem":return e*a;case"%":return e/100*i}}function Dd(e,t,n,r,i){if(t===n)return Ee(e);const a=oh(e,t,r,i);return Pd(a,n,r,i)}const Nl="pt",ih=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,ah=/^[+-]?0(?:\.0+)?$/;function pe(e){return`${Q(e.value)}${e.unit}`}function Te(e){const t=e.trim();if(!t)return null;if(ah.test(t))return{value:0,unit:"px"};const n=t.match(ih);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return oi(i)?{value:Ee(r),unit:i}:null}function mr(e,t,n){const r=e.trim();if(!r)return null;const i=Te(r);if(i)return!n&&i.value<0?{...i,value:0}:i;const a=Number(r.replace(",","."));return Number.isFinite(a)?!n&&a<0?{value:0,unit:t}:{value:Ee(a),unit:t}:null}function Vt(e){return e.value>=0?e:{value:0,unit:e.unit}}function Xe(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function go(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function lh(e,t){return t?e===t||e.contains(t):!1}function Kc(e,t){var a;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0,i;for(;i=n.nextNode();){if(i===t||t.contains(i)||t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)return r;r+=((a=i.textContent)==null?void 0:a.length)??0}return r}function $c(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return Kc(e,t)+n;let r=0;const i=t.childNodes;for(let l=0;l<n&&l<i.length;l+=1)r+=((a=i[l].textContent)==null?void 0:a.length)??0;return Kc(e,t)+r}function Uc(e,t){var l,u;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=Math.max(0,t),i,a=null;for(;i=n.nextNode();){a=i;const m=((l=i.textContent)==null?void 0:l.length)??0;if(r<=m)return{node:i,offset:r};r-=m}return a?{node:a,offset:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function Ml(e,t,n){const r=document.createRange(),i=Uc(e,t),a=Uc(e,n);return r.setStart(i.node,i.offset),r.setEnd(a.node,a.offset),r}function jd(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Wc(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function sh(e,t){return t.mode!=="visual"?null:t.visualRange&&jd(t.visualRange,e)?t.visualRange:Ml(e,t.start,t.end)}function dt(e){var n;if(e.mode==="html"&&e.htmlEl){const r=e.htmlEl.selectionStart,i=e.htmlEl.selectionEnd;return{mode:"html",text:e.htmlEl.value.slice(r,i),collapsed:r===i,start:r,end:i,visualRange:null}}const t=e.visualEl;if(e.mode==="visual"&&t){const r=window.getSelection();if(r&&r.rangeCount>0){const a=r.getRangeAt(0);if(lh(t,a.commonAncestorContainer)){const l=$c(t,a.startContainer,a.startOffset),u=$c(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(l,u),end:Math.max(l,u),visualRange:a.cloneRange()}}}const i=((n=t.textContent)==null?void 0:n.length)??0;return{mode:"visual",text:"",collapsed:!0,start:i,end:i,visualRange:null}}return{mode:e.mode,text:"",collapsed:!0,start:0,end:0,visualRange:null}}function Gc(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ch(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),l=e.snapshot.start,u=e.snapshot.end,m=e.asHtml?e.content:Gc(e.content);e.setHtml(a.slice(0,l)+m+a.slice(u));const p=e.htmlEl;if(p){const g=l+m.length;p.focus(),p.setSelectionRange(g,g)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:Gc(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&jd(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??Ml(t,e.snapshot.start,e.snapshot.end);if(r.deleteContents(),e.content)if(e.asHtml){const a=r.createContextualFragment(e.content),l=a.lastChild;r.insertNode(a),l&&(r.setStartAfter(l),r.collapse(!0))}else{const a=document.createTextNode(e.content);r.insertNode(a),r.setStartAfter(a),r.collapse(!0)}const i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r),e.setHtml(t.innerHTML)}const _l=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),Ed=new Set(["table","thead","tbody","tr","td","th"]),Ll=new Set([...Ed,"ul","ol","li","pre","hr"]);function ce(e){return e.tagName.toLowerCase()}function xr(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Il(e){return e instanceof HTMLElement&&(ce(e)==="ul"||ce(e)==="ol")}function Je(e){return e instanceof HTMLElement&&ce(e)==="li"}function bt(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function Fl(e){const t=e.collapsed?[]:ze(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function An(e,t,n){var m,p,g;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let C=0,y;for(;y=h.nextNode();){if(y===t)return C+n;C+=((m=y.textContent)==null?void 0:m.length)??0}return C}let r=0;const i=t.childNodes;for(let h=0;h<n&&h<i.length;h+=1)r+=((p=i[h].textContent)==null?void 0:p.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=0,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return l+r;l+=((g=u.textContent)==null?void 0:g.length)??0}return l+r}function Bl(e,t,n){const r=Ml(e,t,n),i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function Tn(e,t){const n=bt(e);if(!n)return!1;const r=An(e,n.startContainer,n.startOffset),i=An(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=t();return Bl(e,a,l),u}function Hl(e,t){if(ce(e)===t)return e;const n=document.createElement(t);for(const r of[...e.attributes])n.setAttribute(r.name,r.value);for(;e.firstChild;)n.appendChild(e.firstChild);return e.replaceWith(n),n}function it(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function uh(e,t){let n=xr(t);for(;n&&n!==e;){if(bd(n,e)||gt(n)){n=n.parentElement;continue}const r=ce(n);if(_l.has(r)&&n instanceof HTMLElement)return n;if(Ed.has(r)||r==="pre")return null;n=n.parentElement}return null}function Nn(e){const t=bt(e);if(!t)return[];const n=new Set,r=[];for(const i of Fl(t)){const a=uh(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function qa(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ce(e);return _l.has(t)||Ll.has(t)?!1:ht(e)||t==="br"||t==="a"||t==="img"||t==="span"}function dh(e,t){let n=xr(t);for(;n&&n!==e;){if(Ll.has(ce(n)))return!0;n=n.parentElement}return!1}function mh(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function fh(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&qa(n[i-1]);)i-=1;for(;a<n.length-1&&qa(n[a+1]);)a+=1;return n.slice(i,a+1)}function Ya(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&>(t)))return t;return null}function ph(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&>(r)?Ya(e):r}return n.startContainer===t&&e!==t?Ya(e):mh(e,n.startContainer)}function gh(e,t){const n=Al(e);if(dh(e,t.startContainer))return null;if(!Ya(n)){const l=document.createElement("p");return l.appendChild(document.createElement("br")),n.appendChild(l),l}const r=ph(n,e,t);if(!r||r instanceof HTMLElement&>(r)||r instanceof Element&&Ll.has(ce(r))||r instanceof HTMLElement&&_l.has(ce(r))||!qa(r))return null;const i=fh(n,r),a=document.createElement("p");n.insertBefore(a,i[0]);for(const l of i)a.appendChild(l);return a}function Cr(e){const t=Nn(e);if(t.length>0)return t;const n=bt(e);if(!n)return[];const r=gh(e,n);return r?[r]:[]}function Pn(e){const t=e.parentElement;return t&&Il(t)?t:null}function Rd(e){if(e.length===0)return[];const t=[[e[0]]];for(let n=1;n<e.length;n+=1){const r=e[n-1],i=e[n];r.parentNode===i.parentNode&&hh(r,i)?t[t.length-1].push(i):t.push([i])}return t}function hh(e,t){var r;let n=e.nextSibling;for(;n;){if(n===t)return!0;if(n.nodeType===Node.TEXT_NODE&&!((r=n.textContent)!=null&&r.trim())){n=n.nextSibling;continue}return!1}return!1}function bh(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Pa(e){const t=e.trim().match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d*\.?\d+))?\s*\)$/i);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=t[4]===void 0?1:Number(t[4]);return[n,r,i,a].every(l=>Number.isFinite(l))?{r:n,g:r,b:i,a}:null}function Da(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function ja(e){const t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?t:/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:null}const yh={black:"#000000",silver:"#c0c0c0",gray:"#808080",grey:"#808080",white:"#ffffff",maroon:"#800000",red:"#ff0000",purple:"#800080",fuchsia:"#ff00ff",magenta:"#ff00ff",green:"#008000",lime:"#00ff00",olive:"#808000",yellow:"#ffff00",navy:"#000080",blue:"#0000ff",teal:"#008080",aqua:"#00ffff",cyan:"#00ffff",orange:"#ffa500"};function xh(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function xe(e){const t=e.trim();if(!t||xh(t))return null;const n=ja(t);if(n)return n;const r=Pa(t);if(r)return r.a===0?null:Da(r.r,r.g,r.b);const i=yh[t.toLowerCase()];if(i)return i;const a=document.createElement("canvas").getContext("2d");if(!a)return null;a.fillStyle="#010203";try{a.fillStyle=t}catch{return null}const l=String(a.fillStyle);if(l==="#010203"){const m=ja(t);if(m==="#010203")return m;const p=Pa(t);return p&&Da(p.r,p.g,p.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(l.startsWith("#"))return ja(l);const u=Pa(l);return!u||u.a===0?null:Da(u.r,u.g,u.b)}function Td(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?xe(n):null}function Lo(e,t,n){let r=bh(t);for(;r&&r!==e&&r instanceof HTMLElement;){const i=Td(r,n);if(i)return i;r=r.parentElement}return null}function Io(e,t){return e instanceof HTMLElement?Td(e,t)!==null:!1}function zl(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function Nd(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function Ch(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ht(i)||!Io(i,n)){r=i;continue}if(Gt(i,r),Io(i,n)&&(zl(i,n),Wt(i))){We(i);continue}r=i}}function Md(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function Fo(e,t){const n=Md(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:ze(n).filter(m=>m.data.length>0),a=(r.length>0?r:[n.startContainer]).map(m=>Lo(e,m,t)),l=a[0]??null;return a.every(m=>m===l)?{value:l,mixed:!1}:{value:null,mixed:!0}}function ar(e,t,n){const r=Md(e);if(!r||r.collapsed)return!1;const i=n===null?null:xe(n);if(n!==null&&i===null)return!1;pt(r);const a=ze(r).filter(l=>l.data.length>0);for(const l of a){const u=Lo(e,l,t);if(i===null){if(u===null)continue;Ch(e,l,t);continue}u!==i&&br(l,m=>{Nd(m,t,i)})}return an(a),!0}function Vc(e,t,n){if(n.value===null){zl(e,t);return}const r=xe(n.value);r&&Nd(e,t,r)}function wh(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function vh(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function Sh(e){var r,i,a;let t=e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0?e.startContainer:e.startContainer.childNodes[e.startOffset]??e.startContainer.lastChild??e.startContainer;if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset>0){const l=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(l,e.startContainer.nextSibling),l}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const l=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(l,e.startContainer),l}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function _d(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ht(i)||!n.some(a=>Io(i,a))){r=i;continue}Gt(i,r);for(const a of n)Io(i,a)&&zl(i,a);if(Wt(i)){We(i);continue}r=i.isConnected?i:t}return t}function kh(e,t,n){vh(t);const r=Sh(t);return _d(e,r,n)}function Ah(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&Lo(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&Lo(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Ld=["auto","avoid"],Xa=["auto","avoid","page"];new Set(Ld);new Set(Xa);function Id(e){return e.trim().toLowerCase()}function Zc(e){return Id(e)==="avoid"?"avoid":"auto"}function Bo(e){const t=Id(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function Fd(e){const t=e.style.breakInside;if(t)return Zc(t);const n=e.style.pageBreakInside;return n?Zc(n):"auto"}function Bd(e){const t=e.style.breakAfter;if(t)return Bo(t);const n=e.style.pageBreakAfter;return n?Bo(n):"auto"}function Hd(e){const t=e.style.breakBefore;if(t)return Bo(t);const n=e.style.pageBreakBefore;return n?Bo(n):"auto"}function Ph(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function Dh(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function jh(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function Eh(e){return{breakInside:Fd(e),breakAfter:Bd(e),breakBefore:Hd(e)}}function Rh(e,t){return Fd(e)===t?!1:t==="auto"?(Ph(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function Th(e,t){return Bd(e)===t?!1:t==="auto"?(Dh(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function Nh(e,t){return Hd(e)===t?!1:t==="auto"?(jh(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function Mh(e,t){return e===t}function qc(e,t){return e===t}const Me=["top","right","bottom","left"],ii=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],at={top:null,right:null,bottom:null,left:null},Ol={style:"none",width:null,color:null},_h=new Set(ii),Yc={value:0,unit:"px"};function Lh(){return{margin:{...at},padding:{...at},lineHeight:null,border:{...Ol},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function Kl(){const e=Lh();return{margin:e.margin,marginMixed:!1,padding:e.padding,paddingMixed:!1,lineHeight:e.lineHeight,lineHeightMixed:!1,border:e.border,borderMixed:!1,borderRadius:e.borderRadius,radiusMixed:!1,boxShadow:e.boxShadow,shadowMixed:!1,backgroundColor:e.backgroundColor,backgroundMixed:!1,opacity:e.opacity,opacityMixed:!1,breakInside:e.breakInside,breakInsideMixed:!1,breakAfter:e.breakAfter,breakAfterMixed:!1,breakBefore:e.breakBefore,breakBeforeMixed:!1}}function Rt(e,t){return Me.every(n=>Xe(e[n],t[n]))}function zd(e,t){return e===t?!0:!e||!t||e.kind!==t.kind?!1:e.kind==="normal"||t.kind==="normal"?!0:e.kind==="number"&&t.kind==="number"?e.value===t.value:e.kind==="length"&&t.kind==="length"&&e.value===t.value&&e.unit===t.unit}function Od(e,t){return e.style===t.style&&Xe(e.width,t.width)&&e.color===t.color}function Kd(e,t){return e===t?!0:!e||!t?!1:Xe(e.offsetX,t.offsetX)&&Xe(e.offsetY,t.offsetY)&&Xe(e.blur,t.blur)&&Xe(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function Ih(e){return e.kind==="normal"?"normal":e.kind==="number"?Q(e.value):pe({value:e.value,unit:e.unit})}function Fh(e){const t=e.trim();if(!t)return null;if(t.endsWith("%")){const r=Number(t.slice(0,-1).trim().replace(",","."));return Number.isFinite(r)?Ot(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?Ot(n):null}function Ot(e){return Ee(Math.min(1,Math.max(0,e)))}function Ho(e){return Ee(Ot(e)*100)}function $d(e){return Ot(e/100)}function Ud(e){return Q(Ot(e))}function Bh(e){const t=e.trim();if(!t)return null;if(t.toLowerCase()==="normal")return{kind:"normal"};if(/^[+]?(?:\d+(?:\.\d+)?|\.\d+)$/.test(t)){const r=Number(t);return!Number.isFinite(r)||r<0?null:{kind:"number",value:Ee(r)}}const n=Te(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function Hh(e,t){const n=[];let r="",i=0;for(const a of e){if(a==="("){i+=1,r+=a;continue}if(a===")"){i=Math.max(0,i-1),r+=a;continue}if(a===t&&i===0){r.trim()&&n.push(r.trim()),r="";continue}r+=a}return r.trim()&&n.push(r.trim()),n}function zh(e){const t=[];let n="",r=0;for(const i of e){if(i==="("){r+=1,n+=i;continue}if(i===")"){r=Math.max(0,r-1),n+=i;continue}if(/\s/.test(i)&&r===0){n&&t.push(n),n="";continue}n+=i}return n&&t.push(n),t}function Oh(e){const t=[pe(e.offsetX),pe(e.offsetY),pe(e.blur),pe(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function Kh(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=Hh(t,",")[0];if(!n)return null;const r=zh(n);let i=!1,a=null;const l=[];for(const u of r){if(u.toLowerCase()==="inset"){i=!0;continue}const m=Te(u);if(m){l.push(m);continue}const p=xe(u);if(p){a=p;continue}return null}return l.length<2||l.length>4?null:{offsetX:l[0],offsetY:l[1],blur:l[2]??Yc,spread:l[3]??Yc,color:a,inset:i}}function yn(e,t){return Te(e.style.getPropertyValue(t))}function $h(e,t,n,r){const i=n&&r?Vt(n):n,a=i?pe(i):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function Xc(e,t){return{top:yn(e,`${t}-top`),right:yn(e,`${t}-right`),bottom:yn(e,`${t}-bottom`),left:yn(e,`${t}-left`)}}function Jc(e,t,n,r){let i=!1;for(const a of Me)$h(e,`${t}-${a}`,n[a],r)&&(i=!0);return i}function Uh(e){const t=e.trim().toLowerCase();return _h.has(t)?t:"none"}function Wd(e){const t=Uh(e.style.borderStyle||e.style.borderTopStyle),n=yn(e,"border-width")??yn(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,i=r?xe(r):null;return{style:t,width:n,color:i}}function Wh(e,t){const n=Wd(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?Vt(t.width):null,color:t.color};return Od(n,r)?!1:r.style==="none"?(e.style.removeProperty("border"),e.style.removeProperty("border-style"),e.style.removeProperty("border-width"),e.style.removeProperty("border-color"),!0):(e.style.borderStyle=r.style,r.width?e.style.borderWidth=pe(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function Gd(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return Te(n)}function Gh(e,t){const n=t?Vt(t):null,r=Gd(e);return Xe(r,n)?!1:(n?e.style.borderRadius=pe(n):e.style.removeProperty("border-radius"),!0)}function Vd(e){return Kh(e.style.boxShadow)}function Vh(e,t){const n=Vd(e),r=t?{...t,blur:Vt(t.blur)}:null;return Kd(n,r)?!1:(r?e.style.boxShadow=Oh(r):e.style.removeProperty("box-shadow"),!0)}function Zd(e){return Bh(e.style.lineHeight)}function Zh(e,t){const n=Zd(e);return zd(n,t)?!1:(t?e.style.lineHeight=Ih(t):e.style.removeProperty("line-height"),!0)}function qd(e){const t=e.style.backgroundColor;return t?xe(t):null}function qh(e,t){const n=t?xe(t):null;return qd(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Yd(e){return Fh(e.style.opacity)}function Yh(e,t){const n=Yd(e),r=t===null?null:Ot(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Ud(r),!0)}function Mn(e){const t=Eh(e);return{margin:Xc(e,"margin"),padding:Xc(e,"padding"),lineHeight:Zd(e),border:Wd(e),borderRadius:Gd(e),boxShadow:Vd(e),backgroundColor:qd(e),opacity:Yd(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function _n(e,t){let n=!1;return!t.marginMixed&&Jc(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&Jc(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&Zh(e,t.lineHeight)&&(n=!0),!t.borderMixed&&Wh(e,t.border)&&(n=!0),!t.radiusMixed&&Gh(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&Vh(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&qh(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&Yh(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&Rh(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&Th(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&Nh(e,t.breakBefore)&&(n=!0),n&&it(e),n}function Xh(e){const t=Kl(),n=Nn(e);if(n.length===0)return t;const r=n.map(Mn),i=r[0];return{margin:i.margin,marginMixed:r.some(a=>!Rt(a.margin,i.margin)),padding:i.padding,paddingMixed:r.some(a=>!Rt(a.padding,i.padding)),lineHeight:i.lineHeight,lineHeightMixed:r.some(a=>!zd(a.lineHeight,i.lineHeight)),border:i.border,borderMixed:r.some(a=>!Od(a.border,i.border)),borderRadius:i.borderRadius,radiusMixed:r.some(a=>!Xe(a.borderRadius,i.borderRadius)),boxShadow:i.boxShadow,shadowMixed:r.some(a=>!Kd(a.boxShadow,i.boxShadow)),backgroundColor:i.backgroundColor,backgroundMixed:r.some(a=>a.backgroundColor!==i.backgroundColor),opacity:i.opacity,opacityMixed:r.some(a=>a.opacity!==i.opacity),breakInside:i.breakInside,breakInsideMixed:r.some(a=>!Mh(a.breakInside,i.breakInside)),breakAfter:i.breakAfter,breakAfterMixed:r.some(a=>!qc(a.breakAfter,i.breakAfter)),breakBefore:i.breakBefore,breakBeforeMixed:r.some(a=>!qc(a.breakBefore,i.breakBefore))}}function Jh(e,t){return Tn(e,()=>{const n=Cr(e);if(n.length===0)return!1;let r=!1;for(const i of n)_n(i,t)&&(r=!0);return r})}const zo="data-page-at-rule";function rn(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...at},marginMixed:!1}}function $l(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Xd(e){return e.body.innerHTML}function Jd(e){var r;const n=$l(e).querySelector(`style[${zo}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function ho(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?Te(r[1].trim()):null}function Qh(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...at};const n=t[1].trim().split(/\s+/).map(u=>Te(u)),[r,i=r,a=r,l=i]=n;return{top:r??null,right:i??null,bottom:a??null,left:l??null}}function eb(e){const t=e.match(/(?:^|[\s{;])size\s*:\s*([^;]+)/i);if(!t)return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null};const n=t[1].trim().toLowerCase();if(n==="auto")return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null};if(n==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:null};if(n==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:null};if(n==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:null};const r=n.includes("landscape"),i=n.includes("portrait"),a=r?"landscape":i?"portrait":null,u=n.replace(/\b(landscape|portrait)\b/g,"").trim().split(/\s+/).filter(Boolean);if(u.length>=2){const m=Te(u[0]),p=Te(u[1]);if(m&&p)return{sizePreset:"custom",customWidth:m,customHeight:p,orientation:a}}return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:a}}function tb(e){const t=rn();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],i=eb(r),a={top:ho(r,"top"),right:ho(r,"right"),bottom:ho(r,"bottom"),left:ho(r,"left")},u=Me.some(m=>a[m]!==null)?a:Qh(r);return{...i,margin:u,marginMixed:!1}}function ai(e){return tb(Jd(e))}function nb(e){const t=Me.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?pe(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:Me.map(r=>e[r]?`margin-${r}: ${pe(e[r])};`:null).filter(Boolean).join(" ")}function rb(e){if(e.sizePreset==="auto"&&!e.orientation)return null;const t=[];return e.sizePreset==="A4"?t.push("A4"):e.sizePreset==="letter"?t.push("letter"):e.sizePreset==="legal"?t.push("legal"):e.sizePreset==="custom"&&e.customWidth&&e.customHeight&&t.push(pe(e.customWidth),pe(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function ob(e){const t=rb(e),n=nb(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function ib(e){const t=$l(e);for(const n of t.querySelectorAll(`style[${zo}]`))n.remove();return Xd(t)}function ab(e,t){const n=$l(e);let r=n.querySelector(`style[${zo}]`);return r||(r=n.createElement("style"),r.setAttribute(zo,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,Xd(n)}function lb(e,t){const n=ob(t);return n?ab(e,n):Qd(e)}function Qd(e){return ib(e)}function sb(e){const t=e.map(n=>Jd(n)).filter(n=>!!n);return t.length===0?"":t.join(`
|
|
93
|
+
`)}const cb=1e3;function em(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.right="0",e.style.bottom="0",e.style.width="0",e.style.height="0",e.style.border="0",document.body.append(e);const t=e.contentDocument,n=e.contentWindow;return!t||!n?(e.remove(),null):{iframe:e,doc:t,win:n}}function tm(e,t,n,r){Za(e,r);let i=!1;const a=()=>{i||(i=!0,n.remove())};t.addEventListener("afterprint",a),t.focus(),t.print(),window.setTimeout(a,cb)}function ub(e){const t=em();t&&tm(t.doc,t.win,t.iframe,e)}function db(e){const t=em();if(!t)return;const n=[],r=[];for(const u of e){const m=jt(u);n.push(...m.hrefs),r.push(m.body)}const i=r.map((u,m)=>`<div style="${m<r.length-1?"page-break-after: always;":""}">${u}</div>`).join(""),a=sb(e),l=[a?`<style>${a}</style>`:"",...Array.from(new Set(n)).map(u=>`<link rel="stylesheet" href="${u}" />`),i].filter(Boolean).join("");tm(t.doc,t.win,t.iframe,l)}function mb(e){return{save:async()=>{if(e.onSave){const n=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(n);return}const t=e.isMultiPagesEnabled()?e.getActivePageHtml():e.getHtml();await Ng(t)},open:async()=>{const t=e.onOpen?await e.onOpen():await Mg();if(t!==null){if(Array.isArray(t)){e.setHtml(mt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(mt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){db(e.getAllPagesHtml());return}ub(e.getHtml())}}}function fb(e){return{toggleBold:()=>{e.toggleFontMark("bold")},toggleItalic:()=>{e.toggleFontMark("italic")},toggleUnderline:()=>{e.toggleFontMark("underline")},toggleStrikethrough:()=>{e.toggleFontMark("strikethrough")},clearFormatting:()=>{e.clearFormatting()},toggleFormatBrush:()=>{e.toggleFormatBrush()},setFontSize:(t,n)=>{e.setFontSize(t,n)},setFontSizeUnit:t=>{e.setFontSizeUnit(t)},setFontFamily:t=>{e.setFontFamily(t)},setFontColor:t=>{e.setFontColor(t)},setHighlightColor:t=>{e.setHighlightColor(t)},setParagraphStyle:t=>{e.setParagraphStyle(t)},alignLeft:()=>{e.setTextAlign("left")},alignCenter:()=>{e.setTextAlign("center")},alignRight:()=>{e.setTextAlign("right")},alignJustify:()=>{e.setTextAlign("justify")},indent:()=>{e.indent()},outdent:()=>{e.outdent()},toggleBulletList:()=>{e.toggleList("ul")},toggleNumberedList:()=>{e.toggleList("ol")},openFontProperties:t=>{e.openFontProperties(t??"general")},applyFontProperties:t=>{e.applyFontProperties(t)},openParagraphProperties:t=>{e.openParagraphProperties(t??"general")},applyParagraphProperties:t=>{e.applyParagraphProperties(t)},openPageProperties:t=>{e.openPageProperties(t??"font")},applyPageProperties:t=>{e.applyPageProperties(t)},openCustomParagraphStyleDialog:t=>{e.openCustomParagraphStyleDialog(t)},applyCustomParagraphStyle:t=>{e.applyCustomParagraphStyle(t)},openCustomCss:()=>{e.openCustomCss()},applyCustomCss:t=>{e.applyCustomCss(t)}}}function pb(e){return{isBold:()=>e.isFontMarkActive("bold"),isItalic:()=>e.isFontMarkActive("italic"),isUnderline:()=>e.isFontMarkActive("underline"),isStrikethrough:()=>e.isFontMarkActive("strikethrough"),getFontSize:()=>e.getFontSize(),getFontSizeUnit:()=>e.getFontSizeUnit(),isFontSizeMixed:()=>e.isFontSizeMixed(),getFontFamily:()=>e.getFontFamily(),isFontFamilyMixed:()=>e.isFontFamilyMixed(),getFontFaces:()=>e.getFontFaces(),getFontColor:()=>e.getFontColor(),isFontColorMixed:()=>e.isFontColorMixed(),getHighlightColor:()=>e.getHighlightColor(),isHighlightColorMixed:()=>e.isHighlightColorMixed(),getParagraphStyle:()=>e.getParagraphStyle(),isParagraphStyleMixed:()=>e.isParagraphStyleMixed(),isAlignLeft:()=>e.getTextAlign()==="left"&&!e.isTextAlignMixed(),isAlignCenter:()=>e.getTextAlign()==="center"&&!e.isTextAlignMixed(),isAlignRight:()=>e.getTextAlign()==="right"&&!e.isTextAlignMixed(),isAlignJustify:()=>e.getTextAlign()==="justify"&&!e.isTextAlignMixed(),canOutdent:()=>e.canOutdent(),isBulletList:()=>e.isBulletList(),isNumberedList:()=>e.isNumberedList(),hasTextSelection:()=>e.hasTextSelection(),isFormatBrushActive:()=>e.isFormatBrushActive(),customParagraphStylesEnabled:()=>e.customParagraphStylesEnabled(),getCustomParagraphStyles:()=>e.getCustomParagraphStyles(),isCustomParagraphStylesLoading:()=>e.isCustomParagraphStylesLoading()}}function gb(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function hb(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function bb(e){return{openLinkDialog:t=>{e.openLinkDialog(t)},applyLink:t=>{e.applyLink(t)},openBookmarkDialog:()=>{e.openBookmarkDialog()},applyBookmark:t=>{e.applyBookmark(t)},openImageDialog:()=>{e.openImageDialog()},applyImage:t=>{e.applyImage(t)},openAudioDialog:()=>{e.openAudioDialog()},applyAudio:t=>{e.applyAudio(t)},openYoutubeDialog:()=>{e.openYoutubeDialog()},applyYoutube:t=>{e.applyYoutube(t)},openImageProperties:t=>{e.openImageProperties(t)},applyImageProperties:t=>{e.applyImageProperties(t)},insertHorizontalRule:()=>{e.insertHorizontalRule()},insertPageBreak:()=>{e.insertPageBreak()},insertPage:()=>{e.insertPage()}}}function yb(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),canInsertPage:()=>e.isMultiPagesEnabled()&&e.getMode()==="visual"}}function xb(e){return{openTableDialog:()=>{e.openTableDialog()},applyTable:t=>{e.applyTable(t)},openTableProperties:()=>{e.openTableProperties()},applyTableProperties:t=>{e.applyTableProperties(t)},openCellProperties:()=>{e.openCellProperties()},applyCellProperties:t=>{e.applyCellProperties(t)},openRowProperties:()=>{e.openRowProperties()},applyRowProperties:t=>{e.applyRowProperties(t)},insertRowBelow:()=>{e.insertRowBelow()},insertRowBefore:()=>{e.insertRowBefore()},deleteRow:()=>{e.deleteRow()},insertColumnAfter:()=>{e.insertColumnAfter()},insertColumnBefore:()=>{e.insertColumnBefore()},deleteColumn:()=>{e.deleteColumn()},mergeCells:()=>{e.mergeCells()},unmergeCells:()=>{e.unmergeCells()}}}function Cb(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}const wb=[50,75,100,125,150,200],vb=.1,Sb=3;function Ea(e){return!Number.isFinite(e)||e<=0?1:Math.min(Sb,Math.max(vb,e))}function kb(e,t,n,r,i){if(e==="fitWidth")return r<=0?1:Ea(t/r);if(e==="fitPage"){if(r<=0||i<=0)return 1;const a=t/r,l=n/i;return Ea(Math.min(a,l))}return Ea(e/100)}function It(e,t){return()=>{e.setPageZoom(t)}}function Ft(e,t){return()=>e.getPageZoom()===t}function Ab(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},toggleReadAloud:()=>{e.toggleReadAloud()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setPageZoomFitWidth:It(e,"fitWidth"),setPageZoomFitPage:It(e,"fitPage"),setPageZoom50:It(e,50),setPageZoom75:It(e,75),setPageZoom100:It(e,100),setPageZoom125:It(e,125),setPageZoom150:It(e,150),setPageZoom200:It(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function Pb(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:Ft(e,"fitWidth"),isPageZoomFitPage:Ft(e,"fitPage"),isPageZoom50:Ft(e,50),isPageZoom75:Ft(e,75),isPageZoom100:Ft(e,100),isPageZoom125:Ft(e,125),isPageZoom150:Ft(e,150),isPageZoom200:Ft(e,200),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom",isReadingAloud:()=>e.isReadingAloud(),canReadAloud:()=>e.canReadAloud()}}function Db(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function jb(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function Eb(e){return{...mb(e),...gb(e),...ag(e),...bb(e),...xb(e),...Ab(e),...fb(e),...Db(e)}}function Rb(e){return{...Pb(e),...hb(e),...yb(e),...Cb(e),...pb(e),...jb(e)}}function Oo(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Tb(e){const t=e.style.fontSize;if(!t)return null;const n=Tl(t);return!n||!oi(n.unit)?null:{value:n.value,unit:n.unit}}function nm(e,t){let n=Oo(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Tb(n);if(r)return r;n=n.parentElement}return null}function Nb(e,t){const n=Oo(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function rm(e,t){var a;let n=Oo(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,m=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(m)&&m>0?m:16}n=n.parentElement}const r=((a=Oo(t))==null?void 0:a.parentElement)??e,i=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(i)&&i>0?i:16}function om(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function Mb(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Qc(e=tn){return{value:null,unit:e,mixed:!1}}function im(e,t=tn){const n=window.getSelection();if(!n||n.rangeCount===0)return Qc(t);const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer))return Qc(t);const i=r.collapsed?[]:ze(r).filter(p=>p.data.length>0),a=i.length>0?i:[r.startContainer],l=a.map(p=>nm(e,p)),u=l[0];if(l.every(p=>Mb(p,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(l.every(p=>p===null)){const p=a.map(h=>Nb(h,e)),g=p[0];if(p.every(h=>Math.abs(h-g)<.05)){const h=rm(e,a[0]),C=om(e);return{value:Pd(g,t,h,C),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function _b(e,t){return{parentPx:rm(e,t),rootPx:om(e)}}function Lb(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function Ja(e,t,n){const r=nn(t,n);if(!r)return!1;const i=Lb(e);if(!i||i.collapsed)return!1;const a=Rl(r.value,r.unit);pt(i);const l=ze(i).filter(u=>u.data.length>0);for(const u of l){const m=nm(e,u);m&&m.value===r.value&&m.unit===r.unit||br(u,p=>{p.style.fontSize=a})}return an(l),!0}function Ib(e,t){e.style.fontSize=Rl(t.value,t.unit)}function Fb(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Bb(e){return e.trim().toLowerCase()}function Qa(e){const t={};for(const n of e.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=Bb(r.slice(0,i)),l=r.slice(i+1).trim();a&&(t[a]=l)}return t}function am(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function Hb(e,t){const n={...e};for(const[r,i]of Object.entries(t))i.trim()?n[r]=i:delete n[r];return n}function zb(e){const t=e.trim();if(!t)return"";const n=t.split(";").map(r=>r.trim()).filter(Boolean);return n.length===0?"":n.map(r=>`${r};`).join(`
|
|
94
|
+
`)}function li(e){const t=Qa(e);return am(t)}function Ob(e,t){let n=Fb(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function lm(e){const t=bt(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:ze(t).filter(m=>m.data.length>0),a=(n.length>0?n:[t.startContainer]).map(m=>Ob(e,m)).map(m=>m.trim()),l=a[0]??"";return a.every(m=>m===l)?{value:l||null,mixed:!1}:{value:null,mixed:!0}}function sm(e,t){const n=Qa(e.style.cssText),r=Qa(t),i=Hb(n,r),a=am(i);a?e.style.cssText=a:e.removeAttribute("style")}function cm(e,t){const n=li(t);if(!n)return!1;const r=bt(e);if(!r||r.collapsed)return!1;pt(r);const i=ze(r).filter(a=>a.data.length>0);if(i.length===0)return!1;for(const a of i)br(a,l=>{sm(l,n),Wt(l)&&We(l)});return an(i),!0}function Kb(e,t){const n=li(t);n&&sm(e,n)}function $b(e){return!!(e&&li(e))}const Qe=["bold","italic","underline","strikethrough"],xn={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Ub=new Set(["underline","line-through","overline"]);function Et(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function Wb(e,t){return Qe.every(n=>e[n]===t[n])}function Gb(e){return Qe.some(t=>e[t]!==void 0)}function um(e,t){const n={...e};if(!t)return n;for(const r of Qe){const i=t[r];i!==void 0&&(n[r]=i)}return n}function Vb(e,t,n){const r=e[n]??t[n],i={...e,[n]:!r};return i[n]===t[n]&&delete i[n],i}function Kt(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Ub.has(n))}function Dn(e,t){if(t.length===0){e.style.textDecorationLine="",e.style.removeProperty("text-decoration-line"),e.style.textDecoration&&(e.style.textDecoration="",e.style.removeProperty("text-decoration"));return}e.style.textDecorationLine=t.join(" ")}function dm(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(xn.bold.has(r))return!0;const l=n.style.fontWeight;if(!l)return null;if(l==="bold"||l==="bolder")return!0;const u=Number(l);return Number.isNaN(u)?l==="normal"||l==="lighter"?!1:null:u>=700}if(t==="italic"){if(xn.italic.has(r))return!0;const l=n.style.fontStyle;return l?l==="italic"||l==="oblique"?!0:l==="normal"?!1:null:null}if(t==="underline"){if(xn.underline.has(r))return!0;const l=n.style.textDecorationLine||n.style.textDecoration;if(!l)return null;if(l==="none")return!1;const u=Kt(n);return u.includes("underline")?!0:u.length>0?!1:null}if(xn.strikethrough.has(r))return!0;const i=n.style.textDecorationLine||n.style.textDecoration;if(!i)return null;if(i==="none")return!1;const a=Kt(n);return a.includes("line-through")?!0:a.length>0?!1:null}function Ko(e,t){return dm(e,t)===!0}function jn(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const i=dm(r,n);if(i!==null)return i;r=r.parentElement}return!1}function mm(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=Kt(e);r.includes("underline")||r.push("underline"),Dn(e,r);return}const n=Kt(e);n.includes("line-through")||n.push("line-through"),Dn(e,n)}function fm(e,t){if(t==="bold"){e.style.fontWeight="",e.style.removeProperty("font-weight");return}if(t==="italic"){e.style.fontStyle="",e.style.removeProperty("font-style");return}if(t==="underline"){Dn(e,Kt(e).filter(n=>n!=="underline"));return}Dn(e,Kt(e).filter(n=>n!=="line-through"))}function Zb(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=Kt(e).filter(i=>i!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}Dn(e,r);return}const n=Kt(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}Dn(e,n)}function qb(e,t){br(e,n=>mm(n,t))}function Yb(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!ht(i)||!Ko(i,n)){r=i;continue}if(Gt(i,r),Ko(i,n)){if(xn[n].has(i.tagName.toLowerCase())){We(i);continue}if(fm(i,n),Wt(i)){We(i);continue}}r=i}}function Xb(e,t,n){const r=ze(t).filter(i=>i.data.length>0);return r.length===0?jn(e,t.startContainer,n):r.every(i=>jn(e,i,n))}function Jb(e,t,n,r){pt(t);const i=ze(t).filter(a=>a.data.length>0);for(const a of i)r?jn(e,a,n)||qb(a,n):Yb(e,a,n);an(i)}function Cn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Et();const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return Et();if(n.collapsed)return el(e,n);const r=ze(n).filter(a=>a.data.length>0);if(r.length===0)return el(e,n);const i=Et();for(const a of Qe)i[a]=jn(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const l of Qe)i[l]=i[l]&&jn(e,r[a],l);return i}function el(e,t){const n=Et();for(const r of Qe)n[r]=jn(e,t.startContainer,r);return n}function tl(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer)||r.collapsed)return!1;const i=Xb(e,r,t);return Jb(e,r,t,!i),!0}function Qb(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType!==Node.TEXT_NODE)return;const r=t;if(n<=0||n>=r.length)return;const i=r.splitText(n);e.setStart(i,0),e.collapse(!0)}function ey(e,t,n){var a,l,u;Qb(t);let r=t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0?t.startContainer:t.startContainer.childNodes[t.startOffset]??t.startContainer.lastChild??t.startContainer;if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset>0){const m=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(m,t.startContainer.nextSibling),r=m}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const m=document.createTextNode("");(l=t.startContainer.parentNode)==null||l.insertBefore(m,t.startContainer),r=m}else{const m=document.createTextNode("");r&&r!==t.startContainer?(u=r.parentNode)==null||u.insertBefore(m,r):t.startContainer.appendChild(m),r=m}let i=r;for(;i.parentElement&&i.parentElement!==e;){const m=i.parentElement;if(!ht(m)){i=m;continue}if(!n.some(g=>Ko(m,g))){i=m;continue}Gt(m,i);for(const g of n)if(Ko(m,g)){if(xn[g].has(m.tagName.toLowerCase())){We(m);break}if(fm(m,g),Wt(m)){We(m);break}}i=m.isConnected?m:r}return r}function ty(e,t,n){for(const r of Qe)n[r]!==t[r]&&(n[r]?mm(e,r):Zb(e,r))}function ny(e,t,n,r,i,a,l){var k,P;const u=window.getSelection();if(!u||u.rangeCount===0)return;const m=u.getRangeAt(0);if(!ae(e,m.commonAncestorContainer))return;const p=el(e,m),g=um(p,n),h=Qe.filter(N=>p[N]&&!g[N]),C=Ah(e,m.startContainer,i),y=Xg(e,m.startContainer,a);let x=null;h.length>0?(x=ey(e,m,h),C.length>0&&_d(e,x,C),y&&Va(e,x)):C.length>0?(x=kh(e,m,C),y&&Va(e,x)):y?x=Yg(e,m):m.deleteContents();const b=document.createElement("span");ty(b,p,g),r&&Ib(b,r),i!=null&&i.color&&Vc(b,"color",i.color),i!=null&&i.backgroundColor&&Vc(b,"backgroundColor",i.backgroundColor),a&&Gg(b,a),l&&Kb(b,l),b.textContent=t;const S=b.style.cssText.trim()?b:document.createTextNode(t);x?((k=x.parentNode)==null||k.insertBefore(S,x),x.nodeType===Node.TEXT_NODE&&!x.data&&((P=x.parentNode)==null||P.removeChild(x))):m.insertNode(S);const v=document.createRange();v.selectNodeContents(S),v.collapse(!1),u.removeAllRanges(),u.addRange(v)}const $o=["p","h1","h2","h3","h4","h5","h6"],ry=new Set($o),pm=new Set([...$o,"div"]),si=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),oy=()=>({tag:null,mixed:!1});function gm(e){return ry.has(e)}function iy(e){return gm(e)?e:e==="div"?"p":null}function ay(e){return e instanceof Element&&si.has(ce(e))}function hm(e){return e instanceof HTMLElement&&!gt(e)&&pm.has(ce(e))}function nl(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=ce(e);return pm.has(t)||si.has(t)?!1:ht(e)||t==="br"||t==="a"||t==="img"||t==="span"}function ly(e,t){let n=xr(t);for(;n&&n!==e;){if(si.has(ce(n)))return!0;n=n.parentElement}return!1}function bm(e,t){let n=xr(t);for(;n&&n!==e;){if(bd(n,e)){n=n.parentElement;continue}if(hm(n))return n;if(si.has(ce(n)))return null;n=n.parentElement}return null}function sy(e,t){const n=new Set,r=[];for(const i of Fl(t)){const a=bm(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function cy(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function uy(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&nl(n[i-1]);)i-=1;for(;a<n.length-1&&nl(n[a+1]);)a+=1;return n.slice(i,a+1)}function rl(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&>(t)))return t;return null}function dy(e,t,n){if(n.startContainer===e){const r=e.childNodes[Math.min(n.startOffset,Math.max(0,e.childNodes.length-1))]??e.firstChild;return r instanceof HTMLElement&>(r)?rl(e):r}return n.startContainer===t&&e!==t?rl(e):cy(e,n.startContainer)}function my(e,t,n){const r=Al(e);if(ly(e,t.startContainer))return!1;if(!rl(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const i=dy(r,e,t);if(!i||i instanceof HTMLElement&>(i)||ay(i)||hm(i)||!nl(i))return!1;const a=uy(r,i),l=document.createElement(n);r.insertBefore(l,a[0]);for(const u of a)l.appendChild(u);return!0}function fy(e){const t=bt(e);if(!t)return oy();const n=Fl(t).map(i=>{const a=bm(e,i);return a?iy(ce(a)):null}),r=n[0];return n.every(i=>i===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function py(e,t){if(!gm(t))return!1;const n=bt(e);if(!n)return!1;const r=An(e,n.startContainer,n.startOffset),i=An(e,n.endContainer,n.endOffset),a=Math.min(r,i),l=Math.max(r,i),u=sy(e,n);let m=!1;if(u.length===0)m=my(e,n,t);else for(const p of u)ce(p)!==t&&(Hl(p,t),m=!0);return Bl(e,a,l),m}function Ul(e){if(!Je(e))return null;const t=Pn(e);if(!t)return null;const n=ce(t);return n==="ul"||n==="ol"?n:null}function ym(e){const t=Nn(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Ul),r=n[0];return n.every(i=>i===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function gy(e,t,n){const r=[...e.children].filter(i=>Il(i));for(const i of r)t.insertBefore(i,n)}function xm(e){const t=Pn(e),n=document.createElement("p");for(const p of[...e.attributes])n.setAttribute(p.name,p.value);for(n.style.marginLeft="",it(n);e.firstChild&&!Il(e.firstChild);)n.appendChild(e.firstChild);const r=[];let i=e.nextElementSibling;for(;i;)r.push(i),i=i.nextElementSibling;const a=(t==null?void 0:t.parentNode)??e.parentNode;if(!t||!a)return e.replaceWith(n),n;const l=Je(a)?a.parentNode??a:a,u=Je(a)?a.nextSibling:t.nextSibling;e.remove();let m=null;if(r.length>0){m=document.createElement(t.tagName);for(const p of r)m.appendChild(p)}return l.insertBefore(n,u),m&&l.insertBefore(m,n.nextSibling),gy(e,l,n.nextSibling),t.childElementCount===0&&t.remove(),n}function hy(e){if(Je(e))return e;const t=Hl(e,"li");return t.style.marginLeft="",it(t),t}function Cm(e,t){if(e.length===0)return!1;if(e.every(Je)){const a=Pn(e[0]);if(a&&e.every(l=>l.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return ce(a)===t?!1:(Hl(a,t),!0)}const n=e[0],r=n.parentNode;if(!r)return!1;const i=document.createElement(t);r.insertBefore(i,n);for(const a of e){const l=Je(a)?Pn(a):null;i.appendChild(hy(a)),l&&l!==i&&l.childElementCount===0&&l.remove()}return!0}function wm(e){let t=!1;for(const n of[...e].reverse())Je(n)&&(xm(n),t=!0);return t}function by(e,t){return Tn(e,()=>{const n=Cr(e);if(n.length===0)return!1;if(n.every(a=>Ul(a)===t))return wm(n);let i=!1;for(const a of Rd(n))Cm(a,t)&&(i=!0);return i})}function yy(e,t){return Tn(e,()=>{const n=Cr(e);if(n.length===0)return!1;if(t===null)return wm(n);if(n.every(a=>Ul(a)===t))return!1;let i=!1;for(const a of Rd(n))Cm(a,t)&&(i=!0);return i})}const vm=40;function Wl(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Sm(e,t){if(t<=0){e.style.marginLeft="",it(e);return}e.style.marginLeft=`${t}px`}function xy(e){let t=e.previousElementSibling;for(;t;){if(Je(t))return t;t=t.previousElementSibling}return null}function Cy(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(ce(n)==="ul"||ce(n)==="ol"))return n}return null}function wy(e){const t=xy(e);if(!t)return!1;const n=Pn(e);if(!n)return!1;const r=ce(n)==="ol"?"ol":"ul";let i=Cy(t);return(!i||ce(i)!==r)&&(i=document.createElement(r),t.appendChild(i)),i.appendChild(e),!0}function vy(e){const t=Pn(e);if(!t)return!1;const n=t.parentElement;if(n&&Je(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return xm(e),!0}function Sy(e){return Nn(e).some(n=>Je(n)||Wl(n)>0)}function ky(e){return Tn(e,()=>{const t=Cr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Je(r)){wy(r)&&(n=!0);continue}Sm(r,Wl(r)+vm),n=!0}return n})}function Ay(e){return Tn(e,()=>{const t=Nn(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Je(r)){vy(r)&&(n=!0);continue}const i=Wl(r);i<=0||(Sm(r,Math.max(0,i-vm)),n=!0)}return n})}function ci(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function on(e,t,n){const r=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(n));r<=1?e.removeAttribute("colspan"):e.colSpan=r,i<=1?e.removeAttribute("rowspan"):e.rowSpan=i}function Ge(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let i=0;for(let a=0;a<t;a+=1){const l=e.rows[a];let u=0;for(const m of Array.from(l.cells)){for(;n[a][u];)u+=1;const p=ci(m),g={cell:m,originRow:a,originCol:u,rowSpan:p.rowSpan,colSpan:p.colSpan};r.push(g);for(let h=0;h<p.rowSpan;h+=1){const C=a+h;if(C>=t)break;for(let y=0;y<p.colSpan;y+=1)n[C][u+y]=g}u+=p.colSpan,i=Math.max(i,u)}i=Math.max(i,n[a].length)}return{table:e,slots:n,unique:r,rowCount:t,colCount:i}}function Uo(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function lt(e,t){return e.unique.find(n=>n.cell===t)??null}function km(e,t){return e.originRow<t.minRow||e.originCol<t.minCol||e.originRow+e.rowSpan-1>t.maxRow||e.originCol+e.colSpan-1>t.maxCol}function Am(e){if(e.length===0)return null;let t=1/0,n=-1/0,r=1/0,i=-1/0;for(const a of e)t=Math.min(t,a.originRow),n=Math.max(n,a.originRow+a.rowSpan-1),r=Math.min(r,a.originCol),i=Math.max(i,a.originCol+a.colSpan-1);return{minRow:t,maxRow:n,minCol:r,maxCol:i}}function Py(e,t){const n=new Set,r=[];for(let i=t.minRow;i<=t.maxRow;i+=1)for(let a=t.minCol;a<=t.maxCol;a+=1){const l=Uo(e,i,a);!l||n.has(l.cell)||(n.add(l.cell),r.push(l.cell))}return r}function Pm(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=Uo(e,t.minRow,t.minCol);if(!n||n.originRow!==t.minRow||n.originCol!==t.minCol)return null;const r=new Set,i=[];for(let a=t.minRow;a<=t.maxRow;a+=1)for(let l=t.minCol;l<=t.maxCol;l+=1){const u=Uo(e,a,l);if(!u||km(u,t))return null;r.has(u.cell)||(r.add(u.cell),i.push(u.cell))}return{origin:n,cells:i,colSpan:t.maxCol-t.minCol+1,rowSpan:t.maxRow-t.minRow+1}}function Dy(e,t,n,r){const i={minRow:t.originRow,maxRow:t.originRow+r-1,minCol:t.originCol,maxCol:t.originCol+n-1};if(i.maxRow>=e.rowCount||i.maxCol>=e.colCount)return!1;for(let a=i.minRow;a<=i.maxRow;a+=1)for(let l=i.minCol;l<=i.maxCol;l+=1){const u=Uo(e,a,l);if(!u)return!1;if(u.cell!==t.cell&&km(u,i))return!1}return!0}const eu=10,wn=1,vn=50,jy="1px solid #000",Ey="0.25em",Ry=new Set(["td","th"]);function Dm(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=wn&&t>=wn&&e<=vn&&t<=vn}function He(e,t){return Vl(e,t,n=>n instanceof HTMLTableElement)}function Wo(e,t){return Vl(e,t,n=>Oy(n))}function Ty(e,t){return Vl(e,t,n=>n instanceof HTMLTableRowElement)}function Gl(e){return He(e,Zl(e))}function yt(e){return Wo(e,Zl(e))}function jm(e){return Ty(e,Zl(e))}function Ny(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function wr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return[];const r=Wo(e,n.startContainer),i=Wo(e,n.endContainer);if(!r)return[];if(!i||r===i)return[r];const a=He(e,r);if(!a||He(e,i)!==a)return[r];const l=Ge(a),u=lt(l,r),m=lt(l,i);if(!u||!m)return[r];const p=Am([u,m]);if(!p)return[r];const g=Py(l,p);return g.length>0?g:[r]}function My(e,t){if(!Dm(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer))return!1;const i=document.createElement("table");i.style.borderCollapse="collapse",i.style.width="100%";const a=document.createElement("tbody");for(let u=0;u<t.rows;u+=1){const m=document.createElement("tr");for(let p=0;p<t.cols;p+=1)m.appendChild(Ky("td"));a.appendChild(m)}i.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(i),Gy(e,i);const l=i.querySelector("td, th");return l instanceof HTMLTableCellElement&&Be(l),!0}function ol(e,t){var h,C,y,x;const n=yt(e);if(!n)return!1;const r=He(e,n);if(!r)return!1;const i=Ge(r),a=lt(i,n);if(!a)return!1;const l=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const b of i.unique)if(b.originRow<l&&b.originRow+b.rowSpan>l){on(b.cell,b.colSpan,b.rowSpan+1);for(let S=b.originCol;S<b.originCol+b.colSpan;S+=1)u.add(S)}const m=document.createElement("tr"),p=Math.min(l,i.rowCount-1);for(let b=0;b<i.colCount;b+=1){if(u.has(b))continue;const S=((C=(h=i.slots[p])==null?void 0:h[b])==null?void 0:C.cell)??n;m.appendChild(ql(S))}if(l>=r.rows.length)(y=r.rows[r.rows.length-1].parentNode)==null||y.appendChild(m);else{const b=r.rows[l];(x=b.parentNode)==null||x.insertBefore(m,b)}const g=Uy(m,i.colCount,u,a.originCol);return Be(g||n),!0}function tu(e,t){var p,g,h,C;const n=yt(e);if(!n)return!1;const r=He(e,n);if(!r)return!1;const i=Ge(r),a=lt(i,n);if(!a)return!1;const l=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const y of i.unique)if(y.originCol<l&&y.originCol+y.colSpan>l){on(y.cell,y.colSpan+1,y.rowSpan);for(let x=y.originRow;x<y.originRow+y.rowSpan;x+=1)u.add(x)}let m=null;for(let y=0;y<i.rowCount;y+=1){if(u.has(y))continue;const x=((g=(p=i.slots[y])==null?void 0:p[Math.min(l,Math.max(0,i.colCount-1))])==null?void 0:g.cell)??((C=(h=i.slots[y])==null?void 0:h[Math.max(0,l-1)])==null?void 0:C.cell)??n,b=ql(x);Yl(r,y,l,b),y===a.originRow&&(m=b)}return m&&Be(m),!0}function _y(e){var C,y;const t=yt(e);if(!t)return!1;const n=He(e,t);if(!n)return!1;const r=Ge(n),i=lt(r,t);if(!i)return!1;if(r.rowCount<=1)return il(e,n);const a=i.originRow,l=a+1,u=[];for(const x of r.unique)x.originRow<=a&&x.originRow+x.rowSpan>a&&(x.originRow<a?on(x.cell,x.colSpan,x.rowSpan-1):x.originRow===a&&x.rowSpan>1&&u.push(x));u.sort((x,b)=>x.originCol-b.originCol);for(const x of u)on(x.cell,x.colSpan,x.rowSpan-1),Yl(n,l,x.originCol,x.cell);const m=i.originCol;n.rows[a].remove();const p=n.rows[Math.min(a,n.rows.length-1)],g=Ge(n),h=(y=(C=g.slots[Math.min(a,g.rowCount-1)])==null?void 0:C[Math.min(m,Math.max(0,g.colCount-1))])==null?void 0:y.cell;return h?Be(h):p!=null&&p.cells[0]?Be(p.cells[0]):Zy(n),!0}function Ly(e){var p,g,h;const t=yt(e);if(!t)return!1;const n=He(e,t);if(!n)return!1;const r=Ge(n),i=lt(r,t);if(!i)return!1;if(r.colCount<=1)return il(e,n);const a=i.originCol,l=i.originRow;for(const C of r.unique)a<C.originCol||a>=C.originCol+C.colSpan||(C.colSpan===1?C.cell.remove():on(C.cell,C.colSpan-1,C.rowSpan));const u=Ge(n);if(u.colCount===0||u.unique.length===0)return il(e,n);const m=((g=(p=u.slots[Math.min(l,u.rowCount-1)])==null?void 0:p[Math.min(a,u.colCount-1)])==null?void 0:g.cell)??((h=u.unique[0])==null?void 0:h.cell);return m&&Be(m),!0}function Iy(e,t){const n=yt(e);if(!n)return!1;const r=He(e,n);if(!r)return!1;const i=Ny(r),a=i.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Be(i[a-1]),{changed:!1});if(a<i.length-1)return Be(i[a+1]),{changed:!1};const l=n.parentElement;if(!ol(e,"below"))return!1;const u=l instanceof HTMLTableRowElement?l.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Be(u.cells[0]),{changed:!0}}function Fy(e,t){return!ae(e,t)||t===e?!1:(Be(t),!0)}function nu(e){return Em(e)!==null}function ru(e){const t=yt(e);if(!t)return!1;const n=ci(t);return n.colSpan>1||n.rowSpan>1}function By(e){const t=Em(e);if(!t)return!1;const n=He(e,t.origin.cell);return n?Rm(n,t):!1}function Hy(e){const t=yt(e);if(!t)return!1;const n=He(e,t);return n?Tm(n,t):!1}function zy(e,t,n){const r=yt(e);if(!r)return!1;const i=He(e,r);if(!i)return!1;const a=Ge(i),l=lt(a,r);if(!l)return!1;const u=Math.min(a.colCount-l.originCol,Math.max(1,Math.floor(t))),m=Math.min(a.rowCount-l.originRow,Math.max(1,Math.floor(n)));if(u===l.colSpan&&m===l.rowSpan||!Dy(a,l,u,m))return!1;if((l.colSpan>1||l.rowSpan>1)&&Tm(i,r),u===1&&m===1)return Be(r),!0;const p=Ge(i),g=Pm(p,{minRow:l.originRow,maxRow:l.originRow+m-1,minCol:l.originCol,maxCol:l.originCol+u-1});return g?Rm(i,g):!0}function Vl(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function Oy(e){return Ry.has(e.tagName.toLowerCase())}function Zl(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n.startContainer:null}function Em(e){const t=wr(e);if(t.length<2)return null;const n=He(e,t[0]);if(!n)return null;const r=Ge(n),i=[];for(const u of t){const m=lt(r,u);if(!m)return null;i.push(m)}const a=Am(i);if(!a)return null;const l=Pm(r,a);return!l||l.cells.length<2?null:l}function Rm(e,t){const n=t.origin.cell,r=Ge(e),i=t.cells.map(a=>lt(r,a)).filter(a=>a!==null).sort((a,l)=>a.originRow-l.originRow||a.originCol-l.originCol);for(const a of i)a.cell!==n&&Wy(n,a.cell);on(n,t.colSpan,t.rowSpan);for(const a of i)a.cell!==n&&a.cell.remove();return Be(n),!0}function Tm(e,t){const n=Ge(e),r=lt(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;on(t,1,1);for(let i=r.originRow;i<r.originRow+r.rowSpan;i+=1)for(let a=r.originCol;a<r.originCol+r.colSpan;a+=1)i===r.originRow&&a===r.originCol||Yl(e,i,a,ql(t));return Be(t),!0}function Ky(e){const t=document.createElement(e);return t.style.border=jy,t.style.padding=Ey,t.appendChild(document.createElement("br")),t}function ql(e){const t=e.cloneNode(!1);for(t.removeAttribute("colspan"),t.removeAttribute("rowspan");t.firstChild;)t.removeChild(t.firstChild);return t.appendChild(document.createElement("br")),t}function $y(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Yl(e,t,n,r){const i=e.rows[t];if(!i)return;const a=Ge(e);let l=0;for(const u of Array.from(i.cells)){if(u===r)continue;const m=lt(a,u);if(!m||m.originCol>=n)break;l+=1}$y(i,l,r)}function Uy(e,t,n,r){let i=0;for(let a=0;a<t;a+=1)if(!n.has(a)){if(a>=r)return e.cells[i]??null;i+=1}return e.cells[e.cells.length-1]??null}function ou(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol, hr")===null}function Wy(e,t){if(!(e===t||ou(t)))for(ou(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function Gy(e,t){var i;const n=t.parentElement;if(!n||n===e)return;const r=n.tagName.toLowerCase();r==="td"||r==="th"||(r==="p"||/^h[1-6]$/.test(r))&&((i=n.parentNode)==null||i.insertBefore(t,n.nextSibling),Vy(n)&&n.remove())}function Vy(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol")===null}function il(e,t){if(!t.parentNode||!ae(e,t))return!1;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),t.remove();const i=window.getSelection();return i&&(i.removeAllRanges(),i.addRange(r)),!0}function Be(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Zy(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const Nm=["left","center","right","justify"];function qy(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function Go(e){return qy(e.style.textAlign)}function al(e,t){const n=t??"left";return Go(e)===n?t===null&&e.style.textAlign?(e.style.removeProperty("text-align"),!0):!1:(t===null||t==="left"?e.style.removeProperty("text-align"):e.style.textAlign=t,!0)}function iu(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function Mm(e){const t=wr(e);if(t.length>0)return iu(t.map(Go));const n=Nn(e);return n.length===0?bt(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:iu(n.map(Go))}function _m(e,t){return Nm.includes(t)?Tn(e,()=>{const n=wr(e);if(n.length>0){let a=!1;for(const l of n)al(l,t)&&(a=!0);return a}const r=Cr(e);if(r.length===0)return!1;let i=!1;for(const a of r)al(a,t)&&(i=!0);return i}):!1}function lr(){return{...Kl(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function au(e){const t=Xh(e),n=Mm(e),r=ym(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function Lm(e,t){let n=!1;return!t.alignMixed&&t.align&&_m(e,t.align)&&(n=!0),t.listMixed||yy(e,t.list)&&(n=!0),Jh(e,t)&&(n=!0),n}function Yy(e,t){return Lm(e,ll(t))}function Im(e){return{align:e.alignMixed?void 0:e.align??"left",list:e.listMixed?void 0:e.list,margin:e.marginMixed?void 0:e.margin,padding:e.paddingMixed?void 0:e.padding,lineHeight:e.lineHeightMixed?void 0:e.lineHeight,border:e.borderMixed?void 0:e.border,borderRadius:e.radiusMixed?void 0:e.borderRadius,boxShadow:e.shadowMixed?void 0:e.boxShadow,backgroundColor:e.backgroundMixed?void 0:e.backgroundColor,opacity:e.opacityMixed?void 0:e.opacity,breakInside:e.breakInsideMixed?void 0:e.breakInside,breakAfter:e.breakAfterMixed?void 0:e.breakAfter,breakBefore:e.breakBeforeMixed?void 0:e.breakBefore}}function ll(e){const t=lr();return e?{align:e.align??t.align,alignMixed:e.align===void 0,list:e.list===void 0?t.list:e.list,listMixed:e.list===void 0,margin:e.margin??t.margin,marginMixed:e.margin===void 0,padding:e.padding??t.padding,paddingMixed:e.padding===void 0,lineHeight:e.lineHeight===void 0?t.lineHeight:e.lineHeight,lineHeightMixed:e.lineHeight===void 0,border:e.border??t.border,borderMixed:e.border===void 0,borderRadius:e.borderRadius===void 0?t.borderRadius:e.borderRadius,radiusMixed:e.borderRadius===void 0,boxShadow:e.boxShadow===void 0?t.boxShadow:e.boxShadow,shadowMixed:e.boxShadow===void 0,backgroundColor:e.backgroundColor===void 0?t.backgroundColor:e.backgroundColor,backgroundMixed:e.backgroundColor===void 0,opacity:e.opacity===void 0?t.opacity:e.opacity,opacityMixed:e.opacity===void 0,breakInside:e.breakInside===void 0?t.breakInside:e.breakInside,breakInsideMixed:e.breakInside===void 0,breakAfter:e.breakAfter===void 0?t.breakAfter:e.breakAfter,breakAfterMixed:e.breakAfter===void 0,breakBefore:e.breakBefore===void 0?t.breakBefore:e.breakBefore,breakBeforeMixed:e.breakBefore===void 0}:{...t,alignMixed:!0,listMixed:!0,marginMixed:!0,paddingMixed:!0,lineHeightMixed:!0,borderMixed:!0,radiusMixed:!0,shadowMixed:!0,backgroundMixed:!0,opacityMixed:!0,breakInsideMixed:!0,breakAfterMixed:!0,breakBeforeMixed:!0}}const Fm="data-page-sized",Xy={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function Bm(e){let t=null;if(e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal")t={...Xy[e.sizePreset]};else if(e.sizePreset==="custom"&&e.customWidth&&e.customHeight)t={width:pe(e.customWidth),height:pe(e.customHeight)};else return e.orientation,null;return e.orientation==="landscape"?{width:t.height,height:t.width}:t}function Jy(e){return Bm(e)!==null}function Qy(e){return ex(e.margin)}function ex(e){return{top:e.top?pe(e.top):null,right:e.right?pe(e.right):null,bottom:e.bottom?pe(e.bottom):null,left:e.left?pe(e.left):null}}const tx=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function nx(e){e.removeAttribute(Fm);for(const t of tx)e.style.removeProperty(t)}function fr(e,t){const n=ai(t),r=Bm(n);if(!r){nx(e);return}e.setAttribute(Fm,""),e.style.width=r.width,e.style.minHeight=r.height;const i=Qy(n);for(const a of Me){const l=`padding-${a}`,u=i[a];u?e.style.setProperty(l,u):e.style.removeProperty(l)}}const rx=2*1024*1024,ox="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",ix=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),ax=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),lx=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,sx=/^(javascript|vbscript|file|blob):/i;function cx(e={}){return{src:"",alt:"",title:"",...e}}function Ln(e){const t=e.trim();if(!t)return"empty";if(sx.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return lx.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function ux(e){return e.size>rx?"tooLarge":gx(e)?null:"type"}function dx(e){const t=ux(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(Ln(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function mx(e,t){e.setAttribute("src",t.src.trim());const n=t.alt.trim(),r=t.title.trim();n?e.setAttribute("alt",n):e.removeAttribute("alt"),r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",fx(e,t.css)}function fx(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function px(e,t){const n=cx(t);if(Ln(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ae(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("img");return mx(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function sl(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Ra(e,t){if(!ae(e,t)||t===e)return!1;const n=document.createRange();n.selectNode(t);const r=window.getSelection();return r?(r.removeAllRanges(),r.addRange(n),!0):!1}function gx(e){const t=e.type.trim().toLowerCase();if(t&&ix.has(t))return!0;const n=hx(e.name);return!!(!t&&n&&ax.has(n))}function hx(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Hm=["%","px","pt","pc","em","rem"],bx="%",yx={"%":[25,50,75,100,125,150,200],px:[50,100,150,200,300,400,600,800],pt:[36,48,72,96,144,192,288],pc:[3,4,6,8,12,16,24],em:[2,4,6,8,12,16,24],rem:[2,4,6,8,12,16,24]},En={"%":{min:1,max:1e3},px:{min:1,max:4e3},pt:{min:1,max:3e3},pc:{min:.1,max:250},em:{min:.1,max:200},rem:{min:.1,max:200}},xx=new Set(Hm),Cx=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function wx(e){return xx.has(e)}function Sn(e){return`${Q(e.value)}${e.unit}`}function Vo(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(Cx);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return wx(i)?Rn(r,i):null}function lu(e,t){const n=e.trim();if(!n)return null;const r=Vo(n);if(r)return r;const i=Number(n.replace(",","."));return Number.isFinite(i)?Rn(i,t):null}function Rn(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=En[t];return{value:Ee(Math.min(r,Math.max(n,e))),unit:t}}function sr(e,t,n){const r=n>0?n:1;if(e==="width"){const a=Rn(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:Rn(t.value*r,t.unit)??t,height:t}}const Ro="data-hover-css",Xl=["fill","contain","cover","none","scale-down"],Jl=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],vx=new Set(Xl),Sx=new Set(Jl),su="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",kx="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",Ax=/^-?[a-z][a-z0-9-]*$/i,Px=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,cl=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function zm(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...at},border:{...Ol},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function Dx(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function jx(e,t){const n=e.objectFit;if(n!=="cover"&&n!=="contain"&&n!=="fill"||e.width&&e.height||!e.width&&!e.height)return e;if(e.width){const r=sr("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=sr("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function Ex(e){const t=[];for(const n of e.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim().toLowerCase(),l=r.slice(i+1).trim();!a||!l||Ax.test(a)&&(a==="behavior"||a.endsWith("binding")||Px.test(l)||t.push(`${a}: ${l}`))}return t.join("; ")}function Ht(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return null;if(n.startContainer instanceof HTMLImageElement)return n.startContainer;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const r=n.startContainer.childNodes[n.startOffset];if(r instanceof HTMLImageElement&&ae(e,r))return r}return sl(e,n.commonAncestorContainer)}function Rx(e){const t=Ht(e);return t?Om(t):null}function Om(e){const t=Mn(e),n=Lx(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,i=Nx(e);return zm({sizeMode:i.sizeMode,width:i.width,height:i.height,align:n,margin:r,border:t.border,borderRadius:t.borderRadius,boxShadow:t.boxShadow,opacity:t.opacity,objectFit:$m(e),objectPosition:Hx(e),rotateDeg:Um(e),hoverCss:e.getAttribute(Ro)??""})}function Km(e,t){let n=!1;return Mx(e,t)&&(n=!0),_n(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:at,paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:t.opacity,opacityMixed:!1})&&(n=!0),Ix(e,t.align)&&(n=!0),Fx(e,t.objectFit)&&(n=!0),Bx(e,t.objectPosition)&&(n=!0),Ox(e,t.rotateDeg)&&(n=!0),Kx(e,t.hoverCss)&&(n=!0),n}function Tx(e,t){const n=Ht(e);return n?Km(n,t):!1}function Nx(e){const t=Vo(e.style.width),n=Vo(e.style.height);return t&&n?{sizeMode:"lock",width:t,height:n}:n&&!t?{sizeMode:"height",width:null,height:n}:{sizeMode:"width",width:t,height:null}}function Mx(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=_x(t);return r.width?e.style.width=Sn(r.width):e.style.removeProperty("width"),r.height?e.style.height=Sn(r.height):e.style.height="auto",r.width||r.height?e.style.removeProperty("max-width"):e.style.maxWidth="100%",n.width!==e.style.width||n.height!==e.style.height||n.maxWidth!==e.style.maxWidth}function _x(e){return e.sizeMode==="width"?{sizeMode:"width",width:e.width,height:null}:e.sizeMode==="height"?{sizeMode:"height",width:null,height:e.height}:{sizeMode:"lock",width:e.width,height:e.height}}function Lx(e){const t=e.style.float.trim().toLowerCase();if(t==="left")return"left";if(t==="right")return"right";const n=e.style.display.trim().toLowerCase(),r=e.style.marginLeft.trim().toLowerCase(),i=e.style.marginRight.trim().toLowerCase();return n==="block"&&r==="auto"&&i==="auto"?"center":null}function Ix(e,t){const n={float:e.style.float,display:e.style.display,marginLeft:e.style.marginLeft,marginRight:e.style.marginRight};return t==="left"?(e.style.float="left",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="right"?(e.style.float="right",e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")):t==="center"?(e.style.removeProperty("float"),e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto"):(e.style.removeProperty("float"),e.style.display.trim().toLowerCase()==="block"&&e.style.removeProperty("display"),e.style.marginLeft.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-left"),e.style.marginRight.trim().toLowerCase()==="auto"&&e.style.removeProperty("margin-right")),n.float!==e.style.float||n.display!==e.style.display||n.marginLeft!==e.style.marginLeft||n.marginRight!==e.style.marginRight}function $m(e){const t=e.style.objectFit.trim().toLowerCase();return vx.has(t)?t:null}function Fx(e,t){return $m(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function Bx(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.objectPosition=n:e.style.removeProperty("object-position"),!0)}function Hx(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Sx.has(t),t):null}function Um(e){const t=cl.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?Ee(n):null}function zx(e){const t=e.trim();return t?cl.test(t)&&t.replace(cl,"").trim()==="":!0}function Ox(e,t){const n=Um(e),r=t===null||t===0?null:Ee(t);return n===r?!1:r===null?zx(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${Q(r)}deg)`,!0)}function Kx(e,t){const n=Ex(t),r=e.getAttribute(Ro)??"",i=e.getAttribute("onmouseover")??"";return r===n&&(n&&i===su||!n&&!i)?!1:n?(e.setAttribute(Ro,n),e.setAttribute("onmouseover",su),e.setAttribute("onmouseout",kx),!0):(e.removeAttribute(Ro),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const kn={value:100,unit:"%"},$x=new Set(Xl),Ux=new Set(Jl),Wx=new Set(["cover","contain","scale-down","none"]),cu={contain:"contain",cover:"cover",auto:"none"},uu={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function Ql(){return{src:null,opacity:null,fit:null,position:null,width:{...kn},height:null}}function Wm(e){return e!=null&&Wx.has(e)}function Gm(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?Ot(n):null}function Gx(e,t){const n=Gm(e),r=t===null?null:Ot(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Ud(r),!0)}function Vm(e){const t=e.style.backgroundImage.trim();if(!t||t==="none")return null;const n=/^url\(\s*["']?(.+?)["']?\s*\)$/i.exec(t);return n&&n[1].trim()||null}function Vx(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function Zx(e,t){const n=Vm(e),r=(t==null?void 0:t.trim())??"",i=r&&Ln(r)===null?r:null;return n===i?!1:(i?e.style.backgroundImage=Vx(i):e.style.removeProperty("background-image"),!0)}function Zm(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Ta(e){return!e||e==="auto"?null:Vo(e)}function qx(e){return Wm(e.fit)&&e.fit?uu[e.fit]:e.fit==="fill"?uu.fill:e.width&&e.height?`${Sn(e.width)} ${Sn(e.height)}`:e.width?Sn(e.width):e.height?`auto ${Sn(e.height)}`:null}function Yx(e){const t=Zm(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...kn},height:{...kn}};if(cu[t])return{fit:cu[t],width:null,height:null};if($x.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:Ta(n[0]),height:null}:n.length===2?{fit:null,width:Ta(n[0]),height:Ta(n[1])}:{fit:null,width:null,height:null}}function Xx(e,t){const n=Zm(e.style.backgroundSize),r=qx(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function Jx(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Ux.has(t),t):null}function Qx(e,t){const n=(t==null?void 0:t.trim().toLowerCase().replace(/\s+/g," "))||"";return e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ")===n?!1:(n?e.style.backgroundPosition=n:e.style.removeProperty("background-position"),!0)}function ul(e){let t=!1;return e.id!==Mo&&(e.id=Mo,t=!0),e.hasAttribute(No)||(e.setAttribute(No,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function qm(e){const t=e.getAttribute("style");return e.style.position="absolute",e.style.inset="0",e.style.zIndex="-1",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.getAttribute("style")!==t}function e1(e){const t=Sl(e),n=t[0]??null;if(n){let i=ul(n);for(const a of t.slice(1))a.remove(),i=!0;return(n.parentNode!==e||n!==e.firstChild)&&(e.insertBefore(n,e.firstChild),i=!0),{layer:n,changed:i}}const r=document.createElement("div");return ul(r),qm(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function t1(e){const t=Sl(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function du(e){let t=!1;return kl(e)?(e.style.position!=="relative"&&(e.style.position="relative",t=!0),e.style.isolation!=="isolate"&&(e.style.isolation="isolate",t=!0)):(e.style.position==="relative"&&(e.style.removeProperty("position"),t=!0),e.style.isolation==="isolate"&&(e.style.removeProperty("isolation"),t=!0)),t}function n1(e){const t=kl(e);if(!t)return Ql();const n=Yx(t);return{src:Vm(t),opacity:Gm(t),fit:n.fit,position:Jx(t),width:n.width,height:n.height}}function r1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&Ln(n)===null)){const m=t1(e),p=du(e);return(m||p)&&it(e),m||p}const i=e1(e),a=i.layer;let l=i.changed;return ul(a)&&(l=!0),qm(a)&&(l=!0),du(e)&&(l=!0),Zx(a,n)&&(l=!0),Xx(a,t)&&(l=!0),Qx(a,t.position)&&(l=!0),Gx(a,t.opacity)&&(l=!0),l&&(it(a),it(e)),l}function o1(){return{size:null,unit:tn,marks:Et(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function dl(){return{font:o1(),box:Kl(),backgroundImage:Ql(),atRule:rn()}}function i1(e){const t=e.style.fontSize,n=t?Tl(t):null,r=n&&oi(n.unit)?{value:n.value,unit:n.unit}:null,i=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),l={bold:a==="bold"||Number(a)>=700,italic:e.style.fontStyle.trim().toLowerCase()==="italic",underline:/\bunderline\b/.test(i),strikethrough:/\bline-through\b/.test(i)},u=e.style.color,m=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??tn,marks:l,fontFamily:m||null,fontFamilyMixed:!1,fontColor:u?xe(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function a1(e,t){const n=e.style.fontSize,r=t.size===null?null:nn(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const i=Rl(r.value,r.unit);return n===i?!1:(e.style.fontSize=i,!0)}function l1(e,t){var i;if(t.fontFamilyMixed)return!1;const n=(i=t.fontFamily)!=null&&i.trim()?t.fontFamily.trim():null,r=e.style.fontFamily.trim()||null;return yr(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function s1(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?xe(t.fontColor):null;return(e.style.color?xe(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function c1(e,t){let n=!1;const r=t.bold?"bold":"";e.style.fontWeight!==r&&(r?e.style.fontWeight=r:e.style.removeProperty("font-weight"),n=!0);const i=t.italic?"italic":"";e.style.fontStyle!==i&&(i?e.style.fontStyle=i:e.style.removeProperty("font-style"),n=!0);const a=[];t.underline&&a.push("underline"),t.strikethrough&&a.push("line-through");const l=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==l&&(l?e.style.textDecoration=l:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function u1(e,t){let n=!1;return a1(e,t)&&(n=!0),l1(e,t)&&(n=!0),s1(e,t)&&(n=!0),c1(e,t.marks)&&(n=!0),n&&it(e),n}function d1(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function m1(e){const t=hr(e);if(!t)return dl();const n=Mn(t);return{font:i1(t),box:{margin:n.margin,marginMixed:!1,padding:n.padding,paddingMixed:!1,lineHeight:n.lineHeight,lineHeightMixed:!1,border:n.border,borderMixed:!1,borderRadius:n.borderRadius,radiusMixed:!1,boxShadow:n.boxShadow,shadowMixed:!1,backgroundColor:n.backgroundColor,backgroundMixed:!1,opacity:n.opacity,opacityMixed:!1},backgroundImage:n1(t),atRule:ai(e.innerHTML)}}function f1(e,t){const n=bt(e),r=n?An(e,n.startContainer,n.startOffset):null,i=n?An(e,n.endContainer,n.endOffset):null,a=hr(e),l=Ag(e);jo(l);const u=u1(l,t.font),m=_n(l,d1(t)),p=r1(l,t.backgroundImage);ti(e),fr(e,e.innerHTML);const g=ai(e.innerHTML),h=lb(e.innerHTML,t.atRule);h!==e.innerHTML&&(e.innerHTML=h,fr(e,e.innerHTML));const C=JSON.stringify(g)!==JSON.stringify(t.atRule);return r!==null&&i!==null&&Bl(e,Math.min(r,i),Math.max(r,i)),!a||u||m||p||C}function p1(e){const t=Qd(e.innerHTML);return t===e.innerHTML?!1:(e.innerHTML=t,ti(e),fr(e,e.innerHTML),!0)}const es="data-hover-html",g1="noopener noreferrer",h1="var n=this._hoverBox;if(!n){n=document.createElement('div');n.style.cssText='position:absolute;z-index:2147483646;background:#fff;border:1px solid #c8c8c8;border-radius:4px;padding:0.35rem 0.5rem;color:#222;max-width:18rem';this._hoverBox=n}n.innerHTML=this.getAttribute('data-hover-html')||'';var r=this.getBoundingClientRect();n.style.left=r.left+window.scrollX+'px';n.style.top=r.bottom+4+window.scrollY+'px';document.body.appendChild(n)",b1="this._hoverBox&&this._hoverBox.remove()",y1=/^(#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*(?:0|0?\.\d+|1))?\s*\))$/;function ui(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function x1(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function pr(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&x1(n))return n;n=n.parentNode}return null}function Ym(e){return y1.test(e)}function C1(e){var i;const t=e.getAttribute("onmouseover")??"",n=/this\.style\.color\s*=\s*'([^']+)'/.exec(t),r=((i=n==null?void 0:n[1])==null?void 0:i.trim())??"";return r&&Ym(r)?r:null}function Xm(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function w1(e){const t=e.getAttribute(es)??"",n=C1(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:Xm(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function Jm(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!ae(e,n.commonAncestorContainer))return null;const r=pr(e,n.commonAncestorContainer);return r?w1(r):null}function v1(e){return Jm(e)!==null}function S1(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(es)}function k1(e,t){var r;if(S1(e),t.hoverMode==="html"){const i=t.hoverHtml.trim();if(!i)return;e.setAttribute(es,i),e.setAttribute("onmouseover",h1),e.setAttribute("onmouseout",b1);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!Ym(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function ts(e,t){const n=ui(t);e.setAttribute("href",n.href);const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),n.targetBlank?(e.setAttribute("target","_blank"),e.setAttribute("rel",g1)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":Xm(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),k1(e,n)}function A1(e,t){const n=new Set;for(const r of t){const i=pr(e,r);i&&!n.has(i)&&n.add(i)}for(const r of n)We(r)}function P1(e,t,n){pt(t);const r=ze(t).filter(u=>u.data.length>0);A1(e,r),r.length>0&&an(r);const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);pt(a);const l=document.createElement("a");ts(l,n);try{return a.surroundContents(l),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(l.appendChild(u),a.insertNode(l),!0):!1}}function D1(e,t){const n=document.createElement("a");ts(n,t),n.textContent=t.href,e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();return r==null||r.removeAllRanges(),r==null||r.addRange(e),!0}function j1(e,t){const n=t.href.trim();if(!n)return!1;const r=ui({...t,href:n}),i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!ae(e,a.commonAncestorContainer))return!1;const l=pr(e,a.startContainer),u=pr(e,a.endContainer);return l&&l===u?(ts(l,r),!0):a.collapsed?D1(a,r):P1(e,a,r)}const E1=/^[A-Za-z][A-Za-z0-9_-]*$/,Qm="";function ml(e){var r;const t=Al(e),n=new Set;for(const i of t.querySelectorAll("[id]")){if(i===t)continue;const a=i.id.trim();a&&n.add(a)}for(const i of t.querySelectorAll("a[name]")){const a=(r=i.getAttribute("name"))==null?void 0:r.trim();a&&n.add(a)}return[...n].sort((i,a)=>i.localeCompare(a)).map(i=>({id:i}))}function R1(e){return new Set(ml(e).map(t=>t.id))}function ef(e,t){const n=e.trim();return n?E1.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function mu(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Qm)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function T1(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Qm)),(r=e.parentNode)==null||r.insertBefore(n,e)}function N1(e,t){const n=t.trim();if(ef(n,R1(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ae(e,i.commonAncestorContainer))return!1;const a=pr(e,i.startContainer);if(a)return T1(a,n),!0;if(i.collapsed)return mu(i,n),!0;pt(i);const l=document.createElement("span");l.id=n;try{return i.surroundContents(l),!0}catch{return mu(i,n),!0}}const Re="data-comment-thread",fu="wysiwyg-comment-anchor";function M1(){return`cmt_${crypto.randomUUID()}`}function _1(){return crypto.randomUUID()}const Zo=20;function pu(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${Re}]`);return r instanceof HTMLElement&&ae(t,r)?r:null}function gu(e,t,n){var C;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let i=Math.max(0,t),a=Math.max(t,n),l=null,u=0,m=null,p=0,g;for(;g=r.nextNode();){const y=g,x=((C=y.textContent)==null?void 0:C.length)??0;if(!l&&i<=x&&(l=y,u=i),!m&&a<=x){m=y,p=a;break}i-=x,a-=x}if(!l||!m)return null;const h=document.createRange();return h.setStart(l,u),h.setEnd(m,p),h}function L1(e,t,n){const r=e.textContent??"",i=r.slice(Math.max(0,t-Zo),t),a=r.slice(n,n+Zo);return{prefix:i,suffix:a}}function I1(e,t){if(t.mode!=="visual")return null;const n=Ht(e);if(n)return{type:"image",elementId:n.id||void 0,src:n.getAttribute("src")??void 0};if(t.collapsed&&!t.text)return null;const{prefix:r,suffix:i}=L1(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:i}}function hu(e,t){if(t.mode!=="visual")return null;const n=Ht(e);if(n!=null&&n.hasAttribute(Re))return n.getAttribute(Re)??null;if(t.visualRange){const r=pu(t.visualRange.startContainer,e);if(r)return r.getAttribute(Re)??null;const i=pu(t.visualRange.endContainer,e);if(i)return i.getAttribute(Re)??null}return null}function fl(e,t,n){if(!ae(e,n.commonAncestorContainer))return!1;pt(n);const r=document.createElement("span");r.setAttribute(Re,t);try{return n.surroundContents(r),!0}catch{const i=n.toString();if(!i)return!1;const a=document.createElement("span");return a.setAttribute(Re,t),a.textContent=i,n.deleteContents(),n.insertNode(a),!0}}function tf(e,t){e.setAttribute(Re,t)}function F1(e,t,n){const r=Ht(e);return r?(tf(r,t),!0):n.visualRange?fl(e,t,n.visualRange):!1}function B1(e,t){if(t.type!=="image")return null;for(const n of e.querySelectorAll("img"))if(t.elementId&&n.id===t.elementId||t.src&&n.getAttribute("src")===t.src)return n;return null}function H1(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const l=gu(e,n.start,n.end);if(l&&l.toString()===n.text)return fl(e,t,l)}const r=e.textContent??"",i=n.text;if(!i)return!1;let a=0;for(;a<=r.length;){const l=r.indexOf(i,a);if(l===-1)return!1;const u=l+i.length,m=r.slice(Math.max(0,l-Zo),l),p=r.slice(u,u+Zo);if(n.prefix!==void 0&&m!==n.prefix){a=l+1;continue}if(n.suffix!==void 0&&p!==n.suffix){a=l+1;continue}const g=gu(e,l,u);return g?fl(e,t,g):!1}return!1}function z1(e,t){for(const n of t)if(!e.querySelector(`[${Re}="${n.id}"]`)){if(n.anchor.type==="image"){const i=B1(e,n.anchor);i&&tf(i,n.id);continue}H1(e,n.id,n.anchor)}}function bu(e,t){for(const n of e.querySelectorAll(`[${Re}]`))n instanceof HTMLElement&&(t?n.classList.add(fu):n.classList.remove(fu))}function yu(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${Re}]`);return r instanceof HTMLElement&&ae(e,r)?r:null}function xu(e,t){const n=e.querySelector(`[${Re}="${t}"]`);if(!(n instanceof HTMLElement))return!1;const r=window.getSelection();if(!r)return!1;const i=document.createRange();if(n instanceof HTMLImageElement)i.selectNode(n);else{const l=document.createTreeWalker(n,NodeFilter.SHOW_TEXT).nextNode();l instanceof Text?(i.setStart(l,0),i.collapse(!0)):(i.selectNodeContents(n),i.collapse(!0))}return r.removeAllRanges(),r.addRange(i),!0}function O1(e,t=[]){return{id:M1(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function K1(e,t){return{id:_1(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function $1(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function U1(e,t){return e.find(n=>n.id===t)}function nf(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ae(e,n.commonAncestorContainer)?n:null}function W1(e){const t=nf(e);if(!t||t.collapsed)return null;const n=document.createElement("div");n.appendChild(t.cloneContents());const r=n.innerHTML;if(!r)return null;let i=t.toString();if(!i){const a=n.querySelector("img");i=(a==null?void 0:a.getAttribute("alt"))??(a==null?void 0:a.getAttribute("src"))??""}return{html:r,text:i}}function rf(e){const t=nf(e);if(!t||t.collapsed)return!1;t.deleteContents();const n=window.getSelection();return n==null||n.removeAllRanges(),n==null||n.addRange(t),!0}async function G1(e){const t=navigator.clipboard;if(!t)return!1;try{if(typeof ClipboardItem=="function"&&typeof t.write=="function"){const n=new ClipboardItem({"text/plain":new Blob([e.text],{type:"text/plain"}),"text/html":new Blob([e.html],{type:"text/html"})});return await t.write([n]),!0}if(typeof t.writeText=="function")return await t.writeText(e.text),!0}catch{if(typeof t.writeText=="function")try{return await t.writeText(e.text),!0}catch{return!1}return!1}return!1}async function of(e){const t=W1(e);return t?G1(t):!1}async function V1(e){return await of(e)?rf(e):!1}const Z1=new Set(["strong","b","em","i","u","s","strike","del"]),q1=["font","font-weight","font-style","font-family","font-size","color","background","background-color","text-decoration","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness"];function Y1(e){for(const t of q1)e.style.removeProperty(t)}function X1(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!ht(r)){n=r;continue}if(Gt(r,n),Z1.has(r.tagName.toLowerCase())){We(r);continue}if(Y1(r),Wt(r)){We(r);continue}n=r.isConnected?r:t}}function J1(e){const t=bt(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;pt(t);const r=ze(t).filter(i=>i.data.length>0);if(r.length===0)return!1;for(const i of r)X1(e,i);return an(r),e.innerHTML!==n}function Q1(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function eC(e){const t=Cn(e),n=im(e),r=Ad(e),i=Fo(e,"color"),a=Fo(e,"backgroundColor"),l=lm(e);return{size:n.mixed?null:n.value,unit:n.unit,marks:t,fontFamily:r.mixed?null:r.value,fontFamilyMixed:r.mixed,fontColor:i.mixed?null:i.value,fontColorMixed:i.mixed,highlightColor:a.mixed?null:a.value,highlightColorMixed:a.mixed,customCss:l.mixed?null:l.value,customCssMixed:l.mixed}}function tC(e,t){t.size!==null&&Ja(e,t.size,t.unit);const n=Cn(e);for(const r of Qe)t.marks[r]!==n[r]&&tl(e,r);return t.fontFamilyMixed||Ga(e,t.fontFamily),t.fontColorMixed||ar(e,"color",t.fontColor),t.highlightColorMixed||ar(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&cm(e,t.customCss),!0}function To(){return typeof window<"u"&&"speechSynthesis"in window}function nC(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function Cu(e,t){const n=e.text.trim();return n||nC(t)||null}function rC(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!To())return;if(t.speaking){t.cancel(),n();return}const i=new SpeechSynthesisUtterance(r);i.onend=n,i.onerror=n,t.speak(i),n()},isSpeaking(){return To()&&t.speaking},cancel(){To()&&t.speaking&&(t.cancel(),n())}}}const oC=5*1024*1024,iC="audio/mpeg,audio/mp3,audio/wav,audio/x-wav,audio/ogg,audio/aac,audio/webm,audio/mp4,audio/x-m4a,.mp3,.wav,.ogg,.aac,.webm,.m4a",aC=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),lC=new Set(["mp3","wav","ogg","aac","webm","m4a"]),sC=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,cC=/^(javascript|vbscript|file|blob):/i;function uC(e={}){return{src:"",title:"",...e}}function ns(e){const t=e.trim();if(!t)return"empty";if(cC.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return sC.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function dC(e){return e.size>oC?"tooLarge":hC(e)?null:"type"}function mC(e){const t=dC(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(ns(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function fC(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",pC(e,t.css)}function pC(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function gC(e,t){const n=uC(t);if(ns(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ae(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("audio");return fC(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function hC(e){const t=e.type.trim().toLowerCase();if(t&&aC.has(t))return!0;const n=bC(e.name);return!!(!t&&n&&lC.has(n))}function bC(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const af=/^(javascript|vbscript|file|blob):/i,yC=[/(?:youtube\.com\/watch\?(?:[^&]*&)*v=|youtube\.com\/watch\?v=)([\w-]{11})/i,/youtu\.be\/([\w-]{11})/i,/youtube\.com\/embed\/([\w-]{11})/i,/youtube\.com\/shorts\/([\w-]{11})/i];function xC(e={}){return{url:"",title:"",...e}}function CC(e={}){return{src:"",title:"",...e}}function di(e){const t=e.trim();if(!t)return null;for(const n of yC){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function lf(e){return`https://www.youtube.com/embed/${e}`}function sf(e){const t=e.trim();return t?af.test(t)?"invalid":di(t)?null:"invalid":"empty"}function wC(e){const t=e.trim();if(!t)return"empty";if(af.test(t))return"invalid";if(di(t))return null;if(t.toLowerCase().startsWith("data:"))return/^data:video\//i.test(t)?null:"invalid";if(/^[a-z][a-z0-9+.-]*:/i.test(t)){const n=t.slice(0,t.indexOf(":")).toLowerCase();return n==="http"||n==="https"?null:"invalid"}return null}function cf(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const i=r.indexOf(":");if(i<=0)continue;const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&e.style.setProperty(a,l)}}function uf(e,t,n){e.setAttribute("src",t),e.setAttribute("frameborder","0"),e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),e.setAttribute("allowfullscreen","");const r=n.title.trim();r?e.setAttribute("title",r):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.width="560px",e.style.aspectRatio="16 / 9",e.style.border="0",cf(e,n.css)}function vC(e,t){e.setAttribute("controls",""),e.setAttribute("src",t.src.trim());const n=t.title.trim();n?e.setAttribute("title",n):e.removeAttribute("title"),e.style.maxWidth="100%",cf(e,t.css)}function SC(e,t){const n=xC(t);if(sf(n.url))return!1;const r=di(n.url);if(!r)return!1;const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!ae(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const l=document.createElement("iframe");return uf(l,lf(r),n),a.insertNode(l),a.setStartAfter(l),a.collapse(!0),i.removeAllRanges(),i.addRange(a),!0}function kC(e,t){const n=CC(t);if(wC(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ae(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=di(n.src);if(a){const l=document.createElement("iframe");uf(l,lf(a),{title:n.title,css:n.css}),i.insertNode(l),i.setStartAfter(l)}else{const l=document.createElement("video");vC(l,n),i.insertNode(l),i.setStartAfter(l)}return i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}const AC=new Set(["p","h1","h2","h3","h4","h5","h6"]),PC=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function df(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ae(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const i=DC(e,r.startContainer);if(i){const l=jC(i,r);return(a=i.parentNode)==null||a.insertBefore(t,l),vu(t),!0}return r.insertNode(t),EC(e,t),NC(t),vu(t),!0}function DC(e,t){let n=xr(t);for(;n&&n!==e;){const r=ce(n);if(AC.has(r)&&n instanceof HTMLElement)return n;if(PC.has(r))return null;n=n.parentElement}return null}function jC(e,t){var a;const n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(e,e.childNodes.length);const r=n.extractContents(),i=e.cloneNode(!1);return i.appendChild(r),wu(e),wu(i),(a=e.parentNode)==null||a.insertBefore(i,e.nextSibling),i}function EC(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!RC(n))return;Gt(n,t),We(n)}}function RC(e){const t=ce(e);return ht(e)||t==="a"}function wu(e){TC(e)&&e.appendChild(document.createElement("br"))}function TC(e){var t;return e.childNodes.length===0||e.childNodes.length===1&&((t=e.firstChild)==null?void 0:t.nodeName)==="BR"?!0:(e.textContent??"").trim().length===0&&e.querySelector("img, table, ul, ol, hr")===null}function NC(e){var n;if(e.nextSibling)return;const t=document.createElement("p");t.appendChild(document.createElement("br")),(n=e.parentNode)==null||n.insertBefore(t,e.nextSibling)}function vu(e){const t=e.nextSibling,n=document.createRange();t instanceof HTMLElement||t?(n.setStart(t,0),n.collapse(!0)):(n.setStartAfter(e),n.collapse(!0));const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}const MC="1em 0",_C="1px solid #d0d0d0";function LC(){const e=document.createElement("hr");return e.style.margin=MC,e.style.border="0",e.style.borderTop=_C,e}function IC(e){return df(e,LC())}const FC="1.5em 0",BC="2px dashed #bbb";function HC(){const e=document.createElement("div");return e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=FC,e.style.border="0",e.style.borderTop=BC,e.style.height="0",e}function zC(e){return df(e,HC())}const Tt=16;function Su(e){return Math.min(En.px.max,Math.max(Tt,e))}function OC(e){return e.width>0&&e.height>0?e.width/e.height:1}function KC(e,t){const n=Math.max(Tt,Tt*t),r=Math.min(En.px.max,En.px.max*t),i=Math.min(r,Math.max(n,e));return{width:i,height:i/t}}function $C(e,t){const n=Math.max(Tt,Tt/t),r=Math.min(En.px.max,En.px.max/t),i=Math.min(r,Math.max(n,e));return{width:i*t,height:i}}function UC(e,t,n){const r=OC(t);return e==="e"?KC(t.width+n.x,r):e==="s"?$C(t.height+n.y,r):{width:Su(t.width+n.x),height:Su(t.height+n.y)}}function WC(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Tt,height:r>0?r:Tt}}function GC(e,t,n){const r=Rn(Math.max(Tt,t),"px"),i=Rn(Math.max(Tt,n),"px");return!r||!i?!1:Km(e,{...Om(e),sizeMode:"lock",width:r,height:i})}function VC(e={}){return{border:{...Ol},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function ZC(e){const t=Mn(e);return{border:t.border,borderCollapse:JC(e),borderSpacing:mf(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:Te(e.style.width)}}function qC(e,t){let n=_n(e,{margin:{top:null,right:null,bottom:null,left:null},marginMixed:!0,padding:{top:null,right:null,bottom:null,left:null},paddingMixed:!0,lineHeight:null,lineHeightMixed:!0,border:t.border,borderMixed:!1,borderRadius:t.borderRadius,radiusMixed:!1,boxShadow:t.boxShadow,shadowMixed:!1,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0});return QC(e,t.borderCollapse)&&(n=!0),ew(e,t.borderCollapse,t.borderSpacing)&&(n=!0),tw(e,t.width)&&(n=!0),n&&it(e),n}function YC(e){const t=Gl(e);return t?ZC(t):null}function XC(e,t){const n=Gl(e);return n?qC(n,t):!1}function JC(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function QC(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function mf(e){const t=e.style.borderSpacing.trim();return t?Te(t.split(/\s+/)[0]??""):null}function ew(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?Vt(n):null,i=mf(e);return Xe(i,r)?!1:(r?e.style.borderSpacing=pe(r):e.style.removeProperty("border-spacing"),!0)}function tw(e,t){const n=t?Vt(t):null,r=Te(e.style.width);return Xe(r,n)?!1:(n?e.style.width=pe(n):e.style.removeProperty("width"),!0)}const mi=["top","middle","bottom","baseline"],nw=new Set(mi);function rw(e={}){return{backgroundColor:null,color:null,padding:{...at},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function ow(e){const t=Mn(e);return{backgroundColor:t.backgroundColor,color:ff(e),padding:t.padding,textAlign:cw(e),verticalAlign:pf(e),width:Te(e.style.width),...ci(e)}}function iw(e,t){let n=_n(e,{margin:{...at},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:t.backgroundColor,backgroundMixed:!1,opacity:null,opacityMixed:!0});return sw(e,t.color)&&(n=!0),al(e,t.textAlign)&&(n=!0),uw(e,t.verticalAlign)&&(n=!0),dw(e,t.width)&&(n=!0),n&&it(e),n}function aw(e){const t=yt(e);return t?ow(t):null}function lw(e,t){const n=wr(e);if(n.length===0)return!1;let r=!1;for(const a of n)iw(a,t)&&(r=!0);const i=yt(e);if(i){const a=ci(i);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&zy(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function ff(e){const t=e.style.color;return t?xe(t):null}function sw(e,t){const n=t?xe(t):null;return ff(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function cw(e){const t=Go(e);return t==="left"?null:t}function pf(e){const t=e.style.verticalAlign.trim().toLowerCase();return nw.has(t)?t:null}function uw(e,t){return pf(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function dw(e,t){const n=t?Vt(t):null,r=Te(e.style.width);return Xe(r,n)?!1:(n?e.style.width=pe(n):e.style.removeProperty("width"),!0)}const mw=new Set(mi);function fw(e={}){return{backgroundColor:null,color:null,padding:{...at},height:null,verticalAlign:null,...e}}function pw(e){const t=e.cells[0],n=t?Mn(t).padding:{...at};return{backgroundColor:gf(e),color:hf(e),padding:n,height:Te(e.style.height),verticalAlign:bf(e)}}function gw(e,t){let n=!1;yw(e,t.backgroundColor)&&(n=!0),xw(e,t.color)&&(n=!0),ww(e,t.height)&&(n=!0),Cw(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))_n(r,{margin:{...at},marginMixed:!0,padding:t.padding,paddingMixed:!1,lineHeight:null,lineHeightMixed:!0,border:{style:"none",width:null,color:null},borderMixed:!0,borderRadius:null,radiusMixed:!0,boxShadow:null,shadowMixed:!0,backgroundColor:null,backgroundMixed:!0,opacity:null,opacityMixed:!0})&&(n=!0);return n&&it(e),n}function hw(e){const t=jm(e);return t?pw(t):null}function bw(e,t){const n=jm(e);return n?gw(n,t):!1}function gf(e){const t=e.style.backgroundColor;return t?xe(t):null}function yw(e,t){const n=t?xe(t):null;return gf(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function hf(e){const t=e.style.color;return t?xe(t):null}function xw(e,t){const n=t?xe(t):null;return hf(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function bf(e){const t=e.style.verticalAlign.trim().toLowerCase();return mw.has(t)?t:null}function Cw(e,t){return bf(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function ww(e,t){const n=t?Vt(t):null,r=Te(e.style.height);return Xe(r,n)?!1:(n?e.style.height=pe(n):e.style.removeProperty("height"),!0)}const vw=1e3;function Sw(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function kw({onAutoSave:e,getHtml:t}){const n=c.useRef(e);n.current=e;const r=c.useRef(t);r.current=t;const i=c.useRef(null),a=e!=null;c.useEffect(()=>{if(!a){i.current=null;return}i.current=r.current();const l=window.setInterval(()=>{const u=n.current;if(!u)return;const m=r.current();m!==i.current&&(i.current=m,queueMicrotask(()=>Sw(u,m)))},vw);return()=>{window.clearInterval(l)}},[a])}function bo({value:e,defaultValue:t,onChange:n}){const[r,i]=c.useState(t),a=e!==void 0,l=a?e:r,u=c.useCallback(m=>{a||i(m),n==null||n(m)},[a,n]);return[l,u]}const ku=8,Au=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#9900ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#d9d2e9","#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#8e7cc3","#660000","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#351c75"],Aw=8;let pl=[];const gl=new Set;function Pu(){return pl}function Pw(e){const t=xe(e);t&&(pl=[t,...pl.filter(n=>n!==t)].slice(0,Aw),gl.forEach(n=>n()))}function Dw(e){return gl.add(e),()=>{gl.delete(e)}}function yo(e){const t=xe(e);return t?{r:Number.parseInt(t.slice(1,3),16),g:Number.parseInt(t.slice(3,5),16),b:Number.parseInt(t.slice(5,7),16)}:null}function Qt(e,t,n){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Na({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,l=Math.max(r,i,a),u=Math.min(r,i,a),m=l-u;let p=0;return m!==0&&(l===r?p=(i-a)/m%6:l===i?p=(a-r)/m+2:p=(r-i)/m+4,p*=60,p<0&&(p+=360)),{h:p,s:l===0?0:m/l,v:l}}function Ma({h:e,s:t,v:n}){const r=(e%360+360)%360,i=n*t,a=i*(1-Math.abs(r/60%2-1)),l=n-i;let u=0,m=0,p=0;return r<60?(u=i,m=a):r<120?(u=a,m=i):r<180?(m=i,p=a):r<240?(m=a,p=i):r<300?(u=a,p=i):(u=i,p=a),{r:Math.round((u+l)*255),g:Math.round((m+l)*255),b:Math.round((p+l)*255)}}function yf(){return typeof window<"u"&&"EyeDropper"in window}async function jw(){if(!yf())return null;const e=window.EyeDropper;try{const t=await new e().open();return xe(t.sRGBHex)}catch{return null}}const Ew="_picker_ag1yo_1",Rw="_none_ag1yo_12",Tw="_customToggle_ag1yo_13",Nw="_eyedrop_ag1yo_14",Mw="_swatch_ag1yo_48",_w="_field_ag1yo_49",Lw="_grid_ag1yo_54",Iw="_recents_ag1yo_55",Fw="_sectionLabel_ag1yo_84",Bw="_custom_ag1yo_13",Hw="_sv_ag1yo_95",zw="_svThumb_ag1yo_105",Ow="_hue_ag1yo_116",Kw="_rgbRow_ag1yo_155",$w="_hexRow_ag1yo_156",je={picker:Ew,none:Rw,customToggle:Tw,eyedrop:Nw,swatch:Mw,field:_w,grid:Lw,recents:Iw,sectionLabel:Fw,custom:Bw,sv:Hw,svThumb:zw,hue:Ow,rgbRow:Kw,hexRow:$w};function Uw(e){if(!/^\d+$/.test(e.trim()))return null;const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(255,t)):null}function rs({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:i,menu:a=!1,fallbackCustom:l="#000000",onChange:u,onCommit:m}){const p=W(),g=c.useId(),h=a?"menuitemradio":"option",C=t?null:e,y=yo(C??l)??{r:0,g:0,b:0},[x,b]=c.useState(!1),[S,v]=c.useState(()=>Na(y)),[k,P]=c.useState(()=>({r:String(y.r),g:String(y.g),b:String(y.b)})),[N,D]=c.useState(()=>Qt(y.r,y.g,y.b)),[A,T]=c.useState(()=>[...Pu()]),I=c.useRef(null),E=c.useRef(Qt(y.r,y.g,y.b));c.useEffect(()=>Dw(()=>T([...Pu()])),[]),c.useEffect(()=>{const M=yo(C??l);if(!M)return;const V=Na(M);v(V),P({r:String(M.r),g:String(M.g),b:String(M.b)}),D(Qt(M.r,M.g,M.b))},[C,l]);const R=(M,V,re)=>{M&&(E.current=M),re&&M&&Pw(M),u(M),V&&(m==null||m(M))},j=(M,V,re)=>{const G=Qt(M.r,M.g,M.b);v(Na(M)),P({r:String(M.r),g:String(M.g),b:String(M.b)}),D(G),R(G,V,re)},F=(M,V,re)=>{const G=Ma(M),ye=Qt(G.r,G.g,G.b);v(M),P({r:String(G.r),g:String(G.g),b:String(G.b)}),D(ye),R(ye,V,re)},U=M=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(M.key))return;const re=[...M.currentTarget.querySelectorAll("button")],G=re.findIndex(Ce=>Ce===document.activeElement);if(G<0)return;M.preventDefault();const ye=M.key==="ArrowLeft"?-1:M.key==="ArrowRight"?1:M.key==="ArrowUp"?-ku:ku,Le=re[Math.max(0,Math.min(re.length-1,G+ye))];Le==null||Le.focus()},$=(M,V)=>{const re=I.current;if(!re||i)return;const G=re.getBoundingClientRect(),ye=Math.max(0,Math.min(1,(M.clientX-G.left)/G.width)),Le=Math.max(0,Math.min(1,1-(M.clientY-G.top)/G.height));F({h:S.h,s:ye,v:Le},V,V)},X=M=>{i||(M.currentTarget.setPointerCapture(M.pointerId),$(M,!1))},J=Ma({h:S.h,s:1,v:1}),ge=Qt(J.r,J.g,J.b),Y=Ma(S),he=Qt(Y.r,Y.g,Y.b),te=new Set(Au),ie=A.filter(M=>!te.has(M));return o.jsxs("div",{className:je.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[o.jsx("button",{type:"button",className:je.none,role:h,"aria-checked":a?C===null&&!t:void 0,"aria-selected":a?void 0:C===null&&!t,disabled:i,onClick:()=>R(null,!0,!1),children:n}),o.jsx("div",{className:je.grid,role:a?"group":"none",onKeyDown:U,children:Au.map(M=>{const V=C===M;return o.jsx("button",{type:"button",className:je.swatch,role:h,"aria-label":M,"aria-checked":a?V:void 0,"aria-selected":a?void 0:V,disabled:i,style:{backgroundColor:M},onMouseDown:re=>re.preventDefault(),onClick:()=>R(M,!0,!1)},M)})}),ie.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:je.sectionLabel,children:p("colorRecent")}),o.jsx("div",{className:je.recents,role:a?"group":"none","aria-label":p("colorRecent"),children:ie.map(M=>o.jsx("button",{type:"button",className:je.swatch,role:h,"aria-label":M,"aria-checked":a?C===M:void 0,"aria-selected":a?void 0:C===M,disabled:i,style:{backgroundColor:M},onMouseDown:V=>V.preventDefault(),onClick:()=>R(M,!0,!1)},M))})]}):null,o.jsx("button",{type:"button",className:je.customToggle,disabled:i,"aria-expanded":x,onClick:()=>b(M=>!M),children:p("colorCustom")}),x?o.jsxs("div",{className:je.custom,children:[o.jsx("div",{ref:I,className:je.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${ge})`},onPointerDown:X,onPointerMove:M=>{M.currentTarget.hasPointerCapture(M.pointerId)&&$(M,!1)},onPointerUp:M=>{$(M,!0)},children:o.jsx("span",{className:je.svThumb,style:{left:`${S.s*100}%`,top:`${(1-S.v)*100}%`}})}),o.jsx("input",{className:je.hue,type:"range",min:0,max:360,value:Math.round(S.h),disabled:i,"aria-label":p("colorCustom"),onChange:M=>F({...S,h:Number(M.target.value)},!1,!1),onPointerUp:()=>R(E.current,!0,!0)}),o.jsx("div",{className:je.rgbRow,children:["r","g","b"].map(M=>o.jsxs("div",{className:je.field,children:[o.jsx("label",{htmlFor:`${g}-${M}`,children:p(M==="r"?"colorRgbR":M==="g"?"colorRgbG":"colorRgbB")}),o.jsx("input",{id:`${g}-${M}`,inputMode:"numeric",value:k[M],disabled:i,onChange:V=>{P(re=>({...re,[M]:V.target.value}))},onBlur:()=>{const V=Uw(k[M]);if(V===null){P({r:String(Y.r),g:String(Y.g),b:String(Y.b)});return}j({...Y,[M]:V},!0,!0)},onKeyDown:V=>{V.key==="Enter"&&V.currentTarget.blur()}})]},M))}),o.jsx("div",{className:je.hexRow,children:o.jsxs("div",{className:je.field,children:[o.jsx("label",{htmlFor:`${g}-hex`,children:p("colorHex")}),o.jsx("input",{id:`${g}-hex`,value:N,disabled:i,onChange:M=>D(M.target.value),onBlur:()=>{const M=xe(N);if(!M){D(he);return}const V=yo(M);V&&j(V,!0,!0)},onKeyDown:M=>{M.key==="Enter"&&M.currentTarget.blur()}})]})}),yf()?o.jsx("button",{type:"button",className:je.eyedrop,disabled:i,onClick:()=>{jw().then(M=>{if(!M)return;const V=yo(M);V&&j(V,!0,!0)})},children:p("colorPickFromScreen")}):null]}):null]})}const Ww="_wrap_hfz5s_1",Gw="_button_hfz5s_8",Vw="_icon_hfz5s_18",Zw="_bar_hfz5s_24",qw="_barEmpty_hfz5s_33",Yw="_popover_hfz5s_43",en={wrap:Ww,button:Gw,icon:Vw,bar:Zw,barEmpty:qw,popover:Yw},Xw="_field_1knrr_1",Jw="_label_1knrr_8",Qw="_button_1knrr_12",e0="_swatch_1knrr_37",t0="_swatchEmpty_1knrr_44",rr={field:Xw,label:Jw,button:Qw,swatch:e0,swatchEmpty:t0},xo=4;function et({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:i,fallbackCustom:a,onChange:l}){const u=c.useId(),m=c.useRef(null),p=c.useRef(null),g=c.useRef(null),[h,C]=c.useState(!1),[y,x]=c.useState({top:0,left:0}),b=c.useCallback(()=>{const k=p.current,P=g.current;if(!k)return;const N=k.getBoundingClientRect(),D=(P==null?void 0:P.offsetHeight)??0,A=(P==null?void 0:P.offsetWidth)??240;let T=N.bottom;T+D>window.innerHeight-xo&&(T=Math.max(xo,N.top-D));const I=Math.min(Math.max(N.left,xo),window.innerWidth-A-xo);x({top:T,left:I})},[]);c.useLayoutEffect(()=>{if(!h)return;b();const k=()=>b();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[h,b]),c.useEffect(()=>{if(!h)return;const k=N=>{var A,T;const D=N.target;(A=m.current)!=null&&A.contains(D)||(T=g.current)!=null&&T.contains(D)||C(!1)},P=N=>{var D;N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),C(!1),(D=p.current)==null||D.focus())};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",P,!0)}},[h]);const S=`${rr.swatch}${!n||r?` ${rr.swatchEmpty}`:""}`,v=n&&!r?{backgroundColor:n}:void 0;return o.jsxs("div",{className:rr.field,ref:m,children:[o.jsx("span",{className:rr.label,children:e}),o.jsx("button",{ref:p,type:"button",className:rr.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:i,onClick:()=>C(k=>!k),children:o.jsx("span",{className:S,style:v})}),h?o.jsx(se,{children:o.jsx("div",{ref:g,id:u,className:en.popover,style:{top:y.top,left:y.left,zIndex:1400},children:o.jsx(rs,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:i,fallbackCustom:a,onChange:l,onCommit:()=>C(!1)})})}):null]})}const _a=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],n0="_toolbar_1aggm_1",r0="_menuBar_1aggm_35",o0="_menuBarDesktop_1aggm_43",i0="_brandMark_1aggm_49",a0="_brandMarkIcon_1aggm_56",l0="_menuBarCompact_1aggm_68",s0="_menuWrap_1aggm_91",c0="_menuButton_1aggm_97",u0="_iconButton_1aggm_98",d0="_menuItem_1aggm_99",m0="_hamburgerButton_1aggm_142",f0="_iconNav_1aggm_149",p0="_iconNavMain_1aggm_160",g0="_iconNavEnd_1aggm_169",h0="_iconGroup_1aggm_185",b0="_tooltipTrigger_1aggm_276",y0="_menu_1aggm_35",x0="_submenuWrap_1aggm_305",C0="_submenu_1aggm_305",w0="_submenuTrigger_1aggm_315",v0="_menuOverlay_1aggm_330",S0="_menuOverlayHeader_1aggm_342",k0="_menuOverlayTitle_1aggm_352",A0="_menuOverlayBody_1aggm_358",P0="_menuSeparator_1aggm_409",D0="_icon_1aggm_98",j0="_tooltip_1aggm_276",E0="_tooltipElevated_1aggm_494",q={toolbar:n0,menuBar:r0,menuBarDesktop:o0,brandMark:i0,brandMarkIcon:a0,menuBarCompact:l0,menuWrap:s0,menuButton:c0,iconButton:u0,menuItem:d0,hamburgerButton:m0,iconNav:f0,iconNavMain:p0,iconNavEnd:g0,iconGroup:h0,tooltipTrigger:b0,menu:y0,submenuWrap:x0,submenu:C0,submenuTrigger:w0,menuOverlay:v0,menuOverlayHeader:S0,menuOverlayTitle:k0,menuOverlayBody:A0,menuSeparator:P0,icon:D0,tooltip:j0,tooltipElevated:E0},R0=400,Du=6,La=4;function $t({label:e,children:t,className:n,elevated:r}){const i=c.useRef(null),a=c.useRef(null),l=c.useRef(null),u=c.useRef(!1),m=c.useRef(!1),[p,g]=c.useState(!1),[h,C]=c.useState({top:0,left:0}),y=c.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),x=c.useCallback(v=>{if(!(u.current||m.current)){y(),g(!1);return}if(v||m.current){y(),g(!0);return}y(),l.current=setTimeout(()=>{l.current=null,g(!0)},R0)},[y]),b=c.useCallback(()=>{const v=i.current,k=a.current;if(!v||!k)return;const P=v.getBoundingClientRect(),N=k.offsetWidth,D=k.offsetHeight;let A=P.bottom+Du;A+D>window.innerHeight-La&&(A=P.top-Du-D);let T=P.left+P.width/2-N/2;T=Math.min(Math.max(T,La),window.innerWidth-N-La),C({top:A,left:T})},[]);c.useEffect(()=>()=>y(),[y]),c.useEffect(()=>{const v=i.current;if(!v)return;const k=()=>{m.current=!0,x(!0)},P=()=>{m.current=!1,x(!1)};return v.addEventListener("focusin",k),v.addEventListener("focusout",P),()=>{v.removeEventListener("focusin",k),v.removeEventListener("focusout",P)}},[x]),c.useLayoutEffect(()=>{if(!p)return;b();const v=()=>b();return window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[p,e,b]);const S=n?`${q.tooltipTrigger} ${n}`:q.tooltipTrigger;return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,className:S,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,x(!1)},onMouseLeave:()=>{u.current=!1,x(!1)},children:t}),p?o.jsx(se,{children:o.jsx("span",{ref:a,className:r?`${q.tooltip} ${q.tooltipElevated}`:q.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const T0="_wrap_1vjt0_1",N0="_wrapToolbar_1vjt0_7",M0="_field_1vjt0_12",_0="_trigger_1vjt0_20",L0="_chevron_1vjt0_50",I0="_list_1vjt0_73",F0="_listInline_1vjt0_88",B0="_option_1vjt0_96",H0="_separator_1vjt0_125",ot={wrap:T0,wrapToolbar:N0,field:M0,trigger:_0,chevron:L0,list:I0,listInline:F0,option:B0,separator:H0};function z0({value:e,mixed:t=!1,fonts:n,disabled:r,listId:i,listRef:a,inline:l,style:u,onSelect:m}){const p=W(),g=!t&&e===null;return o.jsxs("ul",{ref:a,id:i,className:l?`${ot.list} ${ot.listInline}`:ot.list,role:"listbox","aria-label":p("commandFontFamilyAria"),style:u,children:[o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ot.option,role:"option","aria-checked":g,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>m(null),children:p("fontFamilyDefault")})}),o.jsx("li",{className:ot.separator,role:"separator"}),n.map(h=>{const C=!t&&yr(e,h.family);return o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ot.option,role:"option","aria-checked":C,disabled:r,style:{fontFamily:h.family},onMouseDown:y=>y.preventDefault(),onClick:()=>m(h.family),children:h.name})},h.family)})]})}function O0(e,t,n,r){var i;return t?"":e===null?r:((i=Fg(e,n))==null?void 0:i.name)??e}const Co=4;function xf({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:i,toolbar:a=!1,triggerId:l,onChange:u}){const m=W(),p=c.useId(),g=c.useRef(null),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(!1),[b,S]=c.useState({top:0,left:0,width:0}),v=O0(e,t,n,m("fontFamilyDefault")),k=c.useCallback(()=>{const N=h.current,D=C.current;if(!N)return;const A=N.getBoundingClientRect(),T=(D==null?void 0:D.offsetHeight)??0,I=Math.max(A.width,(D==null?void 0:D.offsetWidth)??0);let E=A.bottom;E+T>window.innerHeight-Co&&(E=Math.max(Co,A.top-T));const R=Math.min(Math.max(A.left,Co),window.innerWidth-I-Co);S({top:E,left:R,width:I})},[]);c.useLayoutEffect(()=>{if(!y)return;k();const N=()=>k();return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[y,k,n.length]),c.useEffect(()=>{if(!y)return;const N=A=>{var I,E;const T=A.target;(I=g.current)!=null&&I.contains(T)||(E=C.current)!=null&&E.contains(T)||x(!1)},D=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),x(!1))};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",D,!0),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",D,!0)}},[y]);const P=o.jsxs("div",{className:`${ot.wrap}${a?` ${ot.wrapToolbar}`:""}`,ref:g,children:[o.jsxs("div",{className:ot.field,ref:h,children:[o.jsx("button",{type:"button",id:l,className:ot.trigger,disabled:r,"aria-label":a?m("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":y,"aria-controls":y?p:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:N=>N.preventDefault(),onClick:()=>x(N=>!N),children:v}),o.jsx("span",{className:ot.chevron,"aria-hidden":"true"})]}),y?o.jsx(se,{children:o.jsx(z0,{listRef:C,listId:p,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:b.top,left:b.left,minWidth:b.width},onSelect:N=>{u(N),x(!1)}})}):null]});return i?o.jsx($t,{label:i,children:P}):P}function K0({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(xf,{family:t.isFontFamilyMixed()?null:t.getFontFamily(),mixed:t.isFontFamilyMixed(),fonts:t.getFontFaces(),disabled:i,tooltip:r("commandFontFamily"),toolbar:!0,onChange:a=>{e.setFontFamily(a)}})}const $0="_wrap_58i0x_1",U0="_wrapToolbar_58i0x_9",W0="_field_58i0x_14",G0="_input_58i0x_22",V0="_toggle_58i0x_41",Z0="_chevron_58i0x_42",q0="_unit_58i0x_80",Y0="_list_58i0x_110",X0="_option_58i0x_125",ve={wrap:$0,wrapToolbar:U0,field:W0,input:G0,toggle:V0,chevron:Z0,unit:q0,list:Y0,option:X0},wo=4,J0={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Cf({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:i,tooltip:a,sizeInputId:l,toolbar:u=!1}){const m=W(),p=c.useId(),g=c.useRef(null),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(()=>e===null?"":Q(e)),[b,S]=c.useState(!1),[v,k]=c.useState(!1),[P,N]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{b||x(e===null?"":Q(e))},[e,b]);const D=c.useCallback(()=>{const R=h.current,j=C.current;if(!R)return;const F=R.getBoundingClientRect(),U=(j==null?void 0:j.offsetHeight)??0;let $=F.bottom;$+U>window.innerHeight-wo&&($=Math.max(wo,F.top-U));const X=Math.min(Math.max(F.left,wo),window.innerWidth-Math.max(F.width,72)-wo);N({top:$,left:X,width:F.width})},[]);c.useLayoutEffect(()=>{if(!v)return;D();const R=()=>D();return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[v,D]),c.useEffect(()=>{if(!v)return;const R=F=>{var $,X;const U=F.target;($=g.current)!=null&&$.contains(U)||(X=C.current)!=null&&X.contains(U)||k(!1)},j=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",R),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",R),document.removeEventListener("keydown",j,!0)}},[v]);const A=R=>{const j=rh(R,t);if(!j){x(e===null?"":Q(e));return}n(j.value,j.unit),x(Q(j.value))},T=Qg[t],I=v?o.jsx(se,{children:o.jsx("ul",{ref:C,className:ve.list,role:"listbox",id:p,style:{top:P.top,left:P.left,minWidth:P.width},children:T.map(R=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ve.option,role:"option","aria-selected":e===R,onMouseDown:j=>j.preventDefault(),onClick:()=>{n(R,t),x(Q(R)),k(!1)},children:Q(R)})},R))})}):null,E=o.jsxs("div",{className:`${ve.wrap}${u?` ${ve.wrapToolbar}`:""}`,ref:g,children:[o.jsxs("div",{className:ve.field,ref:h,children:[o.jsx("input",{id:l,className:ve.input,value:y,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":v,"aria-controls":p,role:"combobox",inputMode:"decimal",onFocus:()=>S(!0),onBlur:()=>{S(!1),A(y)},onChange:R=>x(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),A(y),k(!1),R.currentTarget.blur()),R.key==="ArrowDown"&&(R.preventDefault(),k(!0))}}),o.jsx("button",{type:"button",className:ve.toggle,tabIndex:-1,disabled:i,"aria-label":m("commandFontSizeAria"),"aria-expanded":v,"aria-controls":p,onMouseDown:R=>R.preventDefault(),onClick:()=>k(R=>!R)})]}),o.jsxs("div",{className:ve.field,children:[o.jsx("select",{className:ve.unit,value:t,disabled:i,"aria-label":m("commandFontSizeUnitAria"),onChange:R=>{r(R.target.value)},children:El.map(R=>o.jsx("option",{value:R,children:m(J0[R])},R))}),o.jsx("span",{className:ve.chevron,"aria-hidden":"true"})]}),I]});return a?o.jsx($t,{label:a,children:E}):E}const Q0="_backdrop_1p9zk_1",ev="_dialog_1p9zk_12",tv="_dialogWide_1p9zk_31",nv="_header_1p9zk_35",rv="_tabs_1p9zk_43",ov="_tab_1p9zk_43",iv="_body_1p9zk_76",av="_field_1p9zk_86",lv="_label_1p9zk_92",sv="_sizeRow_1p9zk_96",cv="_fileRow_1p9zk_102",uv="_fileName_1p9zk_108",dv="_previewImage_1p9zk_115",mv="_marks_1p9zk_125",fv="_mark_1p9zk_125",pv="_actions_1p9zk_140",gv="_actionsSpread_1p9zk_148",hv="_actionsEnd_1p9zk_152",bv="_headerRow_1p9zk_157",yv="_close_1p9zk_170",xv="_nameSection_1p9zk_187",Cv="_nameInput_1p9zk_192",wv="_labelRow_1p9zk_209",vv="_help_1p9zk_215",Sv="_textInput_1p9zk_233",kv="_fullSelect_1p9zk_245",Av="_error_1p9zk_249",Pv="_emptyHint_1p9zk_254",Dv="_action_1p9zk_140",jv="_textarea_1p9zk_265",Ev="_actionDanger_1p9zk_279",Rv="_confirmBody_1p9zk_285",Tv="_nestedPanel_1p9zk_294",Nv="_spinnerWrap_1p9zk_309",Mv="_spinner_1p9zk_309",_v="_actionPrimary_1p9zk_344",Lv="_iconButton_1p9zk_358",Iv="_select_1p9zk_359",Fv="_lengthInput_1p9zk_360",Bv="_lengthUnit_1p9zk_361",Hv="_group_1p9zk_369",zv="_nestedGroup_1p9zk_379",Ov="_subLabel_1p9zk_389",Kv="_iconRow_1p9zk_393",$v="_lengthField_1p9zk_425",Uv="_sideLabel_1p9zk_431",Wv="_lengthRow_1p9zk_435",Gv="_sideGrid_1p9zk_463",Vv="_shadowGrid_1p9zk_464",d={backdrop:Q0,dialog:ev,dialogWide:tv,header:nv,tabs:rv,tab:ov,body:iv,field:av,label:lv,sizeRow:sv,fileRow:cv,fileName:uv,previewImage:dv,marks:mv,mark:fv,actions:pv,actionsSpread:gv,actionsEnd:hv,headerRow:bv,close:yv,nameSection:xv,nameInput:Cv,labelRow:wv,help:vv,textInput:Sv,fullSelect:kv,error:Av,emptyHint:Pv,action:Dv,textarea:jv,actionDanger:Ev,confirmBody:Rv,nestedPanel:Tv,spinnerWrap:Nv,spinner:Mv,actionPrimary:_v,iconButton:Lv,select:Iv,lengthInput:Fv,lengthUnit:Bv,group:Hv,nestedGroup:zv,subLabel:Ov,iconRow:Kv,lengthField:$v,sideLabel:Uv,lengthRow:Wv,sideGrid:Gv,shadowGrid:Vv},Zv={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function os({tab:e,value:t,fonts:n,disabled:r,onTabChange:i,onChange:a}){const l=W(),u=c.useId(),m=c.useId(),p=n??vd(),g=_a.find(h=>h.id===e)??_a[0];return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("fontDialogTitle"),children:_a.map(h=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":h.id===e,disabled:!h.implemented,onClick:()=>i(h.id),children:l(h.labelKey)},h.id))}),o.jsx("div",{className:d.body,role:"tabpanel",children:g.implemented?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("fontDialogFamily")}),o.jsx(xf,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:p,disabled:r,triggerId:m,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("fontDialogSize")}),o.jsx("div",{className:d.sizeRow,children:o.jsx(Cf,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,C)=>{a({...t,size:h,unit:C})},onUnitChange:h=>{const C=t.size!==null?Dd(t.size,t.unit,h,16,16):t.size;a({...t,size:C,unit:h})}})})]}),o.jsx("div",{className:d.field,children:o.jsx(et,{label:l("commandFontColor"),noneLabel:l("colorAutomatic"),value:t.fontColor,mixed:t.fontColorMixed,disabled:r,onChange:h=>{a({...t,fontColor:h,fontColorMixed:!1})}})}),o.jsx("div",{className:d.field,children:o.jsx(et,{label:l("commandHighlightColor"),noneLabel:l("colorNone"),value:t.highlightColor,mixed:t.highlightColorMixed,disabled:r,fallbackCustom:"#ffff00",onChange:h=>{a({...t,highlightColor:h,highlightColorMixed:!1})}})}),o.jsxs("fieldset",{className:d.marks,children:[o.jsx("legend",{className:d.label,children:l("fontDialogStyle")}),Qe.map(h=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.marks[h],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[h]:!t.marks[h]}})}}),l(Zv[h].label)]},h))]})]}):null})]})}const ju='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function qv({open:e,tab:t,size:n,unit:r,marks:i,fontFamily:a=null,fontFamilyMixed:l=!1,fontColor:u,fontColorMixed:m=!1,highlightColor:p,highlightColorMixed:g=!1,fonts:h,disabled:C,onTabChange:y,onApply:x,onClose:b}){const S=W(),v=c.useId(),k=c.useRef(null),[P,N]=c.useState({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:p,fontColorMixed:m,highlightColorMixed:g});return c.useEffect(()=>{e&&N({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:l,fontColor:u,highlightColor:p,fontColorMixed:m,highlightColorMixed:g})},[e,n,r,i,a,l,u,m,p,g]),c.useEffect(()=>{if(!e)return;const D=k.current,A=D==null?void 0:D.querySelector(ju);A==null||A.focus();const T=I=>{if(I.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;I.preventDefault(),I.stopPropagation(),b();return}if(I.key!=="Tab"||!D)return;const E=[...D.querySelectorAll(ju)];if(E.length===0)return;const R=E[0],j=E[E.length-1];I.shiftKey&&document.activeElement===R?(I.preventDefault(),j.focus()):!I.shiftKey&&document.activeElement===j&&(I.preventDefault(),R.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,b]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:b,children:o.jsxs("div",{ref:k,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:D=>D.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:v,children:S("fontDialogTitle")}),o.jsx(os,{tab:t,value:P,fonts:h,disabled:C,onTabChange:y,onChange:N}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:b,children:S("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:C,onClick:()=>x(P),children:S("fontDialogOk")})]})]})})}):null}const Yv={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function ke({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:i,inputId:a,onChange:l}){const u=W(),m=c.useId(),p=a??m,g=(t==null?void 0:t.unit)??Nl,[h,C]=c.useState(()=>t?Q(t.value):""),[y,x]=c.useState(!1);c.useEffect(()=>{y||C(t?Q(t.value):"")},[t,y]);const b=S=>{const v=S.trim();if(!v){l(null),C("");return}const k=mr(v,g,r);if(!k){C(t?Q(t.value):"");return}l(k),C(Q(k.value))};return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:p,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:p,className:d.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),b(h)},onChange:S=>C(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),b(h),S.currentTarget.blur())}}),o.jsx("select",{className:d.lengthUnit,value:g,disabled:n,"aria-label":i??u("paragraphDialogLengthUnitAria"),onChange:S=>{const v=S.target.value;if(t){l({value:t.value,unit:v});return}if(h.trim()){const k=mr(h,v,r);l(k)}},children:El.map(S=>o.jsx("option",{value:S,children:u(Yv[S])},S))})]})]})}function is({shadow:e,disabled:t,onChange:n}){const r=W();return o.jsxs("div",{className:d.shadowGrid,children:[o.jsx(ke,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetX:i??{value:0,unit:"px"}})}}),o.jsx(ke,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetY:i??{value:0,unit:"px"}})}}),o.jsx(ke,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:i=>{n({...e,blur:i??{value:0,unit:"px"}})}}),o.jsx(ke,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:i=>{n({...e,spread:i??{value:0,unit:"px"}})}}),o.jsx(et,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:i=>{n({...e,color:i})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const wf=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],vf=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],Xv={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},Jv={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function Sf({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),l=c.useId();return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:i(e)}),o.jsx(Qv,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("imagePropertiesFit")}),o.jsxs("select",{id:a,className:d.select,value:t.fit??"",disabled:n,onChange:u=>{const m=u.target.value;r({...t,fit:m||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesFitDefault")}),Xl.map(u=>o.jsx("option",{value:u,children:i(Xv[u])},u))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("imagePropertiesPosition")}),o.jsxs("select",{id:l,className:d.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesPositionDefault")}),Jl.map(u=>o.jsx("option",{value:u,children:i(Jv[u])},u))]})]})]})}function Qv({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:Ho(e),[l,u]=c.useState(()=>a===null?"":Q(a)),[m,p]=c.useState(!1);c.useEffect(()=>{m||u(a===null?"":Q(a))},[a,m]);const g=h=>{const C=h.trim();if(!C){n(null),u("");return}const y=Number(C.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":Q(a));return}const x=$d(y);n(x),u(Q(Ho(x)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>u(h.target.value),onBlur:()=>{p(!1),g(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const vo=4,eS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function qo({label:e,inputAria:t,value:n,disabled:r,onChange:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useRef(null),p=c.useRef(null),g=c.useRef(null),h=(n==null?void 0:n.unit)??bx,[C,y]=c.useState(()=>n?Q(n.value):""),[x,b]=c.useState(!1),[S,v]=c.useState(!1),[k,P]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{x||y(n?Q(n.value):"")},[n,x]);const N=c.useCallback(()=>{const E=p.current,R=g.current;if(!E)return;const j=E.getBoundingClientRect(),F=(R==null?void 0:R.offsetHeight)??0;let U=j.bottom;U+F>window.innerHeight-vo&&(U=Math.max(vo,j.top-F));const $=Math.min(Math.max(j.left,vo),window.innerWidth-Math.max(j.width,72)-vo);P({top:U,left:$,width:j.width})},[]);c.useLayoutEffect(()=>{if(!S)return;N();const E=()=>N();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[S,N]),c.useEffect(()=>{if(!S)return;const E=j=>{var U,$;const F=j.target;(U=m.current)!=null&&U.contains(F)||($=g.current)!=null&&$.contains(F)||v(!1)},R=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),v(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",R,!0)}},[S]);const D=E=>{const R=E.trim();if(!R){i(null),y("");return}const j=lu(R,h);if(!j){y(n?Q(n.value):"");return}i(j),y(Q(j.value))},A=yx[h],T=(n==null?void 0:n.value)??null,I=S?o.jsx(se,{children:o.jsx("ul",{ref:g,className:ve.list,role:"listbox",id:l,style:{top:k.top,left:k.left,minWidth:k.width},children:A.map(E=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ve.option,role:"option","aria-selected":T===E,onMouseDown:R=>R.preventDefault(),onClick:()=>{i({value:E,unit:h}),y(Q(E)),v(!1)},children:Q(E)})},E))})}):null;return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:u,children:e}),o.jsxs("div",{className:`${ve.wrap} ${d.lengthRow}`,ref:m,children:[o.jsxs("div",{className:ve.field,ref:p,children:[o.jsx("input",{id:u,className:ve.input,value:C,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":S,"aria-controls":l,role:"combobox",inputMode:"decimal",onFocus:()=>b(!0),onBlur:()=>{b(!1),D(C)},onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),D(C),v(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),v(!0))}}),o.jsx("button",{type:"button",className:ve.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":S,"aria-controls":l,onMouseDown:E=>E.preventDefault(),onClick:()=>v(E=>!E)})]}),o.jsxs("div",{className:ve.field,children:[o.jsx("select",{className:ve.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:E=>{const R=E.target.value;if(n){i({value:n.value,unit:R});return}C.trim()&&i(lu(C,R))},children:Hm.map(E=>o.jsx("option",{value:E,children:a(eS[E])},E))}),o.jsx("span",{className:ve.chevron,"aria-hidden":"true"})]}),I]})]})}const tS={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},nS={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function kf({src:e,disabled:t,customImagePicker:n,onSrcChange:r,onCustomPick:i,onSourceChange:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useRef(null),[g,h]=c.useState(()=>e.startsWith("data:")?"file":e.trim()?"url":"file"),[C,y]=c.useState(()=>e.startsWith("data:")?"":e),[x,b]=c.useState(""),[S,v]=c.useState(null),[k,P]=c.useState(!1);c.useEffect(()=>{a==null||a(g)},[a,g]);const N=g==="file"&&e.startsWith("data:")?e:g==="url"?C:"",D=g==="custom"?null:Ln(N),A=g==="custom"?null:g==="file"&&S?nS[S]:D&&(g==="file"||C.trim().length>0)?tS[D]:null,T=()=>{t||!n||i==null||i()},I=E=>{var j;const R=(j=E.target.files)==null?void 0:j[0];R&&(P(!0),v(null),dx(R).then(F=>{b(R.name),h("file"),r(F),P(!1)},F=>{const U=F instanceof Error?F.message:"";b(""),h("file"),v(U==="tooLarge"||U==="type"?U:"type"),P(!1),p.current&&(p.current.value="")}))};return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("imageDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("imageDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="file",disabled:t,onClick:()=>h("file"),children:l("imageDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="url",disabled:t,onClick:()=>h("url"),children:l("imageDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":g==="custom",disabled:t,onClick:()=>h("custom"),children:n.text}):null]}),g==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:p,type:"file",accept:ox,hidden:!0,disabled:t,"aria-label":l("imageDialogChooseFile"),onChange:I}),o.jsx("button",{type:"button",className:d.action,disabled:t||k,onClick:()=>{var E;return(E=p.current)==null?void 0:E.click()},children:l("imageDialogChooseFile")}),x?o.jsx("span",{className:d.fileName,children:x}):null,e.startsWith("data:")&&!x?o.jsx("span",{className:d.fileName,children:l("pageBackgroundImageCurrent")}):null]}):null,g==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("imageDialogUrl")}),o.jsx("input",{id:u,className:d.textInput,value:C,disabled:t,"aria-invalid":A!==null,"aria-describedby":A?m:void 0,onChange:E=>{const R=E.target.value;y(R),r(R.trim())}})]}):null,g==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:T,children:n.buttonCaption})]}):null,A?o.jsx("p",{id:m,className:d.error,children:l(A)}):null]})}function rS(e){return Ln(e.trim())===null}function oS(e){return Wm(e)?{width:null,height:null}:e==="fill"?{width:{...kn},height:{...kn}}:{width:{...kn},height:null}}function iS({value:e,disabled:t,customImagePicker:n,onCustomImagePick:r,onChange:i}){const a=W(),l=e.src??"",u=(m,p)=>{i({...e,fit:null,[m]:p})};return o.jsxs(o.Fragment,{children:[l?o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:a("pageBackgroundImagePreview")}),o.jsx("img",{className:d.previewImage,src:l,alt:a("pageBackgroundImagePreviewAlt")}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:()=>{i({...e,src:null})},children:a("pageBackgroundImageClear")})]}):null,o.jsx(kf,{src:l,disabled:t,customImagePicker:n,onCustomPick:r,onSrcChange:m=>{i({...e,src:m.trim()||null})}}),l?o.jsxs(o.Fragment,{children:[o.jsx(qo,{label:a("imagePropertiesWidth"),inputAria:a("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:m=>u("width",m)}),o.jsx(qo,{label:a("imagePropertiesHeight"),inputAria:a("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:m=>u("height",m)}),o.jsx(Sf,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:m=>{const p=m.fit===e.fit?{width:e.width,height:e.height}:oS(m.fit);i({...e,opacity:m.opacity,fit:m.fit,position:m.position,...p})}})]}):null]})}const aS={left:Qo,center:Jo,right:ei,justify:nd},lS={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},sS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},cS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},uS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},dS={value:1,unit:"pt"},mS={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},fS={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},Eu={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function or(e){return{top:e,right:e,bottom:e,left:e}}function Ru(e){for(const t of Me)if(e[t])return e[t];return null}function pS(){const e=[...wf];for(const t of vf)e.some(n=>n.id===t.id)||e.push(t);return e}function as({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:i="paragraphDialogTitle",backgroundImage:a,customImagePicker:l,onCustomImagePick:u,onBackgroundImageChange:m,onTabChange:p,onChange:g}){const h=W(),C=r?pS().filter(A=>r.includes(A.id)):wf,y=c.useId(),x=c.useId(),b=c.useId(),S=c.useId(),[v,k]=c.useState(()=>Rt(t.margin,or(t.margin.top))),[P,N]=c.useState(()=>Rt(t.padding,or(t.padding.top))),D=(A,T,I,E)=>{const R=t[A],j=T?or(E):{...R,[I]:E};g({...t,[A]:j,[`${A}Mixed`]:!1})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":h(i),children:C.map(A=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":A.id===e,disabled:!A.implemented,onClick:()=>p(A.id),children:h(A.labelKey)},A.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":h("paragraphDialogAlignment"),children:Nm.map(A=>{const T=aS[A],I=!t.alignMixed&&t.align===A;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":I,"aria-label":h(lS[A].aria),disabled:n,onClick:()=>{g({...t,align:A,alignMixed:!1})},children:o.jsx(T,{})},A)})})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogLists")}),o.jsxs("div",{className:d.iconRow,children:[o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":h("commandBulletListAria"),disabled:n,onClick:()=>{const A=!t.listMixed&&t.list==="ul"?null:"ul";g({...t,list:A,listMixed:!1})},children:o.jsx(rd,{})}),o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":h("commandNumberedListAria"),disabled:n,onClick:()=>{const A=!t.listMixed&&t.list==="ol"?null:"ol";g({...t,list:A,listMixed:!1})},children:o.jsx(ld,{})})]})]})]}):null,e==="spacing"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogSpacing")}),o.jsx(Tu,{legend:h("paragraphDialogMargin"),sides:t.margin,linked:v,disabled:n,allowNegative:!0,onLinkedChange:A=>{k(A),A&&g({...t,margin:or(Ru(t.margin)),marginMixed:!1})},onSideChange:(A,T)=>D("margin",v,A,T)}),o.jsx(Tu,{legend:h("paragraphDialogPadding"),sides:t.padding,linked:P,disabled:n,onLinkedChange:A=>{N(A),A&&g({...t,padding:or(Ru(t.padding)),paddingMixed:!1})},onSideChange:(A,T)=>D("padding",P,A,T)}),o.jsx(hS,{value:t.lineHeight,disabled:n,onChange:A=>{g({...t,lineHeight:A,lineHeightMixed:!1})}}),o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:h("paragraphDialogPageBreaks")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:x,children:h("paragraphDialogBreakInside")}),o.jsx("select",{id:x,className:d.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:A=>{g({...t,breakInside:A.target.value,breakInsideMixed:!1})},children:Ld.map(A=>o.jsx("option",{value:A,children:h(fS[A])},A))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:b,children:h("paragraphDialogBreakAfter")}),o.jsx("select",{id:b,className:d.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:A=>{g({...t,breakAfter:A.target.value,breakAfterMixed:!1})},children:Xa.map(A=>o.jsx("option",{value:A,children:h(Eu[A])},A))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:S,children:h("paragraphDialogBreakBefore")}),o.jsx("select",{id:S,className:d.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:A=>{g({...t,breakBefore:A.target.value,breakBeforeMixed:!1})},children:Xa.map(A=>o.jsx("option",{value:A,children:h(Eu[A])},A))})]})]})]}):null,e==="border"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:y,children:h("paragraphDialogBorderStyle")}),o.jsx("select",{id:y,className:d.select,value:t.border.style,disabled:n,onChange:A=>{const T=A.target.value;g({...t,border:{style:T,width:T==="none"?null:t.border.width??dS,color:T==="none"?null:t.border.color},borderMixed:!1})},children:ii.map(A=>o.jsx("option",{value:A,children:h(cS[A])},A))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ke,{label:h("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:A=>{g({...t,border:{...t.border,width:A},borderMixed:!1})}}),o.jsx(et,{label:h("paragraphDialogBorderColor"),noneLabel:h("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:A=>{g({...t,border:{...t.border,color:A},borderMixed:!1})}})]}):null,o.jsx(ke,{label:h("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:A=>{g({...t,borderRadius:A,radiusMixed:!1})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{g({...t,boxShadow:t.boxShadow?null:mS,shadowMixed:!1})}}),h("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(is,{shadow:t.boxShadow,disabled:n,onChange:A=>{g({...t,boxShadow:A,shadowMixed:!1})}}):null]}):null,e==="background"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogTabBackground")}),o.jsx(et,{label:h("paragraphDialogBackgroundColor"),noneLabel:h("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:A=>{g({...t,backgroundColor:A,backgroundMixed:!1})}}),o.jsx(gS,{value:t.opacity,disabled:n,onChange:A=>{g({...t,opacity:A,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&m?o.jsx(iS,{value:a,disabled:n,customImagePicker:l,onCustomImagePick:u,onChange:m}):null]})]})}function gS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:Ho(e),[l,u]=c.useState(()=>a===null?"":Q(a)),[m,p]=c.useState(!1);c.useEffect(()=>{m||u(a===null?"":Q(a))},[a,m]);const g=h=>{const C=h.trim();if(!C){n(null),u("");return}const y=Number(C.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":Q(a));return}const x=$d(y);n(x),u(Q(Ho(x)))};return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogOpacity")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:l,disabled:t,inputMode:"decimal",onFocus:()=>p(!0),onChange:h=>u(h.target.value),onBlur:()=>{p(!1),g(l)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function Tu({legend:e,sides:t,linked:n,disabled:r,allowNegative:i=!1,onLinkedChange:a,onSideChange:l}){const u=W(),m=n?["top"]:Me;return o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:e}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),u("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:m.map(p=>o.jsx(ke,{label:n?e:u(sS[p]),value:t[p],disabled:r,allowNegative:i,onChange:g=>l(p,g)},p))})]})}function hS({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=bS(e),l=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,m]=c.useState(()=>l===null?"":Q(l)),p=(e==null?void 0:e.kind)==="length"?e.unit:Nl;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("paragraphDialogLineHeight")}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:i,className:d.lengthInput,value:a==="normal"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:g=>m(g.target.value),onBlur:()=>{const g=u.trim();if(!g){n(null);return}if(a==="number"||a==="empty"){const C=Number(g.replace(",","."));if(!Number.isFinite(C)||C<0){m(l===null?"":Q(l));return}n({kind:"number",value:C}),m(Q(C));return}const h=mr(g,p,!1);if(!h){m(l===null?"":Q(l));return}n({kind:"length",value:h.value,unit:h.unit}),m(Q(h.value))}}),o.jsxs("select",{className:d.lengthUnit,value:a==="length"?p:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:g=>{const h=g.target.value;if(h==="empty"){n(null),m("");return}if(h==="normal"){n({kind:"normal"}),m("");return}if(h==="number"){const b=Number((u||"1.5").replace(",",".")),S=Number.isFinite(b)&&b>=0?b:1.5;n({kind:"number",value:S}),m(Q(S));return}const C=h,y=mr(u||"1",C,!1),x=(y==null?void 0:y.value)??1;n({kind:"length",value:x,unit:C}),m(Q(x))},children:[o.jsx("option",{value:"empty"}),o.jsx("option",{value:"normal",children:r("paragraphDialogLineHeightNormal")}),o.jsx("option",{value:"number",children:r("paragraphDialogLineHeightUnitless")}),["pt","px","em","rem","%"].map(g=>o.jsx("option",{value:g,children:r(uS[g])},g))]})]})]})}function bS(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const Nu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function yS({open:e,tab:t,value:n,disabled:r,onTabChange:i,onApply:a,onClose:l}){const u=W(),m=c.useId(),p=c.useRef(null),[g,h]=c.useState(n);return c.useEffect(()=>{e&&h(n)},[e,n]),c.useEffect(()=>{if(!e)return;const C=p.current,y=C==null?void 0:C.querySelector(Nu);y==null||y.focus();const x=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),l();return}if(b.key!=="Tab"||!C)return;const S=[...C.querySelectorAll(Nu)];if(S.length===0)return;const v=S[0],k=S[S.length-1];b.shiftKey&&document.activeElement===v?(b.preventDefault(),k.focus()):!b.shiftKey&&document.activeElement===k&&(b.preventDefault(),v.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,l]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:l,children:o.jsxs("div",{ref:p,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":m,onMouseDown:C=>C.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:m,children:u("paragraphDialogTitle")}),o.jsx(as,{tab:t,value:g,disabled:r,onTabChange:i,onChange:h}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:l,children:u("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:r,onClick:()=>a(g),children:u("fontDialogOk")})]})]})})}):null}const xS=["auto","A4","letter","legal","custom"],CS={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},wS={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Mu(e){return e===null?"":Q(e.value)}function vS({value:e,disabled:t,onChange:n,onReset:r}){const i=W(),a=c.useId(),[l,u]=c.useState(!0),m=e??rn(),p=(g,h)=>{if(l){n({...m,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...m,margin:{...m.margin,[g]:h},marginMixed:!1})};return o.jsxs("div",{className:d.body,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:i("pageAtRuleSize")}),o.jsx("select",{id:a,className:d.select,disabled:t,value:m.sizePreset,onChange:g=>n({...m,sizePreset:g.target.value}),children:xS.map(g=>o.jsx("option",{value:g,children:i(CS[g])},g))})]}),m.sizePreset==="custom"?o.jsxs("div",{className:d.sideGrid,children:[o.jsx(Ia,{label:i("pageAtRuleWidth"),value:m.customWidth,disabled:t,onChange:g=>n({...m,customWidth:g})}),o.jsx(Ia,{label:i("pageAtRuleHeight"),value:m.customHeight,disabled:t,onChange:g=>n({...m,customHeight:g})})]}):null,o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:i("pageAtRuleOrientation")}),o.jsx("div",{className:d.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([g,h])=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"radio",name:"page-orientation",checked:(m.orientation??"none")===g,disabled:t,onChange:()=>n({...m,orientation:g==="none"?null:g})}),i(h)]},g))})]}),o.jsxs("fieldset",{className:d.nestedGroup,children:[o.jsx("legend",{className:d.subLabel,children:i("pageAtRuleMargins")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:l,disabled:t,onChange:()=>u(!l)}),i("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(l?["top"]:Me).map(g=>o.jsx(Ia,{label:i(l?"pageAtRuleMargins":wS[g]),value:m.margin[g],disabled:t,onChange:h=>p(g,h)},g))})]}),o.jsx("div",{className:d.actions,children:o.jsx("button",{type:"button",className:d.action,disabled:t,"aria-label":i("pageAtRuleResetAria"),onClick:r,children:i("pageAtRuleReset")})})]})}function Ia({label:e,value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),[l,u]=c.useState(()=>Mu(t)),m=(t==null?void 0:t.unit)??Nl;return o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:a,className:d.lengthInput,value:l,disabled:n,inputMode:"decimal",onChange:p=>u(p.target.value),onBlur:()=>{const p=l.trim();if(!p){r(null);return}const g=mr(p,m,!1);if(!g){u(Mu(t));return}r(g),u(Q(g.value))}}),o.jsxs("select",{className:d.lengthUnit,disabled:n,value:m,"aria-label":i("paragraphDialogLengthUnitAria"),onChange:p=>{const g=p.target.value;t&&r({...t,unit:g})},children:[o.jsx("option",{value:"pt",children:i("fontSizeUnitPt")}),o.jsx("option",{value:"px",children:i("fontSizeUnitPx")}),o.jsx("option",{value:"em",children:i("fontSizeUnitEm")}),o.jsx("option",{value:"rem",children:i("fontSizeUnitRem")}),o.jsx("option",{value:"%",children:i("fontSizeUnitPercent")})]})]})]})}const _u='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',SS=vf.map(e=>e.id);function kS(e){return{...lr(),...e}}function AS(e){const{align:t,alignMixed:n,list:r,listMixed:i,...a}=e;return a}function PS({open:e,tab:t,value:n,fonts:r,disabled:i,customImagePicker:a,onCustomImagePick:l,onTabChange:u,onApply:m,onResetAtRule:p,onClose:g}){const h=W(),C=c.useId(),y=c.useRef(null),[x,b]=c.useState("general"),[S,v]=c.useState("spacing"),[k,P]=c.useState(n.font),[N,D]=c.useState(n.box),[A,T]=c.useState(n.backgroundImage),[I,E]=c.useState(n.atRule??rn());if(c.useEffect(()=>{e&&(b("general"),v("spacing"),P(n.font),D(n.box),T(n.backgroundImage??Ql()),E(n.atRule??rn()))},[e,n]),c.useEffect(()=>{if(!e)return;const j=y.current,F=j==null?void 0:j.querySelector(_u);F==null||F.focus();const U=$=>{if($.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;$.preventDefault(),$.stopPropagation(),g();return}if($.key!=="Tab"||!j)return;const X=[...j.querySelectorAll(_u)];if(X.length===0)return;const J=X[0],ge=X[X.length-1];$.shiftKey&&document.activeElement===J?($.preventDefault(),ge.focus()):!$.shiftKey&&document.activeElement===ge&&($.preventDefault(),J.focus())};return document.addEventListener("keydown",U,!0),()=>document.removeEventListener("keydown",U,!0)},[e,g]),!e)return null;const R=h("pageDialogTitle");return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:g,children:o.jsxs("div",{ref:y,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":C,onMouseDown:j=>j.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:C,children:R}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":R,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="font",onClick:()=>u("font"),children:h("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="paragraph",onClick:()=>u("paragraph"),children:h("customStyleDialogTabParagraph")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="print",onClick:()=>u("print"),children:h("pageDialogTabPrint")})]}),t==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(os,{tab:x,value:k,fonts:r,disabled:i,onTabChange:b,onChange:P})}):t==="paragraph"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(as,{tab:S,value:kS(N),disabled:i,tabs:SS,tablistLabelKey:"pageDialogTitle",backgroundImage:A,customImagePicker:a,onCustomImagePick:l,onBackgroundImageChange:T,onTabChange:j=>{j!=="general"&&v(j)},onChange:j=>D(AS(j))})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(vS,{value:I,disabled:i,onChange:E,onReset:()=>{E(rn()),p==null||p()}})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:g,children:h("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>m({font:k,box:N,backgroundImage:A,atRule:I}),children:h("fontDialogOk")})]})]})})})}const Lu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function DS(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Iu(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamily??null,fontFamilyMixed:!1,fontColor:e.fontColor,highlightColor:e.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}}function jS(e){return{size:e.size,unit:e.unit,marks:e.marks,fontFamily:e.fontFamilyMixed?null:e.fontFamily,fontColor:e.fontColorMixed?null:e.fontColor,highlightColor:e.highlightColorMixed?null:e.highlightColor}}function ES({open:e,mode:t,styleId:n,name:r="",font:i,paragraph:a,canDelete:l=!1,busy:u,disabled:m,fonts:p,defaultOuterTab:g="font",onSave:h,onDelete:C,onClose:y}){const x=W(),b=c.useId(),S=c.useId(),v=c.useRef(null),[k,P]=c.useState(r),[N,D]=c.useState(g),[A,T]=c.useState("general"),[I,E]=c.useState("general"),[R,j]=c.useState(()=>Iu(i)),[F,U]=c.useState(()=>ll(a)),[$,X]=c.useState(!1);if(c.useEffect(()=>{e&&(P(r),D(g),T("general"),E("general"),j(Iu(i)),U(ll(a)),X(!1))},[e,r,i,a,g]),c.useEffect(()=>{if(!e)return;const te=v.current,ie=te==null?void 0:te.querySelector(Lu);ie==null||ie.focus();const M=V=>{if(V.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if(V.preventDefault(),V.stopPropagation(),$){X(!1);return}y();return}if(V.key!=="Tab"||!te)return;const re=[...te.querySelectorAll(Lu)];if(re.length===0)return;const G=re[0],ye=re[re.length-1];V.shiftKey&&document.activeElement===G?(V.preventDefault(),ye.focus()):!V.shiftKey&&document.activeElement===ye&&(V.preventDefault(),G.focus())};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[e,y,$]),!e)return null;const J=x(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),ge=k.trim().length>0,Y=!!(m||u),he=()=>{const te=k.trim();te&&h({id:n??DS(),name:te,font:jS(R),paragraph:Im(F)})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:y,children:o.jsxs("div",{ref:v,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":b,"aria-busy":u||void 0,onMouseDown:te=>te.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:b,children:J}),o.jsx("button",{type:"button",className:d.close,"aria-label":x("customStyleDialogCloseAria"),onClick:y,children:o.jsx(_e,{})})]}),$?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.confirmBody,children:x("customStyleDialogDeleteConfirm")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:Y,onClick:()=>X(!1),children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y||!n,onClick:()=>{n&&(C==null||C(n))},children:x("customStyleDialogDelete")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.nameSection,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:S,children:x("customStyleDialogName")}),o.jsx("input",{id:S,className:d.nameInput,value:k,disabled:Y,onChange:te=>P(te.target.value)})]})}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":J,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="font",onClick:()=>D("font"),children:x("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="paragraph",onClick:()=>D("paragraph"),children:x("customStyleDialogTabParagraph")})]}),N==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(os,{tab:A,value:R,fonts:p,disabled:Y,onTabChange:T,onChange:j})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(as,{tab:I,value:F,disabled:Y,onTabChange:E,onChange:U})}),o.jsxs("div",{className:t==="edit"&&l?`${d.actions} ${d.actionsSpread}`:d.actions,children:[t==="edit"&&l?o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y,onClick:()=>X(!0),children:x("customStyleDialogDelete")}):null,o.jsxs("div",{className:d.actionsEnd,children:[o.jsx("button",{type:"button",className:d.action,onClick:y,children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:Y||!ge,onClick:he,children:x("fontDialogOk")})]})]})]})]})})})}const RS='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function TS({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useRef(null),p=c.useRef(null),[g,h]=c.useState(t);if(c.useEffect(()=>{e&&h(t)},[e,t]),c.useEffect(()=>{var b;if(!e)return;(b=p.current)==null||b.focus();const y=m.current,x=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),i();return}if(S.key!=="Tab"||!y)return;const v=[...y.querySelectorAll(RS)];if(v.length===0)return;const k=v[0],P=v[v.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),P.focus()):!S.shiftKey&&document.activeElement===P&&(S.preventDefault(),k.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,i]),!e)return null;const C=()=>{n||r(g)};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("customCssDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("customCssDialogCloseAria"),onClick:i,children:o.jsx(_e,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:a("customCssDialogField")}),o.jsx("textarea",{ref:p,id:u,className:d.textarea,value:g,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:y=>h(y.target.value)})]})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:C,children:a("fontDialogOk")})]})]})})})}const Fu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',NS={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function MS({open:e,existingIds:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useId(),m=c.useId(),p=c.useRef(null),[g,h]=c.useState(""),[C,y]=c.useState(!1),x=c.useMemo(()=>new Set(t),[t]),b=ef(g,x);if(c.useEffect(()=>{e&&(h(""),y(!1))},[e]),c.useEffect(()=>{if(!e)return;const P=p.current,N=P==null?void 0:P.querySelector(Fu);N==null||N.focus();const D=A=>{if(A.key==="Escape"){A.preventDefault(),A.stopPropagation(),i();return}if(A.key!=="Tab"||!P)return;const T=[...P.querySelectorAll(Fu)];if(T.length===0)return;const I=T[0],E=T[T.length-1];A.shiftKey&&document.activeElement===I?(A.preventDefault(),E.focus()):!A.shiftKey&&document.activeElement===E&&(A.preventDefault(),I.focus())};return document.addEventListener("keydown",D,!0),()=>document.removeEventListener("keydown",D,!0)},[e,i]),!e)return null;const S=C||g.trim().length>0?b:null,v=b===null&&!n,k=()=>{y(!0),!(b||n)&&r(g.trim())};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:p,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:P=>P.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("bookmarkDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:i,children:o.jsx(_e,{})})]}),o.jsx("div",{className:d.body,children:o.jsxs("div",{className:d.field,children:[o.jsxs("div",{className:d.labelRow,children:[o.jsx("label",{className:d.label,htmlFor:u,children:a("bookmarkDialogName")}),o.jsx($t,{label:a("bookmarkDialogHelp"),elevated:!0,children:o.jsx("button",{type:"button",className:d.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),o.jsx("input",{id:u,className:d.textInput,value:g,disabled:n,"aria-invalid":S!==null,"aria-describedby":S?m:void 0,onChange:P=>h(P.target.value)}),S?o.jsx("p",{id:m,className:d.error,children:a(NS[S])}):null]})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!v,onClick:k,children:a("fontDialogOk")})]})]})})})}const Bu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',_S={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},LS={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function IS({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),g=c.useId(),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState("file"),[b,S]=c.useState(""),[v,k]=c.useState(""),[P,N]=c.useState(""),[D,A]=c.useState(""),[T,I]=c.useState(null),[E,R]=c.useState(!1);if(c.useEffect(()=>{e&&(x("file"),S(""),k(""),N(""),A(""),I(null),R(!1),C.current&&(C.current.value=""))},[e]),c.useEffect(()=>{if(!e)return;const Y=h.current,he=Y==null?void 0:Y.querySelector(Bu);he==null||he.focus();const te=ie=>{if(ie.key==="Escape"){ie.preventDefault(),ie.stopPropagation(),a();return}if(ie.key!=="Tab"||!Y)return;const M=[...Y.querySelectorAll(Bu)];if(M.length===0)return;const V=M[0],re=M[M.length-1];ie.shiftKey&&document.activeElement===V?(ie.preventDefault(),re.focus()):!ie.shiftKey&&document.activeElement===re&&(ie.preventDefault(),V.focus())};return document.addEventListener("keydown",te,!0),()=>document.removeEventListener("keydown",te,!0)},[e,a]),!e)return null;const j=y==="file"?v:y==="url"?b:"",F=y==="custom"?null:ns(j),U=y==="custom"?null:y==="file"&&T?LS[T]:F&&(y==="file"||b.trim().length>0)?_S[F]:null,$=y!=="custom"&&F===null&&!(y==="file"&&T)&&!t&&!E,X=()=>{t||!n||i==null||i()},J=()=>{$&&r({src:j.trim(),title:D.trim()})},ge=Y=>{var te;const he=(te=Y.target.files)==null?void 0:te[0];he&&(R(!0),I(null),mC(he).then(ie=>{k(ie),N(he.name),x("file"),R(!1)},ie=>{const M=ie instanceof Error?ie.message:"";k(""),N(""),x("file"),I(M==="tooLarge"||M==="type"?M:"type"),R(!1),C.current&&(C.current.value="")}))};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:Y=>Y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("audioDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("audioDialogCloseAria"),onClick:a,children:o.jsx(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>x("file"),children:l("audioDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>x("url"),children:l("audioDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>x("custom"),children:n.text}):null]}),y==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:C,type:"file",accept:iC,hidden:!0,disabled:t,"aria-label":l("audioDialogChooseFile"),onChange:ge}),o.jsx("button",{type:"button",className:d.action,disabled:t||E,onClick:()=>{var Y;return(Y=C.current)==null?void 0:Y.click()},children:l("audioDialogChooseFile")}),P?o.jsx("span",{className:d.fileName,children:P}):null]}):null,y==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("audioDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:b,disabled:t,"aria-invalid":U!==null,"aria-describedby":U?g:void 0,onChange:Y=>S(Y.target.value)})]}):null,y==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:X,children:n.buttonCaption})]}):null]}),y!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("audioDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:D,disabled:t,onChange:Y=>A(Y.target.value)})]}):null,U?o.jsx("p",{id:g,className:d.error,children:l(U)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),y!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!$,onClick:J,children:l("fontDialogOk")}):null]})]})})})}const Hu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])';function FS({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),g=c.useRef(null),[h,C]=c.useState(""),[y,x]=c.useState(""),[b,S]=c.useState(""),[v,k]=c.useState("file");if(c.useEffect(()=>{e&&(C(""),x(""),S(""),k("file"))},[e]),c.useEffect(()=>{if(!e)return;const D=g.current,A=D==null?void 0:D.querySelector(Hu);A==null||A.focus();const T=I=>{if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),a();return}if(I.key!=="Tab"||!D)return;const E=[...D.querySelectorAll(Hu)];if(E.length===0)return;const R=E[0],j=E[E.length-1];I.shiftKey&&document.activeElement===R?(I.preventDefault(),j.focus()):!I.shiftKey&&document.activeElement===j&&(I.preventDefault(),R.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,a]),!e)return null;const P=rS(h)&&!t,N=()=>{P&&r({src:h.trim(),alt:y.trim(),title:b.trim()})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:g,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("imageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("imageDialogCloseAria"),onClick:a,children:o.jsx(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx(kf,{src:h,disabled:t,customImagePicker:n,onCustomPick:i,onSourceChange:k,onSrcChange:C}),v!=="custom"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("imageDialogAlt")}),o.jsx("input",{id:m,className:d.textInput,value:y,disabled:t,onChange:D=>x(D.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imageDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:b,disabled:t,onChange:D=>S(D.target.value)})]})]}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),v!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!P,onClick:N,children:l("fontDialogOk")}):null]})]})})})}const BS=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"alignment",labelKey:"imagePropertiesTabAlignment",implemented:!0},{id:"border",labelKey:"imagePropertiesTabBorder",implemented:!0},{id:"advanced",labelKey:"imagePropertiesTabAdvanced",implemented:!0},{id:"hover",labelKey:"imagePropertiesTabHover",implemented:!0}],HS={left:Qo,center:Jo,right:ei},zS=["left","center","right"],OS={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},KS=["width","height","lock"],$S={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},US={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},WS={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},GS={value:1,unit:"pt"},VS={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function Fa(e){return{top:e,right:e,bottom:e,left:e}}function ZS(e){for(const t of Me)if(e[t])return e[t];return null}function qS({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:i,onChange:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),[g,h]=c.useState(()=>Rt(t.margin,Fa(t.margin.top))),C=t.align==="center",y=(b,S)=>{if(t.sizeMode==="lock"&&S){const v=sr(b,S,n);a({...t,width:v.width,height:v.height});return}a({...t,[b]:S})},x=b=>{if(b==="width"){a({...t,sizeMode:b,height:null});return}if(b==="height"){a({...t,sizeMode:b,width:null});return}if(t.width){const S=sr("width",t.width,n);a({...t,sizeMode:b,width:S.width,height:S.height});return}if(t.height){const S=sr("height",t.height,n);a({...t,sizeMode:b,width:S.width,height:S.height});return}a({...t,sizeMode:b})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":l("imagePropertiesDialogTitle"),children:BS.map(b=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":b.id===e,disabled:!b.implemented,onClick:()=>i(b.id),children:l(b.labelKey)},b.id))}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[e==="general"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesSize")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("imagePropertiesSizeMode"),children:KS.map(b=>o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":t.sizeMode===b,disabled:r,onClick:()=>x(b),children:l($S[b])},b))}),o.jsx(qo,{label:l("imagePropertiesWidth"),inputAria:l("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:b=>y("width",b)}),o.jsx(qo,{label:l("imagePropertiesHeight"),inputAria:l("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:b=>y("height",b)})]}):null,e==="alignment"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":l("paragraphDialogAlignment"),children:zS.map(b=>{const S=HS[b];return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":t.align===b,"aria-label":l(OS[b]),disabled:r,onClick:()=>{a({...t,align:t.align===b?null:b})},children:o.jsx(S,{})},b)})})]}):null,e==="border"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogMargin")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:g,disabled:r||C,onChange:()=>{const b=!g;h(b),b&&a({...t,margin:Fa(ZS(t.margin))})}}),l("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(g?["top"]:Me).map(b=>o.jsx(ke,{label:l(g?"paragraphDialogMargin":US[b]),value:t.margin[b],disabled:r||C&&(b==="left"||b==="right"),allowNegative:!0,onChange:S=>{const v=g?Fa(S):{...t.margin,[b]:S};a({...t,margin:v})}},b))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:l("paragraphDialogBorderStyle")}),o.jsx("select",{id:u,className:d.select,value:t.border.style,disabled:r,onChange:b=>{const S=b.target.value;a({...t,border:{style:S,width:S==="none"?null:t.border.width??GS,color:S==="none"?null:t.border.color}})},children:ii.map(b=>o.jsx("option",{value:b,children:l(WS[b])},b))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ke,{label:l("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:b=>{a({...t,border:{...t.border,width:b}})}}),o.jsx(et,{label:l("paragraphDialogBorderColor"),noneLabel:l("colorNone"),value:t.border.color,disabled:r,onChange:b=>{a({...t,border:{...t.border,color:b}})}})]}):null,o.jsx(ke,{label:l("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:b=>{a({...t,borderRadius:b})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:VS})}}),l("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(is,{shadow:t.boxShadow,disabled:r,onChange:b=>{a({...t,boxShadow:b})}}):null]})]}):null,e==="advanced"?o.jsxs(o.Fragment,{children:[o.jsx(Sf,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:b=>{a(jx({...t,opacity:b.opacity,objectFit:b.fit,objectPosition:b.position},n))}}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesRotation")}),o.jsx("div",{className:d.field,children:o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:m,className:d.lengthInput,value:t.rotateDeg===null?"":Q(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":l("imagePropertiesRotation"),onChange:b=>{const S=b.target.value.trim();if(!S){a({...t,rotateDeg:null});return}const v=Number(S.replace(",","."));Number.isFinite(v)&&a({...t,rotateDeg:v})}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:l("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:l("imagePropertiesTabHover")}),o.jsx("p",{className:d.emptyHint,children:l("imagePropertiesHoverHelp")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("imagePropertiesHoverCss")}),o.jsx("textarea",{id:p,className:d.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":l("imagePropertiesHoverCssAria"),onChange:b=>{a({...t,hoverCss:b.target.value})}})]})]}):null]})]})}const zu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function YS({open:e,tab:t,value:n,aspectRatio:r=1,disabled:i,onTabChange:a,onApply:l,onClose:u}){const m=W(),p=c.useId(),g=c.useRef(null),[h,C]=c.useState(n);return c.useEffect(()=>{e&&C(n)},[e,n]),c.useEffect(()=>{if(!e)return;const y=g.current,x=y==null?void 0:y.querySelector(zu);x==null||x.focus();const b=S=>{if(S.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;S.preventDefault(),S.stopPropagation(),u();return}if(S.key!=="Tab"||!y)return;const v=[...y.querySelectorAll(zu)];if(v.length===0)return;const k=v[0],P=v[v.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),P.focus()):!S.shiftKey&&document.activeElement===P&&(S.preventDefault(),k.focus())};return document.addEventListener("keydown",b,!0),()=>document.removeEventListener("keydown",b,!0)},[e,u]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:u,children:o.jsxs("div",{ref:g,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":p,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:p,children:m("imagePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":m("imagePropertiesDialogCloseAria"),onClick:u,children:o.jsx(_e,{})})]}),o.jsx(qS,{tab:t,value:h,aspectRatio:r,disabled:i,onTabChange:a,onChange:C}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:u,children:m("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>l(h),children:m("fontDialogOk")})]})]})})}):null}const XS="_frame_bwkh8_1",JS="_handle_bwkh8_9",QS="_handleEast_bwkh8_29",ek="_handleSouth_bwkh8_37",tk="_handleSouthEast_bwkh8_45",cr={frame:XS,handle:JS,handleEast:QS,handleSouth:ek,handleSouthEast:tk};function ir(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const nk=[{handle:"e",className:cr.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:cr.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:cr.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function Ba(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function rk({img:e,onResize:t,onResizeEnd:n}){const r=W(),i=c.useRef(null),a=c.useRef(e),l=c.useRef(t),u=c.useRef(n),m=c.useRef(null);a.current=e,l.current=t,u.current=n;const p=v=>{const k=i.current;k&&(k.style.left=`${v.left}px`,k.style.top=`${v.top}px`,k.style.width=`${v.width}px`,k.style.height=`${v.height}px`)};c.useLayoutEffect(()=>{p(ir(e));const v=()=>{e.isConnected&&p(ir(e))};return window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[e]);const g=(v,k)=>{const P=m.current,N=a.current;if(!P||!N)return;const D=UC(P.handle,P.start,{x:v-P.originX,y:k-P.originY});l.current(D.width,D.height),N.isConnected&&p(ir(N))},h=()=>{if(!m.current)return;m.current=null;const v=a.current;u.current(),v!=null&&v.isConnected&&p(ir(v))};c.useLayoutEffect(()=>{const v=P=>{if(!m.current)return;const N=Ba(P);N&&g(N.x,N.y)},k=()=>{h()};return document.addEventListener("pointermove",v),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),document.addEventListener("mousemove",v),document.addEventListener("mouseup",k),()=>{document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",k)}},[]);const C=(v,k)=>{const P=Ba(k);P&&(m.current={handle:v,start:WC(a.current),originX:P.x,originY:P.y})},y=v=>k=>{k.preventDefault(),k.stopPropagation(),C(v,k);try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}},x=v=>k=>{k.preventDefault(),k.stopPropagation(),C(v,k)},b=v=>{const k=Ba(v);k&&g(k.x,k.y)};if(!e.isConnected)return null;const S=ir(e);return xl.createPortal(o.jsx("div",{ref:i,className:cr.frame,"data-image-resize-overlay":"",style:{left:S.left,top:S.top,width:S.width,height:S.height},children:nk.map(v=>o.jsx("button",{type:"button",className:`${cr.handle} ${v.className}`,style:{cursor:v.cursor},"aria-label":r(v.ariaKey),"data-resize-handle":v.handle,onPointerDown:y(v.handle),onPointerMove:b,onPointerUp:h,onPointerCancel:h,onMouseDown:x(v.handle),onMouseMove:b,onMouseUp:h},v.handle))}),document.body)}const Ou='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function ok({open:e,tab:t,href:n,title:r,targetBlank:i,textDecorationNone:a,hoverMode:l,hoverColor:u,hoverHtml:m,bookmarks:p,selectedBookmarkId:g,disabled:h,onTabChange:C,onApply:y,onClose:x}){const b=W(),S=c.useId(),v=c.useId(),k=c.useId(),P=c.useId(),N=c.useId(),D=c.useRef(null),[A,T]=c.useState(n),[I,E]=c.useState(r),[R,j]=c.useState(i),[F,U]=c.useState(a),[$,X]=c.useState(l),[J,ge]=c.useState(u),[Y,he]=c.useState(m),[te,ie]=c.useState(g);if(c.useEffect(()=>{e&&(T(n),E(r),j(i),U(a),X(l),ge(u),he(m),ie(g))},[e,n,r,i,a,l,u,m,g]),c.useEffect(()=>{if(!e)return;const G=D.current,ye=G==null?void 0:G.querySelector(Ou);ye==null||ye.focus();const Le=Ce=>{if(Ce.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;Ce.preventDefault(),Ce.stopPropagation(),x();return}if(Ce.key!=="Tab"||!G)return;const Zt=[...G.querySelectorAll(Ou)];if(Zt.length===0)return;const vr=Zt[0],In=Zt[Zt.length-1];Ce.shiftKey&&document.activeElement===vr?(Ce.preventDefault(),In.focus()):!Ce.shiftKey&&document.activeElement===In&&(Ce.preventDefault(),vr.focus())};return document.addEventListener("keydown",Le,!0),()=>document.removeEventListener("keydown",Le,!0)},[e,x,t,$]),!e)return null;const M=()=>ui({title:I,targetBlank:R,textDecorationNone:F,hoverMode:$,hoverColor:J,hoverHtml:Y}),V=()=>{const G=A.trim();!G||h||y({...M(),href:G})},re=()=>{!te||h||y({...M(),href:`#${te}`})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:x,children:o.jsxs("div",{ref:D,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":S,onMouseDown:G=>G.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:S,children:b("linkDialogTitle")}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":b("linkDialogTitle"),children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="link",onClick:()=>C("link"),children:b("linkDialogTabLink")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>C("bookmark"),children:b("linkDialogTabBookmark")})]}),o.jsxs("div",{className:d.body,role:"tabpanel",children:[t==="link"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:v,children:b("linkDialogHref")}),o.jsx("input",{id:v,className:d.textInput,value:A,disabled:h,onChange:G=>T(G.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:k,children:b("linkDialogHoverTitle")}),o.jsx("input",{id:k,className:d.textInput,value:I,disabled:h,onChange:G=>E(G.target.value)})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:R,disabled:h,onChange:G=>j(G.target.checked)}),b("linkDialogTargetBlank")]})]}):p.length===0?o.jsx("p",{className:d.emptyHint,children:b("linkDialogBookmarkEmpty")}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:P,children:b("linkDialogBookmark")}),o.jsxs("select",{id:P,className:`${d.select} ${d.fullSelect}`,value:te,disabled:h,onChange:G=>ie(G.target.value),children:[o.jsx("option",{value:""}),p.map(G=>o.jsx("option",{value:G.id,children:G.id},G.id))]})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:F,disabled:h,onChange:G=>U(G.target.checked)}),b("linkDialogTextDecorationNone")]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:b("linkDialogHover")}),o.jsxs("div",{className:d.sizeRow,role:"group","aria-label":b("linkDialogHover"),children:[o.jsx("button",{type:"button",className:d.action,"aria-pressed":$==="color",disabled:h,onClick:()=>X("color"),children:b("linkDialogHoverColor")}),o.jsx("button",{type:"button",className:d.action,"aria-pressed":$==="html",disabled:h,onClick:()=>X("html"),children:b("linkDialogHoverHtml")})]}),$==="color"?o.jsx(et,{label:b("linkDialogHoverColorField"),noneLabel:b("colorNone"),value:J,disabled:h,onChange:ge}):o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:N,children:b("linkDialogHoverHtmlAria")}),o.jsx("textarea",{id:N,className:d.textarea,value:Y,disabled:h,spellCheck:!1,onChange:G=>he(G.target.value)})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:h||!te,onClick:re,children:b("linkDialogSelect")}),o.jsx("button",{type:"button",className:d.action,onClick:x,children:b("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:h||!A.trim(),onClick:V,children:b("fontDialogOk")})]})]})})})}const Ku='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',$u={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function ik({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:i,onClose:a}){const l=W(),u=c.useId(),m=c.useId(),p=c.useId(),g=c.useId(),h=c.useRef(null),[C,y]=c.useState("url"),[x,b]=c.useState(""),[S,v]=c.useState("");if(c.useEffect(()=>{e&&(y("url"),b(""),v(""))},[e]),c.useEffect(()=>{if(!e)return;const T=h.current,I=T==null?void 0:T.querySelector(Ku);I==null||I.focus();const E=R=>{if(R.key==="Escape"){R.preventDefault(),R.stopPropagation(),a();return}if(R.key!=="Tab"||!T)return;const j=[...T.querySelectorAll(Ku)];if(j.length===0)return;const F=j[0],U=j[j.length-1];R.shiftKey&&document.activeElement===F?(R.preventDefault(),U.focus()):!R.shiftKey&&document.activeElement===U&&(R.preventDefault(),F.focus())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[e,a]),!e)return null;const k=C==="custom"?null:sf(x),P=C==="custom"?null:k&&x.trim().length>0?$u[k]:k==="empty"&&x.trim().length===0?null:k?$u[k]:null,N=C!=="custom"&&k===null&&!t&&x.trim().length>0,D=()=>{t||!n||i==null||i()},A=()=>{N&&r({url:x.trim(),title:S.trim()})};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:h,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:T=>T.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:l("youtubeDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":l("youtubeDialogCloseAria"),onClick:a,children:o.jsx(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:l("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":l("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":C==="url",disabled:t,onClick:()=>y("url"),children:l("youtubeDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":C==="custom",disabled:t,onClick:()=>y("custom"),children:n.text}):null]}),C==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:m,children:l("youtubeDialogUrl")}),o.jsx("input",{id:m,className:d.textInput,value:x,disabled:t,"aria-invalid":P!==null,"aria-describedby":P?g:void 0,onChange:T=>b(T.target.value)})]}):null,C==="custom"&&n?o.jsxs("div",{className:d.field,children:[o.jsx("p",{className:d.emptyHint,children:n.description}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:D,children:n.buttonCaption})]}):null]}),C!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:p,children:l("youtubeDialogTitleField")}),o.jsx("input",{id:p,className:d.textInput,value:S,disabled:t,onChange:T=>v(T.target.value)})]}):null,P?o.jsx("p",{id:g,className:d.error,children:l(P)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:l("fontDialogCancel")}),C!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!N,onClick:A,children:l("fontDialogOk")}):null]})]})})})}const ak="_grid_1bpma_1",lk="_cell_1bpma_8",sk="_sizeLabel_1bpma_27",ck="_sizeFields_1bpma_33",uk="_numberInput_1bpma_37",bn={grid:ak,cell:lk,sizeLabel:sk,sizeFields:ck,numberInput:uk},Uu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',Bt={rows:3,cols:3};function dk({open:e,disabled:t,onApply:n,onClose:r}){const i=W(),a=c.useId(),l=c.useId(),u=c.useId(),m=c.useRef(null),[p,g]=c.useState(Bt.rows),[h,C]=c.useState(Bt.cols),[y,x]=c.useState(String(Bt.rows)),[b,S]=c.useState(String(Bt.cols)),[v,k]=c.useState(!1);if(c.useEffect(()=>{e&&(g(Bt.rows),C(Bt.cols),x(String(Bt.rows)),S(String(Bt.cols)),k(!1))},[e]),c.useEffect(()=>{if(!e)return;const E=m.current,R=E==null?void 0:E.querySelector(Uu);R==null||R.focus();const j=F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),r();return}if(F.key!=="Tab"||!E)return;const U=[...E.querySelectorAll(Uu)];if(U.length===0)return;const $=U[0],X=U[U.length-1];F.shiftKey&&document.activeElement===$?(F.preventDefault(),X.focus()):!F.shiftKey&&document.activeElement===X&&(F.preventDefault(),$.focus())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[e,r]),!e)return null;const N=Dm(p,h)&&!t,D=(E,R)=>{const j=Math.min(vn,Math.max(wn,E)),F=Math.min(vn,Math.max(wn,R));g(j),C(F),x(String(j)),S(String(F))},A=(E,R)=>{const j=Number.parseInt(E,10);if(!Number.isFinite(j)){R==="rows"?x(String(p)):S(String(h));return}k(!0),R==="rows"?D(j,h):D(p,j)},T=(E,R)=>{const j=E.replace(/\D/g,"");if(R==="rows"?x(j):S(j),j==="")return;const F=Number.parseInt(j,10);Number.isFinite(F)&&(k(!0),R==="rows"?D(F,h):D(p,F))},I=E=>{(E.key==="e"||E.key==="E"||E.key==="+"||E.key==="-"||E.key===".")&&E.preventDefault()};return o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:r,children:o.jsxs("div",{ref:m,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:E=>E.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:a,children:i("tableDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":i("tableDialogCloseAria"),onClick:r,children:o.jsx(_e,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx("div",{className:bn.grid,role:"grid","aria-label":i("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:eu},(E,R)=>Array.from({length:eu},(j,F)=>{const U=R+1,$=F+1,X=U<=p&&$<=h;return o.jsx("button",{type:"button",className:bn.cell,role:"gridcell","data-active":X?"true":void 0,"aria-label":`${U} × ${$}`,"aria-pressed":X&&U===p&&$===h,disabled:t,onMouseEnter:()=>{v||D(U,$)},onClick:()=>{k(!0),D(U,$)}},`${U}-${$}`)}))}),o.jsxs("p",{className:bn.sizeLabel,children:[i("tableDialogSize"),": ",p," × ",h]}),o.jsxs("div",{className:`${d.sizeRow} ${bn.sizeFields}`,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:i("tableDialogRows")}),o.jsx("input",{id:l,className:bn.numberInput,type:"number",inputMode:"numeric",min:wn,max:vn,step:1,value:y,disabled:t,onKeyDown:I,onChange:E=>T(E.target.value,"rows"),onBlur:()=>A(y,"rows")})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:i("tableDialogColumns")}),o.jsx("input",{id:u,className:bn.numberInput,type:"number",inputMode:"numeric",min:wn,max:vn,step:1,value:b,disabled:t,onKeyDown:I,onChange:E=>T(E.target.value,"cols"),onBlur:()=>A(b,"cols")})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:r,children:i("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!N,onClick:()=>{N&&n({rows:p,cols:h})},children:i("tableDialogInsert")})]})]})})})}const mk={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},fk={value:1,unit:"pt"},pk={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1};function gk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=c.useId();return o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("tablePropertiesWidth")}),o.jsx(ke,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:l=>n({...e,width:l})}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("tablePropertiesCollapse")}),o.jsxs("select",{id:i,className:d.select,value:e.borderCollapse,disabled:t,onChange:l=>{const u=l.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:u,borderSpacing:u==="separate"?e.borderSpacing:null})},children:[o.jsx("option",{value:"collapse",children:r("tablePropertiesCollapseCollapse")}),o.jsx("option",{value:"separate",children:r("tablePropertiesCollapseSeparate")})]})]}),e.borderCollapse==="separate"?o.jsx(ke,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:l=>n({...e,borderSpacing:l})}):null]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),o.jsx("select",{id:a,className:d.select,value:e.border.style,disabled:t,onChange:l=>{const u=l.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??fk,color:u==="none"?null:e.border.color}})},children:ii.map(l=>o.jsx("option",{value:l,children:r(mk[l])},l))})]}),e.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(ke,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:l=>n({...e,border:{...e.border,width:l}})}),o.jsx(et,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:l=>n({...e,border:{...e.border,color:l}})})]}):null,o.jsx(ke,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:l=>n({...e,borderRadius:l})}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:pk})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?o.jsx(is,{shadow:e.boxShadow,disabled:t,onChange:l=>n({...e,boxShadow:l})}):null]})]})}const Wu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function hk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,p]=c.useState(t);return c.useEffect(()=>{e&&p(t)},[e,t]),c.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(Wu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(Wu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("tablePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:i,children:o.jsx(_e,{})})]}),o.jsx(gk,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const bk=["left","center","right"],yk={left:Qo,center:Jo,right:ei},xk={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},Ck={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},wk={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function So(e){return{top:e,right:e,bottom:e,left:e}}function Ha(e){for(const t of Me)if(e[t])return e[t];return null}function vk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=c.useId(),l=c.useId(),[u,m]=c.useState(()=>Rt(e.padding,So(Ha(e.padding))));return c.useEffect(()=>{m(Rt(e.padding,So(Ha(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(et,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:p=>n({...e,backgroundColor:p})}),o.jsx(et,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:p=>n({...e,color:p})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:u,disabled:t,onChange:()=>{const p=!u;m(p),p&&n({...e,padding:So(Ha(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(u?["top"]:Me).map(p=>o.jsx(ke,{label:r(u?"paragraphDialogPadding":Ck[p]),value:e.padding[p],disabled:t,onChange:g=>{const h=u?So(g):{...e.padding,[p]:g};n({...e,padding:h})}},p))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:bk.map(p=>{const g=yk[p],h=(e.textAlign??"left")===p;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":h,"aria-label":r(xk[p]),disabled:t,onClick:()=>{n({...e,textAlign:p==="left"?null:p})},children:o.jsx(g,{})},p)})})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:p=>{const g=p.target.value;n({...e,verticalAlign:g||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),mi.map(p=>o.jsx("option",{value:p,children:r(wk[p])},p))]})]}),o.jsx(ke,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:p=>n({...e,width:p})}),o.jsxs("div",{className:d.sizeRow,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:a,children:r("cellPropertiesColSpan")}),o.jsx("input",{id:a,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:p=>{const g=Number.parseInt(p.target.value,10);n({...e,colSpan:Number.isFinite(g)?Math.max(1,g):1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:l,children:r("cellPropertiesRowSpan")}),o.jsx("input",{id:l,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:p=>{const g=Number.parseInt(p.target.value,10);n({...e,rowSpan:Number.isFinite(g)?Math.max(1,g):1})}})]})]})]})}const Gu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Sk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,p]=c.useState(t);return c.useEffect(()=>{e&&p(t)},[e,t]),c.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(Gu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(Gu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("cellPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:i,children:o.jsx(_e,{})})]}),o.jsx(vk,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const kk={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Ak={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function ko(e){return{top:e,right:e,bottom:e,left:e}}function za(e){for(const t of Me)if(e[t])return e[t];return null}function Pk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),[a,l]=c.useState(()=>Rt(e.padding,ko(za(e.padding))));return c.useEffect(()=>{l(Rt(e.padding,ko(za(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(et,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),o.jsx(et,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:r("paragraphDialogPadding")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const u=!a;l(u),u&&n({...e,padding:ko(za(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Me).map(u=>o.jsx(ke,{label:r(a?"paragraphDialogPadding":kk[u]),value:e.padding[u],disabled:t,onChange:m=>{const p=a?ko(m):{...e.padding,[u]:m};n({...e,padding:p})}},u))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:i,children:r("cellPropertiesVerticalAlign")}),o.jsxs("select",{id:i,className:d.select,value:e.verticalAlign??"",disabled:t,onChange:u=>{const m=u.target.value;n({...e,verticalAlign:m||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),mi.map(u=>o.jsx("option",{value:u,children:r(Ak[u])},u))]})]}),o.jsx(ke,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}const Vu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Dk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),l=c.useId(),u=c.useRef(null),[m,p]=c.useState(t);return c.useEffect(()=>{e&&p(t)},[e,t]),c.useEffect(()=>{if(!e)return;const g=u.current,h=g==null?void 0:g.querySelector(Vu);h==null||h.focus();const C=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!g)return;const x=[...g.querySelectorAll(Vu)];if(x.length===0)return;const b=x[0],S=x[x.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),S.focus()):!y.shiftKey&&document.activeElement===S&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),e?o.jsx(se,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:u,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":l,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:l,children:a("rowPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:i,children:o.jsx(_e,{})})]}),o.jsx(Pk,{value:m,disabled:n,onChange:p}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:i,children:a("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:n,onClick:()=>r(m),children:a("fontDialogOk")})]})]})})}):null}const jk="_backdrop_9d3gw_1",Ek="_dialog_9d3gw_12",Rk="_headerRow_9d3gw_29",Tk="_header_9d3gw_29",Nk="_close_9d3gw_44",Mk="_body_9d3gw_66",_k="_frame_9d3gw_75",Lk="_actions_9d3gw_83",Ik="_action_9d3gw_83",At={backdrop:jk,dialog:Ek,headerRow:Rk,header:Tk,close:Nk,body:Mk,frame:_k,actions:Lk,action:Ik},Zu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function Fk({open:e,html:t,onClose:n}){const r=W(),i=c.useId(),a=c.useRef(null),l=c.useRef(null);return c.useEffect(()=>{if(!e)return;const u=a.current,m=u==null?void 0:u.querySelector(Zu);m==null||m.focus();const p=g=>{if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),n();return}if(g.key!=="Tab"||!u)return;const h=[...u.querySelectorAll(Zu)];if(h.length===0)return;const C=h[0],y=h[h.length-1];g.shiftKey&&document.activeElement===C?(g.preventDefault(),y.focus()):!g.shiftKey&&document.activeElement===y&&(g.preventDefault(),C.focus())};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[e,n]),c.useEffect(()=>{var m;if(!e)return;const u=(m=l.current)==null?void 0:m.contentDocument;u&&Za(u,t,r("previewDialogTitle"))},[e,t,r]),e?o.jsx(se,{children:o.jsx("div",{className:At.backdrop,role:"presentation",onMouseDown:n,children:o.jsxs("div",{ref:a,className:At.dialog,role:"dialog","aria-modal":"true","aria-labelledby":i,onMouseDown:u=>u.stopPropagation(),children:[o.jsxs("div",{className:At.headerRow,children:[o.jsx("h2",{className:At.header,id:i,children:r("previewDialogTitle")}),o.jsx("button",{type:"button",className:At.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:o.jsx(_e,{})})]}),o.jsx("div",{className:At.body,children:o.jsx("iframe",{ref:l,className:At.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var m;const u=(m=l.current)==null?void 0:m.contentDocument;u&&Za(u,t,r("previewDialogTitle"))}})}),o.jsx("div",{className:At.actions,children:o.jsx("button",{type:"button",className:At.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const Af="commspliant-html-editor.darkMode";function Bk(e){return typeof e=="boolean"?e:null}function qu(){try{const e=localStorage.getItem(Af);return e?Bk(JSON.parse(e)):null}catch{return null}}function Hk(e){try{localStorage.setItem(Af,JSON.stringify(e))}catch{}}const Pf="commspliant-html-editor.pageZoom",zk=new Set(["fitWidth","fitPage"]);function Ok(e){return typeof e=="string"&&zk.has(e)||typeof e=="number"&&wb.includes(e)?e:null}function Kk(){try{const e=localStorage.getItem(Pf);return e?Ok(JSON.parse(e)):null}catch{return null}}function $k(e){try{localStorage.setItem(Pf,JSON.stringify(e))}catch{}}const Df="commspliant-html-editor.toolbarPosition",Uk=["top","left","right","bottom"];function jf(e){return typeof e=="string"&&Uk.includes(e)?e:null}function Yu(){try{const e=localStorage.getItem(Df);return e?jf(JSON.parse(e)):null}catch{return null}}function Wk(e){try{localStorage.setItem(Df,JSON.stringify(e))}catch{}}const Gk="_panel_6xdnw_1",Vk="_header_6xdnw_17",Zk="_title_6xdnw_26",qk="_close_6xdnw_32",Yk="_messages_6xdnw_48",Xk="_empty_6xdnw_57",Jk="_message_6xdnw_48",Qk="_messageHeader_6xdnw_69",eA="_author_6xdnw_77",tA="_time_6xdnw_81",nA="_body_6xdnw_86",rA="_reply_6xdnw_92",oA="_input_6xdnw_100",iA="_post_6xdnw_111",Fe={panel:Gk,header:Vk,title:Zk,close:qk,messages:Yk,empty:Xk,message:Jk,messageHeader:Qk,author:eA,time:tA,body:nA,reply:rA,input:oA,post:iA};function aA(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function lA({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:i,onPost:a,onClose:l}){const u=W(),[m,p]=c.useState(""),g=c.useRef(null);c.useEffect(()=>{var b;(b=g.current)==null||b.focus()},[e==null?void 0:e.id]);const h=!n&&r&&m.trim().length>0,C=c.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),y=C.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const x=()=>{const b=m.trim();!b||!h||(a(b),p(""))};return xl.createPortal(o.jsxs("div",{ref:i,className:Fe.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[o.jsxs("div",{className:Fe.header,children:[o.jsx("h2",{className:Fe.title,children:u("commentPanelTitle")}),o.jsx("button",{type:"button",className:Fe.close,onClick:l,"aria-label":u("commentPanelCloseAria"),children:o.jsx(_e,{})})]}),o.jsx("div",{className:Fe.messages,children:C.length===0?o.jsx("p",{className:Fe.empty,children:u("commentEmpty")}):C.map(b=>o.jsxs("article",{className:Fe.message,children:[o.jsxs("header",{className:Fe.messageHeader,children:[o.jsx("span",{className:Fe.author,children:b.userName}),o.jsx("time",{className:Fe.time,dateTime:b.createdAt,children:aA(b.createdAt,t)})]}),o.jsx("p",{className:Fe.body,children:b.message})]},b.id))}),o.jsxs("div",{className:Fe.reply,children:[o.jsx("textarea",{ref:g,className:Fe.input,value:m,onChange:b=>p(b.target.value),placeholder:y,rows:3,disabled:n||!r}),o.jsx("button",{type:"button",className:Fe.post,onClick:x,disabled:!h,children:u("commentPost")})]})]}),document.body)}function sA({enabled:e,onHtml:t}){const[n,r]=c.useState(!1),i=c.useRef(0),a=c.useRef(e),l=c.useRef(t);a.current=e,l.current=t;const u=c.useCallback(()=>{i.current=0,r(!1)},[]);c.useEffect(()=>{e||u()},[e,u]);const m=c.useCallback(C=>{!a.current||!mo(C.dataTransfer)||(C.preventDefault(),i.current+=1,r(!0))},[]),p=c.useCallback(C=>{!a.current||!mo(C.dataTransfer)||(C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="copy"))},[]),g=c.useCallback(C=>{if(!a.current||!mo(C.dataTransfer))return;const y=C.relatedTarget;y instanceof Node&&C.currentTarget.contains(y)||(i.current=Math.max(0,i.current-1),i.current===0&&r(!1))},[]),h=c.useCallback(C=>{if(!a.current||!mo(C.dataTransfer))return;C.preventDefault(),u();const y=jg(C.dataTransfer);y&&Pl(y).then(x=>{a.current&&l.current(x)},()=>{})},[u]);return{dragging:n,onDragEnter:m,onDragOver:p,onDragLeave:g,onDrop:h}}const cA={menus:{edit:{id:"edit",labelKey:"menuEdit",ariaKey:"menuEditAria"}},submenus:{page:{id:"page",labelKey:"menuPage",ariaKey:"menuPageAria"}},groups:{edit:{id:"edit",labelKey:"toolbarGroupEdit"}},items:{undo:{id:"undo",command:"undo",icon:Vp,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Kp,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:sd,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"}}},uA=400,Xu=100;function dA(e){let t=[],n=e,r=[],i=!1,a=!1,l=0;function u(){t.length<=Xu||t.splice(0,t.length-Xu)}function m(y){t.push(y),u()}function p(y,x){if(i){n=y,i=!1;return}if(y===n)return;const b=Date.now(),S=(x==null?void 0:x.coalesce)===!0;if(S&&a&&b-l<uA){n=y,l=b;return}m(n),n=y,r=[],l=b,a=S}function g(){return t.length===0?null:(a=!1,r.push(n),n=t.pop(),n)}function h(){return r.length===0?null:(a=!1,m(n),n=r.pop(),n)}function C(y){if(i){n=y,i=!1;return}y!==n&&(m(n),n=y,r=[],a=!1)}return{record:p,undo:g,redo:h,canUndo:()=>t.length>0,canRedo:()=>r.length>0,syncExternal:C,markApplying:()=>{i=!0}}}function Ut(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function Yo(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):Ut(e,t):""}const ft="fullscreen",hl="commspliant-html-editor.toolbarCustomization";function bl(e){const t=e.filter(n=>n!==ft);return e.includes(ft)?[...t,ft]:t}function ls(e,t){if(!t||t.length===0)return bl(e);const n=new Set(e),r=t.filter(l=>n.has(l)),i=new Set(r),a=[...r];for(let l=0;l<e.length;l++){const u=e[l];if(i.has(u))continue;let m=0;for(let p=l-1;p>=0;p--){const g=e[p],h=a.indexOf(g);if(h>=0){m=h+1;break}}a.splice(m,0,u),i.add(u)}return bl(a)}function mA(e,t){const n=new Map(e.map(l=>[l.id,l])),r=ls(e.map(l=>l.id),t==null?void 0:t.groupOrder),i=new Set((t==null?void 0:t.hiddenItemIds)??[]),a=[];for(const l of r){const u=n.get(l);if(!u)continue;const m=u.items.filter(p=>!i.has(p));m.length!==0&&a.push({id:l,items:m})}return a}function fA(e){if(e==null||typeof e!="object")return null;const t=e,n=Array.isArray(t.groupOrder)?t.groupOrder.filter(i=>typeof i=="string"):[],r=Array.isArray(t.hiddenItemIds)?[...new Set(t.hiddenItemIds.filter(i=>typeof i=="string"))]:[];return n.length===0&&r.length===0?null:{groupOrder:n,hiddenItemIds:r}}function pA(){try{const e=localStorage.getItem(hl);return e?fA(JSON.parse(e)):null}catch{return null}}function gA(e){try{if(!e){localStorage.removeItem(hl);return}localStorage.setItem(hl,JSON.stringify(e))}catch{}}function ss(e,t){return ls(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function hA(e,t,n,r){const i=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?i.delete(n):i.add(n),{groupOrder:ss(e,t),hiddenItemIds:[...i]}}function Ef(e,t,n,r){const i=ss(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===ft||r===ft)return{groupOrder:i,hiddenItemIds:a};const l=i.indexOf(n),u=i.indexOf(r);if(l<0||u<0||l===u)return{groupOrder:i,hiddenItemIds:a};const m=[...i],[p]=m.splice(l,1);return m.splice(u,0,p),{groupOrder:bl(m),hiddenItemIds:a}}function Ju(e,t,n,r){const i=ss(e,t),a=i.filter(m=>m!==ft),l=a.indexOf(n),u=l+r;return l<0||u<0||u>=a.length?{groupOrder:i,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:Ef(e,t,n,a[u])}const bA="_backdrop_11w4e_1",yA="_dialog_11w4e_12",xA="_header_11w4e_31",CA="_body_11w4e_39",wA="_group_11w4e_49",vA="_groupDragging_11w4e_55",SA="_groupDropTarget_11w4e_59",kA="_groupHeader_11w4e_64",AA="_groupTitle_11w4e_72",PA="_dragHandle_11w4e_77",DA="_moveButton_11w4e_78",jA="_items_11w4e_119",EA="_item_11w4e_119",RA="_itemIcon_11w4e_135",TA="_itemTitle_11w4e_144",NA="_itemCheckbox_11w4e_151",MA="_actions_11w4e_155",_A="_action_11w4e_155",LA="_spinnerWrap_11w4e_191",IA="_spinner_11w4e_191",me={backdrop:bA,dialog:yA,header:xA,body:CA,group:wA,groupDragging:vA,groupDropTarget:SA,groupHeader:kA,groupTitle:AA,dragHandle:PA,moveButton:DA,items:jA,item:EA,itemIcon:RA,itemTitle:TA,itemCheckbox:NA,actions:MA,action:_A,spinnerWrap:LA,spinner:IA},Qu='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function FA(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"currentColor",children:[o.jsx("circle",{cx:"5",cy:"4",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"4",r:"1.2"}),o.jsx("circle",{cx:"5",cy:"8",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"8",r:"1.2"}),o.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),o.jsx("circle",{cx:"11",cy:"12",r:"1.2"})]})}function BA({open:e,catalog:t,groups:n,settings:r,loading:i=!1,busy:a=!1,disabled:l,onChange:u,onReset:m,onClose:p}){const g=W(),h=c.useId(),C=c.useRef(null),[y,x]=c.useState(null),[b,S]=c.useState(null),v=ls(n.map(j=>j.id),r==null?void 0:r.groupOrder),k=new Set((r==null?void 0:r.hiddenItemIds)??[]),P=new Map(n.map(j=>[j.id,j])),N=v.map(j=>P.get(j)).filter(j=>!!j),D=l||a||i;if(c.useEffect(()=>{e||(x(null),S(null))},[e]),c.useEffect(()=>{if(!e)return;const j=C.current,F=j==null?void 0:j.querySelector(Qu);F==null||F.focus();const U=$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),p();return}if($.key!=="Tab"||!j)return;const X=[...j.querySelectorAll(Qu)];if(X.length===0)return;const J=X[0],ge=X[X.length-1];$.shiftKey&&document.activeElement===J?($.preventDefault(),ge.focus()):!$.shiftKey&&document.activeElement===ge&&($.preventDefault(),J.focus())};return document.addEventListener("keydown",U,!0),()=>document.removeEventListener("keydown",U,!0)},[e,p]),!e)return null;const A=N.map(j=>j.id).filter(j=>j!==ft),T=(j,F)=>{if(D||F===ft){j.preventDefault();return}j.dataTransfer.setData("text/plain",F),j.dataTransfer.effectAllowed="move",x(F)},I=(j,F)=>{D||F===ft||!y||y===F||(j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move"),S(F))},E=(j,F)=>{var $;j.preventDefault();const U=(($=j.dataTransfer)==null?void 0:$.getData("text/plain"))||y;x(null),S(null),!(!U||U===F||D)&&u(Ef(r,n,U,F))},R=()=>{x(null),S(null)};return o.jsx(se,{children:o.jsx("div",{className:me.backdrop,role:"presentation",onMouseDown:p,children:o.jsxs("div",{ref:C,className:me.dialog,role:"dialog","aria-modal":"true","aria-labelledby":h,"aria-busy":i||a?!0:void 0,onMouseDown:j=>j.stopPropagation(),children:[o.jsx("h2",{className:me.header,id:h,children:g("customizeToolbarDialogTitle")}),o.jsx("div",{className:me.body,children:i?o.jsx("div",{className:me.spinnerWrap,role:"status","aria-live":"polite","aria-label":g("customizeToolbarDialogLoading"),children:o.jsx("span",{className:me.spinner,"aria-hidden":"true"})}):N.map(j=>{const F=t.groups[j.id],U=F?Ut(g,F):j.id,$=j.id===ft,X=A.indexOf(j.id);return o.jsxs("section",{className:[me.group,y===j.id?me.groupDragging:"",b===j.id?me.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":j.id,"aria-label":U,onDragOver:J=>I(J,j.id),onDrop:J=>E(J,j.id),onDragLeave:()=>{b===j.id&&S(null)},children:[o.jsxs("div",{className:me.groupHeader,children:[o.jsx("button",{type:"button",className:me.dragHandle,draggable:!D&&!$,disabled:D||$,"aria-label":g("customizeToolbarDragHandle"),onDragStart:J=>T(J,j.id),onDragEnd:R,children:o.jsx(FA,{})}),o.jsx("span",{className:me.groupTitle,children:U}),o.jsx("button",{type:"button",className:me.moveButton,disabled:D||$||X<=0,"aria-label":g("customizeToolbarMoveUp"),onClick:()=>u(Ju(r,n,j.id,-1)),children:"↑"}),o.jsx("button",{type:"button",className:me.moveButton,disabled:D||$||X<0||X>=A.length-1,"aria-label":g("customizeToolbarMoveDown"),onClick:()=>u(Ju(r,n,j.id,1)),children:"↓"})]}),o.jsx("div",{className:me.items,children:j.items.map(J=>{const ge=t.items[J];if(!ge)return null;const Y=ge.icon,he=Ut(g,ge),te=`${h}-${j.id}-${J}`,ie=!k.has(J);return o.jsxs("label",{className:me.item,htmlFor:te,children:[o.jsx("span",{className:me.itemIcon,"aria-hidden":"true",children:Y?o.jsx(Y,{}):he.slice(0,2)}),o.jsx("span",{className:me.itemTitle,children:he}),o.jsx("input",{id:te,className:me.itemCheckbox,type:"checkbox",checked:ie,disabled:D,"aria-label":`${he}: ${g("customizeToolbarItemVisible")}`,onChange:M=>u(hA(r,n,J,M.target.checked))})]},J)})})]},j.id)})}),o.jsxs("div",{className:me.actions,children:[o.jsx("button",{type:"button",className:me.action,disabled:D,onClick:m,children:g("customizeToolbarDialogReset")}),o.jsx("button",{type:"button",className:me.action,"aria-label":g("customizeToolbarDialogCloseAria"),onClick:p,children:g("customizeToolbarDialogClose")})]})]})})})}function HA(e,t){if(!t)return e;const n=t.menus,r=t.toolbar;if(n===void 0&&r===void 0)return e;const i=n===void 0?e.menus:e.menus.filter(l=>n.includes(l.id)),a=r===void 0?e.iconGroups:e.iconGroups.map(l=>({id:l.id,items:l.items.filter(u=>r.includes(u))})).filter(l=>l.items.length>0);return{menus:i,iconGroups:a}}const zA={menus:{file:{id:"file",labelKey:"menuFile",ariaKey:"menuFileAria"}},groups:{file:{id:"file",labelKey:"toolbarGroupFile"},print:{id:"print",labelKey:"toolbarGroupPrint"}},items:{save:{id:"save",command:"save",icon:Up,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:Mp,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:zp,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},Ao=4;function Rf({icon:e,value:t,mixed:n,noneKey:r,labelKey:i,ariaKey:a,fallbackCustom:l,disabled:u,onChange:m}){const p=W(),g=c.useId(),h=c.useRef(null),C=c.useRef(null),y=c.useRef(null),[x,b]=c.useState(!1),[S,v]=c.useState({top:0,left:0}),k=c.useCallback(()=>{const T=C.current,I=y.current;if(!T)return;const E=T.getBoundingClientRect(),R=(I==null?void 0:I.offsetHeight)??0,j=(I==null?void 0:I.offsetWidth)??200;let F=E.bottom;F+R>window.innerHeight-Ao&&(F=Math.max(Ao,E.top-R));const U=Math.min(Math.max(E.left,Ao),window.innerWidth-j-Ao);v({top:F,left:U})},[]);c.useLayoutEffect(()=>{if(!x)return;k();const T=()=>k();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[x,k]),c.useEffect(()=>{if(!x)return;const T=E=>{var j,F;const R=E.target;(j=h.current)!=null&&j.contains(R)||(F=y.current)!=null&&F.contains(R)||b(!1)},I=E=>{var R;E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),b(!1),(R=C.current)==null||R.focus())};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",I,!0)}},[x]);const P=T=>{m(T)},N=`${en.bar}${!t||n?` ${en.barEmpty}`:""}`,D=t&&!n?{backgroundColor:t}:void 0,A=o.jsxs("div",{className:en.wrap,ref:h,children:[o.jsxs("button",{ref:C,type:"button",className:`${q.iconButton} ${en.button}`,"aria-label":p(a),"aria-expanded":x,"aria-haspopup":"listbox","aria-controls":x?g:void 0,disabled:u,onMouseDown:T=>T.preventDefault(),onClick:()=>b(T=>!T),children:[o.jsx(e,{className:`${q.icon} ${en.icon}`}),o.jsx("span",{className:N,style:D})]}),x?o.jsx(se,{children:o.jsx("div",{ref:y,id:g,className:en.popover,style:{top:S.top,left:S.left},children:o.jsx(rs,{value:t,mixed:n,noneLabel:p(r),ariaLabel:p(a),disabled:u,fallbackCustom:l,onChange:P,onCommit:()=>b(!1)})})}):null]});return o.jsx($t,{label:p(i),children:A})}function OA({commands:e,queries:t,disabled:n}){return o.jsx(Rf,{icon:od,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function KA({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(Cf,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:i,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,l)=>{e.setFontSize(a,l)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function $A({commands:e,queries:t,disabled:n}){return o.jsx(Rf,{icon:id,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function UA({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=W(),a=!!(n||!t.isVisualMode());return o.jsx(rs,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:i("colorNone"),ariaLabel:i("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:l=>e.setHighlightColor(l),onCommit:()=>r==null?void 0:r()})}const WA="_wrap_1gtdc_1",GA="_wrapToolbar_1gtdc_7",VA="_field_1gtdc_12",ZA="_trigger_1gtdc_20",qA="_chevron_1gtdc_46",YA="_list_1gtdc_69",XA="_option_1gtdc_84",JA="_separator_1gtdc_113",Dt={wrap:WA,wrapToolbar:GA,field:VA,trigger:ZA,chevron:qA,list:YA,option:XA,separator:JA},yl={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},QA={p:{fontSize:"1rem",fontWeight:"400"},h1:{fontSize:"1.75rem",fontWeight:"600"},h2:{fontSize:"1.5rem",fontWeight:"600"},h3:{fontSize:"1.25rem",fontWeight:"600"},h4:{fontSize:"1.125rem",fontWeight:"600"},h5:{fontSize:"1rem",fontWeight:"600"},h6:{fontSize:"0.875rem",fontWeight:"600"}};function ed(){const e=W();return o.jsx("div",{className:d.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:o.jsx("span",{className:d.spinner,"aria-hidden":"true"})})}function Tf({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:i,listRef:a,style:l,customStylesEnabled:u=!1,customStyles:m=[],customStylesLoading:p=!1,onSelect:g,onSelectCustom:h,onAddNew:C}){const y=W(),x=t?null:e,b=u,S=!!(r&&u&&C);return r?o.jsxs(o.Fragment,{children:[$o.map(v=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitemradio","aria-checked":x===v,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>g(v),children:y(yl[v])},v)),b?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,b&&p?o.jsx(ed,{}):null,b&&!p?m.map(v=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitem",disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(v.id),children:v.name},v.id)):null,S?o.jsxs(o.Fragment,{children:[b&&(p||m.length>0)?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,o.jsxs("button",{type:"button",className:q.menuItem,role:"menuitem","aria-label":y("styleAddNewAria"),disabled:n,onMouseDown:v=>v.preventDefault(),onClick:()=>C==null?void 0:C(),children:[o.jsx(Hp,{className:q.icon}),y("styleAddNew")]})]}):null]}):o.jsxs("ul",{ref:a,className:Dt.list,role:"listbox",id:i,style:l,"aria-label":y("commandParagraphStyleAria"),"aria-busy":b&&p?!0:void 0,children:[$o.map(v=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Dt.option,role:"option","aria-selected":x===v,disabled:n,style:QA[v],onMouseDown:k=>k.preventDefault(),onClick:()=>g(v),children:y(yl[v])})},v)),b&&(p||m.length>0)?o.jsx("li",{role:"separator",className:Dt.separator}):null,b&&p?o.jsx("li",{role:"presentation",children:o.jsx(ed,{})}):null,b&&!p?m.map(v=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:Dt.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>h==null?void 0:h(v.id),children:v.name})},v.id)):null]})}const Po=4;function eP({commands:e,queries:t,disabled:n}){const r=W(),i=c.useId(),a=c.useRef(null),l=c.useRef(null),u=c.useRef(null),[m,p]=c.useState(!1),[g,h]=c.useState({top:0,left:0,width:0}),C=!!(n||!t.isVisualMode()),y=t.isParagraphStyleMixed(),x=y?null:t.getParagraphStyle(),b=x?r(yl[x]):"",S=t.customParagraphStylesEnabled(),v=S?t.getCustomParagraphStyles():[],k=S&&t.isCustomParagraphStylesLoading(),P=c.useCallback(()=>{const D=l.current,A=u.current;if(!D)return;const T=D.getBoundingClientRect(),I=(A==null?void 0:A.offsetHeight)??0,E=Math.max(T.width,(A==null?void 0:A.offsetWidth)??0);let R=T.bottom;R+I>window.innerHeight-Po&&(R=Math.max(Po,T.top-I));const j=Math.min(Math.max(T.left,Po),window.innerWidth-E-Po);h({top:R,left:j,width:E})},[]);c.useLayoutEffect(()=>{if(!m)return;P();const D=()=>P();return window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[m,P,v.length,k]),c.useEffect(()=>{if(!m)return;const D=T=>{var E,R;const I=T.target;(E=a.current)!=null&&E.contains(I)||(R=u.current)!=null&&R.contains(I)||p(!1)},A=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),p(!1))};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",A,!0)}},[m]);const N=o.jsxs("div",{className:`${Dt.wrap} ${Dt.wrapToolbar}`,ref:a,children:[o.jsxs("div",{className:Dt.field,ref:l,children:[o.jsx("button",{type:"button",className:Dt.trigger,disabled:C,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":m,"aria-controls":m?i:void 0,onMouseDown:D=>D.preventDefault(),onClick:()=>p(D=>!D),children:b}),o.jsx("span",{className:Dt.chevron,"aria-hidden":"true"})]}),m?o.jsx(se,{children:o.jsx(Tf,{listRef:u,listId:i,value:x,mixed:y,disabled:C,customStylesEnabled:S,customStyles:v,customStylesLoading:k,style:{top:g.top,left:g.left,minWidth:g.width},onSelect:D=>{e.setParagraphStyle(D),p(!1)},onSelectCustom:D=>{e.applyCustomParagraphStyle(D),p(!1)}})}):null]});return o.jsx($t,{label:r("commandParagraphStyle"),children:N})}function tP({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),l=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),m=u?t.getCustomParagraphStyles():[],p=u&&t.isCustomParagraphStylesLoading();return o.jsx(Tf,{menu:!0,value:l,mixed:a,disabled:i,customStylesEnabled:u,customStyles:m,customStylesLoading:p,onSelect:g=>{e.setParagraphStyle(g),r==null||r()},onSelectCustom:g=>{e.openCustomParagraphStyleDialog(g),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const nP={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:tP,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:UA,enabled:"isVisualMode"},paragraph:{id:"paragraph",labelKey:"menuParagraph",ariaKey:"menuParagraphAria"}},groups:{font:{id:"font",labelKey:"toolbarGroupFont"},align:{id:"align",labelKey:"toolbarGroupAlign"},paragraph:{id:"paragraph",labelKey:"toolbarGroupParagraph"}},items:{fontFamily:{id:"fontFamily",widget:K0,icon:Cp,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:eP,icon:Bp,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:KA,icon:vp,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:wp,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:bp,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:Ip,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:ad,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:OA,icon:od,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:$A,icon:id,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:up,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:jp,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Gp,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:Wp,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:fp,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:Sp,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:Qo,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:Jo,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:ei,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:nd,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:Dp,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:_p,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:rd,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:ld,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},rP={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:Rp,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:dp,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:ad,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},audio:{id:"audio",command:"openAudioDialog",icon:cp,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:Yp,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:Ap,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:Lp,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPage:{id:"insertPage",command:"insertPage",icon:sd,labelKey:"commandInsertPage",ariaKey:"commandInsertPageAria",enabled:"canInsertPage"}}},oP={menus:{table:{id:"table",labelKey:"menuTable",ariaKey:"menuTableAria"}},submenus:{insertRow:{id:"insertRow",labelKey:"menuInsertRow",ariaKey:"menuInsertRowAria",enabled:"isInTable"},insertColumn:{id:"insertColumn",labelKey:"menuInsertColumn",ariaKey:"menuInsertColumnAria",enabled:"isInTable"}},groups:{table:{id:"table",labelKey:"toolbarGroupTable"}},items:{table:{id:"table",command:"openTableDialog",icon:Fc,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:ka,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:ka,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:ka,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Sa,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Sa,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Sa,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:Np,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:Zp,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:Fc,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:mp,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:$p,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},iP={menus:{view:{id:"view",labelKey:"menuView",ariaKey:"menuViewAria"}},submenus:{toolbar:{id:"toolbar",labelKey:"menuToolbar",ariaKey:"menuToolbarAria"},toolbarPosition:{id:"toolbarPosition",labelKey:"menuToolbarPosition",ariaKey:"menuToolbarPositionAria"},zoom:{id:"zoom",labelKey:"menuZoom",ariaKey:"menuZoomAria"}},groups:{view:{id:"view",labelKey:"toolbarGroupView"},fullscreen:{id:"fullscreen",labelKey:"toolbarGroupFullscreen"}},items:{visual:{id:"visual",command:"setVisualMode",icon:qp,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:Pp,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:yp,labelKey:"commandCustomizeToolbar",ariaKey:"commandCustomizeToolbarAria"},toolbarPositionTop:{id:"toolbarPositionTop",command:"setToolbarPositionTop",labelKey:"toolbarPositionTop",ariaKey:"toolbarPositionTopAria",active:"isToolbarPositionTop"},toolbarPositionLeft:{id:"toolbarPositionLeft",command:"setToolbarPositionLeft",labelKey:"toolbarPositionLeft",ariaKey:"toolbarPositionLeftAria",active:"isToolbarPositionLeft"},toolbarPositionRight:{id:"toolbarPositionRight",command:"setToolbarPositionRight",labelKey:"toolbarPositionRight",ariaKey:"toolbarPositionRightAria",active:"isToolbarPositionRight"},toolbarPositionBottom:{id:"toolbarPositionBottom",command:"setToolbarPositionBottom",labelKey:"toolbarPositionBottom",ariaKey:"toolbarPositionBottomAria",active:"isToolbarPositionBottom"},lightMode:{id:"lightMode",command:"setLightMode",icon:Ep,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:xp,labelKey:"modeDark",ariaKey:"modeDarkAria",active:"isDarkMode"},pageZoomFitWidth:{id:"pageZoomFitWidth",command:"setPageZoomFitWidth",labelKey:"pageZoomFitWidth",ariaKey:"pageZoomFitWidthAria",active:"isPageZoomFitWidth"},pageZoomFitPage:{id:"pageZoomFitPage",command:"setPageZoomFitPage",labelKey:"pageZoomFitPage",ariaKey:"pageZoomFitPageAria",active:"isPageZoomFitPage"},pageZoom50:{id:"pageZoom50",command:"setPageZoom50",labelKey:"pageZoom50",ariaKey:"pageZoom50Aria",active:"isPageZoom50"},pageZoom75:{id:"pageZoom75",command:"setPageZoom75",labelKey:"pageZoom75",ariaKey:"pageZoom75Aria",active:"isPageZoom75"},pageZoom100:{id:"pageZoom100",command:"setPageZoom100",labelKey:"pageZoom100",ariaKey:"pageZoom100Aria",active:"isPageZoom100"},pageZoom125:{id:"pageZoom125",command:"setPageZoom125",labelKey:"pageZoom125",ariaKey:"pageZoom125Aria",active:"isPageZoom125"},pageZoom150:{id:"pageZoom150",command:"setPageZoom150",labelKey:"pageZoom150",ariaKey:"pageZoom150Aria",active:"isPageZoom150"},pageZoom200:{id:"pageZoom200",command:"setPageZoom200",labelKey:"pageZoom200",ariaKey:"pageZoom200Aria",active:"isPageZoom200"},preview:{id:"preview",command:"openDocumentPreview",icon:Fp,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:Op,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:kp,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function aP(...e){return{menus:Object.assign({},...e.map(t=>t.menus)),submenus:Object.assign({},...e.map(t=>t.submenus??{})),groups:Object.assign({},...e.map(t=>t.groups)),items:Object.assign({},...e.map(t=>t.items))}}const lP=aP(zA,cA,rP,oP,iP,nP),sP={menus:[{id:"file",items:["save","open",ue,"print"]},{id:"edit",items:["undo","redo",ue,{submenu:"page",items:["pageProperties"]}]},{id:"insert",items:["link","bookmark",ue,"image","audio","youtube","table","horizontalRule","pageBreak","insertComment","insertPage"]},{id:"table",items:["table",ue,{submenu:"insertRow",items:["insertRowBelow","insertRowBefore","deleteRow"]},{submenu:"insertColumn",items:["insertColumnAfter","insertColumnBefore","deleteColumn"]},ue,"mergeCells","unmergeCells",ue,"tableProperties","cellProperties","rowProperties"]},{id:"view",items:["visual","html",ue,{submenu:"toolbar",items:["customizeToolbar",ue,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},ue,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",ue,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},ue,"lightMode","darkMode",ue,"toggleCommentsVisible","preview","readAloud","fullscreen"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},ue,{submenu:"font",items:["fontProperties","customCss",ue,{submenu:"highlightColor",items:[]},ue,"bold","italic","underline","strikethrough"]},ue,"clearFormatting",ue,{submenu:"paragraph",items:["paragraphProperties",ue,"alignLeft","alignCenter","alignRight","alignJustify",ue,"indent","outdent",ue,"bulletList","numberedList"]},ue,"imageProperties"]}],iconGroups:[{id:"file",items:["save","open"]},{id:"print",items:["print"]},{id:"edit",items:["undo","redo"]},{id:"insert",items:["link","bookmark","image","table","horizontalRule","addComment"]},{id:"table",items:["mergeCells","unmergeCells"]},{id:"font",items:["fontFamily","paragraphStyle","fontSize","fontColor","highlightColor","customCss","formatBrush","bold","italic","underline","strikethrough","clearFormatting"]},{id:"align",items:["alignLeft","alignCenter","alignRight","alignJustify"]},{id:"paragraph",items:["indent","outdent","bulletList","numberedList"]},{id:"view",items:["visual","html","preview","readAloud","toggleCommentsVisible"]},{id:"fullscreen",items:["fullscreen"]}]},td={items:{addComment:{id:"addComment",command:"addComment",icon:Ic,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:Ic,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:pp,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},cP=["addComment","insertComment","toggleCommentsVisible"],uP=new Set(["insert","view"]);function Nf(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!cP.includes(e):!0:!1}function dP(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!uP.has(e):!0:!1}function mP(e,t){const n=t?"hideComments":"showComments",r=td.items.toggleCommentsVisible;return{...e,items:{...e.items,...td.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function fP(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.indexOf("insertPage"),i=r===-1?n.length:r;return n.includes("insertComment")||n.splice(i,0,"insertComment"),{...t,items:n}}if(t.id==="view"){const n=[...t.items],r=n.indexOf("preview"),i=r===-1?n.length:r;return n.includes("toggleCommentsVisible")||n.splice(i,0,"toggleCommentsVisible"),{...t,items:n}}return t}),iconGroups:e.iconGroups.map(t=>t.id==="insert"&&!t.items.includes("addComment")?{...t,items:[...t.items,"addComment"]}:t.id==="view"&&!t.items.includes("toggleCommentsVisible")?{...t,items:[...t.items,"toggleCommentsVisible"]}:t)}}const Do="fullscreen";function pP(e){const t=[];let n=null;for(const r of e){const i=r.items.filter(a=>a!==Do);i.length>0&&t.push({id:r.id,items:i}),r.items.includes(Do)&&(n={id:Do,items:[Do]})}return{main:t,trailing:n}}function gP({groups:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a}){const l=W(),{main:u,trailing:m}=pP(e),p=g=>{const h=t.groups[g.id];return o.jsx("div",{className:q.iconGroup,role:"group","aria-label":h?Ut(l,h):void 0,"data-toolbar-group":g.id,children:g.items.map(C=>{const y=t.items[C];if(!y)return null;const x=y.enabled?!r[y.enabled]():!1;if(y.widget){const k=y.widget;return o.jsx(k,{commands:n,queries:r,disabled:i||x},C)}if(!y.icon||!y.command)return null;const b=y.icon,S=y.command,v=y.active?r[y.active]():void 0;return o.jsx($t,{label:y.tooltip??Ut(l,y),children:o.jsx("button",{type:"button",className:q.iconButton,"aria-label":Yo(l,y),"aria-pressed":v,disabled:i||(a?Nf(C,a):!1)||x,onPointerDown:k=>k.preventDefault(),onMouseDown:k=>k.preventDefault(),onClick:()=>{wl(n,S)},children:o.jsx(b,{className:q.icon})})},C)})},g.id)};return o.jsxs("div",{className:q.iconNav,role:"toolbar","aria-label":l("toolbarAria"),children:[u.length>0?o.jsx("div",{className:q.iconNavMain,children:u.map(p)}):null,m?o.jsx("div",{className:q.iconNavEnd,children:p(m)}):null]})}const hP=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function bP(e){const t={};for(const n of hP){const r=getComputedStyle(e).getPropertyValue(n).trim();if(r){t[n]=r;continue}let i=e;for(;i;){const a=i.style.getPropertyValue(n).trim();if(a){t[n]=a;break}i=i.parentElement}}return t}function yP({menus:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,compact:l,openMenuId:u,onOpenMenuIdChange:m}){const p=W(),[g,h]=c.useState(!1),[C,y]=c.useState({}),x=c.useRef(null),b=c.useRef(null),S=c.useRef(null),v=c.useRef(null),k=c.useCallback(()=>{h(!1),m(null)},[m]);c.useLayoutEffect(()=>{!g||!x.current||y(bP(x.current))},[g]),c.useEffect(()=>{var N;g&&((N=S.current)==null||N.focus())},[g]),c.useEffect(()=>{if(!g)return;const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=N}},[g]),c.useEffect(()=>{if(!g)return;const N=A=>{var T;if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),u){m(null);return}k(),(T=b.current)==null||T.focus()}},D=A=>{var T;v.current&&!v.current.contains(A.target)&&(k(),(T=b.current)==null||T.focus())};return document.addEventListener("keydown",N,!0),document.addEventListener("pointerdown",D),()=>{document.removeEventListener("keydown",N,!0),document.removeEventListener("pointerdown",D)}},[g,u,m,k]);const P=N=>e.map(D=>{const A=t.menus[D.id];return A?o.jsx(CP,{def:A,itemIds:D.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:N,open:(N==="overlay"||!g)&&u===D.id,onOpenChange:T=>m(T?D.id:null),onItemRun:N==="overlay"?()=>{var T;k(),(T=b.current)==null||T.focus()}:void 0},`${N}-${D.id}`):null});return o.jsxs("div",{className:q.menuBar,ref:x,children:[o.jsx($t,{label:p("brandMarkAria"),children:o.jsx("span",{className:q.brandMark,role:"img","aria-label":p("brandMarkAria"),children:o.jsx(gp,{className:q.brandMarkIcon})})}),o.jsx("div",{className:q.menuBarCompact,hidden:l===void 0?void 0:!l,children:o.jsx($t,{label:p("menuHamburgerAria"),children:o.jsx("button",{ref:b,type:"button",className:`${q.menuButton} ${q.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":g,"aria-label":p("menuHamburgerAria"),disabled:i||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(g){k();return}m(null),h(!0)},children:o.jsx(Tp,{className:q.icon})})})}),o.jsx("div",{className:q.menuBarDesktop,hidden:l===void 0?void 0:l,children:P("dropdown")}),g?o.jsx(se,{children:o.jsx("div",{className:q.toolbar,"data-menu-overlay-portal":"",style:C,children:o.jsxs("div",{ref:v,className:q.menuOverlay,role:"dialog","aria-modal":"true","aria-label":p("menuOverlayAria"),children:[o.jsxs("div",{className:q.menuOverlayHeader,children:[o.jsx("span",{className:q.menuOverlayTitle,children:p("menuOverlayAria")}),o.jsx("button",{ref:S,type:"button",className:q.iconButton,"aria-label":p("menuCloseAria"),onClick:()=>{var N;k(),(N=b.current)==null||N.focus()},children:o.jsx(_e,{className:q.icon})})]}),o.jsx("div",{className:q.menuOverlayBody,children:P("overlay")})]})})}):null]})}function Xo(e,t){var n,r;if(zt(e))return!1;if(gr(e)){const i=(n=t.submenus)==null?void 0:n[e.submenu];return i?i.panel?!0:e.items.some(a=>Xo(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function xP(e,t,n){if(!zt(e[t])||!e.slice(t+1).some(a=>Xo(a,n)))return!1;let i=!1;for(let a=t-1;a>=0;a--){const l=e[a];if(zt(l)){i=!0;continue}if(Xo(l,n))return!i}return!1}function CP({def:e,itemIds:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:l,variant:u,open:m,onOpenChange:p,onItemRun:g}){const h=W(),C=c.useRef(null),y=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[x,b]=c.useState(null);c.useEffect(()=>{m||b(null)},[m]),c.useEffect(()=>{if(!m||u==="overlay")return;const v=P=>{C.current&&!C.current.contains(P.target)&&p(!1)},k=P=>{if(P.key==="Escape"){if(P.preventDefault(),P.stopPropagation(),x){b(null);return}p(!1)}};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",k,!0)}},[m,x,p,u]);const S=()=>{p(!1),g==null||g()};return o.jsxs("div",{className:q.menuWrap,ref:C,children:[o.jsx("button",{type:"button",className:q.menuButton,"aria-haspopup":"menu","aria-expanded":m,"aria-controls":y,"aria-label":Yo(h,e),disabled:a||(l?dP(e.id,l):!1),onClick:()=>p(!m),children:Ut(h,e)}),m?o.jsx("div",{className:q.menu,role:"menu",id:y,onMouseDown:v=>v.preventDefault(),children:o.jsx(Mf,{entries:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:l,variant:u,onClose:S,openSubmenuId:x,onOpenSubmenuIdChange:b})}):null]})}function Mf({entries:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,openSubmenuId:m,onOpenSubmenuIdChange:p}){return o.jsx(o.Fragment,{children:e.map((g,h)=>{if(zt(g))return xP(e,h,t)?o.jsx("div",{role:"separator",className:q.menuSeparator},`separator-${h}`):null;if(gr(g))return o.jsx(vP,{entry:g,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,open:m===g.submenu,onOpenChange:y=>p==null?void 0:p(y?g.submenu:null)},`submenu-${g.submenu}-${h}`);const C=t.items[g];return!C||!C.command?null:o.jsx(wP,{item:C,commands:n,queries:r,disabled:i,chromeLock:a,onClose:u},g)})})}function wP({item:e,commands:t,queries:n,disabled:r,chromeLock:i,onClose:a}){const l=W();if(!e.command)return null;const u=e.icon,m=e.command,p=e.active?n[e.active]():void 0,g=e.enabled?!n[e.enabled]():!1,h=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return o.jsxs("button",{type:"button",role:h,className:q.menuItem,"aria-checked":p,disabled:r||(i?Nf(e.id,i):!1)||g,onClick:()=>{a(),wl(t,m)},children:[u?o.jsx(u,{className:q.icon}):null,Ut(l,e)]})}function vP({entry:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,open:m,onOpenChange:p}){var A;const g=W(),h=c.useRef(null),C=c.useRef(null),[y,x]=c.useState(null),b=(A=t.submenus)==null?void 0:A[e.submenu],S=l==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,v=b==null?void 0:b.panel,k=b!=null&&b.enabled?!r[b.enabled]():!1,P=l==="overlay";if(c.useEffect(()=>{m||x(null)},[m]),!b||!v&&!e.items.some(T=>Xo(T,t)))return null;const N=T=>{(T.key==="ArrowRight"||T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),p(!0),requestAnimationFrame(()=>{var E;const I=(E=C.current)==null?void 0:E.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');I==null||I.focus()}))},D=T=>{var I;T.key==="ArrowLeft"&&(T.preventDefault(),T.stopPropagation(),p(!1),(I=h.current)==null||I.focus())};return o.jsxs("div",{className:q.submenuWrap,onMouseEnter:P?void 0:()=>p(!0),onMouseLeave:P?void 0:()=>p(!1),children:[o.jsx("button",{ref:h,type:"button",role:"menuitem",className:`${q.menuItem} ${q.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":m,"aria-controls":S,"aria-label":Yo(g,b),disabled:i||k||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>p(P?!m:!0),onKeyDown:N,children:Ut(g,b)}),m?o.jsx("div",{ref:C,className:`${q.menu} ${q.submenu}`,role:"menu",id:S,"aria-label":Yo(g,b),onMouseDown:T=>T.preventDefault(),onKeyDown:D,children:v?o.jsx(v,{commands:n,queries:r,disabled:i||k,onMenuClose:u}):o.jsx(Mf,{entries:e.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:l,onClose:u,openSubmenuId:y,onOpenSubmenuIdChange:x})}):null]})}function Oa({catalog:e,layout:t,commands:n,queries:r,disabled:i,chromeLock:a,menuVisible:l=!0,toolbarVisible:u=!0,compact:m,position:p="top"}){const[g,h]=c.useState(null);return!l&&!u?null:o.jsxs("div",{className:q.toolbar,"data-compact":m?"":void 0,"data-toolbar-position":p,children:[l?o.jsx(yP,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a,compact:m,openMenuId:g,onOpenMenuIdChange:h}):null,u?o.jsx(gP,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a}):null]})}const SP="_root_3hjd3_1",kP="_fullscreen_3hjd3_36",AP="_exitFullscreen_3hjd3_48",PP="_exitFullscreenIcon_3hjd3_79",DP="_menuChrome_3hjd3_94",jP="_body_3hjd3_105",EP="_iconChrome_3hjd3_135",RP="_workspace_3hjd3_179",TP="_workspacePageSized_3hjd3_191",NP="_pageCanvasViewport_3hjd3_195",MP="_htmlFileDropOverlay_3hjd3_205",_P="_surface_3hjd3_219",LP="_visual_3hjd3_226",IP="_multiPageContainer_3hjd3_258",FP="_pageBlock_3hjd3_266",BP="_pageGap_3hjd3_273",HP="_pageSurface_3hjd3_279",zP="_html_3hjd3_205",fe={root:SP,fullscreen:kP,exitFullscreen:AP,exitFullscreenIcon:PP,menuChrome:DP,body:jP,iconChrome:EP,workspace:RP,workspacePageSized:TP,pageCanvasViewport:NP,htmlFileDropOverlay:MP,surface:_P,visual:LP,multiPageContainer:IP,pageBlock:FP,pageGap:BP,pageSurface:HP,html:zP},OP=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i},a){const l=W();return o.jsx("textarea",{ref:a,className:`${fe.surface} ${fe.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:i,"aria-label":l("htmlEditorAria"),spellCheck:!1})}),KP=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i,onBeforeInput:a,onPointerDown:l,onMouseUp:u,onContextMenu:m},p){const g=W(),h=c.useRef(null),C=c.useRef(a);C.current=a;const y=x=>{h.current=x,typeof p=="function"?p(x):p&&(p.current=x)};return c.useLayoutEffect(()=>{const x=h.current;x&&(x.innerHTML!==t&&(x.innerHTML=t),ti(x),fr(x,t))},[t]),c.useLayoutEffect(()=>{const x=h.current;if(!x)return;const b=S=>{var v;(v=C.current)==null||v.call(C,S)};return x.addEventListener("beforeinput",b),()=>x.removeEventListener("beforeinput",b)},[]),o.jsx("div",{ref:y,className:`${fe.surface} ${fe.visual}`,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":g("visualEditorAria"),"aria-disabled":i||void 0,"data-placeholder":r,onPointerDown:l,onMouseUp:u,onContextMenu:m,onInput:x=>{n(x.currentTarget.innerHTML)}})}),$P=c.forwardRef(function({pages:t,activePageIndex:n,onActivePageIndexChange:r,onPageChange:i,placeholder:a,disabled:l,onBeforeInput:u,onPointerDown:m,onMouseUp:p,onContextMenu:g},h){const C=W(),y=c.useRef(null),x=c.useRef(n);x.current=n;const b=c.useRef(u);b.current=u;const S=c.useRef(t);S.current=t,c.useImperativeHandle(h,()=>({getContainer:()=>y.current,getActivePageRoot:()=>{const P=y.current;return P?Eo(P,x.current):null},getActivePageIndex:()=>x.current,flushPageHtml:P=>{var D;const N=y.current;return N?((D=Eo(N,P))==null?void 0:D.innerHTML)??null:null}}));const v=c.useCallback((P,N)=>{const D=jt(N).body;P.innerHTML!==D&&(P.innerHTML=D),ti(P),fr(P,N)},[]);c.useLayoutEffect(()=>{const P=y.current;if(P)for(let N=0;N<t.length;N+=1){const D=Eo(P,N);D&&v(D,t[N]??"")}},[t,v]),c.useLayoutEffect(()=>{const P=y.current;if(!P)return;const N=D=>{var A;(A=b.current)==null||A.call(b,D)};return P.addEventListener("beforeinput",N),()=>P.removeEventListener("beforeinput",N)},[]);const k=P=>{P!==n&&r(P)};return o.jsx("div",{ref:y,className:fe.multiPageContainer,children:t.map((P,N)=>o.jsxs("div",{className:fe.pageBlock,children:[N>0?o.jsx("div",{className:fe.pageGap,"aria-hidden":"true"}):null,o.jsx("div",{className:`${fe.surface} ${fe.visual} ${fe.pageSurface}`,[$a]:"","data-page-index":N,contentEditable:!l,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":C("visualEditorAria"),"aria-disabled":l||void 0,"data-placeholder":N===0?a:void 0,onFocus:()=>k(N),onPointerDown:m,onMouseUp:p,onContextMenu:g,onInput:D=>{i(N,D.currentTarget.innerHTML)}})]},N))})});function UP({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:i,onOpen:a,mode:l,defaultMode:u="visual",onModeChange:m,fullscreen:p,defaultFullscreen:g=!1,onFullscreenChange:h,placeholder:C,disabled:y,readOnly:x=!1,className:b,locale:S="en",toolbarBackground:v,menuColor:k,menuBackground:P,menuFontSize:N,menuFontFamily:D,border:A,menuVisible:T=!0,toolbarVisible:I=!0,allowedChrome:E,customActions:R,customFonts:j,transformHtml:F,loadCustomParagraphStyles:U,onSaveCustomParagraphStyle:$,onDeleteCustomParagraphStyle:X,customImagePicker:J,disableBuiltinImageInsert:ge,customAudioPicker:Y,disableBuiltinAudioInsert:he,customVideoPicker:te,disableBuiltinVideoInsert:ie,disableHtmlFileDrop:M=!1,toolbarCustomization:V,darkMode:re=!1,darkModePersistence:G,toolbarPosition:ye="top",toolbarPositionPersistence:Le,enableMultiPages:Ce=!1,pages:Zt,defaultPages:vr,onPagesChange:In,enableComments:Ie=!1,defaultCommentsVisible:_f=!0,commentAuthor:Sr,comments:Lf,defaultComments:If=[],onCommentsChange:Ff}){const ne=!!(y||x),Fn=!!y,Bf=Oc(vr??(t.trim()?[t]:[Ua()])),Hf=Ce?mt(Bf):t,zf=Ce&&Zt!==void 0?mt(Oc(Zt)):e,[Ae,cs]=bo({value:zf,defaultValue:Hf,onChange:Ce?void 0:n}),[be,us]=bo({value:l,defaultValue:u,onChange:m}),[xt,Bn]=bo({value:p,defaultValue:g,onChange:h}),[st,Of]=c.useState(_f),[ct,Ct]=c.useState(null),[ln,Hn]=bo({value:Lf,defaultValue:If,onChange:Ff}),L=c.useRef(null),fi=c.useRef(null),ds=c.useRef(null),kr=c.useRef(null),Oe=c.useRef(null),Ve=c.useRef(Ce);Ve.current=Ce;const qt=c.useRef(Ie);qt.current=Ie;const ms=c.useRef(x);ms.current=x;const fs=c.useRef(ne);fs.current=ne;const Ar=c.useRef(st);Ar.current=st;const Pr=c.useRef(ln);Pr.current=ln;const Dr=c.useRef(In);Dr.current=In;const[sn,ps]=c.useState(0),zn=c.useRef(sn);zn.current=sn;const pi=c.useRef(null);pi.current===null&&(pi.current=dA(Ae));const Ze=pi.current,we=c.useRef(Ae);we.current=Ae;const jr=c.useRef(!0),gi=c.useRef(""),cn=c.useRef(null),H=c.useRef(be);H.current=be;const gs=c.useRef(xt);gs.current=xt;const Se=c.useRef(null),[,Kf]=c.useState(0),On=c.useRef(null);On.current===null&&(On.current=rC(()=>{Kf(s=>s+1)}));const Er=c.useRef(F);Er.current=F;const qe=c.useRef({}),Ke=c.useRef(null),Ye=c.useRef(null),tt=c.useRef(null),nt=c.useRef(null),Nt=c.useRef(null),$e=c.useRef(null),[Rr,hi]=c.useState(Et),bi=c.useRef(Rr);bi.current=Rr;const wt=c.useRef(tn),[Kn,Tr]=c.useState({value:null,unit:tn,mixed:!1}),Mt=c.useRef(Kn);Mt.current=Kn;const[$n,yi]=c.useState({value:null,mixed:!1}),Un=c.useRef($n);Un.current=$n;const[Wn,xi]=c.useState({value:null,mixed:!1}),Gn=c.useRef(Wn);Gn.current=Wn;const[Vn,Ci]=c.useState({value:null,mixed:!1}),Zn=c.useRef(Vn);Zn.current=Vn;const[wi,vi]=c.useState({tag:null,mixed:!1}),Si=c.useRef(wi);Si.current=wi;const[hs,ki]=c.useState({align:"left",mixed:!1}),Ai=c.useRef(hs);Ai.current=hs;const[bs,Pi]=c.useState({type:null,mixed:!1}),qn=c.useRef(bs);qn.current=bs;const[ys,Di]=c.useState(!1),xs=c.useRef(ys);xs.current=ys;const[ji,Ei]=c.useState(!1),Ri=c.useRef(ji);Ri.current=ji;const[Ti,Cs]=c.useState(!1),Nr=c.useRef(Ti);Nr.current=Ti;const Mr=c.useRef(null),_r=c.useRef(null),[ws,vs]=c.useState(!1),Ss=c.useRef(ws);Ss.current=ws;const[Yn,Lr]=c.useState({open:!1,tab:"general"}),[Ni,ks]=c.useState(!1),[Xn,As]=c.useState({open:!1,html:""}),[Mi,Ir]=c.useState(null),[$f,_i]=c.useState(!1),[Uf,Li]=c.useState(!1),[un,Fr]=c.useState(()=>G?re:qu()??re),[rt,Br]=c.useState(()=>Le?ye:Yu()??ye),[Hr,Wf]=c.useState(()=>Kk()??"fitWidth"),[Ii,Gf]=c.useState(1),[Yt,zr]=c.useState({open:!1,tab:"general",value:lr()}),[Or,Fi]=c.useState({open:!1,value:""}),[Xt,dn]=c.useState({open:!1,tab:"font",value:dl()}),[Bi,Ps]=c.useState([]),[Hi,zi]=c.useState(!1),[Vf,Kr]=c.useState(!1),[Pe,Jn]=c.useState({open:!1}),[Ue,$r]=c.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[Oi,Ki]=c.useState({open:!1,existingIds:[]}),[Zf,Ur]=c.useState({open:!1}),[qf,Wr]=c.useState({open:!1}),[Yf,Qn]=c.useState({open:!1}),[Gr,Vr]=c.useState({open:!1,tab:"general",value:zm(),aspectRatio:1}),[$i,Ui]=c.useState({open:!1}),[Zr,Wi]=c.useState({open:!1,value:VC()}),[qr,Gi]=c.useState({open:!1,value:rw()}),[Yr,Vi]=c.useState({open:!1,value:fw()}),[Jt,Zi]=c.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1}),[De,mn]=c.useState(null),qi=c.useRef(De);qi.current=De;const[Yi,Ds]=c.useState(!1),js=c.useRef(Yi);js.current=Yi;const[Xi,Es]=c.useState(!1),Rs=c.useRef(Xi);Rs.current=Xi;const[Ji,Ts]=c.useState(!1),Ns=c.useRef(Ji);Ns.current=Ji;const Ms=c.useRef(void 0),Xr=c.useRef(Bi);Xr.current=Bi;const _s=c.useRef(Hi);_s.current=Hi;const Qi=!!(U&&$),ea=c.useRef(Qi);ea.current=Qi;const Ls=c.useRef(U);Ls.current=U;const Is=c.useRef($);Is.current=$;const Fs=c.useRef(X);Fs.current=X;const Bs=c.useRef(i);Bs.current=i;const Hs=c.useRef(a);Hs.current=a;const zs=c.useRef(J);zs.current=J;const Os=c.useRef(Y);Os.current=Y;const Ks=c.useRef(te);Ks.current=te;const $s=c.useRef(V);$s.current=V;const Us=c.useRef(G);Us.current=G;const Ws=c.useRef(Le);Ws.current=Le;const Gs=c.useRef(un);Gs.current=un;const Vs=c.useRef(rt);Vs.current=rt;const ta=c.useRef(Hr);ta.current=Hr;const Zs=c.useRef(ge);Zs.current=ge;const qs=c.useRef(he);qs.current=he;const Ys=c.useRef(ie);Ys.current=ie;const na=c.useRef(0),er=c.useRef(0),Xs=c.useRef(0),Jr=c.useRef(0),Js=c.useRef(0),Qr=c.useRef(0),Qs=c.useRef(0),_t=c.useMemo(()=>vd(j),[j]),fn=c.useRef(_t);fn.current=_t;const ra=c.useMemo(()=>$g(Ae,_t).join(`
|
|
95
|
+
`),[Ae,_t]),eo=c.useMemo(()=>Pt(Ae).map(s=>jt(s).body),[Ae]),ec=c.useMemo(()=>Ce?eo[sn]??"":jt(Ae).body,[Ce,eo,sn,Ae]),tc=c.useMemo(()=>Jy(ai(ec)),[ec]);c.useEffect(()=>{const f=(ra?ra.split(`
|
|
96
|
+
`):[]).map(w=>{const _=document.createElement("link");return _.rel="stylesheet",_.href=w,_.setAttribute(ni,""),document.head.append(_),_});return()=>{for(const w of f)w.remove()}},[ra]);const to=c.useCallback(async()=>{const s=Ls.current;if(!s)return;const f=++na.current;zi(!0);try{const w=await s();if(f!==na.current)return;Ps(w)}catch{}finally{f===na.current&&zi(!1)}},[]);c.useEffect(()=>{if(!U||!$){Ps([]),zi(!1);return}to()},[U,$,to]);const nc=c.useCallback(async s=>{Ir(s);const f=$s.current;if(f!=null&&f.load&&f.save){const w=++Xs.current;Li(!0);try{await f.save(s)}catch{}finally{w===Xs.current&&Li(!1)}return}gA(s)},[]);c.useEffect(()=>{const s=V;if(!(s!=null&&s.load)||!s.save){Ir(pA()),_i(!1),Li(!1);return}const f=++er.current;return _i(!0),(async()=>{try{const w=await s.load();if(f!==er.current)return;Ir(w)}catch{if(f!==er.current)return;Ir(null)}finally{f===er.current&&_i(!1)}})(),()=>{er.current+=1}},[V]);const rc=c.useCallback(async s=>{Fr(s);const f=Us.current;if(f!=null&&f.load&&f.save){const w=++Js.current;try{await f.save(s)}catch{}finally{if(w!==Js.current)return}return}Hk(s)},[]),oc=c.useCallback(s=>{Wf(s),$k(s)},[]);c.useEffect(()=>{const s=G;if(!(s!=null&&s.load)||!s.save){Fr(qu()??re);return}const f=++Jr.current;return(async()=>{try{const w=await s.load();if(f!==Jr.current)return;Fr(typeof w=="boolean"?w:re)}catch{if(f!==Jr.current)return;Fr(re)}})(),()=>{Jr.current+=1}},[G,re]),c.useLayoutEffect(()=>{if(be!=="visual")return;const s=ds.current;if(!s)return;const f=()=>{const O=L.current,Z=getComputedStyle(s),Ne=parseFloat(Z.paddingLeft)+parseFloat(Z.paddingRight),nr=parseFloat(Z.paddingTop)+parseFloat(Z.paddingBottom),_c=Math.max(0,s.clientWidth-Ne),Lc=Math.max(0,s.clientHeight-nr),lp=(O==null?void 0:O.offsetWidth)??_c,sp=(O==null?void 0:O.offsetHeight)??Lc;Gf(kb(ta.current,_c,Lc,lp,sp))};if(f(),typeof ResizeObserver>"u")return;const w=new ResizeObserver(f);w.observe(s);const _=L.current;return _&&w.observe(_),f(),()=>w.disconnect()},[be,Ae,sn,eo,Hr,tc]);const ic=c.useCallback(async s=>{Br(s);const f=Ws.current;if(f!=null&&f.load&&f.save){const w=++Qs.current;try{await f.save(s)}catch{}finally{if(w!==Qs.current)return}return}Wk(s)},[]);c.useEffect(()=>{const s=Le;if(!(s!=null&&s.load)||!s.save){Br(Yu()??ye);return}const f=++Qr.current;return(async()=>{try{const w=await s.load();if(f!==Qr.current)return;Br(jf(w)??ye)}catch{if(f!==Qr.current)return;Br(ye)}})(),()=>{Qr.current+=1}},[Le,ye]);const pn=c.useCallback(s=>{var w,_;const f=((w=Er.current)==null?void 0:w.call(Er,s))??s;return f!==we.current&&(jr.current=!0),cs(f),Ve.current&&((_=Dr.current)==null||_.call(Dr,Pt(f),zn.current)),f},[cs]),de=c.useCallback((s,f)=>{const w=pn(s);return Ze.record(w,{coalesce:f}),w},[pn,Ze]),Xf=c.useCallback(s=>{if(Ve.current){const f=Pt(we.current),w=zn.current,_=[...f];_[w]=s,de(mt(_),!1);return}de(s,!1)},[de]),tr=sA({enabled:!ne&&!M,onHtml:Xf}),oe=c.useCallback((s,f)=>de(fo(s,po(s,we.current,fn.current)),f),[de]),no=c.useCallback((s,f)=>fo(s,po(s,f,fn.current)),[]),vt=c.useCallback(()=>{const s=kr.current;return(s==null?void 0:s.getContainer())?Pt(we.current).map((_,O)=>{const Z=s==null?void 0:s.flushPageHtml(O);return Z===null?_:no(Z,_)}):Pt(we.current)},[no]),oa=c.useCallback((s,f,w)=>{const _=Pt(we.current),O=[..._];O[s]=no(f,_[s]??""),de(mt(O),w)},[de,no]),ee=c.useCallback((s,f)=>{var _;if(!Ve.current){oe(s.innerHTML,f);return}const w=(_=kr.current)==null?void 0:_.getContainer();if(!w){oe(s.innerHTML,f);return}for(let O=0;O<Pt(we.current).length;O+=1)if(Eo(w,O)===s){oa(O,s.innerHTML,f);return}oe(s.innerHTML,f)},[oa,oe]),ac=c.useCallback((s,f)=>{ms.current||ee(s,f)},[ee]),lc=c.useCallback(()=>{const s=Ve.current?vt():Pt(we.current);return s[zn.current]??s[0]??""},[vt]),ro=c.useCallback(()=>Ve.current?vt():[we.current],[vt]),sc=c.useCallback(()=>{if(!Ve.current||H.current!=="visual")return;const s=vt(),f=zn.current+1,w=[...s];w.splice(f,0,Ua()),de(mt(w),!1),ps(f)},[vt,de]),oo=c.useCallback(()=>{const s=Ze.undo();s!==null&&(Ze.markApplying(),pn(s))},[pn,Ze]),io=c.useCallback(()=>{const s=Ze.redo();s!==null&&(Ze.markApplying(),pn(s))},[pn,Ze]);c.useEffect(()=>{Ze.syncExternal(Ae)},[Ae,Ze]);const B=c.useCallback(()=>{Se.current=dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current})},[]),ut=c.useCallback(s=>{if(!s||H.current!=="visual"){Ds(!1),Es(!1),Ts(!1);return}Ds(Gl(s)!==null),Es(nu(s)),Ts(ru(s))},[]),ia=c.useCallback(()=>{const s=dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current}),f=Se.current;Wc(f,s)||(Se.current=s)},[]),aa=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){Tr({value:null,unit:wt.current,mixed:!1});return}const f=im(s,wt.current);Ke.current&&(f.value=Ke.current.value,f.unit=Ke.current.unit,f.mixed=!1),wt.current=f.unit,Tr(w=>w.value===f.value&&w.unit===f.unit&&w.mixed===f.mixed?w:f)},[]),la=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){yi({value:null,mixed:!1});return}const f=Ad(s);Ye.current&&(f.value=Ye.current.value,f.mixed=!1),yi(w=>w.value===f.value&&w.mixed===f.mixed?w:f)},[]),sa=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){xi({value:null,mixed:!1}),Ci({value:null,mixed:!1});return}const f=Fo(s,"color");tt.current&&(f.value=tt.current.value,f.mixed=!1);const w=Fo(s,"backgroundColor");nt.current&&(w.value=nt.current.value,w.mixed=!1),xi(_=>_.value===f.value&&_.mixed===f.mixed?_:f),Ci(_=>_.value===w.value&&_.mixed===w.mixed?_:w)},[]),ca=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){vi({tag:null,mixed:!1});return}const f=fy(s);vi(w=>w.tag===f.tag&&w.mixed===f.mixed?w:f)},[]),ua=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){ki({align:null,mixed:!1}),Pi({type:null,mixed:!1}),Di(!1),vs(!1);return}const f=Mm(s);ki(Z=>Z.align===f.align&&Z.mixed===f.mixed?Z:f);const w=ym(s);Pi(Z=>Z.type===w.type&&Z.mixed===w.mixed?Z:w);const _=Sy(s);Di(Z=>Z===_?Z:_);const O=v1(s);vs(Z=>Z===O?Z:O)},[]),z=c.useCallback(()=>{const s=L.current;if(H.current!=="visual"||!s){hi(Et()),Ei(!1),aa(),la(),sa(),ca(),ua();return}const f=Se.current,w=!!(f&&!f.collapsed);Ei(O=>O===w?O:w);const _=um(Cn(s),qe.current);hi(O=>Wb(O,_)?O:_),aa(),la(),sa(),ca(),ua()},[aa,la,sa,ca,ua]),cc=c.useCallback(()=>{const s=Se.current,f=$e.current;!f||!s||s.collapsed&&s.start===f.start&&s.end===f.end||(qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null)},[]);c.useEffect(()=>{jr.current=!0},[Ae]),c.useEffect(()=>{if(be==="visual"){z();return}qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null,hi(Et()),Tr({value:null,unit:wt.current,mixed:!1}),yi({value:null,mixed:!1}),xi({value:null,mixed:!1}),Ci({value:null,mixed:!1}),vi({tag:null,mixed:!1}),ki({align:null,mixed:!1}),Pi({type:null,mixed:!1}),Di(!1),Ei(!1)},[be,z]);const gn=c.useCallback((s,f,w)=>{ch({snapshot:s,visualEl:L.current,htmlEl:Oe.current,getHtml:()=>H.current==="visual"&&L.current?L.current.innerHTML:we.current,setHtml:_=>{if(H.current==="visual"){oe(jt(_).body,!1);return}de(_,!1)},content:f,asHtml:w})},[de,oe]),uc=c.useCallback(s=>{if(H.current==="visual"&&s==="html"){if(Ve.current){const f=mt(vt());f!==we.current&&de(f,!0)}else if(L.current){const f=L.current.innerHTML,w=fo(f,po(f,we.current,fn.current));w!==we.current&&de(w,!0)}}us(s)},[de,us,vt]);c.useEffect(()=>{if(!xt)return;const s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[xt]),c.useEffect(()=>{if(!xt)return;const s=f=>{f.key==="Escape"&&(f.defaultPrevented||Yn.open||Or.open||Yt.open||Xt.open||$i.open||Zr.open||qr.open||Yr.open||Ni||Xn.open||(f.preventDefault(),Bn(!1)))};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[xt,Bn,Yn.open,Or.open,Yt.open,Xt.open,$i.open,Zr.open,qr.open,Yr.open,Ni,Xn.open]),c.useEffect(()=>{const s=()=>{if(H.current!=="visual"||!L.current)return;const f=window.getSelection();if(!f||f.rangeCount===0)return;const w=f.anchorNode;!w||!L.current.contains(w)&&L.current!==w||cn.current===null&&(cn.current=window.requestAnimationFrame(()=>{var O;cn.current=null;const _=L.current;if(!(!_||H.current!=="visual")&&(B(),cc(),z(),mn(Ht(_)),ut(_),qt.current&&Ar.current&&!((O=fi.current)!=null&&O.contains(document.activeElement)))){const Z=Se.current;Z&&Ct(hu(_,Z))}}))};return document.addEventListener("selectionchange",s),()=>{document.removeEventListener("selectionchange",s),cn.current!==null&&(window.cancelAnimationFrame(cn.current),cn.current=null)}},[B,cc,z,ut]),c.useEffect(()=>{(!Ie||be!=="visual"||!st)&&Ct(null)},[Ie,be,st]),c.useEffect(()=>{if(!ct)return;const s=f=>{var O;const w=f.target;if((O=fi.current)!=null&&O.contains(w))return;const _=L.current;_&&yu(_,w)||Ct(null)};return document.addEventListener("pointerdown",s),()=>document.removeEventListener("pointerdown",s)},[ct]),c.useEffect(()=>{if(be!=="html")return;const s=Oe.current;if(!s)return;const f=()=>B();return s.addEventListener("select",f),s.addEventListener("keyup",f),s.addEventListener("mouseup",f),()=>{s.removeEventListener("select",f),s.removeEventListener("keyup",f),s.removeEventListener("mouseup",f)}},[be,B]),c.useLayoutEffect(()=>{if(be!=="visual"||ne){mn(null);return}const s=L.current;if(!s)return;const f=Ht(s);mn(w=>f||(w&&w.isConnected&&s.contains(w)?w:null))},[Ae,be,ne]);const K=c.useCallback(s=>{const f=dt({mode:"visual",visualEl:s,htmlEl:Oe.current}),w=Se.current,_=Wc(w,f)?w:f.visualRange?f:w??f;Se.current=_,s.focus();const O=sh(s,_);if(O){const Z=window.getSelection();try{Z==null||Z.removeAllRanges(),Z==null||Z.addRange(O),Se.current={..._,visualRange:O}}catch{}}return Se.current??_},[]),St=c.useCallback(()=>{Mr.current=null,_r.current=null,Cs(!1)},[]),dc=c.useCallback(()=>{if(!Nr.current||!Mr.current||!_r.current||H.current!=="visual")return;const s=L.current;if(!s)return;B();const f=Se.current;!f||f.collapsed||Q1(f,_r.current)||(K(s),tC(s,Mr.current),ee(s,!1),B(),z(),St())},[B,K,oe,z,St]),mc=c.useCallback(()=>{if(H.current!=="visual"){St();return}if(Nr.current){St();return}const s=L.current;if(!s){St();return}const f=K(s);if(f.collapsed){St();return}Mr.current=eC(s),_r.current={...f},Cs(!0),B()},[St,K,B]),fc=c.useCallback(()=>{dc()},[dc]);c.useEffect(()=>{(be!=="visual"||ne)&&St()},[be,ne,St]);const da=c.useCallback((s,f)=>{if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=f??wt.current,O=nn(s,_);if(!O)return;wt.current=O.unit;const Z=K(w);if(Z.collapsed){Ke.current=O,$e.current={start:Z.start,end:Z.end},z();return}Ke.current=null,Ja(w,O.value,O.unit)&&(ee(w,!1),B(),z())},[K,oe,B,z]),pc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(w.collapsed){Ye.current={value:s},$e.current={start:w.start,end:w.end},z();return}Ye.current=null,Ga(f,s)&&(ee(f,!1),B(),z())},[K,oe,B,z]),ma=c.useCallback((s,f)=>{if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=K(w),O=s==="color"?tt:nt;if(_.collapsed){O.current={value:f},$e.current={start:_.start,end:_.end},z();return}O.current=null,ar(w,s,f)&&(ee(w,!1),B(),z())},[K,oe,B,z]),fa=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(Lr({open:!1,tab:"general"}),w.collapsed){if(s.size!==null){const Ne=nn(s.size,s.unit);Ne&&(Ke.current=Ne,wt.current=Ne.unit)}const O=Cn(f),Z={};for(const Ne of Qe)s.marks[Ne]!==O[Ne]&&(Z[Ne]=s.marks[Ne]);qe.current=Z,s.fontColorMixed||(tt.current={value:s.fontColor}),s.highlightColorMixed||(nt.current={value:s.highlightColor}),s.fontFamilyMixed||(Ye.current={value:s.fontFamily}),$e.current={start:w.start,end:w.end},z();return}if(qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,$e.current=null,s.size!==null){const O=nn(s.size,s.unit);O&&(wt.current=O.unit,Ja(f,O.value,O.unit))}const _=Cn(f);for(const O of Qe)s.marks[O]!==_[O]&&tl(f,O);s.fontFamilyMixed||Ga(f,s.fontFamily),s.fontColorMixed||ar(f,"color",s.fontColor),s.highlightColorMixed||ar(f,"backgroundColor",s.highlightColor),ee(f,!1),B(),z()},[K,oe,B,z]),gc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),zr(w=>({...w,open:!1})),!Lm(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),hc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(Fi(_=>({..._,open:!1})),!li(s)){B(),z();return}if(w.collapsed){Nt.current=s,$e.current={start:w.start,end:w.end},z();return}if(Nt.current=null,!cm(f,s)){B(),z();return}ee(f,!1),B(),z()},[K,oe,B,z]),bc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),dn(w=>({...w,open:!1})),!f1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),yc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),$r(w=>({...w,open:!1})),!j1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),xc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Ki(w=>({...w,open:!1})),!N1(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),ao=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Ur({open:!1}),!px(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),lo=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Wr({open:!1}),!gC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Cc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Qn({open:!1}),!SC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),wc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Ui({open:!1}),!My(f,s)){B(),z();return}ee(f,!1),B(),z(),ut(f)}},[K,oe,B,z,ut]),vc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Wi(w=>({...w,open:!1})),!XC(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Sc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Gi(w=>({...w,open:!1})),!lw(f,s)){B(),z();return}ee(f,!1),B(),z(),ut(f)}},[K,oe,B,z,ut]),kc=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Vi(w=>({...w,open:!1})),!bw(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),kt=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),!s(f)){B(),z();return}ee(f,!1),B(),z(),ut(f)}},[K,oe,B,z,ut]),pa=c.useCallback(s=>{ao({src:s.src,alt:s.alt??"",title:s.title??"",css:s.css})},[ao]),ga=c.useCallback(s=>{lo({src:s.src,title:s.title??"",css:s.css})},[lo]),ha=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Qn({open:!1}),!kC(f,{src:s.src,title:s.title??"",css:s.css})){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Ac=c.useCallback(s=>{if(H.current!=="visual")return;const f=L.current;if(f){if(K(f),Vr(w=>({...w,open:!1})),!Tx(f,s)){B(),z();return}ee(f,!1),B(),z()}},[K,oe,B,z]),Jf=c.useCallback((s,f)=>{De!=null&&De.isConnected&&GC(De,s,f)},[De]),Qf=c.useCallback(()=>{const s=L.current;!s||!(De!=null&&De.isConnected)||(ee(s,!1),Ra(s,De),B(),z())},[De,oe,B,z]),Lt=c.useCallback(()=>{if(Ve.current){if(H.current==="visual"){const s=vt(),f=mt(s);if(f!==we.current)return de(f,!0)}return we.current}if(H.current==="visual"&&L.current){const s=L.current.innerHTML,f=fo(s,po(s,we.current,fn.current));if(f!==we.current)return de(f,!0)}return we.current},[de]),ba=c.useCallback(()=>{if(!jr.current&&gi.current)return gi.current;const s=JSON.stringify(ro());return gi.current=s,jr.current=!1,s},[ro]),ep=c.useCallback(()=>Ve.current?ba():Lt(),[Lt,ba]);kw({onAutoSave:r?()=>{const s=Ve.current?JSON.parse(ba()):Lt();return r(s)}:void 0,getHtml:ep}),c.useEffect(()=>()=>{var s;(s=On.current)==null||s.cancel()},[]);const le=c.useMemo(()=>({getHtml:Lt,setHtml:s=>{de(s,!1)},getMode:()=>H.current,setMode:uc,getFullscreen:()=>gs.current,setFullscreen:Bn,getDarkMode:()=>Gs.current,setDarkMode:s=>{rc(s)},getPageZoom:()=>ta.current,setPageZoom:oc,getToolbarPosition:()=>Vs.current,setToolbarPosition:s=>{ic(s)},openCustomizeToolbar:()=>{ks(!0)},openDocumentPreview:()=>{As({open:!0,html:Lt()})},toggleReadAloud:()=>{const s=On.current;if(!s)return;const f=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current}),w=Cu(go(f),Lt());w&&s.toggle(w)},isReadingAloud:()=>{var s;return((s=On.current)==null?void 0:s.isSpeaking())??!1},canReadAloud:()=>{if(!To())return!1;const s=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});return Cu(go(s),Lt())!==null},undo:oo,redo:io,canUndo:()=>Ze.canUndo(),canRedo:()=>Ze.canRedo(),getSelection:()=>{const s=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});return go(s)},insertText:s=>{const f=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});gn(f,s,!1)},insertHtml:(s,f)=>{const w=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current}),_=f===void 0;gn(w,_?s:f,_)},toggleFontMark:s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;const w=K(f);if(w.collapsed){const _=Cn(f);qe.current=Vb(qe.current,_,s),$e.current={start:w.start,end:w.end},z();return}qe.current={},$e.current=null,tl(f,s)&&(ee(f,!1),B(),z())},clearFormatting:()=>{if(H.current!=="visual")return;const s=L.current;!s||K(s).collapsed||(qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null,J1(s)&&(ee(s,!1),B(),z()))},toggleFormatBrush:mc,isFormatBrushActive:()=>Nr.current,isFontMarkActive:s=>bi.current[s],hasTextSelection:()=>H.current==="visual"&&Ri.current,setFontSize:(s,f)=>{da(s,f)},setFontSizeUnit:s=>{var Ne;const f=L.current,w=Mt.current;if(H.current!=="visual"||!f||w.value===null||w.mixed){wt.current=s,Tr(nr=>({...nr,unit:s}));return}const _=K(f),O=_b(f,((Ne=_.visualRange)==null?void 0:Ne.startContainer)??f),Z=Dd(w.value,w.unit,s,O.parentPx,O.rootPx);da(Z,s)},getFontSize:()=>Mt.current.value,getFontSizeUnit:()=>Mt.current.unit,isFontSizeMixed:()=>Mt.current.mixed,setFontFamily:s=>{pc(s)},getFontFamily:()=>Un.current.value,isFontFamilyMixed:()=>Un.current.mixed,getFontFaces:()=>fn.current,setFontColor:s=>{ma("color",s)},setHighlightColor:s=>{ma("backgroundColor",s)},getFontColor:()=>Gn.current.value,isFontColorMixed:()=>Gn.current.mixed,getHighlightColor:()=>Zn.current.value,isHighlightColorMixed:()=>Zn.current.mixed,setParagraphStyle:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),py(f,s)&&(ee(f,!1),B(),z()))},getParagraphStyle:()=>Si.current.tag,isParagraphStyleMixed:()=>Si.current.mixed,setTextAlign:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),_m(f,s)&&(ee(f,!1),B(),z()))},getTextAlign:()=>Ai.current.align,isTextAlignMixed:()=>Ai.current.mixed,indent:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),ky(s)&&(ee(s,!1),B(),z()))},outdent:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),Ay(s)&&(ee(s,!1),B(),z()))},canOutdent:()=>H.current==="visual"&&xs.current,toggleList:s=>{if(H.current!=="visual")return;const f=L.current;f&&(K(f),by(f,s)&&(ee(f,!1),B(),z()))},isBulletList:()=>qn.current.type==="ul"&&!qn.current.mixed,isNumberedList:()=>qn.current.type==="ol"&&!qn.current.mixed,openFontProperties:s=>{H.current==="visual"&&Lr({open:!0,tab:s??"general"})},applyFontProperties:s=>{fa(s)},openCustomCss:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=s?lm(s):{value:null,mixed:!1},w=f.mixed||!f.value?"":zb(f.value);Fi({open:!0,value:w})},applyCustomCss:s=>{hc(s)},openParagraphProperties:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f),zr({open:!0,tab:s??"general",value:f?au(f):lr()})},applyParagraphProperties:s=>{gc(s)},openPageProperties:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f),dn({open:!0,tab:s??"font",value:f?m1(f):dl()})},applyPageProperties:s=>{bc(s)},openCustomParagraphStyleDialog:s=>{if(H.current!=="visual"||!ea.current)return;if(s){const w=Xr.current.find(_=>_.id===s);if(!w)return;Jn({open:!0,mode:"edit",style:w});return}const f=L.current;f&&K(f),Jn({open:!0,mode:"create",font:{size:Mt.current.mixed?null:Mt.current.value,unit:Mt.current.unit,marks:{...bi.current},fontFamily:Un.current.mixed?null:Un.current.value,fontColor:Gn.current.mixed?null:Gn.current.value,highlightColor:Zn.current.mixed?null:Zn.current.value},paragraph:Im(f?au(f):lr())})},applyCustomParagraphStyle:s=>{const f=Xr.current.find(_=>_.id===s);if(!f||(fa({size:f.font.size,unit:f.font.unit,marks:f.font.marks,fontFamily:f.font.fontFamily??null,fontFamilyMixed:!1,fontColor:f.font.fontColor,highlightColor:f.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!f.paragraph))return;const w=L.current;!w||H.current!=="visual"||(K(w),Yy(w,f.paragraph)&&(ee(w,!1),B(),z()))},customParagraphStylesEnabled:()=>ea.current,getCustomParagraphStyles:()=>Xr.current,isCustomParagraphStylesLoading:()=>_s.current,openLinkDialog:s=>{if(H.current!=="visual")return;const f=L.current;f&&K(f);const w=f?Jm(f):ui(),_=f?ml(f):[],O=(w==null?void 0:w.href)??"",Z=O.startsWith("#")?O.slice(1):"",Ne=_.some(nr=>nr.id===Z)?Z:"";$r({open:!0,tab:s??"link",href:O,title:(w==null?void 0:w.title)??"",targetBlank:(w==null?void 0:w.targetBlank)??!1,textDecorationNone:(w==null?void 0:w.textDecorationNone)??!1,hoverMode:(w==null?void 0:w.hoverMode)??"color",hoverColor:(w==null?void 0:w.hoverColor)??null,hoverHtml:(w==null?void 0:w.hoverHtml)??"",bookmarks:_,selectedBookmarkId:Ne})},applyLink:s=>{yc(s)},openBookmarkDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s),Ki({open:!0,existingIds:s?ml(s).map(f=>f.id):[]})},applyBookmark:s=>{xc(s)},openImageDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=zs.current;if(Zs.current&&f){f.onPick(pa);return}Ur({open:!0})},applyImage:s=>{ao(s)},openAudioDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=Os.current;if(qs.current&&f){f.onPick(ga);return}Wr({open:!0})},applyAudio:s=>{lo(s)},openYoutubeDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s);const f=Ks.current;if(Ys.current&&f){f.onPick(ha);return}Qn({open:!0})},applyYoutube:s=>{Cc(s)},openImageProperties:s=>{if(H.current!=="visual")return;const f=L.current;if(!f)return;K(f);const w=Ht(f),_=Rx(f);!w||!_||Vr({open:!0,tab:s??"general",value:_,aspectRatio:Dx(w)})},applyImageProperties:s=>{Ac(s)},insertHorizontalRule:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),IC(s)&&(ee(s,!1),B(),z()))},insertPageBreak:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),zC(s)&&(ee(s,!1),B(),z()))},insertPage:()=>{sc()},isMultiPagesEnabled:()=>Ve.current,getActivePageHtml:()=>lc(),getAllPagesHtml:()=>ro(),openTableDialog:()=>{if(H.current!=="visual")return;const s=L.current;s&&K(s),Ui({open:!0})},applyTable:s=>{wc(s)},openTableProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=YC(s);f&&Wi({open:!0,value:f})},applyTableProperties:s=>{vc(s)},openCellProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=aw(s);f&&Gi({open:!0,value:f})},applyCellProperties:s=>{Sc(s)},openRowProperties:()=>{if(H.current!=="visual")return;const s=L.current;if(!s)return;K(s);const f=hw(s);f&&Vi({open:!0,value:f})},applyRowProperties:s=>{kc(s)},insertRowBelow:()=>{kt(s=>ol(s,"below"))},insertRowBefore:()=>{kt(s=>ol(s,"before"))},deleteRow:()=>{kt(s=>_y(s))},insertColumnAfter:()=>{kt(s=>tu(s,"after"))},insertColumnBefore:()=>{kt(s=>tu(s,"before"))},deleteColumn:()=>{kt(s=>Ly(s))},mergeCells:()=>{kt(s=>By(s))},unmergeCells:()=>{kt(s=>Hy(s))},cut:async()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),await V1(s)&&(ee(s,!1),B(),z()))},copy:async()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),await of(s))},deleteSelection:()=>{if(H.current!=="visual")return;const s=L.current;s&&(K(s),rf(s)&&(ee(s,!1),B(),z()))},addComment:()=>{if(!qt.current||y||H.current!=="visual")return;const s=L.current;if(!s)return;const f=K(s),w=hu(s,f);if(w){Ct(w);return}const _=I1(s,f);if(!_)return;const O=O1(_);F1(s,O.id,f)&&(xu(s,O.id),B(),ac(s,!1),Hn([...Pr.current,O]),Ct(O.id))},toggleCommentsVisible:()=>{Of(s=>{const f=!s,w=L.current;return w&&bu(w,f),f})},areCommentsVisible:()=>Ar.current,canAddComment:()=>!qt.current||y||H.current!=="visual"?!1:Ri.current||qi.current!==null,isCommentsEnabled:()=>qt.current,getCommentThreads:()=>Pr.current,setCommentThreads:s=>Hn(s),openCommentThread:s=>{const f=L.current;!f||H.current!=="visual"||xu(f,s)&&(B(),Ct(s))},isContentLocked:()=>fs.current,isLink:()=>Ss.current,isImageSelected:()=>H.current==="visual"&&qi.current!==null,isInTable:()=>H.current==="visual"&&js.current,canMergeCells:()=>H.current==="visual"&&Rs.current,canUnmergeCells:()=>H.current==="visual"&&Ns.current,...i!=null?{onSave:s=>Bs.current(s)}:{},...a!=null?{onOpen:()=>Hs.current()}:{}}),[de,oe,ee,ac,uc,Bn,rc,oc,ic,gn,oo,io,B,z,K,da,pc,ma,fa,hc,gc,bc,yc,xc,ao,lo,Cc,Ac,wc,vc,Sc,kc,kt,pa,ga,ha,Lt,lc,ro,sc,mc,i,a,y,Hn]),Pc=c.useCallback(()=>{const s=Se.current??dt({mode:H.current,visualEl:L.current,htmlEl:Oe.current});return{mode:s.mode,selection:go(s),getHtml:le.getHtml,setHtml:f=>{de(f,!1)},insertText:f=>gn(s,f,!1),insertHtml:(f,w)=>{const _=w===void 0;gn(s,_?f:w,_)}}},[gn,le.getHtml,de]),{catalog:so,layout:Dc}=c.useMemo(()=>og(R,lP,sP),[R]),co=c.useMemo(()=>HA(Dc,E),[Dc,E]),ya=c.useMemo(()=>({...co,iconGroups:mA(co.iconGroups,Mi)}),[co,Mi]),xa=c.useMemo(()=>Ie?mP(so,st):so,[so,Ie,st]),Ca=c.useMemo(()=>Ie?fP(ya):ya,[ya,Ie]),wa=c.useMemo(()=>({disabled:Fn,readOnly:x,enableComments:Ie}),[Fn,x,Ie]),jc=c.useMemo(()=>ct?U1(ln,ct):null,[ct,ln]),tp=c.useCallback(s=>{if(!ct||!Sr||y)return;const f=K1(Sr,s);Hn($1(Pr.current,ct,f))},[ct,Sr,y,Hn]),hn=c.useMemo(()=>({...Eb(le),...ig(R,Pc)}),[le,R,Pc]),va=c.useMemo(()=>Rb(le),[le,Rr,Kn,$n,Wn,Vn,wi,Bi,Hi,Qi,_t,De,Yi,Xi,Ji,ji,Ti,un,rt,Hr]),Ec=c.useCallback(s=>{if(ne||s.inputType!=="insertText"&&s.inputType!=="insertReplacementText"||!s.data||!Gb(qe.current)&&!Ke.current&&!Vg(Ye.current)&&!wh({color:tt.current,backgroundColor:nt.current})&&!$b(Nt.current))return;const f=L.current;f&&(s.preventDefault(),ny(f,s.data,qe.current,Ke.current,{color:tt.current,backgroundColor:nt.current},Ye.current,Nt.current),qe.current={},Ke.current=null,Ye.current=null,tt.current=null,nt.current=null,Nt.current=null,$e.current=null,ee(f,!0),B(),z())},[ne,oe,B,z]),Rc=c.useCallback(s=>{if(ne||!wg(s,Ms.current))return;s.preventDefault(),s.stopPropagation();const f=L.current;if(!f)return;K(f);const w=sl(f,s.target),_=Wo(f,s.target);_&&!wr(f).includes(_)&&Fy(f,_);const O={inTable:He(f,s.target)!==null,canMergeCells:nu(f),canUnmergeCells:ru(f)};if(w){Ra(f,w),B(),mn(w),Zi({open:!0,x:s.clientX,y:s.clientY,kind:"image",...O,inTable:He(f,w)!==null});return}const Z=dt({mode:"visual",visualEl:f,htmlEl:Oe.current});Se.current=Z,Zi({open:!0,x:s.clientX,y:s.clientY,kind:Z.collapsed?"caret":"text",...O})},[ne,B,K]),Tc=c.useCallback(s=>{if(Ms.current=s.pointerType,y)return;const f=L.current;if(!f)return;if(qt.current&&Ar.current){const _=yu(f,s.target);if(_){const O=_.getAttribute("data-comment-thread");O&&Ct(O);return}}if(ne&&!qt.current)return;const w=sl(f,s.target);if(!w){mn(null);return}s.preventDefault(),Ra(f,w),B(),mn(w)},[y,ne,B]);c.useEffect(()=>{if(!Ie||be!=="visual")return;const s=L.current;s&&(z1(s,ln),bu(s,st))},[Ie,be,ln,st,Ae]);const Nc=c.useCallback(s=>{if(ne)return;if(s.key==="Tab"&&!s.ctrlKey&&!s.metaKey&&!s.altKey){if(H.current!=="visual")return;const w=L.current;if(!w)return;const _=s.target;if(!(_ instanceof Node)||!w.contains(_))return;K(w);const O=Iy(w,s.shiftKey);if(!O)return;s.preventDefault(),typeof O=="object"&&O.changed&&ee(w,!1),B(),z(),ut(w);return}if(!(s.ctrlKey||s.metaKey))return;if(s.key==="Enter"&&!s.shiftKey){s.preventDefault(),le.insertPageBreak();return}const f=s.key.toLowerCase();if(f==="z"&&!s.shiftKey){s.preventDefault(),oo();return}if(f==="z"&&s.shiftKey||f==="y"){s.preventDefault(),io();return}if(f==="b"&&!s.shiftKey){s.preventDefault(),le.toggleFontMark("bold");return}if(f==="i"&&!s.shiftKey){s.preventDefault(),le.toggleFontMark("italic");return}if(f==="u"&&!s.shiftKey){s.preventDefault(),le.toggleFontMark("underline");return}if(f==="x"&&s.shiftKey){s.preventDefault(),le.toggleFontMark("strikethrough");return}f==="p"&&!s.shiftKey&&(s.preventDefault(),hn.print())},[ne,oo,io,le,hn,K,oe,B,z,ut]),np=c.useCallback(s=>{if(s.key==="Escape"&&ct){s.preventDefault(),Ct(null);return}Nc(s)},[ct,Nc]),rp=[fe.root,Ka(un).className,xt?fe.fullscreen:"",b].filter(Boolean).join(" "),op=WP({toolbarBackground:v,menuColor:k,menuBackground:P,menuFontSize:N,menuFontFamily:D,border:A}),ip=Ka(un)["data-wysiwyg-theme"],ap=c.useMemo(()=>{if(!(be!=="visual"||Ii===1))return{transform:`scale(${Ii})`}},[be,Ii]),Mc=be==="visual"?Ce?o.jsx($P,{ref:kr,pages:eo,activePageIndex:sn,onActivePageIndexChange:s=>{var w;ps(s);const f=(w=kr.current)==null?void 0:w.getActivePageRoot();f instanceof HTMLDivElement&&(L.current=f)},onPageChange:(s,f)=>oa(s,f,!0),onBeforeInput:Ec,onPointerDown:s=>{s.currentTarget instanceof HTMLDivElement&&(L.current=s.currentTarget),Tc(s)},onMouseUp:fc,onContextMenu:Rc,placeholder:C,disabled:ne}):o.jsx(KP,{ref:L,html:jt(Ae).body,onChange:s=>oe(s,!0),onBeforeInput:Ec,onPointerDown:Tc,onMouseUp:fc,onContextMenu:Rc,placeholder:C,disabled:ne}):o.jsx(OP,{ref:Oe,html:Ae,onChange:s=>de(s,!0),placeholder:C,disabled:ne});return o.jsx(fg,{locale:S,children:o.jsx(cg,{dark:un,children:o.jsxs("div",{className:rp,style:op,"data-fullscreen":xt?"":void 0,"data-wysiwyg-theme":ip,"data-toolbar-position":rt,"data-comments-visible":Ie&&st?"":void 0,onKeyDown:np,children:[T?o.jsx("div",{className:fe.menuChrome,onPointerDownCapture:ia,children:o.jsx(Oa,{catalog:xa,layout:Ca,commands:hn,queries:va,disabled:Fn,chromeLock:wa,menuVisible:!0,toolbarVisible:!1})}):null,o.jsxs("div",{className:fe.body,"data-icon-dock":I?rt:void 0,children:[I&&(rt==="top"||rt==="left")?o.jsx("div",{className:fe.iconChrome,onPointerDownCapture:ia,children:o.jsx(Oa,{catalog:xa,layout:Ca,commands:hn,queries:va,disabled:Fn,chromeLock:wa,menuVisible:!1,toolbarVisible:!0,position:rt})}):null,o.jsxs("div",{ref:ds,className:`${fe.workspace} ${tc?fe.workspacePageSized:""}`,onDragEnter:tr.onDragEnter,onDragOver:tr.onDragOver,onDragLeave:tr.onDragLeave,onDrop:tr.onDrop,children:[be==="visual"?o.jsx("div",{className:fe.pageCanvasViewport,style:ap,children:Mc}):Mc,tr.dragging?o.jsx(VP,{}):null]}),I&&(rt==="bottom"||rt==="right")?o.jsx("div",{className:fe.iconChrome,onPointerDownCapture:ia,children:o.jsx(Oa,{catalog:xa,layout:Ca,commands:hn,queries:va,disabled:Fn,chromeLock:wa,menuVisible:!1,toolbarVisible:!0,position:rt})}):null]}),xt?o.jsx(GP,{onClick:()=>Bn(!1)}):null,o.jsx(BA,{open:Ni,catalog:so,groups:co.iconGroups,settings:Mi,loading:$f,busy:Uf,disabled:ne,onChange:s=>{nc(s)},onReset:()=>{nc(null)},onClose:()=>ks(!1)}),o.jsx(Fk,{open:Xn.open,html:Xn.html,onClose:()=>As({open:!1,html:Xn.html})}),o.jsx(qv,{open:Yn.open,tab:Yn.tab,size:Kn.value,unit:Kn.unit,marks:Rr,fontFamily:$n.value,fontFamilyMixed:$n.mixed,fontColor:Wn.value,fontColorMixed:Wn.mixed,highlightColor:Vn.value,highlightColorMixed:Vn.mixed,fonts:_t,disabled:ne,onTabChange:s=>Lr({open:!0,tab:s}),onApply:s=>le.applyFontProperties(s),onClose:()=>Lr({open:!1,tab:Yn.tab})}),o.jsx(yS,{open:Yt.open,tab:Yt.tab,value:Yt.value,disabled:ne,onTabChange:s=>zr({...Yt,open:!0,tab:s}),onApply:s=>le.applyParagraphProperties(s),onClose:()=>zr({...Yt,open:!1})}),o.jsx(TS,{open:Or.open,value:Or.value,disabled:ne,onApply:s=>le.applyCustomCss(s),onClose:()=>Fi(s=>({...s,open:!1}))}),o.jsx(PS,{open:Xt.open,tab:Xt.tab,value:Xt.value,fonts:_t,disabled:ne,customImagePicker:J,onCustomImagePick:()=>{J==null||J.onPick(s=>{dn(f=>({...f,tab:"paragraph",value:{...f.value,backgroundImage:{...f.value.backgroundImage,src:s.src}}}))})},onTabChange:s=>dn({...Xt,open:!0,tab:s}),onApply:s=>le.applyPageProperties(s),onResetAtRule:()=>{const s=L.current;!s||H.current!=="visual"||p1(s)&&(ee(s,!1),dn(f=>({...f,value:{...f.value,atRule:rn()}})))},onClose:()=>dn({...Xt,open:!1})}),o.jsx(ES,{open:Pe.open,mode:Pe.open?Pe.mode:"create",styleId:Pe.open&&Pe.mode==="edit"?Pe.style.id:void 0,name:Pe.open&&Pe.mode==="edit"?Pe.style.name:"",font:Pe.open?Pe.mode==="edit"?Pe.style.font:Pe.font:{size:null,unit:tn,marks:Et(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:Pe.open?Pe.mode==="edit"?Pe.style.paragraph:Pe.paragraph:void 0,canDelete:!!X,fonts:_t,busy:Vf,disabled:ne,onSave:async s=>{const f=Is.current;if(f){Kr(!0);try{await f(s),Jn({open:!1}),await to()}finally{Kr(!1)}}},onDelete:async s=>{const f=Fs.current;if(f){Kr(!0);try{await f(s),Jn({open:!1}),await to()}finally{Kr(!1)}}},onClose:()=>Jn({open:!1})}),o.jsx(ok,{open:Ue.open,tab:Ue.tab,href:Ue.href,title:Ue.title,targetBlank:Ue.targetBlank,textDecorationNone:Ue.textDecorationNone,hoverMode:Ue.hoverMode,hoverColor:Ue.hoverColor,hoverHtml:Ue.hoverHtml,bookmarks:Ue.bookmarks,selectedBookmarkId:Ue.selectedBookmarkId,disabled:ne,onTabChange:s=>$r({...Ue,open:!0,tab:s}),onApply:s=>le.applyLink(s),onClose:()=>$r({...Ue,open:!1})}),o.jsx(MS,{open:Oi.open,existingIds:Oi.existingIds,disabled:ne,onApply:s=>le.applyBookmark(s),onClose:()=>Ki({...Oi,open:!1})}),o.jsx(FS,{open:Zf.open,disabled:ne,customImagePicker:J,onApply:s=>le.applyImage(s),onCustomPick:()=>{Ur({open:!1}),J==null||J.onPick(pa)},onClose:()=>Ur({open:!1})}),o.jsx(IS,{open:qf.open,disabled:ne,customAudioPicker:Y,onApply:s=>le.applyAudio(s),onCustomPick:()=>{Wr({open:!1}),Y==null||Y.onPick(ga)},onClose:()=>Wr({open:!1})}),o.jsx(ik,{open:Yf.open,disabled:ne,customVideoPicker:te,onApply:s=>le.applyYoutube(s),onCustomPick:()=>{Qn({open:!1}),te==null||te.onPick(ha)},onClose:()=>Qn({open:!1})}),o.jsx(YS,{open:Gr.open,tab:Gr.tab,value:Gr.value,aspectRatio:Gr.aspectRatio,disabled:ne,onTabChange:s=>Vr(f=>({...f,tab:s})),onApply:s=>le.applyImageProperties(s),onClose:()=>Vr(s=>({...s,open:!1}))}),o.jsx(dk,{open:$i.open,disabled:ne,onApply:s=>le.applyTable(s),onClose:()=>Ui({open:!1})}),o.jsx(hk,{open:Zr.open,value:Zr.value,disabled:ne,onApply:s=>le.applyTableProperties(s),onClose:()=>Wi(s=>({...s,open:!1}))}),o.jsx(Sk,{open:qr.open,value:qr.value,disabled:ne,onApply:s=>le.applyCellProperties(s),onClose:()=>Gi(s=>({...s,open:!1}))}),o.jsx(Dk,{open:Yr.open,value:Yr.value,disabled:ne,onApply:s=>le.applyRowProperties(s),onClose:()=>Vi(s=>({...s,open:!1}))}),be==="visual"&&!ne&&(De!=null&&De.isConnected)?o.jsx(rk,{img:De,onResize:Jf,onResizeEnd:Qf}):null,Ie&&st&&jc?o.jsx(lA,{panelRef:fi,thread:jc,locale:S,disabled:y,commentAuthor:Sr,onPost:tp,onClose:()=>Ct(null)}):null,o.jsx(xg,{open:Jt.open,x:Jt.x,y:Jt.y,kind:Jt.kind,inTable:Jt.inTable,canMergeCells:Jt.canMergeCells,canUnmergeCells:Jt.canUnmergeCells,commands:hn,onClose:()=>Zi(s=>({...s,open:!1}))})]})})})}function WP({toolbarBackground:e,menuColor:t,menuBackground:n,menuFontSize:r,menuFontFamily:i,border:a}){const l={};return e&&(l["--wysiwyg-toolbar-background"]=e),t&&(l["--wysiwyg-menu-color"]=t),n&&(l["--wysiwyg-menu-background"]=n),r&&(l["--wysiwyg-menu-font-size"]=r),i&&(l["--wysiwyg-menu-font-family"]=i),a==="none"?(l["--wysiwyg-border-width"]="0",l["--wysiwyg-border-radius"]="0",l["--wysiwyg-border-shadow"]="none"):a&&(a.width&&(l["--wysiwyg-border-width"]=a.width),a.color&&(l["--wysiwyg-border-color"]=a.color),a.radius&&(l["--wysiwyg-border-radius"]=a.radius),a.shadow&&(l["--wysiwyg-border-shadow"]=a.shadow)),Object.keys(l).length?l:void 0}function GP({onClick:e}){const t=W();return o.jsx("button",{type:"button",className:fe.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:o.jsx(_e,{className:fe.exitFullscreenIcon})})}function VP(){const e=W();return o.jsx("div",{className:fe.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function ZP(e){var n;if(e.tagName.toLowerCase()!=="span")return!1;const t=[...e.attributes];return t.length===0||t.length===1&&((n=t[0])==null?void 0:n.name)===Re?!0:t.length===2&&t.some(r=>r.name===Re)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function qP(e){for(const t of[...e.querySelectorAll(`[${Re}]`)])t.removeAttribute(Re),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!ZP(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function YP(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return qP(n.body),n.body.innerHTML}exports.Editor=UP;exports.PAGE_SEPARATOR=_o;exports.joinPagesToHtml=mt;exports.splitPagesFromHtml=Pt;exports.stripCommentAnchors=YP;
|