commspliant-html-editor 0.0.10 → 0.0.11

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.
Files changed (82) hide show
  1. package/README.md +8 -2
  2. package/dist/commspliant-html-editor.css +1 -1
  3. package/dist/components/Editor.d.ts +1 -1
  4. package/dist/components/Editor.d.ts.map +1 -1
  5. package/dist/components/MultiPageVisualSurface.d.ts +14 -0
  6. package/dist/components/MultiPageVisualSurface.d.ts.map +1 -1
  7. package/dist/components/RulerVisualFrame.d.ts +41 -0
  8. package/dist/components/RulerVisualFrame.d.ts.map +1 -0
  9. package/dist/components/VisualSurface.d.ts +15 -0
  10. package/dist/components/VisualSurface.d.ts.map +1 -1
  11. package/dist/components/rulerDocumentHandlers.d.ts +14 -0
  12. package/dist/components/rulerDocumentHandlers.d.ts.map +1 -0
  13. package/dist/components/useMultiPageRulerMetrics.d.ts +10 -0
  14. package/dist/components/useMultiPageRulerMetrics.d.ts.map +1 -0
  15. package/dist/components/usePageRulerMetrics.d.ts +8 -0
  16. package/dist/components/usePageRulerMetrics.d.ts.map +1 -0
  17. package/dist/core/commandTypes.d.ts +18 -6
  18. package/dist/core/commandTypes.d.ts.map +1 -1
  19. package/dist/core/documentStyles.d.ts.map +1 -1
  20. package/dist/core/fontFamily.d.ts.map +1 -1
  21. package/dist/core/image.d.ts.map +1 -1
  22. package/dist/core/imageWebp.d.ts +6 -0
  23. package/dist/core/imageWebp.d.ts.map +1 -0
  24. package/dist/core/pageAtRule.d.ts.map +1 -1
  25. package/dist/core/pageBackgroundImage.d.ts +2 -0
  26. package/dist/core/pageBackgroundImage.d.ts.map +1 -1
  27. package/dist/core/pageBreak.d.ts +1 -0
  28. package/dist/core/pageBreak.d.ts.map +1 -1
  29. package/dist/core/pageCanvasLayout.d.ts +11 -1
  30. package/dist/core/pageCanvasLayout.d.ts.map +1 -1
  31. package/dist/core/pageGeometry.d.ts +18 -0
  32. package/dist/core/pageGeometry.d.ts.map +1 -0
  33. package/dist/core/paragraphBackgroundImage.d.ts +4 -0
  34. package/dist/core/paragraphBackgroundImage.d.ts.map +1 -0
  35. package/dist/core/paragraphIndent.d.ts +19 -0
  36. package/dist/core/paragraphIndent.d.ts.map +1 -0
  37. package/dist/core/printLayout.d.ts +3 -0
  38. package/dist/core/printLayout.d.ts.map +1 -0
  39. package/dist/core/rulerUnits.d.ts +35 -0
  40. package/dist/core/rulerUnits.d.ts.map +1 -0
  41. package/dist/i18n/en.d.ts.map +1 -1
  42. package/dist/i18n/es.d.ts.map +1 -1
  43. package/dist/i18n/types.d.ts +13 -0
  44. package/dist/i18n/types.d.ts.map +1 -1
  45. package/dist/icons/RulerIcon.d.ts +3 -0
  46. package/dist/icons/RulerIcon.d.ts.map +1 -0
  47. package/dist/icons/index.d.ts +1 -0
  48. package/dist/icons/index.d.ts.map +1 -1
  49. package/dist/index.cjs +40 -8
  50. package/dist/index.js +8061 -6696
  51. package/dist/modules/file/printHtml.d.ts.map +1 -1
  52. package/dist/modules/format/PagePropertiesDialog.d.ts +4 -2
  53. package/dist/modules/format/PagePropertiesDialog.d.ts.map +1 -1
  54. package/dist/modules/format/ParagraphPropertiesDialog.d.ts +11 -2
  55. package/dist/modules/format/ParagraphPropertiesDialog.d.ts.map +1 -1
  56. package/dist/modules/format/paragraphDialog.d.ts.map +1 -1
  57. package/dist/modules/history/history.d.ts +2 -0
  58. package/dist/modules/history/history.d.ts.map +1 -1
  59. package/dist/modules/insert/catalog.d.ts.map +1 -1
  60. package/dist/modules/insert/commands.d.ts +2 -2
  61. package/dist/modules/insert/commands.d.ts.map +1 -1
  62. package/dist/modules/ruler/HorizontalRuler.d.ts +27 -0
  63. package/dist/modules/ruler/HorizontalRuler.d.ts.map +1 -0
  64. package/dist/modules/ruler/IndentArrowIcon.d.ts +14 -0
  65. package/dist/modules/ruler/IndentArrowIcon.d.ts.map +1 -0
  66. package/dist/modules/ruler/VerticalRuler.d.ts +20 -0
  67. package/dist/modules/ruler/VerticalRuler.d.ts.map +1 -0
  68. package/dist/modules/ruler/index.d.ts +5 -0
  69. package/dist/modules/ruler/index.d.ts.map +1 -0
  70. package/dist/modules/ruler/rulerTypes.d.ts +26 -0
  71. package/dist/modules/ruler/rulerTypes.d.ts.map +1 -0
  72. package/dist/modules/ruler/useRulerPointerDrag.d.ts +17 -0
  73. package/dist/modules/ruler/useRulerPointerDrag.d.ts.map +1 -0
  74. package/dist/modules/view/DocumentPreviewDialog.d.ts +1 -0
  75. package/dist/modules/view/DocumentPreviewDialog.d.ts.map +1 -1
  76. package/dist/modules/view/catalog.d.ts.map +1 -1
  77. package/dist/modules/view/commands.d.ts +2 -2
  78. package/dist/modules/view/commands.d.ts.map +1 -1
  79. package/dist/toolbar/defaultLayout.d.ts.map +1 -1
  80. package/dist/types.d.ts +8 -0
  81. package/dist/types.d.ts.map +1 -1
  82. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("react"),Vs=require("react-dom");function Xg({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 Si({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 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":"align-justify",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M4 18h16"})]})}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":"align-left",children:[o.jsx("path",{d:"M4 6h16"}),o.jsx("path",{d:"M4 12h10"}),o.jsx("path",{d:"M4 18h16"})]})}function Ai({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 Jg({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 Qg({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 Kd({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 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":"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 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":"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 Be({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 xu({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 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":"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 rp({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 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":"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 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":"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 ap({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 sp({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 $d({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 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":"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 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-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 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":"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 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":"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 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":"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 Ud({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 fp({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 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":"html",children:[o.jsx("path",{d:"M8 8l-4 4 4 4"}),o.jsx("path",{d:"M16 8l4 4-4 4"})]})}function Wd({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 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":"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 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":"italic",children:[o.jsx("path",{d:"M10 4h9"}),o.jsx("path",{d:"M5 20h9"}),o.jsx("path",{d:"M14 4L8 20"})]})}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":"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 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":"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 xp({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 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":"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 Gd({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 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":"open",children:[o.jsx("path",{d:"M3 7h6l2 2h10v3"}),o.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}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":"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 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":"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 ni({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 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":"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 Ap({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 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":"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 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":"plus",children:[o.jsx("path",{d:"M12 5v14"}),o.jsx("path",{d:"M5 12h14"})]})}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":"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 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":"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 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":"redo",children:[o.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),o.jsx("path",{d:"M17 6l4 4-4 4"})]})}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":"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 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":"save",children:[o.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),o.jsx("path",{d:"M15 3v6H9V3"}),o.jsx("path",{d:"M8 21v-7h8v7"})]})}function Xa({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 Cu({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 Ja({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 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":"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 _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":"underline",children:[o.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),o.jsx("path",{d:"M5 20h14"})]})}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":"undo",children:[o.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),o.jsx("path",{d:"M7 6L3 10l4 4"})]})}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":"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 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":"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 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":"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 me="---";function Xt(e){return e===me}function Jt(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Zs=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","pageBreak","insertPageBefore","insertPageAfter","deletePage","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"]),Hp=new Set(["file","edit","insert","table","view","format"]),Vd="custom",Zd="custom";function qd(e){return`custom:${e}`}function zp(e){return e==="menu"||e==="both"}function Op(e){return e==="toolbar"||e==="both"}function Yd(e){return e.map(t=>Jt(t)?{submenu:t.submenu,items:Yd(t.items)}:t)}function Kp(e){return{menus:e.menus.map(t=>({id:t.id,items:Yd(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function Xd(e){return Xt(e)?!0:Jt(e)?e.items.every(Xd):Zs.has(e)}function Jd(e,t){for(const n of e)if(n===t||Jt(n)&&Jd(n.items,t))return!0;return!1}function $p(e){const t=e.tooltip??e.label;return{id:e.id,command:qd(e.id),icon:e.icon??op,label:e.label,ariaLabel:e.label,tooltip:t}}function Up(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Hp.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===Vd&&!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 Wp(e,t,n){if(e.groups[n]||(n===Zd?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 Gp(e,t,n){var a,s;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},i=Kp(n);for(const u of e??[])if(!(Zs.has(u.id)||Xt(u.id))){if(r.items[u.id]=$p(u),zp(u.showIn)){const f=((a=u.menu)==null?void 0:a.id)??Vd;Up(r,i,f,(s=u.menu)==null?void 0:s.label);const g=i.menus.find(p=>p.id===f);if(g&&!Jd(g.items,u.id)){const p=g.items[g.items.length-1];p!==void 0&&!Xt(p)&&g.items.every(Xd)&&g.items.push(me),g.items.push(u.id)}}if(Op(u.showIn)){const f=u.toolbarGroup??Zd;Wp(r,i,f);const g=i.iconGroups.find(p=>p.id===f);g&&!g.items.includes(u.id)&&g.items.push(u.id)}}return{catalog:r,layout:i}}function Vp(e,t){const n={};for(const r of e??[])Zs.has(r.id)||Xt(r.id)||(n[qd(r.id)]=()=>r.onAction(t()));return n}function Zp(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const qp="_chrome_boy0f_1",Yp={chrome:qp},Qd=c.createContext(!1);function Xp({dark:e,children:t}){return o.jsx(Qd.Provider,{value:e,children:t})}function Jp(){return c.useContext(Qd)}function hs(e){return{className:Yp.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function ue({children:e}){const t=Jp(),n=hs(t);return Vs.createPortal(o.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function qs(e,t){const n=e[t];n==null||n()}const Ys={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",menuInsertPage:"Page",menuInsertPageAria:"Insert page submenu",commandInsertPageBefore:"Page before",commandInsertPageBeforeAria:"Insert page before selected page",commandInsertPageAfter:"Page after",commandInsertPageAfterAria:"Insert page after selected 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",commandDeletePage:"Delete page",commandDeletePageAria:"Delete selected page",deletePageDialogTitle:"Delete page",deletePageConfirmMessage:"Are you sure you want to delete the selected page?",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"},Qp={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",menuInsertPage:"Página",menuInsertPageAria:"Submenú insertar página",commandInsertPageBefore:"Página antes",commandInsertPageBeforeAria:"Insertar página antes de la seleccionada",commandInsertPageAfter:"Página después",commandInsertPageAfterAria:"Insertar página después de la seleccionada",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",commandDeletePage:"Eliminar página",commandDeletePageAria:"Eliminar la página seleccionada",deletePageDialogTitle:"Eliminar página",deletePageConfirmMessage:"¿Seguro que quieres eliminar la página seleccionada?",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"},eh={en:Ys,es:Qp},em=c.createContext(e=>Ys[e]);function th({locale:e="en",children:t}){const n=c.useMemo(()=>{const r=eh[e]??Ys;return i=>r[i]},[e]);return o.jsx(em.Provider,{value:n,children:t})}function W(){return c.useContext(em)}const nh="_menu_c1m45_1",rh="_item_c1m45_19",oh="_separator_c1m45_59",Qa={menu:nh,item:rh,separator:oh},Lo=8,ih=[{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:"openPageProperties",labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"deletePage",labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:(e,t)=>t.canDeletePage},{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 ah(e,t){const n=[];let r=!1;for(const i of ih){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 wu(){return'[role="menuitem"]:not(:disabled)'}function sh({open:e,x:t,y:n,kind:r,inTable:i=!1,canMergeCells:a=!1,canUnmergeCells:s=!1,canDeletePage:u=!1,commands:f,onClose:g}){const p=W(),h=c.useId(),x=c.useRef(null);if(c.useLayoutEffect(()=>{var R;if(!e)return;const b=x.current;if(!b)return;const v=b.getBoundingClientRect(),k=Math.max(Lo,Math.min(t,window.innerWidth-v.width-Lo)),A=Math.max(Lo,Math.min(n,window.innerHeight-v.height-Lo));b.style.left=`${k}px`,b.style.top=`${A}px`,(R=b.querySelector(wu()))==null||R.focus()},[e,t,n,r]),c.useEffect(()=>{if(!e)return;const b=R=>{var N;(N=x.current)!=null&&N.contains(R.target)||g()},v=R=>{R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),g())},k=()=>{g()},A=R=>{var N;if((N=x.current)!=null&&N.contains(R.target)){R.preventDefault();return}R.defaultPrevented||g()};return document.addEventListener("pointerdown",b),document.addEventListener("keydown",v,!0),window.addEventListener("scroll",k,!0),document.addEventListener("contextmenu",A),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",v,!0),window.removeEventListener("scroll",k,!0),document.removeEventListener("contextmenu",A)}},[e,g]),!e)return null;const y=ah(r,{inTable:i,canMergeCells:a,canUnmergeCells:s,canDeletePage:u}),C=b=>{var N;if(b.key!=="ArrowDown"&&b.key!=="ArrowUp")return;const v=[...((N=x.current)==null?void 0:N.querySelectorAll(wu()))??[]];if(v.length===0)return;const k=v.indexOf(document.activeElement),A=b.key==="ArrowDown"?1:-1,R=v[(k+A+v.length)%v.length];b.preventDefault(),R==null||R.focus()};return o.jsx(ue,{children:o.jsxs("div",{ref:x,className:Qa.menu,role:"menu","aria-labelledby":h,style:{left:t,top:n},onMouseDown:b=>b.preventDefault(),onKeyDown:C,children:[o.jsx("span",{id:h,hidden:!0,children:p("contextMenuAria")}),y.map((b,v)=>b.type==="separator"?o.jsx("div",{role:"separator",className:Qa.separator},`separator-${v}`):o.jsx("button",{type:"button",role:"menuitem",className:Qa.item,"aria-label":p(b.ariaKey),onClick:()=>{g(),qs(f,b.command)},children:p(b.labelKey)},b.command))]})})}function lh(e){return e==="touch"||e==="pen"}function ch(e,t){return e.button===2||e.ctrlKey?!0:!lh(t)}const Xs=["pt","px","em","rem","%"],hn="pt",uh={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]},dh={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},mh=new Set(Xs),fh=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function Pi(e){return mh.has(e)}function _e(e){return Math.round(e*100)/100}function J(e){const t=_e(e);return Number.isInteger(t),String(t)}function Js(e,t){return`${J(e)}${t}`}function Qs(e){const t=e.trim();if(!t)return null;const n=t.match(fh);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 gh(e,t){const n=e.trim();if(!n)return null;const r=Qs(n);if(r)return Pi(r.unit)?bn(r.value,r.unit):null;const i=Number(n.replace(",","."));return Number.isFinite(i)?bn(i,t):null}function bn(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=dh[t];return{value:_e(Math.min(r,Math.max(n,e))),unit:t}}function tm(e,t,n,r){const i=n>0?n:16,a=r>0?r:16;switch(t){case"px":return _e(e);case"pt":return _e(e*.75);case"em":return _e(e/i);case"rem":return _e(e/a);case"%":return _e(e/i*100)}}function ph(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 nm(e,t,n,r,i){if(t===n)return _e(e);const a=ph(e,t,r,i);return tm(a,n,r,i)}const el="pt",hh=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,bh=/^[+-]?0(?:\.0+)?$/;function Ce(e){return`${J(e.value)}${e.unit}`}function Ie(e){const t=e.trim();if(!t)return null;if(bh.test(t))return{value:0,unit:"px"};const n=t.match(hh);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const i=n[2]==="%"?"%":n[2].toLowerCase();return Pi(i)?{value:_e(r),unit:i}:null}function Mr(e,t,n){const r=e.trim();if(!r)return null;const i=Ie(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:_e(a),unit:t}:null}function rn(e){return e.value>=0?e:{value:0,unit:e.unit}}function rt(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}const yh=new Set(["span","strong","b","em","i","u","s","strike","del"]);function ce(e,t){return t?e===t||e.contains(t):!1}function St(e){return yh.has(e.tagName.toLowerCase())}function xh(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 Ue(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&&xh(e,i)&&n.push(i);return n}function vt(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType===Node.TEXT_NODE){const a=t;if(n>0&&n<a.length){const s=a.splitText(n);e.setStart(s,0),e.endContainer===a&&e.setEnd(s,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 on(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function Xe(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function an(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),s=n.slice(r+1);if(a.length>0){const u=e.cloneNode(!1);for(const f of a)u.appendChild(f);i.insertBefore(u,e)}if(s.length>0){const u=e.cloneNode(!1);for(const f of s)u.appendChild(f);i.insertBefore(u,e.nextSibling)}}function xn(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}function Io(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function Ch(e,t){return t?e===t||e.contains(t):!1}function vu(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 Su(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return vu(e,t)+n;let r=0;const i=t.childNodes;for(let s=0;s<n&&s<i.length;s+=1)r+=((a=i[s].textContent)==null?void 0:a.length)??0;return vu(e,t)+r}function ku(e,t){var s,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 f=((s=i.textContent)==null?void 0:s.length)??0;if(r<=f)return{node:i,offset:r};r-=f}return a?{node:a,offset:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function tl(e,t,n){const r=document.createRange(),i=ku(e,t),a=ku(e,n);return r.setStart(i.node,i.offset),r.setEnd(a.node,a.offset),r}function rm(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Au(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function wh(e,t){return t.mode!=="visual"?null:t.visualRange&&rm(t.visualRange,e)?t.visualRange:tl(e,t.start,t.end)}function xt(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(Ch(t,a.commonAncestorContainer)){const s=Su(t,a.startContainer,a.startOffset),u=Su(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(s,u),end:Math.max(s,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 Pu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vh(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),s=e.snapshot.start,u=e.snapshot.end,f=e.asHtml?e.content:Pu(e.content);e.setHtml(a.slice(0,s)+f+a.slice(u));const g=e.htmlEl;if(g){const p=s+f.length;g.focus(),g.setSelectionRange(p,p)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:Pu(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&rm(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??tl(t,e.snapshot.start,e.snapshot.end);if(r.deleteContents(),e.content)if(e.asHtml){const a=r.createContextualFragment(e.content),s=a.lastChild;r.insertNode(a),s&&(r.setStartAfter(s),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 nl=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),om=new Set(["table","thead","tbody","tr","td","th"]),rl=new Set([...om,"ul","ol","li","pre","hr"]);function he(e){return e.tagName.toLowerCase()}function Hr(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function ol(e){return e instanceof HTMLElement&&(he(e)==="ul"||he(e)==="ol")}function ot(e){return e instanceof HTMLElement&&he(e)==="li"}function kt(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ce(e,n.commonAncestorContainer)?n:null}function il(e){const t=e.collapsed?[]:Ue(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function Un(e,t,n){var f,g,p;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let x=0,y;for(;y=h.nextNode();){if(y===t)return x+n;x+=((f=y.textContent)==null?void 0:f.length)??0}return x}let r=0;const i=t.childNodes;for(let h=0;h<n&&h<i.length;h+=1)r+=((g=i[h].textContent)==null?void 0:g.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s=0,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return s+r;s+=((p=u.textContent)==null?void 0:p.length)??0}return s+r}function al(e,t,n){const r=tl(e,t,n),i=window.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(r)}function Jn(e,t){const n=kt(e);if(!n)return!1;const r=Un(e,n.startContainer,n.startOffset),i=Un(e,n.endContainer,n.endOffset),a=Math.min(r,i),s=Math.max(r,i),u=t();return al(e,a,s),u}function sl(e,t){if(he(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 mt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function Sh(e,t){let n=Hr(t);for(;n&&n!==e;){if(Rm(n,e)||st(n)){n=n.parentElement;continue}const r=he(n);if(nl.has(r)&&n instanceof HTMLElement)return n;if(om.has(r)||r==="pre")return null;n=n.parentElement}return null}function Qn(e){const t=kt(e);if(!t)return[];const n=new Set,r=[];for(const i of il(t)){const a=Sh(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function bs(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=he(e);return nl.has(t)||rl.has(t)?!1:St(e)||t==="br"||t==="a"||t==="img"||t==="span"}function kh(e,t){let n=Hr(t);for(;n&&n!==e;){if(rl.has(he(n)))return!0;n=n.parentElement}return!1}function Ah(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Ph(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&bs(n[i-1]);)i-=1;for(;a<n.length-1&&bs(n[a+1]);)a+=1;return n.slice(i,a+1)}function ys(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&st(t)))return t;return null}function Dh(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&&st(r)?ys(e):r}return n.startContainer===t&&e!==t?ys(e):Ah(e,n.startContainer)}function Eh(e,t){const n=hl(e);if(kh(e,t.startContainer))return null;if(!ys(n)){const s=document.createElement("p");return s.appendChild(document.createElement("br")),n.appendChild(s),s}const r=Dh(n,e,t);if(!r||r instanceof HTMLElement&&st(r)||r instanceof Element&&rl.has(he(r))||r instanceof HTMLElement&&nl.has(he(r))||!bs(r))return null;const i=Ph(n,r),a=document.createElement("p");n.insertBefore(a,i[0]);for(const s of i)a.appendChild(s);return a}function zr(e){const t=Qn(e);if(t.length>0)return t;const n=kt(e);if(!n)return[];const r=Eh(e,n);return r?[r]:[]}function Wn(e){const t=e.parentElement;return t&&ol(t)?t:null}function im(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&&jh(r,i)?t[t.length-1].push(i):t.push([i])}return t}function jh(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 Rh(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function es(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(s=>Number.isFinite(s))?{r:n,g:r,b:i,a}:null}function ts(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 ns(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 Th={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 Nh(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function we(e){const t=e.trim();if(!t||Nh(t))return null;const n=ns(t);if(n)return n;const r=es(t);if(r)return r.a===0?null:ts(r.r,r.g,r.b);const i=Th[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 s=String(a.fillStyle);if(s==="#010203"){const f=ns(t);if(f==="#010203")return f;const g=es(t);return g&&ts(g.r,g.g,g.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(s.startsWith("#"))return ns(s);const u=es(s);return!u||u.a===0?null:ts(u.r,u.g,u.b)}function am(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?we(n):null}function ri(e,t,n){let r=Rh(t);for(;r&&r!==e&&r instanceof HTMLElement;){const i=am(r,n);if(i)return i;r=r.parentElement}return null}function oi(e,t){return e instanceof HTMLElement?am(e,t)!==null:!1}function ll(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function sm(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function Mh(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!St(i)||!oi(i,n)){r=i;continue}if(an(i,r),oi(i,n)&&(ll(i,n),on(i))){Xe(i);continue}r=i}}function lm(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ce(e,n.commonAncestorContainer)?n:null}function ii(e,t){const n=lm(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:Ue(n).filter(f=>f.data.length>0),a=(r.length>0?r:[n.startContainer]).map(f=>ri(e,f,t)),s=a[0]??null;return a.every(f=>f===s)?{value:s,mixed:!1}:{value:null,mixed:!0}}function Er(e,t,n){const r=lm(e);if(!r||r.collapsed)return!1;const i=n===null?null:we(n);if(n!==null&&i===null)return!1;vt(r);const a=Ue(r).filter(s=>s.data.length>0);for(const s of a){const u=ri(e,s,t);if(i===null){if(u===null)continue;Mh(e,s,t);continue}u!==i&&Br(s,f=>{sm(f,t,i)})}return xn(a),!0}function Du(e,t,n){if(n.value===null){ll(e,t);return}const r=we(n.value);r&&sm(e,t,r)}function _h(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function Lh(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 Ih(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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function cm(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!St(i)||!n.some(a=>oi(i,a))){r=i;continue}an(i,r);for(const a of n)oi(i,a)&&ll(i,a);if(on(i)){Xe(i);continue}r=i.isConnected?i:t}return t}function Fh(e,t,n){Lh(t);const r=Ih(t);return cm(e,r,n)}function Bh(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&ri(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&ri(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const um=["auto","avoid"],xs=["auto","avoid","page"];new Set(um);new Set(xs);function dm(e){return e.trim().toLowerCase()}function Eu(e){return dm(e)==="avoid"?"avoid":"auto"}function ai(e){const t=dm(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function mm(e){const t=e.style.breakInside;if(t)return Eu(t);const n=e.style.pageBreakInside;return n?Eu(n):"auto"}function fm(e){const t=e.style.breakAfter;if(t)return ai(t);const n=e.style.pageBreakAfter;return n?ai(n):"auto"}function gm(e){const t=e.style.breakBefore;if(t)return ai(t);const n=e.style.pageBreakBefore;return n?ai(n):"auto"}function Hh(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function zh(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function Oh(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function Kh(e){return{breakInside:mm(e),breakAfter:fm(e),breakBefore:gm(e)}}function $h(e,t){return mm(e)===t?!1:t==="auto"?(Hh(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function Uh(e,t){return fm(e)===t?!1:t==="auto"?(zh(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function Wh(e,t){return gm(e)===t?!1:t==="auto"?(Oh(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function Gh(e,t){return e===t}function ju(e,t){return e===t}const Fe=["top","right","bottom","left"],Di=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],ft={top:null,right:null,bottom:null,left:null},cl={style:"none",width:null,color:null},Vh=new Set(Di),Ru={value:0,unit:"px"};function Zh(){return{margin:{...ft},padding:{...ft},lineHeight:null,border:{...cl},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function ul(){const e=Zh();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 It(e,t){return Fe.every(n=>rt(e[n],t[n]))}function pm(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 hm(e,t){return e.style===t.style&&rt(e.width,t.width)&&e.color===t.color}function bm(e,t){return e===t?!0:!e||!t?!1:rt(e.offsetX,t.offsetX)&&rt(e.offsetY,t.offsetY)&&rt(e.blur,t.blur)&&rt(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function qh(e){return e.kind==="normal"?"normal":e.kind==="number"?J(e.value):Ce({value:e.value,unit:e.unit})}function Yh(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)?Qt(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?Qt(n):null}function Qt(e){return _e(Math.min(1,Math.max(0,e)))}function si(e){return _e(Qt(e)*100)}function ym(e){return Qt(e/100)}function xm(e){return J(Qt(e))}function Xh(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:_e(r)}}const n=Ie(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function Jh(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 Qh(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 eb(e){const t=[Ce(e.offsetX),Ce(e.offsetY),Ce(e.blur),Ce(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function tb(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=Jh(t,",")[0];if(!n)return null;const r=Qh(n);let i=!1,a=null;const s=[];for(const u of r){if(u.toLowerCase()==="inset"){i=!0;continue}const f=Ie(u);if(f){s.push(f);continue}const g=we(u);if(g){a=g;continue}return null}return s.length<2||s.length>4?null:{offsetX:s[0],offsetY:s[1],blur:s[2]??Ru,spread:s[3]??Ru,color:a,inset:i}}function Ln(e,t){return Ie(e.style.getPropertyValue(t))}function nb(e,t,n,r){const i=n&&r?rn(n):n,a=i?Ce(i):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function Tu(e,t){return{top:Ln(e,`${t}-top`),right:Ln(e,`${t}-right`),bottom:Ln(e,`${t}-bottom`),left:Ln(e,`${t}-left`)}}function Nu(e,t,n,r){let i=!1;for(const a of Fe)nb(e,`${t}-${a}`,n[a],r)&&(i=!0);return i}function rb(e){const t=e.trim().toLowerCase();return Vh.has(t)?t:"none"}function Cm(e){const t=rb(e.style.borderStyle||e.style.borderTopStyle),n=Ln(e,"border-width")??Ln(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,i=r?we(r):null;return{style:t,width:n,color:i}}function ob(e,t){const n=Cm(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?rn(t.width):null,color:t.color};return hm(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=Ce(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function wm(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return Ie(n)}function ib(e,t){const n=t?rn(t):null,r=wm(e);return rt(r,n)?!1:(n?e.style.borderRadius=Ce(n):e.style.removeProperty("border-radius"),!0)}function vm(e){return tb(e.style.boxShadow)}function ab(e,t){const n=vm(e),r=t?{...t,blur:rn(t.blur)}:null;return bm(n,r)?!1:(r?e.style.boxShadow=eb(r):e.style.removeProperty("box-shadow"),!0)}function Sm(e){return Xh(e.style.lineHeight)}function sb(e,t){const n=Sm(e);return pm(n,t)?!1:(t?e.style.lineHeight=qh(t):e.style.removeProperty("line-height"),!0)}function km(e){const t=e.style.backgroundColor;return t?we(t):null}function lb(e,t){const n=t?we(t):null;return km(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Am(e){return Yh(e.style.opacity)}function cb(e,t){const n=Am(e),r=t===null?null:Qt(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=xm(r),!0)}function er(e){const t=Kh(e);return{margin:Tu(e,"margin"),padding:Tu(e,"padding"),lineHeight:Sm(e),border:Cm(e),borderRadius:wm(e),boxShadow:vm(e),backgroundColor:km(e),opacity:Am(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function tr(e,t){let n=!1;return!t.marginMixed&&Nu(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&Nu(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&sb(e,t.lineHeight)&&(n=!0),!t.borderMixed&&ob(e,t.border)&&(n=!0),!t.radiusMixed&&ib(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&ab(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&lb(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&cb(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&$h(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&Uh(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&Wh(e,t.breakBefore)&&(n=!0),n&&mt(e),n}function ub(e){const t=ul(),n=Qn(e);if(n.length===0)return t;const r=n.map(er),i=r[0];return{margin:i.margin,marginMixed:r.some(a=>!It(a.margin,i.margin)),padding:i.padding,paddingMixed:r.some(a=>!It(a.padding,i.padding)),lineHeight:i.lineHeight,lineHeightMixed:r.some(a=>!pm(a.lineHeight,i.lineHeight)),border:i.border,borderMixed:r.some(a=>!hm(a.border,i.border)),borderRadius:i.borderRadius,radiusMixed:r.some(a=>!rt(a.borderRadius,i.borderRadius)),boxShadow:i.boxShadow,shadowMixed:r.some(a=>!bm(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=>!Gh(a.breakInside,i.breakInside)),breakAfter:i.breakAfter,breakAfterMixed:r.some(a=>!ju(a.breakAfter,i.breakAfter)),breakBefore:i.breakBefore,breakBeforeMixed:r.some(a=>!ju(a.breakBefore,i.breakBefore))}}function db(e,t){return Jn(e,()=>{const n=zr(e);if(n.length===0)return!1;let r=!1;for(const i of n)tr(i,t)&&(r=!0);return r})}const li="data-page-at-rule";function Zt(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...ft},marginMixed:!1}}function dl(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Pm(e){return e.body.innerHTML}function _r(e){var r;const n=dl(e).querySelector(`style[${li}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function Fo(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?Ie(r[1].trim()):null}function mb(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...ft};const n=t[1].trim().split(/\s+/).map(u=>Ie(u)),[r,i=r,a=r,s=i]=n;return{top:r??null,right:i??null,bottom:a??null,left:s??null}}function fb(e){const t={sizePreset:"auto",customWidth:null,customHeight:null,orientation:null},n=e.match(/(?:^|[\s{;])size\s*:\s*([^;]+)/i);if(!n)return t;const r=n[1].trim().toLowerCase();if(r==="auto")return t;const i=r.includes("landscape"),a=r.includes("portrait"),s=i?"landscape":a?"portrait":null,u=r.replace(/\b(landscape|portrait)\b/g,"").trim(),f=u.split(/\s+/).filter(Boolean);if(f.length===1){if(f[0]==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:s};if(f[0]==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:s};if(f[0]==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:s}}if(f.length>=2){const g=Ie(f[0]),p=Ie(f[1]);if(g&&p)return{sizePreset:"custom",customWidth:g,customHeight:p,orientation:s}}return!u&&s?{sizePreset:"auto",customWidth:null,customHeight:null,orientation:s}:t}function gb(e){const t=Zt();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],i=fb(r),a={top:Fo(r,"top"),right:Fo(r,"right"),bottom:Fo(r,"bottom"),left:Fo(r,"left")},u=Fe.some(f=>a[f]!==null)?a:mb(r);return{...i,margin:u,marginMixed:!1}}function qt(e){return gb(_r(e))}function Ct(e,t){return _r(e)||!_r(t)?e:Dm(e,qt(t))}function pb(e){const t=Fe.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?Ce(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:Fe.map(r=>e[r]?`margin-${r}: ${Ce(e[r])};`:null).filter(Boolean).join(" ")}function hb(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(Ce(e.customWidth),Ce(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function bb(e){const t=hb(e),n=pb(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function Gn(e){const t=dl(e);for(const n of t.querySelectorAll(`style[${li}]`))n.remove();return Pm(t)}function yb(e,t){const n=dl(e);let r=n.querySelector(`style[${li}]`);return r||(r=n.createElement("style"),r.setAttribute(li,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,Pm(n)}function Dm(e,t){const n=bb(t);return n?yb(e,n):Em(e)}function Em(e){return Gn(e)}function xb(e){const t=e.map(n=>_r(n)).filter(n=>!!n);return t.length===0?"":t.join(`
2
- `)}const ml="data-page-sized",Cb={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function fl(e){let t=null;if(e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal")t={...Cb[e.sizePreset]};else if(e.sizePreset==="custom"&&e.customWidth&&e.customHeight)t={width:Ce(e.customWidth),height:Ce(e.customHeight)};else return e.orientation,null;return e.orientation==="landscape"?{width:t.height,height:t.width}:t}function wb(e){return fl(e)!==null}function vb(e){const t=fl(e);if(!t)return null;const n=document.createElement("div");n.style.position="fixed",n.style.left="-10000px",n.style.top="0",n.style.visibility="hidden",n.style.boxSizing="border-box",n.style.width=t.width,n.style.minHeight=t.height;const r=jm(e);for(const a of Fe){const s=r[a];s&&n.style.setProperty(`padding-${a}`,s)}document.body.appendChild(n);const i={width:n.offsetWidth,height:n.offsetHeight};return n.remove(),i}function jm(e){return Sb(e.margin)}function Sb(e){return{top:e.top?Ce(e.top):null,right:e.right?Ce(e.right):null,bottom:e.bottom?Ce(e.bottom):null,left:e.left?Ce(e.left):null}}const kb=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function Ab(e){e.removeAttribute(ml);for(const t of kb)e.style.removeProperty(t)}function Or(e,t){const n=qt(t),r=fl(n);if(!r){Ab(e);return}e.setAttribute(ml,""),e.style.width=r.width,e.style.minHeight=r.height;const i=jm(n);for(const a of Fe){const s=`padding-${a}`,u=i[a];u?e.style.setProperty(s,u):e.style.removeProperty(s)}}const Lr="data-page",ci="data-page-bg",ui="commspliant-background";function st(e){return e instanceof HTMLElement&&(e.id===ui||e.hasAttribute(ci))}function Pb(e){return e.hasAttribute(Lr)&&e.parentElement?e.parentElement:e}function gl(e){const t=Pb(e),n=new Set,r=[],i=a=>{a instanceof HTMLElement&&st(a)&&!n.has(a)&&(n.add(a),r.push(a))};i(t.querySelector(`#${ui}`));for(const a of t.querySelectorAll(`[${ci}]`))i(a);return i(t),r}function pl(e){return gl(e)[0]??null}function jr(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 Db(e,t){if(!e.hasAttribute(ml))return jr(t);let n=!1;return t.style.width!=="100%"&&(t.style.width="100%",n=!0),t.style.height!=="auto"&&(t.style.height="auto",n=!0),t.style.minHeight!=="100%"&&(t.style.minHeight="100%",n=!0),n}function Eb(e){const t=e.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li");return t[t.length-1]??null}function Mu(e){const t=sn(e);if(!t)return!1;let n=!1;for(const r of[...e.childNodes])if(r!==t&&!(r instanceof HTMLElement&&st(r))){if(r.nodeType===Node.TEXT_NODE){if(!(r.textContent??"").trim()){r.remove(),n=!0;continue}let a=Eb(t);a||(a=document.createElement("p"),t.appendChild(a)),a.appendChild(r),n=!0;continue}t.appendChild(r),n=!0}return n}function Rm(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(Lr)}function Tm(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function jb(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function sn(e){return Tm(e).find(n=>n.hasAttribute(Lr))??null}function Rb(e){if(jb(e))return null;const t=Tm(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||st(n)?null:n}function Nm(e){const t=sn(e);if(t)return jr(t),t;const n=Rb(e);if(n)return n.setAttribute(Lr,""),jr(n),n;const r=document.createElement("div");for(r.setAttribute(Lr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),jr(r),r}function hl(e){return sn(e)??e}function Tb(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&st(t)))return t;return null}function Nb(e,t,n){const{startContainer:r}=n;return r===t||t.contains(r)?!1:r===e?!0:e.contains(r)}function Mb(e){var i,a;const t=document.createRange(),n=Tb(e);if(n instanceof HTMLElement){const s=n.firstChild;(s==null?void 0:s.nodeType)===Node.TEXT_NODE?t.setStart(s,((i=s.textContent)==null?void 0:i.length)??0):n.firstChild?t.setStartBefore(n.firstChild):t.setStart(n,0)}else if((n==null?void 0:n.nodeType)===Node.TEXT_NODE)t.setStart(n,((a=n.textContent)==null?void 0:a.length)??0);else{const s=document.createElement("p");s.appendChild(document.createElement("br")),e.appendChild(s),t.setStart(s,0)}t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}function Kn(e){const t=sn(e);if(!t)return;const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0);Nb(e,t,r)&&Mb(t)}const _u=["background-color","background-image","background-size","background-position","background-repeat","opacity"];function Lu(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 Ei(e){const t=sn(e),n=t?pl(t):null;if(Lu(e,t,"background-color"),n)for(const r of _u)r!=="background-color"&&Lu(e,n,r);else for(const r of _u)r!=="background-color"&&e.style.removeProperty(r)}const di="<!-- wysiwyg-page-separator -->",Vn="data-page-surface";function Me(e){const t=e.trim();return t?t.includes(di)?e.split(di).map(n=>n.trim()):[e]:[""]}function nt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
3
- ${di}
4
- `)}function Jo(){return"<p></p>"}function Iu(e){return e.length===0?[Jo()]:e.map(t=>t.trim())}function In(e,t){const n=e.querySelector(`[${Vn}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${Vn}]`)][t]??null)}function _b(e){const t=e.getAttribute("data-page-index");if(t!==null){const r=Number.parseInt(t,10);if(!Number.isNaN(r))return r}let n=e.parentElement;for(;n;){const i=[...n.querySelectorAll(`[${Vn}]`)].indexOf(e);if(i!==-1)return i;n=n.parentElement}return null}function bl(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 Lb(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function Bo(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 Ib(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 s=a.getAsFile();s&&t.push(s)}return t}function Fb(e){return e?Ib(e).find(Lb)??null:null}const Mm={description:"HTML",accept:{"text/html":[".html",".htm"]}},Bb="document.html";function _m(){return window}function Lm(e){return e instanceof DOMException&&e.name==="AbortError"}function Hb(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 zb(){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}bl(r).then(a=>n(a),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function Ob(e,t=Bb){const n=_m().showSaveFilePicker;if(typeof n=="function"){try{const i=await(await n({suggestedName:t,types:[Mm]})).createWritable();await i.write(e),await i.close()}catch(r){if(Lm(r))return;throw r}return}Hb(e,t)}async function Kb(){const e=_m().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[Mm]}),n=await t.getFile();return await bl(n)}catch(t){if(Lm(t))return null;throw t}return zb()}const ji="data-wysiwyg-font",$b=[{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 Ir(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function Kr(e,t){return e===t?!0:!e||!t?!1:Ir(e)===Ir(t)}function Im(e=[]){var r;const t=[],n=new Set;for(const i of[...$b,...e]){const a=i.family.trim();if(!a)continue;const s=Ir(a);if(n.has(s))continue;n.add(s);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 Ub(e,t){return e?t.find(n=>Kr(n.family,e))??null:null}function Wb(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Gb(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Ri(e){const t=new Set,n=[];for(const r of e){const i=r.trim();!i||!Wb(i)||t.has(i)||(t.add(i),n.push(i))}return n}function Vb(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const Zb=new RegExp(`<link\\b[^>]*\\b${ji}\\b[^>]*>`,"gi");function Se(e){if(!e.includes(ji))return{hrefs:[],body:e};const t=[],n=e.replace(Zb,r=>{var a,s;const i=((a=r.match(/\bhref\s*=\s*"([^"]*)"/i))==null?void 0:a[1])??((s=r.match(/\bhref\s*=\s*'([^']*)'/i))==null?void 0:s[1]);return i&&t.push(Vb(i)),""});return{hrefs:Ri(t),body:n}}function Ho(e,t){const n=Ri(t);return n.length===0?e:`${n.map(i=>`<link rel="stylesheet" href="${Gb(i)}" ${ji}="">`).join("")}${e}`}function qb(e,t){const n=Ir(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 s=a.style.fontFamily;if(s&&Ir(s)===n)return!0}a=i.nextNode()}return!1}function zo(e,t,n=[]){const r=Se(t).hrefs,i=n.filter(a=>a.css&&qb(e,a.family)).map(a=>a.css??"");return Ri([...r,...i])}function Yb(e,t=[]){const n=Se(e).hrefs,r=t.map(i=>i.css??"");return Ri([...n,...r])}function Xb(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Fm(e){return e.style.fontFamily.trim()||null}function yl(e,t){let n=Xb(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Fm(n);if(r)return r;n=n.parentElement}return null}function Cs(e){return e instanceof HTMLElement&&Fm(e)!==null}function xl(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Jb(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!St(r)||!Cs(r)){n=r;continue}if(an(r,n),Cs(r)&&(xl(r),on(r))){Xe(r);continue}n=r}}function Bm(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ce(e,n.commonAncestorContainer)?n:null}function Hm(e){const t=Bm(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:Ue(t).filter(u=>u.data.length>0),i=(n.length>0?n:[t.startContainer]).map(u=>yl(e,u)),a=i[0]??null;return i.every(u=>Kr(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function ws(e,t){const n=Bm(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;vt(n);const i=Ue(n).filter(a=>a.data.length>0);for(const a of i){const s=yl(e,a);if(r===null){if(s===null)continue;Jb(e,a);continue}Kr(s,r)||Br(a,u=>{u.style.fontFamily=r})}return xn(i),!0}function Qb(e,t){if(t){if(t.value===null){xl(e);return}e.style.fontFamily=t.value}}function ey(e){return e!=null}function ty(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 ny(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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(i=e.startContainer.parentNode)==null||i.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function vs(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!St(r)||!Cs(r)){n=r;continue}if(an(r,n),xl(r),on(r)){Xe(r);continue}n=r.isConnected?r:t}return t}function ry(e,t){ty(t);const n=ny(t);return vs(e,n)}function oy(e,t,n){return!!(n&&n.value===null&&yl(e,t))}const iy=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("react"),hl=require("react-dom");function Yp({className:e}){return i.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:[i.jsx("path",{d:"M9 18V5l12-2v13"}),i.jsx("circle",{cx:"6",cy:"18",r:"3"}),i.jsx("circle",{cx:"18",cy:"16",r:"3"})]})}function $i({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M7 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function xm({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h16"}),i.jsx("path",{d:"M4 18h16"})]})}function Ki({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function Ui({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M10 12h10"}),i.jsx("path",{d:"M4 18h16"})]})}function Xp({className:e}){return i.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:[i.jsx("path",{d:"M7 5h6.5a3.5 3.5 0 0 1 0 7H7z"}),i.jsx("path",{d:"M7 12h7.5a3.5 3.5 0 0 1 0 7H7z"}),i.jsx("path",{d:"M7 5v14"})]})}function Jp({className:e}){return i.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:i.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v16l-7-4-7 4V5a1 1 0 0 1 1-1z"})})}function wm({className:e}){return i.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:[i.jsx("path",{d:"M9 6h12"}),i.jsx("path",{d:"M9 12h12"}),i.jsx("path",{d:"M9 18h12"}),i.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"})]})}function Qp({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("rect",{x:"12.5",y:"4.5",width:"8",height:"7",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function eh({className:e}){return i.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:[i.jsx("path",{d:"M4 5h12"}),i.jsx("path",{d:"M10 5v8"}),i.jsx("path",{d:"m14 15 6 6"}),i.jsx("path",{d:"m20 15-6 6"})]})}function Be({className:e}){return i.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:[i.jsx("path",{d:"M18 6L6 18"}),i.jsx("path",{d:"M6 6l12 12"})]})}function Gu({className:e}){return i.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:i.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 th({className:e}){return i.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:[i.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"}),i.jsx("path",{d:"M8 9h8M8 13h5"})]})}function nh({className:e}){return i.jsx("svg",{className:e,viewBox:"0 0 616.23 542.09",width:"45",height:"40","aria-hidden":"true","data-icon":"commspliant-shield",children:i.jsxs("g",{transform:"translate(129.79555,688.75474)",children:[i.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"}),i.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"}),i.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"}),i.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"}),i.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 rh({className:e}){return i.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:[i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),i.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"}),i.jsx("path",{d:"M10.5 14v.5"}),i.jsx("path",{d:"M15 10v4"}),i.jsx("path",{d:"M13 12h4"})]})}function oh({className:e}){return i.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:[i.jsx("path",{d:"M8 6h12"}),i.jsx("path",{d:"M8 12h12"}),i.jsx("path",{d:"M8 18h8"}),i.jsx("path",{d:"M4 6h.01"}),i.jsx("path",{d:"M4 12h.01"}),i.jsx("path",{d:"M4 18h.01"})]})}function ih({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"14",y:"4",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"3",y:"13",width:"7",height:"7",rx:"1"}),i.jsx("rect",{x:"14",y:"13",width:"7",height:"7",rx:"1"})]})}function ah({className:e}){return i.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:i.jsx("path",{d:"M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z"})})}function Cm({className:e}){return i.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:[i.jsx("path",{d:"M6 18L12 4l6 14"}),i.jsx("path",{d:"M8.5 13h7"})]})}function sh({className:e}){return i.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:[i.jsx("path",{d:"M4 18L9 6l5 12"}),i.jsx("path",{d:"M6.2 13h5.6"}),i.jsx("path",{d:"M16 18V9"}),i.jsx("path",{d:"M16 9h5"})]})}function lh({className:e}){return i.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:[i.jsx("path",{d:"M4 20h4"}),i.jsx("path",{d:"M6 20V6"}),i.jsx("path",{d:"M4 6h4"}),i.jsx("path",{d:"M12 20V9"}),i.jsx("path",{d:"M12 9h8"}),i.jsx("path",{d:"M16 9v11"})]})}function ch({className:e}){return i.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:[i.jsx("path",{d:"M4 18V8h3"}),i.jsx("path",{d:"M4 8h8"}),i.jsx("path",{d:"M10 8v10"}),i.jsx("path",{d:"M16 18V12h2"}),i.jsx("path",{d:"M16 12h5"}),i.jsx("path",{d:"M19 12v6"})]})}function uh({className:e}){return i.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:[i.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"}),i.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"}),i.jsx("path",{d:"M7.07 14.94 4.01 18"})]})}function dh({className:e}){return i.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:[i.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),i.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),i.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),i.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})}function vm({className:e}){return i.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:[i.jsx("path",{d:"M15.5 4.5l4 4-9 9H6.5v-4.5z"}),i.jsx("path",{d:"M13.5 6.5l4 4"}),i.jsx("path",{d:"M4 20h8"})]})}function mh({className:e}){return i.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:i.jsx("path",{d:"M4 12h16"})})}function fh({className:e}){return i.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:[i.jsx("path",{d:"M8 8l-4 4 4 4"}),i.jsx("path",{d:"M16 8l4 4-4 4"})]})}function km({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),i.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),i.jsx("path",{d:"m21 15-4.5-4.5L7 20"})]})}function gh({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M12 12h8"}),i.jsx("path",{d:"M4 18h16"}),i.jsx("path",{d:"M4 9l4 3-4 3"})]})}function ph({className:e}){return i.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:[i.jsx("path",{d:"M10 4h9"}),i.jsx("path",{d:"M5 20h9"}),i.jsx("path",{d:"M14 4L8 20"})]})}function hh({className:e}){return i.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:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("path",{d:"M12 2v2"}),i.jsx("path",{d:"M12 20v2"}),i.jsx("path",{d:"M4.93 4.93l1.41 1.41"}),i.jsx("path",{d:"M17.66 17.66l1.41 1.41"}),i.jsx("path",{d:"M2 12h2"}),i.jsx("path",{d:"M20 12h2"}),i.jsx("path",{d:"M4.93 19.07l1.41-1.41"}),i.jsx("path",{d:"M17.66 6.34l1.41-1.41"})]})}function bh({className:e}){return i.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:[i.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"}),i.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 yh({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M4 12h16"}),i.jsx("path",{d:"M4 18h16"})]})}function xh({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 12h5"}),i.jsx("path",{d:"M16 12h5"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("path",{d:"M9 9l3 3-3 3"}),i.jsx("path",{d:"M15 9l-3 3 3 3"})]})}function Sm({className:e}){return i.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:[i.jsx("path",{d:"M10 6h11"}),i.jsx("path",{d:"M10 12h11"}),i.jsx("path",{d:"M10 18h11"}),i.jsx("path",{d:"M4 5v3h2"}),i.jsx("path",{d:"M4 11h2l-2 2h2"}),i.jsx("path",{d:"M4 19h2"}),i.jsx("path",{d:"M4 17h2v2"})]})}function wh({className:e}){return i.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:[i.jsx("path",{d:"M3 7h6l2 2h10v3"}),i.jsx("path",{d:"M3 10l2.2 9h13.6L21 10H3z"})]})}function Ch({className:e}){return i.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:[i.jsx("path",{d:"M4 6h16"}),i.jsx("path",{d:"M12 12h8"}),i.jsx("path",{d:"M4 18h16"}),i.jsx("path",{d:"M8 9l-4 3 4 3"})]})}function vh({className:e}){return i.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:[i.jsx("path",{d:"M4 10h16",strokeDasharray:"3 2"}),i.jsx("path",{d:"M14 10v8"}),i.jsx("path",{d:"M18 14h4v4h-4z"})]})}function zr({className:e}){return i.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:[i.jsx("path",{d:"M6 3h8l6 6v12H6z"}),i.jsx("path",{d:"M14 3v6h6"})]})}function Pm({className:e}){return i.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:[i.jsx("path",{d:"M13 4H9a4 4 0 0 0 0 8h2"}),i.jsx("path",{d:"M15 4v16"}),i.jsx("path",{d:"M11 4v16"})]})}function kh({className:e}){return i.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:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("path",{d:"M14 2v6h6"}),i.jsx("path",{d:"M8 13h8"}),i.jsx("path",{d:"M8 17h5"})]})}function Sh({className:e}){return i.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:[i.jsx("path",{d:"M5 6h14"}),i.jsx("path",{d:"M5 10h10"}),i.jsx("path",{d:"M5 14h14"}),i.jsx("path",{d:"M5 18h8"})]})}function Ph({className:e}){return i.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:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}function Ah({className:e}){return i.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:[i.jsx("path",{d:"M6 9V3h12v6"}),i.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"}),i.jsx("path",{d:"M6 14h12v8H6z"})]})}function Dh({className:e}){return i.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:[i.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),i.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),i.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]})}function Rh({className:e}){return i.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:[i.jsx("path",{d:"M21 10H10a5 5 0 0 0 0 10h1"}),i.jsx("path",{d:"M17 6l4 4-4 4"})]})}function Eh({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function jh({className:e}){return i.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":"ruler",children:[i.jsx("path",{d:"M4 8h16"}),i.jsx("path",{d:"M4 16h16"}),i.jsx("path",{d:"M6 8v8"}),i.jsx("path",{d:"M10 8v4"}),i.jsx("path",{d:"M14 8v6"}),i.jsx("path",{d:"M18 8v8"})]})}function Th({className:e}){return i.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:[i.jsx("path",{d:"M5 3h11l5 5v13H5V3z"}),i.jsx("path",{d:"M15 3v6H9V3"}),i.jsx("path",{d:"M8 21v-7h8v7"})]})}function ps({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("path",{d:"M9 4v16"}),i.jsx("path",{d:"M15 4v16"}),i.jsx("rect",{x:"9.5",y:"5",width:"5",height:"14",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function qu({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("path",{d:"M9 4v16"}),i.jsx("path",{d:"M15 4v16"})]})}function hs({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M3 10h18"}),i.jsx("path",{d:"M3 16h18"}),i.jsx("rect",{x:"4",y:"10.5",width:"16",height:"5",fill:"currentColor",stroke:"none",opacity:"0.25"})]})}function Nh({className:e}){return i.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:[i.jsx("path",{d:"M6 7.5C6 5.5 8 4 12 4s6 1.5 6 3.5-1.8 2.8-6 3.5"}),i.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"}),i.jsx("path",{d:"M4 12h16"})]})}function Ih({className:e}){return i.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:[i.jsx("path",{d:"M7 4v8a5 5 0 0 0 10 0V4"}),i.jsx("path",{d:"M5 20h14"})]})}function Mh({className:e}){return i.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:[i.jsx("path",{d:"M3 10h11a5 5 0 0 1 0 10h-1"}),i.jsx("path",{d:"M7 6L3 10l4 4"})]})}function _h({className:e}){return i.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:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),i.jsx("path",{d:"M12 4v16"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M9 9l-3 3 3 3"}),i.jsx("path",{d:"M15 9l3 3-3 3"})]})}function Lh({className:e}){return i.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:[i.jsx("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Fh({className:e}){return i.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:[i.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3"}),i.jsx("path",{d:"m10 9 6 3-6 3V9Z",fill:"currentColor",stroke:"none"})]})}const ue="---";function on(e){return e===ue}function an(e){return typeof e=="object"&&e!==null&&"submenu"in e}const bl=new Set(["save","open","print","undo","redo","link","bookmark","horizontalRule","pageBreak","insertPageBefore","insertPageAfter","deletePage","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"]),Bh=new Set(["file","edit","view","insert","format","table"]),Am="custom",Dm="custom";function Rm(e){return`custom:${e}`}function Hh(e){return e==="menu"||e==="both"}function zh(e){return e==="toolbar"||e==="both"}function Em(e){return e.map(t=>an(t)?{submenu:t.submenu,items:Em(t.items)}:t)}function Oh(e){return{menus:e.menus.map(t=>({id:t.id,items:Em(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function jm(e){return on(e)?!0:an(e)?e.items.every(jm):bl.has(e)}function Tm(e,t){for(const n of e)if(n===t||an(n)&&Tm(n.items,t))return!0;return!1}function $h(e){const t=e.tooltip??e.label;return{id:e.id,command:Rm(e.id),icon:e.icon??rh,label:e.label,ariaLabel:e.label,tooltip:t}}function Kh(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Bh.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===Am&&!r)e.menus[n]={id:n,labelKey:"menuCustom",ariaKey:"menuCustomAria"};else{const o=r??n;e.menus[n]={id:n,label:o,ariaLabel:o}}t.menus.some(o=>o.id===n)||t.menus.push({id:n,items:[]})}function Uh(e,t,n){if(e.groups[n]||(n===Dm?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:[]},o=t.iconGroups.findIndex(a=>a.items.includes("fullscreen"));o===-1?t.iconGroups.push(r):t.iconGroups.splice(o,0,r)}}function Wh(e,t,n){var a,s;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},o=Oh(n);for(const u of e??[])if(!(bl.has(u.id)||on(u.id))){if(r.items[u.id]=$h(u),Hh(u.showIn)){const d=((a=u.menu)==null?void 0:a.id)??Am;Kh(r,o,d,(s=u.menu)==null?void 0:s.label);const g=o.menus.find(p=>p.id===d);if(g&&!Tm(g.items,u.id)){const p=g.items[g.items.length-1];p!==void 0&&!on(p)&&g.items.every(jm)&&g.items.push(ue),g.items.push(u.id)}}if(zh(u.showIn)){const d=u.toolbarGroup??Dm;Uh(r,o,d);const g=o.iconGroups.find(p=>p.id===d);g&&!g.items.includes(u.id)&&g.items.push(u.id)}}return{catalog:r,layout:o}}function Vh(e,t){const n={};for(const r of e??[])bl.has(r.id)||on(r.id)||(n[Rm(r.id)]=()=>r.onAction(t()));return n}function Gh(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const qh="_chrome_boy0f_1",Zh={chrome:qh},Nm=c.createContext(!1);function Yh({dark:e,children:t}){return i.jsx(Nm.Provider,{value:e,children:t})}function Xh(){return c.useContext(Nm)}function Bs(e){return{className:Zh.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function fe({children:e}){const t=Xh(),n=Bs(t);return hl.createPortal(i.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function yl(e,t){const n=e[t];n==null||n()}const xl={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",commandPageBackgroundImage:"Page background image",commandPageBackgroundImageAria:"Insert page background image",commandParagraphBackgroundImage:"Paragraph background image",commandParagraphBackgroundImageAria:"Insert paragraph background 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",menuInsertPage:"Page",menuInsertPageAria:"Insert page submenu",commandInsertPageBefore:"Page before",commandInsertPageBeforeAria:"Insert page before selected page",commandInsertPageAfter:"Page after",commandInsertPageAfterAria:"Insert page after selected page",commandTableProperties:"Table properties…",commandTablePropertiesAria:"Table properties",commandCellProperties:"Cell properties…",commandCellPropertiesAria:"Cell properties",commandRowProperties:"Row properties…",commandRowPropertiesAria:"Row properties",commandInsertRowBelow:"Insert row below",commandInsertRowBelowAria:"Insert row below",commandInsertRowBefore:"Insert row above",commandInsertRowBeforeAria:"Insert row above",commandDeleteRow:"Delete row",commandDeleteRowAria:"Delete row",commandInsertColumnAfter:"Insert column right",commandInsertColumnAfterAria:"Insert column right",commandInsertColumnBefore:"Insert column left",commandInsertColumnBeforeAria:"Insert column left",commandDeleteColumn:"Delete column",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",commandDeletePage:"Delete page",commandDeletePageAria:"Delete selected page",deletePageDialogTitle:"Delete page",deletePageConfirmMessage:"Are you sure you want to delete the selected page?",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",commandRuler:"Ruler",commandRulerAria:"Show or hide rulers",rulerMarginLeft:"Left margin",rulerMarginRight:"Right margin",rulerMarginTop:"Top margin",rulerMarginBottom:"Bottom margin",rulerFirstLineIndent:"First line indent",rulerLeftIndent:"Left indent",rulerRightIndent:"Right indent",commentPanelTitle:"Comment",commentPlaceholder:"Write a comment…",commentReplyPlaceholder:"Write a reply…",commentPost:"Post",commentEmpty:"No messages yet.",commentPanelCloseAria:"Close comment panel"},Jh={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",commandPageBackgroundImage:"Imagen de fondo de página",commandPageBackgroundImageAria:"Insertar imagen de fondo de página",commandParagraphBackgroundImage:"Imagen de fondo de párrafo",commandParagraphBackgroundImageAria:"Insertar imagen de fondo de párrafo",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",menuInsertPage:"Página",menuInsertPageAria:"Submenú insertar página",commandInsertPageBefore:"Página antes",commandInsertPageBeforeAria:"Insertar página antes de la seleccionada",commandInsertPageAfter:"Página después",commandInsertPageAfterAria:"Insertar página después de la seleccionada",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:"Insertar fila debajo",commandInsertRowBelowAria:"Insertar fila debajo",commandInsertRowBefore:"Insertar fila encima",commandInsertRowBeforeAria:"Insertar fila encima",commandDeleteRow:"Eliminar fila",commandDeleteRowAria:"Eliminar fila",commandInsertColumnAfter:"Insertar columna a la derecha",commandInsertColumnAfterAria:"Insertar columna a la derecha",commandInsertColumnBefore:"Insertar columna a la izquierda",commandInsertColumnBeforeAria:"Insertar columna a la izquierda",commandDeleteColumn:"Eliminar columna",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",commandDeletePage:"Eliminar página",commandDeletePageAria:"Eliminar la página seleccionada",deletePageDialogTitle:"Eliminar página",deletePageConfirmMessage:"¿Seguro que quieres eliminar la página seleccionada?",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",commandRuler:"Regla",commandRulerAria:"Mostrar u ocultar reglas",rulerMarginLeft:"Margen izquierdo",rulerMarginRight:"Margen derecho",rulerMarginTop:"Margen superior",rulerMarginBottom:"Margen inferior",rulerFirstLineIndent:"Sangría de primera línea",rulerLeftIndent:"Sangría izquierda",rulerRightIndent:"Sangría derecha",commentPanelTitle:"Comentario",commentPlaceholder:"Escribe un comentario…",commentReplyPlaceholder:"Escribe una respuesta…",commentPost:"Publicar",commentEmpty:"Aún no hay mensajes.",commentPanelCloseAria:"Cerrar panel de comentarios"},Qh={en:xl,es:Jh},Im=c.createContext(e=>xl[e]);function eb({locale:e="en",children:t}){const n=c.useMemo(()=>{const r=Qh[e]??xl;return o=>r[o]},[e]);return i.jsx(Im.Provider,{value:n,children:t})}function q(){return c.useContext(Im)}const tb="_menu_c1m45_1",nb="_item_c1m45_19",rb="_separator_c1m45_59",bs={menu:tb,item:nb,separator:rb},Xo=8,ob=[{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:"openPageProperties",labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:e=>e!=="image"},{type:"item",command:"deletePage",labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:(e,t)=>t.canDeletePage},{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 ib(e,t){const n=[];let r=!1;for(const o of ob){if(o.type==="separator"){n.length>0&&(r=!0);continue}o.enabled(e,t)&&(r&&(n.push({type:"separator"}),r=!1),n.push(o))}return n}function Zu(){return'[role="menuitem"]:not(:disabled)'}function ab({open:e,x:t,y:n,kind:r,inTable:o=!1,canMergeCells:a=!1,canUnmergeCells:s=!1,canDeletePage:u=!1,commands:d,onClose:g}){const p=q(),h=c.useId(),x=c.useRef(null);if(c.useLayoutEffect(()=>{var D;if(!e)return;const y=x.current;if(!y)return;const v=y.getBoundingClientRect(),k=Math.max(Xo,Math.min(t,window.innerWidth-v.width-Xo)),S=Math.max(Xo,Math.min(n,window.innerHeight-v.height-Xo));y.style.left=`${k}px`,y.style.top=`${S}px`,(D=y.querySelector(Zu()))==null||D.focus()},[e,t,n,r]),c.useEffect(()=>{if(!e)return;const y=D=>{var I;(I=x.current)!=null&&I.contains(D.target)||g()},v=D=>{D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),g())},k=()=>{g()},S=D=>{var I;if((I=x.current)!=null&&I.contains(D.target)){D.preventDefault();return}D.defaultPrevented||g()};return document.addEventListener("pointerdown",y),document.addEventListener("keydown",v,!0),window.addEventListener("scroll",k,!0),document.addEventListener("contextmenu",S),()=>{document.removeEventListener("pointerdown",y),document.removeEventListener("keydown",v,!0),window.removeEventListener("scroll",k,!0),document.removeEventListener("contextmenu",S)}},[e,g]),!e)return null;const b=ib(r,{inTable:o,canMergeCells:a,canUnmergeCells:s,canDeletePage:u}),w=y=>{var I;if(y.key!=="ArrowDown"&&y.key!=="ArrowUp")return;const v=[...((I=x.current)==null?void 0:I.querySelectorAll(Zu()))??[]];if(v.length===0)return;const k=v.indexOf(document.activeElement),S=y.key==="ArrowDown"?1:-1,D=v[(k+S+v.length)%v.length];y.preventDefault(),D==null||D.focus()};return i.jsx(fe,{children:i.jsxs("div",{ref:x,className:bs.menu,role:"menu","aria-labelledby":h,style:{left:t,top:n},onMouseDown:y=>y.preventDefault(),onKeyDown:w,children:[i.jsx("span",{id:h,hidden:!0,children:p("contextMenuAria")}),b.map((y,v)=>y.type==="separator"?i.jsx("div",{role:"separator",className:bs.separator},`separator-${v}`):i.jsx("button",{type:"button",role:"menuitem",className:bs.item,"aria-label":p(y.ariaKey),onClick:()=>{g(),yl(d,y.command)},children:p(y.labelKey)},y.command))]})})}function sb(e){return e==="touch"||e==="pen"}function lb(e,t){return e.button===2||e.ctrlKey?!0:!sb(t)}const wl=["pt","px","em","rem","%"],Rn="pt",cb={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]},ub={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},db=new Set(wl),mb=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function Wi(e){return db.has(e)}function Me(e){return Math.round(e*100)/100}function ie(e){const t=Me(e);return Number.isInteger(t),String(t)}function Cl(e,t){return`${ie(e)}${t}`}function vl(e){const t=e.trim();if(!t)return null;const n=t.match(mb);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return{value:r,unit:o}}function fb(e,t){const n=e.trim();if(!n)return null;const r=vl(n);if(r)return Wi(r.unit)?En(r.value,r.unit):null;const o=Number(n.replace(",","."));return Number.isFinite(o)?En(o,t):null}function En(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=ub[t];return{value:Me(Math.min(r,Math.max(n,e))),unit:t}}function Mm(e,t,n,r){const o=n>0?n:16,a=r>0?r:16;switch(t){case"px":return Me(e);case"pt":return Me(e*.75);case"em":return Me(e/o);case"rem":return Me(e/a);case"%":return Me(e/o*100)}}function gb(e,t,n,r){const o=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*o;case"rem":return e*a;case"%":return e/100*o}}function _m(e,t,n,r,o){if(t===n)return Me(e);const a=gb(e,t,r,o);return Mm(a,n,r,o)}const kl="pt",pb=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,hb=/^[+-]?0(?:\.0+)?$/;function he(e){return`${ie(e.value)}${e.unit}`}function Oe(e){const t=e.trim();if(!t)return null;if(hb.test(t))return{value:0,unit:"px"};const n=t.match(pb);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return Wi(o)?{value:Me(r),unit:o}:null}function Vr(e,t,n){const r=e.trim();if(!r)return null;const o=Oe(r);if(o)return!n&&o.value<0?{...o,value:0}:o;const a=Number(r.replace(",","."));return Number.isFinite(a)?!n&&a<0?{value:0,unit:t}:{value:Me(a),unit:t}:null}function dn(e){return e.value>=0?e:{value:0,unit:e.unit}}function st(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}const bb=new Set(["span","strong","b","em","i","u","s","strike","del"]);function de(e,t){return t?e===t||e.contains(t):!1}function Rt(e){return bb.has(e.tagName.toLowerCase())}function yb(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 qe(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 o;for(;o=r.nextNode();)o.nodeValue&&yb(e,o)&&n.push(o);return n}function Dt(e){const t=e.startContainer,n=e.startOffset;if(t.nodeType===Node.TEXT_NODE){const a=t;if(n>0&&n<a.length){const s=a.splitText(n);e.setStart(s,0),e.endContainer===a&&e.setEnd(s,e.endOffset-n)}}const r=e.endContainer,o=e.endOffset;if(r.nodeType===Node.TEXT_NODE){const a=r;o>0&&o<a.length&&(a.splitText(o),e.setEnd(a,a.length))}}function mn(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function tt(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function fn(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<=-1||n.length===1)return;const o=e.parentNode;if(!o)return;const a=n.slice(0,r),s=n.slice(r+1);if(a.length>0){const u=e.cloneNode(!1);for(const d of a)u.appendChild(d);o.insertBefore(u,e)}if(s.length>0){const u=e.cloneNode(!1);for(const d of s)u.appendChild(d);o.insertBefore(u,e.nextSibling)}}function Tn(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 o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function eo(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}function Jo(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function xb(e,t){return t?e===t||e.contains(t):!1}function Yu(e,t){var a;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0,o;for(;o=n.nextNode();){if(o===t||t.contains(o)||t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)return r;r+=((a=o.textContent)==null?void 0:a.length)??0}return r}function Xu(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return Yu(e,t)+n;let r=0;const o=t.childNodes;for(let s=0;s<n&&s<o.length;s+=1)r+=((a=o[s].textContent)==null?void 0:a.length)??0;return Yu(e,t)+r}function Ju(e,t){var s,u;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=Math.max(0,t),o,a=null;for(;o=n.nextNode();){a=o;const d=((s=o.textContent)==null?void 0:s.length)??0;if(r<=d)return{node:o,offset:r};r-=d}return a?{node:a,offset:((u=a.textContent)==null?void 0:u.length)??0}:{node:e,offset:e.childNodes.length}}function Sl(e,t,n){const r=document.createRange(),o=Ju(e,t),a=Ju(e,n);return r.setStart(o.node,o.offset),r.setEnd(a.node,a.offset),r}function Lm(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Qu(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function wb(e,t){return t.mode!=="visual"?null:t.visualRange&&Lm(t.visualRange,e)?t.visualRange:Sl(e,t.start,t.end)}function St(e){var n;if(e.mode==="html"&&e.htmlEl){const r=e.htmlEl.selectionStart,o=e.htmlEl.selectionEnd;return{mode:"html",text:e.htmlEl.value.slice(r,o),collapsed:r===o,start:r,end:o,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(xb(t,a.commonAncestorContainer)){const s=Xu(t,a.startContainer,a.startOffset),u=Xu(t,a.endContainer,a.endOffset);return{mode:"visual",text:a.toString(),collapsed:a.collapsed,start:Math.min(s,u),end:Math.max(s,u),visualRange:a.cloneRange()}}}const o=((n=t.textContent)==null?void 0:n.length)??0;return{mode:"visual",text:"",collapsed:!0,start:o,end:o,visualRange:null}}return{mode:e.mode,text:"",collapsed:!0,start:0,end:0,visualRange:null}}function ed(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Cb(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),s=e.snapshot.start,u=e.snapshot.end,d=e.asHtml?e.content:ed(e.content);e.setHtml(a.slice(0,s)+d+a.slice(u));const g=e.htmlEl;if(g){const p=s+d.length;g.focus(),g.setSelectionRange(p,p)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:ed(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&Lm(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??Sl(t,e.snapshot.start,e.snapshot.end);if(r.deleteContents(),e.content)if(e.asHtml){const a=r.createContextualFragment(e.content),s=a.lastChild;r.insertNode(a),s&&(r.setStartAfter(s),r.collapse(!0))}else{const a=document.createTextNode(e.content);r.insertNode(a),r.setStartAfter(a),r.collapse(!0)}const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r),e.setHtml(t.innerHTML)}const Pl=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),Fm=new Set(["table","thead","tbody","tr","td","th"]),Al=new Set([...Fm,"ul","ol","li","pre","hr"]);function xe(e){return e.tagName.toLowerCase()}function to(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Dl(e){return e instanceof HTMLElement&&(xe(e)==="ul"||xe(e)==="ol")}function lt(e){return e instanceof HTMLElement&&xe(e)==="li"}function Et(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return de(e,n.commonAncestorContainer)?n:null}function Rl(e){const t=e.collapsed?[]:qe(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function nr(e,t,n){var d,g,p;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let x=0,b;for(;b=h.nextNode();){if(b===t)return x+n;x+=((d=b.textContent)==null?void 0:d.length)??0}return x}let r=0;const o=t.childNodes;for(let h=0;h<n&&h<o.length;h+=1)r+=((g=o[h].textContent)==null?void 0:g.length)??0;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s=0,u;for(;u=a.nextNode();){if(t.contains(u)||t.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING)return s+r;s+=((p=u.textContent)==null?void 0:p.length)??0}return s+r}function El(e,t,n){const r=Sl(e,t,n),o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function gn(e,t){const n=Et(e);if(!n)return!1;const r=nr(e,n.startContainer,n.startOffset),o=nr(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=t();return El(e,a,s),u}function jl(e,t){if(xe(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 We(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function vb(e,t){let n=to(t);for(;n&&n!==e;){if(hf(n,e)||dt(n)){n=n.parentElement;continue}const r=xe(n);if(Pl.has(r)&&n instanceof HTMLElement)return n;if(Fm.has(r)||r==="pre")return null;n=n.parentElement}return null}function Kt(e){const t=Et(e);if(!t)return[];const n=new Set,r=[];for(const o of Rl(t)){const a=vb(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Hs(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=xe(e);return Pl.has(t)||Al.has(t)?!1:Rt(e)||t==="br"||t==="a"||t==="img"||t==="span"}function kb(e,t){let n=to(t);for(;n&&n!==e;){if(Al.has(xe(n)))return!0;n=n.parentElement}return!1}function Sb(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Pb(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&Hs(n[o-1]);)o-=1;for(;a<n.length-1&&Hs(n[a+1]);)a+=1;return n.slice(o,a+1)}function zs(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&dt(t)))return t;return null}function Ab(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&&dt(r)?zs(e):r}return n.startContainer===t&&e!==t?zs(e):Sb(e,n.startContainer)}function Db(e,t){const n=$l(e);if(kb(e,t.startContainer))return null;if(!zs(n)){const s=document.createElement("p");return s.appendChild(document.createElement("br")),n.appendChild(s),s}const r=Ab(n,e,t);if(!r||r instanceof HTMLElement&&dt(r)||r instanceof Element&&Al.has(xe(r))||r instanceof HTMLElement&&Pl.has(xe(r))||!Hs(r))return null;const o=Pb(n,r),a=document.createElement("p");n.insertBefore(a,o[0]);for(const s of o)a.appendChild(s);return a}function Nn(e){const t=Kt(e);if(t.length>0)return t;const n=Et(e);if(!n)return[];const r=Db(e,n);return r?[r]:[]}function rr(e){const t=e.parentElement;return t&&Dl(t)?t:null}function Bm(e){if(e.length===0)return[];const t=[[e[0]]];for(let n=1;n<e.length;n+=1){const r=e[n-1],o=e[n];r.parentNode===o.parentNode&&Rb(r,o)?t[t.length-1].push(o):t.push([o])}return t}function Rb(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 Eb(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function ys(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]),o=Number(t[3]),a=t[4]===void 0?1:Number(t[4]);return[n,r,o,a].every(s=>Number.isFinite(s))?{r:n,g:r,b:o,a}:null}function xs(e,t,n){const r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function ws(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 jb={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 Tb(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function Pe(e){const t=e.trim();if(!t||Tb(t))return null;const n=ws(t);if(n)return n;const r=ys(t);if(r)return r.a===0?null:xs(r.r,r.g,r.b);const o=jb[t.toLowerCase()];if(o)return o;const a=document.createElement("canvas").getContext("2d");if(!a)return null;a.fillStyle="#010203";try{a.fillStyle=t}catch{return null}const s=String(a.fillStyle);if(s==="#010203"){const d=ws(t);if(d==="#010203")return d;const g=ys(t);return g&&xs(g.r,g.g,g.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(s.startsWith("#"))return ws(s);const u=ys(s);return!u||u.a===0?null:xs(u.r,u.g,u.b)}function Hm(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?Pe(n):null}function Ci(e,t,n){let r=Eb(t);for(;r&&r!==e&&r instanceof HTMLElement;){const o=Hm(r,n);if(o)return o;r=r.parentElement}return null}function vi(e,t){return e instanceof HTMLElement?Hm(e,t)!==null:!1}function Tl(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function zm(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function Nb(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Rt(o)||!vi(o,n)){r=o;continue}if(fn(o,r),vi(o,n)&&(Tl(o,n),mn(o))){tt(o);continue}r=o}}function Om(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return de(e,n.commonAncestorContainer)?n:null}function ki(e,t){const n=Om(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:qe(n).filter(d=>d.data.length>0),a=(r.length>0?r:[n.startContainer]).map(d=>Ci(e,d,t)),s=a[0]??null;return a.every(d=>d===s)?{value:s,mixed:!1}:{value:null,mixed:!0}}function Or(e,t,n){const r=Om(e);if(!r||r.collapsed)return!1;const o=n===null?null:Pe(n);if(n!==null&&o===null)return!1;Dt(r);const a=qe(r).filter(s=>s.data.length>0);for(const s of a){const u=Ci(e,s,t);if(o===null){if(u===null)continue;Nb(e,s,t);continue}u!==o&&eo(s,d=>{zm(d,t,o)})}return Tn(a),!0}function td(e,t,n){if(n.value===null){Tl(e,t);return}const r=Pe(n.value);r&&zm(e,t,r)}function Ib(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function Mb(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function _b(e){var r,o,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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(o=e.startContainer.parentNode)==null||o.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function $m(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Rt(o)||!n.some(a=>vi(o,a))){r=o;continue}fn(o,r);for(const a of n)vi(o,a)&&Tl(o,a);if(mn(o)){tt(o);continue}r=o.isConnected?o:t}return t}function Lb(e,t,n){Mb(t);const r=_b(t);return $m(e,r,n)}function Fb(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&Ci(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&Ci(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Km=["auto","avoid"],Os=["auto","avoid","page"];new Set(Km);new Set(Os);function Um(e){return e.trim().toLowerCase()}function nd(e){return Um(e)==="avoid"?"avoid":"auto"}function Si(e){const t=Um(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function Wm(e){const t=e.style.breakInside;if(t)return nd(t);const n=e.style.pageBreakInside;return n?nd(n):"auto"}function Vm(e){const t=e.style.breakAfter;if(t)return Si(t);const n=e.style.pageBreakAfter;return n?Si(n):"auto"}function Gm(e){const t=e.style.breakBefore;if(t)return Si(t);const n=e.style.pageBreakBefore;return n?Si(n):"auto"}function Bb(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function Hb(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function zb(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function Ob(e){return{breakInside:Wm(e),breakAfter:Vm(e),breakBefore:Gm(e)}}function $b(e,t){return Wm(e)===t?!1:t==="auto"?(Bb(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function Kb(e,t){return Vm(e)===t?!1:t==="auto"?(Hb(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function Ub(e,t){return Gm(e)===t?!1:t==="auto"?(zb(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function Wb(e,t){return e===t}function rd(e,t){return e===t}const Fe=["top","right","bottom","left"],Vi=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],ht={top:null,right:null,bottom:null,left:null},Nl={style:"none",width:null,color:null},Vb=new Set(Vi),od={value:0,unit:"px"};function Gb(){return{margin:{...ht},padding:{...ht},lineHeight:null,border:{...Nl},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function Il(){const e=Gb();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 Ot(e,t){return Fe.every(n=>st(e[n],t[n]))}function qm(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 Zm(e,t){return e.style===t.style&&st(e.width,t.width)&&e.color===t.color}function Ym(e,t){return e===t?!0:!e||!t?!1:st(e.offsetX,t.offsetX)&&st(e.offsetY,t.offsetY)&&st(e.blur,t.blur)&&st(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function qb(e){return e.kind==="normal"?"normal":e.kind==="number"?ie(e.value):he({value:e.value,unit:e.unit})}function Zb(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)?sn(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?sn(n):null}function sn(e){return Me(Math.min(1,Math.max(0,e)))}function Pi(e){return Me(sn(e)*100)}function Xm(e){return sn(e/100)}function Jm(e){return ie(sn(e))}function Yb(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:Me(r)}}const n=Oe(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function Xb(e,t){const n=[];let r="",o=0;for(const a of e){if(a==="("){o+=1,r+=a;continue}if(a===")"){o=Math.max(0,o-1),r+=a;continue}if(a===t&&o===0){r.trim()&&n.push(r.trim()),r="";continue}r+=a}return r.trim()&&n.push(r.trim()),n}function Jb(e){const t=[];let n="",r=0;for(const o of e){if(o==="("){r+=1,n+=o;continue}if(o===")"){r=Math.max(0,r-1),n+=o;continue}if(/\s/.test(o)&&r===0){n&&t.push(n),n="";continue}n+=o}return n&&t.push(n),t}function Qb(e){const t=[he(e.offsetX),he(e.offsetY),he(e.blur),he(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function ey(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=Xb(t,",")[0];if(!n)return null;const r=Jb(n);let o=!1,a=null;const s=[];for(const u of r){if(u.toLowerCase()==="inset"){o=!0;continue}const d=Oe(u);if(d){s.push(d);continue}const g=Pe(u);if(g){a=g;continue}return null}return s.length<2||s.length>4?null:{offsetX:s[0],offsetY:s[1],blur:s[2]??od,spread:s[3]??od,color:a,inset:o}}function qn(e,t){return Oe(e.style.getPropertyValue(t))}function ty(e,t,n,r){const o=n&&r?dn(n):n,a=o?he(o):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function id(e,t){return{top:qn(e,`${t}-top`),right:qn(e,`${t}-right`),bottom:qn(e,`${t}-bottom`),left:qn(e,`${t}-left`)}}function ad(e,t,n,r){let o=!1;for(const a of Fe)ty(e,`${t}-${a}`,n[a],r)&&(o=!0);return o}function ny(e){const t=e.trim().toLowerCase();return Vb.has(t)?t:"none"}function Qm(e){const t=ny(e.style.borderStyle||e.style.borderTopStyle),n=qn(e,"border-width")??qn(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,o=r?Pe(r):null;return{style:t,width:n,color:o}}function ry(e,t){const n=Qm(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?dn(t.width):null,color:t.color};return Zm(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=he(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function ef(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return Oe(n)}function oy(e,t){const n=t?dn(t):null,r=ef(e);return st(r,n)?!1:(n?e.style.borderRadius=he(n):e.style.removeProperty("border-radius"),!0)}function tf(e){return ey(e.style.boxShadow)}function iy(e,t){const n=tf(e),r=t?{...t,blur:dn(t.blur)}:null;return Ym(n,r)?!1:(r?e.style.boxShadow=Qb(r):e.style.removeProperty("box-shadow"),!0)}function nf(e){return Yb(e.style.lineHeight)}function ay(e,t){const n=nf(e);return qm(n,t)?!1:(t?e.style.lineHeight=qb(t):e.style.removeProperty("line-height"),!0)}function rf(e){const t=e.style.backgroundColor;return t?Pe(t):null}function sy(e,t){const n=t?Pe(t):null;return rf(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function of(e){return Zb(e.style.opacity)}function ly(e,t){const n=of(e),r=t===null?null:sn(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Jm(r),!0)}function ur(e){const t=Ob(e);return{margin:id(e,"margin"),padding:id(e,"padding"),lineHeight:nf(e),border:Qm(e),borderRadius:ef(e),boxShadow:tf(e),backgroundColor:rf(e),opacity:of(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function dr(e,t){let n=!1;return!t.marginMixed&&ad(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&ad(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&ay(e,t.lineHeight)&&(n=!0),!t.borderMixed&&ry(e,t.border)&&(n=!0),!t.radiusMixed&&oy(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&iy(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&sy(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&ly(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&$b(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&Kb(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&Ub(e,t.breakBefore)&&(n=!0),n&&We(e),n}function cy(e){const t=Il(),n=Kt(e);if(n.length===0)return t;const r=n.map(ur),o=r[0];return{margin:o.margin,marginMixed:r.some(a=>!Ot(a.margin,o.margin)),padding:o.padding,paddingMixed:r.some(a=>!Ot(a.padding,o.padding)),lineHeight:o.lineHeight,lineHeightMixed:r.some(a=>!qm(a.lineHeight,o.lineHeight)),border:o.border,borderMixed:r.some(a=>!Zm(a.border,o.border)),borderRadius:o.borderRadius,radiusMixed:r.some(a=>!st(a.borderRadius,o.borderRadius)),boxShadow:o.boxShadow,shadowMixed:r.some(a=>!Ym(a.boxShadow,o.boxShadow)),backgroundColor:o.backgroundColor,backgroundMixed:r.some(a=>a.backgroundColor!==o.backgroundColor),opacity:o.opacity,opacityMixed:r.some(a=>a.opacity!==o.opacity),breakInside:o.breakInside,breakInsideMixed:r.some(a=>!Wb(a.breakInside,o.breakInside)),breakAfter:o.breakAfter,breakAfterMixed:r.some(a=>!rd(a.breakAfter,o.breakAfter)),breakBefore:o.breakBefore,breakBeforeMixed:r.some(a=>!rd(a.breakBefore,o.breakBefore))}}function uy(e,t){return gn(e,()=>{const n=Nn(e);if(n.length===0)return!1;let r=!1;for(const o of n)dr(o,t)&&(r=!0);return r})}const Gr=96,dy=25.4,Ml=Gr/dy,af=Ml*10,sf=72,my=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(in|cm|mm|pt|px|em|rem|%)$/i;function lf(e){const t=e.trim();if(!t)return null;if(/^[+-]?0(?:\.0+)?$/.test(t))return{value:0,unit:"px"};const n=t.match(my);if(!n)return null;const r=Number(n[1]);return Number.isFinite(r)?{value:Me(r),unit:n[2].toLowerCase()}:null}function qr(e,t){switch(t){case"in":return e/Gr;case"cm":return e/af;case"mm":return e/Ml;case"pt":return e/Gr*sf;case"px":default:return e}}function Zr(e,t){switch(t){case"in":return e*Gr;case"cm":return e*af;case"mm":return e*Ml;case"pt":return e/sf*Gr;case"em":case"rem":return e*16;case"px":default:return e}}function An(e,t=0){if(!e)return t;const n=typeof e=="string"?lf(e):e;return!n||!Number.isFinite(n.value)?t:Zr(n.value,n.unit)}function Cs(e,t="in"){const n=qr(e,t);return{value:Math.round(n*1e3)/1e3,unit:t}}function Hr(e){const t=qr(e,"pt");return{value:Math.round(t*1e3)/1e3,unit:"pt"}}function cf(e,t="in"){const n=qr(e,t),r=t==="in"?2:t==="cm"?1:0;return`${n.toFixed(r)} ${t}`}function Pn(e,t="in",n=!1,r=0){if(n)return e;const o=e-r,s=Zr(t==="in"?.125:t==="cm"?.25:t==="mm"?2.5:10,t);if(s<=0)return e;const u=Math.round(o/s)*s;return r+u}function uf(e,t,n="in"){const r=[];if(e<=0)return r;const o=n==="in",a=o?.125:.1;if(Zr(a,n)<=0)return r;const u=-qr(t,n),d=qr(e-t,n),g=Math.floor(u/a),p=Math.ceil(d/a);for(let h=g;h<=p;h++){const x=h*a,b=t+Zr(x,n);if(b<0||b>e)continue;const w=Math.round(x),y=Math.abs(x-w)<.001,v=o?Math.abs(x-(Math.floor(x)+.5))<.001:!1,k=o?Math.abs(x-(Math.floor(x)+.25))<.001||Math.abs(x-(Math.floor(x)+.75))<.001:!1;let S=4;y?S=10:v?S=7:k&&(S=5);const D={positionPx:Math.round(b),unitValue:x,major:y,height:S};y&&x>=0&&(D.label=String(Math.abs(w))),r.push(D)}return r}function df(e){const t=Oe(e);if(t)return t;const n=lf(e);return n&&(n.unit==="in"||n.unit==="cm"||n.unit==="mm")?Hr(Zr(n.value,n.unit)):null}const Ai="data-page-at-rule";function nn(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...ht},marginMixed:!1}}function _l(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function mf(e){return e.body.innerHTML.replace(/\s*data-page=""/g," data-page")}function Yr(e){var r;const n=_l(e).querySelector(`style[${Ai}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function Qo(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?df(r[1].trim()):null}function fy(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...ht};const n=t[1].trim().split(/\s+/).map(u=>df(u)),[r,o=r,a=r,s=o]=n;return{top:r??null,right:o??null,bottom:a??null,left:s??null}}function gy(e){const t={sizePreset:"auto",customWidth:null,customHeight:null,orientation:null},n=e.match(/(?:^|[\s{;])size\s*:\s*([^;]+)/i);if(!n)return t;const r=n[1].trim().toLowerCase();if(r==="auto")return t;const o=r.includes("landscape"),a=r.includes("portrait"),s=o?"landscape":a?"portrait":null,u=r.replace(/\b(landscape|portrait)\b/g,"").trim(),d=u.split(/\s+/).filter(Boolean);if(d.length===1){if(d[0]==="a4")return{sizePreset:"A4",customWidth:null,customHeight:null,orientation:s};if(d[0]==="letter")return{sizePreset:"letter",customWidth:null,customHeight:null,orientation:s};if(d[0]==="legal")return{sizePreset:"legal",customWidth:null,customHeight:null,orientation:s}}if(d.length>=2){const g=Oe(d[0]),p=Oe(d[1]);if(g&&p)return{sizePreset:"custom",customWidth:g,customHeight:p,orientation:s}}return!u&&s?{sizePreset:"auto",customWidth:null,customHeight:null,orientation:s}:t}function py(e){const t=nn();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],o=gy(r),a={top:Qo(r,"top"),right:Qo(r,"right"),bottom:Qo(r,"bottom"),left:Qo(r,"left")},u=Fe.some(d=>a[d]!==null)?a:fy(r);return{...o,margin:u,marginMixed:!1}}function Qe(e){return py(Yr(e))}function Pt(e,t){return Yr(e)||!Yr(t)?e:Ll(e,Qe(t))}function hy(e){const t=Fe.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?he(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:Fe.map(r=>e[r]?`margin-${r}: ${he(e[r])};`:null).filter(Boolean).join(" ")}function by(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(he(e.customWidth),he(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function yy(e){const t=by(e),n=hy(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function or(e){const t=_l(e);for(const n of t.querySelectorAll(`style[${Ai}]`))n.remove();return mf(t)}function xy(e,t){const n=_l(e);let r=n.querySelector(`style[${Ai}]`);return r||(r=n.createElement("style"),r.setAttribute(Ai,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,mf(n)}function Ll(e,t){const n=yy(t);return n?xy(e,n):ff(e)}function ff(e){return or(e)}function wy(e){const t=e.map(n=>Yr(n)).filter(n=>!!n);return t.length===0?"":t.join(`
2
+ `)}const Fl="data-page-sized",vs={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function Bl(e,t=!1){let n=null;return e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal"?n={...vs[e.sizePreset]}:e.sizePreset==="custom"&&e.customWidth&&e.customHeight?n={width:he(e.customWidth),height:he(e.customHeight)}:e.orientation?n=t?{...vs.letter}:null:n=t?{...vs.letter}:null,n?e.orientation==="landscape"?{width:n.height,height:n.width}:n:null}function gf(e){return Bl(e,!1)!==null}function Cy(e){const t=Bl(e);if(!t)return null;const n=document.createElement("div");n.style.position="fixed",n.style.left="-10000px",n.style.top="0",n.style.visibility="hidden",n.style.boxSizing="border-box",n.style.width=t.width,n.style.minHeight=t.height;const r=Hl(e);for(const a of Fe){const s=r[a];s&&n.style.setProperty(`padding-${a}`,s)}document.body.appendChild(n);const o={width:n.offsetWidth,height:n.offsetHeight};return n.remove(),o}function Hl(e){return vy(e.margin)}function vy(e){return{top:e.top?he(e.top):null,right:e.right?he(e.right):null,bottom:e.bottom?he(e.bottom):null,left:e.left?he(e.left):null}}const ky=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function Sy(e){e.removeAttribute(Fl);for(const t of ky)e.style.removeProperty(t)}function pf(e,t){const n=Qe(e),r={...n.margin};return t.left!==void 0&&(r.left=Hr(t.left)),t.right!==void 0&&(r.right=Hr(t.right)),t.top!==void 0&&(r.top=Hr(t.top)),t.bottom!==void 0&&(r.bottom=Hr(t.bottom)),Ll(e,{...n,margin:r})}function Py(e,t,n){mr(e,pf(t,n))}function mr(e,t){const n=Qe(t),r=Bl(n);if(!r){Sy(e);return}e.setAttribute(Fl,""),e.style.width=r.width,e.style.minHeight=r.height;const o=Hl(n);for(const a of Fe){const s=`padding-${a}`,u=o[a];u?e.style.setProperty(s,u):e.style.removeProperty(s)}}const Xr="data-page",Di="data-page-bg",Ri="commspliant-background";function dt(e){return e instanceof HTMLElement&&(e.id===Ri||e.hasAttribute(Di))}function Ay(e){return e.hasAttribute(Xr)&&e.parentElement?e.parentElement:e}function zl(e){const t=Ay(e),n=new Set,r=[],o=a=>{a instanceof HTMLElement&&dt(a)&&!n.has(a)&&(n.add(a),r.push(a))};o(t.querySelector(`#${Ri}`));for(const a of t.querySelectorAll(`[${Di}]`))o(a);return o(t),r}function Ol(e){return zl(e)[0]??null}function $r(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 Dy(e,t){if(!e.hasAttribute(Fl))return $r(t);let n=!1;return t.style.width!=="100%"&&(t.style.width="100%",n=!0),t.style.height!=="auto"&&(t.style.height="auto",n=!0),t.style.minHeight!=="100%"&&(t.style.minHeight="100%",n=!0),n}function Ry(e){const t=e.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li");return t[t.length-1]??null}function sd(e){const t=pn(e);if(!t)return!1;let n=!1;for(const r of[...e.childNodes])if(r!==t&&!(r instanceof HTMLElement&&dt(r))){if(r.nodeType===Node.TEXT_NODE){if(!(r.textContent??"").trim()){r.remove(),n=!0;continue}let a=Ry(t);a||(a=document.createElement("p"),t.appendChild(a)),a.appendChild(r),n=!0;continue}t.appendChild(r),n=!0}return n}function hf(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(Xr)}function bf(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function Ey(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function pn(e){return bf(e).find(n=>n.hasAttribute(Xr))??null}function jy(e){if(Ey(e))return null;const t=bf(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||dt(n)?null:n}function yf(e){const t=pn(e);if(t)return $r(t),t;const n=jy(e);if(n)return n.setAttribute(Xr,""),$r(n),n;const r=document.createElement("div");for(r.setAttribute(Xr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),$r(r),r}function $l(e){return pn(e)??e}function Ty(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&dt(t)))return t;return null}function Ny(e,t,n){const{startContainer:r}=n;return r===t||t.contains(r)?!1:r===e?!0:e.contains(r)}function Iy(e){var o,a;const t=document.createRange(),n=Ty(e);if(n instanceof HTMLElement){const s=n.firstChild;(s==null?void 0:s.nodeType)===Node.TEXT_NODE?t.setStart(s,((o=s.textContent)==null?void 0:o.length)??0):n.firstChild?t.setStartBefore(n.firstChild):t.setStart(n,0)}else if((n==null?void 0:n.nodeType)===Node.TEXT_NODE)t.setStart(n,((a=n.textContent)==null?void 0:a.length)??0);else{const s=document.createElement("p");s.appendChild(document.createElement("br")),e.appendChild(s),t.setStart(s,0)}t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}function er(e){const t=pn(e);if(!t)return;const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0);Ny(e,t,r)&&Iy(t)}const ld=["background-color","background-image","background-size","background-position","background-repeat","opacity"];function cd(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 Gi(e){const t=pn(e),n=t?Ol(t):null;if(cd(e,t,"background-color"),n)for(const r of ld)r!=="background-color"&&cd(e,n,r);else for(const r of ld)r!=="background-color"&&e.style.removeProperty(r)}const Ei="<!-- wysiwyg-page-separator -->",ir="data-page-surface";function Se(e){const t=e.trim();return t?t.includes(Ei)?e.split(Ei).map(n=>n.trim()):[e]:[""]}function at(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
3
+ ${Ei}
4
+ `)}function pi(){return"<p></p>"}function ud(e){return e.length===0?[pi()]:e.map(t=>t.trim())}function et(e,t){const n=e.querySelector(`[${ir}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${ir}]`)][t]??null)}function My(e){const t=e.getAttribute("data-page-index");if(t!==null){const r=Number.parseInt(t,10);if(!Number.isNaN(r))return r}let n=e.parentElement;for(;n;){const o=[...n.querySelectorAll(`[${ir}]`)].indexOf(e);if(o!==-1)return o;n=n.parentElement}return null}function Kl(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 _y(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function ei(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 o=0;o<n.length;o++)if(((r=n[o])==null?void 0:r.kind)==="file")return!0}return!1}function Ly(e){var r;const t=[],n=e.files;if(n)for(let o=0;o<n.length;o++){const a=((r=n.item)==null?void 0:r.call(n,o))??n[o];a&&t.push(a)}if(t.length===0&&e.items)for(let o=0;o<e.items.length;o++){const a=e.items[o];if((a==null?void 0:a.kind)!=="file")continue;const s=a.getAsFile();s&&t.push(s)}return t}function Fy(e){return e?Ly(e).find(_y)??null:null}const xf={description:"HTML",accept:{"text/html":[".html",".htm"]}},By="document.html";function wf(){return window}function Cf(e){return e instanceof DOMException&&e.name==="AbortError"}function Hy(e,t){const n=new Blob([e],{type:"text/html;charset=utf-8"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=t,o.rel="noopener",document.body.append(o),o.click(),o.remove(),URL.revokeObjectURL(r)}function zy(){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 o;const r=(o=t.files)==null?void 0:o[0];if(!r){n(null);return}Kl(r).then(a=>n(a),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function Oy(e,t=By){const n=wf().showSaveFilePicker;if(typeof n=="function"){try{const o=await(await n({suggestedName:t,types:[xf]})).createWritable();await o.write(e),await o.close()}catch(r){if(Cf(r))return;throw r}return}Hy(e,t)}async function $y(){const e=wf().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[xf]}),n=await t.getFile();return await Kl(n)}catch(t){if(Cf(t))return null;throw t}return zy()}const qi="data-wysiwyg-font",Ky=[{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 Jr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function no(e,t){return e===t?!0:!e||!t?!1:Jr(e)===Jr(t)}function vf(e=[]){var r;const t=[],n=new Set;for(const o of[...Ky,...e]){const a=o.family.trim();if(!a)continue;const s=Jr(a);if(n.has(s))continue;n.add(s);const u=(r=o.css)==null?void 0:r.trim();t.push({name:o.name.trim()||a,family:a,...u?{css:u}:{}})}return t}function Uy(e,t){return e?t.find(n=>no(n.family,e))??null:null}function Wy(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Vy(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Zi(e){const t=new Set,n=[];for(const r of e){const o=r.trim();!o||!Wy(o)||t.has(o)||(t.add(o),n.push(o))}return n}function Gy(e){return e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&amp;/g,"&")}const qy=new RegExp(`<link\\b[^>]*\\b${qi}\\b[^>]*>`,"gi");function Ce(e){if(!e.includes(qi))return{hrefs:[],body:e};const t=[],n=e.replace(qy,r=>{var a,s;const o=((a=r.match(/\bhref\s*=\s*"([^"]*)"/i))==null?void 0:a[1])??((s=r.match(/\bhref\s*=\s*'([^']*)'/i))==null?void 0:s[1]);return o&&t.push(Gy(o)),""});return{hrefs:Zi(t),body:n}}function ti(e,t){const n=Zi(t);return n.length===0?e:`${n.map(o=>`<link rel="stylesheet" href="${Vy(o)}" ${qi}="">`).join("")}${e}`}function Zy(e,t){const n=Jr(t);if(!n)return!1;const r=e.toLowerCase();if(!r.includes("font-family")&&!r.includes("face="))return!1;const o=n.split(",")[0].replace(/['"]/g,"").trim().toLowerCase();if(o&&!r.includes(o))return!1;const a=new DOMParser().parseFromString(e,"text/html"),s=a.createTreeWalker(a.body,NodeFilter.SHOW_ELEMENT);let u=s.currentNode;for(;u;){if(u instanceof HTMLElement){const d=u.style.fontFamily;if(d&&Jr(d)===n)return!0}u=s.nextNode()}return!1}function ni(e,t,n=[]){const r=Ce(t).hrefs,o=n.filter(a=>a.css&&Zy(e,a.family)).map(a=>a.css??"");return Zi([...r,...o])}function Yy(e,t=[]){const n=Ce(e).hrefs,r=t.map(o=>o.css??"");return Zi([...n,...r])}function Xy(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function kf(e){return e.style.fontFamily.trim()||null}function Ul(e,t){let n=Xy(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=kf(n);if(r)return r;n=n.parentElement}return null}function $s(e){return e instanceof HTMLElement&&kf(e)!==null}function Wl(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Jy(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Rt(r)||!$s(r)){n=r;continue}if(fn(r,n),$s(r)&&(Wl(r),mn(r))){tt(r);continue}n=r}}function Sf(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return de(e,n.commonAncestorContainer)?n:null}function Pf(e){const t=Sf(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:qe(t).filter(u=>u.data.length>0),o=(n.length>0?n:[t.startContainer]).map(u=>Ul(e,u)),a=o[0]??null;return o.every(u=>no(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function Ks(e,t){const n=Sf(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;Dt(n);const o=qe(n).filter(a=>a.data.length>0);for(const a of o){const s=Ul(e,a);if(r===null){if(s===null)continue;Jy(e,a);continue}no(s,r)||eo(a,u=>{u.style.fontFamily=r})}return Tn(o),!0}function Qy(e,t){if(t){if(t.value===null){Wl(e);return}e.style.fontFamily=t.value}}function ex(e){return e!=null}function tx(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function nx(e){var r,o,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 s=document.createTextNode("");return(r=e.startContainer.parentNode)==null||r.insertBefore(s,e.startContainer.nextSibling),s}if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startOffset===0){const s=document.createTextNode("");return(o=e.startContainer.parentNode)==null||o.insertBefore(s,e.startContainer),s}const n=document.createTextNode("");return t&&t!==e.startContainer?(a=t.parentNode)==null||a.insertBefore(n,t):e.startContainer.appendChild(n),n}function Us(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Rt(r)||!$s(r)){n=r;continue}if(fn(r,n),Wl(r),mn(r)){tt(r);continue}n=r.isConnected?r:t}return t}function rx(e,t){tx(t);const n=nx(t);return Us(e,n)}function ox(e,t,n){return!!(n&&n.value===null&&Ul(e,t))}const ix=`
5
5
  @page {
6
6
  margin: 0;
7
7
  }
@@ -90,7 +90,39 @@ img {
90
90
  height: auto;
91
91
  vertical-align: middle;
92
92
  }
93
- `.trim();function Ss(e,t,n="​"){const{hrefs:r,body:i}=Se(t),a=e.createElement("meta");a.setAttribute("charset","utf-8");const s=e.createElement("title");s.textContent=n;const u=e.createElement("style");u.textContent=iy;const f=r.map(g=>{const p=e.createElement("link");return p.rel="stylesheet",p.href=g,p});e.head.replaceChildren(a,s,u,...f),e.title=n,e.body.innerHTML=i}const ay=1e3;function zm(){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 Om(e,t,n,r){Ss(e,r);let i=!1;const a=()=>{i||(i=!0,n.remove())};t.addEventListener("afterprint",a),t.focus(),t.print(),window.setTimeout(a,ay)}function sy(e){const t=zm();t&&Om(t.doc,t.win,t.iframe,e)}function ly(e){const t=zm();if(!t)return;const n=[],r=[];for(const u of e){const f=Se(u);n.push(...f.hrefs),r.push(f.body)}const i=r.map((u,f)=>`<div style="${f<r.length-1?"page-break-after: always;":""}">${u}</div>`).join(""),a=xb(e),s=[a?`<style>${a}</style>`:"",...Array.from(new Set(n)).map(u=>`<link rel="stylesheet" href="${u}" />`),i].filter(Boolean).join("");Om(t.doc,t.win,t.iframe,s)}function cy(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 Ob(t)},open:async()=>{const t=e.onOpen?await e.onOpen():await Kb();if(t!==null){if(Array.isArray(t)){e.setHtml(nt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(nt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){ly(e.getAllPagesHtml());return}sy(e.getHtml())}}}function uy(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 dy(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 my(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function fy(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function gy(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()},insertPageBefore:()=>{e.insertPageBefore()},insertPageAfter:()=>{e.insertPageAfter()},deletePage:()=>{e.deletePage()}}}function py(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),hasSelectedPage:()=>e.hasSelectedPage(),canDeletePage:()=>e.canDeletePage()}}function hy(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 by(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}const yy=[50,75,100,125,150,200],xy=.1,Cy=3;function rs(e){return!Number.isFinite(e)||e<=0?1:Math.min(Cy,Math.max(xy,e))}function wy(e,t,n,r,i){if(e==="fitWidth")return r<=0?1:rs(t/r);if(e==="fitPage"){if(r<=0||i<=0)return 1;const a=t/r,s=n/i;return rs(Math.min(a,s))}return rs(e/100)}function vy(e){return e==="fitWidth"||e==="fitPage"}function Wt(e,t){return()=>{e.setPageZoom(t)}}function Gt(e,t){return()=>e.getPageZoom()===t}function Sy(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:Wt(e,"fitWidth"),setPageZoomFitPage:Wt(e,"fitPage"),setPageZoom50:Wt(e,50),setPageZoom75:Wt(e,75),setPageZoom100:Wt(e,100),setPageZoom125:Wt(e,125),setPageZoom150:Wt(e,150),setPageZoom200:Wt(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function ky(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:Gt(e,"fitWidth"),isPageZoomFitPage:Gt(e,"fitPage"),isPageZoom50:Gt(e,50),isPageZoom75:Gt(e,75),isPageZoom100:Gt(e,100),isPageZoom125:Gt(e,125),isPageZoom150:Gt(e,150),isPageZoom200:Gt(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 Ay(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function Py(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function Dy(e){return{...cy(e),...my(e),...Zp(e),...gy(e),...hy(e),...Sy(e),...uy(e),...Ay(e)}}function Ey(e){return{...ky(e),...fy(e),...py(e),...by(e),...dy(e),...Py(e)}}function mi(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function jy(e){const t=e.style.fontSize;if(!t)return null;const n=Qs(t);return!n||!Pi(n.unit)?null:{value:n.value,unit:n.unit}}function Km(e,t){let n=mi(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=jy(n);if(r)return r;n=n.parentElement}return null}function Ry(e,t){const n=mi(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function $m(e,t){var a;let n=mi(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,f=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(f)&&f>0?f:16}n=n.parentElement}const r=((a=mi(t))==null?void 0:a.parentElement)??e,i=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(i)&&i>0?i:16}function Um(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function Ty(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function Fu(e=hn){return{value:null,unit:e,mixed:!1}}function Wm(e,t=hn){const n=window.getSelection();if(!n||n.rangeCount===0)return Fu(t);const r=n.getRangeAt(0);if(!ce(e,r.commonAncestorContainer))return Fu(t);const i=r.collapsed?[]:Ue(r).filter(g=>g.data.length>0),a=i.length>0?i:[r.startContainer],s=a.map(g=>Km(e,g)),u=s[0];if(s.every(g=>Ty(g,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(s.every(g=>g===null)){const g=a.map(h=>Ry(h,e)),p=g[0];if(g.every(h=>Math.abs(h-p)<.05)){const h=$m(e,a[0]),x=Um(e);return{value:tm(p,t,h,x),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function Ny(e,t){return{parentPx:$m(e,t),rootPx:Um(e)}}function My(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ce(e,n.commonAncestorContainer)?n:null}function ks(e,t,n){const r=bn(t,n);if(!r)return!1;const i=My(e);if(!i||i.collapsed)return!1;const a=Js(r.value,r.unit);vt(i);const s=Ue(i).filter(u=>u.data.length>0);for(const u of s){const f=Km(e,u);f&&f.value===r.value&&f.unit===r.unit||Br(u,g=>{g.style.fontSize=a})}return xn(s),!0}function _y(e,t){e.style.fontSize=Js(t.value,t.unit)}function Ly(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Iy(e){return e.trim().toLowerCase()}function As(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=Iy(r.slice(0,i)),s=r.slice(i+1).trim();a&&(t[a]=s)}return t}function Gm(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function Fy(e,t){const n={...e};for(const[r,i]of Object.entries(t))i.trim()?n[r]=i:delete n[r];return n}function By(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 Ti(e){const t=As(e);return Gm(t)}function Hy(e,t){let n=Ly(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function Vm(e){const t=kt(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:Ue(t).filter(f=>f.data.length>0),a=(n.length>0?n:[t.startContainer]).map(f=>Hy(e,f)).map(f=>f.trim()),s=a[0]??"";return a.every(f=>f===s)?{value:s||null,mixed:!1}:{value:null,mixed:!0}}function Zm(e,t){const n=As(e.style.cssText),r=As(t),i=Fy(n,r),a=Gm(i);a?e.style.cssText=a:e.removeAttribute("style")}function qm(e,t){const n=Ti(t);if(!n)return!1;const r=kt(e);if(!r||r.collapsed)return!1;vt(r);const i=Ue(r).filter(a=>a.data.length>0);if(i.length===0)return!1;for(const a of i)Br(a,s=>{Zm(s,n),on(s)&&Xe(s)});return xn(i),!0}function zy(e,t){const n=Ti(t);n&&Zm(e,n)}function Oy(e){return!!(e&&Ti(e))}const it=["bold","italic","underline","strikethrough"],Fn={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Ky=new Set(["underline","line-through","overline"]);function Lt(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function $y(e,t){return it.every(n=>e[n]===t[n])}function Uy(e){return it.some(t=>e[t]!==void 0)}function Ym(e,t){const n={...e};if(!t)return n;for(const r of it){const i=t[r];i!==void 0&&(n[r]=i)}return n}function Wy(e,t,n){const r=e[n]??t[n],i={...e,[n]:!r};return i[n]===t[n]&&delete i[n],i}function en(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Ky.has(n))}function Zn(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 Xm(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(Fn.bold.has(r))return!0;const s=n.style.fontWeight;if(!s)return null;if(s==="bold"||s==="bolder")return!0;const u=Number(s);return Number.isNaN(u)?s==="normal"||s==="lighter"?!1:null:u>=700}if(t==="italic"){if(Fn.italic.has(r))return!0;const s=n.style.fontStyle;return s?s==="italic"||s==="oblique"?!0:s==="normal"?!1:null:null}if(t==="underline"){if(Fn.underline.has(r))return!0;const s=n.style.textDecorationLine||n.style.textDecoration;if(!s)return null;if(s==="none")return!1;const u=en(n);return u.includes("underline")?!0:u.length>0?!1:null}if(Fn.strikethrough.has(r))return!0;const i=n.style.textDecorationLine||n.style.textDecoration;if(!i)return null;if(i==="none")return!1;const a=en(n);return a.includes("line-through")?!0:a.length>0?!1:null}function fi(e,t){return Xm(e,t)===!0}function qn(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const i=Xm(r,n);if(i!==null)return i;r=r.parentElement}return!1}function Jm(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=en(e);r.includes("underline")||r.push("underline"),Zn(e,r);return}const n=en(e);n.includes("line-through")||n.push("line-through"),Zn(e,n)}function Qm(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"){Zn(e,en(e).filter(n=>n!=="underline"));return}Zn(e,en(e).filter(n=>n!=="line-through"))}function Gy(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=en(e).filter(i=>i!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}Zn(e,r);return}const n=en(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}Zn(e,n)}function Vy(e,t){Br(e,n=>Jm(n,t))}function Zy(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const i=r.parentElement;if(!St(i)||!fi(i,n)){r=i;continue}if(an(i,r),fi(i,n)){if(Fn[n].has(i.tagName.toLowerCase())){Xe(i);continue}if(Qm(i,n),on(i)){Xe(i);continue}}r=i}}function qy(e,t,n){const r=Ue(t).filter(i=>i.data.length>0);return r.length===0?qn(e,t.startContainer,n):r.every(i=>qn(e,i,n))}function Yy(e,t,n,r){vt(t);const i=Ue(t).filter(a=>a.data.length>0);for(const a of i)r?qn(e,a,n)||Vy(a,n):Zy(e,a,n);xn(i)}function Bn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Lt();const n=t.getRangeAt(0);if(!ce(e,n.commonAncestorContainer))return Lt();if(n.collapsed)return Ps(e,n);const r=Ue(n).filter(a=>a.data.length>0);if(r.length===0)return Ps(e,n);const i=Lt();for(const a of it)i[a]=qn(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const s of it)i[s]=i[s]&&qn(e,r[a],s);return i}function Ps(e,t){const n=Lt();for(const r of it)n[r]=qn(e,t.startContainer,r);return n}function Ds(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ce(e,r.commonAncestorContainer)||r.collapsed)return!1;const i=qy(e,r,t);return Yy(e,r,t,!i),!0}function Xy(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 Jy(e,t,n){var a,s,u;Xy(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 f=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(f,t.startContainer.nextSibling),r=f}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const f=document.createTextNode("");(s=t.startContainer.parentNode)==null||s.insertBefore(f,t.startContainer),r=f}else{const f=document.createTextNode("");r&&r!==t.startContainer?(u=r.parentNode)==null||u.insertBefore(f,r):t.startContainer.appendChild(f),r=f}let i=r;for(;i.parentElement&&i.parentElement!==e;){const f=i.parentElement;if(!St(f)){i=f;continue}if(!n.some(p=>fi(f,p))){i=f;continue}an(f,i);for(const p of n)if(fi(f,p)){if(Fn[p].has(f.tagName.toLowerCase())){Xe(f);break}if(Qm(f,p),on(f)){Xe(f);break}}i=f.isConnected?f:r}return r}function Qy(e,t,n){for(const r of it)n[r]!==t[r]&&(n[r]?Jm(e,r):Gy(e,r))}function ex(e,t,n,r,i,a,s){var A,R;const u=window.getSelection();if(!u||u.rangeCount===0)return;const f=u.getRangeAt(0);if(!ce(e,f.commonAncestorContainer))return;const g=Ps(e,f),p=Ym(g,n),h=it.filter(N=>g[N]&&!p[N]),x=Bh(e,f.startContainer,i),y=oy(e,f.startContainer,a);let C=null;h.length>0?(C=Jy(e,f,h),x.length>0&&cm(e,C,x),y&&vs(e,C)):x.length>0?(C=Fh(e,f,x),y&&vs(e,C)):y?C=ry(e,f):f.deleteContents();const b=document.createElement("span");Qy(b,g,p),r&&_y(b,r),i!=null&&i.color&&Du(b,"color",i.color),i!=null&&i.backgroundColor&&Du(b,"backgroundColor",i.backgroundColor),a&&Qb(b,a),s&&zy(b,s),b.textContent=t;const v=b.style.cssText.trim()?b:document.createTextNode(t);C?((A=C.parentNode)==null||A.insertBefore(v,C),C.nodeType===Node.TEXT_NODE&&!C.data&&((R=C.parentNode)==null||R.removeChild(C))):f.insertNode(v);const k=document.createRange();k.selectNodeContents(v),k.collapse(!1),u.removeAllRanges(),u.addRange(k)}const gi=["p","h1","h2","h3","h4","h5","h6"],tx=new Set(gi),ef=new Set([...gi,"div"]),Ni=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),nx=()=>({tag:null,mixed:!1});function tf(e){return tx.has(e)}function rx(e){return tf(e)?e:e==="div"?"p":null}function ox(e){return e instanceof Element&&Ni.has(he(e))}function nf(e){return e instanceof HTMLElement&&!st(e)&&ef.has(he(e))}function Es(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=he(e);return ef.has(t)||Ni.has(t)?!1:St(e)||t==="br"||t==="a"||t==="img"||t==="span"}function ix(e,t){let n=Hr(t);for(;n&&n!==e;){if(Ni.has(he(n)))return!0;n=n.parentElement}return!1}function rf(e,t){let n=Hr(t);for(;n&&n!==e;){if(Rm(n,e)){n=n.parentElement;continue}if(nf(n))return n;if(Ni.has(he(n)))return null;n=n.parentElement}return null}function ax(e,t){const n=new Set,r=[];for(const i of il(t)){const a=rf(e,i);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function sx(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function lx(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let i=r,a=r;for(;i>0&&Es(n[i-1]);)i-=1;for(;a<n.length-1&&Es(n[a+1]);)a+=1;return n.slice(i,a+1)}function js(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&st(t)))return t;return null}function cx(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&&st(r)?js(e):r}return n.startContainer===t&&e!==t?js(e):sx(e,n.startContainer)}function ux(e,t,n){const r=hl(e);if(ix(e,t.startContainer))return!1;if(!js(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const i=cx(r,e,t);if(!i||i instanceof HTMLElement&&st(i)||ox(i)||nf(i)||!Es(i))return!1;const a=lx(r,i),s=document.createElement(n);r.insertBefore(s,a[0]);for(const u of a)s.appendChild(u);return!0}function dx(e){const t=kt(e);if(!t)return nx();const n=il(t).map(i=>{const a=rf(e,i);return a?rx(he(a)):null}),r=n[0];return n.every(i=>i===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function mx(e,t){if(!tf(t))return!1;const n=kt(e);if(!n)return!1;const r=Un(e,n.startContainer,n.startOffset),i=Un(e,n.endContainer,n.endOffset),a=Math.min(r,i),s=Math.max(r,i),u=ax(e,n);let f=!1;if(u.length===0)f=ux(e,n,t);else for(const g of u)he(g)!==t&&(sl(g,t),f=!0);return al(e,a,s),f}function Cl(e){if(!ot(e))return null;const t=Wn(e);if(!t)return null;const n=he(t);return n==="ul"||n==="ol"?n:null}function of(e){const t=Qn(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Cl),r=n[0];return n.every(i=>i===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function fx(e,t,n){const r=[...e.children].filter(i=>ol(i));for(const i of r)t.insertBefore(i,n)}function af(e){const t=Wn(e),n=document.createElement("p");for(const g of[...e.attributes])n.setAttribute(g.name,g.value);for(n.style.marginLeft="",mt(n);e.firstChild&&!ol(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 s=ot(a)?a.parentNode??a:a,u=ot(a)?a.nextSibling:t.nextSibling;e.remove();let f=null;if(r.length>0){f=document.createElement(t.tagName);for(const g of r)f.appendChild(g)}return s.insertBefore(n,u),f&&s.insertBefore(f,n.nextSibling),fx(e,s,n.nextSibling),t.childElementCount===0&&t.remove(),n}function gx(e){if(ot(e))return e;const t=sl(e,"li");return t.style.marginLeft="",mt(t),t}function sf(e,t){if(e.length===0)return!1;if(e.every(ot)){const a=Wn(e[0]);if(a&&e.every(s=>s.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return he(a)===t?!1:(sl(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 s=ot(a)?Wn(a):null;i.appendChild(gx(a)),s&&s!==i&&s.childElementCount===0&&s.remove()}return!0}function lf(e){let t=!1;for(const n of[...e].reverse())ot(n)&&(af(n),t=!0);return t}function px(e,t){return Jn(e,()=>{const n=zr(e);if(n.length===0)return!1;if(n.every(a=>Cl(a)===t))return lf(n);let i=!1;for(const a of im(n))sf(a,t)&&(i=!0);return i})}function hx(e,t){return Jn(e,()=>{const n=zr(e);if(n.length===0)return!1;if(t===null)return lf(n);if(n.every(a=>Cl(a)===t))return!1;let i=!1;for(const a of im(n))sf(a,t)&&(i=!0);return i})}const cf=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 uf(e,t){if(t<=0){e.style.marginLeft="",mt(e);return}e.style.marginLeft=`${t}px`}function bx(e){let t=e.previousElementSibling;for(;t;){if(ot(t))return t;t=t.previousElementSibling}return null}function yx(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(he(n)==="ul"||he(n)==="ol"))return n}return null}function xx(e){const t=bx(e);if(!t)return!1;const n=Wn(e);if(!n)return!1;const r=he(n)==="ol"?"ol":"ul";let i=yx(t);return(!i||he(i)!==r)&&(i=document.createElement(r),t.appendChild(i)),i.appendChild(e),!0}function Cx(e){const t=Wn(e);if(!t)return!1;const n=t.parentElement;if(n&&ot(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return af(e),!0}function wx(e){return Qn(e).some(n=>ot(n)||wl(n)>0)}function vx(e){return Jn(e,()=>{const t=zr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(ot(r)){xx(r)&&(n=!0);continue}uf(r,wl(r)+cf),n=!0}return n})}function Sx(e){return Jn(e,()=>{const t=Qn(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(ot(r)){Cx(r)&&(n=!0);continue}const i=wl(r);i<=0||(uf(r,Math.max(0,i-cf)),n=!0)}return n})}function Mi(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function yn(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 Je(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let i=0;for(let a=0;a<t;a+=1){const s=e.rows[a];let u=0;for(const f of Array.from(s.cells)){for(;n[a][u];)u+=1;const g=Mi(f),p={cell:f,originRow:a,originCol:u,rowSpan:g.rowSpan,colSpan:g.colSpan};r.push(p);for(let h=0;h<g.rowSpan;h+=1){const x=a+h;if(x>=t)break;for(let y=0;y<g.colSpan;y+=1)n[x][u+y]=p}u+=g.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 pi(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function gt(e,t){return e.unique.find(n=>n.cell===t)??null}function df(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 mf(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 kx(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 s=pi(e,i,a);!s||n.has(s.cell)||(n.add(s.cell),r.push(s.cell))}return r}function ff(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=pi(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 s=t.minCol;s<=t.maxCol;s+=1){const u=pi(e,a,s);if(!u||df(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 Ax(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 s=i.minCol;s<=i.maxCol;s+=1){const u=pi(e,a,s);if(!u)return!1;if(u.cell!==t.cell&&df(u,i))return!1}return!0}const Bu=10,Hn=1,zn=50,Px="1px solid #000",Dx="0.25em",Ex=new Set(["td","th"]);function gf(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=Hn&&t>=Hn&&e<=zn&&t<=zn}function $e(e,t){return Sl(e,t,n=>n instanceof HTMLTableElement)}function hi(e,t){return Sl(e,t,n=>Hx(n))}function jx(e,t){return Sl(e,t,n=>n instanceof HTMLTableRowElement)}function vl(e){return $e(e,kl(e))}function At(e){return hi(e,kl(e))}function pf(e){return jx(e,kl(e))}function Rx(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function $r(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!ce(e,n.commonAncestorContainer))return[];const r=hi(e,n.startContainer),i=hi(e,n.endContainer);if(!r)return[];if(!i||r===i)return[r];const a=$e(e,r);if(!a||$e(e,i)!==a)return[r];const s=Je(a),u=gt(s,r),f=gt(s,i);if(!u||!f)return[r];const g=mf([u,f]);if(!g)return[r];const p=kx(s,g);return p.length>0?p:[r]}function Tx(e,t){if(!gf(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ce(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 f=document.createElement("tr");for(let g=0;g<t.cols;g+=1)f.appendChild(zx("td"));a.appendChild(f)}i.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(i),Ux(e,i);const s=i.querySelector("td, th");return s instanceof HTMLTableCellElement&&Ke(s),!0}function Rs(e,t){var h,x,y,C;const n=At(e);if(!n)return!1;const r=$e(e,n);if(!r)return!1;const i=Je(r),a=gt(i,n);if(!a)return!1;const s=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const b of i.unique)if(b.originRow<s&&b.originRow+b.rowSpan>s){yn(b.cell,b.colSpan,b.rowSpan+1);for(let v=b.originCol;v<b.originCol+b.colSpan;v+=1)u.add(v)}const f=document.createElement("tr"),g=Math.min(s,i.rowCount-1);for(let b=0;b<i.colCount;b+=1){if(u.has(b))continue;const v=((x=(h=i.slots[g])==null?void 0:h[b])==null?void 0:x.cell)??n;f.appendChild(Al(v))}if(s>=r.rows.length)(y=r.rows[r.rows.length-1].parentNode)==null||y.appendChild(f);else{const b=r.rows[s];(C=b.parentNode)==null||C.insertBefore(f,b)}const p=Kx(f,i.colCount,u,a.originCol);return Ke(p||n),!0}function Hu(e,t){var g,p,h,x;const n=At(e);if(!n)return!1;const r=$e(e,n);if(!r)return!1;const i=Je(r),a=gt(i,n);if(!a)return!1;const s=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const y of i.unique)if(y.originCol<s&&y.originCol+y.colSpan>s){yn(y.cell,y.colSpan+1,y.rowSpan);for(let C=y.originRow;C<y.originRow+y.rowSpan;C+=1)u.add(C)}let f=null;for(let y=0;y<i.rowCount;y+=1){if(u.has(y))continue;const C=((p=(g=i.slots[y])==null?void 0:g[Math.min(s,Math.max(0,i.colCount-1))])==null?void 0:p.cell)??((x=(h=i.slots[y])==null?void 0:h[Math.max(0,s-1)])==null?void 0:x.cell)??n,b=Al(C);Pl(r,y,s,b),y===a.originRow&&(f=b)}return f&&Ke(f),!0}function Nx(e){var x,y;const t=At(e);if(!t)return!1;const n=$e(e,t);if(!n)return!1;const r=Je(n),i=gt(r,t);if(!i)return!1;if(r.rowCount<=1)return Ts(e,n);const a=i.originRow,s=a+1,u=[];for(const C of r.unique)C.originRow<=a&&C.originRow+C.rowSpan>a&&(C.originRow<a?yn(C.cell,C.colSpan,C.rowSpan-1):C.originRow===a&&C.rowSpan>1&&u.push(C));u.sort((C,b)=>C.originCol-b.originCol);for(const C of u)yn(C.cell,C.colSpan,C.rowSpan-1),Pl(n,s,C.originCol,C.cell);const f=i.originCol;n.rows[a].remove();const g=n.rows[Math.min(a,n.rows.length-1)],p=Je(n),h=(y=(x=p.slots[Math.min(a,p.rowCount-1)])==null?void 0:x[Math.min(f,Math.max(0,p.colCount-1))])==null?void 0:y.cell;return h?Ke(h):g!=null&&g.cells[0]?Ke(g.cells[0]):Gx(n),!0}function Mx(e){var g,p,h;const t=At(e);if(!t)return!1;const n=$e(e,t);if(!n)return!1;const r=Je(n),i=gt(r,t);if(!i)return!1;if(r.colCount<=1)return Ts(e,n);const a=i.originCol,s=i.originRow;for(const x of r.unique)a<x.originCol||a>=x.originCol+x.colSpan||(x.colSpan===1?x.cell.remove():yn(x.cell,x.colSpan-1,x.rowSpan));const u=Je(n);if(u.colCount===0||u.unique.length===0)return Ts(e,n);const f=((p=(g=u.slots[Math.min(s,u.rowCount-1)])==null?void 0:g[Math.min(a,u.colCount-1)])==null?void 0:p.cell)??((h=u.unique[0])==null?void 0:h.cell);return f&&Ke(f),!0}function _x(e,t){const n=At(e);if(!n)return!1;const r=$e(e,n);if(!r)return!1;const i=Rx(r),a=i.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Ke(i[a-1]),{changed:!1});if(a<i.length-1)return Ke(i[a+1]),{changed:!1};const s=n.parentElement;if(!Rs(e,"below"))return!1;const u=s instanceof HTMLTableRowElement?s.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Ke(u.cells[0]),{changed:!0}}function Lx(e,t){return!ce(e,t)||t===e?!1:(Ke(t),!0)}function zu(e){return hf(e)!==null}function Ou(e){const t=At(e);if(!t)return!1;const n=Mi(t);return n.colSpan>1||n.rowSpan>1}function Ix(e){const t=hf(e);if(!t)return!1;const n=$e(e,t.origin.cell);return n?bf(n,t):!1}function Fx(e){const t=At(e);if(!t)return!1;const n=$e(e,t);return n?yf(n,t):!1}function Bx(e,t,n){const r=At(e);if(!r)return!1;const i=$e(e,r);if(!i)return!1;const a=Je(i),s=gt(a,r);if(!s)return!1;const u=Math.min(a.colCount-s.originCol,Math.max(1,Math.floor(t))),f=Math.min(a.rowCount-s.originRow,Math.max(1,Math.floor(n)));if(u===s.colSpan&&f===s.rowSpan||!Ax(a,s,u,f))return!1;if((s.colSpan>1||s.rowSpan>1)&&yf(i,r),u===1&&f===1)return Ke(r),!0;const g=Je(i),p=ff(g,{minRow:s.originRow,maxRow:s.originRow+f-1,minCol:s.originCol,maxCol:s.originCol+u-1});return p?bf(i,p):!0}function Sl(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function Hx(e){return Ex.has(e.tagName.toLowerCase())}function kl(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ce(e,n.commonAncestorContainer)?n.startContainer:null}function hf(e){const t=$r(e);if(t.length<2)return null;const n=$e(e,t[0]);if(!n)return null;const r=Je(n),i=[];for(const u of t){const f=gt(r,u);if(!f)return null;i.push(f)}const a=mf(i);if(!a)return null;const s=ff(r,a);return!s||s.cells.length<2?null:s}function bf(e,t){const n=t.origin.cell,r=Je(e),i=t.cells.map(a=>gt(r,a)).filter(a=>a!==null).sort((a,s)=>a.originRow-s.originRow||a.originCol-s.originCol);for(const a of i)a.cell!==n&&$x(n,a.cell);yn(n,t.colSpan,t.rowSpan);for(const a of i)a.cell!==n&&a.cell.remove();return Ke(n),!0}function yf(e,t){const n=Je(e),r=gt(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;yn(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||Pl(e,i,a,Al(t));return Ke(t),!0}function zx(e){const t=document.createElement(e);return t.style.border=Px,t.style.padding=Dx,t.appendChild(document.createElement("br")),t}function Al(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 Ox(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Pl(e,t,n,r){const i=e.rows[t];if(!i)return;const a=Je(e);let s=0;for(const u of Array.from(i.cells)){if(u===r)continue;const f=gt(a,u);if(!f||f.originCol>=n)break;s+=1}Ox(i,s,r)}function Kx(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 Ku(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 $x(e,t){if(!(e===t||Ku(t)))for(Ku(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function Ux(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),Wx(n)&&n.remove())}function Wx(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 Ts(e,t){if(!t.parentNode||!ce(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 Ke(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Gx(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const xf=["left","center","right","justify"];function Vx(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function bi(e){return Vx(e.style.textAlign)}function Ns(e,t){const n=t??"left";return bi(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 $u(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function Cf(e){const t=$r(e);if(t.length>0)return $u(t.map(bi));const n=Qn(e);return n.length===0?kt(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:$u(n.map(bi))}function wf(e,t){return xf.includes(t)?Jn(e,()=>{const n=$r(e);if(n.length>0){let a=!1;for(const s of n)Ns(s,t)&&(a=!0);return a}const r=zr(e);if(r.length===0)return!1;let i=!1;for(const a of r)Ns(a,t)&&(i=!0);return i}):!1}function Rr(){return{...ul(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function Uu(e){const t=ub(e),n=Cf(e),r=of(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function vf(e,t){let n=!1;return!t.alignMixed&&t.align&&wf(e,t.align)&&(n=!0),t.listMixed||hx(e,t.list)&&(n=!0),db(e,t)&&(n=!0),n}function Zx(e,t){return vf(e,Ms(t))}function Sf(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 Ms(e){const t=Rr();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 qx=2*1024*1024,Yx="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",Xx=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),Jx=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),Qx=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,e1=/^(javascript|vbscript|file|blob):/i;function t1(e={}){return{src:"",alt:"",title:"",...e}}function nr(e){const t=e.trim();if(!t)return"empty";if(e1.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return Qx.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 n1(e){return e.size>qx?"tooLarge":s1(e)?null:"type"}function r1(e){const t=n1(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(nr(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function o1(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",i1(e,t.css)}function i1(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(),s=r.slice(i+1).trim();a&&s&&e.style.setProperty(a,s)}}function a1(e,t){const n=t1(t);if(nr(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ce(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("img");return o1(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function _s(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function os(e,t){if(!ce(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 s1(e){const t=e.type.trim().toLowerCase();if(t&&Xx.has(t))return!0;const n=l1(e.name);return!!(!t&&n&&Jx.has(n))}function l1(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const kf=["%","px","pt","pc","em","rem"],c1="%",u1={"%":[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]},Yn={"%":{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}},d1=new Set(kf),m1=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function f1(e){return d1.has(e)}function On(e){return`${J(e.value)}${e.unit}`}function yi(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(m1);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 f1(i)?Xn(r,i):null}function Wu(e,t){const n=e.trim();if(!n)return null;const r=yi(n);if(r)return r;const i=Number(n.replace(",","."));return Number.isFinite(i)?Xn(i,t):null}function Xn(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Yn[t];return{value:_e(Math.min(r,Math.max(n,e))),unit:t}}function Tr(e,t,n){const r=n>0?n:1;if(e==="width"){const a=Xn(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:Xn(t.value*r,t.unit)??t,height:t}}const Qo="data-hover-css",Dl=["fill","contain","cover","none","scale-down"],El=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],g1=new Set(Dl),p1=new Set(El),Gu="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",h1="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",b1=/^-?[a-z][a-z0-9-]*$/i,y1=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,Ls=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function Af(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...ft},border:{...cl},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function x1(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function C1(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=Tr("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=Tr("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function w1(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(),s=r.slice(i+1).trim();!a||!s||b1.test(a)&&(a==="behavior"||a.endsWith("binding")||y1.test(s)||t.push(`${a}: ${s}`))}return t.join("; ")}function Yt(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!ce(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&&ce(e,r))return r}return _s(e,n.commonAncestorContainer)}function v1(e){const t=Yt(e);return t?Pf(t):null}function Pf(e){const t=er(e),n=D1(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,i=k1(e);return Af({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:Ef(e),objectPosition:T1(e),rotateDeg:jf(e),hoverCss:e.getAttribute(Qo)??""})}function Df(e,t){let n=!1;return A1(e,t)&&(n=!0),tr(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:ft,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),E1(e,t.align)&&(n=!0),j1(e,t.objectFit)&&(n=!0),R1(e,t.objectPosition)&&(n=!0),M1(e,t.rotateDeg)&&(n=!0),_1(e,t.hoverCss)&&(n=!0),n}function S1(e,t){const n=Yt(e);return n?Df(n,t):!1}function k1(e){const t=yi(e.style.width),n=yi(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 A1(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=P1(t);return r.width?e.style.width=On(r.width):e.style.removeProperty("width"),r.height?e.style.height=On(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 P1(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 D1(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 E1(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 Ef(e){const t=e.style.objectFit.trim().toLowerCase();return g1.has(t)?t:null}function j1(e,t){return Ef(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function R1(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 T1(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(p1.has(t),t):null}function jf(e){const t=Ls.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?_e(n):null}function N1(e){const t=e.trim();return t?Ls.test(t)&&t.replace(Ls,"").trim()==="":!0}function M1(e,t){const n=jf(e),r=t===null||t===0?null:_e(t);return n===r?!1:r===null?N1(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${J(r)}deg)`,!0)}function _1(e,t){const n=w1(t),r=e.getAttribute(Qo)??"",i=e.getAttribute("onmouseover")??"";return r===n&&(n&&i===Gu||!n&&!i)?!1:n?(e.setAttribute(Qo,n),e.setAttribute("onmouseover",Gu),e.setAttribute("onmouseout",h1),!0):(e.removeAttribute(Qo),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const $n={value:100,unit:"%"},L1=new Set(Dl),I1=new Set(El),F1=new Set(["cover","contain","scale-down","none"]),Vu={contain:"contain",cover:"cover",auto:"none"},Zu={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function jl(){return{src:null,opacity:null,fit:null,position:null,width:{...$n},height:null}}function Rf(e){return e!=null&&F1.has(e)}function Tf(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?Qt(n):null}function B1(e,t){const n=Tf(e),r=t===null?null:Qt(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=xm(r),!0)}function Nf(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 H1(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function z1(e,t){const n=Nf(e),r=(t==null?void 0:t.trim())??"",i=r&&nr(r)===null?r:null;return n===i?!1:(i?e.style.backgroundImage=H1(i):e.style.removeProperty("background-image"),!0)}function Mf(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function is(e){return!e||e==="auto"?null:yi(e)}function O1(e){return Rf(e.fit)&&e.fit?Zu[e.fit]:e.fit==="fill"?Zu.fill:e.width&&e.height?`${On(e.width)} ${On(e.height)}`:e.width?On(e.width):e.height?`auto ${On(e.height)}`:null}function K1(e){const t=Mf(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...$n},height:{...$n}};if(Vu[t])return{fit:Vu[t],width:null,height:null};if(L1.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:is(n[0]),height:null}:n.length===2?{fit:null,width:is(n[0]),height:is(n[1])}:{fit:null,width:null,height:null}}function $1(e,t){const n=Mf(e.style.backgroundSize),r=O1(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function U1(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(I1.has(t),t):null}function W1(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 Is(e){let t=!1;return e.id!==ui&&(e.id=ui,t=!0),e.hasAttribute(ci)||(e.setAttribute(ci,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function _f(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 G1(e){const t=gl(e),n=t[0]??null;if(n){let i=Is(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 Is(r),_f(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function V1(e){const t=gl(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function qu(e){let t=!1;return pl(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 Z1(e){const t=pl(e);if(!t)return jl();const n=K1(t);return{src:Nf(t),opacity:Tf(t),fit:n.fit,position:U1(t),width:n.width,height:n.height}}function q1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&nr(n)===null)){const f=V1(e),g=qu(e);return(f||g)&&mt(e),f||g}const i=G1(e),a=i.layer;let s=i.changed;return Is(a)&&(s=!0),_f(a)&&(s=!0),qu(e)&&(s=!0),z1(a,n)&&(s=!0),$1(a,t)&&(s=!0),W1(a,t.position)&&(s=!0),B1(a,t.opacity)&&(s=!0),s&&(mt(a),mt(e)),s}function Y1(){return{size:null,unit:hn,marks:Lt(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function Fs(){return{font:Y1(),box:ul(),backgroundImage:jl(),atRule:Zt()}}function Bs(e,t){return t?{top:t.top!==void 0?t.top:e.top,right:t.right!==void 0?t.right:e.right,bottom:t.bottom!==void 0?t.bottom:e.bottom,left:t.left!==void 0?t.left:e.left}:e}function X1(e,t){if(!t)return e;const{margin:n,padding:r,...i}=t;return{...e,...i,margin:n?Bs(e.margin,n):e.margin,padding:r?Bs(e.padding,r):e.padding}}function J1(e,t){if(!t)return e;const{marks:n,...r}=t;return{...e,...r,marks:n?{...e.marks,...n}:e.marks}}function Q1(e,t){const{margin:n,...r}=t.atRule??{};return{font:J1(e.font,t.font),box:X1(e.box,t.box),backgroundImage:t.backgroundImage?{...e.backgroundImage,...t.backgroundImage}:e.backgroundImage,atRule:t.atRule?{...e.atRule,...r,margin:n?Bs(e.atRule.margin,n):e.atRule.margin}:e.atRule}}function eC(e){return e?!!(e.font||e.box||e.backgroundImage||e.atRule):!1}function Yu(e,t){if(!eC(t))return e;const n=document.createElement("div");n.innerHTML=e;const r=Q1(Lf(n),t);return If(n,r).pageHtml}function tC(e){const t=e.style.fontSize,n=t?Qs(t):null,r=n&&Pi(n.unit)?{value:n.value,unit:n.unit}:null,i=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),s={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,f=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??hn,marks:s,fontFamily:f||null,fontFamilyMixed:!1,fontColor:u?we(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function nC(e,t){const n=e.style.fontSize,r=t.size===null?null:bn(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const i=Js(r.value,r.unit);return n===i?!1:(e.style.fontSize=i,!0)}function rC(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 Kr(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function oC(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?we(t.fontColor):null;return(e.style.color?we(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function iC(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 s=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==s&&(s?e.style.textDecoration=s:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function aC(e,t){let n=!1;return nC(e,t)&&(n=!0),rC(e,t)&&(n=!0),oC(e,t)&&(n=!0),iC(e,t.marks)&&(n=!0),n&&mt(e),n}function sC(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function Lf(e){const t=sn(e);if(!t)return Fs();const n=er(t);return{font:tC(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:Z1(t),atRule:qt(e.innerHTML)}}function If(e,t){const n=kt(e),r=n?Un(e,n.startContainer,n.startOffset):null,i=n?Un(e,n.endContainer,n.endOffset):null,a=sn(e),s=Nm(e);jr(s);const u=aC(s,t.font),f=tr(s,sC(t)),g=q1(s,t.backgroundImage);Ei(e);const p=qt(e.innerHTML),h=Dm(e.innerHTML,t.atRule),x=Gn(h);x!==Gn(e.innerHTML)&&(e.innerHTML=x),Or(e,h);const y=JSON.stringify(p)!==JSON.stringify(t.atRule);return r!==null&&i!==null&&al(e,Math.min(r,i),Math.max(r,i)),{changed:!a||u||f||g||y,pageHtml:h}}function lC(e,t){const n=t??e.innerHTML,r=Em(n);return _r(n)?(e.innerHTML=Gn(r),Ei(e),Or(e,r),{changed:!0,pageHtml:r}):{changed:!1,pageHtml:r}}const cC=/<script\b[^>]*>[\s\S]*?<\/script>/gi,uC=/^\s*javascript\s*:/i;function dC(e){return e.replace(/&(#x[0-9a-f]+|#\d+|amp|lt|gt|quot);/gi,(t,n)=>{const r=n.toLowerCase();if(r==="amp")return"&";if(r==="lt")return"<";if(r==="gt")return">";if(r==="quot")return'"';if(r.startsWith("#x")){const i=Number.parseInt(r.slice(2),16);return Number.isFinite(i)?String.fromCodePoint(i):t}if(r.startsWith("#")){const i=Number.parseInt(r.slice(1),10);return Number.isFinite(i)?String.fromCodePoint(i):t}return t}).replace(/\\([0-7]{1,3})/g,(t,n)=>{const r=Number.parseInt(n,8);return Number.isFinite(r)?String.fromCodePoint(r):t})}function Ff(e){const t=dC(e).replace(/[\u0000-\u001F\u007F\s]+/g,"");return uC.test(t)}function mC(e){return e.split(";").map(t=>t.trim()).filter(t=>{if(!t)return!1;const n=t.indexOf(":");if(n<=0)return!0;const r=t.slice(n+1);return!Ff(r)&&!/url\s*\(\s*["']?\s*javascript:/i.test(r)}).join("; ")}function fC(e){const t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const n of t)for(const r of[...n.attributes]){if(Ff(r.value)){n.removeAttribute(r.name);continue}if(r.name.toLowerCase()==="style"){const i=mC(r.value);i?i!==r.value&&n.setAttribute(r.name,i):n.removeAttribute(r.name)}}}function gC(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function pC(e){return e.body.innerHTML}function Hs(e){if(!e.trim())return e;const n=e.replace(cC,"");if(!/javascript\s*:/i.test(n))return n;const r=gC(n);return fC(r.body),pC(r)}function ei(e){if(!e.trim())return e;const n=Me(e);return n.length===1?Hs(e):nt(n.map(Hs))}const Rl="data-hover-html",hC="noopener noreferrer",bC="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)",yC="this._hoverBox&&this._hoverBox.remove()",xC=/^(#(?:[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 _i(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function CC(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function Fr(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&CC(n))return n;n=n.parentNode}return null}function Bf(e){return xC.test(e)}function wC(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&&Bf(r)?r:null}function Hf(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function vC(e){const t=e.getAttribute(Rl)??"",n=wC(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:Hf(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function zf(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!ce(e,n.commonAncestorContainer))return null;const r=Fr(e,n.commonAncestorContainer);return r?vC(r):null}function SC(e){return zf(e)!==null}function kC(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(Rl)}function AC(e,t){var r;if(kC(e),t.hoverMode==="html"){const i=t.hoverHtml.trim();if(!i)return;e.setAttribute(Rl,i),e.setAttribute("onmouseover",bC),e.setAttribute("onmouseout",yC);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!Bf(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function Tl(e,t){const n=_i(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",hC)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":Hf(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),AC(e,n)}function PC(e,t){const n=new Set;for(const r of t){const i=Fr(e,r);i&&!n.has(i)&&n.add(i)}for(const r of n)Xe(r)}function DC(e,t,n){vt(t);const r=Ue(t).filter(u=>u.data.length>0);PC(e,r),r.length>0&&xn(r);const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);vt(a);const s=document.createElement("a");Tl(s,n);try{return a.surroundContents(s),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(s.appendChild(u),a.insertNode(s),!0):!1}}function EC(e,t){const n=document.createElement("a");Tl(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 jC(e,t){const n=t.href.trim();if(!n)return!1;const r=_i({...t,href:n}),i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!ce(e,a.commonAncestorContainer))return!1;const s=Fr(e,a.startContainer),u=Fr(e,a.endContainer);return s&&s===u?(Tl(s,r),!0):a.collapsed?EC(a,r):DC(e,a,r)}const RC=/^[A-Za-z][A-Za-z0-9_-]*$/,Of="​";function zs(e){var r;const t=hl(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 TC(e){return new Set(zs(e).map(t=>t.id))}function Kf(e,t){const n=e.trim();return n?RC.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function Xu(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Of)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function NC(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Of)),(r=e.parentNode)==null||r.insertBefore(n,e)}function MC(e,t){const n=t.trim();if(Kf(n,TC(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ce(e,i.commonAncestorContainer))return!1;const a=Fr(e,i.startContainer);if(a)return NC(a,n),!0;if(i.collapsed)return Xu(i,n),!0;vt(i);const s=document.createElement("span");s.id=n;try{return i.surroundContents(s),!0}catch{return Xu(i,n),!0}}const Le="data-comment-thread",Ju="wysiwyg-comment-anchor";function _C(){return`cmt_${crypto.randomUUID()}`}function LC(){return crypto.randomUUID()}const xi=20;function Qu(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${Le}]`);return r instanceof HTMLElement&&ce(t,r)?r:null}function ed(e,t,n){var x;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let i=Math.max(0,t),a=Math.max(t,n),s=null,u=0,f=null,g=0,p;for(;p=r.nextNode();){const y=p,C=((x=y.textContent)==null?void 0:x.length)??0;if(!s&&i<=C&&(s=y,u=i),!f&&a<=C){f=y,g=a;break}i-=C,a-=C}if(!s||!f)return null;const h=document.createRange();return h.setStart(s,u),h.setEnd(f,g),h}function IC(e,t,n){const r=e.textContent??"",i=r.slice(Math.max(0,t-xi),t),a=r.slice(n,n+xi);return{prefix:i,suffix:a}}function FC(e,t){if(t.mode!=="visual")return null;const n=Yt(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}=IC(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:i}}function td(e,t){if(t.mode!=="visual")return null;const n=Yt(e);if(n!=null&&n.hasAttribute(Le))return n.getAttribute(Le)??null;if(t.visualRange){const r=Qu(t.visualRange.startContainer,e);if(r)return r.getAttribute(Le)??null;const i=Qu(t.visualRange.endContainer,e);if(i)return i.getAttribute(Le)??null}return null}function Os(e,t,n){if(!ce(e,n.commonAncestorContainer))return!1;vt(n);const r=document.createElement("span");r.setAttribute(Le,t);try{return n.surroundContents(r),!0}catch{const i=n.toString();if(!i)return!1;const a=document.createElement("span");return a.setAttribute(Le,t),a.textContent=i,n.deleteContents(),n.insertNode(a),!0}}function $f(e,t){e.setAttribute(Le,t)}function BC(e,t,n){const r=Yt(e);return r?($f(r,t),!0):n.visualRange?Os(e,t,n.visualRange):!1}function HC(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 zC(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const s=ed(e,n.start,n.end);if(s&&s.toString()===n.text)return Os(e,t,s)}const r=e.textContent??"",i=n.text;if(!i)return!1;let a=0;for(;a<=r.length;){const s=r.indexOf(i,a);if(s===-1)return!1;const u=s+i.length,f=r.slice(Math.max(0,s-xi),s),g=r.slice(u,u+xi);if(n.prefix!==void 0&&f!==n.prefix){a=s+1;continue}if(n.suffix!==void 0&&g!==n.suffix){a=s+1;continue}const p=ed(e,s,u);return p?Os(e,t,p):!1}return!1}function OC(e,t){for(const n of t)if(!e.querySelector(`[${Le}="${n.id}"]`)){if(n.anchor.type==="image"){const i=HC(e,n.anchor);i&&$f(i,n.id);continue}zC(e,n.id,n.anchor)}}function nd(e,t){for(const n of e.querySelectorAll(`[${Le}]`))n instanceof HTMLElement&&(t?n.classList.add(Ju):n.classList.remove(Ju))}function rd(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${Le}]`);return r instanceof HTMLElement&&ce(e,r)?r:null}function od(e,t){const n=e.querySelector(`[${Le}="${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 s=document.createTreeWalker(n,NodeFilter.SHOW_TEXT).nextNode();s instanceof Text?(i.setStart(s,0),i.collapse(!0)):(i.selectNodeContents(n),i.collapse(!0))}return r.removeAllRanges(),r.addRange(i),!0}function KC(e,t=[]){return{id:_C(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function $C(e,t){return{id:LC(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function UC(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function WC(e,t){return e.find(n=>n.id===t)}function Uf(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return ce(e,n.commonAncestorContainer)?n:null}function GC(e){const t=Uf(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 Wf(e){const t=Uf(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 VC(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 Gf(e){const t=GC(e);return t?VC(t):!1}async function ZC(e){return await Gf(e)?Wf(e):!1}const qC=new Set(["strong","b","em","i","u","s","strike","del"]),YC=["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 XC(e){for(const t of YC)e.style.removeProperty(t)}function JC(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!St(r)){n=r;continue}if(an(r,n),qC.has(r.tagName.toLowerCase())){Xe(r);continue}if(XC(r),on(r)){Xe(r);continue}n=r.isConnected?r:t}}function QC(e){const t=kt(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;vt(t);const r=Ue(t).filter(i=>i.data.length>0);if(r.length===0)return!1;for(const i of r)JC(e,i);return xn(r),e.innerHTML!==n}function ew(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function tw(e){const t=Bn(e),n=Wm(e),r=Hm(e),i=ii(e,"color"),a=ii(e,"backgroundColor"),s=Vm(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:s.mixed?null:s.value,customCssMixed:s.mixed}}function nw(e,t){t.size!==null&&ks(e,t.size,t.unit);const n=Bn(e);for(const r of it)t.marks[r]!==n[r]&&Ds(e,r);return t.fontFamilyMixed||ws(e,t.fontFamily),t.fontColorMixed||Er(e,"color",t.fontColor),t.highlightColorMixed||Er(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&qm(e,t.customCss),!0}function ti(){return typeof window<"u"&&"speechSynthesis"in window}function rw(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function id(e,t){const n=e.text.trim();return n||rw(t)||null}function ow(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!ti())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 ti()&&t.speaking},cancel(){ti()&&t.speaking&&(t.cancel(),n())}}}const iw=5*1024*1024,aw="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",sw=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),lw=new Set(["mp3","wav","ogg","aac","webm","m4a"]),cw=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,uw=/^(javascript|vbscript|file|blob):/i;function dw(e={}){return{src:"",title:"",...e}}function Nl(e){const t=e.trim();if(!t)return"empty";if(uw.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return cw.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 mw(e){return e.size>iw?"tooLarge":bw(e)?null:"type"}function fw(e){const t=mw(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const a=String(i.result??"");if(Nl(a)){r(new Error("invalid"));return}n(a)},i.onerror=()=>r(i.error??new Error("Failed to read file")),i.readAsDataURL(e)})}function gw(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%",pw(e,t.css)}function pw(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(),s=r.slice(i+1).trim();a&&s&&e.style.setProperty(a,s)}}function hw(e,t){const n=dw(t);if(Nl(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ce(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=document.createElement("audio");return gw(a,n),i.insertNode(a),i.setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}function bw(e){const t=e.type.trim().toLowerCase();if(t&&sw.has(t))return!0;const n=yw(e.name);return!!(!t&&n&&lw.has(n))}function yw(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Vf=/^(javascript|vbscript|file|blob):/i,xw=[/(?: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 Cw(e={}){return{url:"",title:"",...e}}function ww(e={}){return{src:"",title:"",...e}}function Li(e){const t=e.trim();if(!t)return null;for(const n of xw){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function Zf(e){return`https://www.youtube.com/embed/${e}`}function qf(e){const t=e.trim();return t?Vf.test(t)?"invalid":Li(t)?null:"invalid":"empty"}function vw(e){const t=e.trim();if(!t)return"empty";if(Vf.test(t))return"invalid";if(Li(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 Yf(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(),s=r.slice(i+1).trim();a&&s&&e.style.setProperty(a,s)}}function Xf(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",Yf(e,n.css)}function Sw(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%",Yf(e,t.css)}function kw(e,t){const n=Cw(t);if(qf(n.url))return!1;const r=Li(n.url);if(!r)return!1;const i=window.getSelection();if(!i||i.rangeCount===0)return!1;const a=i.getRangeAt(0);if(!ce(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const s=document.createElement("iframe");return Xf(s,Zf(r),n),a.insertNode(s),a.setStartAfter(s),a.collapse(!0),i.removeAllRanges(),i.addRange(a),!0}function Aw(e,t){const n=ww(t);if(vw(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const i=r.getRangeAt(0);if(!ce(e,i.commonAncestorContainer))return!1;i.collapsed||i.deleteContents();const a=Li(n.src);if(a){const s=document.createElement("iframe");Xf(s,Zf(a),{title:n.title,css:n.css}),i.insertNode(s),i.setStartAfter(s)}else{const s=document.createElement("video");Sw(s,n),i.insertNode(s),i.setStartAfter(s)}return i.collapse(!0),r.removeAllRanges(),r.addRange(i),!0}const Pw=new Set(["p","h1","h2","h3","h4","h5","h6"]),Dw=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function Jf(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!ce(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const i=Ew(e,r.startContainer);if(i){const s=jw(i,r);return(a=i.parentNode)==null||a.insertBefore(t,s),sd(t),!0}return r.insertNode(t),Rw(e,t),Mw(t),sd(t),!0}function Ew(e,t){let n=Hr(t);for(;n&&n!==e;){const r=he(n);if(Pw.has(r)&&n instanceof HTMLElement)return n;if(Dw.has(r))return null;n=n.parentElement}return null}function jw(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),ad(e),ad(i),(a=e.parentNode)==null||a.insertBefore(i,e.nextSibling),i}function Rw(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!Tw(n))return;an(n,t),Xe(n)}}function Tw(e){const t=he(e);return St(e)||t==="a"}function ad(e){Nw(e)&&e.appendChild(document.createElement("br"))}function Nw(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 Mw(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 sd(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 _w="1em 0",Lw="1px solid #d0d0d0";function Iw(){const e=document.createElement("hr");return e.style.margin=_w,e.style.border="0",e.style.borderTop=Lw,e}function Fw(e){return Jf(e,Iw())}const Bw="1.5em 0",Hw="2px dashed #bbb";function zw(){const e=document.createElement("div");return e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=Bw,e.style.border="0",e.style.borderTop=Hw,e.style.height="0",e}function Ow(e){return Jf(e,zw())}const Ft=16;function ld(e){return Math.min(Yn.px.max,Math.max(Ft,e))}function Kw(e){return e.width>0&&e.height>0?e.width/e.height:1}function $w(e,t){const n=Math.max(Ft,Ft*t),r=Math.min(Yn.px.max,Yn.px.max*t),i=Math.min(r,Math.max(n,e));return{width:i,height:i/t}}function Uw(e,t){const n=Math.max(Ft,Ft/t),r=Math.min(Yn.px.max,Yn.px.max/t),i=Math.min(r,Math.max(n,e));return{width:i*t,height:i}}function Ww(e,t,n){const r=Kw(t);return e==="e"?$w(t.width+n.x,r):e==="s"?Uw(t.height+n.y,r):{width:ld(t.width+n.x),height:ld(t.height+n.y)}}function Gw(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Ft,height:r>0?r:Ft}}function Vw(e,t,n){const r=Xn(Math.max(Ft,t),"px"),i=Xn(Math.max(Ft,n),"px");return!r||!i?!1:Df(e,{...Pf(e),sizeMode:"lock",width:r,height:i})}function Zw(e={}){return{border:{...cl},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function qw(e){const t=er(e);return{border:t.border,borderCollapse:Qw(e),borderSpacing:Qf(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:Ie(e.style.width)}}function Yw(e,t){let n=tr(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 e0(e,t.borderCollapse)&&(n=!0),t0(e,t.borderCollapse,t.borderSpacing)&&(n=!0),n0(e,t.width)&&(n=!0),n&&mt(e),n}function Xw(e){const t=vl(e);return t?qw(t):null}function Jw(e,t){const n=vl(e);return n?Yw(n,t):!1}function Qw(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function e0(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function Qf(e){const t=e.style.borderSpacing.trim();return t?Ie(t.split(/\s+/)[0]??""):null}function t0(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?rn(n):null,i=Qf(e);return rt(i,r)?!1:(r?e.style.borderSpacing=Ce(r):e.style.removeProperty("border-spacing"),!0)}function n0(e,t){const n=t?rn(t):null,r=Ie(e.style.width);return rt(r,n)?!1:(n?e.style.width=Ce(n):e.style.removeProperty("width"),!0)}const Ii=["top","middle","bottom","baseline"],r0=new Set(Ii);function o0(e={}){return{backgroundColor:null,color:null,padding:{...ft},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function i0(e){const t=er(e);return{backgroundColor:t.backgroundColor,color:eg(e),padding:t.padding,textAlign:u0(e),verticalAlign:tg(e),width:Ie(e.style.width),...Mi(e)}}function a0(e,t){let n=tr(e,{margin:{...ft},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 c0(e,t.color)&&(n=!0),Ns(e,t.textAlign)&&(n=!0),d0(e,t.verticalAlign)&&(n=!0),m0(e,t.width)&&(n=!0),n&&mt(e),n}function s0(e){const t=At(e);return t?i0(t):null}function l0(e,t){const n=$r(e);if(n.length===0)return!1;let r=!1;for(const a of n)a0(a,t)&&(r=!0);const i=At(e);if(i){const a=Mi(i);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&Bx(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function eg(e){const t=e.style.color;return t?we(t):null}function c0(e,t){const n=t?we(t):null;return eg(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function u0(e){const t=bi(e);return t==="left"?null:t}function tg(e){const t=e.style.verticalAlign.trim().toLowerCase();return r0.has(t)?t:null}function d0(e,t){return tg(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function m0(e,t){const n=t?rn(t):null,r=Ie(e.style.width);return rt(r,n)?!1:(n?e.style.width=Ce(n):e.style.removeProperty("width"),!0)}const f0=new Set(Ii);function g0(e={}){return{backgroundColor:null,color:null,padding:{...ft},height:null,verticalAlign:null,...e}}function p0(e){const t=e.cells[0],n=t?er(t).padding:{...ft};return{backgroundColor:ng(e),color:rg(e),padding:n,height:Ie(e.style.height),verticalAlign:og(e)}}function h0(e,t){let n=!1;x0(e,t.backgroundColor)&&(n=!0),C0(e,t.color)&&(n=!0),v0(e,t.height)&&(n=!0),w0(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))tr(r,{margin:{...ft},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&&mt(e),n}function b0(e){const t=pf(e);return t?p0(t):null}function y0(e,t){const n=pf(e);return n?h0(n,t):!1}function ng(e){const t=e.style.backgroundColor;return t?we(t):null}function x0(e,t){const n=t?we(t):null;return ng(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function rg(e){const t=e.style.color;return t?we(t):null}function C0(e,t){const n=t?we(t):null;return rg(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function og(e){const t=e.style.verticalAlign.trim().toLowerCase();return f0.has(t)?t:null}function w0(e,t){return og(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function v0(e,t){const n=t?rn(t):null,r=Ie(e.style.height);return rt(r,n)?!1:(n?e.style.height=Ce(n):e.style.removeProperty("height"),!0)}const S0=1e3;function k0(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function A0({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 s=window.setInterval(()=>{const u=n.current;if(!u)return;const f=r.current();f!==i.current&&(i.current=f,queueMicrotask(()=>k0(u,f)))},S0);return()=>{window.clearInterval(s)}},[a])}function Oo({value:e,defaultValue:t,onChange:n}){const[r,i]=c.useState(t),a=e!==void 0,s=a?e:r,u=c.useCallback(f=>{a||i(f),n==null||n(f)},[a,n]);return[s,u]}const cd=8,ud=["#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"],P0=8;let Ks=[];const $s=new Set;function dd(){return Ks}function D0(e){const t=we(e);t&&(Ks=[t,...Ks.filter(n=>n!==t)].slice(0,P0),$s.forEach(n=>n()))}function E0(e){return $s.add(e),()=>{$s.delete(e)}}function Ko(e){const t=we(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 gn(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 as({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,s=Math.max(r,i,a),u=Math.min(r,i,a),f=s-u;let g=0;return f!==0&&(s===r?g=(i-a)/f%6:s===i?g=(a-r)/f+2:g=(r-i)/f+4,g*=60,g<0&&(g+=360)),{h:g,s:s===0?0:f/s,v:s}}function ss({h:e,s:t,v:n}){const r=(e%360+360)%360,i=n*t,a=i*(1-Math.abs(r/60%2-1)),s=n-i;let u=0,f=0,g=0;return r<60?(u=i,f=a):r<120?(u=a,f=i):r<180?(f=i,g=a):r<240?(f=a,g=i):r<300?(u=a,g=i):(u=i,g=a),{r:Math.round((u+s)*255),g:Math.round((f+s)*255),b:Math.round((g+s)*255)}}function ig(){return typeof window<"u"&&"EyeDropper"in window}async function j0(){if(!ig())return null;const e=window.EyeDropper;try{const t=await new e().open();return we(t.sRGBHex)}catch{return null}}const R0="_picker_ag1yo_1",T0="_none_ag1yo_12",N0="_customToggle_ag1yo_13",M0="_eyedrop_ag1yo_14",_0="_swatch_ag1yo_48",L0="_field_ag1yo_49",I0="_grid_ag1yo_54",F0="_recents_ag1yo_55",B0="_sectionLabel_ag1yo_84",H0="_custom_ag1yo_13",z0="_sv_ag1yo_95",O0="_svThumb_ag1yo_105",K0="_hue_ag1yo_116",$0="_rgbRow_ag1yo_155",U0="_hexRow_ag1yo_156",Te={picker:R0,none:T0,customToggle:N0,eyedrop:M0,swatch:_0,field:L0,grid:I0,recents:F0,sectionLabel:B0,custom:H0,sv:z0,svThumb:O0,hue:K0,rgbRow:$0,hexRow:U0};function W0(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 Ml({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:i,menu:a=!1,fallbackCustom:s="#000000",onChange:u,onCommit:f}){const g=W(),p=c.useId(),h=a?"menuitemradio":"option",x=t?null:e,y=Ko(x??s)??{r:0,g:0,b:0},[C,b]=c.useState(!1),[v,k]=c.useState(()=>as(y)),[A,R]=c.useState(()=>({r:String(y.r),g:String(y.g),b:String(y.b)})),[N,T]=c.useState(()=>gn(y.r,y.g,y.b)),[S,P]=c.useState(()=>[...dd()]),_=c.useRef(null),D=c.useRef(gn(y.r,y.g,y.b));c.useEffect(()=>E0(()=>P([...dd()])),[]),c.useEffect(()=>{const L=Ko(x??s);if(!L)return;const Z=as(L);k(Z),R({r:String(L.r),g:String(L.g),b:String(L.b)}),T(gn(L.r,L.g,L.b))},[x,s]);const E=(L,Z,ae)=>{L&&(D.current=L),ae&&L&&D0(L),u(L),Z&&(f==null||f(L))},j=(L,Z,ae)=>{const G=gn(L.r,L.g,L.b);k(as(L)),R({r:String(L.r),g:String(L.g),b:String(L.b)}),T(G),E(G,Z,ae)},F=(L,Z,ae)=>{const G=ss(L),ve=gn(G.r,G.g,G.b);k(L),R({r:String(G.r),g:String(G.g),b:String(G.b)}),T(ve),E(ve,Z,ae)},$=L=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(L.key))return;const ae=[...L.currentTarget.querySelectorAll("button")],G=ae.findIndex(Ne=>Ne===document.activeElement);if(G<0)return;L.preventDefault();const ve=L.key==="ArrowLeft"?-1:L.key==="ArrowRight"?1:L.key==="ArrowUp"?-cd:cd,He=ae[Math.max(0,Math.min(ae.length-1,G+ve))];He==null||He.focus()},U=(L,Z)=>{const ae=_.current;if(!ae||i)return;const G=ae.getBoundingClientRect(),ve=Math.max(0,Math.min(1,(L.clientX-G.left)/G.width)),He=Math.max(0,Math.min(1,1-(L.clientY-G.top)/G.height));F({h:v.h,s:ve,v:He},Z,Z)},X=L=>{i||(L.currentTarget.setPointerCapture(L.pointerId),U(L,!1))},Q=ss({h:v.h,s:1,v:1}),oe=gn(Q.r,Q.g,Q.b),Y=ss(v),le=gn(Y.r,Y.g,Y.b),ie=new Set(ud),re=S.filter(L=>!ie.has(L));return o.jsxs("div",{className:Te.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[o.jsx("button",{type:"button",className:Te.none,role:h,"aria-checked":a?x===null&&!t:void 0,"aria-selected":a?void 0:x===null&&!t,disabled:i,onClick:()=>E(null,!0,!1),children:n}),o.jsx("div",{className:Te.grid,role:a?"group":"none",onKeyDown:$,children:ud.map(L=>{const Z=x===L;return o.jsx("button",{type:"button",className:Te.swatch,role:h,"aria-label":L,"aria-checked":a?Z:void 0,"aria-selected":a?void 0:Z,disabled:i,style:{backgroundColor:L},onMouseDown:ae=>ae.preventDefault(),onClick:()=>E(L,!0,!1)},L)})}),re.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:Te.sectionLabel,children:g("colorRecent")}),o.jsx("div",{className:Te.recents,role:a?"group":"none","aria-label":g("colorRecent"),children:re.map(L=>o.jsx("button",{type:"button",className:Te.swatch,role:h,"aria-label":L,"aria-checked":a?x===L:void 0,"aria-selected":a?void 0:x===L,disabled:i,style:{backgroundColor:L},onMouseDown:Z=>Z.preventDefault(),onClick:()=>E(L,!0,!1)},L))})]}):null,o.jsx("button",{type:"button",className:Te.customToggle,disabled:i,"aria-expanded":C,onClick:()=>b(L=>!L),children:g("colorCustom")}),C?o.jsxs("div",{className:Te.custom,children:[o.jsx("div",{ref:_,className:Te.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${oe})`},onPointerDown:X,onPointerMove:L=>{L.currentTarget.hasPointerCapture(L.pointerId)&&U(L,!1)},onPointerUp:L=>{U(L,!0)},children:o.jsx("span",{className:Te.svThumb,style:{left:`${v.s*100}%`,top:`${(1-v.v)*100}%`}})}),o.jsx("input",{className:Te.hue,type:"range",min:0,max:360,value:Math.round(v.h),disabled:i,"aria-label":g("colorCustom"),onChange:L=>F({...v,h:Number(L.target.value)},!1,!1),onPointerUp:()=>E(D.current,!0,!0)}),o.jsx("div",{className:Te.rgbRow,children:["r","g","b"].map(L=>o.jsxs("div",{className:Te.field,children:[o.jsx("label",{htmlFor:`${p}-${L}`,children:g(L==="r"?"colorRgbR":L==="g"?"colorRgbG":"colorRgbB")}),o.jsx("input",{id:`${p}-${L}`,inputMode:"numeric",value:A[L],disabled:i,onChange:Z=>{R(ae=>({...ae,[L]:Z.target.value}))},onBlur:()=>{const Z=W0(A[L]);if(Z===null){R({r:String(Y.r),g:String(Y.g),b:String(Y.b)});return}j({...Y,[L]:Z},!0,!0)},onKeyDown:Z=>{Z.key==="Enter"&&Z.currentTarget.blur()}})]},L))}),o.jsx("div",{className:Te.hexRow,children:o.jsxs("div",{className:Te.field,children:[o.jsx("label",{htmlFor:`${p}-hex`,children:g("colorHex")}),o.jsx("input",{id:`${p}-hex`,value:N,disabled:i,onChange:L=>T(L.target.value),onBlur:()=>{const L=we(N);if(!L){T(le);return}const Z=Ko(L);Z&&j(Z,!0,!0)},onKeyDown:L=>{L.key==="Enter"&&L.currentTarget.blur()}})]})}),ig()?o.jsx("button",{type:"button",className:Te.eyedrop,disabled:i,onClick:()=>{j0().then(L=>{if(!L)return;const Z=Ko(L);Z&&j(Z,!0,!0)})},children:g("colorPickFromScreen")}):null]}):null]})}const G0="_wrap_hfz5s_1",V0="_button_hfz5s_8",Z0="_icon_hfz5s_18",q0="_bar_hfz5s_24",Y0="_barEmpty_hfz5s_33",X0="_popover_hfz5s_43",pn={wrap:G0,button:V0,icon:Z0,bar:q0,barEmpty:Y0,popover:X0},J0="_field_1knrr_1",Q0="_label_1knrr_8",ev="_button_1knrr_12",tv="_swatch_1knrr_37",nv="_swatchEmpty_1knrr_44",Ar={field:J0,label:Q0,button:ev,swatch:tv,swatchEmpty:nv},$o=4;function at({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:i,fallbackCustom:a,onChange:s}){const u=c.useId(),f=c.useRef(null),g=c.useRef(null),p=c.useRef(null),[h,x]=c.useState(!1),[y,C]=c.useState({top:0,left:0}),b=c.useCallback(()=>{const A=g.current,R=p.current;if(!A)return;const N=A.getBoundingClientRect(),T=(R==null?void 0:R.offsetHeight)??0,S=(R==null?void 0:R.offsetWidth)??240;let P=N.bottom;P+T>window.innerHeight-$o&&(P=Math.max($o,N.top-T));const _=Math.min(Math.max(N.left,$o),window.innerWidth-S-$o);C({top:P,left:_})},[]);c.useLayoutEffect(()=>{if(!h)return;b();const A=()=>b();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[h,b]),c.useEffect(()=>{if(!h)return;const A=N=>{var S,P;const T=N.target;(S=f.current)!=null&&S.contains(T)||(P=p.current)!=null&&P.contains(T)||x(!1)},R=N=>{var T;N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),x(!1),(T=g.current)==null||T.focus())};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",R,!0)}},[h]);const v=`${Ar.swatch}${!n||r?` ${Ar.swatchEmpty}`:""}`,k=n&&!r?{backgroundColor:n}:void 0;return o.jsxs("div",{className:Ar.field,ref:f,children:[o.jsx("span",{className:Ar.label,children:e}),o.jsx("button",{ref:g,type:"button",className:Ar.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:i,onClick:()=>x(A=>!A),children:o.jsx("span",{className:v,style:k})}),h?o.jsx(ue,{children:o.jsx("div",{ref:p,id:u,className:pn.popover,style:{top:y.top,left:y.left,zIndex:1400},children:o.jsx(Ml,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:i,fallbackCustom:a,onChange:s,onCommit:()=>x(!1)})})}):null]})}const ls=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],rv="_toolbar_1aggm_1",ov="_menuBar_1aggm_35",iv="_menuBarDesktop_1aggm_43",av="_brandMark_1aggm_49",sv="_brandMarkIcon_1aggm_56",lv="_menuBarCompact_1aggm_68",cv="_menuWrap_1aggm_91",uv="_menuButton_1aggm_97",dv="_iconButton_1aggm_98",mv="_menuItem_1aggm_99",fv="_hamburgerButton_1aggm_142",gv="_iconNav_1aggm_149",pv="_iconNavMain_1aggm_160",hv="_iconNavEnd_1aggm_169",bv="_iconGroup_1aggm_185",yv="_tooltipTrigger_1aggm_276",xv="_menu_1aggm_35",Cv="_submenuWrap_1aggm_305",wv="_submenu_1aggm_305",vv="_submenuTrigger_1aggm_315",Sv="_menuOverlay_1aggm_330",kv="_menuOverlayHeader_1aggm_342",Av="_menuOverlayTitle_1aggm_352",Pv="_menuOverlayBody_1aggm_358",Dv="_menuSeparator_1aggm_409",Ev="_icon_1aggm_98",jv="_tooltip_1aggm_276",Rv="_tooltipElevated_1aggm_494",q={toolbar:rv,menuBar:ov,menuBarDesktop:iv,brandMark:av,brandMarkIcon:sv,menuBarCompact:lv,menuWrap:cv,menuButton:uv,iconButton:dv,menuItem:mv,hamburgerButton:fv,iconNav:gv,iconNavMain:pv,iconNavEnd:hv,iconGroup:bv,tooltipTrigger:yv,menu:xv,submenuWrap:Cv,submenu:wv,submenuTrigger:vv,menuOverlay:Sv,menuOverlayHeader:kv,menuOverlayTitle:Av,menuOverlayBody:Pv,menuSeparator:Dv,icon:Ev,tooltip:jv,tooltipElevated:Rv},Tv=400,md=6,cs=4;function tn({label:e,children:t,className:n,elevated:r}){const i=c.useRef(null),a=c.useRef(null),s=c.useRef(null),u=c.useRef(!1),f=c.useRef(!1),[g,p]=c.useState(!1),[h,x]=c.useState({top:0,left:0}),y=c.useCallback(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),C=c.useCallback(k=>{if(!(u.current||f.current)){y(),p(!1);return}if(k||f.current){y(),p(!0);return}y(),s.current=setTimeout(()=>{s.current=null,p(!0)},Tv)},[y]),b=c.useCallback(()=>{const k=i.current,A=a.current;if(!k||!A)return;const R=k.getBoundingClientRect(),N=A.offsetWidth,T=A.offsetHeight;let S=R.bottom+md;S+T>window.innerHeight-cs&&(S=R.top-md-T);let P=R.left+R.width/2-N/2;P=Math.min(Math.max(P,cs),window.innerWidth-N-cs),x({top:S,left:P})},[]);c.useEffect(()=>()=>y(),[y]),c.useEffect(()=>{const k=i.current;if(!k)return;const A=()=>{f.current=!0,C(!0)},R=()=>{f.current=!1,C(!1)};return k.addEventListener("focusin",A),k.addEventListener("focusout",R),()=>{k.removeEventListener("focusin",A),k.removeEventListener("focusout",R)}},[C]),c.useLayoutEffect(()=>{if(!g)return;b();const k=()=>b();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[g,e,b]);const v=n?`${q.tooltipTrigger} ${n}`:q.tooltipTrigger;return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,className:v,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,C(!1)},onMouseLeave:()=>{u.current=!1,C(!1)},children:t}),g?o.jsx(ue,{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 Nv="_wrap_1vjt0_1",Mv="_wrapToolbar_1vjt0_7",_v="_field_1vjt0_12",Lv="_trigger_1vjt0_20",Iv="_chevron_1vjt0_50",Fv="_list_1vjt0_73",Bv="_listInline_1vjt0_88",Hv="_option_1vjt0_96",zv="_separator_1vjt0_125",dt={wrap:Nv,wrapToolbar:Mv,field:_v,trigger:Lv,chevron:Iv,list:Fv,listInline:Bv,option:Hv,separator:zv};function Ov({value:e,mixed:t=!1,fonts:n,disabled:r,listId:i,listRef:a,inline:s,style:u,onSelect:f}){const g=W(),p=!t&&e===null;return o.jsxs("ul",{ref:a,id:i,className:s?`${dt.list} ${dt.listInline}`:dt.list,role:"listbox","aria-label":g("commandFontFamilyAria"),style:u,children:[o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:dt.option,role:"option","aria-checked":p,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>f(null),children:g("fontFamilyDefault")})}),o.jsx("li",{className:dt.separator,role:"separator"}),n.map(h=>{const x=!t&&Kr(e,h.family);return o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:dt.option,role:"option","aria-checked":x,disabled:r,style:{fontFamily:h.family},onMouseDown:y=>y.preventDefault(),onClick:()=>f(h.family),children:h.name})},h.family)})]})}function Kv(e,t,n,r){var i;return t?"":e===null?r:((i=Ub(e,n))==null?void 0:i.name)??e}const Uo=4;function ag({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:i,toolbar:a=!1,triggerId:s,onChange:u}){const f=W(),g=c.useId(),p=c.useRef(null),h=c.useRef(null),x=c.useRef(null),[y,C]=c.useState(!1),[b,v]=c.useState({top:0,left:0,width:0}),k=Kv(e,t,n,f("fontFamilyDefault")),A=c.useCallback(()=>{const N=h.current,T=x.current;if(!N)return;const S=N.getBoundingClientRect(),P=(T==null?void 0:T.offsetHeight)??0,_=Math.max(S.width,(T==null?void 0:T.offsetWidth)??0);let D=S.bottom;D+P>window.innerHeight-Uo&&(D=Math.max(Uo,S.top-P));const E=Math.min(Math.max(S.left,Uo),window.innerWidth-_-Uo);v({top:D,left:E,width:_})},[]);c.useLayoutEffect(()=>{if(!y)return;A();const N=()=>A();return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[y,A,n.length]),c.useEffect(()=>{if(!y)return;const N=S=>{var _,D;const P=S.target;(_=p.current)!=null&&_.contains(P)||(D=x.current)!=null&&D.contains(P)||C(!1)},T=S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),C(!1))};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",T,!0),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",T,!0)}},[y]);const R=o.jsxs("div",{className:`${dt.wrap}${a?` ${dt.wrapToolbar}`:""}`,ref:p,children:[o.jsxs("div",{className:dt.field,ref:h,children:[o.jsx("button",{type:"button",id:s,className:dt.trigger,disabled:r,"aria-label":a?f("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":y,"aria-controls":y?g:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:N=>N.preventDefault(),onClick:()=>C(N=>!N),children:k}),o.jsx("span",{className:dt.chevron,"aria-hidden":"true"})]}),y?o.jsx(ue,{children:o.jsx(Ov,{listRef:x,listId:g,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:b.top,left:b.left,minWidth:b.width},onSelect:N=>{u(N),C(!1)}})}):null]});return i?o.jsx(tn,{label:i,children:R}):R}function $v({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(ag,{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 Uv="_wrap_58i0x_1",Wv="_wrapToolbar_58i0x_9",Gv="_field_58i0x_14",Vv="_input_58i0x_22",Zv="_toggle_58i0x_41",qv="_chevron_58i0x_42",Yv="_unit_58i0x_80",Xv="_list_58i0x_110",Jv="_option_58i0x_125",ke={wrap:Uv,wrapToolbar:Wv,field:Gv,input:Vv,toggle:Zv,chevron:qv,unit:Yv,list:Xv,option:Jv},Wo=4,Qv={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function sg({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:i,tooltip:a,sizeInputId:s,toolbar:u=!1}){const f=W(),g=c.useId(),p=c.useRef(null),h=c.useRef(null),x=c.useRef(null),[y,C]=c.useState(()=>e===null?"":J(e)),[b,v]=c.useState(!1),[k,A]=c.useState(!1),[R,N]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{b||C(e===null?"":J(e))},[e,b]);const T=c.useCallback(()=>{const E=h.current,j=x.current;if(!E)return;const F=E.getBoundingClientRect(),$=(j==null?void 0:j.offsetHeight)??0;let U=F.bottom;U+$>window.innerHeight-Wo&&(U=Math.max(Wo,F.top-$));const X=Math.min(Math.max(F.left,Wo),window.innerWidth-Math.max(F.width,72)-Wo);N({top:U,left:X,width:F.width})},[]);c.useLayoutEffect(()=>{if(!k)return;T();const E=()=>T();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[k,T]),c.useEffect(()=>{if(!k)return;const E=F=>{var U,X;const $=F.target;(U=p.current)!=null&&U.contains($)||(X=x.current)!=null&&X.contains($)||A(!1)},j=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),A(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",j,!0)}},[k]);const S=E=>{const j=gh(E,t);if(!j){C(e===null?"":J(e));return}n(j.value,j.unit),C(J(j.value))},P=uh[t],_=k?o.jsx(ue,{children:o.jsx("ul",{ref:x,className:ke.list,role:"listbox",id:g,style:{top:R.top,left:R.left,minWidth:R.width},children:P.map(E=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ke.option,role:"option","aria-selected":e===E,onMouseDown:j=>j.preventDefault(),onClick:()=>{n(E,t),C(J(E)),A(!1)},children:J(E)})},E))})}):null,D=o.jsxs("div",{className:`${ke.wrap}${u?` ${ke.wrapToolbar}`:""}`,ref:p,children:[o.jsxs("div",{className:ke.field,ref:h,children:[o.jsx("input",{id:s,className:ke.input,value:y,disabled:i,"aria-label":f("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":k,"aria-controls":g,role:"combobox",inputMode:"decimal",onFocus:()=>v(!0),onBlur:()=>{v(!1),S(y)},onChange:E=>C(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),S(y),A(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),A(!0))}}),o.jsx("button",{type:"button",className:ke.toggle,tabIndex:-1,disabled:i,"aria-label":f("commandFontSizeAria"),"aria-expanded":k,"aria-controls":g,onMouseDown:E=>E.preventDefault(),onClick:()=>A(E=>!E)})]}),o.jsxs("div",{className:ke.field,children:[o.jsx("select",{className:ke.unit,value:t,disabled:i,"aria-label":f("commandFontSizeUnitAria"),onChange:E=>{r(E.target.value)},children:Xs.map(E=>o.jsx("option",{value:E,children:f(Qv[E])},E))}),o.jsx("span",{className:ke.chevron,"aria-hidden":"true"})]}),_]});return a?o.jsx(tn,{label:a,children:D}):D}const eS="_backdrop_1p9zk_1",tS="_dialog_1p9zk_12",nS="_dialogWide_1p9zk_31",rS="_header_1p9zk_35",oS="_tabs_1p9zk_43",iS="_tab_1p9zk_43",aS="_body_1p9zk_76",sS="_field_1p9zk_86",lS="_label_1p9zk_92",cS="_sizeRow_1p9zk_96",uS="_fileRow_1p9zk_102",dS="_fileName_1p9zk_108",mS="_previewImage_1p9zk_115",fS="_marks_1p9zk_125",gS="_mark_1p9zk_125",pS="_actions_1p9zk_140",hS="_actionsSpread_1p9zk_148",bS="_actionsEnd_1p9zk_152",yS="_headerRow_1p9zk_157",xS="_close_1p9zk_170",CS="_nameSection_1p9zk_187",wS="_nameInput_1p9zk_192",vS="_labelRow_1p9zk_209",SS="_help_1p9zk_215",kS="_textInput_1p9zk_233",AS="_fullSelect_1p9zk_245",PS="_error_1p9zk_249",DS="_emptyHint_1p9zk_254",ES="_action_1p9zk_140",jS="_textarea_1p9zk_265",RS="_actionDanger_1p9zk_279",TS="_confirmBody_1p9zk_285",NS="_nestedPanel_1p9zk_294",MS="_spinnerWrap_1p9zk_309",_S="_spinner_1p9zk_309",LS="_actionPrimary_1p9zk_344",IS="_iconButton_1p9zk_358",FS="_select_1p9zk_359",BS="_lengthInput_1p9zk_360",HS="_lengthUnit_1p9zk_361",zS="_group_1p9zk_369",OS="_nestedGroup_1p9zk_379",KS="_subLabel_1p9zk_389",$S="_iconRow_1p9zk_393",US="_lengthField_1p9zk_425",WS="_sideLabel_1p9zk_431",GS="_lengthRow_1p9zk_435",VS="_sideGrid_1p9zk_463",ZS="_shadowGrid_1p9zk_464",d={backdrop:eS,dialog:tS,dialogWide:nS,header:rS,tabs:oS,tab:iS,body:aS,field:sS,label:lS,sizeRow:cS,fileRow:uS,fileName:dS,previewImage:mS,marks:fS,mark:gS,actions:pS,actionsSpread:hS,actionsEnd:bS,headerRow:yS,close:xS,nameSection:CS,nameInput:wS,labelRow:vS,help:SS,textInput:kS,fullSelect:AS,error:PS,emptyHint:DS,action:ES,textarea:jS,actionDanger:RS,confirmBody:TS,nestedPanel:NS,spinnerWrap:MS,spinner:_S,actionPrimary:LS,iconButton:IS,select:FS,lengthInput:BS,lengthUnit:HS,group:zS,nestedGroup:OS,subLabel:KS,iconRow:$S,lengthField:US,sideLabel:WS,lengthRow:GS,sideGrid:VS,shadowGrid:ZS},qS={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function _l({tab:e,value:t,fonts:n,disabled:r,onTabChange:i,onChange:a}){const s=W(),u=c.useId(),f=c.useId(),g=n??Im(),p=ls.find(h=>h.id===e)??ls[0];return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":s("fontDialogTitle"),children:ls.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:s(h.labelKey)},h.id))}),o.jsx("div",{className:d.body,role:"tabpanel",children:p.implemented?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:f,children:s("fontDialogFamily")}),o.jsx(ag,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:g,disabled:r,triggerId:f,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:s("fontDialogSize")}),o.jsx("div",{className:d.sizeRow,children:o.jsx(sg,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,x)=>{a({...t,size:h,unit:x})},onUnitChange:h=>{const x=t.size!==null?nm(t.size,t.unit,h,16,16):t.size;a({...t,size:x,unit:h})}})})]}),o.jsx("div",{className:d.field,children:o.jsx(at,{label:s("commandFontColor"),noneLabel:s("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(at,{label:s("commandHighlightColor"),noneLabel:s("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:s("fontDialogStyle")}),it.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]}})}}),s(qS[h].label)]},h))]})]}):null})]})}const fd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function YS({open:e,tab:t,size:n,unit:r,marks:i,fontFamily:a=null,fontFamilyMixed:s=!1,fontColor:u,fontColorMixed:f=!1,highlightColor:g,highlightColorMixed:p=!1,fonts:h,disabled:x,onTabChange:y,onApply:C,onClose:b}){const v=W(),k=c.useId(),A=c.useRef(null),[R,N]=c.useState({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:g,fontColorMixed:f,highlightColorMixed:p});return c.useEffect(()=>{e&&N({size:n,unit:r,marks:i,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:g,fontColorMixed:f,highlightColorMixed:p})},[e,n,r,i,a,s,u,f,g,p]),c.useEffect(()=>{if(!e)return;const T=A.current,S=T==null?void 0:T.querySelector(fd);S==null||S.focus();const P=_=>{if(_.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;_.preventDefault(),_.stopPropagation(),b();return}if(_.key!=="Tab"||!T)return;const D=[...T.querySelectorAll(fd)];if(D.length===0)return;const E=D[0],j=D[D.length-1];_.shiftKey&&document.activeElement===E?(_.preventDefault(),j.focus()):!_.shiftKey&&document.activeElement===j&&(_.preventDefault(),E.focus())};return document.addEventListener("keydown",P,!0),()=>document.removeEventListener("keydown",P,!0)},[e,b]),e?o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:b,children:o.jsxs("div",{ref:A,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":k,onMouseDown:T=>T.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:k,children:v("fontDialogTitle")}),o.jsx(_l,{tab:t,value:R,fonts:h,disabled:x,onTabChange:y,onChange:N}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:b,children:v("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:x,onClick:()=>C(R),children:v("fontDialogOk")})]})]})})}):null}const XS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function De({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:i,inputId:a,onChange:s}){const u=W(),f=c.useId(),g=a??f,p=(t==null?void 0:t.unit)??el,[h,x]=c.useState(()=>t?J(t.value):""),[y,C]=c.useState(!1);c.useEffect(()=>{y||x(t?J(t.value):"")},[t,y]);const b=v=>{const k=v.trim();if(!k){s(null),x("");return}const A=Mr(k,p,r);if(!A){x(t?J(t.value):"");return}s(A),x(J(A.value))};return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:g,children:e}),o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:g,className:d.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>C(!0),onBlur:()=>{C(!1),b(h)},onChange:v=>x(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),b(h),v.currentTarget.blur())}}),o.jsx("select",{className:d.lengthUnit,value:p,disabled:n,"aria-label":i??u("paragraphDialogLengthUnitAria"),onChange:v=>{const k=v.target.value;if(t){s({value:t.value,unit:k});return}if(h.trim()){const A=Mr(h,k,r);s(A)}},children:Xs.map(v=>o.jsx("option",{value:v,children:u(XS[v])},v))})]})]})}function Ll({shadow:e,disabled:t,onChange:n}){const r=W();return o.jsxs("div",{className:d.shadowGrid,children:[o.jsx(De,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetX:i??{value:0,unit:"px"}})}}),o.jsx(De,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:i=>{n({...e,offsetY:i??{value:0,unit:"px"}})}}),o.jsx(De,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:i=>{n({...e,blur:i??{value:0,unit:"px"}})}}),o.jsx(De,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:i=>{n({...e,spread:i??{value:0,unit:"px"}})}}),o.jsx(at,{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 lg=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0}],cg=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],JS={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},QS={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function ug({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),s=c.useId();return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:i(e)}),o.jsx(ek,{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 f=u.target.value;r({...t,fit:f||null})},children:[o.jsx("option",{value:"",children:i("imagePropertiesFitDefault")}),Dl.map(u=>o.jsx("option",{value:u,children:i(JS[u])},u))]})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:s,children:i("imagePropertiesPosition")}),o.jsxs("select",{id:s,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")}),El.map(u=>o.jsx("option",{value:u,children:i(QS[u])},u))]})]})]})}function ek({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:si(e),[s,u]=c.useState(()=>a===null?"":J(a)),[f,g]=c.useState(!1);c.useEffect(()=>{f||u(a===null?"":J(a))},[a,f]);const p=h=>{const x=h.trim();if(!x){n(null),u("");return}const y=Number(x.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":J(a));return}const C=ym(y);n(C),u(J(si(C)))};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:s,disabled:t,inputMode:"decimal",onFocus:()=>g(!0),onChange:h=>u(h.target.value),onBlur:()=>{g(!1),p(s)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const Go=4,tk={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Ci({label:e,inputAria:t,value:n,disabled:r,onChange:i}){const a=W(),s=c.useId(),u=c.useId(),f=c.useRef(null),g=c.useRef(null),p=c.useRef(null),h=(n==null?void 0:n.unit)??c1,[x,y]=c.useState(()=>n?J(n.value):""),[C,b]=c.useState(!1),[v,k]=c.useState(!1),[A,R]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{C||y(n?J(n.value):"")},[n,C]);const N=c.useCallback(()=>{const D=g.current,E=p.current;if(!D)return;const j=D.getBoundingClientRect(),F=(E==null?void 0:E.offsetHeight)??0;let $=j.bottom;$+F>window.innerHeight-Go&&($=Math.max(Go,j.top-F));const U=Math.min(Math.max(j.left,Go),window.innerWidth-Math.max(j.width,72)-Go);R({top:$,left:U,width:j.width})},[]);c.useLayoutEffect(()=>{if(!v)return;N();const D=()=>N();return window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[v,N]),c.useEffect(()=>{if(!v)return;const D=j=>{var $,U;const F=j.target;($=f.current)!=null&&$.contains(F)||(U=p.current)!=null&&U.contains(F)||k(!1)},E=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",E,!0)}},[v]);const T=D=>{const E=D.trim();if(!E){i(null),y("");return}const j=Wu(E,h);if(!j){y(n?J(n.value):"");return}i(j),y(J(j.value))},S=u1[h],P=(n==null?void 0:n.value)??null,_=v?o.jsx(ue,{children:o.jsx("ul",{ref:p,className:ke.list,role:"listbox",id:s,style:{top:A.top,left:A.left,minWidth:A.width},children:S.map(D=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:ke.option,role:"option","aria-selected":P===D,onMouseDown:E=>E.preventDefault(),onClick:()=>{i({value:D,unit:h}),y(J(D)),k(!1)},children:J(D)})},D))})}):null;return o.jsxs("div",{className:d.lengthField,children:[o.jsx("label",{className:d.sideLabel,htmlFor:u,children:e}),o.jsxs("div",{className:`${ke.wrap} ${d.lengthRow}`,ref:f,children:[o.jsxs("div",{className:ke.field,ref:g,children:[o.jsx("input",{id:u,className:ke.input,value:x,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":v,"aria-controls":s,role:"combobox",inputMode:"decimal",onFocus:()=>b(!0),onBlur:()=>{b(!1),T(x)},onChange:D=>y(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),T(x),k(!1),D.currentTarget.blur()),D.key==="ArrowDown"&&(D.preventDefault(),k(!0))}}),o.jsx("button",{type:"button",className:ke.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":v,"aria-controls":s,onMouseDown:D=>D.preventDefault(),onClick:()=>k(D=>!D)})]}),o.jsxs("div",{className:ke.field,children:[o.jsx("select",{className:ke.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:D=>{const E=D.target.value;if(n){i({value:n.value,unit:E});return}x.trim()&&i(Wu(x,E))},children:kf.map(D=>o.jsx("option",{value:D,children:a(tk[D])},D))}),o.jsx("span",{className:ke.chevron,"aria-hidden":"true"})]}),_]})]})}const nk={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},rk={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function dg({src:e,disabled:t,customImagePicker:n,onSrcChange:r,onCustomPick:i,onSourceChange:a}){const s=W(),u=c.useId(),f=c.useId(),g=c.useRef(null),[p,h]=c.useState(()=>e.startsWith("data:")?"file":e.trim()?"url":"file"),[x,y]=c.useState(()=>e.startsWith("data:")?"":e),[C,b]=c.useState(""),[v,k]=c.useState(null),[A,R]=c.useState(!1);c.useEffect(()=>{a==null||a(p)},[a,p]);const N=p==="file"&&e.startsWith("data:")?e:p==="url"?x:"",T=p==="custom"?null:nr(N),S=p==="custom"?null:p==="file"&&v?rk[v]:T&&(p==="file"||x.trim().length>0)?nk[T]:null,P=()=>{t||!n||i==null||i()},_=D=>{var j;const E=(j=D.target.files)==null?void 0:j[0];E&&(R(!0),k(null),r1(E).then(F=>{b(E.name),h("file"),r(F),R(!1)},F=>{const $=F instanceof Error?F.message:"";b(""),h("file"),k($==="tooLarge"||$==="type"?$:"type"),R(!1),g.current&&(g.current.value="")}))};return o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:s("imageDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":s("imageDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":p==="file",disabled:t,onClick:()=>h("file"),children:s("imageDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":p==="url",disabled:t,onClick:()=>h("url"),children:s("imageDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":p==="custom",disabled:t,onClick:()=>h("custom"),children:n.text}):null]}),p==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:g,type:"file",accept:Yx,hidden:!0,disabled:t,"aria-label":s("imageDialogChooseFile"),onChange:_}),o.jsx("button",{type:"button",className:d.action,disabled:t||A,onClick:()=>{var D;return(D=g.current)==null?void 0:D.click()},children:s("imageDialogChooseFile")}),C?o.jsx("span",{className:d.fileName,children:C}):null,e.startsWith("data:")&&!C?o.jsx("span",{className:d.fileName,children:s("pageBackgroundImageCurrent")}):null]}):null,p==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:s("imageDialogUrl")}),o.jsx("input",{id:u,className:d.textInput,value:x,disabled:t,"aria-invalid":S!==null,"aria-describedby":S?f:void 0,onChange:D=>{const E=D.target.value;y(E),r(E.trim())}})]}):null,p==="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:P,children:n.buttonCaption})]}):null,S?o.jsx("p",{id:f,className:d.error,children:s(S)}):null]})}function ok(e){return nr(e.trim())===null}function ik(e){return Rf(e)?{width:null,height:null}:e==="fill"?{width:{...$n},height:{...$n}}:{width:{...$n},height:null}}function ak({value:e,disabled:t,customImagePicker:n,onCustomImagePick:r,onChange:i}){const a=W(),s=e.src??"",u=(f,g)=>{i({...e,fit:null,[f]:g})};return o.jsxs(o.Fragment,{children:[s?o.jsxs("div",{className:d.field,children:[o.jsx("span",{className:d.label,children:a("pageBackgroundImagePreview")}),o.jsx("img",{className:d.previewImage,src:s,alt:a("pageBackgroundImagePreviewAlt")}),o.jsx("button",{type:"button",className:d.action,disabled:t,onClick:()=>{i({...e,src:null})},children:a("pageBackgroundImageClear")})]}):null,o.jsx(dg,{src:s,disabled:t,customImagePicker:n,onCustomPick:r,onSrcChange:f=>{i({...e,src:f.trim()||null})}}),s?o.jsxs(o.Fragment,{children:[o.jsx(Ci,{label:a("imagePropertiesWidth"),inputAria:a("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:f=>u("width",f)}),o.jsx(Ci,{label:a("imagePropertiesHeight"),inputAria:a("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:f=>u("height",f)}),o.jsx(ug,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:f=>{const g=f.fit===e.fit?{width:e.width,height:e.height}:ik(f.fit);i({...e,opacity:f.opacity,fit:f.fit,position:f.position,...g})}})]}):null]})}const sk={left:ki,center:Si,right:Ai,justify:Od},lk={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},ck={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},uk={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},dk={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},mk={value:1,unit:"pt"},fk={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},gk={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},gd={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function Pr(e){return{top:e,right:e,bottom:e,left:e}}function pd(e){for(const t of Fe)if(e[t])return e[t];return null}function pk(){const e=[...lg];for(const t of cg)e.some(n=>n.id===t.id)||e.push(t);return e}function Il({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:i="paragraphDialogTitle",backgroundImage:a,customImagePicker:s,onCustomImagePick:u,onBackgroundImageChange:f,onTabChange:g,onChange:p}){const h=W(),x=r?pk().filter(S=>r.includes(S.id)):lg,y=c.useId(),C=c.useId(),b=c.useId(),v=c.useId(),[k,A]=c.useState(()=>It(t.margin,Pr(t.margin.top))),[R,N]=c.useState(()=>It(t.padding,Pr(t.padding.top))),T=(S,P,_,D)=>{const E=t[S],j=P?Pr(D):{...E,[_]:D};p({...t,[S]:j,[`${S}Mixed`]:!1})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":h(i),children:x.map(S=>o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":S.id===e,disabled:!S.implemented,onClick:()=>g(S.id),children:h(S.labelKey)},S.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:xf.map(S=>{const P=sk[S],_=!t.alignMixed&&t.align===S;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":_,"aria-label":h(lk[S].aria),disabled:n,onClick:()=>{p({...t,align:S,alignMixed:!1})},children:o.jsx(P,{})},S)})})]}),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 S=!t.listMixed&&t.list==="ul"?null:"ul";p({...t,list:S,listMixed:!1})},children:o.jsx(Kd,{})}),o.jsx("button",{type:"button",className:d.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":h("commandNumberedListAria"),disabled:n,onClick:()=>{const S=!t.listMixed&&t.list==="ol"?null:"ol";p({...t,list:S,listMixed:!1})},children:o.jsx(Gd,{})})]})]})]}):null,e==="spacing"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogSpacing")}),o.jsx(hd,{legend:h("paragraphDialogMargin"),sides:t.margin,linked:k,disabled:n,allowNegative:!0,onLinkedChange:S=>{A(S),S&&p({...t,margin:Pr(pd(t.margin)),marginMixed:!1})},onSideChange:(S,P)=>T("margin",k,S,P)}),o.jsx(hd,{legend:h("paragraphDialogPadding"),sides:t.padding,linked:R,disabled:n,onLinkedChange:S=>{N(S),S&&p({...t,padding:Pr(pd(t.padding)),paddingMixed:!1})},onSideChange:(S,P)=>T("padding",R,S,P)}),o.jsx(bk,{value:t.lineHeight,disabled:n,onChange:S=>{p({...t,lineHeight:S,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:C,children:h("paragraphDialogBreakInside")}),o.jsx("select",{id:C,className:d.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:S=>{p({...t,breakInside:S.target.value,breakInsideMixed:!1})},children:um.map(S=>o.jsx("option",{value:S,children:h(gk[S])},S))})]}),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:S=>{p({...t,breakAfter:S.target.value,breakAfterMixed:!1})},children:xs.map(S=>o.jsx("option",{value:S,children:h(gd[S])},S))})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:v,children:h("paragraphDialogBreakBefore")}),o.jsx("select",{id:v,className:d.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:S=>{p({...t,breakBefore:S.target.value,breakBeforeMixed:!1})},children:xs.map(S=>o.jsx("option",{value:S,children:h(gd[S])},S))})]})]})]}):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:S=>{const P=S.target.value;p({...t,border:{style:P,width:P==="none"?null:t.border.width??mk,color:P==="none"?null:t.border.color},borderMixed:!1})},children:Di.map(S=>o.jsx("option",{value:S,children:h(uk[S])},S))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(De,{label:h("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:S=>{p({...t,border:{...t.border,width:S},borderMixed:!1})}}),o.jsx(at,{label:h("paragraphDialogBorderColor"),noneLabel:h("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:S=>{p({...t,border:{...t.border,color:S},borderMixed:!1})}})]}):null,o.jsx(De,{label:h("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:S=>{p({...t,borderRadius:S,radiusMixed:!1})}}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{p({...t,boxShadow:t.boxShadow?null:fk,shadowMixed:!1})}}),h("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(Ll,{shadow:t.boxShadow,disabled:n,onChange:S=>{p({...t,boxShadow:S,shadowMixed:!1})}}):null]}):null,e==="background"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:h("paragraphDialogTabBackground")}),o.jsx(at,{label:h("paragraphDialogBackgroundColor"),noneLabel:h("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:S=>{p({...t,backgroundColor:S,backgroundMixed:!1})}}),o.jsx(hk,{value:t.opacity,disabled:n,onChange:S=>{p({...t,opacity:S,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&f?o.jsx(ak,{value:a,disabled:n,customImagePicker:s,onCustomImagePick:u,onChange:f}):null]})]})}function hk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=e===null?null:si(e),[s,u]=c.useState(()=>a===null?"":J(a)),[f,g]=c.useState(!1);c.useEffect(()=>{f||u(a===null?"":J(a))},[a,f]);const p=h=>{const x=h.trim();if(!x){n(null),u("");return}const y=Number(x.replace(",","."));if(!Number.isFinite(y)){u(a===null?"":J(a));return}const C=ym(y);n(C),u(J(si(C)))};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:s,disabled:t,inputMode:"decimal",onFocus:()=>g(!0),onChange:h=>u(h.target.value),onBlur:()=>{g(!1),p(s)}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function hd({legend:e,sides:t,linked:n,disabled:r,allowNegative:i=!1,onLinkedChange:a,onSideChange:s}){const u=W(),f=n?["top"]:Fe;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:f.map(g=>o.jsx(De,{label:n?e:u(ck[g]),value:t[g],disabled:r,allowNegative:i,onChange:p=>s(g,p)},g))})]})}function bk({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=yk(e),s=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,f]=c.useState(()=>s===null?"":J(s)),g=(e==null?void 0:e.kind)==="length"?e.unit:el;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:p=>f(p.target.value),onBlur:()=>{const p=u.trim();if(!p){n(null);return}if(a==="number"||a==="empty"){const x=Number(p.replace(",","."));if(!Number.isFinite(x)||x<0){f(s===null?"":J(s));return}n({kind:"number",value:x}),f(J(x));return}const h=Mr(p,g,!1);if(!h){f(s===null?"":J(s));return}n({kind:"length",value:h.value,unit:h.unit}),f(J(h.value))}}),o.jsxs("select",{className:d.lengthUnit,value:a==="length"?g:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:p=>{const h=p.target.value;if(h==="empty"){n(null),f("");return}if(h==="normal"){n({kind:"normal"}),f("");return}if(h==="number"){const b=Number((u||"1.5").replace(",",".")),v=Number.isFinite(b)&&b>=0?b:1.5;n({kind:"number",value:v}),f(J(v));return}const x=h,y=Mr(u||"1",x,!1),C=(y==null?void 0:y.value)??1;n({kind:"length",value:C,unit:x}),f(J(C))},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(p=>o.jsx("option",{value:p,children:r(dk[p])},p))]})]})]})}function yk(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const bd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function xk({open:e,tab:t,value:n,disabled:r,onTabChange:i,onApply:a,onClose:s}){const u=W(),f=c.useId(),g=c.useRef(null),[p,h]=c.useState(n);return c.useEffect(()=>{e&&h(n)},[e,n]),c.useEffect(()=>{if(!e)return;const x=g.current,y=x==null?void 0:x.querySelector(bd);y==null||y.focus();const C=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),s();return}if(b.key!=="Tab"||!x)return;const v=[...x.querySelectorAll(bd)];if(v.length===0)return;const k=v[0],A=v[v.length-1];b.shiftKey&&document.activeElement===k?(b.preventDefault(),A.focus()):!b.shiftKey&&document.activeElement===A&&(b.preventDefault(),k.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,s]),e?o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:s,children:o.jsxs("div",{ref:g,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":f,onMouseDown:x=>x.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:f,children:u("paragraphDialogTitle")}),o.jsx(Il,{tab:t,value:p,disabled:r,onTabChange:i,onChange:h}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:s,children:u("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:r,onClick:()=>a(p),children:u("fontDialogOk")})]})]})})}):null}const Ck=["auto","A4","letter","legal","custom"],wk={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},vk={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function yd(e){return e===null?"":J(e.value)}function Sk({value:e,disabled:t,onChange:n,onReset:r}){const i=W(),a=c.useId(),[s,u]=c.useState(!0),f=e??Zt(),g=(p,h)=>{if(s){n({...f,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...f,margin:{...f.margin,[p]: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:f.sizePreset,onChange:p=>n({...f,sizePreset:p.target.value}),children:Ck.map(p=>o.jsx("option",{value:p,children:i(wk[p])},p))})]}),f.sizePreset==="custom"?o.jsxs("div",{className:d.sideGrid,children:[o.jsx(us,{label:i("pageAtRuleWidth"),value:f.customWidth,disabled:t,onChange:p=>n({...f,customWidth:p})}),o.jsx(us,{label:i("pageAtRuleHeight"),value:f.customHeight,disabled:t,onChange:p=>n({...f,customHeight:p})})]}):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(([p,h])=>o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"radio",name:"page-orientation",checked:(f.orientation??"none")===p,disabled:t,onChange:()=>n({...f,orientation:p==="none"?null:p})}),i(h)]},p))})]}),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:s,disabled:t,onChange:()=>u(!s)}),i("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(s?["top"]:Fe).map(p=>o.jsx(us,{label:i(s?"pageAtRuleMargins":vk[p]),value:f.margin[p],disabled:t,onChange:h=>g(p,h)},p))})]}),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 us({label:e,value:t,disabled:n,onChange:r}){const i=W(),a=c.useId(),[s,u]=c.useState(()=>yd(t)),f=(t==null?void 0:t.unit)??el;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:s,disabled:n,inputMode:"decimal",onChange:g=>u(g.target.value),onBlur:()=>{const g=s.trim();if(!g){r(null);return}const p=Mr(g,f,!1);if(!p){u(yd(t));return}r(p),u(J(p.value))}}),o.jsxs("select",{className:d.lengthUnit,disabled:n,value:f,"aria-label":i("paragraphDialogLengthUnitAria"),onChange:g=>{const p=g.target.value;t&&r({...t,unit:p})},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 xd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',kk=cg.map(e=>e.id);function Ak(e){return{...Rr(),...e}}function Pk(e){const{align:t,alignMixed:n,list:r,listMixed:i,...a}=e;return a}function Dk({open:e,tab:t,value:n,fonts:r,disabled:i,printTabVisible:a=!1,customImagePicker:s,onCustomImagePick:u,onTabChange:f,onApply:g,onResetAtRule:p,onClose:h}){const x=W(),y=c.useId(),C=c.useRef(null),[b,v]=c.useState("general"),[k,A]=c.useState("spacing"),[R,N]=c.useState(n.font),[T,S]=c.useState(n.box),[P,_]=c.useState(n.backgroundImage),[D,E]=c.useState(n.atRule??Zt());if(c.useEffect(()=>{e&&(v("general"),A("spacing"),N(n.font),S(n.box),_(n.backgroundImage??jl()),E(n.atRule??Zt()),t==="print"&&!a&&f("font"))},[e,n,t,a,f]),c.useEffect(()=>{if(!e)return;const $=C.current,U=$==null?void 0:$.querySelector(xd);U==null||U.focus();const X=Q=>{if(Q.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;Q.preventDefault(),Q.stopPropagation(),h();return}if(Q.key!=="Tab"||!$)return;const oe=[...$.querySelectorAll(xd)];if(oe.length===0)return;const Y=oe[0],le=oe[oe.length-1];Q.shiftKey&&document.activeElement===Y?(Q.preventDefault(),le.focus()):!Q.shiftKey&&document.activeElement===le&&(Q.preventDefault(),Y.focus())};return document.addEventListener("keydown",X,!0),()=>document.removeEventListener("keydown",X,!0)},[e,h]),!e)return null;const j=x("pageDialogTitle"),F=t==="print"&&!a?"font":t;return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:h,children:o.jsxs("div",{ref:C,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,onMouseDown:$=>$.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:y,children:j}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":j,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":F==="font",onClick:()=>f("font"),children:x("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":F==="paragraph",onClick:()=>f("paragraph"),children:x("customStyleDialogTabParagraph")}),a?o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":F==="print",onClick:()=>f("print"),children:x("pageDialogTabPrint")}):null]}),F==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(_l,{tab:b,value:R,fonts:r,disabled:i,onTabChange:v,onChange:N})}):F==="paragraph"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(Il,{tab:k,value:Ak(T),disabled:i,tabs:kk,tablistLabelKey:"pageDialogTitle",backgroundImage:P,customImagePicker:s,onCustomImagePick:u,onBackgroundImageChange:_,onTabChange:$=>{$!=="general"&&A($)},onChange:$=>S(Pk($))})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(Sk,{value:D,disabled:i,onChange:E,onReset:()=>{E(Zt()),p==null||p()}})}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:h,children:x("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>g({font:R,box:T,backgroundImage:P,atRule:a?D:n.atRule??Zt()}),children:x("fontDialogOk")})]})]})})})}function Ek({open:e,disabled:t,onClose:n,onConfirm:r}){const i=W(),a=c.useId(),s=c.useRef(null);if(c.useEffect(()=>{if(!e)return;const f=s.current;if(!f)return;const g=f.querySelector('button:not([disabled]):not([tabindex="-1"])');g==null||g.focus();const p=h=>{h.key==="Escape"&&(h.preventDefault(),n())};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[e,n]),!e)return null;const u=!!t;return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:n,children:o.jsxs("div",{ref:s,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:f=>f.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:a,children:i("deletePageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":i("fontDialogCloseAria"),onClick:n,children:o.jsx(Be,{})})]}),o.jsx("div",{className:d.confirmBody,children:i("deletePageConfirmMessage")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:u,onClick:n,children:i("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:u,onClick:r,children:i("commandDeletePage")})]})]})})})}const Cd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function jk(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function wd(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 Rk(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 Tk({open:e,mode:t,styleId:n,name:r="",font:i,paragraph:a,canDelete:s=!1,busy:u,disabled:f,fonts:g,defaultOuterTab:p="font",onSave:h,onDelete:x,onClose:y}){const C=W(),b=c.useId(),v=c.useId(),k=c.useRef(null),[A,R]=c.useState(r),[N,T]=c.useState(p),[S,P]=c.useState("general"),[_,D]=c.useState("general"),[E,j]=c.useState(()=>wd(i)),[F,$]=c.useState(()=>Ms(a)),[U,X]=c.useState(!1);if(c.useEffect(()=>{e&&(R(r),T(p),P("general"),D("general"),j(wd(i)),$(Ms(a)),X(!1))},[e,r,i,a,p]),c.useEffect(()=>{if(!e)return;const ie=k.current,re=ie==null?void 0:ie.querySelector(Cd);re==null||re.focus();const L=Z=>{if(Z.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if(Z.preventDefault(),Z.stopPropagation(),U){X(!1);return}y();return}if(Z.key!=="Tab"||!ie)return;const ae=[...ie.querySelectorAll(Cd)];if(ae.length===0)return;const G=ae[0],ve=ae[ae.length-1];Z.shiftKey&&document.activeElement===G?(Z.preventDefault(),ve.focus()):!Z.shiftKey&&document.activeElement===ve&&(Z.preventDefault(),G.focus())};return document.addEventListener("keydown",L,!0),()=>document.removeEventListener("keydown",L,!0)},[e,y,U]),!e)return null;const Q=C(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),oe=A.trim().length>0,Y=!!(f||u),le=()=>{const ie=A.trim();ie&&h({id:n??jk(),name:ie,font:Rk(E),paragraph:Sf(F)})};return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:y,children:o.jsxs("div",{ref:k,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":b,"aria-busy":u||void 0,onMouseDown:ie=>ie.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:b,children:Q}),o.jsx("button",{type:"button",className:d.close,"aria-label":C("customStyleDialogCloseAria"),onClick:y,children:o.jsx(Be,{})})]}),U?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.confirmBody,children:C("customStyleDialogDeleteConfirm")}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:Y,onClick:()=>X(!1),children:C("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y||!n,onClick:()=>{n&&(x==null||x(n))},children:C("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:v,children:C("customStyleDialogName")}),o.jsx("input",{id:v,className:d.nameInput,value:A,disabled:Y,onChange:ie=>R(ie.target.value)})]})}),o.jsxs("div",{className:d.tabs,role:"tablist","aria-label":Q,children:[o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="font",onClick:()=>T("font"),children:C("customStyleDialogTabFont")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":N==="paragraph",onClick:()=>T("paragraph"),children:C("customStyleDialogTabParagraph")})]}),N==="font"?o.jsx("div",{className:d.nestedPanel,children:o.jsx(_l,{tab:S,value:E,fonts:g,disabled:Y,onTabChange:P,onChange:j})}):o.jsx("div",{className:d.nestedPanel,children:o.jsx(Il,{tab:_,value:F,disabled:Y,onTabChange:D,onChange:$})}),o.jsxs("div",{className:t==="edit"&&s?`${d.actions} ${d.actionsSpread}`:d.actions,children:[t==="edit"&&s?o.jsx("button",{type:"button",className:`${d.action} ${d.actionDanger}`,disabled:Y,onClick:()=>X(!0),children:C("customStyleDialogDelete")}):null,o.jsxs("div",{className:d.actionsEnd,children:[o.jsx("button",{type:"button",className:d.action,onClick:y,children:C("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:Y||!oe,onClick:le,children:C("fontDialogOk")})]})]})]})]})})})}const Nk='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Mk({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),s=c.useId(),u=c.useId(),f=c.useRef(null),g=c.useRef(null),[p,h]=c.useState(t);if(c.useEffect(()=>{e&&h(t)},[e,t]),c.useEffect(()=>{var b;if(!e)return;(b=g.current)==null||b.focus();const y=f.current,C=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),i();return}if(v.key!=="Tab"||!y)return;const k=[...y.querySelectorAll(Nk)];if(k.length===0)return;const A=k[0],R=k[k.length-1];v.shiftKey&&document.activeElement===A?(v.preventDefault(),R.focus()):!v.shiftKey&&document.activeElement===R&&(v.preventDefault(),A.focus())};return document.addEventListener("keydown",C,!0),()=>document.removeEventListener("keydown",C,!0)},[e,i]),!e)return null;const x=()=>{n||r(p)};return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:f,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:s,children:a("customCssDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("customCssDialogCloseAria"),onClick:i,children:o.jsx(Be,{})})]}),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:g,id:u,className:d.textarea,value:p,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:x,children:a("fontDialogOk")})]})]})})})}const vd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',_k={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function Lk({open:e,existingIds:t,disabled:n,onApply:r,onClose:i}){const a=W(),s=c.useId(),u=c.useId(),f=c.useId(),g=c.useRef(null),[p,h]=c.useState(""),[x,y]=c.useState(!1),C=c.useMemo(()=>new Set(t),[t]),b=Kf(p,C);if(c.useEffect(()=>{e&&(h(""),y(!1))},[e]),c.useEffect(()=>{if(!e)return;const R=g.current,N=R==null?void 0:R.querySelector(vd);N==null||N.focus();const T=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),i();return}if(S.key!=="Tab"||!R)return;const P=[...R.querySelectorAll(vd)];if(P.length===0)return;const _=P[0],D=P[P.length-1];S.shiftKey&&document.activeElement===_?(S.preventDefault(),D.focus()):!S.shiftKey&&document.activeElement===D&&(S.preventDefault(),_.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,i]),!e)return null;const v=x||p.trim().length>0?b:null,k=b===null&&!n,A=()=>{y(!0),!(b||n)&&r(p.trim())};return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:i,children:o.jsxs("div",{ref:g,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:R=>R.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:s,children:a("bookmarkDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:i,children:o.jsx(Be,{})})]}),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(tn,{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:p,disabled:n,"aria-invalid":v!==null,"aria-describedby":v?f:void 0,onChange:R=>h(R.target.value)}),v?o.jsx("p",{id:f,className:d.error,children:a(_k[v])}):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:!k,onClick:A,children:a("fontDialogOk")})]})]})})})}const Sd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',Ik={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},Fk={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function Bk({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:i,onClose:a}){const s=W(),u=c.useId(),f=c.useId(),g=c.useId(),p=c.useId(),h=c.useRef(null),x=c.useRef(null),[y,C]=c.useState("file"),[b,v]=c.useState(""),[k,A]=c.useState(""),[R,N]=c.useState(""),[T,S]=c.useState(""),[P,_]=c.useState(null),[D,E]=c.useState(!1);if(c.useEffect(()=>{e&&(C("file"),v(""),A(""),N(""),S(""),_(null),E(!1),x.current&&(x.current.value=""))},[e]),c.useEffect(()=>{if(!e)return;const Y=h.current,le=Y==null?void 0:Y.querySelector(Sd);le==null||le.focus();const ie=re=>{if(re.key==="Escape"){re.preventDefault(),re.stopPropagation(),a();return}if(re.key!=="Tab"||!Y)return;const L=[...Y.querySelectorAll(Sd)];if(L.length===0)return;const Z=L[0],ae=L[L.length-1];re.shiftKey&&document.activeElement===Z?(re.preventDefault(),ae.focus()):!re.shiftKey&&document.activeElement===ae&&(re.preventDefault(),Z.focus())};return document.addEventListener("keydown",ie,!0),()=>document.removeEventListener("keydown",ie,!0)},[e,a]),!e)return null;const j=y==="file"?k:y==="url"?b:"",F=y==="custom"?null:Nl(j),$=y==="custom"?null:y==="file"&&P?Fk[P]:F&&(y==="file"||b.trim().length>0)?Ik[F]:null,U=y!=="custom"&&F===null&&!(y==="file"&&P)&&!t&&!D,X=()=>{t||!n||i==null||i()},Q=()=>{U&&r({src:j.trim(),title:T.trim()})},oe=Y=>{var ie;const le=(ie=Y.target.files)==null?void 0:ie[0];le&&(E(!0),_(null),fw(le).then(re=>{A(re),N(le.name),C("file"),E(!1)},re=>{const L=re instanceof Error?re.message:"";A(""),N(""),C("file"),_(L==="tooLarge"||L==="type"?L:"type"),E(!1),x.current&&(x.current.value="")}))};return o.jsx(ue,{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:s("audioDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":s("audioDialogCloseAria"),onClick:a,children:o.jsx(Be,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:s("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>C("file"),children:s("audioDialogFile")}),o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>C("url"),children:s("audioDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>C("custom"),children:n.text}):null]}),y==="file"?o.jsxs("div",{className:d.fileRow,children:[o.jsx("input",{ref:x,type:"file",accept:aw,hidden:!0,disabled:t,"aria-label":s("audioDialogChooseFile"),onChange:oe}),o.jsx("button",{type:"button",className:d.action,disabled:t||D,onClick:()=>{var Y;return(Y=x.current)==null?void 0:Y.click()},children:s("audioDialogChooseFile")}),R?o.jsx("span",{className:d.fileName,children:R}):null]}):null,y==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:f,children:s("audioDialogUrl")}),o.jsx("input",{id:f,className:d.textInput,value:b,disabled:t,"aria-invalid":$!==null,"aria-describedby":$?p:void 0,onChange:Y=>v(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:g,children:s("audioDialogTitleField")}),o.jsx("input",{id:g,className:d.textInput,value:T,disabled:t,onChange:Y=>S(Y.target.value)})]}):null,$?o.jsx("p",{id:p,className:d.error,children:s($)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:s("fontDialogCancel")}),y!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!U,onClick:Q,children:s("fontDialogOk")}):null]})]})})})}const kd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])';function Hk({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:i,onClose:a}){const s=W(),u=c.useId(),f=c.useId(),g=c.useId(),p=c.useRef(null),[h,x]=c.useState(""),[y,C]=c.useState(""),[b,v]=c.useState(""),[k,A]=c.useState("file");if(c.useEffect(()=>{e&&(x(""),C(""),v(""),A("file"))},[e]),c.useEffect(()=>{if(!e)return;const T=p.current,S=T==null?void 0:T.querySelector(kd);S==null||S.focus();const P=_=>{if(_.key==="Escape"){_.preventDefault(),_.stopPropagation(),a();return}if(_.key!=="Tab"||!T)return;const D=[...T.querySelectorAll(kd)];if(D.length===0)return;const E=D[0],j=D[D.length-1];_.shiftKey&&document.activeElement===E?(_.preventDefault(),j.focus()):!_.shiftKey&&document.activeElement===j&&(_.preventDefault(),E.focus())};return document.addEventListener("keydown",P,!0),()=>document.removeEventListener("keydown",P,!0)},[e,a]),!e)return null;const R=ok(h)&&!t,N=()=>{R&&r({src:h.trim(),alt:y.trim(),title:b.trim()})};return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:a,children:o.jsxs("div",{ref:p,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:s("imageDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":s("imageDialogCloseAria"),onClick:a,children:o.jsx(Be,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx(dg,{src:h,disabled:t,customImagePicker:n,onCustomPick:i,onSourceChange:A,onSrcChange:x}),k!=="custom"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:f,children:s("imageDialogAlt")}),o.jsx("input",{id:f,className:d.textInput,value:y,disabled:t,onChange:T=>C(T.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:s("imageDialogTitleField")}),o.jsx("input",{id:g,className:d.textInput,value:b,disabled:t,onChange:T=>v(T.target.value)})]})]}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:s("fontDialogCancel")}),k!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!R,onClick:N,children:s("fontDialogOk")}):null]})]})})})}const zk=[{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}],Ok={left:ki,center:Si,right:Ai},Kk=["left","center","right"],$k={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},Uk=["width","height","lock"],Wk={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},Gk={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Vk={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Zk={value:1,unit:"pt"},qk={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 ds(e){return{top:e,right:e,bottom:e,left:e}}function Yk(e){for(const t of Fe)if(e[t])return e[t];return null}function Xk({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:i,onChange:a}){const s=W(),u=c.useId(),f=c.useId(),g=c.useId(),[p,h]=c.useState(()=>It(t.margin,ds(t.margin.top))),x=t.align==="center",y=(b,v)=>{if(t.sizeMode==="lock"&&v){const k=Tr(b,v,n);a({...t,width:k.width,height:k.height});return}a({...t,[b]:v})},C=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 v=Tr("width",t.width,n);a({...t,sizeMode:b,width:v.width,height:v.height});return}if(t.height){const v=Tr("height",t.height,n);a({...t,sizeMode:b,width:v.width,height:v.height});return}a({...t,sizeMode:b})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:d.tabs,role:"tablist","aria-label":s("imagePropertiesDialogTitle"),children:zk.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:s(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:s("imagePropertiesSize")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":s("imagePropertiesSizeMode"),children:Uk.map(b=>o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":t.sizeMode===b,disabled:r,onClick:()=>C(b),children:s(Wk[b])},b))}),o.jsx(Ci,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:b=>y("width",b)}),o.jsx(Ci,{label:s("imagePropertiesHeight"),inputAria:s("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:s("paragraphDialogAlignment")}),o.jsx("div",{className:d.iconRow,role:"radiogroup","aria-label":s("paragraphDialogAlignment"),children:Kk.map(b=>{const v=Ok[b];return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":t.align===b,"aria-label":s($k[b]),disabled:r,onClick:()=>{a({...t,align:t.align===b?null:b})},children:o.jsx(v,{})},b)})})]}):null,e==="border"?o.jsxs(o.Fragment,{children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:s("paragraphDialogMargin")}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:p,disabled:r||x,onChange:()=>{const b=!p;h(b),b&&a({...t,margin:ds(Yk(t.margin))})}}),s("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(p?["top"]:Fe).map(b=>o.jsx(De,{label:s(p?"paragraphDialogMargin":Gk[b]),value:t.margin[b],disabled:r||x&&(b==="left"||b==="right"),allowNegative:!0,onChange:v=>{const k=p?ds(v):{...t.margin,[b]:v};a({...t,margin:k})}},b))})]}),o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:s("paragraphDialogBorder")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:u,children:s("paragraphDialogBorderStyle")}),o.jsx("select",{id:u,className:d.select,value:t.border.style,disabled:r,onChange:b=>{const v=b.target.value;a({...t,border:{style:v,width:v==="none"?null:t.border.width??Zk,color:v==="none"?null:t.border.color}})},children:Di.map(b=>o.jsx("option",{value:b,children:s(Vk[b])},b))})]}),t.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(De,{label:s("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:b=>{a({...t,border:{...t.border,width:b}})}}),o.jsx(at,{label:s("paragraphDialogBorderColor"),noneLabel:s("colorNone"),value:t.border.color,disabled:r,onChange:b=>{a({...t,border:{...t.border,color:b}})}})]}):null,o.jsx(De,{label:s("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:qk})}}),s("paragraphDialogBoxShadow")]}),t.boxShadow?o.jsx(Ll,{shadow:t.boxShadow,disabled:r,onChange:b=>{a({...t,boxShadow:b})}}):null]})]}):null,e==="advanced"?o.jsxs(o.Fragment,{children:[o.jsx(ug,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:b=>{a(C1({...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:s("imagePropertiesRotation")}),o.jsx("div",{className:d.field,children:o.jsxs("div",{className:d.lengthRow,children:[o.jsx("input",{id:f,className:d.lengthInput,value:t.rotateDeg===null?"":J(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":s("imagePropertiesRotation"),onChange:b=>{const v=b.target.value.trim();if(!v){a({...t,rotateDeg:null});return}const k=Number(v.replace(",","."));Number.isFinite(k)&&a({...t,rotateDeg:k})}}),o.jsx("span",{className:d.lengthUnit,"aria-hidden":"true",children:s("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.label,children:s("imagePropertiesTabHover")}),o.jsx("p",{className:d.emptyHint,children:s("imagePropertiesHoverHelp")}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:s("imagePropertiesHoverCss")}),o.jsx("textarea",{id:g,className:d.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":s("imagePropertiesHoverCssAria"),onChange:b=>{a({...t,hoverCss:b.target.value})}})]})]}):null]})]})}const Ad='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function Jk({open:e,tab:t,value:n,aspectRatio:r=1,disabled:i,onTabChange:a,onApply:s,onClose:u}){const f=W(),g=c.useId(),p=c.useRef(null),[h,x]=c.useState(n);return c.useEffect(()=>{e&&x(n)},[e,n]),c.useEffect(()=>{if(!e)return;const y=p.current,C=y==null?void 0:y.querySelector(Ad);C==null||C.focus();const b=v=>{if(v.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;v.preventDefault(),v.stopPropagation(),u();return}if(v.key!=="Tab"||!y)return;const k=[...y.querySelectorAll(Ad)];if(k.length===0)return;const A=k[0],R=k[k.length-1];v.shiftKey&&document.activeElement===A?(v.preventDefault(),R.focus()):!v.shiftKey&&document.activeElement===R&&(v.preventDefault(),A.focus())};return document.addEventListener("keydown",b,!0),()=>document.removeEventListener("keydown",b,!0)},[e,u]),e?o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:u,children:o.jsxs("div",{ref:p,className:`${d.dialog} ${d.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":g,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:g,children:f("imagePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":f("imagePropertiesDialogCloseAria"),onClick:u,children:o.jsx(Be,{})})]}),o.jsx(Xk,{tab:t,value:h,aspectRatio:r,disabled:i,onTabChange:a,onChange:x}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:u,children:f("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:i,onClick:()=>s(h),children:f("fontDialogOk")})]})]})})}):null}const Qk="_frame_bwkh8_1",eA="_handle_bwkh8_9",tA="_handleEast_bwkh8_29",nA="_handleSouth_bwkh8_37",rA="_handleSouthEast_bwkh8_45",Nr={frame:Qk,handle:eA,handleEast:tA,handleSouth:nA,handleSouthEast:rA};function Dr(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const oA=[{handle:"e",className:Nr.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:Nr.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:Nr.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function ms(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function iA({img:e,onResize:t,onResizeEnd:n}){const r=W(),i=c.useRef(null),a=c.useRef(e),s=c.useRef(t),u=c.useRef(n),f=c.useRef(null);a.current=e,s.current=t,u.current=n;const g=k=>{const A=i.current;A&&(A.style.left=`${k.left}px`,A.style.top=`${k.top}px`,A.style.width=`${k.width}px`,A.style.height=`${k.height}px`)};c.useLayoutEffect(()=>{g(Dr(e));const k=()=>{e.isConnected&&g(Dr(e))};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[e]);const p=(k,A)=>{const R=f.current,N=a.current;if(!R||!N)return;const T=Ww(R.handle,R.start,{x:k-R.originX,y:A-R.originY});s.current(T.width,T.height),N.isConnected&&g(Dr(N))},h=()=>{if(!f.current)return;f.current=null;const k=a.current;u.current(),k!=null&&k.isConnected&&g(Dr(k))};c.useLayoutEffect(()=>{const k=R=>{if(!f.current)return;const N=ms(R);N&&p(N.x,N.y)},A=()=>{h()};return document.addEventListener("pointermove",k),document.addEventListener("pointerup",A),document.addEventListener("pointercancel",A),document.addEventListener("mousemove",k),document.addEventListener("mouseup",A),()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",A),document.removeEventListener("pointercancel",A),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",A)}},[]);const x=(k,A)=>{const R=ms(A);R&&(f.current={handle:k,start:Gw(a.current),originX:R.x,originY:R.y})},y=k=>A=>{A.preventDefault(),A.stopPropagation(),x(k,A);try{A.currentTarget.setPointerCapture(A.pointerId)}catch{}},C=k=>A=>{A.preventDefault(),A.stopPropagation(),x(k,A)},b=k=>{const A=ms(k);A&&p(A.x,A.y)};if(!e.isConnected)return null;const v=Dr(e);return Vs.createPortal(o.jsx("div",{ref:i,className:Nr.frame,"data-image-resize-overlay":"",style:{left:v.left,top:v.top,width:v.width,height:v.height},children:oA.map(k=>o.jsx("button",{type:"button",className:`${Nr.handle} ${k.className}`,style:{cursor:k.cursor},"aria-label":r(k.ariaKey),"data-resize-handle":k.handle,onPointerDown:y(k.handle),onPointerMove:b,onPointerUp:h,onPointerCancel:h,onMouseDown:C(k.handle),onMouseMove:b,onMouseUp:h},k.handle))}),document.body)}const Pd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function aA({open:e,tab:t,href:n,title:r,targetBlank:i,textDecorationNone:a,hoverMode:s,hoverColor:u,hoverHtml:f,bookmarks:g,selectedBookmarkId:p,disabled:h,onTabChange:x,onApply:y,onClose:C}){const b=W(),v=c.useId(),k=c.useId(),A=c.useId(),R=c.useId(),N=c.useId(),T=c.useRef(null),[S,P]=c.useState(n),[_,D]=c.useState(r),[E,j]=c.useState(i),[F,$]=c.useState(a),[U,X]=c.useState(s),[Q,oe]=c.useState(u),[Y,le]=c.useState(f),[ie,re]=c.useState(p);if(c.useEffect(()=>{e&&(P(n),D(r),j(i),$(a),X(s),oe(u),le(f),re(p))},[e,n,r,i,a,s,u,f,p]),c.useEffect(()=>{if(!e)return;const G=T.current,ve=G==null?void 0:G.querySelector(Pd);ve==null||ve.focus();const He=Ne=>{if(Ne.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;Ne.preventDefault(),Ne.stopPropagation(),C();return}if(Ne.key!=="Tab"||!G)return;const Bt=[...G.querySelectorAll(Pd)];if(Bt.length===0)return;const ln=Bt[0],Ae=Bt[Bt.length-1];Ne.shiftKey&&document.activeElement===ln?(Ne.preventDefault(),Ae.focus()):!Ne.shiftKey&&document.activeElement===Ae&&(Ne.preventDefault(),ln.focus())};return document.addEventListener("keydown",He,!0),()=>document.removeEventListener("keydown",He,!0)},[e,C,t,U]),!e)return null;const L=()=>_i({title:_,targetBlank:E,textDecorationNone:F,hoverMode:U,hoverColor:Q,hoverHtml:Y}),Z=()=>{const G=S.trim();!G||h||y({...L(),href:G})},ae=()=>{!ie||h||y({...L(),href:`#${ie}`})};return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:C,children:o.jsxs("div",{ref:T,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:G=>G.stopPropagation(),children:[o.jsx("h2",{className:d.header,id:v,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:()=>x("link"),children:b("linkDialogTabLink")}),o.jsx("button",{type:"button",className:d.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>x("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:k,children:b("linkDialogHref")}),o.jsx("input",{id:k,className:d.textInput,value:S,disabled:h,onChange:G=>P(G.target.value)})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:A,children:b("linkDialogHoverTitle")}),o.jsx("input",{id:A,className:d.textInput,value:_,disabled:h,onChange:G=>D(G.target.value)})]}),o.jsxs("label",{className:d.mark,children:[o.jsx("input",{type:"checkbox",checked:E,disabled:h,onChange:G=>j(G.target.checked)}),b("linkDialogTargetBlank")]})]}):g.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:R,children:b("linkDialogBookmark")}),o.jsxs("select",{id:R,className:`${d.select} ${d.fullSelect}`,value:ie,disabled:h,onChange:G=>re(G.target.value),children:[o.jsx("option",{value:""}),g.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=>$(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":U==="color",disabled:h,onClick:()=>X("color"),children:b("linkDialogHoverColor")}),o.jsx("button",{type:"button",className:d.action,"aria-pressed":U==="html",disabled:h,onClick:()=>X("html"),children:b("linkDialogHoverHtml")})]}),U==="color"?o.jsx(at,{label:b("linkDialogHoverColorField"),noneLabel:b("colorNone"),value:Q,disabled:h,onChange:oe}):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=>le(G.target.value)})]})]})]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,disabled:h||!ie,onClick:ae,children:b("linkDialogSelect")}),o.jsx("button",{type:"button",className:d.action,onClick:C,children:b("fontDialogCancel")}),o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:h||!S.trim(),onClick:Z,children:b("fontDialogOk")})]})]})})})}const Dd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',Ed={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function sA({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:i,onClose:a}){const s=W(),u=c.useId(),f=c.useId(),g=c.useId(),p=c.useId(),h=c.useRef(null),[x,y]=c.useState("url"),[C,b]=c.useState(""),[v,k]=c.useState("");if(c.useEffect(()=>{e&&(y("url"),b(""),k(""))},[e]),c.useEffect(()=>{if(!e)return;const P=h.current,_=P==null?void 0:P.querySelector(Dd);_==null||_.focus();const D=E=>{if(E.key==="Escape"){E.preventDefault(),E.stopPropagation(),a();return}if(E.key!=="Tab"||!P)return;const j=[...P.querySelectorAll(Dd)];if(j.length===0)return;const F=j[0],$=j[j.length-1];E.shiftKey&&document.activeElement===F?(E.preventDefault(),$.focus()):!E.shiftKey&&document.activeElement===$&&(E.preventDefault(),F.focus())};return document.addEventListener("keydown",D,!0),()=>document.removeEventListener("keydown",D,!0)},[e,a]),!e)return null;const A=x==="custom"?null:qf(C),R=x==="custom"?null:A&&C.trim().length>0?Ed[A]:A==="empty"&&C.trim().length===0?null:A?Ed[A]:null,N=x!=="custom"&&A===null&&!t&&C.trim().length>0,T=()=>{t||!n||i==null||i()},S=()=>{N&&r({url:C.trim(),title:v.trim()})};return o.jsx(ue,{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:P=>P.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:u,children:s("youtubeDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":s("youtubeDialogCloseAria"),onClick:a,children:o.jsx(Be,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsxs("fieldset",{className:d.group,children:[o.jsx("legend",{className:d.subLabel,children:s("audioDialogSource")}),o.jsxs("div",{className:d.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":x==="url",disabled:t,onClick:()=>y("url"),children:s("youtubeDialogUrl")}),n?o.jsx("button",{type:"button",className:d.action,role:"radio","aria-checked":x==="custom",disabled:t,onClick:()=>y("custom"),children:n.text}):null]}),x==="url"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:f,children:s("youtubeDialogUrl")}),o.jsx("input",{id:f,className:d.textInput,value:C,disabled:t,"aria-invalid":R!==null,"aria-describedby":R?p:void 0,onChange:P=>b(P.target.value)})]}):null,x==="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]}),x!=="custom"?o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:g,children:s("youtubeDialogTitleField")}),o.jsx("input",{id:g,className:d.textInput,value:v,disabled:t,onChange:P=>k(P.target.value)})]}):null,R?o.jsx("p",{id:p,className:d.error,children:s(R)}):null]}),o.jsxs("div",{className:d.actions,children:[o.jsx("button",{type:"button",className:d.action,onClick:a,children:s("fontDialogCancel")}),x!=="custom"?o.jsx("button",{type:"button",className:`${d.action} ${d.actionPrimary}`,disabled:!N,onClick:S,children:s("fontDialogOk")}):null]})]})})})}const lA="_grid_1bpma_1",cA="_cell_1bpma_8",uA="_sizeLabel_1bpma_27",dA="_sizeFields_1bpma_33",mA="_numberInput_1bpma_37",_n={grid:lA,cell:cA,sizeLabel:uA,sizeFields:dA,numberInput:mA},jd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',Vt={rows:3,cols:3};function fA({open:e,disabled:t,onApply:n,onClose:r}){const i=W(),a=c.useId(),s=c.useId(),u=c.useId(),f=c.useRef(null),[g,p]=c.useState(Vt.rows),[h,x]=c.useState(Vt.cols),[y,C]=c.useState(String(Vt.rows)),[b,v]=c.useState(String(Vt.cols)),[k,A]=c.useState(!1);if(c.useEffect(()=>{e&&(p(Vt.rows),x(Vt.cols),C(String(Vt.rows)),v(String(Vt.cols)),A(!1))},[e]),c.useEffect(()=>{if(!e)return;const D=f.current,E=D==null?void 0:D.querySelector(jd);E==null||E.focus();const j=F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),r();return}if(F.key!=="Tab"||!D)return;const $=[...D.querySelectorAll(jd)];if($.length===0)return;const U=$[0],X=$[$.length-1];F.shiftKey&&document.activeElement===U?(F.preventDefault(),X.focus()):!F.shiftKey&&document.activeElement===X&&(F.preventDefault(),U.focus())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[e,r]),!e)return null;const N=gf(g,h)&&!t,T=(D,E)=>{const j=Math.min(zn,Math.max(Hn,D)),F=Math.min(zn,Math.max(Hn,E));p(j),x(F),C(String(j)),v(String(F))},S=(D,E)=>{const j=Number.parseInt(D,10);if(!Number.isFinite(j)){E==="rows"?C(String(g)):v(String(h));return}A(!0),E==="rows"?T(j,h):T(g,j)},P=(D,E)=>{const j=D.replace(/\D/g,"");if(E==="rows"?C(j):v(j),j==="")return;const F=Number.parseInt(j,10);Number.isFinite(F)&&(A(!0),E==="rows"?T(F,h):T(g,F))},_=D=>{(D.key==="e"||D.key==="E"||D.key==="+"||D.key==="-"||D.key===".")&&D.preventDefault()};return o.jsx(ue,{children:o.jsx("div",{className:d.backdrop,role:"presentation",onMouseDown:r,children:o.jsxs("div",{ref:f,className:d.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:D=>D.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(Be,{})})]}),o.jsxs("div",{className:d.body,children:[o.jsx("div",{className:_n.grid,role:"grid","aria-label":i("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:Bu},(D,E)=>Array.from({length:Bu},(j,F)=>{const $=E+1,U=F+1,X=$<=g&&U<=h;return o.jsx("button",{type:"button",className:_n.cell,role:"gridcell","data-active":X?"true":void 0,"aria-label":`${$} × ${U}`,"aria-pressed":X&&$===g&&U===h,disabled:t,onMouseEnter:()=>{k||T($,U)},onClick:()=>{A(!0),T($,U)}},`${$}-${U}`)}))}),o.jsxs("p",{className:_n.sizeLabel,children:[i("tableDialogSize"),": ",g," × ",h]}),o.jsxs("div",{className:`${d.sizeRow} ${_n.sizeFields}`,children:[o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:s,children:i("tableDialogRows")}),o.jsx("input",{id:s,className:_n.numberInput,type:"number",inputMode:"numeric",min:Hn,max:zn,step:1,value:y,disabled:t,onKeyDown:_,onChange:D=>P(D.target.value,"rows"),onBlur:()=>S(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:_n.numberInput,type:"number",inputMode:"numeric",min:Hn,max:zn,step:1,value:b,disabled:t,onKeyDown:_,onChange:D=>P(D.target.value,"cols"),onBlur:()=>S(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:g,cols:h})},children:i("tableDialogInsert")})]})]})})})}const gA={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},pA={value:1,unit:"pt"},hA={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 bA({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(De,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:s=>n({...e,width:s})}),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:s=>{const u=s.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(De,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:s=>n({...e,borderSpacing:s})}):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:s=>{const u=s.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??pA,color:u==="none"?null:e.border.color}})},children:Di.map(s=>o.jsx("option",{value:s,children:r(gA[s])},s))})]}),e.border.style!=="none"?o.jsxs(o.Fragment,{children:[o.jsx(De,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:s=>n({...e,border:{...e.border,width:s}})}),o.jsx(at,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:s=>n({...e,border:{...e.border,color:s}})})]}):null,o.jsx(De,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:s=>n({...e,borderRadius:s})}),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:hA})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?o.jsx(Ll,{shadow:e.boxShadow,disabled:t,onChange:s=>n({...e,boxShadow:s})}):null]})]})}const Rd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function yA({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),s=c.useId(),u=c.useRef(null),[f,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(Rd);h==null||h.focus();const x=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!p)return;const C=[...p.querySelectorAll(Rd)];if(C.length===0)return;const b=C[0],v=C[C.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),v.focus()):!y.shiftKey&&document.activeElement===v&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,i]),e?o.jsx(ue,{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":s,onMouseDown:p=>p.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:s,children:a("tablePropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:i,children:o.jsx(Be,{})})]}),o.jsx(bA,{value:f,disabled:n,onChange:g}),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(f),children:a("fontDialogOk")})]})]})})}):null}const xA=["left","center","right"],CA={left:ki,center:Si,right:Ai},wA={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},vA={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},SA={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Vo(e){return{top:e,right:e,bottom:e,left:e}}function fs(e){for(const t of Fe)if(e[t])return e[t];return null}function kA({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),a=c.useId(),s=c.useId(),[u,f]=c.useState(()=>It(e.padding,Vo(fs(e.padding))));return c.useEffect(()=>{f(It(e.padding,Vo(fs(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(at,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:g=>n({...e,backgroundColor:g})}),o.jsx(at,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:g=>n({...e,color:g})}),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 g=!u;f(g),g&&n({...e,padding:Vo(fs(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(u?["top"]:Fe).map(g=>o.jsx(De,{label:r(u?"paragraphDialogPadding":vA[g]),value:e.padding[g],disabled:t,onChange:p=>{const h=u?Vo(p):{...e.padding,[g]:p};n({...e,padding:h})}},g))})]}),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:xA.map(g=>{const p=CA[g],h=(e.textAlign??"left")===g;return o.jsx("button",{type:"button",className:d.iconButton,role:"radio","aria-checked":h,"aria-label":r(wA[g]),disabled:t,onClick:()=>{n({...e,textAlign:g==="left"?null:g})},children:o.jsx(p,{})},g)})})]}),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:g=>{const p=g.target.value;n({...e,verticalAlign:p||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Ii.map(g=>o.jsx("option",{value:g,children:r(SA[g])},g))]})]}),o.jsx(De,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:g=>n({...e,width:g})}),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:g=>{const p=Number.parseInt(g.target.value,10);n({...e,colSpan:Number.isFinite(p)?Math.max(1,p):1})}})]}),o.jsxs("div",{className:d.field,children:[o.jsx("label",{className:d.label,htmlFor:s,children:r("cellPropertiesRowSpan")}),o.jsx("input",{id:s,className:d.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:g=>{const p=Number.parseInt(g.target.value,10);n({...e,rowSpan:Number.isFinite(p)?Math.max(1,p):1})}})]})]})]})}const Td='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function AA({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),s=c.useId(),u=c.useRef(null),[f,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(Td);h==null||h.focus();const x=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!p)return;const C=[...p.querySelectorAll(Td)];if(C.length===0)return;const b=C[0],v=C[C.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),v.focus()):!y.shiftKey&&document.activeElement===v&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,i]),e?o.jsx(ue,{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":s,onMouseDown:p=>p.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:s,children:a("cellPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:i,children:o.jsx(Be,{})})]}),o.jsx(kA,{value:f,disabled:n,onChange:g}),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(f),children:a("fontDialogOk")})]})]})})}):null}const PA={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},DA={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Zo(e){return{top:e,right:e,bottom:e,left:e}}function gs(e){for(const t of Fe)if(e[t])return e[t];return null}function EA({value:e,disabled:t,onChange:n}){const r=W(),i=c.useId(),[a,s]=c.useState(()=>It(e.padding,Zo(gs(e.padding))));return c.useEffect(()=>{s(It(e.padding,Zo(gs(e.padding))))},[e.padding]),o.jsxs("div",{className:d.body,children:[o.jsx(at,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),o.jsx(at,{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;s(u),u&&n({...e,padding:Zo(gs(e.padding))})}}),r("paragraphDialogLinkSides")]}),o.jsx("div",{className:d.sideGrid,children:(a?["top"]:Fe).map(u=>o.jsx(De,{label:r(a?"paragraphDialogPadding":PA[u]),value:e.padding[u],disabled:t,onChange:f=>{const g=a?Zo(f):{...e.padding,[u]:f};n({...e,padding:g})}},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 f=u.target.value;n({...e,verticalAlign:f||null})},children:[o.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Ii.map(u=>o.jsx("option",{value:u,children:r(DA[u])},u))]})]}),o.jsx(De,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}const Nd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function jA({open:e,value:t,disabled:n,onApply:r,onClose:i}){const a=W(),s=c.useId(),u=c.useRef(null),[f,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(Nd);h==null||h.focus();const x=y=>{if(y.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;y.preventDefault(),y.stopPropagation(),i();return}if(y.key!=="Tab"||!p)return;const C=[...p.querySelectorAll(Nd)];if(C.length===0)return;const b=C[0],v=C[C.length-1];y.shiftKey&&document.activeElement===b?(y.preventDefault(),v.focus()):!y.shiftKey&&document.activeElement===v&&(y.preventDefault(),b.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,i]),e?o.jsx(ue,{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":s,onMouseDown:p=>p.stopPropagation(),children:[o.jsxs("div",{className:d.headerRow,children:[o.jsx("h2",{className:d.header,id:s,children:a("rowPropertiesDialogTitle")}),o.jsx("button",{type:"button",className:d.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:i,children:o.jsx(Be,{})})]}),o.jsx(EA,{value:f,disabled:n,onChange:g}),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(f),children:a("fontDialogOk")})]})]})})}):null}const RA="_backdrop_9d3gw_1",TA="_dialog_9d3gw_12",NA="_headerRow_9d3gw_29",MA="_header_9d3gw_29",_A="_close_9d3gw_44",LA="_body_9d3gw_66",IA="_frame_9d3gw_75",FA="_actions_9d3gw_83",BA="_action_9d3gw_83",Mt={backdrop:RA,dialog:TA,headerRow:NA,header:MA,close:_A,body:LA,frame:IA,actions:FA,action:BA},Md='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function HA({open:e,html:t,onClose:n}){const r=W(),i=c.useId(),a=c.useRef(null),s=c.useRef(null);return c.useEffect(()=>{if(!e)return;const u=a.current,f=u==null?void 0:u.querySelector(Md);f==null||f.focus();const g=p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),n();return}if(p.key!=="Tab"||!u)return;const h=[...u.querySelectorAll(Md)];if(h.length===0)return;const x=h[0],y=h[h.length-1];p.shiftKey&&document.activeElement===x?(p.preventDefault(),y.focus()):!p.shiftKey&&document.activeElement===y&&(p.preventDefault(),x.focus())};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[e,n]),c.useEffect(()=>{var f;if(!e)return;const u=(f=s.current)==null?void 0:f.contentDocument;u&&Ss(u,t,r("previewDialogTitle"))},[e,t,r]),e?o.jsx(ue,{children:o.jsx("div",{className:Mt.backdrop,role:"presentation",onMouseDown:n,children:o.jsxs("div",{ref:a,className:Mt.dialog,role:"dialog","aria-modal":"true","aria-labelledby":i,onMouseDown:u=>u.stopPropagation(),children:[o.jsxs("div",{className:Mt.headerRow,children:[o.jsx("h2",{className:Mt.header,id:i,children:r("previewDialogTitle")}),o.jsx("button",{type:"button",className:Mt.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:o.jsx(Be,{})})]}),o.jsx("div",{className:Mt.body,children:o.jsx("iframe",{ref:s,className:Mt.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var f;const u=(f=s.current)==null?void 0:f.contentDocument;u&&Ss(u,t,r("previewDialogTitle"))}})}),o.jsx("div",{className:Mt.actions,children:o.jsx("button",{type:"button",className:Mt.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const mg="commspliant-html-editor.darkMode";function zA(e){return typeof e=="boolean"?e:null}function _d(){try{const e=localStorage.getItem(mg);return e?zA(JSON.parse(e)):null}catch{return null}}function OA(e){try{localStorage.setItem(mg,JSON.stringify(e))}catch{}}const fg="commspliant-html-editor.pageZoom",KA=new Set(["fitWidth","fitPage"]);function $A(e){return typeof e=="string"&&KA.has(e)||typeof e=="number"&&yy.includes(e)?e:null}function UA(){try{const e=localStorage.getItem(fg);return e?$A(JSON.parse(e)):null}catch{return null}}function WA(e){try{localStorage.setItem(fg,JSON.stringify(e))}catch{}}const gg="commspliant-html-editor.toolbarPosition",GA=["top","left","right","bottom"];function pg(e){return typeof e=="string"&&GA.includes(e)?e:null}function Ld(){try{const e=localStorage.getItem(gg);return e?pg(JSON.parse(e)):null}catch{return null}}function VA(e){try{localStorage.setItem(gg,JSON.stringify(e))}catch{}}const ZA="_panel_6xdnw_1",qA="_header_6xdnw_17",YA="_title_6xdnw_26",XA="_close_6xdnw_32",JA="_messages_6xdnw_48",QA="_empty_6xdnw_57",eP="_message_6xdnw_48",tP="_messageHeader_6xdnw_69",nP="_author_6xdnw_77",rP="_time_6xdnw_81",oP="_body_6xdnw_86",iP="_reply_6xdnw_92",aP="_input_6xdnw_100",sP="_post_6xdnw_111",Oe={panel:ZA,header:qA,title:YA,close:XA,messages:JA,empty:QA,message:eP,messageHeader:tP,author:nP,time:rP,body:oP,reply:iP,input:aP,post:sP};function lP(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function cP({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:i,onPost:a,onClose:s}){const u=W(),[f,g]=c.useState(""),p=c.useRef(null);c.useEffect(()=>{var b;(b=p.current)==null||b.focus()},[e==null?void 0:e.id]);const h=!n&&r&&f.trim().length>0,x=c.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),y=x.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const C=()=>{const b=f.trim();!b||!h||(a(b),g(""))};return Vs.createPortal(o.jsxs("div",{ref:i,className:Oe.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[o.jsxs("div",{className:Oe.header,children:[o.jsx("h2",{className:Oe.title,children:u("commentPanelTitle")}),o.jsx("button",{type:"button",className:Oe.close,onClick:s,"aria-label":u("commentPanelCloseAria"),children:o.jsx(Be,{})})]}),o.jsx("div",{className:Oe.messages,children:x.length===0?o.jsx("p",{className:Oe.empty,children:u("commentEmpty")}):x.map(b=>o.jsxs("article",{className:Oe.message,children:[o.jsxs("header",{className:Oe.messageHeader,children:[o.jsx("span",{className:Oe.author,children:b.userName}),o.jsx("time",{className:Oe.time,dateTime:b.createdAt,children:lP(b.createdAt,t)})]}),o.jsx("p",{className:Oe.body,children:b.message})]},b.id))}),o.jsxs("div",{className:Oe.reply,children:[o.jsx("textarea",{ref:p,className:Oe.input,value:f,onChange:b=>g(b.target.value),placeholder:y,rows:3,disabled:n||!r}),o.jsx("button",{type:"button",className:Oe.post,onClick:C,disabled:!h,children:u("commentPost")})]})]}),document.body)}function uP({enabled:e,onHtml:t}){const[n,r]=c.useState(!1),i=c.useRef(0),a=c.useRef(e),s=c.useRef(t);a.current=e,s.current=t;const u=c.useCallback(()=>{i.current=0,r(!1)},[]);c.useEffect(()=>{e||u()},[e,u]);const f=c.useCallback(x=>{!a.current||!Bo(x.dataTransfer)||(x.preventDefault(),i.current+=1,r(!0))},[]),g=c.useCallback(x=>{!a.current||!Bo(x.dataTransfer)||(x.preventDefault(),x.dataTransfer&&(x.dataTransfer.dropEffect="copy"))},[]),p=c.useCallback(x=>{if(!a.current||!Bo(x.dataTransfer))return;const y=x.relatedTarget;y instanceof Node&&x.currentTarget.contains(y)||(i.current=Math.max(0,i.current-1),i.current===0&&r(!1))},[]),h=c.useCallback(x=>{if(!a.current||!Bo(x.dataTransfer))return;x.preventDefault(),u();const y=Fb(x.dataTransfer);y&&bl(y).then(C=>{a.current&&s.current(C)},()=>{})},[u]);return{dragging:n,onDragEnter:f,onDragOver:g,onDragLeave:p,onDrop:h}}const dP={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:Lp,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Rp,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:ni,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},deletePage:{id:"deletePage",command:"deletePage",icon:ni,labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:"canDeletePage"}}},mP=400,Id=100;function fP(e){let t=[],n=e,r=[],i=!1,a=!1,s=0;function u(){t.length<=Id||t.splice(0,t.length-Id)}function f(y){t.push(y),u()}function g(y,C){if(i){n=y,i=!1;return}if(y===n)return;const b=Date.now(),v=(C==null?void 0:C.coalesce)===!0;if(v&&a&&b-s<mP){n=y,s=b;return}f(n),n=y,r=[],s=b,a=v}function p(){return t.length===0?null:(a=!1,r.push(n),n=t.pop(),n)}function h(){return r.length===0?null:(a=!1,f(n),n=r.pop(),n)}function x(y){if(i){n=y,i=!1;return}y!==n&&(f(n),n=y,r=[],a=!1)}return{record:g,undo:p,redo:h,canUndo:()=>t.length>0,canRedo:()=>r.length>0,syncExternal:x,markApplying:()=>{i=!0}}}function nn(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function wi(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):nn(e,t):""}const wt="fullscreen",Us="commspliant-html-editor.toolbarCustomization";function Ws(e){const t=e.filter(n=>n!==wt);return e.includes(wt)?[...t,wt]:t}function Fl(e,t){if(!t||t.length===0)return Ws(e);const n=new Set(e),r=t.filter(s=>n.has(s)),i=new Set(r),a=[...r];for(let s=0;s<e.length;s++){const u=e[s];if(i.has(u))continue;let f=0;for(let g=s-1;g>=0;g--){const p=e[g],h=a.indexOf(p);if(h>=0){f=h+1;break}}a.splice(f,0,u),i.add(u)}return Ws(a)}function gP(e,t){const n=new Map(e.map(s=>[s.id,s])),r=Fl(e.map(s=>s.id),t==null?void 0:t.groupOrder),i=new Set((t==null?void 0:t.hiddenItemIds)??[]),a=[];for(const s of r){const u=n.get(s);if(!u)continue;const f=u.items.filter(g=>!i.has(g));f.length!==0&&a.push({id:s,items:f})}return a}function pP(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 hP(){try{const e=localStorage.getItem(Us);return e?pP(JSON.parse(e)):null}catch{return null}}function bP(e){try{if(!e){localStorage.removeItem(Us);return}localStorage.setItem(Us,JSON.stringify(e))}catch{}}function Bl(e,t){return Fl(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function yP(e,t,n,r){const i=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?i.delete(n):i.add(n),{groupOrder:Bl(e,t),hiddenItemIds:[...i]}}function hg(e,t,n,r){const i=Bl(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===wt||r===wt)return{groupOrder:i,hiddenItemIds:a};const s=i.indexOf(n),u=i.indexOf(r);if(s<0||u<0||s===u)return{groupOrder:i,hiddenItemIds:a};const f=[...i],[g]=f.splice(s,1);return f.splice(u,0,g),{groupOrder:Ws(f),hiddenItemIds:a}}function Fd(e,t,n,r){const i=Bl(e,t),a=i.filter(f=>f!==wt),s=a.indexOf(n),u=s+r;return s<0||u<0||u>=a.length?{groupOrder:i,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:hg(e,t,n,a[u])}const xP="_backdrop_11w4e_1",CP="_dialog_11w4e_12",wP="_header_11w4e_31",vP="_body_11w4e_39",SP="_group_11w4e_49",kP="_groupDragging_11w4e_55",AP="_groupDropTarget_11w4e_59",PP="_groupHeader_11w4e_64",DP="_groupTitle_11w4e_72",EP="_dragHandle_11w4e_77",jP="_moveButton_11w4e_78",RP="_items_11w4e_119",TP="_item_11w4e_119",NP="_itemIcon_11w4e_135",MP="_itemTitle_11w4e_144",_P="_itemCheckbox_11w4e_151",LP="_actions_11w4e_155",IP="_action_11w4e_155",FP="_spinnerWrap_11w4e_191",BP="_spinner_11w4e_191",ye={backdrop:xP,dialog:CP,header:wP,body:vP,group:SP,groupDragging:kP,groupDropTarget:AP,groupHeader:PP,groupTitle:DP,dragHandle:EP,moveButton:jP,items:RP,item:TP,itemIcon:NP,itemTitle:MP,itemCheckbox:_P,actions:LP,action:IP,spinnerWrap:FP,spinner:BP},Bd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function HP(){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 zP({open:e,catalog:t,groups:n,settings:r,loading:i=!1,busy:a=!1,disabled:s,onChange:u,onReset:f,onClose:g}){const p=W(),h=c.useId(),x=c.useRef(null),[y,C]=c.useState(null),[b,v]=c.useState(null),k=Fl(n.map(j=>j.id),r==null?void 0:r.groupOrder),A=new Set((r==null?void 0:r.hiddenItemIds)??[]),R=new Map(n.map(j=>[j.id,j])),N=k.map(j=>R.get(j)).filter(j=>!!j),T=s||a||i;if(c.useEffect(()=>{e||(C(null),v(null))},[e]),c.useEffect(()=>{if(!e)return;const j=x.current,F=j==null?void 0:j.querySelector(Bd);F==null||F.focus();const $=U=>{if(U.key==="Escape"){U.preventDefault(),U.stopPropagation(),g();return}if(U.key!=="Tab"||!j)return;const X=[...j.querySelectorAll(Bd)];if(X.length===0)return;const Q=X[0],oe=X[X.length-1];U.shiftKey&&document.activeElement===Q?(U.preventDefault(),oe.focus()):!U.shiftKey&&document.activeElement===oe&&(U.preventDefault(),Q.focus())};return document.addEventListener("keydown",$,!0),()=>document.removeEventListener("keydown",$,!0)},[e,g]),!e)return null;const S=N.map(j=>j.id).filter(j=>j!==wt),P=(j,F)=>{if(T||F===wt){j.preventDefault();return}j.dataTransfer.setData("text/plain",F),j.dataTransfer.effectAllowed="move",C(F)},_=(j,F)=>{T||F===wt||!y||y===F||(j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move"),v(F))},D=(j,F)=>{var U;j.preventDefault();const $=((U=j.dataTransfer)==null?void 0:U.getData("text/plain"))||y;C(null),v(null),!(!$||$===F||T)&&u(hg(r,n,$,F))},E=()=>{C(null),v(null)};return o.jsx(ue,{children:o.jsx("div",{className:ye.backdrop,role:"presentation",onMouseDown:g,children:o.jsxs("div",{ref:x,className:ye.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:ye.header,id:h,children:p("customizeToolbarDialogTitle")}),o.jsx("div",{className:ye.body,children:i?o.jsx("div",{className:ye.spinnerWrap,role:"status","aria-live":"polite","aria-label":p("customizeToolbarDialogLoading"),children:o.jsx("span",{className:ye.spinner,"aria-hidden":"true"})}):N.map(j=>{const F=t.groups[j.id],$=F?nn(p,F):j.id,U=j.id===wt,X=S.indexOf(j.id);return o.jsxs("section",{className:[ye.group,y===j.id?ye.groupDragging:"",b===j.id?ye.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":j.id,"aria-label":$,onDragOver:Q=>_(Q,j.id),onDrop:Q=>D(Q,j.id),onDragLeave:()=>{b===j.id&&v(null)},children:[o.jsxs("div",{className:ye.groupHeader,children:[o.jsx("button",{type:"button",className:ye.dragHandle,draggable:!T&&!U,disabled:T||U,"aria-label":p("customizeToolbarDragHandle"),onDragStart:Q=>P(Q,j.id),onDragEnd:E,children:o.jsx(HP,{})}),o.jsx("span",{className:ye.groupTitle,children:$}),o.jsx("button",{type:"button",className:ye.moveButton,disabled:T||U||X<=0,"aria-label":p("customizeToolbarMoveUp"),onClick:()=>u(Fd(r,n,j.id,-1)),children:"↑"}),o.jsx("button",{type:"button",className:ye.moveButton,disabled:T||U||X<0||X>=S.length-1,"aria-label":p("customizeToolbarMoveDown"),onClick:()=>u(Fd(r,n,j.id,1)),children:"↓"})]}),o.jsx("div",{className:ye.items,children:j.items.map(Q=>{const oe=t.items[Q];if(!oe)return null;const Y=oe.icon,le=nn(p,oe),ie=`${h}-${j.id}-${Q}`,re=!A.has(Q);return o.jsxs("label",{className:ye.item,htmlFor:ie,children:[o.jsx("span",{className:ye.itemIcon,"aria-hidden":"true",children:Y?o.jsx(Y,{}):le.slice(0,2)}),o.jsx("span",{className:ye.itemTitle,children:le}),o.jsx("input",{id:ie,className:ye.itemCheckbox,type:"checkbox",checked:re,disabled:T,"aria-label":`${le}: ${p("customizeToolbarItemVisible")}`,onChange:L=>u(yP(r,n,Q,L.target.checked))})]},Q)})})]},j.id)})}),o.jsxs("div",{className:ye.actions,children:[o.jsx("button",{type:"button",className:ye.action,disabled:T,onClick:f,children:p("customizeToolbarDialogReset")}),o.jsx("button",{type:"button",className:ye.action,"aria-label":p("customizeToolbarDialogCloseAria"),onClick:g,children:p("customizeToolbarDialogClose")})]})]})})})}function OP(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(s=>n.includes(s.id)),a=r===void 0?e.iconGroups:e.iconGroups.map(s=>({id:s.id,items:s.items.filter(u=>r.includes(u))})).filter(s=>s.items.length>0);return{menus:i,iconGroups:a}}const KP={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:Np,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:wp,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Ep,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},qo=4;function bg({icon:e,value:t,mixed:n,noneKey:r,labelKey:i,ariaKey:a,fallbackCustom:s,disabled:u,onChange:f}){const g=W(),p=c.useId(),h=c.useRef(null),x=c.useRef(null),y=c.useRef(null),[C,b]=c.useState(!1),[v,k]=c.useState({top:0,left:0}),A=c.useCallback(()=>{const P=x.current,_=y.current;if(!P)return;const D=P.getBoundingClientRect(),E=(_==null?void 0:_.offsetHeight)??0,j=(_==null?void 0:_.offsetWidth)??200;let F=D.bottom;F+E>window.innerHeight-qo&&(F=Math.max(qo,D.top-E));const $=Math.min(Math.max(D.left,qo),window.innerWidth-j-qo);k({top:F,left:$})},[]);c.useLayoutEffect(()=>{if(!C)return;A();const P=()=>A();return window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[C,A]),c.useEffect(()=>{if(!C)return;const P=D=>{var j,F;const E=D.target;(j=h.current)!=null&&j.contains(E)||(F=y.current)!=null&&F.contains(E)||b(!1)},_=D=>{var E;D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),b(!1),(E=x.current)==null||E.focus())};return document.addEventListener("pointerdown",P),document.addEventListener("keydown",_,!0),()=>{document.removeEventListener("pointerdown",P),document.removeEventListener("keydown",_,!0)}},[C]);const R=P=>{f(P)},N=`${pn.bar}${!t||n?` ${pn.barEmpty}`:""}`,T=t&&!n?{backgroundColor:t}:void 0,S=o.jsxs("div",{className:pn.wrap,ref:h,children:[o.jsxs("button",{ref:x,type:"button",className:`${q.iconButton} ${pn.button}`,"aria-label":g(a),"aria-expanded":C,"aria-haspopup":"listbox","aria-controls":C?p:void 0,disabled:u,onMouseDown:P=>P.preventDefault(),onClick:()=>b(P=>!P),children:[o.jsx(e,{className:`${q.icon} ${pn.icon}`}),o.jsx("span",{className:N,style:T})]}),C?o.jsx(ue,{children:o.jsx("div",{ref:y,id:p,className:pn.popover,style:{top:v.top,left:v.left},children:o.jsx(Ml,{value:t,mixed:n,noneLabel:g(r),ariaLabel:g(a),disabled:u,fallbackCustom:s,onChange:R,onCommit:()=>b(!1)})})}):null]});return o.jsx(tn,{label:g(i),children:S})}function $P({commands:e,queries:t,disabled:n}){return o.jsx(bg,{icon:$d,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function UP({commands:e,queries:t,disabled:n}){const r=W(),i=!!(n||!t.isVisualMode());return o.jsx(sg,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:i,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,s)=>{e.setFontSize(a,s)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function WP({commands:e,queries:t,disabled:n}){return o.jsx(bg,{icon:Ud,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function GP({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=W(),a=!!(n||!t.isVisualMode());return o.jsx(Ml,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:i("colorNone"),ariaLabel:i("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:s=>e.setHighlightColor(s),onCommit:()=>r==null?void 0:r()})}const VP="_wrap_1gtdc_1",ZP="_wrapToolbar_1gtdc_7",qP="_field_1gtdc_12",YP="_trigger_1gtdc_20",XP="_chevron_1gtdc_46",JP="_list_1gtdc_69",QP="_option_1gtdc_84",eD="_separator_1gtdc_113",_t={wrap:VP,wrapToolbar:ZP,field:qP,trigger:YP,chevron:XP,list:JP,option:QP,separator:eD},Gs={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},tD={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 Hd(){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 yg({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:i,listRef:a,style:s,customStylesEnabled:u=!1,customStyles:f=[],customStylesLoading:g=!1,onSelect:p,onSelectCustom:h,onAddNew:x}){const y=W(),C=t?null:e,b=u,v=!!(r&&u&&x);return r?o.jsxs(o.Fragment,{children:[gi.map(k=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitemradio","aria-checked":C===k,disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>p(k),children:y(Gs[k])},k)),b?o.jsx("div",{role:"separator",className:q.menuSeparator}):null,b&&g?o.jsx(Hd,{}):null,b&&!g?f.map(k=>o.jsx("button",{type:"button",className:q.menuItem,role:"menuitem",disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>h==null?void 0:h(k.id),children:k.name},k.id)):null,v?o.jsxs(o.Fragment,{children:[b&&(g||f.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:k=>k.preventDefault(),onClick:()=>x==null?void 0:x(),children:[o.jsx(Dp,{className:q.icon}),y("styleAddNew")]})]}):null]}):o.jsxs("ul",{ref:a,className:_t.list,role:"listbox",id:i,style:s,"aria-label":y("commandParagraphStyleAria"),"aria-busy":b&&g?!0:void 0,children:[gi.map(k=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:_t.option,role:"option","aria-selected":C===k,disabled:n,style:tD[k],onMouseDown:A=>A.preventDefault(),onClick:()=>p(k),children:y(Gs[k])})},k)),b&&(g||f.length>0)?o.jsx("li",{role:"separator",className:_t.separator}):null,b&&g?o.jsx("li",{role:"presentation",children:o.jsx(Hd,{})}):null,b&&!g?f.map(k=>o.jsx("li",{role:"presentation",children:o.jsx("button",{type:"button",className:_t.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:A=>A.preventDefault(),onClick:()=>h==null?void 0:h(k.id),children:k.name})},k.id)):null]})}const Yo=4;function nD({commands:e,queries:t,disabled:n}){const r=W(),i=c.useId(),a=c.useRef(null),s=c.useRef(null),u=c.useRef(null),[f,g]=c.useState(!1),[p,h]=c.useState({top:0,left:0,width:0}),x=!!(n||!t.isVisualMode()),y=t.isParagraphStyleMixed(),C=y?null:t.getParagraphStyle(),b=C?r(Gs[C]):"",v=t.customParagraphStylesEnabled(),k=v?t.getCustomParagraphStyles():[],A=v&&t.isCustomParagraphStylesLoading(),R=c.useCallback(()=>{const T=s.current,S=u.current;if(!T)return;const P=T.getBoundingClientRect(),_=(S==null?void 0:S.offsetHeight)??0,D=Math.max(P.width,(S==null?void 0:S.offsetWidth)??0);let E=P.bottom;E+_>window.innerHeight-Yo&&(E=Math.max(Yo,P.top-_));const j=Math.min(Math.max(P.left,Yo),window.innerWidth-D-Yo);h({top:E,left:j,width:D})},[]);c.useLayoutEffect(()=>{if(!f)return;R();const T=()=>R();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[f,R,k.length,A]),c.useEffect(()=>{if(!f)return;const T=P=>{var D,E;const _=P.target;(D=a.current)!=null&&D.contains(_)||(E=u.current)!=null&&E.contains(_)||g(!1)},S=P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),g(!1))};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",S,!0),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",S,!0)}},[f]);const N=o.jsxs("div",{className:`${_t.wrap} ${_t.wrapToolbar}`,ref:a,children:[o.jsxs("div",{className:_t.field,ref:s,children:[o.jsx("button",{type:"button",className:_t.trigger,disabled:x,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":f,"aria-controls":f?i:void 0,onMouseDown:T=>T.preventDefault(),onClick:()=>g(T=>!T),children:b}),o.jsx("span",{className:_t.chevron,"aria-hidden":"true"})]}),f?o.jsx(ue,{children:o.jsx(yg,{listRef:u,listId:i,value:C,mixed:y,disabled:x,customStylesEnabled:v,customStyles:k,customStylesLoading:A,style:{top:p.top,left:p.left,minWidth:p.width},onSelect:T=>{e.setParagraphStyle(T),g(!1)},onSelectCustom:T=>{e.applyCustomParagraphStyle(T),g(!1)}})}):null]});return o.jsx(tn,{label:r("commandParagraphStyle"),children:N})}function rD({commands:e,queries:t,disabled:n,onMenuClose:r}){const i=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),s=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),f=u?t.getCustomParagraphStyles():[],g=u&&t.isCustomParagraphStylesLoading();return o.jsx(yg,{menu:!0,value:s,mixed:a,disabled:i,customStylesEnabled:u,customStyles:f,customStylesLoading:g,onSelect:p=>{e.setParagraphStyle(p),r==null||r()},onSelectCustom:p=>{e.openCustomParagraphStyleDialog(p),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const oD={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:rD,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:GP,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:$v,icon:lp,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:nD,icon:Pp,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:UP,icon:up,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:cp,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:ip,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:kp,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:Wd,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:$P,icon:$d,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:WP,icon:Ud,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:Jg,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:hp,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:_p,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:Mp,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:tp,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:dp,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:ki,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:Si,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:Ai,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Od,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:pp,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:vp,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:Kd,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:Gd,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},iD={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},submenus:{insertPage:{id:"insertPage",labelKey:"menuInsertPage",ariaKey:"menuInsertPageAria",enabled:"hasSelectedPage"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:yp,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:Qg,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:Wd,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},audio:{id:"audio",command:"openAudioDialog",icon:Xg,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:Bp,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:fp,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:Sp,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPageBefore:{id:"insertPageBefore",command:"insertPageBefore",icon:ni,labelKey:"commandInsertPageBefore",ariaKey:"commandInsertPageBeforeAria",enabled:"hasSelectedPage"},insertPageAfter:{id:"insertPageAfter",command:"insertPageAfter",icon:ni,labelKey:"commandInsertPageAfter",ariaKey:"commandInsertPageAfterAria",enabled:"hasSelectedPage"}}},aD={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:Cu,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:Ja,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:Ja,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:Ja,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Xa,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Xa,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Xa,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:Cp,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:Ip,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:Cu,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:ep,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:Tp,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},sD={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:Fp,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:gp,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:ap,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:bp,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:sp,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:Ap,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:jp,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:mp,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function lD(...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 cD=lD(KP,dP,iD,aD,sD,oD),uD={menus:[{id:"file",items:["save","open",me,"print"]},{id:"edit",items:["undo","redo",me,{submenu:"page",items:["pageProperties",me,"deletePage"]}]},{id:"insert",items:["link","bookmark",me,"image","audio","youtube","table","horizontalRule","pageBreak","insertComment",{submenu:"insertPage",items:["insertPageBefore","insertPageAfter"]}]},{id:"table",items:["table",me,{submenu:"insertRow",items:["insertRowBelow","insertRowBefore","deleteRow"]},{submenu:"insertColumn",items:["insertColumnAfter","insertColumnBefore","deleteColumn"]},me,"mergeCells","unmergeCells",me,"tableProperties","cellProperties","rowProperties"]},{id:"view",items:["visual","html",me,{submenu:"toolbar",items:["customizeToolbar",me,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},me,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",me,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},me,"lightMode","darkMode",me,"toggleCommentsVisible","preview","readAloud","fullscreen"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},me,{submenu:"font",items:["fontProperties","customCss",me,{submenu:"highlightColor",items:[]},me,"bold","italic","underline","strikethrough"]},me,"clearFormatting",me,{submenu:"paragraph",items:["paragraphProperties",me,"alignLeft","alignCenter","alignRight","alignJustify",me,"indent","outdent",me,"bulletList","numberedList"]},me,"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"]}]},zd={items:{addComment:{id:"addComment",command:"addComment",icon:xu,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:xu,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:np,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},dD=["addComment","insertComment","toggleCommentsVisible"],mD=new Set(["insert","view"]);function xg(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!dD.includes(e):!0:!1}function fD(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!mD.has(e):!0:!1}function gD(e,t){const n=t?"hideComments":"showComments",r=zd.items.toggleCommentsVisible;return{...e,items:{...e.items,...zd.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function pD(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.findIndex(a=>Jt(a)&&a.submenu==="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 Xo="fullscreen";function hD(e){const t=[];let n=null;for(const r of e){const i=r.items.filter(a=>a!==Xo);i.length>0&&t.push({id:r.id,items:i}),r.items.includes(Xo)&&(n={id:Xo,items:[Xo]})}return{main:t,trailing:n}}function bD({groups:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a}){const s=W(),{main:u,trailing:f}=hD(e),g=p=>{const h=t.groups[p.id];return o.jsx("div",{className:q.iconGroup,role:"group","aria-label":h?nn(s,h):void 0,"data-toolbar-group":p.id,children:p.items.map(x=>{const y=t.items[x];if(!y)return null;const C=y.enabled?!r[y.enabled]():!1;if(y.widget){const A=y.widget;return o.jsx(A,{commands:n,queries:r,disabled:i||C},x)}if(!y.icon||!y.command)return null;const b=y.icon,v=y.command,k=y.active?r[y.active]():void 0;return o.jsx(tn,{label:y.tooltip??nn(s,y),children:o.jsx("button",{type:"button",className:q.iconButton,"aria-label":wi(s,y),"aria-pressed":k,disabled:i||(a?xg(x,a):!1)||C,onPointerDown:A=>A.preventDefault(),onMouseDown:A=>A.preventDefault(),onClick:()=>{qs(n,v)},children:o.jsx(b,{className:q.icon})})},x)})},p.id)};return o.jsxs("div",{className:q.iconNav,role:"toolbar","aria-label":s("toolbarAria"),children:[u.length>0?o.jsx("div",{className:q.iconNavMain,children:u.map(g)}):null,f?o.jsx("div",{className:q.iconNavEnd,children:g(f)}):null]})}const yD=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function xD(e){const t={};for(const n of yD){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 CD({menus:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,compact:s,openMenuId:u,onOpenMenuIdChange:f}){const g=W(),[p,h]=c.useState(!1),[x,y]=c.useState({}),C=c.useRef(null),b=c.useRef(null),v=c.useRef(null),k=c.useRef(null),A=c.useCallback(()=>{h(!1),f(null)},[f]);c.useLayoutEffect(()=>{!p||!C.current||y(xD(C.current))},[p]),c.useEffect(()=>{var N;p&&((N=v.current)==null||N.focus())},[p]),c.useEffect(()=>{if(!p)return;const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=N}},[p]),c.useEffect(()=>{if(!p)return;const N=S=>{var P;if(S.key==="Escape"){if(S.preventDefault(),S.stopPropagation(),u){f(null);return}A(),(P=b.current)==null||P.focus()}},T=S=>{var P;k.current&&!k.current.contains(S.target)&&(A(),(P=b.current)==null||P.focus())};return document.addEventListener("keydown",N,!0),document.addEventListener("pointerdown",T),()=>{document.removeEventListener("keydown",N,!0),document.removeEventListener("pointerdown",T)}},[p,u,f,A]);const R=N=>e.map(T=>{const S=t.menus[T.id];return S?o.jsx(vD,{def:S,itemIds:T.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:N,open:(N==="overlay"||!p)&&u===T.id,onOpenChange:P=>f(P?T.id:null),onItemRun:N==="overlay"?()=>{var P;A(),(P=b.current)==null||P.focus()}:void 0},`${N}-${T.id}`):null});return o.jsxs("div",{className:q.menuBar,ref:C,children:[o.jsx(tn,{label:g("brandMarkAria"),children:o.jsx("span",{className:q.brandMark,role:"img","aria-label":g("brandMarkAria"),children:o.jsx(rp,{className:q.brandMarkIcon})})}),o.jsx("div",{className:q.menuBarCompact,hidden:s===void 0?void 0:!s,children:o.jsx(tn,{label:g("menuHamburgerAria"),children:o.jsx("button",{ref:b,type:"button",className:`${q.menuButton} ${q.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":p,"aria-label":g("menuHamburgerAria"),disabled:i||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(p){A();return}f(null),h(!0)},children:o.jsx(xp,{className:q.icon})})})}),o.jsx("div",{className:q.menuBarDesktop,hidden:s===void 0?void 0:s,children:R("dropdown")}),p?o.jsx(ue,{children:o.jsx("div",{className:q.toolbar,"data-menu-overlay-portal":"",style:x,children:o.jsxs("div",{ref:k,className:q.menuOverlay,role:"dialog","aria-modal":"true","aria-label":g("menuOverlayAria"),children:[o.jsxs("div",{className:q.menuOverlayHeader,children:[o.jsx("span",{className:q.menuOverlayTitle,children:g("menuOverlayAria")}),o.jsx("button",{ref:v,type:"button",className:q.iconButton,"aria-label":g("menuCloseAria"),onClick:()=>{var N;A(),(N=b.current)==null||N.focus()},children:o.jsx(Be,{className:q.icon})})]}),o.jsx("div",{className:q.menuOverlayBody,children:R("overlay")})]})})}):null]})}function vi(e,t){var n,r;if(Xt(e))return!1;if(Jt(e)){const i=(n=t.submenus)==null?void 0:n[e.submenu];return i?i.panel?!0:e.items.some(a=>vi(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function wD(e,t,n){if(!Xt(e[t])||!e.slice(t+1).some(a=>vi(a,n)))return!1;let i=!1;for(let a=t-1;a>=0;a--){const s=e[a];if(Xt(s)){i=!0;continue}if(vi(s,n))return!i}return!1}function vD({def:e,itemIds:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:s,variant:u,open:f,onOpenChange:g,onItemRun:p}){const h=W(),x=c.useRef(null),y=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[C,b]=c.useState(null);c.useEffect(()=>{f||b(null)},[f]),c.useEffect(()=>{if(!f||u==="overlay")return;const k=R=>{x.current&&!x.current.contains(R.target)&&g(!1)},A=R=>{if(R.key==="Escape"){if(R.preventDefault(),R.stopPropagation(),C){b(null);return}g(!1)}};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",A,!0)}},[f,C,g,u]);const v=()=>{g(!1),p==null||p()};return o.jsxs("div",{className:q.menuWrap,ref:x,children:[o.jsx("button",{type:"button",className:q.menuButton,"aria-haspopup":"menu","aria-expanded":f,"aria-controls":y,"aria-label":wi(h,e),disabled:a||(s?fD(e.id,s):!1),onClick:()=>g(!f),children:nn(h,e)}),f?o.jsx("div",{className:q.menu,role:"menu",id:y,onMouseDown:k=>k.preventDefault(),children:o.jsx(Cg,{entries:t,catalog:n,commands:r,queries:i,disabled:a,chromeLock:s,variant:u,onClose:v,openSubmenuId:C,onOpenSubmenuIdChange:b})}):null]})}function Cg({entries:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:s,onClose:u,openSubmenuId:f,onOpenSubmenuIdChange:g}){return o.jsx(o.Fragment,{children:e.map((p,h)=>{if(Xt(p))return wD(e,h,t)?o.jsx("div",{role:"separator",className:q.menuSeparator},`separator-${h}`):null;if(Jt(p))return o.jsx(kD,{entry:p,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:s,onClose:u,open:f===p.submenu,onOpenChange:y=>g==null?void 0:g(y?p.submenu:null)},`submenu-${p.submenu}-${h}`);const x=t.items[p];return!x||!x.command?null:o.jsx(SD,{item:x,commands:n,queries:r,disabled:i,chromeLock:a,onClose:u},p)})})}function SD({item:e,commands:t,queries:n,disabled:r,chromeLock:i,onClose:a}){const s=W();if(!e.command)return null;const u=e.icon,f=e.command,g=e.active?n[e.active]():void 0,p=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":g,disabled:r||(i?xg(e.id,i):!1)||p,onClick:()=>{a(),qs(t,f)},children:[u?o.jsx(u,{className:q.icon}):null,nn(s,e)]})}function kD({entry:e,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:s,onClose:u,open:f,onOpenChange:g}){var S;const p=W(),h=c.useRef(null),x=c.useRef(null),[y,C]=c.useState(null),b=(S=t.submenus)==null?void 0:S[e.submenu],v=s==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,k=b==null?void 0:b.panel,A=b!=null&&b.enabled?!r[b.enabled]():!1,R=s==="overlay";if(c.useEffect(()=>{f||C(null)},[f]),!b||!k&&!e.items.some(P=>vi(P,t)))return null;const N=P=>{(P.key==="ArrowRight"||P.key==="Enter"||P.key===" ")&&(P.preventDefault(),P.stopPropagation(),g(!0),requestAnimationFrame(()=>{var D;const _=(D=x.current)==null?void 0:D.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');_==null||_.focus()}))},T=P=>{var _;P.key==="ArrowLeft"&&(P.preventDefault(),P.stopPropagation(),g(!1),(_=h.current)==null||_.focus())};return o.jsxs("div",{className:q.submenuWrap,onMouseEnter:R?void 0:()=>g(!0),onMouseLeave:R?void 0:()=>g(!1),children:[o.jsx("button",{ref:h,type:"button",role:"menuitem",className:`${q.menuItem} ${q.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":f,"aria-controls":v,"aria-label":wi(p,b),disabled:i||A||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>g(R?!f:!0),onKeyDown:N,children:nn(p,b)}),f?o.jsx("div",{ref:x,className:`${q.menu} ${q.submenu}`,role:"menu",id:v,"aria-label":wi(p,b),onMouseDown:P=>P.preventDefault(),onKeyDown:T,children:k?o.jsx(k,{commands:n,queries:r,disabled:i||A,onMenuClose:u}):o.jsx(Cg,{entries:e.items,catalog:t,commands:n,queries:r,disabled:i,chromeLock:a,variant:s,onClose:u,openSubmenuId:y,onOpenSubmenuIdChange:C})}):null]})}function ps({catalog:e,layout:t,commands:n,queries:r,disabled:i,chromeLock:a,menuVisible:s=!0,toolbarVisible:u=!0,compact:f,position:g="top"}){const[p,h]=c.useState(null);return!s&&!u?null:o.jsxs("div",{className:q.toolbar,"data-compact":f?"":void 0,"data-toolbar-position":g,children:[s?o.jsx(CD,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a,compact:f,openMenuId:p,onOpenMenuIdChange:h}):null,u?o.jsx(bD,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:i,chromeLock:a}):null]})}function AD(e,t){return t?e:{...e,menus:e.menus.map(n=>n.id==="insert"?{...n,items:n.items.filter(r=>!(Jt(r)&&r.submenu==="insertPage"))}:n.id==="edit"?{...n,items:n.items.map(r=>{if(!Jt(r)||r.submenu!=="page")return r;let i=r.items.filter(a=>a!=="deletePage");return i.at(-1)===me&&(i=i.slice(0,-1)),{...r,items:i}})}:n)}}const PD="_root_6d8ko_1",DD="_fullscreen_6d8ko_36",ED="_exitFullscreen_6d8ko_48",jD="_exitFullscreenIcon_6d8ko_79",RD="_menuChrome_6d8ko_94",TD="_body_6d8ko_105",ND="_iconChrome_6d8ko_135",MD="_workspace_6d8ko_179",_D="_workspacePageSized_6d8ko_191",LD="_pageCanvasViewport_6d8ko_195",ID="_multiPageContainer_6d8ko_208",FD="_htmlFileDropOverlay_6d8ko_212",BD="_surface_6d8ko_226",HD="_visual_6d8ko_233",zD="_pageBlock_6d8ko_273",OD="_pageGap_6d8ko_280",KD="_pageSurface_6d8ko_286",$D="_html_6d8ko_212",xe={root:PD,fullscreen:DD,exitFullscreen:ED,exitFullscreenIcon:jD,menuChrome:RD,body:TD,iconChrome:ND,workspace:MD,workspacePageSized:_D,pageCanvasViewport:LD,multiPageContainer:ID,htmlFileDropOverlay:FD,surface:BD,visual:HD,pageBlock:zD,pageGap:OD,pageSurface:KD,html:$D},UD=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i},a){const s=W();return o.jsx("textarea",{ref:a,className:`${xe.surface} ${xe.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:i,"aria-label":s("htmlEditorAria"),spellCheck:!1})}),WD=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:i,onBeforeInput:a,onPointerDown:s,onMouseUp:u,onContextMenu:f},g){const p=W(),h=c.useRef(null),x=c.useRef(a);x.current=a;const y=C=>{h.current=C,typeof g=="function"?g(C):g&&(g.current=C)};return c.useLayoutEffect(()=>{const C=h.current;if(!C)return;const b=Gn(t);C.innerHTML!==b&&(C.innerHTML=b),Ei(C),Or(C,t)},[t]),c.useLayoutEffect(()=>{const C=h.current;if(!C)return;const b=v=>{var k;(k=x.current)==null||k.call(x,v)};return C.addEventListener("beforeinput",b),()=>C.removeEventListener("beforeinput",b)},[]),o.jsx("div",{ref:y,className:`${xe.surface} ${xe.visual}`,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":p("visualEditorAria"),"aria-disabled":i||void 0,"data-placeholder":r,onPointerDown:s,onMouseUp:u,onContextMenu:f,onInput:C=>{n(C.currentTarget.innerHTML)}})}),GD=c.forwardRef(function({pages:t,activePageIndex:n,onActivePageIndexChange:r,onPageSelected:i,onPageChange:a,placeholder:s,disabled:u,onBeforeInput:f,onPointerDown:g,onMouseUp:p,onContextMenu:h},x){const y=W(),C=c.useRef(null),b=c.useRef(n);b.current=n;const v=c.useRef(f);v.current=f;const k=c.useRef(t);k.current=t;const A=c.useRef(i);A.current=i;const R=c.useCallback(S=>{var D;b.current=S,S!==n&&r(S),(D=A.current)==null||D.call(A,S);const P=C.current;if(!P)return;const _=In(P,S);_&&requestAnimationFrame(()=>Kn(_))},[n,r]);c.useImperativeHandle(x,()=>({getContainer:()=>C.current,getActivePageRoot:()=>{const S=C.current;return S?In(S,b.current):null},getActivePageIndex:()=>b.current,flushPageHtml:S=>{var _;const P=C.current;return P?((_=In(P,S))==null?void 0:_.innerHTML)??null:null}}));const N=c.useCallback((S,P)=>{const _=Gn(Se(P).body);!(S===document.activeElement)&&S.innerHTML!==_&&(S.innerHTML=_),Nm(S),Mu(S),Ei(S),Or(S,P);const E=sn(S);E&&Db(S,E)},[]);c.useLayoutEffect(()=>{const S=C.current;if(S)for(let P=0;P<t.length;P+=1){const _=In(S,P);_&&N(_,t[P]??"")}},[t,N]),c.useLayoutEffect(()=>{const S=C.current;if(!S)return;const P=_=>{var j;const D=_,E=_.target;E instanceof HTMLElement&&E.hasAttribute(Vn)&&(D.inputType==="insertParagraph"||D.inputType==="insertLineBreak")&&Kn(E),(j=v.current)==null||j.call(v,D)};return S.addEventListener("beforeinput",P),()=>S.removeEventListener("beforeinput",P)},[]);const T=c.useCallback((S,P)=>{R(S),g==null||g(P)},[R,g]);return o.jsx("div",{ref:C,className:xe.multiPageContainer,children:t.map((S,P)=>o.jsxs("div",{className:xe.pageBlock,children:[P>0?o.jsx("div",{className:xe.pageGap,"aria-hidden":"true"}):null,o.jsx("div",{className:`${xe.surface} ${xe.visual} ${xe.pageSurface}`,[Vn]:"","data-page-index":P,contentEditable:!u,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":y("visualEditorAria"),"aria-disabled":u||void 0,"data-placeholder":P===0?s:void 0,onFocus:()=>R(P),onPointerDown:_=>T(P,_),onMouseUp:p,onContextMenu:h,onInput:_=>{const D=_.currentTarget;Mu(D)&&Kn(D),a(P,D.innerHTML)}})]},P))})}),VD=.001;function ZD({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:i,onOpen:a,mode:s,defaultMode:u="visual",onModeChange:f,fullscreen:g,defaultFullscreen:p=!1,onFullscreenChange:h,placeholder:x,disabled:y,readOnly:C=!1,className:b,locale:v="en",toolbarBackground:k,menuColor:A,menuBackground:R,menuFontSize:N,menuFontFamily:T,border:S,menuVisible:P=!0,toolbarVisible:_=!0,allowedChrome:D,customActions:E,customFonts:j,transformHtml:F,sanitizeHtml:$=!0,loadCustomParagraphStyles:U,onSaveCustomParagraphStyle:X,onDeleteCustomParagraphStyle:Q,customImagePicker:oe,disableBuiltinImageInsert:Y,customAudioPicker:le,disableBuiltinAudioInsert:ie,customVideoPicker:re,disableBuiltinVideoInsert:L,disableHtmlFileDrop:Z=!1,toolbarCustomization:ae,darkMode:G=!1,darkModePersistence:ve,toolbarPosition:He="top",toolbarPositionPersistence:Ne,enablePageProperties:Bt=!1,defaultPageProperties:ln,enableMultiPages:Ae=!1,pages:Fi,defaultPages:wg,onPagesChange:Hl,enableComments:ze=!1,defaultCommentsVisible:vg=!0,commentAuthor:Ur,comments:Sg,defaultComments:kg=[],onCommentsChange:Ag}){const te=!!(y||C),rr=!!y,Pg=Ae?Fi!==void 0:e!==void 0,zl=Iu(wg??(t.trim()?[t]:[Jo()])),Ol=!Pg&&ln?zl.map(l=>Yu(l,ln)):zl,Kl=Ae?nt(Ol):Ol[0]??"",Dg=$?ei(Kl):Kl,Wr=Ae&&Fi!==void 0?nt(Iu(Fi)):e,Eg=c.useMemo(()=>{if(Wr!==void 0)return $?ei(Wr):Wr},[Wr,$]),[Ee,$l]=Oo({value:Eg,defaultValue:Dg,onChange:Ae?void 0:n}),[fe,Ul]=Oo({value:s,defaultValue:u,onChange:f}),[Pt,or]=Oo({value:g,defaultValue:p,onChange:h}),[pt,jg]=c.useState(vg),[ht,Dt]=c.useState(null),[Cn,ir]=Oo({value:Sg,defaultValue:kg,onChange:Ag}),B=c.useRef(null),Bi=c.useRef(null),Gr=c.useRef(null),cn=c.useRef(null),We=c.useRef(null),be=c.useRef(Ae);be.current=Ae;const Hi=c.useRef(ln);Hi.current=ln;const un=c.useRef(ze);un.current=ze;const Wl=c.useRef(C);Wl.current=C;const Gl=c.useRef(te);Gl.current=te;const Vr=c.useRef(pt);Vr.current=pt;const Zr=c.useRef(Cn);Zr.current=Cn;const qr=c.useRef(Hl);qr.current=Hl;const[Ht,zi]=c.useState(0),Ge=c.useRef(Ht);Ge.current=Ht;const[Oi,ar]=c.useState(!1),Et=c.useRef(Oi);Et.current=Oi;const Ki=c.useRef(null);Ki.current===null&&(Ki.current=fP(Ee));const Qe=Ki.current,ne=c.useRef(Ee);ne.current=Ee;const Yr=c.useRef(!0),$i=c.useRef(""),wn=c.useRef(null),I=c.useRef(fe);I.current=fe;const Vl=c.useRef(Pt);Vl.current=Pt;const Pe=c.useRef(null),[,Rg]=c.useState(0),sr=c.useRef(null);sr.current===null&&(sr.current=ow(()=>{Rg(l=>l+1)}));const Xr=c.useRef(F);Xr.current=F;const Zl=c.useRef($);Zl.current=$;const et=c.useRef({}),Ve=c.useRef(null),tt=c.useRef(null),lt=c.useRef(null),ct=c.useRef(null),zt=c.useRef(null),Ze=c.useRef(null),[Jr,Ui]=c.useState(Lt),Wi=c.useRef(Jr);Wi.current=Jr;const jt=c.useRef(hn),[lr,Qr]=c.useState({value:null,unit:hn,mixed:!1}),Ot=c.useRef(lr);Ot.current=lr;const[cr,Gi]=c.useState({value:null,mixed:!1}),ur=c.useRef(cr);ur.current=cr;const[dr,Vi]=c.useState({value:null,mixed:!1}),mr=c.useRef(dr);mr.current=dr;const[fr,Zi]=c.useState({value:null,mixed:!1}),gr=c.useRef(fr);gr.current=fr;const[qi,Yi]=c.useState({tag:null,mixed:!1}),Xi=c.useRef(qi);Xi.current=qi;const[ql,Ji]=c.useState({align:"left",mixed:!1}),Qi=c.useRef(ql);Qi.current=ql;const[Yl,ea]=c.useState({type:null,mixed:!1}),pr=c.useRef(Yl);pr.current=Yl;const[Xl,ta]=c.useState(!1),Jl=c.useRef(Xl);Jl.current=Xl;const[na,ra]=c.useState(!1),oa=c.useRef(na);oa.current=na;const[ia,Ql]=c.useState(!1),eo=c.useRef(ia);eo.current=ia;const to=c.useRef(null),no=c.useRef(null),[ec,tc]=c.useState(!1),nc=c.useRef(ec);nc.current=ec;const[hr,ro]=c.useState({open:!1,tab:"general"}),[aa,rc]=c.useState(!1),[br,oc]=c.useState({open:!1,html:""}),[sa,oo]=c.useState(null),[Tg,la]=c.useState(!1),[Ng,ca]=c.useState(!1),[vn,io]=c.useState(()=>ve?G:_d()??G),[ut,ao]=c.useState(()=>Ne?He:Ld()??He),[Sn,Mg]=c.useState(()=>UA()??"fitWidth"),[yr,_g]=c.useState(1),[dn,so]=c.useState({open:!1,tab:"general",value:Rr()}),[lo,ua]=c.useState({open:!1,value:""}),[mn,kn]=c.useState({open:!1,tab:"font",value:Fs()}),[da,ma]=c.useState(!1),[fa,ic]=c.useState([]),[ga,pa]=c.useState(!1),[Lg,co]=c.useState(!1),[je,xr]=c.useState({open:!1}),[qe,uo]=c.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[ha,ba]=c.useState({open:!1,existingIds:[]}),[Ig,mo]=c.useState({open:!1}),[Fg,fo]=c.useState({open:!1}),[Bg,Cr]=c.useState({open:!1}),[go,po]=c.useState({open:!1,tab:"general",value:Af(),aspectRatio:1}),[ya,xa]=c.useState({open:!1}),[ho,Ca]=c.useState({open:!1,value:Zw()}),[bo,wa]=c.useState({open:!1,value:o0()}),[yo,va]=c.useState({open:!1,value:g0()}),[Kt,Sa]=c.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1,canDeletePage:!1}),[Re,An]=c.useState(null),ka=c.useRef(Re);ka.current=Re;const[Aa,ac]=c.useState(!1),sc=c.useRef(Aa);sc.current=Aa;const[Pa,lc]=c.useState(!1),cc=c.useRef(Pa);cc.current=Pa;const[Da,uc]=c.useState(!1),dc=c.useRef(Da);dc.current=Da;const mc=c.useRef(void 0),xo=c.useRef(fa);xo.current=fa;const fc=c.useRef(ga);fc.current=ga;const Ea=!!(U&&X),ja=c.useRef(Ea);ja.current=Ea;const gc=c.useRef(U);gc.current=U;const pc=c.useRef(X);pc.current=X;const hc=c.useRef(Q);hc.current=Q;const bc=c.useRef(i);bc.current=i;const yc=c.useRef(a);yc.current=a;const xc=c.useRef(oe);xc.current=oe;const Cc=c.useRef(le);Cc.current=le;const wc=c.useRef(re);wc.current=re;const vc=c.useRef(ae);vc.current=ae;const Sc=c.useRef(ve);Sc.current=ve;const kc=c.useRef(Ne);kc.current=Ne;const Ac=c.useRef(vn);Ac.current=vn;const Pc=c.useRef(ut);Pc.current=ut;const Co=c.useRef(Sn);Co.current=Sn;const wo=c.useRef(yr);wo.current=yr;const Dc=c.useRef(Y);Dc.current=Y;const Ec=c.useRef(ie);Ec.current=ie;const jc=c.useRef(L);jc.current=L;const Ra=c.useRef(0),wr=c.useRef(0),Rc=c.useRef(0),vo=c.useRef(0),Tc=c.useRef(0),So=c.useRef(0),Nc=c.useRef(0),$t=c.useMemo(()=>Im(j),[j]),Pn=c.useRef($t);Pn.current=$t;const Ta=c.useMemo(()=>Yb(Ee,$t).join(`
95
- `),[Ee,$t]),Dn=c.useMemo(()=>Me(Ee).map(l=>Se(l).body),[Ee]),fn=c.useCallback(()=>{var l;if(be.current){const m=(l=cn.current)==null?void 0:l.getActivePageRoot();if(m instanceof HTMLElement)return m}return B.current},[]);c.useLayoutEffect(()=>{var m;if(!Ae)return;const l=(m=cn.current)==null?void 0:m.getActivePageRoot();l instanceof HTMLDivElement&&(B.current=l)},[Ae,Ht,Dn.length]);const ko=c.useMemo(()=>Ae?Dn[Ht]??"":Se(Ee).body,[Ae,Dn,Ht,Ee]),En=c.useMemo(()=>wb(qt(ko)),[ko]),Mc=c.useRef(ko);Mc.current=ko;const _c=c.useRef(En);_c.current=En;const Ao=c.useRef(()=>{}),Na=c.useRef(!1),Hg=c.useCallback(()=>{if(Na.current||I.current!=="visual")return;const l=Gr.current;if(l){Na.current=!0;try{const m=getComputedStyle(l),w=parseFloat(m.paddingLeft)+parseFloat(m.paddingRight),M=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom),z=Math.max(0,l.clientWidth-w),V=Math.max(0,l.clientHeight-M);let pe=0,Nt=0;if(_c.current){const yt=vb(qt(Mc.current));yt&&(pe=yt.width,Nt=yt.height)}else{const yt=fn(),yu=wo.current>0?wo.current:1;pe=((yt==null?void 0:yt.offsetWidth)??0)/yu,Nt=((yt==null?void 0:yt.offsetHeight)??0)/yu}pe<=0&&(pe=z),Nt<=0&&(Nt=V);const bu=wy(Co.current,z,V,pe,Nt);Math.abs(bu-wo.current)>=VD&&_g(bu)}finally{Na.current=!1}}},[fn]);Ao.current=Hg,c.useLayoutEffect(()=>{if(fe!=="visual")return;const l=fn();!l||l!==document.activeElement||Kn(l)},[fe,En,Ht,Dn,fn]),c.useEffect(()=>{const m=(Ta?Ta.split(`
96
- `):[]).map(w=>{const M=document.createElement("link");return M.rel="stylesheet",M.href=w,M.setAttribute(ji,""),document.head.append(M),M});return()=>{for(const w of m)w.remove()}},[Ta]);const Po=c.useCallback(async()=>{const l=gc.current;if(!l)return;const m=++Ra.current;pa(!0);try{const w=await l();if(m!==Ra.current)return;ic(w)}catch{}finally{m===Ra.current&&pa(!1)}},[]);c.useEffect(()=>{if(!U||!X){ic([]),pa(!1);return}Po()},[U,X,Po]);const Lc=c.useCallback(async l=>{oo(l);const m=vc.current;if(m!=null&&m.load&&m.save){const w=++Rc.current;ca(!0);try{await m.save(l)}catch{}finally{w===Rc.current&&ca(!1)}return}bP(l)},[]);c.useEffect(()=>{const l=ae;if(!(l!=null&&l.load)||!l.save){oo(hP()),la(!1),ca(!1);return}const m=++wr.current;return la(!0),(async()=>{try{const w=await l.load();if(m!==wr.current)return;oo(w)}catch{if(m!==wr.current)return;oo(null)}finally{m===wr.current&&la(!1)}})(),()=>{wr.current+=1}},[ae]);const Ic=c.useCallback(async l=>{io(l);const m=Sc.current;if(m!=null&&m.load&&m.save){const w=++Tc.current;try{await m.save(l)}catch{}finally{if(w!==Tc.current)return}return}OA(l)},[]),Fc=c.useCallback(l=>{Co.current=l,Mg(l),WA(l);const m=Gr.current;m&&(m.scrollTop=0,m.scrollLeft=0),Ao.current()},[]);c.useEffect(()=>{const l=ve;if(!(l!=null&&l.load)||!l.save){io(_d()??G);return}const m=++vo.current;return(async()=>{try{const w=await l.load();if(m!==vo.current)return;io(typeof w=="boolean"?w:G)}catch{if(m!==vo.current)return;io(G)}})(),()=>{vo.current+=1}},[ve,G]),c.useLayoutEffect(()=>{if(Ao.current(),fe!=="visual")return;const l=Gr.current;if(!l||typeof ResizeObserver>"u")return;const m=new ResizeObserver(()=>Ao.current());return m.observe(l),()=>m.disconnect()},[fe,Ee,Ht,Dn,Sn,En,Ae]);const Bc=c.useCallback(async l=>{ao(l);const m=kc.current;if(m!=null&&m.load&&m.save){const w=++Nc.current;try{await m.save(l)}catch{}finally{if(w!==Nc.current)return}return}VA(l)},[]);c.useEffect(()=>{const l=Ne;if(!(l!=null&&l.load)||!l.save){ao(Ld()??He);return}const m=++So.current;return(async()=>{try{const w=await l.load();if(m!==So.current)return;ao(pg(w)??He)}catch{if(m!==So.current)return;ao(He)}})(),()=>{So.current+=1}},[Ne,He]);const jn=c.useCallback(l=>{var M,z;const m=Zl.current?ei(l):l,w=((M=Xr.current)==null?void 0:M.call(Xr,m))??m;return w!==ne.current&&(Yr.current=!0),$l(w),be.current&&((z=qr.current)==null||z.call(qr,Me(w),Ge.current)),w},[$l]),ge=c.useCallback((l,m)=>{const w=jn(l);return Qe.record(w,{coalesce:m}),w},[jn,Qe]),zg=c.useCallback(l=>{if(be.current){const m=Me(ne.current),w=Ge.current,M=[...m];M[w]=l,ge(nt(M),!1);return}ge(l,!1)},[ge]),vr=uP({enabled:!te&&!Z,onHtml:zg}),se=c.useCallback((l,m)=>ge(Ho(l,zo(l,ne.current,Pn.current)),m),[ge]),Og=c.useCallback((l,m)=>se(Ct(l,ne.current),m),[se]),Do=c.useCallback((l,m)=>Ho(l,zo(l,m,Pn.current)),[]),Ye=c.useCallback(()=>{const l=cn.current;return(l==null?void 0:l.getContainer())?Me(ne.current).map((M,z)=>{const V=l==null?void 0:l.flushPageHtml(z);if(V===null)return M;const pe=Ct(V,Se(M).body);return Do(pe,M)}):Me(ne.current)},[Do]),Sr=c.useCallback((l,m,w)=>{const M=Me(ne.current),z=[...M];z[l]=Do(m,M[l]??""),ge(nt(z),w)},[ge,Do]),kr=c.useCallback((l,m)=>{const w=Se(l).body;be.current?Sr(Ge.current,w,m):se(w,m)},[Sr,se]),ee=c.useCallback((l,m)=>{var M;if(!be.current){se(Ct(l.innerHTML,ne.current),m);return}const w=(M=cn.current)==null?void 0:M.getContainer();if(!w){se(Ct(l.innerHTML,ne.current),m);return}for(let z=0;z<Me(ne.current).length;z+=1)if(In(w,z)===l){const V=Me(ne.current)[z]??"";Sr(z,Ct(l.innerHTML,Se(V).body),m);return}se(Ct(l.innerHTML,ne.current),m)},[Sr,se]),Hc=c.useCallback((l,m)=>{Wl.current||ee(l,m)},[ee]),zc=c.useCallback(()=>{const l=be.current?Ye():Me(ne.current);return l[Ge.current]??l[0]??""},[Ye]),Rn=c.useCallback(()=>be.current?Ye():[ne.current],[Ye]),Eo=c.useCallback(l=>{if(!be.current||I.current!=="visual"||!Et.current)return;const m=Ye(),w=Math.max(0,Math.min(l,m.length)),M=[...m],z=Hi.current?Yu(Jo(),Hi.current):Jo();M.splice(w,0,z),ge(nt(M),!1),Ge.current=w,zi(w),ar(!0)},[Ye,ge]),Tn=c.useCallback(()=>{var w;const l=B.current;if(l!=null&&l.hasAttribute(Vn)){const M=_b(l);if(M!==null)return M}const m=(w=cn.current)==null?void 0:w.getActivePageIndex();return typeof m=="number"?m:Ge.current},[]),Oc=c.useCallback(()=>{const l=Tn();l===null||!Et.current||Eo(l)},[Eo,Tn]),Kc=c.useCallback(()=>{const l=Tn();l===null||!Et.current||Eo(l+1)},[Eo,Tn]),$c=c.useCallback(()=>{if(!be.current||I.current!=="visual"||!Et.current)return;const l=Ye();if(l.length<=1)return;const m=Tn();if(m===null)return;const w=l.filter((z,V)=>V!==m);ge(nt(w),!1);const M=Math.min(m,w.length-1);Ge.current=M,zi(M),ar(!0)},[Ye,ge,Tn]);c.useEffect(()=>{Ae||ar(!1)},[Ae]);const jo=c.useCallback(()=>{const l=Qe.undo();l!==null&&(Qe.markApplying(),jn(l))},[jn,Qe]),Ro=c.useCallback(()=>{const l=Qe.redo();l!==null&&(Qe.markApplying(),jn(l))},[jn,Qe]);c.useEffect(()=>{Qe.syncExternal(Ee)},[Ee,Qe]);const H=c.useCallback(()=>{Pe.current=xt({mode:I.current,visualEl:B.current,htmlEl:We.current})},[]),bt=c.useCallback(l=>{if(!l||I.current!=="visual"){ac(!1),lc(!1),uc(!1);return}ac(vl(l)!==null),lc(zu(l)),uc(Ou(l))},[]),Ma=c.useCallback(()=>{const l=xt({mode:I.current,visualEl:B.current,htmlEl:We.current}),m=Pe.current;Au(m,l)||(Pe.current=l)},[]),_a=c.useCallback(()=>{const l=B.current;if(I.current!=="visual"||!l){Qr({value:null,unit:jt.current,mixed:!1});return}const m=Wm(l,jt.current);Ve.current&&(m.value=Ve.current.value,m.unit=Ve.current.unit,m.mixed=!1),jt.current=m.unit,Qr(w=>w.value===m.value&&w.unit===m.unit&&w.mixed===m.mixed?w:m)},[]),La=c.useCallback(()=>{const l=B.current;if(I.current!=="visual"||!l){Gi({value:null,mixed:!1});return}const m=Hm(l);tt.current&&(m.value=tt.current.value,m.mixed=!1),Gi(w=>w.value===m.value&&w.mixed===m.mixed?w:m)},[]),Ia=c.useCallback(()=>{const l=B.current;if(I.current!=="visual"||!l){Vi({value:null,mixed:!1}),Zi({value:null,mixed:!1});return}const m=ii(l,"color");lt.current&&(m.value=lt.current.value,m.mixed=!1);const w=ii(l,"backgroundColor");ct.current&&(w.value=ct.current.value,w.mixed=!1),Vi(M=>M.value===m.value&&M.mixed===m.mixed?M:m),Zi(M=>M.value===w.value&&M.mixed===w.mixed?M:w)},[]),Fa=c.useCallback(()=>{const l=B.current;if(I.current!=="visual"||!l){Yi({tag:null,mixed:!1});return}const m=dx(l);Yi(w=>w.tag===m.tag&&w.mixed===m.mixed?w:m)},[]),Ba=c.useCallback(()=>{const l=B.current;if(I.current!=="visual"||!l){Ji({align:null,mixed:!1}),ea({type:null,mixed:!1}),ta(!1),tc(!1);return}const m=Cf(l);Ji(V=>V.align===m.align&&V.mixed===m.mixed?V:m);const w=of(l);ea(V=>V.type===w.type&&V.mixed===w.mixed?V:w);const M=wx(l);ta(V=>V===M?V:M);const z=SC(l);tc(V=>V===z?V:z)},[]),O=c.useCallback(()=>{const l=B.current;if(I.current!=="visual"||!l){Ui(Lt()),ra(!1),_a(),La(),Ia(),Fa(),Ba();return}const m=Pe.current,w=!!(m&&!m.collapsed);ra(z=>z===w?z:w);const M=Ym(Bn(l),et.current);Ui(z=>$y(z,M)?z:M),_a(),La(),Ia(),Fa(),Ba()},[_a,La,Ia,Fa,Ba]),Uc=c.useCallback(()=>{const l=Pe.current,m=Ze.current;!m||!l||l.collapsed&&l.start===m.start&&l.end===m.end||(et.current={},Ve.current=null,tt.current=null,lt.current=null,ct.current=null,zt.current=null,Ze.current=null)},[]);c.useEffect(()=>{Yr.current=!0},[Ee]),c.useEffect(()=>{if(fe==="visual"){O();return}et.current={},Ve.current=null,tt.current=null,lt.current=null,ct.current=null,zt.current=null,Ze.current=null,Ui(Lt()),Qr({value:null,unit:jt.current,mixed:!1}),Gi({value:null,mixed:!1}),Vi({value:null,mixed:!1}),Zi({value:null,mixed:!1}),Yi({tag:null,mixed:!1}),Ji({align:null,mixed:!1}),ea({type:null,mixed:!1}),ta(!1),ra(!1)},[fe,O]);const Nn=c.useCallback((l,m,w)=>{vh({snapshot:l,visualEl:B.current,htmlEl:We.current,getHtml:()=>I.current==="visual"&&B.current?B.current.innerHTML:ne.current,setHtml:M=>{if(I.current==="visual"){const z=be.current?Me(ne.current)[Ge.current]??"":ne.current;kr(Ct(Se(M).body,Se(z).body),!1);return}ge(M,!1)},content:m,asHtml:w})},[ge,kr]),Wc=c.useCallback(l=>{if(I.current==="visual"&&l==="html"){if(be.current){const m=nt(Ye());m!==ne.current&&ge(m,!0)}else if(B.current){const m=Ct(B.current.innerHTML,Se(ne.current).body),w=Ho(m,zo(m,ne.current,Pn.current));w!==ne.current&&ge(w,!0)}}Ul(l),l!=="visual"&&ar(!1)},[ge,Ul,Ye]);c.useEffect(()=>{if(!Pt)return;const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}},[Pt]),c.useEffect(()=>{if(!Pt)return;const l=m=>{m.key==="Escape"&&(m.defaultPrevented||hr.open||lo.open||dn.open||mn.open||da||ya.open||ho.open||bo.open||yo.open||aa||br.open||(m.preventDefault(),or(!1)))};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[Pt,or,hr.open,lo.open,dn.open,mn.open,da,ya.open,ho.open,bo.open,yo.open,aa,br.open]),c.useEffect(()=>{const l=()=>{if(I.current!=="visual"||!B.current)return;const m=window.getSelection();if(!m||m.rangeCount===0)return;const w=m.anchorNode;!w||!B.current.contains(w)&&B.current!==w||wn.current===null&&(wn.current=window.requestAnimationFrame(()=>{var z;wn.current=null;const M=B.current;if(!(!M||I.current!=="visual")&&(H(),Uc(),O(),An(Yt(M)),bt(M),un.current&&Vr.current&&!((z=Bi.current)!=null&&z.contains(document.activeElement)))){const V=Pe.current;V&&Dt(td(M,V))}}))};return document.addEventListener("selectionchange",l),()=>{document.removeEventListener("selectionchange",l),wn.current!==null&&(window.cancelAnimationFrame(wn.current),wn.current=null)}},[H,Uc,O,bt]),c.useEffect(()=>{(!ze||fe!=="visual"||!pt)&&Dt(null)},[ze,fe,pt]),c.useEffect(()=>{if(!ht)return;const l=m=>{var z;const w=m.target;if((z=Bi.current)!=null&&z.contains(w))return;const M=B.current;M&&rd(M,w)||Dt(null)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[ht]),c.useEffect(()=>{if(fe!=="html")return;const l=We.current;if(!l)return;const m=()=>H();return l.addEventListener("select",m),l.addEventListener("keyup",m),l.addEventListener("mouseup",m),()=>{l.removeEventListener("select",m),l.removeEventListener("keyup",m),l.removeEventListener("mouseup",m)}},[fe,H]),c.useLayoutEffect(()=>{if(fe!=="visual"||te){An(null);return}const l=B.current;if(!l)return;const m=Yt(l);An(w=>m||(w&&w.isConnected&&l.contains(w)?w:null))},[Ee,fe,te]);const K=c.useCallback(l=>{const m=xt({mode:"visual",visualEl:l,htmlEl:We.current}),w=Pe.current,M=Au(w,m)?w:m.visualRange?m:w??m;Pe.current=M,l.focus();const z=wh(l,M);if(z){const V=window.getSelection();try{V==null||V.removeAllRanges(),V==null||V.addRange(z),Pe.current={...M,visualRange:z}}catch{}}return Pe.current??M},[]),Rt=c.useCallback(()=>{to.current=null,no.current=null,Ql(!1)},[]),Gc=c.useCallback(()=>{if(!eo.current||!to.current||!no.current||I.current!=="visual")return;const l=B.current;if(!l)return;H();const m=Pe.current;!m||m.collapsed||ew(m,no.current)||(K(l),nw(l,to.current),ee(l,!1),H(),O(),Rt())},[H,K,se,O,Rt]),Vc=c.useCallback(()=>{if(I.current!=="visual"){Rt();return}if(eo.current){Rt();return}const l=B.current;if(!l){Rt();return}const m=K(l);if(m.collapsed){Rt();return}to.current=tw(l),no.current={...m},Ql(!0),H()},[Rt,K,H]),Zc=c.useCallback(()=>{Gc()},[Gc]);c.useEffect(()=>{(fe!=="visual"||te)&&Rt()},[fe,te,Rt]);const Ha=c.useCallback((l,m)=>{if(I.current!=="visual")return;const w=B.current;if(!w)return;const M=m??jt.current,z=bn(l,M);if(!z)return;jt.current=z.unit;const V=K(w);if(V.collapsed){Ve.current=z,Ze.current={start:V.start,end:V.end},O();return}Ve.current=null,ks(w,z.value,z.unit)&&(ee(w,!1),H(),O())},[K,se,H,O]),qc=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(!m)return;const w=K(m);if(w.collapsed){tt.current={value:l},Ze.current={start:w.start,end:w.end},O();return}tt.current=null,ws(m,l)&&(ee(m,!1),H(),O())},[K,se,H,O]),za=c.useCallback((l,m)=>{if(I.current!=="visual")return;const w=B.current;if(!w)return;const M=K(w),z=l==="color"?lt:ct;if(M.collapsed){z.current={value:m},Ze.current={start:M.start,end:M.end},O();return}z.current=null,Er(w,l,m)&&(ee(w,!1),H(),O())},[K,se,H,O]),Oa=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(!m)return;const w=K(m);if(ro({open:!1,tab:"general"}),w.collapsed){if(l.size!==null){const pe=bn(l.size,l.unit);pe&&(Ve.current=pe,jt.current=pe.unit)}const z=Bn(m),V={};for(const pe of it)l.marks[pe]!==z[pe]&&(V[pe]=l.marks[pe]);et.current=V,l.fontColorMixed||(lt.current={value:l.fontColor}),l.highlightColorMixed||(ct.current={value:l.highlightColor}),l.fontFamilyMixed||(tt.current={value:l.fontFamily}),Ze.current={start:w.start,end:w.end},O();return}if(et.current={},Ve.current=null,tt.current=null,lt.current=null,ct.current=null,Ze.current=null,l.size!==null){const z=bn(l.size,l.unit);z&&(jt.current=z.unit,ks(m,z.value,z.unit))}const M=Bn(m);for(const z of it)l.marks[z]!==M[z]&&Ds(m,z);l.fontFamilyMixed||ws(m,l.fontFamily),l.fontColorMixed||Er(m,"color",l.fontColor),l.highlightColorMixed||Er(m,"backgroundColor",l.highlightColor),ee(m,!1),H(),O()},[K,se,H,O]),Yc=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),so(w=>({...w,open:!1})),!vf(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),Xc=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(!m)return;const w=K(m);if(ua(M=>({...M,open:!1})),!Ti(l)){H(),O();return}if(w.collapsed){zt.current=l,Ze.current={start:w.start,end:w.end},O();return}if(zt.current=null,!qm(m,l)){H(),O();return}ee(m,!1),H(),O()},[K,se,H,O]),Jc=c.useCallback(l=>{if(I.current!=="visual")return;const m=fn();if(!m)return;K(m),kn(V=>({...V,open:!1}));const w=be.current?Me(ne.current)[Ge.current]??"":ne.current,M=JSON.stringify(l.atRule)!==JSON.stringify(qt(Se(w).body)),z=If(m,l);if(M&&Or(m,z.pageHtml),!z.changed&&!M){H(),O();return}kr(z.pageHtml,!1),H(),O()},[K,kr,H,O,fn]),Qc=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),uo(w=>({...w,open:!1})),!jC(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),eu=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),ba(w=>({...w,open:!1})),!MC(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),To=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),mo({open:!1}),!a1(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),No=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),fo({open:!1}),!hw(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),tu=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),Cr({open:!1}),!kw(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),nu=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),xa({open:!1}),!Tx(m,l)){H(),O();return}ee(m,!1),H(),O(),bt(m)}},[K,se,H,O,bt]),ru=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),Ca(w=>({...w,open:!1})),!Jw(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),ou=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),wa(w=>({...w,open:!1})),!l0(m,l)){H(),O();return}ee(m,!1),H(),O(),bt(m)}},[K,se,H,O,bt]),iu=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),va(w=>({...w,open:!1})),!y0(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),Tt=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),!l(m)){H(),O();return}ee(m,!1),H(),O(),bt(m)}},[K,se,H,O,bt]),Ka=c.useCallback(l=>{To({src:l.src,alt:l.alt??"",title:l.title??"",css:l.css})},[To]),$a=c.useCallback(l=>{No({src:l.src,title:l.title??"",css:l.css})},[No]),Ua=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),Cr({open:!1}),!Aw(m,{src:l.src,title:l.title??"",css:l.css})){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),au=c.useCallback(l=>{if(I.current!=="visual")return;const m=B.current;if(m){if(K(m),po(w=>({...w,open:!1})),!S1(m,l)){H(),O();return}ee(m,!1),H(),O()}},[K,se,H,O]),Kg=c.useCallback((l,m)=>{Re!=null&&Re.isConnected&&Vw(Re,l,m)},[Re]),$g=c.useCallback(()=>{const l=B.current;!l||!(Re!=null&&Re.isConnected)||(ee(l,!1),os(l,Re),H(),O())},[Re,se,H,O]),Ut=c.useCallback(()=>{if(be.current){if(I.current==="visual"){const l=Ye(),m=nt(l);if(m!==ne.current)return ge(m,!0)}return ne.current}if(I.current==="visual"&&B.current){const l=Ct(B.current.innerHTML,Se(ne.current).body),m=Ho(l,zo(l,ne.current,Pn.current));if(m!==ne.current)return ge(m,!0)}return ne.current},[ge]),Wa=c.useCallback(()=>{if(!Yr.current&&$i.current)return $i.current;const l=JSON.stringify(Rn());return $i.current=l,Yr.current=!1,l},[Rn]),Ug=c.useCallback(()=>be.current?Wa():Ut(),[Ut,Wa]);A0({onAutoSave:r?()=>{const l=be.current?JSON.parse(Wa()):Ut();return r(l)}:void 0,getHtml:Ug}),c.useEffect(()=>()=>{var l;(l=sr.current)==null||l.cancel()},[]);const de=c.useMemo(()=>({getHtml:Ut,setHtml:l=>{ge(l,!1)},getMode:()=>I.current,setMode:Wc,getFullscreen:()=>Vl.current,setFullscreen:or,getDarkMode:()=>Ac.current,setDarkMode:l=>{Ic(l)},getPageZoom:()=>Co.current,setPageZoom:Fc,getToolbarPosition:()=>Pc.current,setToolbarPosition:l=>{Bc(l)},openCustomizeToolbar:()=>{rc(!0)},openDocumentPreview:()=>{oc({open:!0,html:Ut()})},toggleReadAloud:()=>{const l=sr.current;if(!l)return;const m=Pe.current??xt({mode:I.current,visualEl:B.current,htmlEl:We.current}),w=id(Io(m),Ut());w&&l.toggle(w)},isReadingAloud:()=>{var l;return((l=sr.current)==null?void 0:l.isSpeaking())??!1},canReadAloud:()=>{if(!ti())return!1;const l=Pe.current??xt({mode:I.current,visualEl:B.current,htmlEl:We.current});return id(Io(l),Ut())!==null},undo:jo,redo:Ro,canUndo:()=>Qe.canUndo(),canRedo:()=>Qe.canRedo(),getSelection:()=>{const l=Pe.current??xt({mode:I.current,visualEl:B.current,htmlEl:We.current});return Io(l)},insertText:l=>{const m=Pe.current??xt({mode:I.current,visualEl:B.current,htmlEl:We.current});Nn(m,l,!1)},insertHtml:(l,m)=>{const w=Pe.current??xt({mode:I.current,visualEl:B.current,htmlEl:We.current}),M=m===void 0;Nn(w,M?l:m,M)},toggleFontMark:l=>{if(I.current!=="visual")return;const m=B.current;if(!m)return;const w=K(m);if(w.collapsed){const M=Bn(m);et.current=Wy(et.current,M,l),Ze.current={start:w.start,end:w.end},O();return}et.current={},Ze.current=null,Ds(m,l)&&(ee(m,!1),H(),O())},clearFormatting:()=>{if(I.current!=="visual")return;const l=B.current;!l||K(l).collapsed||(et.current={},Ve.current=null,tt.current=null,lt.current=null,ct.current=null,zt.current=null,Ze.current=null,QC(l)&&(ee(l,!1),H(),O()))},toggleFormatBrush:Vc,isFormatBrushActive:()=>eo.current,isFontMarkActive:l=>Wi.current[l],hasTextSelection:()=>I.current==="visual"&&oa.current,setFontSize:(l,m)=>{Ha(l,m)},setFontSizeUnit:l=>{var pe;const m=B.current,w=Ot.current;if(I.current!=="visual"||!m||w.value===null||w.mixed){jt.current=l,Qr(Nt=>({...Nt,unit:l}));return}const M=K(m),z=Ny(m,((pe=M.visualRange)==null?void 0:pe.startContainer)??m),V=nm(w.value,w.unit,l,z.parentPx,z.rootPx);Ha(V,l)},getFontSize:()=>Ot.current.value,getFontSizeUnit:()=>Ot.current.unit,isFontSizeMixed:()=>Ot.current.mixed,setFontFamily:l=>{qc(l)},getFontFamily:()=>ur.current.value,isFontFamilyMixed:()=>ur.current.mixed,getFontFaces:()=>Pn.current,setFontColor:l=>{za("color",l)},setHighlightColor:l=>{za("backgroundColor",l)},getFontColor:()=>mr.current.value,isFontColorMixed:()=>mr.current.mixed,getHighlightColor:()=>gr.current.value,isHighlightColorMixed:()=>gr.current.mixed,setParagraphStyle:l=>{if(I.current!=="visual")return;const m=B.current;m&&(K(m),mx(m,l)&&(ee(m,!1),H(),O()))},getParagraphStyle:()=>Xi.current.tag,isParagraphStyleMixed:()=>Xi.current.mixed,setTextAlign:l=>{if(I.current!=="visual")return;const m=B.current;m&&(K(m),wf(m,l)&&(ee(m,!1),H(),O()))},getTextAlign:()=>Qi.current.align,isTextAlignMixed:()=>Qi.current.mixed,indent:()=>{if(I.current!=="visual")return;const l=B.current;l&&(K(l),vx(l)&&(ee(l,!1),H(),O()))},outdent:()=>{if(I.current!=="visual")return;const l=B.current;l&&(K(l),Sx(l)&&(ee(l,!1),H(),O()))},canOutdent:()=>I.current==="visual"&&Jl.current,toggleList:l=>{if(I.current!=="visual")return;const m=B.current;m&&(K(m),px(m,l)&&(ee(m,!1),H(),O()))},isBulletList:()=>pr.current.type==="ul"&&!pr.current.mixed,isNumberedList:()=>pr.current.type==="ol"&&!pr.current.mixed,openFontProperties:l=>{I.current==="visual"&&ro({open:!0,tab:l??"general"})},applyFontProperties:l=>{Oa(l)},openCustomCss:()=>{if(I.current!=="visual")return;const l=B.current;l&&K(l);const m=l?Vm(l):{value:null,mixed:!1},w=m.mixed||!m.value?"":By(m.value);ua({open:!0,value:w})},applyCustomCss:l=>{Xc(l)},openParagraphProperties:l=>{if(I.current!=="visual")return;const m=B.current;m&&K(m),so({open:!0,tab:l??"general",value:m?Uu(m):Rr()})},applyParagraphProperties:l=>{Yc(l)},openPageProperties:l=>{if(I.current!=="visual")return;const m=B.current;m&&K(m);const w=be.current?Me(ne.current)[Ge.current]??"":ne.current,M=m?Lf(m):Fs();kn({open:!0,tab:l==="print"&&!Bt?"font":l??"font",value:{...M,atRule:qt(Se(w).body)}})},applyPageProperties:l=>{Jc(l)},openCustomParagraphStyleDialog:l=>{if(I.current!=="visual"||!ja.current)return;if(l){const w=xo.current.find(M=>M.id===l);if(!w)return;xr({open:!0,mode:"edit",style:w});return}const m=B.current;m&&K(m),xr({open:!0,mode:"create",font:{size:Ot.current.mixed?null:Ot.current.value,unit:Ot.current.unit,marks:{...Wi.current},fontFamily:ur.current.mixed?null:ur.current.value,fontColor:mr.current.mixed?null:mr.current.value,highlightColor:gr.current.mixed?null:gr.current.value},paragraph:Sf(m?Uu(m):Rr())})},applyCustomParagraphStyle:l=>{const m=xo.current.find(M=>M.id===l);if(!m||(Oa({size:m.font.size,unit:m.font.unit,marks:m.font.marks,fontFamily:m.font.fontFamily??null,fontFamilyMixed:!1,fontColor:m.font.fontColor,highlightColor:m.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!m.paragraph))return;const w=B.current;!w||I.current!=="visual"||(K(w),Zx(w,m.paragraph)&&(ee(w,!1),H(),O()))},customParagraphStylesEnabled:()=>ja.current,getCustomParagraphStyles:()=>xo.current,isCustomParagraphStylesLoading:()=>fc.current,openLinkDialog:l=>{if(I.current!=="visual")return;const m=B.current;m&&K(m);const w=m?zf(m):_i(),M=m?zs(m):[],z=(w==null?void 0:w.href)??"",V=z.startsWith("#")?z.slice(1):"",pe=M.some(Nt=>Nt.id===V)?V:"";uo({open:!0,tab:l??"link",href:z,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:M,selectedBookmarkId:pe})},applyLink:l=>{Qc(l)},openBookmarkDialog:()=>{if(I.current!=="visual")return;const l=B.current;l&&K(l),ba({open:!0,existingIds:l?zs(l).map(m=>m.id):[]})},applyBookmark:l=>{eu(l)},openImageDialog:()=>{if(I.current!=="visual")return;const l=B.current;l&&K(l);const m=xc.current;if(Dc.current&&m){m.onPick(Ka);return}mo({open:!0})},applyImage:l=>{To(l)},openAudioDialog:()=>{if(I.current!=="visual")return;const l=B.current;l&&K(l);const m=Cc.current;if(Ec.current&&m){m.onPick($a);return}fo({open:!0})},applyAudio:l=>{No(l)},openYoutubeDialog:()=>{if(I.current!=="visual")return;const l=B.current;l&&K(l);const m=wc.current;if(jc.current&&m){m.onPick(Ua);return}Cr({open:!0})},applyYoutube:l=>{tu(l)},openImageProperties:l=>{if(I.current!=="visual")return;const m=B.current;if(!m)return;K(m);const w=Yt(m),M=v1(m);!w||!M||po({open:!0,tab:l??"general",value:M,aspectRatio:x1(w)})},applyImageProperties:l=>{au(l)},insertHorizontalRule:()=>{if(I.current!=="visual")return;const l=B.current;l&&(K(l),Fw(l)&&(ee(l,!1),H(),O()))},insertPageBreak:()=>{if(I.current!=="visual")return;const l=B.current;l&&(K(l),Ow(l)&&(ee(l,!1),H(),O()))},insertPageBefore:()=>{Oc()},insertPageAfter:()=>{Kc()},deletePage:()=>{!be.current||I.current!=="visual"||Et.current&&(Rn().length<=1||ma(!0))},isMultiPagesEnabled:()=>be.current,hasSelectedPage:()=>be.current&&I.current==="visual"&&Et.current,canDeletePage:()=>be.current&&I.current==="visual"&&Et.current&&Rn().length>1,getActivePageHtml:()=>zc(),getAllPagesHtml:()=>Rn(),openTableDialog:()=>{if(I.current!=="visual")return;const l=B.current;l&&K(l),xa({open:!0})},applyTable:l=>{nu(l)},openTableProperties:()=>{if(I.current!=="visual")return;const l=B.current;if(!l)return;K(l);const m=Xw(l);m&&Ca({open:!0,value:m})},applyTableProperties:l=>{ru(l)},openCellProperties:()=>{if(I.current!=="visual")return;const l=B.current;if(!l)return;K(l);const m=s0(l);m&&wa({open:!0,value:m})},applyCellProperties:l=>{ou(l)},openRowProperties:()=>{if(I.current!=="visual")return;const l=B.current;if(!l)return;K(l);const m=b0(l);m&&va({open:!0,value:m})},applyRowProperties:l=>{iu(l)},insertRowBelow:()=>{Tt(l=>Rs(l,"below"))},insertRowBefore:()=>{Tt(l=>Rs(l,"before"))},deleteRow:()=>{Tt(l=>Nx(l))},insertColumnAfter:()=>{Tt(l=>Hu(l,"after"))},insertColumnBefore:()=>{Tt(l=>Hu(l,"before"))},deleteColumn:()=>{Tt(l=>Mx(l))},mergeCells:()=>{Tt(l=>Ix(l))},unmergeCells:()=>{Tt(l=>Fx(l))},cut:async()=>{if(I.current!=="visual")return;const l=B.current;l&&(K(l),await ZC(l)&&(ee(l,!1),H(),O()))},copy:async()=>{if(I.current!=="visual")return;const l=B.current;l&&(K(l),await Gf(l))},deleteSelection:()=>{if(I.current!=="visual")return;const l=B.current;l&&(K(l),Wf(l)&&(ee(l,!1),H(),O()))},addComment:()=>{if(!un.current||y||I.current!=="visual")return;const l=B.current;if(!l)return;const m=K(l),w=td(l,m);if(w){Dt(w);return}const M=FC(l,m);if(!M)return;const z=KC(M);BC(l,z.id,m)&&(od(l,z.id),H(),Hc(l,!1),ir([...Zr.current,z]),Dt(z.id))},toggleCommentsVisible:()=>{jg(l=>{const m=!l,w=B.current;return w&&nd(w,m),m})},areCommentsVisible:()=>Vr.current,canAddComment:()=>!un.current||y||I.current!=="visual"?!1:oa.current||ka.current!==null,isCommentsEnabled:()=>un.current,getCommentThreads:()=>Zr.current,setCommentThreads:l=>ir(l),openCommentThread:l=>{const m=B.current;!m||I.current!=="visual"||od(m,l)&&(H(),Dt(l))},isContentLocked:()=>Gl.current,isLink:()=>nc.current,isImageSelected:()=>I.current==="visual"&&ka.current!==null,isInTable:()=>I.current==="visual"&&sc.current,canMergeCells:()=>I.current==="visual"&&cc.current,canUnmergeCells:()=>I.current==="visual"&&dc.current,...i!=null?{onSave:l=>bc.current(l)}:{},...a!=null?{onOpen:()=>yc.current()}:{}}),[ge,se,ee,Hc,Wc,or,Ic,Fc,Bc,Nn,jo,Ro,H,O,K,Ha,qc,za,Oa,Xc,Yc,Jc,Qc,eu,To,No,tu,au,nu,ru,ou,iu,Tt,Ka,$a,Ua,Ut,zc,Rn,Oc,Kc,$c,Vc,i,a,y,ir,Bt]),su=c.useCallback(()=>{const l=Pe.current??xt({mode:I.current,visualEl:B.current,htmlEl:We.current});return{mode:l.mode,selection:Io(l),getHtml:de.getHtml,setHtml:m=>{ge(m,!1)},insertText:m=>Nn(l,m,!1),insertHtml:(m,w)=>{const M=w===void 0;Nn(l,M?m:w,M)}}},[Nn,de.getHtml,ge]),{catalog:Mo,layout:lu}=c.useMemo(()=>Gp(E,cD,uD),[E]),_o=c.useMemo(()=>OP(lu,D),[lu,D]),cu=c.useMemo(()=>({..._o,iconGroups:gP(_o.iconGroups,sa)}),[_o,sa]),uu=Ae&&fe==="visual",Ga=c.useMemo(()=>AD(cu,uu),[cu,uu]),Va=c.useMemo(()=>ze?gD(Mo,pt):Mo,[Mo,ze,pt]),Za=c.useMemo(()=>ze?pD(Ga):Ga,[Ga,ze]),qa=c.useMemo(()=>({disabled:rr,readOnly:C,enableComments:ze}),[rr,C,ze]),du=c.useMemo(()=>ht?WC(Cn,ht):null,[ht,Cn]),Wg=c.useCallback(l=>{if(!ht||!Ur||y)return;const m=$C(Ur,l);ir(UC(Zr.current,ht,m))},[ht,Ur,y,ir]),Mn=c.useMemo(()=>({...Dy(de),...Vp(E,su)}),[de,E,su]),Ya=c.useMemo(()=>Ey(de),[de,Jr,lr,cr,dr,fr,qi,fa,ga,Ea,$t,Re,Aa,Pa,Da,na,ia,vn,ut,Sn,Oi]),mu=c.useCallback(l=>{if(te||l.inputType!=="insertText"&&l.inputType!=="insertReplacementText"||!l.data||!Uy(et.current)&&!Ve.current&&!ey(tt.current)&&!_h({color:lt.current,backgroundColor:ct.current})&&!Oy(zt.current))return;const m=B.current;m&&(l.preventDefault(),ex(m,l.data,et.current,Ve.current,{color:lt.current,backgroundColor:ct.current},tt.current,zt.current),et.current={},Ve.current=null,tt.current=null,lt.current=null,ct.current=null,zt.current=null,Ze.current=null,ee(m,!0),H(),O())},[te,se,H,O]),fu=c.useCallback(l=>{if(te||!ch(l,mc.current))return;l.preventDefault(),l.stopPropagation();const m=B.current;if(!m)return;K(m);const w=_s(m,l.target),M=hi(m,l.target);M&&!$r(m).includes(M)&&Lx(m,M);const z={inTable:$e(m,l.target)!==null,canMergeCells:zu(m),canUnmergeCells:Ou(m)},V={canDeletePage:be.current&&Et.current&&Ye().length>1};if(w){os(m,w),H(),An(w),Sa({open:!0,x:l.clientX,y:l.clientY,kind:"image",...z,...V,inTable:$e(m,w)!==null});return}const pe=xt({mode:"visual",visualEl:m,htmlEl:We.current});Pe.current=pe,Sa({open:!0,x:l.clientX,y:l.clientY,kind:pe.collapsed?"caret":"text",...z,...V})},[te,H,K,Ye]),gu=c.useCallback(l=>{if(mc.current=l.pointerType,y)return;const m=B.current;if(!m)return;if(un.current&&Vr.current){const M=rd(m,l.target);if(M){const z=M.getAttribute("data-comment-thread");z&&Dt(z);return}}if(te&&!un.current)return;const w=_s(m,l.target);if(!w){An(null);return}l.preventDefault(),os(m,w),H(),An(w)},[y,te,H]);c.useEffect(()=>{if(!ze||fe!=="visual")return;const l=B.current;l&&(OC(l,Cn),nd(l,pt))},[ze,fe,Cn,pt,Ee]);const pu=c.useCallback(l=>{if(te)return;if(l.key==="Tab"&&!l.ctrlKey&&!l.metaKey&&!l.altKey){if(I.current!=="visual")return;const w=B.current;if(!w)return;const M=l.target;if(!(M instanceof Node)||!w.contains(M))return;K(w);const z=_x(w,l.shiftKey);if(!z)return;l.preventDefault(),typeof z=="object"&&z.changed&&ee(w,!1),H(),O(),bt(w);return}if(!(l.ctrlKey||l.metaKey))return;if(l.key==="Enter"&&!l.shiftKey){l.preventDefault(),de.insertPageBreak();return}const m=l.key.toLowerCase();if(m==="z"&&!l.shiftKey){l.preventDefault(),jo();return}if(m==="z"&&l.shiftKey||m==="y"){l.preventDefault(),Ro();return}if(m==="b"&&!l.shiftKey){l.preventDefault(),de.toggleFontMark("bold");return}if(m==="i"&&!l.shiftKey){l.preventDefault(),de.toggleFontMark("italic");return}if(m==="u"&&!l.shiftKey){l.preventDefault(),de.toggleFontMark("underline");return}if(m==="x"&&l.shiftKey){l.preventDefault(),de.toggleFontMark("strikethrough");return}m==="p"&&!l.shiftKey&&(l.preventDefault(),Mn.print())},[te,jo,Ro,de,Mn,K,se,H,O,bt]),Gg=c.useCallback(l=>{if(l.key==="Escape"&&ht){l.preventDefault(),Dt(null);return}pu(l)},[ht,pu]),Vg=[xe.root,hs(vn).className,Pt?xe.fullscreen:"",b].filter(Boolean).join(" "),Zg=qD({toolbarBackground:k,menuColor:A,menuBackground:R,menuFontSize:N,menuFontFamily:T,border:S}),qg=hs(vn)["data-wysiwyg-theme"],Yg=c.useMemo(()=>{if(fe==="visual"&&!(yr===1&&!vy(Sn)))return{zoom:yr}},[fe,Sn,yr]),hu=fe==="visual"?Ae?o.jsx(GD,{ref:cn,pages:Dn,activePageIndex:Ht,onActivePageIndexChange:l=>{var M;Ge.current=l,zi(l);const m=(M=cn.current)==null?void 0:M.getContainer(),w=m?In(m,l):null;w instanceof HTMLDivElement&&(B.current=w)},onPageSelected:()=>{ar(!0)},onPageChange:(l,m)=>{const w=Me(ne.current)[l]??"";Sr(l,Ct(m,Se(w).body),!0)},onBeforeInput:mu,onPointerDown:l=>{if(l.currentTarget instanceof HTMLDivElement&&(B.current=l.currentTarget),gu(l),l.currentTarget instanceof HTMLDivElement){const m=l.currentTarget;requestAnimationFrame(()=>Kn(m))}},onMouseUp:Zc,onContextMenu:fu,placeholder:x,disabled:te}):o.jsx(WD,{ref:B,html:Se(Ee).body,onChange:l=>Og(l,!0),onBeforeInput:mu,onPointerDown:l=>{if(gu(l),l.currentTarget instanceof HTMLDivElement){const m=l.currentTarget;requestAnimationFrame(()=>Kn(m))}},onMouseUp:Zc,onContextMenu:fu,placeholder:x,disabled:te}):o.jsx(UD,{ref:We,html:Ee,onChange:l=>ge(l,!0),placeholder:x,disabled:te});return o.jsx(th,{locale:v,children:o.jsx(Xp,{dark:vn,children:o.jsxs("div",{className:Vg,style:Zg,"data-fullscreen":Pt?"":void 0,"data-wysiwyg-theme":qg,"data-toolbar-position":ut,"data-comments-visible":ze&&pt?"":void 0,onKeyDown:Gg,children:[P?o.jsx("div",{className:xe.menuChrome,onPointerDownCapture:Ma,children:o.jsx(ps,{catalog:Va,layout:Za,commands:Mn,queries:Ya,disabled:rr,chromeLock:qa,menuVisible:!0,toolbarVisible:!1})}):null,o.jsxs("div",{className:xe.body,"data-icon-dock":_?ut:void 0,children:[_&&(ut==="top"||ut==="left")?o.jsx("div",{className:xe.iconChrome,onPointerDownCapture:Ma,children:o.jsx(ps,{catalog:Va,layout:Za,commands:Mn,queries:Ya,disabled:rr,chromeLock:qa,menuVisible:!1,toolbarVisible:!0,position:ut})}):null,o.jsxs("div",{ref:Gr,className:`${xe.workspace} ${En?xe.workspacePageSized:""}`,onDragEnter:vr.onDragEnter,onDragOver:vr.onDragOver,onDragLeave:vr.onDragLeave,onDrop:vr.onDrop,children:[fe==="visual"?o.jsx("div",{className:xe.pageCanvasViewport,style:Yg,"data-page-canvas-sized":En?"":void 0,children:hu}):hu,vr.dragging?o.jsx(XD,{}):null]}),_&&(ut==="bottom"||ut==="right")?o.jsx("div",{className:xe.iconChrome,onPointerDownCapture:Ma,children:o.jsx(ps,{catalog:Va,layout:Za,commands:Mn,queries:Ya,disabled:rr,chromeLock:qa,menuVisible:!1,toolbarVisible:!0,position:ut})}):null]}),Pt?o.jsx(YD,{onClick:()=>or(!1)}):null,o.jsx(zP,{open:aa,catalog:Mo,groups:_o.iconGroups,settings:sa,loading:Tg,busy:Ng,disabled:te,onChange:l=>{Lc(l)},onReset:()=>{Lc(null)},onClose:()=>rc(!1)}),o.jsx(HA,{open:br.open,html:br.html,onClose:()=>oc({open:!1,html:br.html})}),o.jsx(YS,{open:hr.open,tab:hr.tab,size:lr.value,unit:lr.unit,marks:Jr,fontFamily:cr.value,fontFamilyMixed:cr.mixed,fontColor:dr.value,fontColorMixed:dr.mixed,highlightColor:fr.value,highlightColorMixed:fr.mixed,fonts:$t,disabled:te,onTabChange:l=>ro({open:!0,tab:l}),onApply:l=>de.applyFontProperties(l),onClose:()=>ro({open:!1,tab:hr.tab})}),o.jsx(xk,{open:dn.open,tab:dn.tab,value:dn.value,disabled:te,onTabChange:l=>so({...dn,open:!0,tab:l}),onApply:l=>de.applyParagraphProperties(l),onClose:()=>so({...dn,open:!1})}),o.jsx(Mk,{open:lo.open,value:lo.value,disabled:te,onApply:l=>de.applyCustomCss(l),onClose:()=>ua(l=>({...l,open:!1}))}),o.jsx(Dk,{open:mn.open,tab:mn.tab,value:mn.value,fonts:$t,disabled:te,printTabVisible:Bt,customImagePicker:oe,onCustomImagePick:()=>{oe==null||oe.onPick(l=>{kn(m=>({...m,tab:"paragraph",value:{...m.value,backgroundImage:{...m.value.backgroundImage,src:l.src}}}))})},onTabChange:l=>kn({...mn,open:!0,tab:l}),onApply:l=>de.applyPageProperties(l),onResetAtRule:()=>{const l=fn();if(!l||I.current!=="visual")return;const m=be.current?Me(ne.current)[Ge.current]??"":Se(ne.current).body,w=lC(l,m);w.changed&&(kr(w.pageHtml,!1),kn(M=>({...M,value:{...M.value,atRule:Zt()}})))},onClose:()=>kn({...mn,open:!1})}),o.jsx(Ek,{open:da,disabled:te,onClose:()=>ma(!1),onConfirm:()=>{$c(),ma(!1)}}),o.jsx(Tk,{open:je.open,mode:je.open?je.mode:"create",styleId:je.open&&je.mode==="edit"?je.style.id:void 0,name:je.open&&je.mode==="edit"?je.style.name:"",font:je.open?je.mode==="edit"?je.style.font:je.font:{size:null,unit:hn,marks:Lt(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:je.open?je.mode==="edit"?je.style.paragraph:je.paragraph:void 0,canDelete:!!Q,fonts:$t,busy:Lg,disabled:te,onSave:async l=>{const m=pc.current;if(m){co(!0);try{await m(l),xr({open:!1}),await Po()}finally{co(!1)}}},onDelete:async l=>{const m=hc.current;if(m){co(!0);try{await m(l),xr({open:!1}),await Po()}finally{co(!1)}}},onClose:()=>xr({open:!1})}),o.jsx(aA,{open:qe.open,tab:qe.tab,href:qe.href,title:qe.title,targetBlank:qe.targetBlank,textDecorationNone:qe.textDecorationNone,hoverMode:qe.hoverMode,hoverColor:qe.hoverColor,hoverHtml:qe.hoverHtml,bookmarks:qe.bookmarks,selectedBookmarkId:qe.selectedBookmarkId,disabled:te,onTabChange:l=>uo({...qe,open:!0,tab:l}),onApply:l=>de.applyLink(l),onClose:()=>uo({...qe,open:!1})}),o.jsx(Lk,{open:ha.open,existingIds:ha.existingIds,disabled:te,onApply:l=>de.applyBookmark(l),onClose:()=>ba({...ha,open:!1})}),o.jsx(Hk,{open:Ig.open,disabled:te,customImagePicker:oe,onApply:l=>de.applyImage(l),onCustomPick:()=>{mo({open:!1}),oe==null||oe.onPick(Ka)},onClose:()=>mo({open:!1})}),o.jsx(Bk,{open:Fg.open,disabled:te,customAudioPicker:le,onApply:l=>de.applyAudio(l),onCustomPick:()=>{fo({open:!1}),le==null||le.onPick($a)},onClose:()=>fo({open:!1})}),o.jsx(sA,{open:Bg.open,disabled:te,customVideoPicker:re,onApply:l=>de.applyYoutube(l),onCustomPick:()=>{Cr({open:!1}),re==null||re.onPick(Ua)},onClose:()=>Cr({open:!1})}),o.jsx(Jk,{open:go.open,tab:go.tab,value:go.value,aspectRatio:go.aspectRatio,disabled:te,onTabChange:l=>po(m=>({...m,tab:l})),onApply:l=>de.applyImageProperties(l),onClose:()=>po(l=>({...l,open:!1}))}),o.jsx(fA,{open:ya.open,disabled:te,onApply:l=>de.applyTable(l),onClose:()=>xa({open:!1})}),o.jsx(yA,{open:ho.open,value:ho.value,disabled:te,onApply:l=>de.applyTableProperties(l),onClose:()=>Ca(l=>({...l,open:!1}))}),o.jsx(AA,{open:bo.open,value:bo.value,disabled:te,onApply:l=>de.applyCellProperties(l),onClose:()=>wa(l=>({...l,open:!1}))}),o.jsx(jA,{open:yo.open,value:yo.value,disabled:te,onApply:l=>de.applyRowProperties(l),onClose:()=>va(l=>({...l,open:!1}))}),fe==="visual"&&!te&&(Re!=null&&Re.isConnected)?o.jsx(iA,{img:Re,onResize:Kg,onResizeEnd:$g}):null,ze&&pt&&du?o.jsx(cP,{panelRef:Bi,thread:du,locale:v,disabled:y,commentAuthor:Ur,onPost:Wg,onClose:()=>Dt(null)}):null,o.jsx(sh,{open:Kt.open,x:Kt.x,y:Kt.y,kind:Kt.kind,inTable:Kt.inTable,canMergeCells:Kt.canMergeCells,canUnmergeCells:Kt.canUnmergeCells,canDeletePage:Kt.canDeletePage,commands:Mn,onClose:()=>Sa(l=>({...l,open:!1}))})]})})})}function qD({toolbarBackground:e,menuColor:t,menuBackground:n,menuFontSize:r,menuFontFamily:i,border:a}){const s={};return e&&(s["--wysiwyg-toolbar-background"]=e),t&&(s["--wysiwyg-menu-color"]=t),n&&(s["--wysiwyg-menu-background"]=n),r&&(s["--wysiwyg-menu-font-size"]=r),i&&(s["--wysiwyg-menu-font-family"]=i),a==="none"?(s["--wysiwyg-border-width"]="0",s["--wysiwyg-border-radius"]="0",s["--wysiwyg-border-shadow"]="none"):a&&(a.width&&(s["--wysiwyg-border-width"]=a.width),a.color&&(s["--wysiwyg-border-color"]=a.color),a.radius&&(s["--wysiwyg-border-radius"]=a.radius),a.shadow&&(s["--wysiwyg-border-shadow"]=a.shadow)),Object.keys(s).length?s:void 0}function YD({onClick:e}){const t=W();return o.jsx("button",{type:"button",className:xe.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:o.jsx(Be,{className:xe.exitFullscreenIcon})})}function XD(){const e=W();return o.jsx("div",{className:xe.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function JD(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)===Le?!0:t.length===2&&t.some(r=>r.name===Le)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function QD(e){for(const t of[...e.querySelectorAll(`[${Le}]`)])t.removeAttribute(Le),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!JD(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function eE(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return QD(n.body),n.body.innerHTML}exports.Editor=ZD;exports.PAGE_SEPARATOR=di;exports.joinPagesToHtml=nt;exports.sanitizeDocumentHtml=ei;exports.sanitizePageHtml=Hs;exports.splitPagesFromHtml=Me;exports.stripCommentAnchors=eE;
93
+ [data-wysiwyg-page-break] {
94
+ display: block;
95
+ clear: both;
96
+ break-after: page;
97
+ page-break-after: always;
98
+ height: 0;
99
+ margin: 1.5em 0;
100
+ border: 0;
101
+ border-top: 2px dashed #bbb;
102
+ }
103
+ .wysiwyg-preview-page + .wysiwyg-preview-page {
104
+ margin-top: 1.5rem;
105
+ padding-top: 1.5rem;
106
+ border-top: 2px dashed #ccc;
107
+ }
108
+ @media print {
109
+ [data-wysiwyg-page-break] {
110
+ display: block !important;
111
+ clear: both !important;
112
+ break-after: page !important;
113
+ page-break-after: always !important;
114
+ height: 0 !important;
115
+ margin: 0 !important;
116
+ border: 0 !important;
117
+ visibility: hidden !important;
118
+ }
119
+ .wysiwyg-preview-page + .wysiwyg-preview-page {
120
+ margin-top: 0 !important;
121
+ padding-top: 0 !important;
122
+ border-top: 0 !important;
123
+ }
124
+ }
125
+ `.trim();function Ws(e,t,n="​"){const{hrefs:r,body:o}=Ce(t),a=e.createElement("meta");a.setAttribute("charset","utf-8");const s=e.createElement("title");s.textContent=n;const u=e.createElement("style");u.textContent=ix;const d=r.map(g=>{const p=e.createElement("link");return p.rel="stylesheet",p.href=g,p});e.head.replaceChildren(a,s,u,...d),e.title=n,e.body.innerHTML=o}const ax=1e3;function Af(){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 Df(e,t,n,r){Ws(e,r);let o=!1;const a=()=>{o||(o=!0,n.remove())};t.addEventListener("afterprint",a),t.focus(),t.print(),window.setTimeout(a,ax)}function sx(e){const t=Af();t&&Df(t.doc,t.win,t.iframe,e)}function lx(e){const t=Af();if(!t)return;const n=[],r=[];for(const u of e){const d=Ce(u);n.push(...d.hrefs),r.push(d.body)}const o=r.map((u,d)=>`<div data-wysiwyg-print-page="" style="${d===r.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${u}</div>`).join(""),a=wy(e),s=[a?`<style>${a}</style>`:"",...Array.from(new Set(n)).map(u=>`<link rel="stylesheet" href="${u}" />`),o].filter(Boolean).join("");Df(t.doc,t.win,t.iframe,s)}function cx(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 Oy(t)},open:async()=>{const t=e.onOpen?await e.onOpen():await $y();if(t!==null){if(Array.isArray(t)){e.setHtml(at(t));return}if(e.isMultiPagesEnabled()){e.setHtml(at([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){lx(e.getAllPagesHtml());return}sx(e.getHtml())}}}function ux(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 dx(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 mx(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function fx(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function gx(e){return{openLinkDialog:t=>{e.openLinkDialog(t)},applyLink:t=>{e.applyLink(t)},openBookmarkDialog:()=>{e.openBookmarkDialog()},applyBookmark:t=>{e.applyBookmark(t)},openImageDialog:()=>{e.openImageDialog()},openPageBackgroundImage:()=>{e.openPageBackgroundImage()},openParagraphBackgroundImage:()=>{e.openParagraphBackgroundImage()},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()},insertPageBefore:()=>{e.insertPageBefore()},insertPageAfter:()=>{e.insertPageAfter()},deletePage:()=>{e.deletePage()}}}function px(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),hasSelectedPage:()=>e.hasSelectedPage(),canDeletePage:()=>e.canDeletePage(),canInsertPageBackgroundImage:()=>e.canInsertPageBackgroundImage(),canInsertParagraphBackgroundImage:()=>e.canInsertParagraphBackgroundImage()}}function hx(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 bx(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}const yx=[50,75,100,125,150,200],xx=.1,wx=3;function ks(e){return!Number.isFinite(e)||e<=0?1:Math.min(wx,Math.max(xx,e))}function Cx(e,t,n,r,o){if(e==="fitWidth")return r<=0?1:ks(t/r);if(e==="fitPage"){if(r<=0||o<=0)return 1;const a=t/r,s=n/o;return ks(Math.min(a,s))}return ks(e/100)}function Qt(e,t){return()=>{e.setPageZoom(t)}}function en(e,t){return()=>e.getPageZoom()===t}function vx(e){return{setVisualMode:()=>{e.setMode("visual")},setHtmlMode:()=>{e.setMode("html")},toggleFullscreen:()=>{e.setFullscreen(!e.getFullscreen())},openCustomizeToolbar:()=>{e.openCustomizeToolbar()},openDocumentPreview:()=>{e.openDocumentPreview()},toggleReadAloud:()=>{e.toggleReadAloud()},toggleRuler:()=>{e.toggleRuler()},setLightMode:()=>{e.setDarkMode(!1)},setDarkMode:()=>{e.setDarkMode(!0)},setPageZoomFitWidth:Qt(e,"fitWidth"),setPageZoomFitPage:Qt(e,"fitPage"),setPageZoom50:Qt(e,50),setPageZoom75:Qt(e,75),setPageZoom100:Qt(e,100),setPageZoom125:Qt(e,125),setPageZoom150:Qt(e,150),setPageZoom200:Qt(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function kx(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:en(e,"fitWidth"),isPageZoomFitPage:en(e,"fitPage"),isPageZoom50:en(e,50),isPageZoom75:en(e,75),isPageZoom100:en(e,100),isPageZoom125:en(e,125),isPageZoom150:en(e,150),isPageZoom200:en(e,200),isToolbarPositionTop:()=>e.getToolbarPosition()==="top",isToolbarPositionLeft:()=>e.getToolbarPosition()==="left",isToolbarPositionRight:()=>e.getToolbarPosition()==="right",isToolbarPositionBottom:()=>e.getToolbarPosition()==="bottom",isReadingAloud:()=>e.isReadingAloud(),isRulerVisible:()=>e.isRulerVisible(),canReadAloud:()=>e.canReadAloud()}}function Sx(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function Px(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function Ax(e){return{...cx(e),...mx(e),...Gh(e),...gx(e),...hx(e),...vx(e),...ux(e),...Sx(e)}}function Dx(e){return{...kx(e),...fx(e),...px(e),...bx(e),...dx(e),...Px(e)}}function ji(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Rx(e){const t=e.style.fontSize;if(!t)return null;const n=vl(t);return!n||!Wi(n.unit)?null:{value:n.value,unit:n.unit}}function Rf(e,t){let n=ji(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=Rx(n);if(r)return r;n=n.parentElement}return null}function Ex(e,t){const n=ji(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function Ef(e,t){var a;let n=ji(t);for(;n&&n!==e;){if(n.style.fontSize){const u=n.parentElement??e,d=parseFloat(getComputedStyle(u).fontSize);return Number.isFinite(d)&&d>0?d:16}n=n.parentElement}const r=((a=ji(t))==null?void 0:a.parentElement)??e,o=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(o)&&o>0?o:16}function jf(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function jx(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function dd(e=Rn){return{value:null,unit:e,mixed:!1}}function Tf(e,t=Rn){const n=window.getSelection();if(!n||n.rangeCount===0)return dd(t);const r=n.getRangeAt(0);if(!de(e,r.commonAncestorContainer))return dd(t);const o=r.collapsed?[]:qe(r).filter(g=>g.data.length>0),a=o.length>0?o:[r.startContainer],s=a.map(g=>Rf(e,g)),u=s[0];if(s.every(g=>jx(g,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(s.every(g=>g===null)){const g=a.map(h=>Ex(h,e)),p=g[0];if(g.every(h=>Math.abs(h-p)<.05)){const h=Ef(e,a[0]),x=jf(e);return{value:Mm(p,t,h,x),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function Tx(e,t){return{parentPx:Ef(e,t),rootPx:jf(e)}}function Nx(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return de(e,n.commonAncestorContainer)?n:null}function Vs(e,t,n){const r=En(t,n);if(!r)return!1;const o=Nx(e);if(!o||o.collapsed)return!1;const a=Cl(r.value,r.unit);Dt(o);const s=qe(o).filter(u=>u.data.length>0);for(const u of s){const d=Rf(e,u);d&&d.value===r.value&&d.unit===r.unit||eo(u,g=>{g.style.fontSize=a})}return Tn(s),!0}function Ix(e,t){e.style.fontSize=Cl(t.value,t.unit)}function Mx(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function _x(e){return e.trim().toLowerCase()}function Gs(e){const t={};for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=_x(r.slice(0,o)),s=r.slice(o+1).trim();a&&(t[a]=s)}return t}function Nf(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function Lx(e,t){const n={...e};for(const[r,o]of Object.entries(t))o.trim()?n[r]=o:delete n[r];return n}function Fx(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(`
126
+ `)}function Yi(e){const t=Gs(e);return Nf(t)}function Bx(e,t){let n=Mx(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function If(e){const t=Et(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:qe(t).filter(d=>d.data.length>0),a=(n.length>0?n:[t.startContainer]).map(d=>Bx(e,d)).map(d=>d.trim()),s=a[0]??"";return a.every(d=>d===s)?{value:s||null,mixed:!1}:{value:null,mixed:!0}}function Mf(e,t){const n=Gs(e.style.cssText),r=Gs(t),o=Lx(n,r),a=Nf(o);a?e.style.cssText=a:e.removeAttribute("style")}function _f(e,t){const n=Yi(t);if(!n)return!1;const r=Et(e);if(!r||r.collapsed)return!1;Dt(r);const o=qe(r).filter(a=>a.data.length>0);if(o.length===0)return!1;for(const a of o)eo(a,s=>{Mf(s,n),mn(s)&&tt(s)});return Tn(o),!0}function Hx(e,t){const n=Yi(t);n&&Mf(e,n)}function zx(e){return!!(e&&Yi(e))}const ct=["bold","italic","underline","strikethrough"],Zn={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},Ox=new Set(["underline","line-through","overline"]);function Ht(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function $x(e,t){return ct.every(n=>e[n]===t[n])}function Kx(e){return ct.some(t=>e[t]!==void 0)}function Lf(e,t){const n={...e};if(!t)return n;for(const r of ct){const o=t[r];o!==void 0&&(n[r]=o)}return n}function Ux(e,t,n){const r=e[n]??t[n],o={...e,[n]:!r};return o[n]===t[n]&&delete o[n],o}function ln(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>Ox.has(n))}function ar(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 Ff(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(Zn.bold.has(r))return!0;const s=n.style.fontWeight;if(!s)return null;if(s==="bold"||s==="bolder")return!0;const u=Number(s);return Number.isNaN(u)?s==="normal"||s==="lighter"?!1:null:u>=700}if(t==="italic"){if(Zn.italic.has(r))return!0;const s=n.style.fontStyle;return s?s==="italic"||s==="oblique"?!0:s==="normal"?!1:null:null}if(t==="underline"){if(Zn.underline.has(r))return!0;const s=n.style.textDecorationLine||n.style.textDecoration;if(!s)return null;if(s==="none")return!1;const u=ln(n);return u.includes("underline")?!0:u.length>0?!1:null}if(Zn.strikethrough.has(r))return!0;const o=n.style.textDecorationLine||n.style.textDecoration;if(!o)return null;if(o==="none")return!1;const a=ln(n);return a.includes("line-through")?!0:a.length>0?!1:null}function Ti(e,t){return Ff(e,t)===!0}function sr(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const o=Ff(r,n);if(o!==null)return o;r=r.parentElement}return!1}function Bf(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=ln(e);r.includes("underline")||r.push("underline"),ar(e,r);return}const n=ln(e);n.includes("line-through")||n.push("line-through"),ar(e,n)}function Hf(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"){ar(e,ln(e).filter(n=>n!=="underline"));return}ar(e,ln(e).filter(n=>n!=="line-through"))}function Wx(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=ln(e).filter(o=>o!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}ar(e,r);return}const n=ln(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}ar(e,n)}function Vx(e,t){eo(e,n=>Bf(n,t))}function Gx(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!Rt(o)||!Ti(o,n)){r=o;continue}if(fn(o,r),Ti(o,n)){if(Zn[n].has(o.tagName.toLowerCase())){tt(o);continue}if(Hf(o,n),mn(o)){tt(o);continue}}r=o}}function qx(e,t,n){const r=qe(t).filter(o=>o.data.length>0);return r.length===0?sr(e,t.startContainer,n):r.every(o=>sr(e,o,n))}function Zx(e,t,n,r){Dt(t);const o=qe(t).filter(a=>a.data.length>0);for(const a of o)r?sr(e,a,n)||Vx(a,n):Gx(e,a,n);Tn(o)}function Yn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Ht();const n=t.getRangeAt(0);if(!de(e,n.commonAncestorContainer))return Ht();if(n.collapsed)return qs(e,n);const r=qe(n).filter(a=>a.data.length>0);if(r.length===0)return qs(e,n);const o=Ht();for(const a of ct)o[a]=sr(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const s of ct)o[s]=o[s]&&sr(e,r[a],s);return o}function qs(e,t){const n=Ht();for(const r of ct)n[r]=sr(e,t.startContainer,r);return n}function Zs(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!de(e,r.commonAncestorContainer)||r.collapsed)return!1;const o=qx(e,r,t);return Zx(e,r,t,!o),!0}function Yx(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 o=r.splitText(n);e.setStart(o,0),e.collapse(!0)}function Xx(e,t,n){var a,s,u;Yx(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 d=document.createTextNode("");(a=t.startContainer.parentNode)==null||a.insertBefore(d,t.startContainer.nextSibling),r=d}else if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset===0){const d=document.createTextNode("");(s=t.startContainer.parentNode)==null||s.insertBefore(d,t.startContainer),r=d}else{const d=document.createTextNode("");r&&r!==t.startContainer?(u=r.parentNode)==null||u.insertBefore(d,r):t.startContainer.appendChild(d),r=d}let o=r;for(;o.parentElement&&o.parentElement!==e;){const d=o.parentElement;if(!Rt(d)){o=d;continue}if(!n.some(p=>Ti(d,p))){o=d;continue}fn(d,o);for(const p of n)if(Ti(d,p)){if(Zn[p].has(d.tagName.toLowerCase())){tt(d);break}if(Hf(d,p),mn(d)){tt(d);break}}o=d.isConnected?d:r}return r}function Jx(e,t,n){for(const r of ct)n[r]!==t[r]&&(n[r]?Bf(e,r):Wx(e,r))}function Qx(e,t,n,r,o,a,s){var S,D;const u=window.getSelection();if(!u||u.rangeCount===0)return;const d=u.getRangeAt(0);if(!de(e,d.commonAncestorContainer))return;const g=qs(e,d),p=Lf(g,n),h=ct.filter(I=>g[I]&&!p[I]),x=Fb(e,d.startContainer,o),b=ox(e,d.startContainer,a);let w=null;h.length>0?(w=Xx(e,d,h),x.length>0&&$m(e,w,x),b&&Us(e,w)):x.length>0?(w=Lb(e,d,x),b&&Us(e,w)):b?w=rx(e,d):d.deleteContents();const y=document.createElement("span");Jx(y,g,p),r&&Ix(y,r),o!=null&&o.color&&td(y,"color",o.color),o!=null&&o.backgroundColor&&td(y,"backgroundColor",o.backgroundColor),a&&Qy(y,a),s&&Hx(y,s),y.textContent=t;const v=y.style.cssText.trim()?y:document.createTextNode(t);w?((S=w.parentNode)==null||S.insertBefore(v,w),w.nodeType===Node.TEXT_NODE&&!w.data&&((D=w.parentNode)==null||D.removeChild(w))):d.insertNode(v);const k=document.createRange();k.selectNodeContents(v),k.collapse(!1),u.removeAllRanges(),u.addRange(k)}const Ni=["p","h1","h2","h3","h4","h5","h6"],e1=new Set(Ni),zf=new Set([...Ni,"div"]),Xi=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),t1=()=>({tag:null,mixed:!1});function Of(e){return e1.has(e)}function n1(e){return Of(e)?e:e==="div"?"p":null}function r1(e){return e instanceof Element&&Xi.has(xe(e))}function $f(e){return e instanceof HTMLElement&&!dt(e)&&zf.has(xe(e))}function Ys(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=xe(e);return zf.has(t)||Xi.has(t)?!1:Rt(e)||t==="br"||t==="a"||t==="img"||t==="span"}function o1(e,t){let n=to(t);for(;n&&n!==e;){if(Xi.has(xe(n)))return!0;n=n.parentElement}return!1}function Kf(e,t){let n=to(t);for(;n&&n!==e;){if(hf(n,e)){n=n.parentElement;continue}if($f(n))return n;if(Xi.has(xe(n)))return null;n=n.parentElement}return null}function i1(e,t){const n=new Set,r=[];for(const o of Rl(t)){const a=Kf(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function a1(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function s1(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&Ys(n[o-1]);)o-=1;for(;a<n.length-1&&Ys(n[a+1]);)a+=1;return n.slice(o,a+1)}function Xs(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&dt(t)))return t;return null}function l1(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&&dt(r)?Xs(e):r}return n.startContainer===t&&e!==t?Xs(e):a1(e,n.startContainer)}function c1(e,t,n){const r=$l(e);if(o1(e,t.startContainer))return!1;if(!Xs(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const o=l1(r,e,t);if(!o||o instanceof HTMLElement&&dt(o)||r1(o)||$f(o)||!Ys(o))return!1;const a=s1(r,o),s=document.createElement(n);r.insertBefore(s,a[0]);for(const u of a)s.appendChild(u);return!0}function u1(e){const t=Et(e);if(!t)return t1();const n=Rl(t).map(o=>{const a=Kf(e,o);return a?n1(xe(a)):null}),r=n[0];return n.every(o=>o===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function d1(e,t){if(!Of(t))return!1;const n=Et(e);if(!n)return!1;const r=nr(e,n.startContainer,n.startOffset),o=nr(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=i1(e,n);let d=!1;if(u.length===0)d=c1(e,n,t);else for(const g of u)xe(g)!==t&&(jl(g,t),d=!0);return El(e,a,s),d}function Vl(e){if(!lt(e))return null;const t=rr(e);if(!t)return null;const n=xe(t);return n==="ul"||n==="ol"?n:null}function Uf(e){const t=Kt(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Vl),r=n[0];return n.every(o=>o===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function m1(e,t,n){const r=[...e.children].filter(o=>Dl(o));for(const o of r)t.insertBefore(o,n)}function Wf(e){const t=rr(e),n=document.createElement("p");for(const g of[...e.attributes])n.setAttribute(g.name,g.value);for(n.style.marginLeft="",We(n);e.firstChild&&!Dl(e.firstChild);)n.appendChild(e.firstChild);const r=[];let o=e.nextElementSibling;for(;o;)r.push(o),o=o.nextElementSibling;const a=(t==null?void 0:t.parentNode)??e.parentNode;if(!t||!a)return e.replaceWith(n),n;const s=lt(a)?a.parentNode??a:a,u=lt(a)?a.nextSibling:t.nextSibling;e.remove();let d=null;if(r.length>0){d=document.createElement(t.tagName);for(const g of r)d.appendChild(g)}return s.insertBefore(n,u),d&&s.insertBefore(d,n.nextSibling),m1(e,s,n.nextSibling),t.childElementCount===0&&t.remove(),n}function f1(e){if(lt(e))return e;const t=jl(e,"li");return t.style.marginLeft="",We(t),t}function Vf(e,t){if(e.length===0)return!1;if(e.every(lt)){const a=rr(e[0]);if(a&&e.every(s=>s.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return xe(a)===t?!1:(jl(a,t),!0)}const n=e[0],r=n.parentNode;if(!r)return!1;const o=document.createElement(t);r.insertBefore(o,n);for(const a of e){const s=lt(a)?rr(a):null;o.appendChild(f1(a)),s&&s!==o&&s.childElementCount===0&&s.remove()}return!0}function Gf(e){let t=!1;for(const n of[...e].reverse())lt(n)&&(Wf(n),t=!0);return t}function g1(e,t){return gn(e,()=>{const n=Nn(e);if(n.length===0)return!1;if(n.every(a=>Vl(a)===t))return Gf(n);let o=!1;for(const a of Bm(n))Vf(a,t)&&(o=!0);return o})}function p1(e,t){return gn(e,()=>{const n=Nn(e);if(n.length===0)return!1;if(t===null)return Gf(n);if(n.every(a=>Vl(a)===t))return!1;let o=!1;for(const a of Bm(n))Vf(a,t)&&(o=!0);return o})}const qf=40;function Gl(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Zf(e,t){if(t<=0){e.style.marginLeft="",We(e);return}e.style.marginLeft=`${t}px`}function h1(e){let t=e.previousElementSibling;for(;t;){if(lt(t))return t;t=t.previousElementSibling}return null}function b1(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(xe(n)==="ul"||xe(n)==="ol"))return n}return null}function y1(e){const t=h1(e);if(!t)return!1;const n=rr(e);if(!n)return!1;const r=xe(n)==="ol"?"ol":"ul";let o=b1(t);return(!o||xe(o)!==r)&&(o=document.createElement(r),t.appendChild(o)),o.appendChild(e),!0}function x1(e){const t=rr(e);if(!t)return!1;const n=t.parentElement;if(n&&lt(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return Wf(e),!0}function w1(e){return Kt(e).some(n=>lt(n)||Gl(n)>0)}function C1(e){return gn(e,()=>{const t=Nn(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(lt(r)){y1(r)&&(n=!0);continue}Zf(r,Gl(r)+qf),n=!0}return n})}function v1(e){return gn(e,()=>{const t=Kt(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(lt(r)){x1(r)&&(n=!0);continue}const o=Gl(r);o<=0||(Zf(r,Math.max(0,o-qf)),n=!0)}return n})}function Ji(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function jn(e,t,n){const r=Math.max(1,Math.floor(t)),o=Math.max(1,Math.floor(n));r<=1?e.removeAttribute("colspan"):e.colSpan=r,o<=1?e.removeAttribute("rowspan"):e.rowSpan=o}function nt(e){const t=e.rows.length,n=Array.from({length:t},()=>[]),r=[];let o=0;for(let a=0;a<t;a+=1){const s=e.rows[a];let u=0;for(const d of Array.from(s.cells)){for(;n[a][u];)u+=1;const g=Ji(d),p={cell:d,originRow:a,originCol:u,rowSpan:g.rowSpan,colSpan:g.colSpan};r.push(p);for(let h=0;h<g.rowSpan;h+=1){const x=a+h;if(x>=t)break;for(let b=0;b<g.colSpan;b+=1)n[x][u+b]=p}u+=g.colSpan,o=Math.max(o,u)}o=Math.max(o,n[a].length)}return{table:e,slots:n,unique:r,rowCount:t,colCount:o}}function Ii(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function bt(e,t){return e.unique.find(n=>n.cell===t)??null}function Yf(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 Xf(e){if(e.length===0)return null;let t=1/0,n=-1/0,r=1/0,o=-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),o=Math.max(o,a.originCol+a.colSpan-1);return{minRow:t,maxRow:n,minCol:r,maxCol:o}}function k1(e,t){const n=new Set,r=[];for(let o=t.minRow;o<=t.maxRow;o+=1)for(let a=t.minCol;a<=t.maxCol;a+=1){const s=Ii(e,o,a);!s||n.has(s.cell)||(n.add(s.cell),r.push(s.cell))}return r}function Jf(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=Ii(e,t.minRow,t.minCol);if(!n||n.originRow!==t.minRow||n.originCol!==t.minCol)return null;const r=new Set,o=[];for(let a=t.minRow;a<=t.maxRow;a+=1)for(let s=t.minCol;s<=t.maxCol;s+=1){const u=Ii(e,a,s);if(!u||Yf(u,t))return null;r.has(u.cell)||(r.add(u.cell),o.push(u.cell))}return{origin:n,cells:o,colSpan:t.maxCol-t.minCol+1,rowSpan:t.maxRow-t.minRow+1}}function S1(e,t,n,r){const o={minRow:t.originRow,maxRow:t.originRow+r-1,minCol:t.originCol,maxCol:t.originCol+n-1};if(o.maxRow>=e.rowCount||o.maxCol>=e.colCount)return!1;for(let a=o.minRow;a<=o.maxRow;a+=1)for(let s=o.minCol;s<=o.maxCol;s+=1){const u=Ii(e,a,s);if(!u)return!1;if(u.cell!==t.cell&&Yf(u,o))return!1}return!0}const md=10,Xn=1,Jn=50,P1="1px solid #000",A1="0.25em",D1=new Set(["td","th"]);function Qf(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=Xn&&t>=Xn&&e<=Jn&&t<=Jn}function Ge(e,t){return Zl(e,t,n=>n instanceof HTMLTableElement)}function Mi(e,t){return Zl(e,t,n=>B1(n))}function R1(e,t){return Zl(e,t,n=>n instanceof HTMLTableRowElement)}function ql(e){return Ge(e,Yl(e))}function jt(e){return Mi(e,Yl(e))}function eg(e){return R1(e,Yl(e))}function E1(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function ro(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!de(e,n.commonAncestorContainer))return[];const r=Mi(e,n.startContainer),o=Mi(e,n.endContainer);if(!r)return[];if(!o||r===o)return[r];const a=Ge(e,r);if(!a||Ge(e,o)!==a)return[r];const s=nt(a),u=bt(s,r),d=bt(s,o);if(!u||!d)return[r];const g=Xf([u,d]);if(!g)return[r];const p=k1(s,g);return p.length>0?p:[r]}function j1(e,t){if(!Qf(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!de(e,r.commonAncestorContainer))return!1;const o=document.createElement("table");o.style.borderCollapse="collapse",o.style.width="100%";const a=document.createElement("tbody");for(let u=0;u<t.rows;u+=1){const d=document.createElement("tr");for(let g=0;g<t.cols;g+=1)d.appendChild(H1("td"));a.appendChild(d)}o.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(o),K1(e,o);const s=o.querySelector("td, th");return s instanceof HTMLTableCellElement&&Ve(s),!0}function Js(e,t){var h,x,b,w;const n=jt(e);if(!n)return!1;const r=Ge(e,n);if(!r)return!1;const o=nt(r),a=bt(o,n);if(!a)return!1;const s=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const y of o.unique)if(y.originRow<s&&y.originRow+y.rowSpan>s){jn(y.cell,y.colSpan,y.rowSpan+1);for(let v=y.originCol;v<y.originCol+y.colSpan;v+=1)u.add(v)}const d=document.createElement("tr"),g=Math.min(s,o.rowCount-1);for(let y=0;y<o.colCount;y+=1){if(u.has(y))continue;const v=((x=(h=o.slots[g])==null?void 0:h[y])==null?void 0:x.cell)??n;d.appendChild(Xl(v))}if(s>=r.rows.length)(b=r.rows[r.rows.length-1].parentNode)==null||b.appendChild(d);else{const y=r.rows[s];(w=y.parentNode)==null||w.insertBefore(d,y)}const p=O1(d,o.colCount,u,a.originCol);return Ve(p||n),!0}function fd(e,t){var g,p,h,x;const n=jt(e);if(!n)return!1;const r=Ge(e,n);if(!r)return!1;const o=nt(r),a=bt(o,n);if(!a)return!1;const s=t==="before"?a.originCol:a.originCol+a.colSpan,u=new Set;for(const b of o.unique)if(b.originCol<s&&b.originCol+b.colSpan>s){jn(b.cell,b.colSpan+1,b.rowSpan);for(let w=b.originRow;w<b.originRow+b.rowSpan;w+=1)u.add(w)}let d=null;for(let b=0;b<o.rowCount;b+=1){if(u.has(b))continue;const w=((p=(g=o.slots[b])==null?void 0:g[Math.min(s,Math.max(0,o.colCount-1))])==null?void 0:p.cell)??((x=(h=o.slots[b])==null?void 0:h[Math.max(0,s-1)])==null?void 0:x.cell)??n,y=Xl(w);Jl(r,b,s,y),b===a.originRow&&(d=y)}return d&&Ve(d),!0}function T1(e){var x,b;const t=jt(e);if(!t)return!1;const n=Ge(e,t);if(!n)return!1;const r=nt(n),o=bt(r,t);if(!o)return!1;if(r.rowCount<=1)return Qs(e,n);const a=o.originRow,s=a+1,u=[];for(const w of r.unique)w.originRow<=a&&w.originRow+w.rowSpan>a&&(w.originRow<a?jn(w.cell,w.colSpan,w.rowSpan-1):w.originRow===a&&w.rowSpan>1&&u.push(w));u.sort((w,y)=>w.originCol-y.originCol);for(const w of u)jn(w.cell,w.colSpan,w.rowSpan-1),Jl(n,s,w.originCol,w.cell);const d=o.originCol;n.rows[a].remove();const g=n.rows[Math.min(a,n.rows.length-1)],p=nt(n),h=(b=(x=p.slots[Math.min(a,p.rowCount-1)])==null?void 0:x[Math.min(d,Math.max(0,p.colCount-1))])==null?void 0:b.cell;return h?Ve(h):g!=null&&g.cells[0]?Ve(g.cells[0]):W1(n),!0}function N1(e){var g,p,h;const t=jt(e);if(!t)return!1;const n=Ge(e,t);if(!n)return!1;const r=nt(n),o=bt(r,t);if(!o)return!1;if(r.colCount<=1)return Qs(e,n);const a=o.originCol,s=o.originRow;for(const x of r.unique)a<x.originCol||a>=x.originCol+x.colSpan||(x.colSpan===1?x.cell.remove():jn(x.cell,x.colSpan-1,x.rowSpan));const u=nt(n);if(u.colCount===0||u.unique.length===0)return Qs(e,n);const d=((p=(g=u.slots[Math.min(s,u.rowCount-1)])==null?void 0:g[Math.min(a,u.colCount-1)])==null?void 0:p.cell)??((h=u.unique[0])==null?void 0:h.cell);return d&&Ve(d),!0}function I1(e,t){const n=jt(e);if(!n)return!1;const r=Ge(e,n);if(!r)return!1;const o=E1(r),a=o.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Ve(o[a-1]),{changed:!1});if(a<o.length-1)return Ve(o[a+1]),{changed:!1};const s=n.parentElement;if(!Js(e,"below"))return!1;const u=s instanceof HTMLTableRowElement?s.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Ve(u.cells[0]),{changed:!0}}function M1(e,t){return!de(e,t)||t===e?!1:(Ve(t),!0)}function gd(e){return tg(e)!==null}function pd(e){const t=jt(e);if(!t)return!1;const n=Ji(t);return n.colSpan>1||n.rowSpan>1}function _1(e){const t=tg(e);if(!t)return!1;const n=Ge(e,t.origin.cell);return n?ng(n,t):!1}function L1(e){const t=jt(e);if(!t)return!1;const n=Ge(e,t);return n?rg(n,t):!1}function F1(e,t,n){const r=jt(e);if(!r)return!1;const o=Ge(e,r);if(!o)return!1;const a=nt(o),s=bt(a,r);if(!s)return!1;const u=Math.min(a.colCount-s.originCol,Math.max(1,Math.floor(t))),d=Math.min(a.rowCount-s.originRow,Math.max(1,Math.floor(n)));if(u===s.colSpan&&d===s.rowSpan||!S1(a,s,u,d))return!1;if((s.colSpan>1||s.rowSpan>1)&&rg(o,r),u===1&&d===1)return Ve(r),!0;const g=nt(o),p=Jf(g,{minRow:s.originRow,maxRow:s.originRow+d-1,minCol:s.originCol,maxCol:s.originCol+u-1});return p?ng(o,p):!0}function Zl(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function B1(e){return D1.has(e.tagName.toLowerCase())}function Yl(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return de(e,n.commonAncestorContainer)?n.startContainer:null}function tg(e){const t=ro(e);if(t.length<2)return null;const n=Ge(e,t[0]);if(!n)return null;const r=nt(n),o=[];for(const u of t){const d=bt(r,u);if(!d)return null;o.push(d)}const a=Xf(o);if(!a)return null;const s=Jf(r,a);return!s||s.cells.length<2?null:s}function ng(e,t){const n=t.origin.cell,r=nt(e),o=t.cells.map(a=>bt(r,a)).filter(a=>a!==null).sort((a,s)=>a.originRow-s.originRow||a.originCol-s.originCol);for(const a of o)a.cell!==n&&$1(n,a.cell);jn(n,t.colSpan,t.rowSpan);for(const a of o)a.cell!==n&&a.cell.remove();return Ve(n),!0}function rg(e,t){const n=nt(e),r=bt(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;jn(t,1,1);for(let o=r.originRow;o<r.originRow+r.rowSpan;o+=1)for(let a=r.originCol;a<r.originCol+r.colSpan;a+=1)o===r.originRow&&a===r.originCol||Jl(e,o,a,Xl(t));return Ve(t),!0}function H1(e){const t=document.createElement(e);return t.style.border=P1,t.style.padding=A1,t.appendChild(document.createElement("br")),t}function Xl(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 z1(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Jl(e,t,n,r){const o=e.rows[t];if(!o)return;const a=nt(e);let s=0;for(const u of Array.from(o.cells)){if(u===r)continue;const d=bt(a,u);if(!d||d.originCol>=n)break;s+=1}z1(o,s,r)}function O1(e,t,n,r){let o=0;for(let a=0;a<t;a+=1)if(!n.has(a)){if(a>=r)return e.cells[o]??null;o+=1}return e.cells[e.cells.length-1]??null}function hd(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 $1(e,t){if(!(e===t||hd(t)))for(hd(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function K1(e,t){var o;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))&&((o=n.parentNode)==null||o.insertBefore(t,n.nextSibling),U1(n)&&n.remove())}function U1(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 Qs(e,t){if(!t.parentNode||!de(e,t))return!1;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),t.remove();const o=window.getSelection();return o&&(o.removeAllRanges(),o.addRange(r)),!0}function Ve(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function W1(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const og=["left","center","right","justify"];function V1(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function _i(e){return V1(e.style.textAlign)}function el(e,t){const n=t??"left";return _i(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 bd(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function ig(e){const t=ro(e);if(t.length>0)return bd(t.map(_i));const n=Kt(e);return n.length===0?Et(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:bd(n.map(_i))}function ag(e,t){return og.includes(t)?gn(e,()=>{const n=ro(e);if(n.length>0){let a=!1;for(const s of n)el(s,t)&&(a=!0);return a}const r=Nn(e);if(r.length===0)return!1;let o=!1;for(const a of r)el(a,t)&&(o=!0);return o}):!1}function Qn(){return{...Il(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function Ss(e){const t=cy(e),n=ig(e),r=Uf(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function sg(e,t){let n=!1;return!t.alignMixed&&t.align&&ag(e,t.align)&&(n=!0),t.listMixed||p1(e,t.list)&&(n=!0),uy(e,t)&&(n=!0),n}function G1(e,t){return sg(e,tl(t))}function lg(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 tl(e){const t=Qn();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 cg=["%","px","pt","pc","em","rem"],q1="%",Z1={"%":[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]},lr={"%":{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}},Y1=new Set(cg),X1=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function J1(e){return Y1.has(e)}function Dn(e){return`${ie(e.value)}${e.unit}`}function Li(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(X1);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r)||r<=0)return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return J1(o)?cr(r,o):null}function yd(e,t){const n=e.trim();if(!n)return null;const r=Li(n);if(r)return r;const o=Number(n.replace(",","."));return Number.isFinite(o)?cr(o,t):null}function cr(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=lr[t];return{value:Me(Math.min(r,Math.max(n,e))),unit:t}}function Kr(e,t,n){const r=n>0?n:1;if(e==="width"){const a=cr(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:cr(t.value*r,t.unit)??t,height:t}}const Q1=.85,ew=new Set(["image/webp","image/avif","image/gif"]);let _r=null;function tw(){if(_r!==null)return _r;_r=!1;try{_r=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp")}catch{}return _r}function nw(e){const t=e.type.trim().toLowerCase();if(t&&ew.has(t))return!1;const n=iw(e.name);return!(!t&&(n==="webp"||n==="avif"||n==="gif"))}function rw(e,t=Q1){return typeof createImageBitmap!="function"?Promise.resolve(null):createImageBitmap(e).then(n=>ow(n,t)).catch(()=>null)}function ow(e,t){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(!r)return e.close(),Promise.resolve(null);try{r.drawImage(e,0,0)}finally{e.close()}return new Promise(o=>{n.toBlob(a=>{if(!a){o(null);return}const s=new FileReader;s.onload=()=>{const u=String(s.result??"");o(u.startsWith("data:image/webp")?u:null)},s.onerror=()=>o(null),s.readAsDataURL(a)},"image/webp",t)})}function iw(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const ug=2*1024*1024,aw="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",sw=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),lw=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),cw=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,uw=/^(javascript|vbscript|file|blob):/i;function dw(e={}){return{src:"",alt:"",title:"",...e}}function hn(e){const t=e.trim();if(!t)return"empty";if(uw.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return cw.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 mw(e){return e.size>ug?"tooLarge":ww(e)?null:"type"}function fw(e){const t=mw(e);return t?Promise.reject(new Error(t)):gw(e)}async function gw(e){if(nw(e)&&tw()){const t=await rw(e);if(t&&hn(t)===null&&hw(t)<=ug)return t}return pw(e)}function pw(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=String(r.result??"");if(hn(o)){n(new Error("invalid"));return}t(o)},r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsDataURL(e)})}function hw(e){const t=e.indexOf(",");if(t<0)return e.length;const n=e.slice(t+1),r=n.endsWith("==")?2:n.endsWith("=")?1:0;return Math.floor(n.length*3/4)-r}function bw(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",yw(e,t.css)}function yw(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function xw(e,t){const n=dw(t);if(hn(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!de(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=document.createElement("img");return bw(a,n),o.insertNode(a),o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}function nl(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Ps(e,t){if(!de(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 ww(e){const t=e.type.trim().toLowerCase();if(t&&sw.has(t))return!0;const n=Cw(e.name);return!!(!t&&n&&lw.has(n))}function Cw(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const hi="data-hover-css",Ql=["fill","contain","cover","none","scale-down"],ec=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],vw=new Set(Ql),kw=new Set(ec),xd="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",Sw="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",Pw=/^-?[a-z][a-z0-9-]*$/i,Aw=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,rl=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function dg(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...ht},border:{...Nl},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function Dw(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function Rw(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=Kr("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=Kr("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function Ew(e){const t=[];for(const n of e.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim().toLowerCase(),s=r.slice(o+1).trim();!a||!s||Pw.test(a)&&(a==="behavior"||a.endsWith("binding")||Aw.test(s)||t.push(`${a}: ${s}`))}return t.join("; ")}function rn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!de(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&&de(e,r))return r}return nl(e,n.commonAncestorContainer)}function jw(e){const t=rn(e);return t?mg(t):null}function mg(e){const t=ur(e),n=_w(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,o=Nw(e);return dg({sizeMode:o.sizeMode,width:o.width,height:o.height,align:n,margin:r,border:t.border,borderRadius:t.borderRadius,boxShadow:t.boxShadow,opacity:t.opacity,objectFit:gg(e),objectPosition:Hw(e),rotateDeg:pg(e),hoverCss:e.getAttribute(hi)??""})}function fg(e,t){let n=!1;return Iw(e,t)&&(n=!0),dr(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:ht,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),Lw(e,t.align)&&(n=!0),Fw(e,t.objectFit)&&(n=!0),Bw(e,t.objectPosition)&&(n=!0),Ow(e,t.rotateDeg)&&(n=!0),$w(e,t.hoverCss)&&(n=!0),n}function Tw(e,t){const n=rn(e);return n?fg(n,t):!1}function Nw(e){const t=Li(e.style.width),n=Li(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 Iw(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=Mw(t);return r.width?e.style.width=Dn(r.width):e.style.removeProperty("width"),r.height?e.style.height=Dn(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 Mw(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 _w(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(),o=e.style.marginRight.trim().toLowerCase();return n==="block"&&r==="auto"&&o==="auto"?"center":null}function Lw(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 gg(e){const t=e.style.objectFit.trim().toLowerCase();return vw.has(t)?t:null}function Fw(e,t){return gg(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function Bw(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 Hw(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(kw.has(t),t):null}function pg(e){const t=rl.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?Me(n):null}function zw(e){const t=e.trim();return t?rl.test(t)&&t.replace(rl,"").trim()==="":!0}function Ow(e,t){const n=pg(e),r=t===null||t===0?null:Me(t);return n===r?!1:r===null?zw(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${ie(r)}deg)`,!0)}function $w(e,t){const n=Ew(t),r=e.getAttribute(hi)??"",o=e.getAttribute("onmouseover")??"";return r===n&&(n&&o===xd||!n&&!o)?!1:n?(e.setAttribute(hi,n),e.setAttribute("onmouseover",xd),e.setAttribute("onmouseout",Sw),!0):(e.removeAttribute(hi),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const tr={value:100,unit:"%"},Kw=new Set(Ql),Uw=new Set(ec),Ww=new Set(["cover","contain","scale-down","none"]),wd={contain:"contain",cover:"cover",auto:"none"},Cd={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function zt(){return{src:null,opacity:null,fit:null,position:null,width:{...tr},height:null}}function hg(e){return e!=null&&Ww.has(e)}function bg(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?sn(n):null}function vd(e,t){const n=bg(e),r=t===null?null:sn(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=Jm(r),!0)}function yg(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 Vw(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function kd(e,t){const n=yg(e),r=(t==null?void 0:t.trim())??"",o=r&&hn(r)===null?r:null;return n===o?!1:(o?e.style.backgroundImage=Vw(o):e.style.removeProperty("background-image"),!0)}function tc(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function As(e){return!e||e==="auto"?null:Li(e)}function Gw(e){return hg(e.fit)&&e.fit?Cd[e.fit]:e.fit==="fill"?Cd.fill:e.width&&e.height?`${Dn(e.width)} ${Dn(e.height)}`:e.width?Dn(e.width):e.height?`auto ${Dn(e.height)}`:null}function qw(e){const t=tc(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...tr},height:{...tr}};if(wd[t])return{fit:wd[t],width:null,height:null};if(Kw.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:As(n[0]),height:null}:n.length===2?{fit:null,width:As(n[0]),height:As(n[1])}:{fit:null,width:null,height:null}}function Zw(e,t){const n=tc(e.style.backgroundSize),r=Gw(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function Yw(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Uw.has(t),t):null}function Sd(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 ol(e){let t=!1;return e.id!==Ri&&(e.id=Ri,t=!0),e.hasAttribute(Di)||(e.setAttribute(Di,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function xg(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 Xw(e){const t=zl(e),n=t[0]??null;if(n){let o=ol(n);for(const a of t.slice(1))a.remove(),o=!0;return(n.parentNode!==e||n!==e.firstChild)&&(e.insertBefore(n,e.firstChild),o=!0),{layer:n,changed:o}}const r=document.createElement("div");return ol(r),xg(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function Jw(e){const t=zl(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function Pd(e){let t=!1;return Ol(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 wg(e){const t=qw(e);return{src:yg(e),opacity:bg(e),fit:t.fit,position:Yw(e),width:t.width,height:t.height}}function Cg(e,t){var a;const n=((a=t.src)==null?void 0:a.trim())??"",r=n.length>0&&hn(n)===null;let o=!1;return r?(kd(e,n)&&(o=!0),Zw(e,t)&&(o=!0),Sd(e,t.position)&&(o=!0),vd(e,t.opacity)&&(o=!0),e.style.backgroundRepeat!=="no-repeat"&&(e.style.backgroundRepeat="no-repeat",o=!0),o&&We(e),o):(kd(e,null)&&(o=!0),tc(e.style.backgroundSize)&&(e.style.removeProperty("background-size"),o=!0),Sd(e,null)&&(o=!0),vd(e,null)&&(o=!0),e.style.backgroundRepeat&&(e.style.removeProperty("background-repeat"),o=!0),o&&We(e),o)}function Qw(e){const t=Ol(e);return t?wg(t):zt()}function eC(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&hn(n)===null)){const d=Jw(e),g=Pd(e);return(d||g)&&We(e),d||g}const o=Xw(e),a=o.layer;let s=o.changed;return ol(a)&&(s=!0),xg(a)&&(s=!0),Pd(e)&&(s=!0),Cg(a,t)&&(s=!0),s&&(We(a),We(e)),s}function ri(e){return e?Dn(e):""}function tC(e,t){return e.src===t.src&&e.opacity===t.opacity&&e.fit===t.fit&&e.position===t.position&&ri(e.width)===ri(t.width)&&ri(e.height)===ri(t.height)}function Ad(e){const t=Kt(e);if(t.length===0)return zt();const n=t.map(wg),r=n[0];return n.some(o=>!tC(o,r))?zt():r}function nC(e,t){return gn(e,()=>{const n=Nn(e);if(n.length===0)return!1;let r=!1;for(const o of n)Cg(o,t)&&(r=!0);return r})}function rC(){return{size:null,unit:Rn,marks:Ht(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function bi(){return{font:rC(),box:Il(),backgroundImage:zt(),atRule:nn()}}function il(e,t){return t?{top:t.top!==void 0?t.top:e.top,right:t.right!==void 0?t.right:e.right,bottom:t.bottom!==void 0?t.bottom:e.bottom,left:t.left!==void 0?t.left:e.left}:e}function oC(e,t){if(!t)return e;const{margin:n,padding:r,...o}=t;return{...e,...o,margin:n?il(e.margin,n):e.margin,padding:r?il(e.padding,r):e.padding}}function iC(e,t){if(!t)return e;const{marks:n,...r}=t;return{...e,...r,marks:n?{...e.marks,...n}:e.marks}}function aC(e,t){const{margin:n,...r}=t.atRule??{};return{font:iC(e.font,t.font),box:oC(e.box,t.box),backgroundImage:t.backgroundImage?{...e.backgroundImage,...t.backgroundImage}:e.backgroundImage,atRule:t.atRule?{...e.atRule,...r,margin:n?il(e.atRule.margin,n):e.atRule.margin}:e.atRule}}function sC(e){return e?!!(e.font||e.box||e.backgroundImage||e.atRule):!1}function Dd(e,t){if(!sC(t))return e;const n=document.createElement("div");n.innerHTML=e;const r=aC(yi(n),t);return al(n,r).pageHtml}function lC(e){const t=e.style.fontSize,n=t?vl(t):null,r=n&&Wi(n.unit)?{value:n.value,unit:n.unit}:null,o=`${e.style.textDecorationLine} ${e.style.textDecoration}`.toLowerCase(),a=e.style.fontWeight.trim().toLowerCase(),s={bold:a==="bold"||Number(a)>=700,italic:e.style.fontStyle.trim().toLowerCase()==="italic",underline:/\bunderline\b/.test(o),strikethrough:/\bline-through\b/.test(o)},u=e.style.color,d=e.style.fontFamily.trim();return{size:(r==null?void 0:r.value)??null,unit:(r==null?void 0:r.unit)??Rn,marks:s,fontFamily:d||null,fontFamilyMixed:!1,fontColor:u?Pe(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function cC(e,t){const n=e.style.fontSize,r=t.size===null?null:En(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const o=Cl(r.value,r.unit);return n===o?!1:(e.style.fontSize=o,!0)}function uC(e,t){var o;if(t.fontFamilyMixed)return!1;const n=(o=t.fontFamily)!=null&&o.trim()?t.fontFamily.trim():null,r=e.style.fontFamily.trim()||null;return no(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function dC(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?Pe(t.fontColor):null;return(e.style.color?Pe(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function mC(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 o=t.italic?"italic":"";e.style.fontStyle!==o&&(o?e.style.fontStyle=o:e.style.removeProperty("font-style"),n=!0);const a=[];t.underline&&a.push("underline"),t.strikethrough&&a.push("line-through");const s=a.join(" ");return(e.style.textDecorationLine||e.style.textDecoration).trim()!==s&&(s?e.style.textDecoration=s:(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),n=!0),n}function fC(e,t){let n=!1;return cC(e,t)&&(n=!0),uC(e,t)&&(n=!0),dC(e,t)&&(n=!0),mC(e,t.marks)&&(n=!0),n&&We(e),n}function gC(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function yi(e){const t=pn(e);if(!t)return bi();const n=ur(t);return{font:lC(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:Qw(t),atRule:Qe(e.innerHTML)}}function al(e,t){const n=Et(e),r=n?nr(e,n.startContainer,n.startOffset):null,o=n?nr(e,n.endContainer,n.endOffset):null,a=pn(e),s=yf(e);$r(s);const u=fC(s,t.font),d=dr(s,gC(t)),g=eC(s,t.backgroundImage);Gi(e);const p=Qe(e.innerHTML),h=Ll(e.innerHTML,t.atRule),x=or(h);x!==or(e.innerHTML)&&(e.innerHTML=x),mr(e,h);const b=JSON.stringify(p)!==JSON.stringify(t.atRule);return r!==null&&o!==null&&El(e,Math.min(r,o),Math.max(r,o)),{changed:!a||u||d||g||b,pageHtml:h}}function pC(e,t){const n=t??e.innerHTML,r=ff(n);return Yr(n)?(e.innerHTML=or(r),Gi(e),mr(e,r),{changed:!0,pageHtml:r}):{changed:!1,pageHtml:r}}const hC=/<script\b[^>]*>[\s\S]*?<\/script>/gi,bC=/^\s*javascript\s*:/i;function yC(e){return e.replace(/&(#x[0-9a-f]+|#\d+|amp|lt|gt|quot);/gi,(t,n)=>{const r=n.toLowerCase();if(r==="amp")return"&";if(r==="lt")return"<";if(r==="gt")return">";if(r==="quot")return'"';if(r.startsWith("#x")){const o=Number.parseInt(r.slice(2),16);return Number.isFinite(o)?String.fromCodePoint(o):t}if(r.startsWith("#")){const o=Number.parseInt(r.slice(1),10);return Number.isFinite(o)?String.fromCodePoint(o):t}return t}).replace(/\\([0-7]{1,3})/g,(t,n)=>{const r=Number.parseInt(n,8);return Number.isFinite(r)?String.fromCodePoint(r):t})}function vg(e){const t=yC(e).replace(/[\u0000-\u001F\u007F\s]+/g,"");return bC.test(t)}function xC(e){return e.split(";").map(t=>t.trim()).filter(t=>{if(!t)return!1;const n=t.indexOf(":");if(n<=0)return!0;const r=t.slice(n+1);return!vg(r)&&!/url\s*\(\s*["']?\s*javascript:/i.test(r)}).join("; ")}function wC(e){const t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const n of t)for(const r of[...n.attributes]){if(vg(r.value)){n.removeAttribute(r.name);continue}if(r.name.toLowerCase()==="style"){const o=xC(r.value);o?o!==r.value&&n.setAttribute(r.name,o):n.removeAttribute(r.name)}}}function CC(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function vC(e){return e.body.innerHTML}function sl(e){if(!e.trim())return e;const n=e.replace(hC,"");if(!/javascript\s*:/i.test(n))return n;const r=CC(n);return wC(r.body),vC(r)}function xi(e){if(!e.trim())return e;const n=Se(e);return n.length===1?sl(e):at(n.map(sl))}const nc="data-hover-html",kC="noopener noreferrer",SC="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)",PC="this._hoverBox&&this._hoverBox.remove()",AC=/^(#(?:[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 Qi(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function DC(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function Qr(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&DC(n))return n;n=n.parentNode}return null}function kg(e){return AC.test(e)}function RC(e){var o;const t=e.getAttribute("onmouseover")??"",n=/this\.style\.color\s*=\s*'([^']+)'/.exec(t),r=((o=n==null?void 0:n[1])==null?void 0:o.trim())??"";return r&&kg(r)?r:null}function Sg(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function EC(e){const t=e.getAttribute(nc)??"",n=RC(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:Sg(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function Pg(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!de(e,n.commonAncestorContainer))return null;const r=Qr(e,n.commonAncestorContainer);return r?EC(r):null}function jC(e){return Pg(e)!==null}function TC(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(nc)}function NC(e,t){var r;if(TC(e),t.hoverMode==="html"){const o=t.hoverHtml.trim();if(!o)return;e.setAttribute(nc,o),e.setAttribute("onmouseover",SC),e.setAttribute("onmouseout",PC);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!kg(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function rc(e,t){const n=Qi(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",kC)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":Sg(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),NC(e,n)}function IC(e,t){const n=new Set;for(const r of t){const o=Qr(e,r);o&&!n.has(o)&&n.add(o)}for(const r of n)tt(r)}function MC(e,t,n){Dt(t);const r=qe(t).filter(u=>u.data.length>0);IC(e,r),r.length>0&&Tn(r);const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);Dt(a);const s=document.createElement("a");rc(s,n);try{return a.surroundContents(s),!0}catch{const u=a.extractContents();return u.hasChildNodes()?(s.appendChild(u),a.insertNode(s),!0):!1}}function _C(e,t){const n=document.createElement("a");rc(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 LC(e,t){const n=t.href.trim();if(!n)return!1;const r=Qi({...t,href:n}),o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!de(e,a.commonAncestorContainer))return!1;const s=Qr(e,a.startContainer),u=Qr(e,a.endContainer);return s&&s===u?(rc(s,r),!0):a.collapsed?_C(a,r):MC(e,a,r)}const FC=/^[A-Za-z][A-Za-z0-9_-]*$/,Ag="​";function ll(e){var r;const t=$l(e),n=new Set;for(const o of t.querySelectorAll("[id]")){if(o===t)continue;const a=o.id.trim();a&&n.add(a)}for(const o of t.querySelectorAll("a[name]")){const a=(r=o.getAttribute("name"))==null?void 0:r.trim();a&&n.add(a)}return[...n].sort((o,a)=>o.localeCompare(a)).map(o=>({id:o}))}function BC(e){return new Set(ll(e).map(t=>t.id))}function Dg(e,t){const n=e.trim();return n?FC.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function Rd(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Ag)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function HC(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(Ag)),(r=e.parentNode)==null||r.insertBefore(n,e)}function zC(e,t){const n=t.trim();if(Dg(n,BC(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!de(e,o.commonAncestorContainer))return!1;const a=Qr(e,o.startContainer);if(a)return HC(a,n),!0;if(o.collapsed)return Rd(o,n),!0;Dt(o);const s=document.createElement("span");s.id=n;try{return o.surroundContents(s),!0}catch{return Rd(o,n),!0}}const Le="data-comment-thread",Ed="wysiwyg-comment-anchor";function OC(){return`cmt_${crypto.randomUUID()}`}function $C(){return crypto.randomUUID()}const Fi=20;function jd(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${Le}]`);return r instanceof HTMLElement&&de(t,r)?r:null}function Td(e,t,n){var x;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=Math.max(0,t),a=Math.max(t,n),s=null,u=0,d=null,g=0,p;for(;p=r.nextNode();){const b=p,w=((x=b.textContent)==null?void 0:x.length)??0;if(!s&&o<=w&&(s=b,u=o),!d&&a<=w){d=b,g=a;break}o-=w,a-=w}if(!s||!d)return null;const h=document.createRange();return h.setStart(s,u),h.setEnd(d,g),h}function KC(e,t,n){const r=e.textContent??"",o=r.slice(Math.max(0,t-Fi),t),a=r.slice(n,n+Fi);return{prefix:o,suffix:a}}function UC(e,t){if(t.mode!=="visual")return null;const n=rn(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:o}=KC(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:o}}function Nd(e,t){if(t.mode!=="visual")return null;const n=rn(e);if(n!=null&&n.hasAttribute(Le))return n.getAttribute(Le)??null;if(t.visualRange){const r=jd(t.visualRange.startContainer,e);if(r)return r.getAttribute(Le)??null;const o=jd(t.visualRange.endContainer,e);if(o)return o.getAttribute(Le)??null}return null}function cl(e,t,n){if(!de(e,n.commonAncestorContainer))return!1;Dt(n);const r=document.createElement("span");r.setAttribute(Le,t);try{return n.surroundContents(r),!0}catch{const o=n.toString();if(!o)return!1;const a=document.createElement("span");return a.setAttribute(Le,t),a.textContent=o,n.deleteContents(),n.insertNode(a),!0}}function Rg(e,t){e.setAttribute(Le,t)}function WC(e,t,n){const r=rn(e);return r?(Rg(r,t),!0):n.visualRange?cl(e,t,n.visualRange):!1}function VC(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 GC(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const s=Td(e,n.start,n.end);if(s&&s.toString()===n.text)return cl(e,t,s)}const r=e.textContent??"",o=n.text;if(!o)return!1;let a=0;for(;a<=r.length;){const s=r.indexOf(o,a);if(s===-1)return!1;const u=s+o.length,d=r.slice(Math.max(0,s-Fi),s),g=r.slice(u,u+Fi);if(n.prefix!==void 0&&d!==n.prefix){a=s+1;continue}if(n.suffix!==void 0&&g!==n.suffix){a=s+1;continue}const p=Td(e,s,u);return p?cl(e,t,p):!1}return!1}function qC(e,t){for(const n of t)if(!e.querySelector(`[${Le}="${n.id}"]`)){if(n.anchor.type==="image"){const o=VC(e,n.anchor);o&&Rg(o,n.id);continue}GC(e,n.id,n.anchor)}}function Id(e,t){for(const n of e.querySelectorAll(`[${Le}]`))n instanceof HTMLElement&&(t?n.classList.add(Ed):n.classList.remove(Ed))}function Md(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${Le}]`);return r instanceof HTMLElement&&de(e,r)?r:null}function _d(e,t){const n=e.querySelector(`[${Le}="${t}"]`);if(!(n instanceof HTMLElement))return!1;const r=window.getSelection();if(!r)return!1;const o=document.createRange();if(n instanceof HTMLImageElement)o.selectNode(n);else{const s=document.createTreeWalker(n,NodeFilter.SHOW_TEXT).nextNode();s instanceof Text?(o.setStart(s,0),o.collapse(!0)):(o.selectNodeContents(n),o.collapse(!0))}return r.removeAllRanges(),r.addRange(o),!0}function ZC(e,t=[]){return{id:OC(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function YC(e,t){return{id:$C(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function XC(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function JC(e,t){return e.find(n=>n.id===t)}function Eg(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return de(e,n.commonAncestorContainer)?n:null}function QC(e){const t=Eg(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 o=t.toString();if(!o){const a=n.querySelector("img");o=(a==null?void 0:a.getAttribute("alt"))??(a==null?void 0:a.getAttribute("src"))??""}return{html:r,text:o}}function jg(e){const t=Eg(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 e0(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 Tg(e){const t=QC(e);return t?e0(t):!1}async function t0(e){return await Tg(e)?jg(e):!1}const n0=new Set(["strong","b","em","i","u","s","strike","del"]),r0=["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 o0(e){for(const t of r0)e.style.removeProperty(t)}function i0(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!Rt(r)){n=r;continue}if(fn(r,n),n0.has(r.tagName.toLowerCase())){tt(r);continue}if(o0(r),mn(r)){tt(r);continue}n=r.isConnected?r:t}}function a0(e){const t=Et(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;Dt(t);const r=qe(t).filter(o=>o.data.length>0);if(r.length===0)return!1;for(const o of r)i0(e,o);return Tn(r),e.innerHTML!==n}function s0(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function l0(e){const t=Yn(e),n=Tf(e),r=Pf(e),o=ki(e,"color"),a=ki(e,"backgroundColor"),s=If(e);return{size:n.mixed?null:n.value,unit:n.unit,marks:t,fontFamily:r.mixed?null:r.value,fontFamilyMixed:r.mixed,fontColor:o.mixed?null:o.value,fontColorMixed:o.mixed,highlightColor:a.mixed?null:a.value,highlightColorMixed:a.mixed,customCss:s.mixed?null:s.value,customCssMixed:s.mixed}}function c0(e,t){t.size!==null&&Vs(e,t.size,t.unit);const n=Yn(e);for(const r of ct)t.marks[r]!==n[r]&&Zs(e,r);return t.fontFamilyMixed||Ks(e,t.fontFamily),t.fontColorMixed||Or(e,"color",t.fontColor),t.highlightColorMixed||Or(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&_f(e,t.customCss),!0}function wi(){return typeof window<"u"&&"speechSynthesis"in window}function u0(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function Ld(e,t){const n=e.text.trim();return n||u0(t)||null}function d0(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!wi())return;if(t.speaking){t.cancel(),n();return}const o=new SpeechSynthesisUtterance(r);o.onend=n,o.onerror=n,t.speak(o),n()},isSpeaking(){return wi()&&t.speaking},cancel(){wi()&&t.speaking&&(t.cancel(),n())}}}const m0=5*1024*1024,f0="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",g0=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),p0=new Set(["mp3","wav","ogg","aac","webm","m4a"]),h0=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,b0=/^(javascript|vbscript|file|blob):/i;function y0(e={}){return{src:"",title:"",...e}}function oc(e){const t=e.trim();if(!t)return"empty";if(b0.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return h0.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 x0(e){return e.size>m0?"tooLarge":S0(e)?null:"type"}function w0(e){const t=x0(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");if(oc(a)){r(new Error("invalid"));return}n(a)},o.onerror=()=>r(o.error??new Error("Failed to read file")),o.readAsDataURL(e)})}function C0(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%",v0(e,t.css)}function v0(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function k0(e,t){const n=y0(t);if(oc(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!de(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=document.createElement("audio");return C0(a,n),o.insertNode(a),o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}function S0(e){const t=e.type.trim().toLowerCase();if(t&&g0.has(t))return!0;const n=P0(e.name);return!!(!t&&n&&p0.has(n))}function P0(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const Ng=/^(javascript|vbscript|file|blob):/i,A0=[/(?: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 D0(e={}){return{url:"",title:"",...e}}function R0(e={}){return{src:"",title:"",...e}}function ea(e){const t=e.trim();if(!t)return null;for(const n of A0){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function Ig(e){return`https://www.youtube.com/embed/${e}`}function Mg(e){const t=e.trim();return t?Ng.test(t)?"invalid":ea(t)?null:"invalid":"empty"}function E0(e){const t=e.trim();if(!t)return"empty";if(Ng.test(t))return"invalid";if(ea(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 _g(e,t){if(t)for(const n of t.split(";")){const r=n.trim();if(!r)continue;const o=r.indexOf(":");if(o<=0)continue;const a=r.slice(0,o).trim(),s=r.slice(o+1).trim();a&&s&&e.style.setProperty(a,s)}}function Lg(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",_g(e,n.css)}function j0(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%",_g(e,t.css)}function T0(e,t){const n=D0(t);if(Mg(n.url))return!1;const r=ea(n.url);if(!r)return!1;const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!de(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const s=document.createElement("iframe");return Lg(s,Ig(r),n),a.insertNode(s),a.setStartAfter(s),a.collapse(!0),o.removeAllRanges(),o.addRange(a),!0}function N0(e,t){const n=R0(t);if(E0(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!de(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=ea(n.src);if(a){const s=document.createElement("iframe");Lg(s,Ig(a),{title:n.title,css:n.css}),o.insertNode(s),o.setStartAfter(s)}else{const s=document.createElement("video");j0(s,n),o.insertNode(s),o.setStartAfter(s)}return o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}const I0=new Set(["p","h1","h2","h3","h4","h5","h6"]),M0=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function Fg(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!de(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const o=_0(e,r.startContainer);if(o){const s=L0(o,r);return(a=o.parentNode)==null||a.insertBefore(t,s),Bd(t),!0}return r.insertNode(t),F0(e,t),z0(t),Bd(t),!0}function _0(e,t){let n=to(t);for(;n&&n!==e;){const r=xe(n);if(I0.has(r)&&n instanceof HTMLElement)return n;if(M0.has(r))return null;n=n.parentElement}return null}function L0(e,t){var a;const n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(e,e.childNodes.length);const r=n.extractContents(),o=e.cloneNode(!1);return o.appendChild(r),Fd(e),Fd(o),(a=e.parentNode)==null||a.insertBefore(o,e.nextSibling),o}function F0(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!B0(n))return;fn(n,t),tt(n)}}function B0(e){const t=xe(e);return Rt(e)||t==="a"}function Fd(e){H0(e)&&e.appendChild(document.createElement("br"))}function H0(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 z0(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 Bd(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 O0="1em 0",$0="1px solid #d0d0d0";function K0(){const e=document.createElement("hr");return e.style.margin=O0,e.style.border="0",e.style.borderTop=$0,e}function U0(e){return Fg(e,K0())}const W0="1.5em 0",V0="2px dashed #bbb",G0="data-wysiwyg-page-break";function q0(){const e=document.createElement("div");return e.setAttribute(G0,""),e.style.display="block",e.style.clear="both",e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=W0,e.style.border="0",e.style.borderTop=V0,e.style.height="0",e}function Z0(e){return Fg(e,q0())}const $t=16;function Hd(e){return Math.min(lr.px.max,Math.max($t,e))}function Y0(e){return e.width>0&&e.height>0?e.width/e.height:1}function X0(e,t){const n=Math.max($t,$t*t),r=Math.min(lr.px.max,lr.px.max*t),o=Math.min(r,Math.max(n,e));return{width:o,height:o/t}}function J0(e,t){const n=Math.max($t,$t/t),r=Math.min(lr.px.max,lr.px.max/t),o=Math.min(r,Math.max(n,e));return{width:o*t,height:o}}function Q0(e,t,n){const r=Y0(t);return e==="e"?X0(t.width+n.x,r):e==="s"?J0(t.height+n.y,r):{width:Hd(t.width+n.x),height:Hd(t.height+n.y)}}function ev(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:$t,height:r>0?r:$t}}function tv(e,t,n){const r=cr(Math.max($t,t),"px"),o=cr(Math.max($t,n),"px");return!r||!o?!1:fg(e,{...mg(e),sizeMode:"lock",width:r,height:o})}function nv(e={}){return{border:{...Nl},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function rv(e){const t=ur(e);return{border:t.border,borderCollapse:sv(e),borderSpacing:Bg(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:Oe(e.style.width)}}function ov(e,t){let n=dr(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 lv(e,t.borderCollapse)&&(n=!0),cv(e,t.borderCollapse,t.borderSpacing)&&(n=!0),uv(e,t.width)&&(n=!0),n&&We(e),n}function iv(e){const t=ql(e);return t?rv(t):null}function av(e,t){const n=ql(e);return n?ov(n,t):!1}function sv(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function lv(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function Bg(e){const t=e.style.borderSpacing.trim();return t?Oe(t.split(/\s+/)[0]??""):null}function cv(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?dn(n):null,o=Bg(e);return st(o,r)?!1:(r?e.style.borderSpacing=he(r):e.style.removeProperty("border-spacing"),!0)}function uv(e,t){const n=t?dn(t):null,r=Oe(e.style.width);return st(r,n)?!1:(n?e.style.width=he(n):e.style.removeProperty("width"),!0)}const ta=["top","middle","bottom","baseline"],dv=new Set(ta);function mv(e={}){return{backgroundColor:null,color:null,padding:{...ht},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function fv(e){const t=ur(e);return{backgroundColor:t.backgroundColor,color:Hg(e),padding:t.padding,textAlign:yv(e),verticalAlign:zg(e),width:Oe(e.style.width),...Ji(e)}}function gv(e,t){let n=dr(e,{margin:{...ht},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 bv(e,t.color)&&(n=!0),el(e,t.textAlign)&&(n=!0),xv(e,t.verticalAlign)&&(n=!0),wv(e,t.width)&&(n=!0),n&&We(e),n}function pv(e){const t=jt(e);return t?fv(t):null}function hv(e,t){const n=ro(e);if(n.length===0)return!1;let r=!1;for(const a of n)gv(a,t)&&(r=!0);const o=jt(e);if(o){const a=Ji(o);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&F1(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function Hg(e){const t=e.style.color;return t?Pe(t):null}function bv(e,t){const n=t?Pe(t):null;return Hg(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function yv(e){const t=_i(e);return t==="left"?null:t}function zg(e){const t=e.style.verticalAlign.trim().toLowerCase();return dv.has(t)?t:null}function xv(e,t){return zg(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function wv(e,t){const n=t?dn(t):null,r=Oe(e.style.width);return st(r,n)?!1:(n?e.style.width=he(n):e.style.removeProperty("width"),!0)}const Cv=new Set(ta);function vv(e={}){return{backgroundColor:null,color:null,padding:{...ht},height:null,verticalAlign:null,...e}}function kv(e){const t=e.cells[0],n=t?ur(t).padding:{...ht};return{backgroundColor:Og(e),color:$g(e),padding:n,height:Oe(e.style.height),verticalAlign:Kg(e)}}function Sv(e,t){let n=!1;Dv(e,t.backgroundColor)&&(n=!0),Rv(e,t.color)&&(n=!0),jv(e,t.height)&&(n=!0),Ev(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))dr(r,{margin:{...ht},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&&We(e),n}function Pv(e){const t=eg(e);return t?kv(t):null}function Av(e,t){const n=eg(e);return n?Sv(n,t):!1}function Og(e){const t=e.style.backgroundColor;return t?Pe(t):null}function Dv(e,t){const n=t?Pe(t):null;return Og(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function $g(e){const t=e.style.color;return t?Pe(t):null}function Rv(e,t){const n=t?Pe(t):null;return $g(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Kg(e){const t=e.style.verticalAlign.trim().toLowerCase();return Cv.has(t)?t:null}function Ev(e,t){return Kg(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function jv(e,t){const n=t?dn(t):null,r=Oe(e.style.height);return st(r,n)?!1:(n?e.style.height=he(n):e.style.removeProperty("height"),!0)}const Tv=1e3;function Nv(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function Iv({onAutoSave:e,getHtml:t}){const n=c.useRef(e);n.current=e;const r=c.useRef(t);r.current=t;const o=c.useRef(null),a=e!=null;c.useEffect(()=>{if(!a){o.current=null;return}o.current=r.current();const s=window.setInterval(()=>{const u=n.current;if(!u)return;const d=r.current();d!==o.current&&(o.current=d,queueMicrotask(()=>Nv(u,d)))},Tv);return()=>{window.clearInterval(s)}},[a])}function oi({value:e,defaultValue:t,onChange:n}){const[r,o]=c.useState(t),a=e!==void 0,s=a?e:r,u=c.useCallback(d=>{a||o(d),n==null||n(d)},[a,n]);return[s,u]}const zd=8,Od=["#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"],Mv=8;let ul=[];const dl=new Set;function $d(){return ul}function _v(e){const t=Pe(e);t&&(ul=[t,...ul.filter(n=>n!==t)].slice(0,Mv),dl.forEach(n=>n()))}function Lv(e){return dl.add(e),()=>{dl.delete(e)}}function ii(e){const t=Pe(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 kn(e,t,n){const r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Ds({r:e,g:t,b:n}){const r=e/255,o=t/255,a=n/255,s=Math.max(r,o,a),u=Math.min(r,o,a),d=s-u;let g=0;return d!==0&&(s===r?g=(o-a)/d%6:s===o?g=(a-r)/d+2:g=(r-o)/d+4,g*=60,g<0&&(g+=360)),{h:g,s:s===0?0:d/s,v:s}}function Rs({h:e,s:t,v:n}){const r=(e%360+360)%360,o=n*t,a=o*(1-Math.abs(r/60%2-1)),s=n-o;let u=0,d=0,g=0;return r<60?(u=o,d=a):r<120?(u=a,d=o):r<180?(d=o,g=a):r<240?(d=a,g=o):r<300?(u=a,g=o):(u=o,g=a),{r:Math.round((u+s)*255),g:Math.round((d+s)*255),b:Math.round((g+s)*255)}}function Ug(){return typeof window<"u"&&"EyeDropper"in window}async function Fv(){if(!Ug())return null;const e=window.EyeDropper;try{const t=await new e().open();return Pe(t.sRGBHex)}catch{return null}}const Bv="_picker_ag1yo_1",Hv="_none_ag1yo_12",zv="_customToggle_ag1yo_13",Ov="_eyedrop_ag1yo_14",$v="_swatch_ag1yo_48",Kv="_field_ag1yo_49",Uv="_grid_ag1yo_54",Wv="_recents_ag1yo_55",Vv="_sectionLabel_ag1yo_84",Gv="_custom_ag1yo_13",qv="_sv_ag1yo_95",Zv="_svThumb_ag1yo_105",Yv="_hue_ag1yo_116",Xv="_rgbRow_ag1yo_155",Jv="_hexRow_ag1yo_156",Ie={picker:Bv,none:Hv,customToggle:zv,eyedrop:Ov,swatch:$v,field:Kv,grid:Uv,recents:Wv,sectionLabel:Vv,custom:Gv,sv:qv,svThumb:Zv,hue:Yv,rgbRow:Xv,hexRow:Jv};function Qv(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 ic({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:o,menu:a=!1,fallbackCustom:s="#000000",onChange:u,onCommit:d}){const g=q(),p=c.useId(),h=a?"menuitemradio":"option",x=t?null:e,b=ii(x??s)??{r:0,g:0,b:0},[w,y]=c.useState(!1),[v,k]=c.useState(()=>Ds(b)),[S,D]=c.useState(()=>({r:String(b.r),g:String(b.g),b:String(b.b)})),[I,A]=c.useState(()=>kn(b.r,b.g,b.b)),[P,R]=c.useState(()=>[...$d()]),L=c.useRef(null),E=c.useRef(kn(b.r,b.g,b.b));c.useEffect(()=>Lv(()=>R([...$d()])),[]),c.useEffect(()=>{const T=ii(x??s);if(!T)return;const V=Ds(T);k(V),D({r:String(T.r),g:String(T.g),b:String(T.b)}),A(kn(T.r,T.g,T.b))},[x,s]);const N=(T,V,Q)=>{T&&(E.current=T),Q&&T&&_v(T),u(T),V&&(d==null||d(T))},j=(T,V,Q)=>{const G=kn(T.r,T.g,T.b);k(Ds(T)),D({r:String(T.r),g:String(T.g),b:String(T.b)}),A(G),N(G,V,Q)},M=(T,V,Q)=>{const G=Rs(T),ve=kn(G.r,G.g,G.b);k(T),D({r:String(G.r),g:String(G.g),b:String(G.b)}),A(ve),N(ve,V,Q)},F=T=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(T.key))return;const Q=[...T.currentTarget.querySelectorAll("button")],G=Q.findIndex(_e=>_e===document.activeElement);if(G<0)return;T.preventDefault();const ve=T.key==="ArrowLeft"?-1:T.key==="ArrowRight"?1:T.key==="ArrowUp"?-zd:zd,He=Q[Math.max(0,Math.min(Q.length-1,G+ve))];He==null||He.focus()},$=(T,V)=>{const Q=L.current;if(!Q||o)return;const G=Q.getBoundingClientRect(),ve=Math.max(0,Math.min(1,(T.clientX-G.left)/G.width)),He=Math.max(0,Math.min(1,1-(T.clientY-G.top)/G.height));M({h:v.h,s:ve,v:He},V,V)},Z=T=>{o||(T.currentTarget.setPointerCapture(T.pointerId),$(T,!1))},ne=Rs({h:v.h,s:1,v:1}),X=kn(ne.r,ne.g,ne.b),Y=Rs(v),ae=kn(Y.r,Y.g,Y.b),te=new Set(Od),U=P.filter(T=>!te.has(T));return i.jsxs("div",{className:Ie.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[i.jsx("button",{type:"button",className:Ie.none,role:h,"aria-checked":a?x===null&&!t:void 0,"aria-selected":a?void 0:x===null&&!t,disabled:o,onClick:()=>N(null,!0,!1),children:n}),i.jsx("div",{className:Ie.grid,role:a?"group":"none",onKeyDown:F,children:Od.map(T=>{const V=x===T;return i.jsx("button",{type:"button",className:Ie.swatch,role:h,"aria-label":T,"aria-checked":a?V:void 0,"aria-selected":a?void 0:V,disabled:o,style:{backgroundColor:T},onMouseDown:Q=>Q.preventDefault(),onClick:()=>N(T,!0,!1)},T)})}),U.length>0?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:Ie.sectionLabel,children:g("colorRecent")}),i.jsx("div",{className:Ie.recents,role:a?"group":"none","aria-label":g("colorRecent"),children:U.map(T=>i.jsx("button",{type:"button",className:Ie.swatch,role:h,"aria-label":T,"aria-checked":a?x===T:void 0,"aria-selected":a?void 0:x===T,disabled:o,style:{backgroundColor:T},onMouseDown:V=>V.preventDefault(),onClick:()=>N(T,!0,!1)},T))})]}):null,i.jsx("button",{type:"button",className:Ie.customToggle,disabled:o,"aria-expanded":w,onClick:()=>y(T=>!T),children:g("colorCustom")}),w?i.jsxs("div",{className:Ie.custom,children:[i.jsx("div",{ref:L,className:Ie.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${X})`},onPointerDown:Z,onPointerMove:T=>{T.currentTarget.hasPointerCapture(T.pointerId)&&$(T,!1)},onPointerUp:T=>{$(T,!0)},children:i.jsx("span",{className:Ie.svThumb,style:{left:`${v.s*100}%`,top:`${(1-v.v)*100}%`}})}),i.jsx("input",{className:Ie.hue,type:"range",min:0,max:360,value:Math.round(v.h),disabled:o,"aria-label":g("colorCustom"),onChange:T=>M({...v,h:Number(T.target.value)},!1,!1),onPointerUp:()=>N(E.current,!0,!0)}),i.jsx("div",{className:Ie.rgbRow,children:["r","g","b"].map(T=>i.jsxs("div",{className:Ie.field,children:[i.jsx("label",{htmlFor:`${p}-${T}`,children:g(T==="r"?"colorRgbR":T==="g"?"colorRgbG":"colorRgbB")}),i.jsx("input",{id:`${p}-${T}`,inputMode:"numeric",value:S[T],disabled:o,onChange:V=>{D(Q=>({...Q,[T]:V.target.value}))},onBlur:()=>{const V=Qv(S[T]);if(V===null){D({r:String(Y.r),g:String(Y.g),b:String(Y.b)});return}j({...Y,[T]:V},!0,!0)},onKeyDown:V=>{V.key==="Enter"&&V.currentTarget.blur()}})]},T))}),i.jsx("div",{className:Ie.hexRow,children:i.jsxs("div",{className:Ie.field,children:[i.jsx("label",{htmlFor:`${p}-hex`,children:g("colorHex")}),i.jsx("input",{id:`${p}-hex`,value:I,disabled:o,onChange:T=>A(T.target.value),onBlur:()=>{const T=Pe(I);if(!T){A(ae);return}const V=ii(T);V&&j(V,!0,!0)},onKeyDown:T=>{T.key==="Enter"&&T.currentTarget.blur()}})]})}),Ug()?i.jsx("button",{type:"button",className:Ie.eyedrop,disabled:o,onClick:()=>{Fv().then(T=>{if(!T)return;const V=ii(T);V&&j(V,!0,!0)})},children:g("colorPickFromScreen")}):null]}):null]})}const ek="_wrap_hfz5s_1",tk="_button_hfz5s_8",nk="_icon_hfz5s_18",rk="_bar_hfz5s_24",ok="_barEmpty_hfz5s_33",ik="_popover_hfz5s_43",Sn={wrap:ek,button:tk,icon:nk,bar:rk,barEmpty:ok,popover:ik},ak="_field_1knrr_1",sk="_label_1knrr_8",lk="_button_1knrr_12",ck="_swatch_1knrr_37",uk="_swatchEmpty_1knrr_44",Lr={field:ak,label:sk,button:lk,swatch:ck,swatchEmpty:uk},ai=4;function ut({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:o,fallbackCustom:a,onChange:s}){const u=c.useId(),d=c.useRef(null),g=c.useRef(null),p=c.useRef(null),[h,x]=c.useState(!1),[b,w]=c.useState({top:0,left:0}),y=c.useCallback(()=>{const S=g.current,D=p.current;if(!S)return;const I=S.getBoundingClientRect(),A=(D==null?void 0:D.offsetHeight)??0,P=(D==null?void 0:D.offsetWidth)??240;let R=I.bottom;R+A>window.innerHeight-ai&&(R=Math.max(ai,I.top-A));const L=Math.min(Math.max(I.left,ai),window.innerWidth-P-ai);w({top:R,left:L})},[]);c.useLayoutEffect(()=>{if(!h)return;y();const S=()=>y();return window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[h,y]),c.useEffect(()=>{if(!h)return;const S=I=>{var P,R;const A=I.target;(P=d.current)!=null&&P.contains(A)||(R=p.current)!=null&&R.contains(A)||x(!1)},D=I=>{var A;I.key==="Escape"&&(I.preventDefault(),I.stopPropagation(),x(!1),(A=g.current)==null||A.focus())};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",D,!0),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",D,!0)}},[h]);const v=`${Lr.swatch}${!n||r?` ${Lr.swatchEmpty}`:""}`,k=n&&!r?{backgroundColor:n}:void 0;return i.jsxs("div",{className:Lr.field,ref:d,children:[i.jsx("span",{className:Lr.label,children:e}),i.jsx("button",{ref:g,type:"button",className:Lr.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:o,onClick:()=>x(S=>!S),children:i.jsx("span",{className:v,style:k})}),h?i.jsx(fe,{children:i.jsx("div",{ref:p,id:u,className:Sn.popover,style:{top:b.top,left:b.left,zIndex:1400},children:i.jsx(ic,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:o,fallbackCustom:a,onChange:s,onCommit:()=>x(!1)})})}):null]})}const Es=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],dk="_toolbar_1aggm_1",mk="_menuBar_1aggm_35",fk="_menuBarDesktop_1aggm_43",gk="_brandMark_1aggm_49",pk="_brandMarkIcon_1aggm_56",hk="_menuBarCompact_1aggm_68",bk="_menuWrap_1aggm_91",yk="_menuButton_1aggm_97",xk="_iconButton_1aggm_98",wk="_menuItem_1aggm_99",Ck="_hamburgerButton_1aggm_142",vk="_iconNav_1aggm_149",kk="_iconNavMain_1aggm_160",Sk="_iconNavEnd_1aggm_169",Pk="_iconGroup_1aggm_185",Ak="_tooltipTrigger_1aggm_276",Dk="_menu_1aggm_35",Rk="_submenuWrap_1aggm_305",Ek="_submenu_1aggm_305",jk="_submenuTrigger_1aggm_315",Tk="_menuOverlay_1aggm_330",Nk="_menuOverlayHeader_1aggm_342",Ik="_menuOverlayTitle_1aggm_352",Mk="_menuOverlayBody_1aggm_358",_k="_menuSeparator_1aggm_409",Lk="_icon_1aggm_98",Fk="_tooltip_1aggm_276",Bk="_tooltipElevated_1aggm_494",ee={toolbar:dk,menuBar:mk,menuBarDesktop:fk,brandMark:gk,brandMarkIcon:pk,menuBarCompact:hk,menuWrap:bk,menuButton:yk,iconButton:xk,menuItem:wk,hamburgerButton:Ck,iconNav:vk,iconNavMain:kk,iconNavEnd:Sk,iconGroup:Pk,tooltipTrigger:Ak,menu:Dk,submenuWrap:Rk,submenu:Ek,submenuTrigger:jk,menuOverlay:Tk,menuOverlayHeader:Nk,menuOverlayTitle:Ik,menuOverlayBody:Mk,menuSeparator:_k,icon:Lk,tooltip:Fk,tooltipElevated:Bk},Hk=400,Kd=6,js=4;function cn({label:e,children:t,className:n,elevated:r}){const o=c.useRef(null),a=c.useRef(null),s=c.useRef(null),u=c.useRef(!1),d=c.useRef(!1),[g,p]=c.useState(!1),[h,x]=c.useState({top:0,left:0}),b=c.useCallback(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),w=c.useCallback(k=>{if(!(u.current||d.current)){b(),p(!1);return}if(k||d.current){b(),p(!0);return}b(),s.current=setTimeout(()=>{s.current=null,p(!0)},Hk)},[b]),y=c.useCallback(()=>{const k=o.current,S=a.current;if(!k||!S)return;const D=k.getBoundingClientRect(),I=S.offsetWidth,A=S.offsetHeight;let P=D.bottom+Kd;P+A>window.innerHeight-js&&(P=D.top-Kd-A);let R=D.left+D.width/2-I/2;R=Math.min(Math.max(R,js),window.innerWidth-I-js),x({top:P,left:R})},[]);c.useEffect(()=>()=>b(),[b]),c.useEffect(()=>{const k=o.current;if(!k)return;const S=()=>{d.current=!0,w(!0)},D=()=>{d.current=!1,w(!1)};return k.addEventListener("focusin",S),k.addEventListener("focusout",D),()=>{k.removeEventListener("focusin",S),k.removeEventListener("focusout",D)}},[w]),c.useLayoutEffect(()=>{if(!g)return;y();const k=()=>y();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[g,e,y]);const v=n?`${ee.tooltipTrigger} ${n}`:ee.tooltipTrigger;return i.jsxs(i.Fragment,{children:[i.jsx("span",{ref:o,className:v,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,w(!1)},onMouseLeave:()=>{u.current=!1,w(!1)},children:t}),g?i.jsx(fe,{children:i.jsx("span",{ref:a,className:r?`${ee.tooltip} ${ee.tooltipElevated}`:ee.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const zk="_wrap_1vjt0_1",Ok="_wrapToolbar_1vjt0_7",$k="_field_1vjt0_12",Kk="_trigger_1vjt0_20",Uk="_chevron_1vjt0_50",Wk="_list_1vjt0_73",Vk="_listInline_1vjt0_88",Gk="_option_1vjt0_96",qk="_separator_1vjt0_125",pt={wrap:zk,wrapToolbar:Ok,field:$k,trigger:Kk,chevron:Uk,list:Wk,listInline:Vk,option:Gk,separator:qk};function Zk({value:e,mixed:t=!1,fonts:n,disabled:r,listId:o,listRef:a,inline:s,style:u,onSelect:d}){const g=q(),p=!t&&e===null;return i.jsxs("ul",{ref:a,id:o,className:s?`${pt.list} ${pt.listInline}`:pt.list,role:"listbox","aria-label":g("commandFontFamilyAria"),style:u,children:[i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:pt.option,role:"option","aria-checked":p,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>d(null),children:g("fontFamilyDefault")})}),i.jsx("li",{className:pt.separator,role:"separator"}),n.map(h=>{const x=!t&&no(e,h.family);return i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:pt.option,role:"option","aria-checked":x,disabled:r,style:{fontFamily:h.family},onMouseDown:b=>b.preventDefault(),onClick:()=>d(h.family),children:h.name})},h.family)})]})}function Yk(e,t,n,r){var o;return t?"":e===null?r:((o=Uy(e,n))==null?void 0:o.name)??e}const si=4;function Wg({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:o,toolbar:a=!1,triggerId:s,onChange:u}){const d=q(),g=c.useId(),p=c.useRef(null),h=c.useRef(null),x=c.useRef(null),[b,w]=c.useState(!1),[y,v]=c.useState({top:0,left:0,width:0}),k=Yk(e,t,n,d("fontFamilyDefault")),S=c.useCallback(()=>{const I=h.current,A=x.current;if(!I)return;const P=I.getBoundingClientRect(),R=(A==null?void 0:A.offsetHeight)??0,L=Math.max(P.width,(A==null?void 0:A.offsetWidth)??0);let E=P.bottom;E+R>window.innerHeight-si&&(E=Math.max(si,P.top-R));const N=Math.min(Math.max(P.left,si),window.innerWidth-L-si);v({top:E,left:N,width:L})},[]);c.useLayoutEffect(()=>{if(!b)return;S();const I=()=>S();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[b,S,n.length]),c.useEffect(()=>{if(!b)return;const I=P=>{var L,E;const R=P.target;(L=p.current)!=null&&L.contains(R)||(E=x.current)!=null&&E.contains(R)||w(!1)},A=P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),w(!1))};return document.addEventListener("pointerdown",I),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",I),document.removeEventListener("keydown",A,!0)}},[b]);const D=i.jsxs("div",{className:`${pt.wrap}${a?` ${pt.wrapToolbar}`:""}`,ref:p,children:[i.jsxs("div",{className:pt.field,ref:h,children:[i.jsx("button",{type:"button",id:s,className:pt.trigger,disabled:r,"aria-label":a?d("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":b?g:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:I=>I.preventDefault(),onClick:()=>w(I=>!I),children:k}),i.jsx("span",{className:pt.chevron,"aria-hidden":"true"})]}),b?i.jsx(fe,{children:i.jsx(Zk,{listRef:x,listId:g,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:y.top,left:y.left,minWidth:y.width},onSelect:I=>{u(I),w(!1)}})}):null]});return o?i.jsx(cn,{label:o,children:D}):D}function Xk({commands:e,queries:t,disabled:n}){const r=q(),o=!!(n||!t.isVisualMode());return i.jsx(Wg,{family:t.isFontFamilyMixed()?null:t.getFontFamily(),mixed:t.isFontFamilyMixed(),fonts:t.getFontFaces(),disabled:o,tooltip:r("commandFontFamily"),toolbar:!0,onChange:a=>{e.setFontFamily(a)}})}const Jk="_wrap_58i0x_1",Qk="_wrapToolbar_58i0x_9",eS="_field_58i0x_14",tS="_input_58i0x_22",nS="_toggle_58i0x_41",rS="_chevron_58i0x_42",oS="_unit_58i0x_80",iS="_list_58i0x_110",aS="_option_58i0x_125",Ae={wrap:Jk,wrapToolbar:Qk,field:eS,input:tS,toggle:nS,chevron:rS,unit:oS,list:iS,option:aS},li=4,sS={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Vg({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:o,tooltip:a,sizeInputId:s,toolbar:u=!1}){const d=q(),g=c.useId(),p=c.useRef(null),h=c.useRef(null),x=c.useRef(null),[b,w]=c.useState(()=>e===null?"":ie(e)),[y,v]=c.useState(!1),[k,S]=c.useState(!1),[D,I]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{y||w(e===null?"":ie(e))},[e,y]);const A=c.useCallback(()=>{const N=h.current,j=x.current;if(!N)return;const M=N.getBoundingClientRect(),F=(j==null?void 0:j.offsetHeight)??0;let $=M.bottom;$+F>window.innerHeight-li&&($=Math.max(li,M.top-F));const Z=Math.min(Math.max(M.left,li),window.innerWidth-Math.max(M.width,72)-li);I({top:$,left:Z,width:M.width})},[]);c.useLayoutEffect(()=>{if(!k)return;A();const N=()=>A();return window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[k,A]),c.useEffect(()=>{if(!k)return;const N=M=>{var $,Z;const F=M.target;($=p.current)!=null&&$.contains(F)||(Z=x.current)!=null&&Z.contains(F)||S(!1)},j=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopPropagation(),S(!1))};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",j,!0)}},[k]);const P=N=>{const j=fb(N,t);if(!j){w(e===null?"":ie(e));return}n(j.value,j.unit),w(ie(j.value))},R=cb[t],L=k?i.jsx(fe,{children:i.jsx("ul",{ref:x,className:Ae.list,role:"listbox",id:g,style:{top:D.top,left:D.left,minWidth:D.width},children:R.map(N=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ae.option,role:"option","aria-selected":e===N,onMouseDown:j=>j.preventDefault(),onClick:()=>{n(N,t),w(ie(N)),S(!1)},children:ie(N)})},N))})}):null,E=i.jsxs("div",{className:`${Ae.wrap}${u?` ${Ae.wrapToolbar}`:""}`,ref:p,children:[i.jsxs("div",{className:Ae.field,ref:h,children:[i.jsx("input",{id:s,className:Ae.input,value:b,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":k,"aria-controls":g,role:"combobox",inputMode:"decimal",onFocus:()=>v(!0),onBlur:()=>{v(!1),P(b)},onChange:N=>w(N.target.value),onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),P(b),S(!1),N.currentTarget.blur()),N.key==="ArrowDown"&&(N.preventDefault(),S(!0))}}),i.jsx("button",{type:"button",className:Ae.toggle,tabIndex:-1,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-expanded":k,"aria-controls":g,onMouseDown:N=>N.preventDefault(),onClick:()=>S(N=>!N)})]}),i.jsxs("div",{className:Ae.field,children:[i.jsx("select",{className:Ae.unit,value:t,disabled:o,"aria-label":d("commandFontSizeUnitAria"),onChange:N=>{r(N.target.value)},children:wl.map(N=>i.jsx("option",{value:N,children:d(sS[N])},N))}),i.jsx("span",{className:Ae.chevron,"aria-hidden":"true"})]}),L]});return a?i.jsx(cn,{label:a,children:E}):E}const lS="_backdrop_1p9zk_1",cS="_dialog_1p9zk_12",uS="_dialogWide_1p9zk_31",dS="_header_1p9zk_35",mS="_tabs_1p9zk_43",fS="_tab_1p9zk_43",gS="_body_1p9zk_76",pS="_field_1p9zk_86",hS="_label_1p9zk_92",bS="_sizeRow_1p9zk_96",yS="_fileRow_1p9zk_102",xS="_fileName_1p9zk_108",wS="_previewImage_1p9zk_115",CS="_marks_1p9zk_125",vS="_mark_1p9zk_125",kS="_actions_1p9zk_140",SS="_actionsSpread_1p9zk_148",PS="_actionsEnd_1p9zk_152",AS="_headerRow_1p9zk_157",DS="_close_1p9zk_170",RS="_nameSection_1p9zk_187",ES="_nameInput_1p9zk_192",jS="_labelRow_1p9zk_209",TS="_help_1p9zk_215",NS="_textInput_1p9zk_233",IS="_fullSelect_1p9zk_245",MS="_error_1p9zk_249",_S="_emptyHint_1p9zk_254",LS="_action_1p9zk_140",FS="_textarea_1p9zk_265",BS="_actionDanger_1p9zk_279",HS="_confirmBody_1p9zk_285",zS="_nestedPanel_1p9zk_294",OS="_spinnerWrap_1p9zk_309",$S="_spinner_1p9zk_309",KS="_actionPrimary_1p9zk_344",US="_iconButton_1p9zk_358",WS="_select_1p9zk_359",VS="_lengthInput_1p9zk_360",GS="_lengthUnit_1p9zk_361",qS="_group_1p9zk_369",ZS="_nestedGroup_1p9zk_379",YS="_subLabel_1p9zk_389",XS="_iconRow_1p9zk_393",JS="_lengthField_1p9zk_425",QS="_sideLabel_1p9zk_431",eP="_lengthRow_1p9zk_435",tP="_sideGrid_1p9zk_463",nP="_shadowGrid_1p9zk_464",f={backdrop:lS,dialog:cS,dialogWide:uS,header:dS,tabs:mS,tab:fS,body:gS,field:pS,label:hS,sizeRow:bS,fileRow:yS,fileName:xS,previewImage:wS,marks:CS,mark:vS,actions:kS,actionsSpread:SS,actionsEnd:PS,headerRow:AS,close:DS,nameSection:RS,nameInput:ES,labelRow:jS,help:TS,textInput:NS,fullSelect:IS,error:MS,emptyHint:_S,action:LS,textarea:FS,actionDanger:BS,confirmBody:HS,nestedPanel:zS,spinnerWrap:OS,spinner:$S,actionPrimary:KS,iconButton:US,select:WS,lengthInput:VS,lengthUnit:GS,group:qS,nestedGroup:ZS,subLabel:YS,iconRow:XS,lengthField:JS,sideLabel:QS,lengthRow:eP,sideGrid:tP,shadowGrid:nP},rP={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function ac({tab:e,value:t,fonts:n,disabled:r,onTabChange:o,onChange:a}){const s=q(),u=c.useId(),d=c.useId(),g=n??vf(),p=Es.find(h=>h.id===e)??Es[0];return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:f.tabs,role:"tablist","aria-label":s("fontDialogTitle"),children:Es.map(h=>i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":h.id===e,disabled:!h.implemented,onClick:()=>o(h.id),children:s(h.labelKey)},h.id))}),i.jsx("div",{className:f.body,role:"tabpanel",children:p.implemented?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:d,children:s("fontDialogFamily")}),i.jsx(Wg,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:g,disabled:r,triggerId:d,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:u,children:s("fontDialogSize")}),i.jsx("div",{className:f.sizeRow,children:i.jsx(Vg,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,x)=>{a({...t,size:h,unit:x})},onUnitChange:h=>{const x=t.size!==null?_m(t.size,t.unit,h,16,16):t.size;a({...t,size:x,unit:h})}})})]}),i.jsx("div",{className:f.field,children:i.jsx(ut,{label:s("commandFontColor"),noneLabel:s("colorAutomatic"),value:t.fontColor,mixed:t.fontColorMixed,disabled:r,onChange:h=>{a({...t,fontColor:h,fontColorMixed:!1})}})}),i.jsx("div",{className:f.field,children:i.jsx(ut,{label:s("commandHighlightColor"),noneLabel:s("colorNone"),value:t.highlightColor,mixed:t.highlightColorMixed,disabled:r,fallbackCustom:"#ffff00",onChange:h=>{a({...t,highlightColor:h,highlightColorMixed:!1})}})}),i.jsxs("fieldset",{className:f.marks,children:[i.jsx("legend",{className:f.label,children:s("fontDialogStyle")}),ct.map(h=>i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:t.marks[h],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[h]:!t.marks[h]}})}}),s(rP[h].label)]},h))]})]}):null})]})}const Ud='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function oP({open:e,tab:t,size:n,unit:r,marks:o,fontFamily:a=null,fontFamilyMixed:s=!1,fontColor:u,fontColorMixed:d=!1,highlightColor:g,highlightColorMixed:p=!1,fonts:h,disabled:x,onTabChange:b,onApply:w,onClose:y}){const v=q(),k=c.useId(),S=c.useRef(null),[D,I]=c.useState({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:g,fontColorMixed:d,highlightColorMixed:p});return c.useEffect(()=>{e&&I({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:g,fontColorMixed:d,highlightColorMixed:p})},[e,n,r,o,a,s,u,d,g,p]),c.useEffect(()=>{if(!e)return;const A=S.current,P=A==null?void 0:A.querySelector(Ud);P==null||P.focus();const R=L=>{if(L.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;L.preventDefault(),L.stopPropagation(),y();return}if(L.key!=="Tab"||!A)return;const E=[...A.querySelectorAll(Ud)];if(E.length===0)return;const N=E[0],j=E[E.length-1];L.shiftKey&&document.activeElement===N?(L.preventDefault(),j.focus()):!L.shiftKey&&document.activeElement===j&&(L.preventDefault(),N.focus())};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[e,y]),e?i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:y,children:i.jsxs("div",{ref:S,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":k,onMouseDown:A=>A.stopPropagation(),children:[i.jsx("h2",{className:f.header,id:k,children:v("fontDialogTitle")}),i.jsx(ac,{tab:t,value:D,fonts:h,disabled:x,onTabChange:b,onChange:I}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:y,children:v("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:x,onClick:()=>w(D),children:v("fontDialogOk")})]})]})})}):null}const iP={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function je({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:o,inputId:a,onChange:s}){const u=q(),d=c.useId(),g=a??d,p=(t==null?void 0:t.unit)??kl,[h,x]=c.useState(()=>t?ie(t.value):""),[b,w]=c.useState(!1);c.useEffect(()=>{b||x(t?ie(t.value):"")},[t,b]);const y=v=>{const k=v.trim();if(!k){s(null),x("");return}const S=Vr(k,p,r);if(!S){x(t?ie(t.value):"");return}s(S),x(ie(S.value))};return i.jsxs("div",{className:f.lengthField,children:[i.jsx("label",{className:f.sideLabel,htmlFor:g,children:e}),i.jsxs("div",{className:f.lengthRow,children:[i.jsx("input",{id:g,className:f.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>w(!0),onBlur:()=>{w(!1),y(h)},onChange:v=>x(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),y(h),v.currentTarget.blur())}}),i.jsx("select",{className:f.lengthUnit,value:p,disabled:n,"aria-label":o??u("paragraphDialogLengthUnitAria"),onChange:v=>{const k=v.target.value;if(t){s({value:t.value,unit:k});return}if(h.trim()){const S=Vr(h,k,r);s(S)}},children:wl.map(v=>i.jsx("option",{value:v,children:u(iP[v])},v))})]})]})}function sc({shadow:e,disabled:t,onChange:n}){const r=q();return i.jsxs("div",{className:f.shadowGrid,children:[i.jsx(je,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetX:o??{value:0,unit:"px"}})}}),i.jsx(je,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetY:o??{value:0,unit:"px"}})}}),i.jsx(je,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:o=>{n({...e,blur:o??{value:0,unit:"px"}})}}),i.jsx(je,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:o=>{n({...e,spread:o??{value:0,unit:"px"}})}}),i.jsx(ut,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:o=>{n({...e,color:o})}}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const Gg=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0},{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],qg=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],aP={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},sP={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function Zg({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const o=q(),a=c.useId(),s=c.useId();return i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:o(e)}),i.jsx(lP,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:a,children:o("imagePropertiesFit")}),i.jsxs("select",{id:a,className:f.select,value:t.fit??"",disabled:n,onChange:u=>{const d=u.target.value;r({...t,fit:d||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesFitDefault")}),Ql.map(u=>i.jsx("option",{value:u,children:o(aP[u])},u))]})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:s,children:o("imagePropertiesPosition")}),i.jsxs("select",{id:s,className:f.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesPositionDefault")}),ec.map(u=>i.jsx("option",{value:u,children:o(sP[u])},u))]})]})]})}function lP({value:e,disabled:t,onChange:n}){const r=q(),o=c.useId(),a=e===null?null:Pi(e),[s,u]=c.useState(()=>a===null?"":ie(a)),[d,g]=c.useState(!1);c.useEffect(()=>{d||u(a===null?"":ie(a))},[a,d]);const p=h=>{const x=h.trim();if(!x){n(null),u("");return}const b=Number(x.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":ie(a));return}const w=Xm(b);n(w),u(ie(Pi(w)))};return i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:f.lengthRow,children:[i.jsx("input",{id:o,className:f.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>g(!0),onChange:h=>u(h.target.value),onBlur:()=>{g(!1),p(s)}}),i.jsx("span",{className:f.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const ci=4,cP={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function Bi({label:e,inputAria:t,value:n,disabled:r,onChange:o}){const a=q(),s=c.useId(),u=c.useId(),d=c.useRef(null),g=c.useRef(null),p=c.useRef(null),h=(n==null?void 0:n.unit)??q1,[x,b]=c.useState(()=>n?ie(n.value):""),[w,y]=c.useState(!1),[v,k]=c.useState(!1),[S,D]=c.useState({top:0,left:0,width:0});c.useEffect(()=>{w||b(n?ie(n.value):"")},[n,w]);const I=c.useCallback(()=>{const E=g.current,N=p.current;if(!E)return;const j=E.getBoundingClientRect(),M=(N==null?void 0:N.offsetHeight)??0;let F=j.bottom;F+M>window.innerHeight-ci&&(F=Math.max(ci,j.top-M));const $=Math.min(Math.max(j.left,ci),window.innerWidth-Math.max(j.width,72)-ci);D({top:F,left:$,width:j.width})},[]);c.useLayoutEffect(()=>{if(!v)return;I();const E=()=>I();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[v,I]),c.useEffect(()=>{if(!v)return;const E=j=>{var F,$;const M=j.target;(F=d.current)!=null&&F.contains(M)||($=p.current)!=null&&$.contains(M)||k(!1)},N=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",N,!0),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",N,!0)}},[v]);const A=E=>{const N=E.trim();if(!N){o(null),b("");return}const j=yd(N,h);if(!j){b(n?ie(n.value):"");return}o(j),b(ie(j.value))},P=Z1[h],R=(n==null?void 0:n.value)??null,L=v?i.jsx(fe,{children:i.jsx("ul",{ref:p,className:Ae.list,role:"listbox",id:s,style:{top:S.top,left:S.left,minWidth:S.width},children:P.map(E=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ae.option,role:"option","aria-selected":R===E,onMouseDown:N=>N.preventDefault(),onClick:()=>{o({value:E,unit:h}),b(ie(E)),k(!1)},children:ie(E)})},E))})}):null;return i.jsxs("div",{className:f.lengthField,children:[i.jsx("label",{className:f.sideLabel,htmlFor:u,children:e}),i.jsxs("div",{className:`${Ae.wrap} ${f.lengthRow}`,ref:d,children:[i.jsxs("div",{className:Ae.field,ref:g,children:[i.jsx("input",{id:u,className:Ae.input,value:x,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":v,"aria-controls":s,role:"combobox",inputMode:"decimal",onFocus:()=>y(!0),onBlur:()=>{y(!1),A(x)},onChange:E=>b(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),A(x),k(!1),E.currentTarget.blur()),E.key==="ArrowDown"&&(E.preventDefault(),k(!0))}}),i.jsx("button",{type:"button",className:Ae.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":v,"aria-controls":s,onMouseDown:E=>E.preventDefault(),onClick:()=>k(E=>!E)})]}),i.jsxs("div",{className:Ae.field,children:[i.jsx("select",{className:Ae.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:E=>{const N=E.target.value;if(n){o({value:n.value,unit:N});return}x.trim()&&o(yd(x,N))},children:cg.map(E=>i.jsx("option",{value:E,children:a(cP[E])},E))}),i.jsx("span",{className:Ae.chevron,"aria-hidden":"true"})]}),L]})]})}const uP={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},dP={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function Yg({src:e,disabled:t,customImagePicker:n,onSrcChange:r,onCustomPick:o,onSourceChange:a}){const s=q(),u=c.useId(),d=c.useId(),g=c.useRef(null),[p,h]=c.useState(()=>e.startsWith("data:")?"file":e.trim()?"url":"file"),[x,b]=c.useState(()=>e.startsWith("data:")?"":e),[w,y]=c.useState(""),[v,k]=c.useState(null),[S,D]=c.useState(!1);c.useEffect(()=>{a==null||a(p)},[a,p]);const I=p==="file"&&e.startsWith("data:")?e:p==="url"?x:"",A=p==="custom"?null:hn(I),P=p==="custom"?null:p==="file"&&v?dP[v]:A&&(p==="file"||x.trim().length>0)?uP[A]:null,R=()=>{t||!n||o==null||o()},L=E=>{var j;const N=(j=E.target.files)==null?void 0:j[0];N&&(D(!0),k(null),fw(N).then(M=>{y(N.name),h("file"),r(M),D(!1)},M=>{const F=M instanceof Error?M.message:"";y(""),h("file"),k(F==="tooLarge"||F==="type"?F:"type"),D(!1),g.current&&(g.current.value="")}))};return i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.subLabel,children:s("imageDialogSource")}),i.jsxs("div",{className:f.sizeRow,role:"radiogroup","aria-label":s("imageDialogSource"),children:[i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":p==="file",disabled:t,onClick:()=>h("file"),children:s("imageDialogFile")}),i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":p==="url",disabled:t,onClick:()=>h("url"),children:s("imageDialogUrl")}),n?i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":p==="custom",disabled:t,onClick:()=>h("custom"),children:n.text}):null]}),p==="file"?i.jsxs("div",{className:f.fileRow,children:[i.jsx("input",{ref:g,type:"file",accept:aw,hidden:!0,disabled:t,"aria-label":s("imageDialogChooseFile"),onChange:L}),i.jsx("button",{type:"button",className:f.action,disabled:t||S,onClick:()=>{var E;return(E=g.current)==null?void 0:E.click()},children:s("imageDialogChooseFile")}),w?i.jsx("span",{className:f.fileName,children:w}):null,e.startsWith("data:")&&!w?i.jsx("span",{className:f.fileName,children:s("pageBackgroundImageCurrent")}):null]}):null,p==="url"?i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:u,children:s("imageDialogUrl")}),i.jsx("input",{id:u,className:f.textInput,value:x,disabled:t,"aria-invalid":P!==null,"aria-describedby":P?d:void 0,onChange:E=>{const N=E.target.value;b(N),r(N.trim())}})]}):null,p==="custom"&&n?i.jsxs("div",{className:f.field,children:[i.jsx("p",{className:f.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:f.action,disabled:t,onClick:R,children:n.buttonCaption})]}):null,P?i.jsx("p",{id:d,className:f.error,children:s(P)}):null]})}function mP(e){return hn(e.trim())===null}function fP(e){return hg(e)?{width:null,height:null}:e==="fill"?{width:{...tr},height:{...tr}}:{width:{...tr},height:null}}function gP({value:e,disabled:t,customImagePicker:n,onCustomImagePick:r,onChange:o}){const a=q(),s=e.src??"",u=(d,g)=>{o({...e,fit:null,[d]:g})};return i.jsxs(i.Fragment,{children:[s?i.jsxs("div",{className:f.field,children:[i.jsx("span",{className:f.label,children:a("pageBackgroundImagePreview")}),i.jsx("img",{className:f.previewImage,src:s,alt:a("pageBackgroundImagePreviewAlt")}),i.jsx("button",{type:"button",className:f.action,disabled:t,onClick:()=>{o({...e,src:null})},children:a("pageBackgroundImageClear")})]}):null,i.jsx(Yg,{src:s,disabled:t,customImagePicker:n,onCustomPick:r,onSrcChange:d=>{o({...e,src:d.trim()||null})}}),s?i.jsxs(i.Fragment,{children:[i.jsx(Bi,{label:a("imagePropertiesWidth"),inputAria:a("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:d=>u("width",d)}),i.jsx(Bi,{label:a("imagePropertiesHeight"),inputAria:a("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:d=>u("height",d)}),i.jsx(Zg,{legendKey:"pageDialogTabBackgroundImage",value:{opacity:e.opacity,fit:e.fit,position:e.position},disabled:t,onChange:d=>{const g=d.fit===e.fit?{width:e.width,height:e.height}:fP(d.fit);o({...e,opacity:d.opacity,fit:d.fit,position:d.position,...g})}})]}):null]})}const pP={left:Ki,center:$i,right:Ui,justify:xm},hP={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},bP={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},yP={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},xP={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},wP={value:1,unit:"pt"},CP={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},vP={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},Wd={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function Fr(e){return{top:e,right:e,bottom:e,left:e}}function Vd(e){for(const t of Fe)if(e[t])return e[t];return null}function kP(){const e=[...Gg];for(const t of qg)e.some(n=>n.id===t.id)||e.push(t);return e}function lc({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:o="paragraphDialogTitle",backgroundImage:a,customImagePicker:s,onCustomImagePick:u,onBackgroundImageChange:d,onTabChange:g,onChange:p}){const h=q(),x=r?kP().filter(P=>r.includes(P.id)):Gg,b=c.useId(),w=c.useId(),y=c.useId(),v=c.useId(),[k,S]=c.useState(()=>Ot(t.margin,Fr(t.margin.top))),[D,I]=c.useState(()=>Ot(t.padding,Fr(t.padding.top))),A=(P,R,L,E)=>{const N=t[P],j=R?Fr(E):{...N,[L]:E};p({...t,[P]:j,[`${P}Mixed`]:!1})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:f.tabs,role:"tablist","aria-label":h(o),children:x.map(P=>i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":P.id===e,disabled:!P.implemented,onClick:()=>g(P.id),children:h(P.labelKey)},P.id))}),i.jsxs("div",{className:f.body,role:"tabpanel",children:[e==="general"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:h("paragraphDialogAlignment")}),i.jsx("div",{className:f.iconRow,role:"radiogroup","aria-label":h("paragraphDialogAlignment"),children:og.map(P=>{const R=pP[P],L=!t.alignMixed&&t.align===P;return i.jsx("button",{type:"button",className:f.iconButton,role:"radio","aria-checked":L,"aria-label":h(hP[P].aria),disabled:n,onClick:()=>{p({...t,align:P,alignMixed:!1})},children:i.jsx(R,{})},P)})})]}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:h("paragraphDialogLists")}),i.jsxs("div",{className:f.iconRow,children:[i.jsx("button",{type:"button",className:f.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":h("commandBulletListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ul"?null:"ul";p({...t,list:P,listMixed:!1})},children:i.jsx(wm,{})}),i.jsx("button",{type:"button",className:f.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":h("commandNumberedListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ol"?null:"ol";p({...t,list:P,listMixed:!1})},children:i.jsx(Sm,{})})]})]})]}):null,e==="spacing"?i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:h("paragraphDialogSpacing")}),i.jsx(Gd,{legend:h("paragraphDialogMargin"),sides:t.margin,linked:k,disabled:n,allowNegative:!0,onLinkedChange:P=>{S(P),P&&p({...t,margin:Fr(Vd(t.margin)),marginMixed:!1})},onSideChange:(P,R)=>A("margin",k,P,R)}),i.jsx(Gd,{legend:h("paragraphDialogPadding"),sides:t.padding,linked:D,disabled:n,onLinkedChange:P=>{I(P),P&&p({...t,padding:Fr(Vd(t.padding)),paddingMixed:!1})},onSideChange:(P,R)=>A("padding",D,P,R)}),i.jsx(PP,{value:t.lineHeight,disabled:n,onChange:P=>{p({...t,lineHeight:P,lineHeightMixed:!1})}}),i.jsxs("fieldset",{className:f.nestedGroup,children:[i.jsx("legend",{className:f.subLabel,children:h("paragraphDialogPageBreaks")}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:w,children:h("paragraphDialogBreakInside")}),i.jsx("select",{id:w,className:f.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:P=>{p({...t,breakInside:P.target.value,breakInsideMixed:!1})},children:Km.map(P=>i.jsx("option",{value:P,children:h(vP[P])},P))})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:y,children:h("paragraphDialogBreakAfter")}),i.jsx("select",{id:y,className:f.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:P=>{p({...t,breakAfter:P.target.value,breakAfterMixed:!1})},children:Os.map(P=>i.jsx("option",{value:P,children:h(Wd[P])},P))})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:v,children:h("paragraphDialogBreakBefore")}),i.jsx("select",{id:v,className:f.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:P=>{p({...t,breakBefore:P.target.value,breakBeforeMixed:!1})},children:Os.map(P=>i.jsx("option",{value:P,children:h(Wd[P])},P))})]})]})]}):null,e==="border"?i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:h("paragraphDialogBorder")}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:b,children:h("paragraphDialogBorderStyle")}),i.jsx("select",{id:b,className:f.select,value:t.border.style,disabled:n,onChange:P=>{const R=P.target.value;p({...t,border:{style:R,width:R==="none"?null:t.border.width??wP,color:R==="none"?null:t.border.color},borderMixed:!1})},children:Vi.map(P=>i.jsx("option",{value:P,children:h(yP[P])},P))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(je,{label:h("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:P=>{p({...t,border:{...t.border,width:P},borderMixed:!1})}}),i.jsx(ut,{label:h("paragraphDialogBorderColor"),noneLabel:h("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:P=>{p({...t,border:{...t.border,color:P},borderMixed:!1})}})]}):null,i.jsx(je,{label:h("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:P=>{p({...t,borderRadius:P,radiusMixed:!1})}}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{p({...t,boxShadow:t.boxShadow?null:CP,shadowMixed:!1})}}),h("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(sc,{shadow:t.boxShadow,disabled:n,onChange:P=>{p({...t,boxShadow:P,shadowMixed:!1})}}):null]}):null,e==="background"?i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:h("paragraphDialogTabBackground")}),i.jsx(ut,{label:h("paragraphDialogBackgroundColor"),noneLabel:h("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:P=>{p({...t,backgroundColor:P,backgroundMixed:!1})}}),i.jsx(SP,{value:t.opacity,disabled:n,onChange:P=>{p({...t,opacity:P,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&d?i.jsx(gP,{value:a,disabled:n,customImagePicker:s,onCustomImagePick:u,onChange:d}):null]})]})}function SP({value:e,disabled:t,onChange:n}){const r=q(),o=c.useId(),a=e===null?null:Pi(e),[s,u]=c.useState(()=>a===null?"":ie(a)),[d,g]=c.useState(!1);c.useEffect(()=>{d||u(a===null?"":ie(a))},[a,d]);const p=h=>{const x=h.trim();if(!x){n(null),u("");return}const b=Number(x.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":ie(a));return}const w=Xm(b);n(w),u(ie(Pi(w)))};return i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:f.lengthRow,children:[i.jsx("input",{id:o,className:f.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>g(!0),onChange:h=>u(h.target.value),onBlur:()=>{g(!1),p(s)}}),i.jsx("span",{className:f.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function Gd({legend:e,sides:t,linked:n,disabled:r,allowNegative:o=!1,onLinkedChange:a,onSideChange:s}){const u=q(),d=n?["top"]:Fe;return i.jsxs("fieldset",{className:f.nestedGroup,children:[i.jsx("legend",{className:f.subLabel,children:e}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),u("paragraphDialogLinkSides")]}),i.jsx("div",{className:f.sideGrid,children:d.map(g=>i.jsx(je,{label:n?e:u(bP[g]),value:t[g],disabled:r,allowNegative:o,onChange:p=>s(g,p)},g))})]})}function PP({value:e,disabled:t,onChange:n}){const r=q(),o=c.useId(),a=AP(e),s=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,d]=c.useState(()=>s===null?"":ie(s)),g=(e==null?void 0:e.kind)==="length"?e.unit:kl;return i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:o,children:r("paragraphDialogLineHeight")}),i.jsxs("div",{className:f.lengthRow,children:[i.jsx("input",{id:o,className:f.lengthInput,value:a==="normal"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:p=>d(p.target.value),onBlur:()=>{const p=u.trim();if(!p){n(null);return}if(a==="number"||a==="empty"){const x=Number(p.replace(",","."));if(!Number.isFinite(x)||x<0){d(s===null?"":ie(s));return}n({kind:"number",value:x}),d(ie(x));return}const h=Vr(p,g,!1);if(!h){d(s===null?"":ie(s));return}n({kind:"length",value:h.value,unit:h.unit}),d(ie(h.value))}}),i.jsxs("select",{className:f.lengthUnit,value:a==="length"?g:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:p=>{const h=p.target.value;if(h==="empty"){n(null),d("");return}if(h==="normal"){n({kind:"normal"}),d("");return}if(h==="number"){const y=Number((u||"1.5").replace(",",".")),v=Number.isFinite(y)&&y>=0?y:1.5;n({kind:"number",value:v}),d(ie(v));return}const x=h,b=Vr(u||"1",x,!1),w=(b==null?void 0:b.value)??1;n({kind:"length",value:w,unit:x}),d(ie(w))},children:[i.jsx("option",{value:"empty"}),i.jsx("option",{value:"normal",children:r("paragraphDialogLineHeightNormal")}),i.jsx("option",{value:"number",children:r("paragraphDialogLineHeightUnitless")}),["pt","px","em","rem","%"].map(p=>i.jsx("option",{value:p,children:r(xP[p])},p))]})]})]})}function AP(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}const qd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function DP({open:e,tab:t,value:n,backgroundImage:r,disabled:o,customImagePicker:a,onCustomImagePick:s,onTabChange:u,onApply:d,onClose:g}){const p=q(),h=c.useId(),x=c.useRef(null),[b,w]=c.useState(n),[y,v]=c.useState(r);return c.useEffect(()=>{e&&(w(n),v(r??zt()))},[e,n,r]),c.useEffect(()=>{if(!e)return;const k=x.current,S=k==null?void 0:k.querySelector(qd);S==null||S.focus();const D=I=>{if(I.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;I.preventDefault(),I.stopPropagation(),g();return}if(I.key!=="Tab"||!k)return;const A=[...k.querySelectorAll(qd)];if(A.length===0)return;const P=A[0],R=A[A.length-1];I.shiftKey&&document.activeElement===P?(I.preventDefault(),R.focus()):!I.shiftKey&&document.activeElement===R&&(I.preventDefault(),P.focus())};return document.addEventListener("keydown",D,!0),()=>document.removeEventListener("keydown",D,!0)},[e,g]),e?i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:g,children:i.jsxs("div",{ref:x,className:`${f.dialog} ${f.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":h,onMouseDown:k=>k.stopPropagation(),children:[i.jsx("h2",{className:f.header,id:h,children:p("paragraphDialogTitle")}),i.jsx(lc,{tab:t,value:b,disabled:o,backgroundImage:y,customImagePicker:a,onCustomImagePick:s,onBackgroundImageChange:v,onTabChange:u,onChange:w}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:g,children:p("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:o,onClick:()=>d({value:b,backgroundImage:y}),children:p("fontDialogOk")})]})]})})}):null}const RP=["auto","A4","letter","legal","custom"],EP={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},jP={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Zd(e){return e===null?"":ie(e.value)}function TP({value:e,disabled:t,onChange:n,onReset:r}){const o=q(),a=c.useId(),[s,u]=c.useState(!0),d=e??nn(),g=(p,h)=>{if(s){n({...d,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...d,margin:{...d.margin,[p]:h},marginMixed:!1})};return i.jsxs("div",{className:f.body,children:[i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:a,children:o("pageAtRuleSize")}),i.jsx("select",{id:a,className:f.select,disabled:t,value:d.sizePreset,onChange:p=>n({...d,sizePreset:p.target.value}),children:RP.map(p=>i.jsx("option",{value:p,children:o(EP[p])},p))})]}),d.sizePreset==="custom"?i.jsxs("div",{className:f.sideGrid,children:[i.jsx(Ts,{label:o("pageAtRuleWidth"),value:d.customWidth,disabled:t,onChange:p=>n({...d,customWidth:p})}),i.jsx(Ts,{label:o("pageAtRuleHeight"),value:d.customHeight,disabled:t,onChange:p=>n({...d,customHeight:p})})]}):null,i.jsxs("div",{className:f.field,children:[i.jsx("span",{className:f.label,children:o("pageAtRuleOrientation")}),i.jsx("div",{className:f.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([p,h])=>i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"radio",name:"page-orientation",checked:(d.orientation??"none")===p,disabled:t,onChange:()=>n({...d,orientation:p==="none"?null:p})}),o(h)]},p))})]}),i.jsxs("fieldset",{className:f.nestedGroup,children:[i.jsx("legend",{className:f.subLabel,children:o("pageAtRuleMargins")}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:s,disabled:t,onChange:()=>u(!s)}),o("paragraphDialogLinkSides")]}),i.jsx("div",{className:f.sideGrid,children:(s?["top"]:Fe).map(p=>i.jsx(Ts,{label:o(s?"pageAtRuleMargins":jP[p]),value:d.margin[p],disabled:t,onChange:h=>g(p,h)},p))})]}),i.jsx("div",{className:f.actions,children:i.jsx("button",{type:"button",className:f.action,disabled:t,"aria-label":o("pageAtRuleResetAria"),onClick:r,children:o("pageAtRuleReset")})})]})}function Ts({label:e,value:t,disabled:n,onChange:r}){const o=q(),a=c.useId(),[s,u]=c.useState(()=>Zd(t)),d=(t==null?void 0:t.unit)??kl;return i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:a,children:e}),i.jsxs("div",{className:f.lengthRow,children:[i.jsx("input",{id:a,className:f.lengthInput,value:s,disabled:n,inputMode:"decimal",onChange:g=>u(g.target.value),onBlur:()=>{const g=s.trim();if(!g){r(null);return}const p=Vr(g,d,!1);if(!p){u(Zd(t));return}r(p),u(ie(p.value))}}),i.jsxs("select",{className:f.lengthUnit,disabled:n,value:d,"aria-label":o("paragraphDialogLengthUnitAria"),onChange:g=>{const p=g.target.value;t&&r({...t,unit:p})},children:[i.jsx("option",{value:"pt",children:o("fontSizeUnitPt")}),i.jsx("option",{value:"px",children:o("fontSizeUnitPx")}),i.jsx("option",{value:"em",children:o("fontSizeUnitEm")}),i.jsx("option",{value:"rem",children:o("fontSizeUnitRem")}),i.jsx("option",{value:"%",children:o("fontSizeUnitPercent")})]})]})]})}const Yd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',NP=qg.map(e=>e.id);function IP(e){return{...Qn(),...e}}function MP(e){const{align:t,alignMixed:n,list:r,listMixed:o,...a}=e;return a}function _P({open:e,tab:t,value:n,fonts:r,disabled:o,printTabVisible:a=!1,initialParagraphTab:s="spacing",customImagePicker:u,onCustomImagePick:d,onTabChange:g,onApply:p,onResetAtRule:h,onClose:x}){const b=q(),w=c.useId(),y=c.useRef(null),[v,k]=c.useState("general"),[S,D]=c.useState("spacing"),[I,A]=c.useState(n.font),[P,R]=c.useState(n.box),[L,E]=c.useState(n.backgroundImage),[N,j]=c.useState(n.atRule??nn());if(c.useEffect(()=>{e&&(k("general"),D(s==="general"?"spacing":s),A(n.font),R(n.box),E(n.backgroundImage??zt()),j(n.atRule??nn()),t==="print"&&!a&&g("font"))},[e,n,t,a,s,g]),c.useEffect(()=>{if(!e)return;const $=y.current,Z=$==null?void 0:$.querySelector(Yd);Z==null||Z.focus();const ne=X=>{if(X.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;X.preventDefault(),X.stopPropagation(),x();return}if(X.key!=="Tab"||!$)return;const Y=[...$.querySelectorAll(Yd)];if(Y.length===0)return;const ae=Y[0],te=Y[Y.length-1];X.shiftKey&&document.activeElement===ae?(X.preventDefault(),te.focus()):!X.shiftKey&&document.activeElement===te&&(X.preventDefault(),ae.focus())};return document.addEventListener("keydown",ne,!0),()=>document.removeEventListener("keydown",ne,!0)},[e,x]),!e)return null;const M=b("pageDialogTitle"),F=t==="print"&&!a?"font":t;return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:x,children:i.jsxs("div",{ref:y,className:`${f.dialog} ${f.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":w,onMouseDown:$=>$.stopPropagation(),children:[i.jsx("h2",{className:f.header,id:w,children:M}),i.jsxs("div",{className:f.tabs,role:"tablist","aria-label":M,children:[i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":F==="font",onClick:()=>g("font"),children:b("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":F==="paragraph",onClick:()=>g("paragraph"),children:b("customStyleDialogTabParagraph")}),a?i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":F==="print",onClick:()=>g("print"),children:b("pageDialogTabPrint")}):null]}),F==="font"?i.jsx("div",{className:f.nestedPanel,children:i.jsx(ac,{tab:v,value:I,fonts:r,disabled:o,onTabChange:k,onChange:A})}):F==="paragraph"?i.jsx("div",{className:f.nestedPanel,children:i.jsx(lc,{tab:S,value:IP(P),disabled:o,tabs:NP,tablistLabelKey:"pageDialogTitle",backgroundImage:L,customImagePicker:u,onCustomImagePick:d,onBackgroundImageChange:E,onTabChange:$=>{$!=="general"&&D($)},onChange:$=>R(MP($))})}):i.jsx("div",{className:f.nestedPanel,children:i.jsx(TP,{value:N,disabled:o,onChange:j,onReset:()=>{j(nn()),h==null||h()}})}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:x,children:b("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:o,onClick:()=>p({font:I,box:P,backgroundImage:L,atRule:a?N:n.atRule??nn()}),children:b("fontDialogOk")})]})]})})})}function LP({open:e,disabled:t,onClose:n,onConfirm:r}){const o=q(),a=c.useId(),s=c.useRef(null);if(c.useEffect(()=>{if(!e)return;const d=s.current;if(!d)return;const g=d.querySelector('button:not([disabled]):not([tabindex="-1"])');g==null||g.focus();const p=h=>{h.key==="Escape"&&(h.preventDefault(),n())};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[e,n]),!e)return null;const u=!!t;return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:s,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:a,children:o("deletePageDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":o("fontDialogCloseAria"),onClick:n,children:i.jsx(Be,{})})]}),i.jsx("div",{className:f.confirmBody,children:o("deletePageConfirmMessage")}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,disabled:u,onClick:n,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionDanger}`,disabled:u,onClick:r,children:o("commandDeletePage")})]})]})})})}const Xd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function FP(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Jd(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 BP(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 HP({open:e,mode:t,styleId:n,name:r="",font:o,paragraph:a,canDelete:s=!1,busy:u,disabled:d,fonts:g,defaultOuterTab:p="font",onSave:h,onDelete:x,onClose:b}){const w=q(),y=c.useId(),v=c.useId(),k=c.useRef(null),[S,D]=c.useState(r),[I,A]=c.useState(p),[P,R]=c.useState("general"),[L,E]=c.useState("general"),[N,j]=c.useState(()=>Jd(o)),[M,F]=c.useState(()=>tl(a)),[$,Z]=c.useState(!1);if(c.useEffect(()=>{e&&(D(r),A(p),R("general"),E("general"),j(Jd(o)),F(tl(a)),Z(!1))},[e,r,o,a,p]),c.useEffect(()=>{if(!e)return;const te=k.current,U=te==null?void 0:te.querySelector(Xd);U==null||U.focus();const T=V=>{if(V.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;if(V.preventDefault(),V.stopPropagation(),$){Z(!1);return}b();return}if(V.key!=="Tab"||!te)return;const Q=[...te.querySelectorAll(Xd)];if(Q.length===0)return;const G=Q[0],ve=Q[Q.length-1];V.shiftKey&&document.activeElement===G?(V.preventDefault(),ve.focus()):!V.shiftKey&&document.activeElement===ve&&(V.preventDefault(),G.focus())};return document.addEventListener("keydown",T,!0),()=>document.removeEventListener("keydown",T,!0)},[e,b,$]),!e)return null;const ne=w(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),X=S.trim().length>0,Y=!!(d||u),ae=()=>{const te=S.trim();te&&h({id:n??FP(),name:te,font:BP(N),paragraph:lg(M)})};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:k,className:`${f.dialog} ${f.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,"aria-busy":u||void 0,onMouseDown:te=>te.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:y,children:ne}),i.jsx("button",{type:"button",className:f.close,"aria-label":w("customStyleDialogCloseAria"),onClick:b,children:i.jsx(Be,{})})]}),$?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:f.confirmBody,children:w("customStyleDialogDeleteConfirm")}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,disabled:Y,onClick:()=>Z(!1),children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionDanger}`,disabled:Y||!n,onClick:()=>{n&&(x==null||x(n))},children:w("customStyleDialogDelete")})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:f.nameSection,children:i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:v,children:w("customStyleDialogName")}),i.jsx("input",{id:v,className:f.nameInput,value:S,disabled:Y,onChange:te=>D(te.target.value)})]})}),i.jsxs("div",{className:f.tabs,role:"tablist","aria-label":ne,children:[i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":I==="font",onClick:()=>A("font"),children:w("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":I==="paragraph",onClick:()=>A("paragraph"),children:w("customStyleDialogTabParagraph")})]}),I==="font"?i.jsx("div",{className:f.nestedPanel,children:i.jsx(ac,{tab:P,value:N,fonts:g,disabled:Y,onTabChange:R,onChange:j})}):i.jsx("div",{className:f.nestedPanel,children:i.jsx(lc,{tab:L,value:M,disabled:Y,onTabChange:E,onChange:F})}),i.jsxs("div",{className:t==="edit"&&s?`${f.actions} ${f.actionsSpread}`:f.actions,children:[t==="edit"&&s?i.jsx("button",{type:"button",className:`${f.action} ${f.actionDanger}`,disabled:Y,onClick:()=>Z(!0),children:w("customStyleDialogDelete")}):null,i.jsxs("div",{className:f.actionsEnd,children:[i.jsx("button",{type:"button",className:f.action,onClick:b,children:w("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:Y||!X,onClick:ae,children:w("fontDialogOk")})]})]})]})]})})})}const zP='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function OP({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=q(),s=c.useId(),u=c.useId(),d=c.useRef(null),g=c.useRef(null),[p,h]=c.useState(t);if(c.useEffect(()=>{e&&h(t)},[e,t]),c.useEffect(()=>{var y;if(!e)return;(y=g.current)==null||y.focus();const b=d.current,w=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),o();return}if(v.key!=="Tab"||!b)return;const k=[...b.querySelectorAll(zP)];if(k.length===0)return;const S=k[0],D=k[k.length-1];v.shiftKey&&document.activeElement===S?(v.preventDefault(),D.focus()):!v.shiftKey&&document.activeElement===D&&(v.preventDefault(),S.focus())};return document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[e,o]),!e)return null;const x=()=>{n||r(p)};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:d,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:s,children:a("customCssDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":a("customCssDialogCloseAria"),onClick:o,children:i.jsx(Be,{})})]}),i.jsx("div",{className:f.body,children:i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:u,children:a("customCssDialogField")}),i.jsx("textarea",{ref:g,id:u,className:f.textarea,value:p,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:b=>h(b.target.value)})]})}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:n,onClick:x,children:a("fontDialogOk")})]})]})})})}const Qd='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])',$P={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function KP({open:e,existingIds:t,disabled:n,onApply:r,onClose:o}){const a=q(),s=c.useId(),u=c.useId(),d=c.useId(),g=c.useRef(null),[p,h]=c.useState(""),[x,b]=c.useState(!1),w=c.useMemo(()=>new Set(t),[t]),y=Dg(p,w);if(c.useEffect(()=>{e&&(h(""),b(!1))},[e]),c.useEffect(()=>{if(!e)return;const D=g.current,I=D==null?void 0:D.querySelector(Qd);I==null||I.focus();const A=P=>{if(P.key==="Escape"){P.preventDefault(),P.stopPropagation(),o();return}if(P.key!=="Tab"||!D)return;const R=[...D.querySelectorAll(Qd)];if(R.length===0)return;const L=R[0],E=R[R.length-1];P.shiftKey&&document.activeElement===L?(P.preventDefault(),E.focus()):!P.shiftKey&&document.activeElement===E&&(P.preventDefault(),L.focus())};return document.addEventListener("keydown",A,!0),()=>document.removeEventListener("keydown",A,!0)},[e,o]),!e)return null;const v=x||p.trim().length>0?y:null,k=y===null&&!n,S=()=>{b(!0),!(y||n)&&r(p.trim())};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:g,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:D=>D.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:s,children:a("bookmarkDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:o,children:i.jsx(Be,{})})]}),i.jsx("div",{className:f.body,children:i.jsxs("div",{className:f.field,children:[i.jsxs("div",{className:f.labelRow,children:[i.jsx("label",{className:f.label,htmlFor:u,children:a("bookmarkDialogName")}),i.jsx(cn,{label:a("bookmarkDialogHelp"),elevated:!0,children:i.jsx("button",{type:"button",className:f.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),i.jsx("input",{id:u,className:f.textInput,value:p,disabled:n,"aria-invalid":v!==null,"aria-describedby":v?d:void 0,onChange:D=>h(D.target.value)}),v?i.jsx("p",{id:d,className:f.error,children:a($P[v])}):null]})}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:!k,onClick:S,children:a("fontDialogOk")})]})]})})})}const em='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',UP={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},WP={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function VP({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=q(),u=c.useId(),d=c.useId(),g=c.useId(),p=c.useId(),h=c.useRef(null),x=c.useRef(null),[b,w]=c.useState("file"),[y,v]=c.useState(""),[k,S]=c.useState(""),[D,I]=c.useState(""),[A,P]=c.useState(""),[R,L]=c.useState(null),[E,N]=c.useState(!1);if(c.useEffect(()=>{e&&(w("file"),v(""),S(""),I(""),P(""),L(null),N(!1),x.current&&(x.current.value=""))},[e]),c.useEffect(()=>{if(!e)return;const Y=h.current,ae=Y==null?void 0:Y.querySelector(em);ae==null||ae.focus();const te=U=>{if(U.key==="Escape"){U.preventDefault(),U.stopPropagation(),a();return}if(U.key!=="Tab"||!Y)return;const T=[...Y.querySelectorAll(em)];if(T.length===0)return;const V=T[0],Q=T[T.length-1];U.shiftKey&&document.activeElement===V?(U.preventDefault(),Q.focus()):!U.shiftKey&&document.activeElement===Q&&(U.preventDefault(),V.focus())};return document.addEventListener("keydown",te,!0),()=>document.removeEventListener("keydown",te,!0)},[e,a]),!e)return null;const j=b==="file"?k:b==="url"?y:"",M=b==="custom"?null:oc(j),F=b==="custom"?null:b==="file"&&R?WP[R]:M&&(b==="file"||y.trim().length>0)?UP[M]:null,$=b!=="custom"&&M===null&&!(b==="file"&&R)&&!t&&!E,Z=()=>{t||!n||o==null||o()},ne=()=>{$&&r({src:j.trim(),title:A.trim()})},X=Y=>{var te;const ae=(te=Y.target.files)==null?void 0:te[0];ae&&(N(!0),L(null),w0(ae).then(U=>{S(U),I(ae.name),w("file"),N(!1)},U=>{const T=U instanceof Error?U.message:"";S(""),I(""),w("file"),L(T==="tooLarge"||T==="type"?T:"type"),N(!1),x.current&&(x.current.value="")}))};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:Y=>Y.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:u,children:s("audioDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":s("audioDialogCloseAria"),onClick:a,children:i.jsx(Be,{})})]}),i.jsxs("div",{className:f.body,children:[i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:f.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":b==="file",disabled:t,onClick:()=>w("file"),children:s("audioDialogFile")}),i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":b==="url",disabled:t,onClick:()=>w("url"),children:s("audioDialogUrl")}),n?i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":b==="custom",disabled:t,onClick:()=>w("custom"),children:n.text}):null]}),b==="file"?i.jsxs("div",{className:f.fileRow,children:[i.jsx("input",{ref:x,type:"file",accept:f0,hidden:!0,disabled:t,"aria-label":s("audioDialogChooseFile"),onChange:X}),i.jsx("button",{type:"button",className:f.action,disabled:t||E,onClick:()=>{var Y;return(Y=x.current)==null?void 0:Y.click()},children:s("audioDialogChooseFile")}),D?i.jsx("span",{className:f.fileName,children:D}):null]}):null,b==="url"?i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:d,children:s("audioDialogUrl")}),i.jsx("input",{id:d,className:f.textInput,value:y,disabled:t,"aria-invalid":F!==null,"aria-describedby":F?p:void 0,onChange:Y=>v(Y.target.value)})]}):null,b==="custom"&&n?i.jsxs("div",{className:f.field,children:[i.jsx("p",{className:f.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:f.action,disabled:t,onClick:Z,children:n.buttonCaption})]}):null]}),b!=="custom"?i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:g,children:s("audioDialogTitleField")}),i.jsx("input",{id:g,className:f.textInput,value:A,disabled:t,onChange:Y=>P(Y.target.value)})]}):null,F?i.jsx("p",{id:p,className:f.error,children:s(F)}):null]}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:a,children:s("fontDialogCancel")}),b!=="custom"?i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:!$,onClick:ne,children:s("fontDialogOk")}):null]})]})})})}const tm='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])';function GP({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=q(),u=c.useId(),d=c.useId(),g=c.useId(),p=c.useRef(null),[h,x]=c.useState(""),[b,w]=c.useState(""),[y,v]=c.useState(""),[k,S]=c.useState("file");if(c.useEffect(()=>{e&&(x(""),w(""),v(""),S("file"))},[e]),c.useEffect(()=>{if(!e)return;const A=p.current,P=A==null?void 0:A.querySelector(tm);P==null||P.focus();const R=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),a();return}if(L.key!=="Tab"||!A)return;const E=[...A.querySelectorAll(tm)];if(E.length===0)return;const N=E[0],j=E[E.length-1];L.shiftKey&&document.activeElement===N?(L.preventDefault(),j.focus()):!L.shiftKey&&document.activeElement===j&&(L.preventDefault(),N.focus())};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[e,a]),!e)return null;const D=mP(h)&&!t,I=()=>{D&&r({src:h.trim(),alt:b.trim(),title:y.trim()})};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:p,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:A=>A.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:u,children:s("imageDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":s("imageDialogCloseAria"),onClick:a,children:i.jsx(Be,{})})]}),i.jsxs("div",{className:f.body,children:[i.jsx(Yg,{src:h,disabled:t,customImagePicker:n,onCustomPick:o,onSourceChange:S,onSrcChange:x}),k!=="custom"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:d,children:s("imageDialogAlt")}),i.jsx("input",{id:d,className:f.textInput,value:b,disabled:t,onChange:A=>w(A.target.value)})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:g,children:s("imageDialogTitleField")}),i.jsx("input",{id:g,className:f.textInput,value:y,disabled:t,onChange:A=>v(A.target.value)})]})]}):null]}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:a,children:s("fontDialogCancel")}),k!=="custom"?i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:!D,onClick:I,children:s("fontDialogOk")}):null]})]})})})}const qP=[{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}],ZP={left:Ki,center:$i,right:Ui},YP=["left","center","right"],XP={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},JP=["width","height","lock"],QP={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},eA={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},tA={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},nA={value:1,unit:"pt"},rA={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 Ns(e){return{top:e,right:e,bottom:e,left:e}}function oA(e){for(const t of Fe)if(e[t])return e[t];return null}function iA({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:o,onChange:a}){const s=q(),u=c.useId(),d=c.useId(),g=c.useId(),[p,h]=c.useState(()=>Ot(t.margin,Ns(t.margin.top))),x=t.align==="center",b=(y,v)=>{if(t.sizeMode==="lock"&&v){const k=Kr(y,v,n);a({...t,width:k.width,height:k.height});return}a({...t,[y]:v})},w=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 v=Kr("width",t.width,n);a({...t,sizeMode:y,width:v.width,height:v.height});return}if(t.height){const v=Kr("height",t.height,n);a({...t,sizeMode:y,width:v.width,height:v.height});return}a({...t,sizeMode:y})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:f.tabs,role:"tablist","aria-label":s("imagePropertiesDialogTitle"),children:qP.map(y=>i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":y.id===e,disabled:!y.implemented,onClick:()=>o(y.id),children:s(y.labelKey)},y.id))}),i.jsxs("div",{className:f.body,role:"tabpanel",children:[e==="general"?i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:s("imagePropertiesSize")}),i.jsx("div",{className:f.iconRow,role:"radiogroup","aria-label":s("imagePropertiesSizeMode"),children:JP.map(y=>i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":t.sizeMode===y,disabled:r,onClick:()=>w(y),children:s(QP[y])},y))}),i.jsx(Bi,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:y=>b("width",y)}),i.jsx(Bi,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:y=>b("height",y)})]}):null,e==="alignment"?i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:s("paragraphDialogAlignment")}),i.jsx("div",{className:f.iconRow,role:"radiogroup","aria-label":s("paragraphDialogAlignment"),children:YP.map(y=>{const v=ZP[y];return i.jsx("button",{type:"button",className:f.iconButton,role:"radio","aria-checked":t.align===y,"aria-label":s(XP[y]),disabled:r,onClick:()=>{a({...t,align:t.align===y?null:y})},children:i.jsx(v,{})},y)})})]}):null,e==="border"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:s("paragraphDialogMargin")}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:p,disabled:r||x,onChange:()=>{const y=!p;h(y),y&&a({...t,margin:Ns(oA(t.margin))})}}),s("paragraphDialogLinkSides")]}),i.jsx("div",{className:f.sideGrid,children:(p?["top"]:Fe).map(y=>i.jsx(je,{label:s(p?"paragraphDialogMargin":eA[y]),value:t.margin[y],disabled:r||x&&(y==="left"||y==="right"),allowNegative:!0,onChange:v=>{const k=p?Ns(v):{...t.margin,[y]:v};a({...t,margin:k})}},y))})]}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:s("paragraphDialogBorder")}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:u,children:s("paragraphDialogBorderStyle")}),i.jsx("select",{id:u,className:f.select,value:t.border.style,disabled:r,onChange:y=>{const v=y.target.value;a({...t,border:{style:v,width:v==="none"?null:t.border.width??nA,color:v==="none"?null:t.border.color}})},children:Vi.map(y=>i.jsx("option",{value:y,children:s(tA[y])},y))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(je,{label:s("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:y=>{a({...t,border:{...t.border,width:y}})}}),i.jsx(ut,{label:s("paragraphDialogBorderColor"),noneLabel:s("colorNone"),value:t.border.color,disabled:r,onChange:y=>{a({...t,border:{...t.border,color:y}})}})]}):null,i.jsx(je,{label:s("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:y=>{a({...t,borderRadius:y})}}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:rA})}}),s("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(sc,{shadow:t.boxShadow,disabled:r,onChange:y=>{a({...t,boxShadow:y})}}):null]})]}):null,e==="advanced"?i.jsxs(i.Fragment,{children:[i.jsx(Zg,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:y=>{a(Rw({...t,opacity:y.opacity,objectFit:y.fit,objectPosition:y.position},n))}}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:s("imagePropertiesRotation")}),i.jsx("div",{className:f.field,children:i.jsxs("div",{className:f.lengthRow,children:[i.jsx("input",{id:d,className:f.lengthInput,value:t.rotateDeg===null?"":ie(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":s("imagePropertiesRotation"),onChange:y=>{const v=y.target.value.trim();if(!v){a({...t,rotateDeg:null});return}const k=Number(v.replace(",","."));Number.isFinite(k)&&a({...t,rotateDeg:k})}}),i.jsx("span",{className:f.lengthUnit,"aria-hidden":"true",children:s("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:s("imagePropertiesTabHover")}),i.jsx("p",{className:f.emptyHint,children:s("imagePropertiesHoverHelp")}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:g,children:s("imagePropertiesHoverCss")}),i.jsx("textarea",{id:g,className:f.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":s("imagePropertiesHoverCssAria"),onChange:y=>{a({...t,hoverCss:y.target.value})}})]})]}):null]})]})}const nm='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function aA({open:e,tab:t,value:n,aspectRatio:r=1,disabled:o,onTabChange:a,onApply:s,onClose:u}){const d=q(),g=c.useId(),p=c.useRef(null),[h,x]=c.useState(n);return c.useEffect(()=>{e&&x(n)},[e,n]),c.useEffect(()=>{if(!e)return;const b=p.current,w=b==null?void 0:b.querySelector(nm);w==null||w.focus();const y=v=>{if(v.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;v.preventDefault(),v.stopPropagation(),u();return}if(v.key!=="Tab"||!b)return;const k=[...b.querySelectorAll(nm)];if(k.length===0)return;const S=k[0],D=k[k.length-1];v.shiftKey&&document.activeElement===S?(v.preventDefault(),D.focus()):!v.shiftKey&&document.activeElement===D&&(v.preventDefault(),S.focus())};return document.addEventListener("keydown",y,!0),()=>document.removeEventListener("keydown",y,!0)},[e,u]),e?i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:u,children:i.jsxs("div",{ref:p,className:`${f.dialog} ${f.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":g,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:g,children:d("imagePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":d("imagePropertiesDialogCloseAria"),onClick:u,children:i.jsx(Be,{})})]}),i.jsx(iA,{tab:t,value:h,aspectRatio:r,disabled:o,onTabChange:a,onChange:x}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:u,children:d("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:o,onClick:()=>s(h),children:d("fontDialogOk")})]})]})})}):null}const sA="_frame_bwkh8_1",lA="_handle_bwkh8_9",cA="_handleEast_bwkh8_29",uA="_handleSouth_bwkh8_37",dA="_handleSouthEast_bwkh8_45",Ur={frame:sA,handle:lA,handleEast:cA,handleSouth:uA,handleSouthEast:dA};function Br(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const mA=[{handle:"e",className:Ur.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:Ur.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:Ur.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function Is(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function fA({img:e,onResize:t,onResizeEnd:n}){const r=q(),o=c.useRef(null),a=c.useRef(e),s=c.useRef(t),u=c.useRef(n),d=c.useRef(null);a.current=e,s.current=t,u.current=n;const g=k=>{const S=o.current;S&&(S.style.left=`${k.left}px`,S.style.top=`${k.top}px`,S.style.width=`${k.width}px`,S.style.height=`${k.height}px`)};c.useLayoutEffect(()=>{g(Br(e));const k=()=>{e.isConnected&&g(Br(e))};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[e]);const p=(k,S)=>{const D=d.current,I=a.current;if(!D||!I)return;const A=Q0(D.handle,D.start,{x:k-D.originX,y:S-D.originY});s.current(A.width,A.height),I.isConnected&&g(Br(I))},h=()=>{if(!d.current)return;d.current=null;const k=a.current;u.current(),k!=null&&k.isConnected&&g(Br(k))};c.useLayoutEffect(()=>{const k=D=>{if(!d.current)return;const I=Is(D);I&&p(I.x,I.y)},S=()=>{h()};return document.addEventListener("pointermove",k),document.addEventListener("pointerup",S),document.addEventListener("pointercancel",S),document.addEventListener("mousemove",k),document.addEventListener("mouseup",S),()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",S),document.removeEventListener("pointercancel",S),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",S)}},[]);const x=(k,S)=>{const D=Is(S);D&&(d.current={handle:k,start:ev(a.current),originX:D.x,originY:D.y})},b=k=>S=>{S.preventDefault(),S.stopPropagation(),x(k,S);try{S.currentTarget.setPointerCapture(S.pointerId)}catch{}},w=k=>S=>{S.preventDefault(),S.stopPropagation(),x(k,S)},y=k=>{const S=Is(k);S&&p(S.x,S.y)};if(!e.isConnected)return null;const v=Br(e);return hl.createPortal(i.jsx("div",{ref:o,className:Ur.frame,"data-image-resize-overlay":"",style:{left:v.left,top:v.top,width:v.width,height:v.height},children:mA.map(k=>i.jsx("button",{type:"button",className:`${Ur.handle} ${k.className}`,style:{cursor:k.cursor},"aria-label":r(k.ariaKey),"data-resize-handle":k.handle,onPointerDown:b(k.handle),onPointerMove:y,onPointerUp:h,onPointerCancel:h,onMouseDown:w(k.handle),onMouseMove:y,onMouseUp:h},k.handle))}),document.body)}const rm='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function gA({open:e,tab:t,href:n,title:r,targetBlank:o,textDecorationNone:a,hoverMode:s,hoverColor:u,hoverHtml:d,bookmarks:g,selectedBookmarkId:p,disabled:h,onTabChange:x,onApply:b,onClose:w}){const y=q(),v=c.useId(),k=c.useId(),S=c.useId(),D=c.useId(),I=c.useId(),A=c.useRef(null),[P,R]=c.useState(n),[L,E]=c.useState(r),[N,j]=c.useState(o),[M,F]=c.useState(a),[$,Z]=c.useState(s),[ne,X]=c.useState(u),[Y,ae]=c.useState(d),[te,U]=c.useState(p);if(c.useEffect(()=>{e&&(R(n),E(r),j(o),F(a),Z(s),X(u),ae(d),U(p))},[e,n,r,o,a,s,u,d,p]),c.useEffect(()=>{if(!e)return;const G=A.current,ve=G==null?void 0:G.querySelector(rm);ve==null||ve.focus();const He=_e=>{if(_e.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;_e.preventDefault(),_e.stopPropagation(),w();return}if(_e.key!=="Tab"||!G)return;const Ut=[...G.querySelectorAll(rm)];if(Ut.length===0)return;const bn=Ut[0],De=Ut[Ut.length-1];_e.shiftKey&&document.activeElement===bn?(_e.preventDefault(),De.focus()):!_e.shiftKey&&document.activeElement===De&&(_e.preventDefault(),bn.focus())};return document.addEventListener("keydown",He,!0),()=>document.removeEventListener("keydown",He,!0)},[e,w,t,$]),!e)return null;const T=()=>Qi({title:L,targetBlank:N,textDecorationNone:M,hoverMode:$,hoverColor:ne,hoverHtml:Y}),V=()=>{const G=P.trim();!G||h||b({...T(),href:G})},Q=()=>{!te||h||b({...T(),href:`#${te}`})};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:w,children:i.jsxs("div",{ref:A,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:G=>G.stopPropagation(),children:[i.jsx("h2",{className:f.header,id:v,children:y("linkDialogTitle")}),i.jsxs("div",{className:f.tabs,role:"tablist","aria-label":y("linkDialogTitle"),children:[i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":t==="link",onClick:()=>x("link"),children:y("linkDialogTabLink")}),i.jsx("button",{type:"button",className:f.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>x("bookmark"),children:y("linkDialogTabBookmark")})]}),i.jsxs("div",{className:f.body,role:"tabpanel",children:[t==="link"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:k,children:y("linkDialogHref")}),i.jsx("input",{id:k,className:f.textInput,value:P,disabled:h,onChange:G=>R(G.target.value)})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:S,children:y("linkDialogHoverTitle")}),i.jsx("input",{id:S,className:f.textInput,value:L,disabled:h,onChange:G=>E(G.target.value)})]}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:N,disabled:h,onChange:G=>j(G.target.checked)}),y("linkDialogTargetBlank")]})]}):g.length===0?i.jsx("p",{className:f.emptyHint,children:y("linkDialogBookmarkEmpty")}):i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:D,children:y("linkDialogBookmark")}),i.jsxs("select",{id:D,className:`${f.select} ${f.fullSelect}`,value:te,disabled:h,onChange:G=>U(G.target.value),children:[i.jsx("option",{value:""}),g.map(G=>i.jsx("option",{value:G.id,children:G.id},G.id))]})]}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:M,disabled:h,onChange:G=>F(G.target.checked)}),y("linkDialogTextDecorationNone")]}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.subLabel,children:y("linkDialogHover")}),i.jsxs("div",{className:f.sizeRow,role:"group","aria-label":y("linkDialogHover"),children:[i.jsx("button",{type:"button",className:f.action,"aria-pressed":$==="color",disabled:h,onClick:()=>Z("color"),children:y("linkDialogHoverColor")}),i.jsx("button",{type:"button",className:f.action,"aria-pressed":$==="html",disabled:h,onClick:()=>Z("html"),children:y("linkDialogHoverHtml")})]}),$==="color"?i.jsx(ut,{label:y("linkDialogHoverColorField"),noneLabel:y("colorNone"),value:ne,disabled:h,onChange:X}):i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:I,children:y("linkDialogHoverHtmlAria")}),i.jsx("textarea",{id:I,className:f.textarea,value:Y,disabled:h,spellCheck:!1,onChange:G=>ae(G.target.value)})]})]})]}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,disabled:h||!te,onClick:Q,children:y("linkDialogSelect")}),i.jsx("button",{type:"button",className:f.action,onClick:w,children:y("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:h||!P.trim(),onClick:V,children:y("fontDialogOk")})]})]})})})}const om='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',im={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function pA({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=q(),u=c.useId(),d=c.useId(),g=c.useId(),p=c.useId(),h=c.useRef(null),[x,b]=c.useState("url"),[w,y]=c.useState(""),[v,k]=c.useState("");if(c.useEffect(()=>{e&&(b("url"),y(""),k(""))},[e]),c.useEffect(()=>{if(!e)return;const R=h.current,L=R==null?void 0:R.querySelector(om);L==null||L.focus();const E=N=>{if(N.key==="Escape"){N.preventDefault(),N.stopPropagation(),a();return}if(N.key!=="Tab"||!R)return;const j=[...R.querySelectorAll(om)];if(j.length===0)return;const M=j[0],F=j[j.length-1];N.shiftKey&&document.activeElement===M?(N.preventDefault(),F.focus()):!N.shiftKey&&document.activeElement===F&&(N.preventDefault(),M.focus())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[e,a]),!e)return null;const S=x==="custom"?null:Mg(w),D=x==="custom"?null:S&&w.trim().length>0?im[S]:S==="empty"&&w.trim().length===0?null:S?im[S]:null,I=x!=="custom"&&S===null&&!t&&w.trim().length>0,A=()=>{t||!n||o==null||o()},P=()=>{I&&r({url:w.trim(),title:v.trim()})};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:R=>R.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:u,children:s("youtubeDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":s("youtubeDialogCloseAria"),onClick:a,children:i.jsx(Be,{})})]}),i.jsxs("div",{className:f.body,children:[i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:f.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":x==="url",disabled:t,onClick:()=>b("url"),children:s("youtubeDialogUrl")}),n?i.jsx("button",{type:"button",className:f.action,role:"radio","aria-checked":x==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),x==="url"?i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:d,children:s("youtubeDialogUrl")}),i.jsx("input",{id:d,className:f.textInput,value:w,disabled:t,"aria-invalid":D!==null,"aria-describedby":D?p:void 0,onChange:R=>y(R.target.value)})]}):null,x==="custom"&&n?i.jsxs("div",{className:f.field,children:[i.jsx("p",{className:f.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:f.action,disabled:t,onClick:A,children:n.buttonCaption})]}):null]}),x!=="custom"?i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:g,children:s("youtubeDialogTitleField")}),i.jsx("input",{id:g,className:f.textInput,value:v,disabled:t,onChange:R=>k(R.target.value)})]}):null,D?i.jsx("p",{id:p,className:f.error,children:s(D)}):null]}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:a,children:s("fontDialogCancel")}),x!=="custom"?i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:!I,onClick:P,children:s("fontDialogOk")}):null]})]})})})}const hA="_grid_1bpma_1",bA="_cell_1bpma_8",yA="_sizeLabel_1bpma_27",xA="_sizeFields_1bpma_33",wA="_numberInput_1bpma_37",Gn={grid:hA,cell:bA,sizeLabel:yA,sizeFields:xA,numberInput:wA},am='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])',tn={rows:3,cols:3};function CA({open:e,disabled:t,onApply:n,onClose:r}){const o=q(),a=c.useId(),s=c.useId(),u=c.useId(),d=c.useRef(null),[g,p]=c.useState(tn.rows),[h,x]=c.useState(tn.cols),[b,w]=c.useState(String(tn.rows)),[y,v]=c.useState(String(tn.cols)),[k,S]=c.useState(!1);if(c.useEffect(()=>{e&&(p(tn.rows),x(tn.cols),w(String(tn.rows)),v(String(tn.cols)),S(!1))},[e]),c.useEffect(()=>{if(!e)return;const E=d.current,N=E==null?void 0:E.querySelector(am);N==null||N.focus();const j=M=>{if(M.key==="Escape"){M.preventDefault(),M.stopPropagation(),r();return}if(M.key!=="Tab"||!E)return;const F=[...E.querySelectorAll(am)];if(F.length===0)return;const $=F[0],Z=F[F.length-1];M.shiftKey&&document.activeElement===$?(M.preventDefault(),Z.focus()):!M.shiftKey&&document.activeElement===Z&&(M.preventDefault(),$.focus())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[e,r]),!e)return null;const I=Qf(g,h)&&!t,A=(E,N)=>{const j=Math.min(Jn,Math.max(Xn,E)),M=Math.min(Jn,Math.max(Xn,N));p(j),x(M),w(String(j)),v(String(M))},P=(E,N)=>{const j=Number.parseInt(E,10);if(!Number.isFinite(j)){N==="rows"?w(String(g)):v(String(h));return}S(!0),N==="rows"?A(j,h):A(g,j)},R=(E,N)=>{const j=E.replace(/\D/g,"");if(N==="rows"?w(j):v(j),j==="")return;const M=Number.parseInt(j,10);Number.isFinite(M)&&(S(!0),N==="rows"?A(M,h):A(g,M))},L=E=>{(E.key==="e"||E.key==="E"||E.key==="+"||E.key==="-"||E.key===".")&&E.preventDefault()};return i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:d,className:f.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:E=>E.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:a,children:o("tableDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":o("tableDialogCloseAria"),onClick:r,children:i.jsx(Be,{})})]}),i.jsxs("div",{className:f.body,children:[i.jsx("div",{className:Gn.grid,role:"grid","aria-label":o("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:md},(E,N)=>Array.from({length:md},(j,M)=>{const F=N+1,$=M+1,Z=F<=g&&$<=h;return i.jsx("button",{type:"button",className:Gn.cell,role:"gridcell","data-active":Z?"true":void 0,"aria-label":`${F} × ${$}`,"aria-pressed":Z&&F===g&&$===h,disabled:t,onMouseEnter:()=>{k||A(F,$)},onClick:()=>{S(!0),A(F,$)}},`${F}-${$}`)}))}),i.jsxs("p",{className:Gn.sizeLabel,children:[o("tableDialogSize"),": ",g," × ",h]}),i.jsxs("div",{className:`${f.sizeRow} ${Gn.sizeFields}`,children:[i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:s,children:o("tableDialogRows")}),i.jsx("input",{id:s,className:Gn.numberInput,type:"number",inputMode:"numeric",min:Xn,max:Jn,step:1,value:b,disabled:t,onKeyDown:L,onChange:E=>R(E.target.value,"rows"),onBlur:()=>P(b,"rows")})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:u,children:o("tableDialogColumns")}),i.jsx("input",{id:u,className:Gn.numberInput,type:"number",inputMode:"numeric",min:Xn,max:Jn,step:1,value:y,disabled:t,onKeyDown:L,onChange:E=>R(E.target.value,"cols"),onBlur:()=>P(y,"cols")})]})]})]}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:r,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:!I,onClick:()=>{I&&n({rows:g,cols:h})},children:o("tableDialogInsert")})]})]})})})}const vA={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},kA={value:1,unit:"pt"},SA={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 PA({value:e,disabled:t,onChange:n}){const r=q(),o=c.useId(),a=c.useId();return i.jsxs("div",{className:f.body,children:[i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:r("tablePropertiesWidth")}),i.jsx(je,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:s=>n({...e,width:s})}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:o,children:r("tablePropertiesCollapse")}),i.jsxs("select",{id:o,className:f.select,value:e.borderCollapse,disabled:t,onChange:s=>{const u=s.target.value==="separate"?"separate":"collapse";n({...e,borderCollapse:u,borderSpacing:u==="separate"?e.borderSpacing:null})},children:[i.jsx("option",{value:"collapse",children:r("tablePropertiesCollapseCollapse")}),i.jsx("option",{value:"separate",children:r("tablePropertiesCollapseSeparate")})]})]}),e.borderCollapse==="separate"?i.jsx(je,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:s=>n({...e,borderSpacing:s})}):null]}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:r("paragraphDialogBorder")}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),i.jsx("select",{id:a,className:f.select,value:e.border.style,disabled:t,onChange:s=>{const u=s.target.value;n({...e,border:{style:u,width:u==="none"?null:e.border.width??kA,color:u==="none"?null:e.border.color}})},children:Vi.map(s=>i.jsx("option",{value:s,children:r(vA[s])},s))})]}),e.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(je,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:s=>n({...e,border:{...e.border,width:s}})}),i.jsx(ut,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:s=>n({...e,border:{...e.border,color:s}})})]}):null,i.jsx(je,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:s=>n({...e,borderRadius:s})}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:SA})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?i.jsx(sc,{shadow:e.boxShadow,disabled:t,onChange:s=>n({...e,boxShadow:s})}):null]})]})}const sm='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function AA({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=q(),s=c.useId(),u=c.useRef(null),[d,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(sm);h==null||h.focus();const x=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),o();return}if(b.key!=="Tab"||!p)return;const w=[...p.querySelectorAll(sm)];if(w.length===0)return;const y=w[0],v=w[w.length-1];b.shiftKey&&document.activeElement===y?(b.preventDefault(),v.focus()):!b.shiftKey&&document.activeElement===v&&(b.preventDefault(),y.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,o]),e?i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${f.dialog} ${f.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:p=>p.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:s,children:a("tablePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:o,children:i.jsx(Be,{})})]}),i.jsx(PA,{value:d,disabled:n,onChange:g}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const DA=["left","center","right"],RA={left:Ki,center:$i,right:Ui},EA={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},jA={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},TA={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function ui(e){return{top:e,right:e,bottom:e,left:e}}function Ms(e){for(const t of Fe)if(e[t])return e[t];return null}function NA({value:e,disabled:t,onChange:n}){const r=q(),o=c.useId(),a=c.useId(),s=c.useId(),[u,d]=c.useState(()=>Ot(e.padding,ui(Ms(e.padding))));return c.useEffect(()=>{d(Ot(e.padding,ui(Ms(e.padding))))},[e.padding]),i.jsxs("div",{className:f.body,children:[i.jsx(ut,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:g=>n({...e,backgroundColor:g})}),i.jsx(ut,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:g=>n({...e,color:g})}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:u,disabled:t,onChange:()=>{const g=!u;d(g),g&&n({...e,padding:ui(Ms(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:f.sideGrid,children:(u?["top"]:Fe).map(g=>i.jsx(je,{label:r(u?"paragraphDialogPadding":jA[g]),value:e.padding[g],disabled:t,onChange:p=>{const h=u?ui(p):{...e.padding,[g]:p};n({...e,padding:h})}},g))})]}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:r("paragraphDialogAlignment")}),i.jsx("div",{className:f.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:DA.map(g=>{const p=RA[g],h=(e.textAlign??"left")===g;return i.jsx("button",{type:"button",className:f.iconButton,role:"radio","aria-checked":h,"aria-label":r(EA[g]),disabled:t,onClick:()=>{n({...e,textAlign:g==="left"?null:g})},children:i.jsx(p,{})},g)})})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:f.select,value:e.verticalAlign??"",disabled:t,onChange:g=>{const p=g.target.value;n({...e,verticalAlign:p||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),ta.map(g=>i.jsx("option",{value:g,children:r(TA[g])},g))]})]}),i.jsx(je,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:g=>n({...e,width:g})}),i.jsxs("div",{className:f.sizeRow,children:[i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:a,children:r("cellPropertiesColSpan")}),i.jsx("input",{id:a,className:f.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:g=>{const p=Number.parseInt(g.target.value,10);n({...e,colSpan:Number.isFinite(p)?Math.max(1,p):1})}})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:s,children:r("cellPropertiesRowSpan")}),i.jsx("input",{id:s,className:f.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:g=>{const p=Number.parseInt(g.target.value,10);n({...e,rowSpan:Number.isFinite(p)?Math.max(1,p):1})}})]})]})]})}const lm='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function IA({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=q(),s=c.useId(),u=c.useRef(null),[d,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(lm);h==null||h.focus();const x=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),o();return}if(b.key!=="Tab"||!p)return;const w=[...p.querySelectorAll(lm)];if(w.length===0)return;const y=w[0],v=w[w.length-1];b.shiftKey&&document.activeElement===y?(b.preventDefault(),v.focus()):!b.shiftKey&&document.activeElement===v&&(b.preventDefault(),y.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,o]),e?i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${f.dialog} ${f.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:p=>p.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:s,children:a("cellPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Be,{})})]}),i.jsx(NA,{value:d,disabled:n,onChange:g}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const MA={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},_A={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function di(e){return{top:e,right:e,bottom:e,left:e}}function _s(e){for(const t of Fe)if(e[t])return e[t];return null}function LA({value:e,disabled:t,onChange:n}){const r=q(),o=c.useId(),[a,s]=c.useState(()=>Ot(e.padding,di(_s(e.padding))));return c.useEffect(()=>{s(Ot(e.padding,di(_s(e.padding))))},[e.padding]),i.jsxs("div",{className:f.body,children:[i.jsx(ut,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),i.jsx(ut,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),i.jsxs("fieldset",{className:f.group,children:[i.jsx("legend",{className:f.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:f.mark,children:[i.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const u=!a;s(u),u&&n({...e,padding:di(_s(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:f.sideGrid,children:(a?["top"]:Fe).map(u=>i.jsx(je,{label:r(a?"paragraphDialogPadding":MA[u]),value:e.padding[u],disabled:t,onChange:d=>{const g=a?di(d):{...e.padding,[u]:d};n({...e,padding:g})}},u))})]}),i.jsxs("div",{className:f.field,children:[i.jsx("label",{className:f.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:f.select,value:e.verticalAlign??"",disabled:t,onChange:u=>{const d=u.target.value;n({...e,verticalAlign:d||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),ta.map(u=>i.jsx("option",{value:u,children:r(_A[u])},u))]})]}),i.jsx(je,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}const cm='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';function FA({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=q(),s=c.useId(),u=c.useRef(null),[d,g]=c.useState(t);return c.useEffect(()=>{e&&g(t)},[e,t]),c.useEffect(()=>{if(!e)return;const p=u.current,h=p==null?void 0:p.querySelector(cm);h==null||h.focus();const x=b=>{if(b.key==="Escape"){if(document.querySelector('[role="listbox"], [data-color-picker]'))return;b.preventDefault(),b.stopPropagation(),o();return}if(b.key!=="Tab"||!p)return;const w=[...p.querySelectorAll(cm)];if(w.length===0)return;const y=w[0],v=w[w.length-1];b.shiftKey&&document.activeElement===y?(b.preventDefault(),v.focus()):!b.shiftKey&&document.activeElement===v&&(b.preventDefault(),y.focus())};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[e,o]),e?i.jsx(fe,{children:i.jsx("div",{className:f.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${f.dialog} ${f.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:p=>p.stopPropagation(),children:[i.jsxs("div",{className:f.headerRow,children:[i.jsx("h2",{className:f.header,id:s,children:a("rowPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:f.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Be,{})})]}),i.jsx(LA,{value:d,disabled:n,onChange:g}),i.jsxs("div",{className:f.actions,children:[i.jsx("button",{type:"button",className:f.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${f.action} ${f.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const BA="_backdrop_9d3gw_1",HA="_dialog_9d3gw_12",zA="_headerRow_9d3gw_29",OA="_header_9d3gw_29",$A="_close_9d3gw_44",KA="_body_9d3gw_66",UA="_frame_9d3gw_75",WA="_actions_9d3gw_83",VA="_action_9d3gw_83",Ft={backdrop:BA,dialog:HA,headerRow:zA,header:OA,close:$A,body:KA,frame:UA,actions:WA,action:VA},um='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function GA(e){const t=Se(e);if(t.length<=1)return e;const n=[],r=[];for(const a of t){const s=Ce(a);n.push(...s.hrefs),r.push(s.body)}const o=r.map((a,s)=>`<div class="wysiwyg-preview-page" style="${s===r.length-1?"display: block; break-inside: avoid; page-break-inside: avoid;":"display: block; break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid;"}">${a}</div>`).join("");return[...Array.from(new Set(n)).map(a=>`<link rel="stylesheet" href="${a}" />`),o].filter(Boolean).join("")}function qA({open:e,html:t,onClose:n}){const r=q(),o=c.useId(),a=c.useRef(null),s=c.useRef(null),u=c.useMemo(()=>GA(t),[t]);return c.useEffect(()=>{if(!e)return;const d=a.current,g=d==null?void 0:d.querySelector(um);g==null||g.focus();const p=h=>{if(h.key==="Escape"){h.preventDefault(),h.stopPropagation(),n();return}if(h.key!=="Tab"||!d)return;const x=[...d.querySelectorAll(um)];if(x.length===0)return;const b=x[0],w=x[x.length-1];h.shiftKey&&document.activeElement===b?(h.preventDefault(),w.focus()):!h.shiftKey&&document.activeElement===w&&(h.preventDefault(),b.focus())};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[e,n]),c.useEffect(()=>{var g;if(!e)return;const d=(g=s.current)==null?void 0:g.contentDocument;d&&Ws(d,u,r("previewDialogTitle"))},[e,u,r]),e?i.jsx(fe,{children:i.jsx("div",{className:Ft.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:a,className:Ft.dialog,role:"dialog","aria-modal":"true","aria-labelledby":o,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:Ft.headerRow,children:[i.jsx("h2",{className:Ft.header,id:o,children:r("previewDialogTitle")}),i.jsx("button",{type:"button",className:Ft.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:i.jsx(Be,{})})]}),i.jsx("div",{className:Ft.body,children:i.jsx("iframe",{ref:s,className:Ft.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var g;const d=(g=s.current)==null?void 0:g.contentDocument;d&&Ws(d,u,r("previewDialogTitle"))}})}),i.jsx("div",{className:Ft.actions,children:i.jsx("button",{type:"button",className:Ft.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const Xg="commspliant-html-editor.darkMode";function ZA(e){return typeof e=="boolean"?e:null}function dm(){try{const e=localStorage.getItem(Xg);return e?ZA(JSON.parse(e)):null}catch{return null}}function YA(e){try{localStorage.setItem(Xg,JSON.stringify(e))}catch{}}const Jg="commspliant-html-editor.pageZoom",XA=new Set(["fitWidth","fitPage"]);function JA(e){return typeof e=="string"&&XA.has(e)||typeof e=="number"&&yx.includes(e)?e:null}function QA(){try{const e=localStorage.getItem(Jg);return e?JA(JSON.parse(e)):null}catch{return null}}function eD(e){try{localStorage.setItem(Jg,JSON.stringify(e))}catch{}}const Qg="commspliant-html-editor.toolbarPosition",tD=["top","left","right","bottom"];function ep(e){return typeof e=="string"&&tD.includes(e)?e:null}function mm(){try{const e=localStorage.getItem(Qg);return e?ep(JSON.parse(e)):null}catch{return null}}function nD(e){try{localStorage.setItem(Qg,JSON.stringify(e))}catch{}}const rD="_panel_6xdnw_1",oD="_header_6xdnw_17",iD="_title_6xdnw_26",aD="_close_6xdnw_32",sD="_messages_6xdnw_48",lD="_empty_6xdnw_57",cD="_message_6xdnw_48",uD="_messageHeader_6xdnw_69",dD="_author_6xdnw_77",mD="_time_6xdnw_81",fD="_body_6xdnw_86",gD="_reply_6xdnw_92",pD="_input_6xdnw_100",hD="_post_6xdnw_111",Ue={panel:rD,header:oD,title:iD,close:aD,messages:sD,empty:lD,message:cD,messageHeader:uD,author:dD,time:mD,body:fD,reply:gD,input:pD,post:hD};function bD(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function yD({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:o,onPost:a,onClose:s}){const u=q(),[d,g]=c.useState(""),p=c.useRef(null);c.useEffect(()=>{var y;(y=p.current)==null||y.focus()},[e==null?void 0:e.id]);const h=!n&&r&&d.trim().length>0,x=c.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),b=x.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const w=()=>{const y=d.trim();!y||!h||(a(y),g(""))};return hl.createPortal(i.jsxs("div",{ref:o,className:Ue.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[i.jsxs("div",{className:Ue.header,children:[i.jsx("h2",{className:Ue.title,children:u("commentPanelTitle")}),i.jsx("button",{type:"button",className:Ue.close,onClick:s,"aria-label":u("commentPanelCloseAria"),children:i.jsx(Be,{})})]}),i.jsx("div",{className:Ue.messages,children:x.length===0?i.jsx("p",{className:Ue.empty,children:u("commentEmpty")}):x.map(y=>i.jsxs("article",{className:Ue.message,children:[i.jsxs("header",{className:Ue.messageHeader,children:[i.jsx("span",{className:Ue.author,children:y.userName}),i.jsx("time",{className:Ue.time,dateTime:y.createdAt,children:bD(y.createdAt,t)})]}),i.jsx("p",{className:Ue.body,children:y.message})]},y.id))}),i.jsxs("div",{className:Ue.reply,children:[i.jsx("textarea",{ref:p,className:Ue.input,value:d,onChange:y=>g(y.target.value),placeholder:b,rows:3,disabled:n||!r}),i.jsx("button",{type:"button",className:Ue.post,onClick:w,disabled:!h,children:u("commentPost")})]})]}),document.body)}function xD({enabled:e,onHtml:t}){const[n,r]=c.useState(!1),o=c.useRef(0),a=c.useRef(e),s=c.useRef(t);a.current=e,s.current=t;const u=c.useCallback(()=>{o.current=0,r(!1)},[]);c.useEffect(()=>{e||u()},[e,u]);const d=c.useCallback(x=>{!a.current||!ei(x.dataTransfer)||(x.preventDefault(),o.current+=1,r(!0))},[]),g=c.useCallback(x=>{!a.current||!ei(x.dataTransfer)||(x.preventDefault(),x.dataTransfer&&(x.dataTransfer.dropEffect="copy"))},[]),p=c.useCallback(x=>{if(!a.current||!ei(x.dataTransfer))return;const b=x.relatedTarget;b instanceof Node&&x.currentTarget.contains(b)||(o.current=Math.max(0,o.current-1),o.current===0&&r(!1))},[]),h=c.useCallback(x=>{if(!a.current||!ei(x.dataTransfer))return;x.preventDefault(),u();const b=Fy(x.dataTransfer);b&&Kl(b).then(w=>{a.current&&s.current(w)},()=>{})},[u]);return{dragging:n,onDragEnter:d,onDragOver:g,onDragLeave:p,onDrop:h}}const wD={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:Mh,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Rh,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:zr,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},deletePage:{id:"deletePage",command:"deletePage",icon:zr,labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:"canDeletePage"}}},CD=400,fm=100,vD=2e7;function kD(e){let t=[],n=0,r=e,o=[],a=0,s=!1,u=!1,d=0;function g(){if(t.length>fm){const v=t.splice(0,t.length-fm);for(const k of v)n-=k.length}for(;t.length>1&&n+a>vD;){const v=t.shift();v&&(n-=v.length)}}function p(v){t.push(v),n+=v.length,g()}function h(){o=[],a=0}function x(v,k){if(s){r=v,s=!1;return}if(v===r)return;const S=Date.now(),D=(k==null?void 0:k.coalesce)===!0;if(D&&u&&S-d<CD){r=v,d=S;return}p(r),r=v,h(),d=S,u=D}function b(){if(t.length===0)return null;u=!1,o.push(r),a+=r.length;const v=t.pop();return n-=v.length,r=v,g(),r}function w(){if(o.length===0)return null;u=!1,p(r);const v=o.pop();return a-=v.length,r=v,r}function y(v){if(s){r=v,s=!1;return}v!==r&&(p(r),r=v,h(),u=!1)}return{record:x,undo:b,redo:w,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncExternal:y,markApplying:()=>{s=!0}}}function un(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function Hi(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):un(e,t):""}const At="fullscreen",ml="commspliant-html-editor.toolbarCustomization";function fl(e){const t=e.filter(n=>n!==At);return e.includes(At)?[...t,At]:t}function cc(e,t){if(!t||t.length===0)return fl(e);const n=new Set(e),r=t.filter(s=>n.has(s)),o=new Set(r),a=[...r];for(let s=0;s<e.length;s++){const u=e[s];if(o.has(u))continue;let d=0;for(let g=s-1;g>=0;g--){const p=e[g],h=a.indexOf(p);if(h>=0){d=h+1;break}}a.splice(d,0,u),o.add(u)}return fl(a)}function SD(e,t){const n=new Map(e.map(s=>[s.id,s])),r=cc(e.map(s=>s.id),t==null?void 0:t.groupOrder),o=new Set((t==null?void 0:t.hiddenItemIds)??[]),a=[];for(const s of r){const u=n.get(s);if(!u)continue;const d=u.items.filter(g=>!o.has(g));d.length!==0&&a.push({id:s,items:d})}return a}function PD(e){if(e==null||typeof e!="object")return null;const t=e,n=Array.isArray(t.groupOrder)?t.groupOrder.filter(o=>typeof o=="string"):[],r=Array.isArray(t.hiddenItemIds)?[...new Set(t.hiddenItemIds.filter(o=>typeof o=="string"))]:[];return n.length===0&&r.length===0?null:{groupOrder:n,hiddenItemIds:r}}function AD(){try{const e=localStorage.getItem(ml);return e?PD(JSON.parse(e)):null}catch{return null}}function DD(e){try{if(!e){localStorage.removeItem(ml);return}localStorage.setItem(ml,JSON.stringify(e))}catch{}}function uc(e,t){return cc(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function RD(e,t,n,r){const o=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?o.delete(n):o.add(n),{groupOrder:uc(e,t),hiddenItemIds:[...o]}}function tp(e,t,n,r){const o=uc(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===At||r===At)return{groupOrder:o,hiddenItemIds:a};const s=o.indexOf(n),u=o.indexOf(r);if(s<0||u<0||s===u)return{groupOrder:o,hiddenItemIds:a};const d=[...o],[g]=d.splice(s,1);return d.splice(u,0,g),{groupOrder:fl(d),hiddenItemIds:a}}function gm(e,t,n,r){const o=uc(e,t),a=o.filter(d=>d!==At),s=a.indexOf(n),u=s+r;return s<0||u<0||u>=a.length?{groupOrder:o,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:tp(e,t,n,a[u])}const ED="_backdrop_11w4e_1",jD="_dialog_11w4e_12",TD="_header_11w4e_31",ND="_body_11w4e_39",ID="_group_11w4e_49",MD="_groupDragging_11w4e_55",_D="_groupDropTarget_11w4e_59",LD="_groupHeader_11w4e_64",FD="_groupTitle_11w4e_72",BD="_dragHandle_11w4e_77",HD="_moveButton_11w4e_78",zD="_items_11w4e_119",OD="_item_11w4e_119",$D="_itemIcon_11w4e_135",KD="_itemTitle_11w4e_144",UD="_itemCheckbox_11w4e_151",WD="_actions_11w4e_155",VD="_action_11w4e_155",GD="_spinnerWrap_11w4e_191",qD="_spinner_11w4e_191",ke={backdrop:ED,dialog:jD,header:TD,body:ND,group:ID,groupDragging:MD,groupDropTarget:_D,groupHeader:LD,groupTitle:FD,dragHandle:BD,moveButton:HD,items:zD,item:OD,itemIcon:$D,itemTitle:KD,itemCheckbox:UD,actions:WD,action:VD,spinnerWrap:GD,spinner:qD},pm='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])';function ZD(){return i.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"currentColor",children:[i.jsx("circle",{cx:"5",cy:"4",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"4",r:"1.2"}),i.jsx("circle",{cx:"5",cy:"8",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"8",r:"1.2"}),i.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),i.jsx("circle",{cx:"11",cy:"12",r:"1.2"})]})}function YD({open:e,catalog:t,groups:n,settings:r,loading:o=!1,busy:a=!1,disabled:s,onChange:u,onReset:d,onClose:g}){const p=q(),h=c.useId(),x=c.useRef(null),[b,w]=c.useState(null),[y,v]=c.useState(null),k=cc(n.map(j=>j.id),r==null?void 0:r.groupOrder),S=new Set((r==null?void 0:r.hiddenItemIds)??[]),D=new Map(n.map(j=>[j.id,j])),I=k.map(j=>D.get(j)).filter(j=>!!j),A=s||a||o;if(c.useEffect(()=>{e||(w(null),v(null))},[e]),c.useEffect(()=>{if(!e)return;const j=x.current,M=j==null?void 0:j.querySelector(pm);M==null||M.focus();const F=$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),g();return}if($.key!=="Tab"||!j)return;const Z=[...j.querySelectorAll(pm)];if(Z.length===0)return;const ne=Z[0],X=Z[Z.length-1];$.shiftKey&&document.activeElement===ne?($.preventDefault(),X.focus()):!$.shiftKey&&document.activeElement===X&&($.preventDefault(),ne.focus())};return document.addEventListener("keydown",F,!0),()=>document.removeEventListener("keydown",F,!0)},[e,g]),!e)return null;const P=I.map(j=>j.id).filter(j=>j!==At),R=(j,M)=>{if(A||M===At){j.preventDefault();return}j.dataTransfer.setData("text/plain",M),j.dataTransfer.effectAllowed="move",w(M)},L=(j,M)=>{A||M===At||!b||b===M||(j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move"),v(M))},E=(j,M)=>{var $;j.preventDefault();const F=(($=j.dataTransfer)==null?void 0:$.getData("text/plain"))||b;w(null),v(null),!(!F||F===M||A)&&u(tp(r,n,F,M))},N=()=>{w(null),v(null)};return i.jsx(fe,{children:i.jsx("div",{className:ke.backdrop,role:"presentation",onMouseDown:g,children:i.jsxs("div",{ref:x,className:ke.dialog,role:"dialog","aria-modal":"true","aria-labelledby":h,"aria-busy":o||a?!0:void 0,onMouseDown:j=>j.stopPropagation(),children:[i.jsx("h2",{className:ke.header,id:h,children:p("customizeToolbarDialogTitle")}),i.jsx("div",{className:ke.body,children:o?i.jsx("div",{className:ke.spinnerWrap,role:"status","aria-live":"polite","aria-label":p("customizeToolbarDialogLoading"),children:i.jsx("span",{className:ke.spinner,"aria-hidden":"true"})}):I.map(j=>{const M=t.groups[j.id],F=M?un(p,M):j.id,$=j.id===At,Z=P.indexOf(j.id);return i.jsxs("section",{className:[ke.group,b===j.id?ke.groupDragging:"",y===j.id?ke.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":j.id,"aria-label":F,onDragOver:ne=>L(ne,j.id),onDrop:ne=>E(ne,j.id),onDragLeave:()=>{y===j.id&&v(null)},children:[i.jsxs("div",{className:ke.groupHeader,children:[i.jsx("button",{type:"button",className:ke.dragHandle,draggable:!A&&!$,disabled:A||$,"aria-label":p("customizeToolbarDragHandle"),onDragStart:ne=>R(ne,j.id),onDragEnd:N,children:i.jsx(ZD,{})}),i.jsx("span",{className:ke.groupTitle,children:F}),i.jsx("button",{type:"button",className:ke.moveButton,disabled:A||$||Z<=0,"aria-label":p("customizeToolbarMoveUp"),onClick:()=>u(gm(r,n,j.id,-1)),children:"↑"}),i.jsx("button",{type:"button",className:ke.moveButton,disabled:A||$||Z<0||Z>=P.length-1,"aria-label":p("customizeToolbarMoveDown"),onClick:()=>u(gm(r,n,j.id,1)),children:"↓"})]}),i.jsx("div",{className:ke.items,children:j.items.map(ne=>{const X=t.items[ne];if(!X)return null;const Y=X.icon,ae=un(p,X),te=`${h}-${j.id}-${ne}`,U=!S.has(ne);return i.jsxs("label",{className:ke.item,htmlFor:te,children:[i.jsx("span",{className:ke.itemIcon,"aria-hidden":"true",children:Y?i.jsx(Y,{}):ae.slice(0,2)}),i.jsx("span",{className:ke.itemTitle,children:ae}),i.jsx("input",{id:te,className:ke.itemCheckbox,type:"checkbox",checked:U,disabled:A,"aria-label":`${ae}: ${p("customizeToolbarItemVisible")}`,onChange:T=>u(RD(r,n,ne,T.target.checked))})]},ne)})})]},j.id)})}),i.jsxs("div",{className:ke.actions,children:[i.jsx("button",{type:"button",className:ke.action,disabled:A,onClick:d,children:p("customizeToolbarDialogReset")}),i.jsx("button",{type:"button",className:ke.action,"aria-label":p("customizeToolbarDialogCloseAria"),onClick:g,children:p("customizeToolbarDialogClose")})]})]})})})}function XD(e,t){if(!t)return e;const n=t.menus,r=t.toolbar;if(n===void 0&&r===void 0)return e;const o=n===void 0?e.menus:e.menus.filter(s=>n.includes(s.id)),a=r===void 0?e.iconGroups:e.iconGroups.map(s=>({id:s.id,items:s.items.filter(u=>r.includes(u))})).filter(s=>s.items.length>0);return{menus:o,iconGroups:a}}const JD={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:Th,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:wh,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Ah,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},mi=4;function np({icon:e,value:t,mixed:n,noneKey:r,labelKey:o,ariaKey:a,fallbackCustom:s,disabled:u,onChange:d}){const g=q(),p=c.useId(),h=c.useRef(null),x=c.useRef(null),b=c.useRef(null),[w,y]=c.useState(!1),[v,k]=c.useState({top:0,left:0}),S=c.useCallback(()=>{const R=x.current,L=b.current;if(!R)return;const E=R.getBoundingClientRect(),N=(L==null?void 0:L.offsetHeight)??0,j=(L==null?void 0:L.offsetWidth)??200;let M=E.bottom;M+N>window.innerHeight-mi&&(M=Math.max(mi,E.top-N));const F=Math.min(Math.max(E.left,mi),window.innerWidth-j-mi);k({top:M,left:F})},[]);c.useLayoutEffect(()=>{if(!w)return;S();const R=()=>S();return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[w,S]),c.useEffect(()=>{if(!w)return;const R=E=>{var j,M;const N=E.target;(j=h.current)!=null&&j.contains(N)||(M=b.current)!=null&&M.contains(N)||y(!1)},L=E=>{var N;E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),y(!1),(N=x.current)==null||N.focus())};return document.addEventListener("pointerdown",R),document.addEventListener("keydown",L,!0),()=>{document.removeEventListener("pointerdown",R),document.removeEventListener("keydown",L,!0)}},[w]);const D=R=>{d(R)},I=`${Sn.bar}${!t||n?` ${Sn.barEmpty}`:""}`,A=t&&!n?{backgroundColor:t}:void 0,P=i.jsxs("div",{className:Sn.wrap,ref:h,children:[i.jsxs("button",{ref:x,type:"button",className:`${ee.iconButton} ${Sn.button}`,"aria-label":g(a),"aria-expanded":w,"aria-haspopup":"listbox","aria-controls":w?p:void 0,disabled:u,onMouseDown:R=>R.preventDefault(),onClick:()=>y(R=>!R),children:[i.jsx(e,{className:`${ee.icon} ${Sn.icon}`}),i.jsx("span",{className:I,style:A})]}),w?i.jsx(fe,{children:i.jsx("div",{ref:b,id:p,className:Sn.popover,style:{top:v.top,left:v.left},children:i.jsx(ic,{value:t,mixed:n,noneLabel:g(r),ariaLabel:g(a),disabled:u,fallbackCustom:s,onChange:D,onCommit:()=>y(!1)})})}):null]});return i.jsx(cn,{label:g(o),children:P})}function QD({commands:e,queries:t,disabled:n}){return i.jsx(np,{icon:Cm,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}function eR({commands:e,queries:t,disabled:n}){const r=q(),o=!!(n||!t.isVisualMode());return i.jsx(Vg,{size:t.getFontSize(),unit:t.getFontSizeUnit(),disabled:o,tooltip:r("commandFontSize"),toolbar:!0,onSizeChange:(a,s)=>{e.setFontSize(a,s)},onUnitChange:a=>{e.setFontSizeUnit(a)}})}function tR({commands:e,queries:t,disabled:n}){return i.jsx(np,{icon:vm,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function nR({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=q(),a=!!(n||!t.isVisualMode());return i.jsx(ic,{value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneLabel:o("colorNone"),ariaLabel:o("commandHighlightColorAria"),disabled:a,menu:!0,fallbackCustom:"#ffff00",onChange:s=>e.setHighlightColor(s),onCommit:()=>r==null?void 0:r()})}const rR="_wrap_1gtdc_1",oR="_wrapToolbar_1gtdc_7",iR="_field_1gtdc_12",aR="_trigger_1gtdc_20",sR="_chevron_1gtdc_46",lR="_list_1gtdc_69",cR="_option_1gtdc_84",uR="_separator_1gtdc_113",Bt={wrap:rR,wrapToolbar:oR,field:iR,trigger:aR,chevron:sR,list:lR,option:cR,separator:uR},gl={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},dR={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 hm(){const e=q();return i.jsx("div",{className:f.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:i.jsx("span",{className:f.spinner,"aria-hidden":"true"})})}function rp({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:o,listRef:a,style:s,customStylesEnabled:u=!1,customStyles:d=[],customStylesLoading:g=!1,onSelect:p,onSelectCustom:h,onAddNew:x}){const b=q(),w=t?null:e,y=u,v=!!(r&&u&&x);return r?i.jsxs(i.Fragment,{children:[Ni.map(k=>i.jsx("button",{type:"button",className:ee.menuItem,role:"menuitemradio","aria-checked":w===k,disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>p(k),children:b(gl[k])},k)),y?i.jsx("div",{role:"separator",className:ee.menuSeparator}):null,y&&g?i.jsx(hm,{}):null,y&&!g?d.map(k=>i.jsx("button",{type:"button",className:ee.menuItem,role:"menuitem",disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>h==null?void 0:h(k.id),children:k.name},k.id)):null,v?i.jsxs(i.Fragment,{children:[y&&(g||d.length>0)?i.jsx("div",{role:"separator",className:ee.menuSeparator}):null,i.jsxs("button",{type:"button",className:ee.menuItem,role:"menuitem","aria-label":b("styleAddNewAria"),disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>x==null?void 0:x(),children:[i.jsx(Ph,{className:ee.icon}),b("styleAddNew")]})]}):null]}):i.jsxs("ul",{ref:a,className:Bt.list,role:"listbox",id:o,style:s,"aria-label":b("commandParagraphStyleAria"),"aria-busy":y&&g?!0:void 0,children:[Ni.map(k=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Bt.option,role:"option","aria-selected":w===k,disabled:n,style:dR[k],onMouseDown:S=>S.preventDefault(),onClick:()=>p(k),children:b(gl[k])})},k)),y&&(g||d.length>0)?i.jsx("li",{role:"separator",className:Bt.separator}):null,y&&g?i.jsx("li",{role:"presentation",children:i.jsx(hm,{})}):null,y&&!g?d.map(k=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Bt.option,role:"option","aria-selected":!1,disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>h==null?void 0:h(k.id),children:k.name})},k.id)):null]})}const fi=4;function mR({commands:e,queries:t,disabled:n}){const r=q(),o=c.useId(),a=c.useRef(null),s=c.useRef(null),u=c.useRef(null),[d,g]=c.useState(!1),[p,h]=c.useState({top:0,left:0,width:0}),x=!!(n||!t.isVisualMode()),b=t.isParagraphStyleMixed(),w=b?null:t.getParagraphStyle(),y=w?r(gl[w]):"",v=t.customParagraphStylesEnabled(),k=v?t.getCustomParagraphStyles():[],S=v&&t.isCustomParagraphStylesLoading(),D=c.useCallback(()=>{const A=s.current,P=u.current;if(!A)return;const R=A.getBoundingClientRect(),L=(P==null?void 0:P.offsetHeight)??0,E=Math.max(R.width,(P==null?void 0:P.offsetWidth)??0);let N=R.bottom;N+L>window.innerHeight-fi&&(N=Math.max(fi,R.top-L));const j=Math.min(Math.max(R.left,fi),window.innerWidth-E-fi);h({top:N,left:j,width:E})},[]);c.useLayoutEffect(()=>{if(!d)return;D();const A=()=>D();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[d,D,k.length,S]),c.useEffect(()=>{if(!d)return;const A=R=>{var E,N;const L=R.target;(E=a.current)!=null&&E.contains(L)||(N=u.current)!=null&&N.contains(L)||g(!1)},P=R=>{R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),g(!1))};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",P,!0)}},[d]);const I=i.jsxs("div",{className:`${Bt.wrap} ${Bt.wrapToolbar}`,ref:a,children:[i.jsxs("div",{className:Bt.field,ref:s,children:[i.jsx("button",{type:"button",className:Bt.trigger,disabled:x,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?o:void 0,onMouseDown:A=>A.preventDefault(),onClick:()=>g(A=>!A),children:y}),i.jsx("span",{className:Bt.chevron,"aria-hidden":"true"})]}),d?i.jsx(fe,{children:i.jsx(rp,{listRef:u,listId:o,value:w,mixed:b,disabled:x,customStylesEnabled:v,customStyles:k,customStylesLoading:S,style:{top:p.top,left:p.left,minWidth:p.width},onSelect:A=>{e.setParagraphStyle(A),g(!1)},onSelectCustom:A=>{e.applyCustomParagraphStyle(A),g(!1)}})}):null]});return i.jsx(cn,{label:r("commandParagraphStyle"),children:I})}function fR({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=!!(n||!t.isVisualMode()),a=t.isParagraphStyleMixed(),s=a?null:t.getParagraphStyle(),u=t.customParagraphStylesEnabled(),d=u?t.getCustomParagraphStyles():[],g=u&&t.isCustomParagraphStylesLoading();return i.jsx(rp,{menu:!0,value:s,mixed:a,disabled:o,customStylesEnabled:u,customStyles:d,customStylesLoading:g,onSelect:p=>{e.setParagraphStyle(p),r==null||r()},onSelectCustom:p=>{e.openCustomParagraphStyleDialog(p),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const gR={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:fR,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:nR,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:Xk,icon:sh,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:mR,icon:Sh,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:eR,icon:ch,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:lh,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:oh,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:Pm,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:km,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:QD,icon:Cm,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:tR,icon:vm,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:Xp,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:ph,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Ih,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:Nh,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:eh,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:uh,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:Ki,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:$i,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:Ui,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:xm,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:gh,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Ch,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:wm,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:Sm,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},pR={menus:{insert:{id:"insert",labelKey:"menuInsert",ariaKey:"menuInsertAria"}},submenus:{insertPage:{id:"insertPage",labelKey:"menuInsertPage",ariaKey:"menuInsertPageAria",enabled:"hasSelectedPage"}},groups:{insert:{id:"insert",labelKey:"toolbarGroupInsert"}},items:{link:{id:"link",command:"openLinkDialog",icon:bh,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:Jp,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:km,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},pageBackgroundImage:{id:"pageBackgroundImage",command:"openPageBackgroundImage",icon:zr,labelKey:"commandPageBackgroundImage",ariaKey:"commandPageBackgroundImageAria",enabled:"canInsertPageBackgroundImage"},paragraphBackgroundImage:{id:"paragraphBackgroundImage",command:"openParagraphBackgroundImage",icon:Pm,labelKey:"commandParagraphBackgroundImage",ariaKey:"commandParagraphBackgroundImageAria",enabled:"canInsertParagraphBackgroundImage"},audio:{id:"audio",command:"openAudioDialog",icon:Yp,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:Fh,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:mh,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:vh,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPageBefore:{id:"insertPageBefore",command:"insertPageBefore",icon:zr,labelKey:"commandInsertPageBefore",ariaKey:"commandInsertPageBeforeAria",enabled:"hasSelectedPage"},insertPageAfter:{id:"insertPageAfter",command:"insertPageAfter",icon:zr,labelKey:"commandInsertPageAfter",ariaKey:"commandInsertPageAfterAria",enabled:"hasSelectedPage"}}},hR={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:qu,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:hs,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:hs,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:hs,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:ps,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:ps,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:ps,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:xh,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:_h,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:qu,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:Qp,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:Eh,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},bR={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:Lh,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:fh,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:ih,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:hh,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:ah,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:kh,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},ruler:{id:"ruler",command:"toggleRuler",icon:jh,labelKey:"commandRuler",ariaKey:"commandRulerAria",active:"isRulerVisible",toggle:!0},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:Dh,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:dh,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function yR(...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 xR=yR(JD,wD,pR,hR,bR,gR),wR={menus:[{id:"file",items:["save","open",ue,"print"]},{id:"edit",items:["undo","redo",ue,{submenu:"page",items:["pageProperties",ue,"deletePage"]}]},{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","ruler","preview","readAloud","fullscreen"]},{id:"insert",items:["pageBreak",{submenu:"insertPage",items:["insertPageBefore","insertPageAfter"]},ue,"table",ue,"image","pageBackgroundImage","paragraphBackgroundImage","audio","youtube","horizontalRule",ue,"link","bookmark",ue,"insertComment"]},{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"]},{id:"table",items:["table",ue,{submenu:"insertRow",items:["insertRowBefore","insertRowBelow","deleteRow"]},{submenu:"insertColumn",items:["insertColumnBefore","insertColumnAfter","deleteColumn"]},ue,"mergeCells","unmergeCells",ue,"tableProperties","rowProperties","cellProperties"]}],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"]}]},bm={items:{addComment:{id:"addComment",command:"addComment",icon:Gu,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:Gu,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:th,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},CR=["addComment","insertComment","toggleCommentsVisible"],vR=new Set(["insert","view"]);function op(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!CR.includes(e):!0:!1}function kR(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!vR.has(e):!0:!1}function SR(e,t){const n=t?"hideComments":"showComments",r=bm.items.toggleCommentsVisible;return{...e,items:{...e.items,...bm.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function PR(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.findIndex(a=>an(a)&&a.submenu==="insertPage"),o=r===-1?n.length:r;return n.includes("insertComment")||n.splice(o,0,"insertComment"),{...t,items:n}}if(t.id==="view"){const n=[...t.items],r=n.indexOf("preview"),o=r===-1?n.length:r;return n.includes("toggleCommentsVisible")||n.splice(o,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 gi="fullscreen";function AR(e){const t=[];let n=null;for(const r of e){const o=r.items.filter(a=>a!==gi);o.length>0&&t.push({id:r.id,items:o}),r.items.includes(gi)&&(n={id:gi,items:[gi]})}return{main:t,trailing:n}}function DR({groups:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a}){const s=q(),{main:u,trailing:d}=AR(e),g=p=>{const h=t.groups[p.id];return i.jsx("div",{className:ee.iconGroup,role:"group","aria-label":h?un(s,h):void 0,"data-toolbar-group":p.id,children:p.items.map(x=>{const b=t.items[x];if(!b)return null;const w=b.enabled?!r[b.enabled]():!1;if(b.widget){const S=b.widget;return i.jsx(S,{commands:n,queries:r,disabled:o||w},x)}if(!b.icon||!b.command)return null;const y=b.icon,v=b.command,k=b.active?r[b.active]():void 0;return i.jsx(cn,{label:b.tooltip??un(s,b),children:i.jsx("button",{type:"button",className:ee.iconButton,"aria-label":Hi(s,b),"aria-pressed":k,disabled:o||(a?op(x,a):!1)||w,onPointerDown:S=>S.preventDefault(),onMouseDown:S=>S.preventDefault(),onClick:()=>{yl(n,v)},children:i.jsx(y,{className:ee.icon})})},x)})},p.id)};return i.jsxs("div",{className:ee.iconNav,role:"toolbar","aria-label":s("toolbarAria"),children:[u.length>0?i.jsx("div",{className:ee.iconNavMain,children:u.map(g)}):null,d?i.jsx("div",{className:ee.iconNavEnd,children:g(d)}):null]})}const RR=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function ER(e){const t={};for(const n of RR){const r=getComputedStyle(e).getPropertyValue(n).trim();if(r){t[n]=r;continue}let o=e;for(;o;){const a=o.style.getPropertyValue(n).trim();if(a){t[n]=a;break}o=o.parentElement}}return t}function jR({menus:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,compact:s,openMenuId:u,onOpenMenuIdChange:d}){const g=q(),[p,h]=c.useState(!1),[x,b]=c.useState({}),w=c.useRef(null),y=c.useRef(null),v=c.useRef(null),k=c.useRef(null),S=c.useCallback(()=>{h(!1),d(null)},[d]);c.useLayoutEffect(()=>{!p||!w.current||b(ER(w.current))},[p]),c.useEffect(()=>{var I;p&&((I=v.current)==null||I.focus())},[p]),c.useEffect(()=>{if(!p)return;const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=I}},[p]),c.useEffect(()=>{if(!p)return;const I=P=>{var R;if(P.key==="Escape"){if(P.preventDefault(),P.stopPropagation(),u){d(null);return}S(),(R=y.current)==null||R.focus()}},A=P=>{var R;k.current&&!k.current.contains(P.target)&&(S(),(R=y.current)==null||R.focus())};return document.addEventListener("keydown",I,!0),document.addEventListener("pointerdown",A),()=>{document.removeEventListener("keydown",I,!0),document.removeEventListener("pointerdown",A)}},[p,u,d,S]);const D=I=>e.map(A=>{const P=t.menus[A.id];return P?i.jsx(NR,{def:P,itemIds:A.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:I,open:(I==="overlay"||!p)&&u===A.id,onOpenChange:R=>d(R?A.id:null),onItemRun:I==="overlay"?()=>{var R;S(),(R=y.current)==null||R.focus()}:void 0},`${I}-${A.id}`):null});return i.jsxs("div",{className:ee.menuBar,ref:w,children:[i.jsx(cn,{label:g("brandMarkAria"),children:i.jsx("span",{className:ee.brandMark,role:"img","aria-label":g("brandMarkAria"),children:i.jsx(nh,{className:ee.brandMarkIcon})})}),i.jsx("div",{className:ee.menuBarCompact,hidden:s===void 0?void 0:!s,children:i.jsx(cn,{label:g("menuHamburgerAria"),children:i.jsx("button",{ref:y,type:"button",className:`${ee.menuButton} ${ee.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":p,"aria-label":g("menuHamburgerAria"),disabled:o||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(p){S();return}d(null),h(!0)},children:i.jsx(yh,{className:ee.icon})})})}),i.jsx("div",{className:ee.menuBarDesktop,hidden:s===void 0?void 0:s,children:D("dropdown")}),p?i.jsx(fe,{children:i.jsx("div",{className:ee.toolbar,"data-menu-overlay-portal":"",style:x,children:i.jsxs("div",{ref:k,className:ee.menuOverlay,role:"dialog","aria-modal":"true","aria-label":g("menuOverlayAria"),children:[i.jsxs("div",{className:ee.menuOverlayHeader,children:[i.jsx("span",{className:ee.menuOverlayTitle,children:g("menuOverlayAria")}),i.jsx("button",{ref:v,type:"button",className:ee.iconButton,"aria-label":g("menuCloseAria"),onClick:()=>{var I;S(),(I=y.current)==null||I.focus()},children:i.jsx(Be,{className:ee.icon})})]}),i.jsx("div",{className:ee.menuOverlayBody,children:D("overlay")})]})})}):null]})}function zi(e,t){var n,r;if(on(e))return!1;if(an(e)){const o=(n=t.submenus)==null?void 0:n[e.submenu];return o?o.panel?!0:e.items.some(a=>zi(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function TR(e,t,n){if(!on(e[t])||!e.slice(t+1).some(a=>zi(a,n)))return!1;let o=!1;for(let a=t-1;a>=0;a--){const s=e[a];if(on(s)){o=!0;continue}if(zi(s,n))return!o}return!1}function NR({def:e,itemIds:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,open:d,onOpenChange:g,onItemRun:p}){const h=q(),x=c.useRef(null),b=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[w,y]=c.useState(null);c.useEffect(()=>{d||y(null)},[d]),c.useEffect(()=>{if(!d||u==="overlay")return;const k=D=>{x.current&&!x.current.contains(D.target)&&g(!1)},S=D=>{if(D.key==="Escape"){if(D.preventDefault(),D.stopPropagation(),w){y(null);return}g(!1)}};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",S,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",S,!0)}},[d,w,g,u]);const v=()=>{g(!1),p==null||p()};return i.jsxs("div",{className:ee.menuWrap,ref:x,children:[i.jsx("button",{type:"button",className:ee.menuButton,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":Hi(h,e),disabled:a||(s?kR(e.id,s):!1),onClick:()=>g(!d),children:un(h,e)}),d?i.jsx("div",{className:ee.menu,role:"menu",id:b,onMouseDown:k=>k.preventDefault(),children:i.jsx(ip,{entries:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,onClose:v,openSubmenuId:w,onOpenSubmenuIdChange:y})}):null]})}function ip({entries:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:d,onOpenSubmenuIdChange:g}){return i.jsx(i.Fragment,{children:e.map((p,h)=>{if(on(p))return TR(e,h,t)?i.jsx("div",{role:"separator",className:ee.menuSeparator},`separator-${h}`):null;if(an(p))return i.jsx(MR,{entry:p,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d===p.submenu,onOpenChange:b=>g==null?void 0:g(b?p.submenu:null)},`submenu-${p.submenu}-${h}`);const x=t.items[p];return!x||!x.command?null:i.jsx(IR,{item:x,commands:n,queries:r,disabled:o,chromeLock:a,onClose:u},p)})})}function IR({item:e,commands:t,queries:n,disabled:r,chromeLock:o,onClose:a}){const s=q();if(!e.command)return null;const u=e.icon,d=e.command,g=e.active?n[e.active]():void 0,p=e.enabled?!n[e.enabled]():!1,h=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return i.jsxs("button",{type:"button",role:h,className:ee.menuItem,"aria-checked":g,disabled:r||(o?op(e.id,o):!1)||p,onClick:()=>{a(),yl(t,d)},children:[u?i.jsx(u,{className:ee.icon}):null,un(s,e)]})}function MR({entry:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d,onOpenChange:g}){var P;const p=q(),h=c.useRef(null),x=c.useRef(null),[b,w]=c.useState(null),y=(P=t.submenus)==null?void 0:P[e.submenu],v=s==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,k=y==null?void 0:y.panel,S=y!=null&&y.enabled?!r[y.enabled]():!1,D=s==="overlay";if(c.useEffect(()=>{d||w(null)},[d]),!y||!k&&!e.items.some(R=>zi(R,t)))return null;const I=R=>{(R.key==="ArrowRight"||R.key==="Enter"||R.key===" ")&&(R.preventDefault(),R.stopPropagation(),g(!0),requestAnimationFrame(()=>{var E;const L=(E=x.current)==null?void 0:E.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');L==null||L.focus()}))},A=R=>{var L;R.key==="ArrowLeft"&&(R.preventDefault(),R.stopPropagation(),g(!1),(L=h.current)==null||L.focus())};return i.jsxs("div",{className:ee.submenuWrap,onMouseEnter:D?void 0:()=>g(!0),onMouseLeave:D?void 0:()=>g(!1),children:[i.jsx("button",{ref:h,type:"button",role:"menuitem",className:`${ee.menuItem} ${ee.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":v,"aria-label":Hi(p,y),disabled:o||S||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>g(D?!d:!0),onKeyDown:I,children:un(p,y)}),d?i.jsx("div",{ref:x,className:`${ee.menu} ${ee.submenu}`,role:"menu",id:v,"aria-label":Hi(p,y),onMouseDown:R=>R.preventDefault(),onKeyDown:A,children:k?i.jsx(k,{commands:n,queries:r,disabled:o||S,onMenuClose:u}):i.jsx(ip,{entries:e.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:b,onOpenSubmenuIdChange:w})}):null]})}function Ls({catalog:e,layout:t,commands:n,queries:r,disabled:o,chromeLock:a,menuVisible:s=!0,toolbarVisible:u=!0,compact:d,position:g="top"}){const[p,h]=c.useState(null);return!s&&!u?null:i.jsxs("div",{className:ee.toolbar,"data-compact":d?"":void 0,"data-toolbar-position":g,children:[s?i.jsx(jR,{menus:t.menus,catalog:e,commands:n,queries:r,disabled:o,chromeLock:a,compact:d,openMenuId:p,onOpenMenuIdChange:h}):null,u?i.jsx(DR,{groups:t.iconGroups,catalog:e,commands:n,queries:r,disabled:o,chromeLock:a}):null]})}function _R(e,t){return t?e:{...e,menus:e.menus.map(n=>n.id==="insert"?{...n,items:n.items.filter(r=>!(an(r)&&r.submenu==="insertPage"))}:n.id==="edit"?{...n,items:n.items.map(r=>{if(!an(r)||r.submenu!=="page")return r;let o=r.items.filter(a=>a!=="deletePage");return o.at(-1)===ue&&(o=o.slice(0,-1)),{...r,items:o}})}:n)}}const LR="_root_1febl_1",FR="_fullscreen_1febl_36",BR="_exitFullscreen_1febl_48",HR="_exitFullscreenIcon_1febl_79",zR="_menuChrome_1febl_94",OR="_body_1febl_106",$R="_iconChrome_1febl_136",KR="_workspace_1febl_181",UR="_workspacePageSized_1febl_193",WR="_workspaceWithRuler_1febl_197",VR="_pageCanvasViewport_1febl_201",GR="_multiPageRulerLayer_1febl_211",qR="_multiPageContainer_1febl_234",ZR="_pageZoomContent_1febl_244",YR="_htmlFileDropOverlay_1febl_262",XR="_surface_1febl_276",JR="_visual_1febl_283",QR="_pageBlock_1febl_331",eE="_pageBlockFluid_1febl_338",tE="_pageSurfaceRulerGutter_1febl_347",nE="_pageSurface_1febl_347",rE="_html_1febl_262",ce={root:LR,fullscreen:FR,exitFullscreen:BR,exitFullscreenIcon:HR,menuChrome:zR,body:OR,iconChrome:$R,workspace:KR,workspacePageSized:UR,workspaceWithRuler:WR,pageCanvasViewport:VR,multiPageRulerLayer:GR,multiPageContainer:qR,pageZoomContent:ZR,htmlFileDropOverlay:YR,surface:XR,visual:JR,pageBlock:QR,pageBlockFluid:eE,pageSurfaceRulerGutter:tE,pageSurface:nE,html:rE},oE=c.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:o},a){const s=q();return i.jsx("textarea",{ref:a,className:`${ce.surface} ${ce.html}`,value:t,onChange:u=>n(u.target.value),placeholder:r,disabled:o,"aria-label":s("htmlEditorAria"),spellCheck:!1})});function pl(e){return gf(Qe(e))}const ap=24,Wr=48;function sp(e,t){const n=Hl(Qe(t));return{pageWidthPx:e.offsetWidth,pageHeightPx:e.offsetHeight,marginsPx:{top:An(n.top,0),right:An(n.right,0),bottom:An(n.bottom,0),left:An(n.left,0)}}}const iE="_rulerRoot_j57vt_5",aE="_horizontalRulerGroup_j57vt_22",sE="_horizontalRulerTrack_j57vt_28",lE="_horizontalRulerShelf_j57vt_42",cE="_horizontalInner_j57vt_51",uE="_dragEdgeLeft_j57vt_63",dE="_dragEdgeRight_j57vt_73",mE="_dragEdgeActive_j57vt_85",fE="_verticalRuler_j57vt_92",gE="_verticalInner_j57vt_102",pE="_dragEdgeTop_j57vt_114",hE="_dragEdgeBottom_j57vt_124",bE="_dragEdgeActiveV_j57vt_136",yE="_tickH_j57vt_143",xE="_tickV_j57vt_152",wE="_tickLabelH_j57vt_161",CE="_tickLabelV_j57vt_175",vE="_arrowIconWrapper_j57vt_192",kE="_arrowDown_j57vt_203",SE="_arrowGlyph_j57vt_211",PE="_arrowActive_j57vt_220",AE="_arrowUp_j57vt_225",DE="_rulerTooltip_j57vt_249",me={rulerRoot:iE,horizontalRulerGroup:aE,horizontalRulerTrack:sE,horizontalRulerShelf:lE,horizontalInner:cE,dragEdgeLeft:uE,dragEdgeRight:dE,dragEdgeActive:mE,verticalRuler:fE,verticalInner:gE,dragEdgeTop:pE,dragEdgeBottom:hE,dragEdgeActiveV:bE,tickH:yE,tickV:xE,tickLabelH:wE,tickLabelV:CE,arrowIconWrapper:vE,arrowDown:kE,arrowGlyph:SE,arrowActive:PE,arrowUp:AE,rulerTooltip:DE},Fs=({type:e,active:t=!1,className:n="",style:r,title:o,"aria-label":a,onPointerDown:s,"data-testid":u})=>{const d=e==="down"?me.arrowDown:me.arrowUp;return i.jsx("div",{className:`${me.arrowIconWrapper} ${d} ${t?me.arrowActive:""} ${n}`,style:r,title:o,"aria-label":a||o,onPointerDown:s,"data-testid":u,children:i.jsx("div",{className:me.arrowGlyph})})};function lp(){const[e,t]=c.useState(null),[n,r]=c.useState(null),o=c.useCallback((a,s,u)=>{s.preventDefault(),s.stopPropagation(),t(a);const d=Number.isFinite(s.clientX)?s.clientX:0,g=Number.isFinite(s.clientY)?s.clientY:0,p=s.altKey,h=b=>{var k;const w=Number.isFinite(b.clientX)?b.clientX:d,y=Number.isFinite(b.clientY)?b.clientY:g,v=u.updateDragState(w,y,b.altKey);r(v),(k=u.onPreview)==null||k.call(u,v)},x=b=>{const w=Number.isFinite(b.clientX)?b.clientX:d,y=Number.isFinite(b.clientY)?b.clientY:g,v=u.updateDragState(w,y,b.altKey);window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),t(null),r(null),u.onCommit(v)};r(u.updateDragState(d,g,p)),window.addEventListener("pointermove",h),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[]);return{activeTarget:e,dragPreview:n,startPointerDrag:o}}const RE=({geometry:e,indentState:t,unit:n="in",zoomScale:r=1,onMarginChange:o,onMarginPreview:a,onIndentChange:s})=>{const u=q(),{activeTarget:d,dragPreview:g,startPointerDrag:p}=lp(),h=(e==null?void 0:e.pageWidthPx)??816,x=(e==null?void 0:e.marginsPx.left)??96,b=(e==null?void 0:e.marginsPx.right)??96,w=r>0?r:1,y=(g==null?void 0:g.marginLeft)??x,v=(g==null?void 0:g.marginRight)??b,k=(g==null?void 0:g.firstLineIndentPx)??t.firstLineIndentPx,S=(g==null?void 0:g.leftIndentPx)??t.leftIndentPx,D=(g==null?void 0:g.rightIndentPx)??t.rightIndentPx,I=Math.max(0,h-y-v),A=!t.mixed,P=c.useMemo(()=>uf(h,y,n),[h,y,n]),R=c.useCallback((M,F)=>{const $=Number.isFinite(F.clientX)?F.clientX:0;Number.isFinite(F.clientY)&&F.clientY,p(M.type,F,{updateDragState:(Z,ne,X)=>{const Y=(Z-$)/w;let ae=0;const te={target:M.type,marginLeft:x,marginRight:b,firstLineIndentPx:t.firstLineIndentPx,leftIndentPx:t.leftIndentPx,rightIndentPx:t.rightIndentPx,measurementPx:0,clientX:Z,clientY:ne};if(M.type==="margin-left"){const U=Math.max(0,Math.min(h-b-Wr,M.startMarginPx+Y)),T=Pn(U,n,X,0);te.marginLeft=T,ae=T}else if(M.type==="margin-right"){const U=Math.max(0,Math.min(h-x-Wr,M.startMarginPx-Y)),T=Pn(U,n,X,0);te.marginRight=T,ae=T}else if(M.type==="first-line-indent"){const U=-M.startLeftIndentPx,T=h-x-b-M.startLeftIndentPx-Wr,V=Math.max(U,Math.min(T,M.startFirstLinePx+Y)),Q=Pn(V,n,X,0);te.firstLineIndentPx=Q,ae=Q}else if(M.type==="left-indent"){const U=Math.max(0,M.startLeftIndentPx+Y),T=Pn(U,n,X,0);te.leftIndentPx=T,te.firstLineIndentPx=M.startFirstLinePx,ae=T}else if(M.type==="right-indent"){const U=Math.max(0,M.startRightIndentPx-Y),T=Pn(U,n,X,0);te.rightIndentPx=T,ae=T}return te.measurementPx=ae,te},onPreview:Z=>{M.type==="margin-left"?a==null||a({left:Z.marginLeft}):M.type==="margin-right"&&(a==null||a({right:Z.marginRight}))},onCommit:Z=>{M.type==="margin-left"?o==null||o({left:Z.marginLeft}):M.type==="margin-right"?o==null||o({right:Z.marginRight}):M.type==="first-line-indent"?s==null||s({firstLineIndentPx:Z.firstLineIndentPx}):M.type==="left-indent"?s==null||s({leftIndentPx:Z.leftIndentPx}):M.type==="right-indent"&&(s==null||s({rightIndentPx:Z.rightIndentPx}))}})},[x,b,h,n,w,t,o,a,s,p]),L=y+S,E=L+k,N=h-v-D,j=h*w;return i.jsxs("div",{className:`${me.rulerRoot} ${me.horizontalRulerGroup}`,style:{width:`${j}px`},"data-testid":"horizontal-ruler",children:[i.jsxs("div",{className:me.horizontalRulerTrack,children:[i.jsxs("div",{className:me.horizontalInner,style:{left:`${y*w}px`,width:`${I*w}px`},"data-testid":"ruler-printable-area",children:[i.jsx("div",{className:`${me.dragEdgeLeft} ${d==="margin-left"?me.dragEdgeActive:""}`,title:u("rulerMarginLeft"),"aria-label":u("rulerMarginLeft"),"data-testid":"ruler-margin-splitter-left",onPointerDown:M=>R({type:"margin-left",startMarginPx:x},M)}),i.jsx("div",{className:`${me.dragEdgeRight} ${d==="margin-right"?me.dragEdgeActive:""}`,title:u("rulerMarginRight"),"aria-label":u("rulerMarginRight"),"data-testid":"ruler-margin-splitter-right",onPointerDown:M=>R({type:"margin-right",startMarginPx:b},M)})]}),P.map((M,F)=>i.jsxs(c.Fragment,{children:[i.jsx("div",{className:me.tickH,style:{left:`${M.positionPx*w}px`,height:`${M.height}px`}}),M.label?i.jsx("span",{className:me.tickLabelH,style:{left:`${M.positionPx*w}px`},children:M.label}):null]},F)),A?i.jsxs(i.Fragment,{children:[i.jsx(Fs,{type:"down",style:{left:`${E*w}px`},active:d==="first-line-indent",title:u("rulerFirstLineIndent"),"aria-label":u("rulerFirstLineIndent"),"data-testid":"ruler-first-line-indent",onPointerDown:M=>R({type:"first-line-indent",startFirstLinePx:t.firstLineIndentPx,startLeftIndentPx:t.leftIndentPx},M)}),i.jsx(Fs,{type:"up",style:{left:`${L*w}px`},active:d==="left-indent",title:u("rulerLeftIndent"),"aria-label":u("rulerLeftIndent"),"data-testid":"ruler-left-indent",onPointerDown:M=>R({type:"left-indent",startLeftIndentPx:t.leftIndentPx,startFirstLinePx:t.firstLineIndentPx},M)}),i.jsx(Fs,{type:"up",style:{left:`${N*w}px`},active:d==="right-indent",title:u("rulerRightIndent"),"aria-label":u("rulerRightIndent"),"data-testid":"ruler-right-indent",onPointerDown:M=>R({type:"right-indent",startRightIndentPx:t.rightIndentPx},M)})]}):null]}),i.jsx("div",{className:me.horizontalRulerShelf,"aria-hidden":!0}),g?i.jsx("div",{className:me.rulerTooltip,style:{left:g.clientX,top:g.clientY},"data-testid":"ruler-drag-tooltip",children:cf(g.measurementPx,n)}):null]})},EE=({geometry:e,unit:t="in",zoomScale:n=1,onMarginChange:r,onMarginPreview:o})=>{const a=q(),{activeTarget:s,dragPreview:u,startPointerDrag:d}=lp(),g=(e==null?void 0:e.pageHeightPx)??1056,p=(e==null?void 0:e.marginsPx.top)??96,h=(e==null?void 0:e.marginsPx.bottom)??96,x=n>0?n:1,b=(u==null?void 0:u.marginTop)??p,w=(u==null?void 0:u.marginBottom)??h,y=Math.max(0,g-b-w),v=c.useMemo(()=>uf(g,b,t),[g,b,t]),k=c.useCallback((S,D)=>{Number.isFinite(D.clientX)&&D.clientX;const I=Number.isFinite(D.clientY)?D.clientY:0;d(S.type,D,{updateDragState:(A,P,R)=>{const L=(P-I)/x,E={target:S.type,marginTop:p,marginBottom:h,measurementPx:0,clientX:A,clientY:P};if(S.type==="margin-top"){const N=Math.max(0,Math.min(g-h-Wr,S.startMarginPx+L)),j=Pn(N,t,R,0);E.marginTop=j,E.measurementPx=j}else if(S.type==="margin-bottom"){const N=Math.max(0,Math.min(g-p-Wr,S.startMarginPx-L)),j=Pn(N,t,R,0);E.marginBottom=j,E.measurementPx=j}return E},onPreview:A=>{S.type==="margin-top"?o==null||o({top:A.marginTop}):S.type==="margin-bottom"&&(o==null||o({bottom:A.marginBottom}))},onCommit:A=>{S.type==="margin-top"?r==null||r({top:A.marginTop}):S.type==="margin-bottom"&&(r==null||r({bottom:A.marginBottom}))}})},[p,h,g,t,x,r,o,d]);return i.jsxs("div",{className:`${me.rulerRoot} ${me.verticalRuler}`,style:{height:`${g}px`},"data-testid":"vertical-ruler",children:[i.jsxs("div",{className:me.verticalInner,style:{top:`${b}px`,height:`${y}px`},"data-testid":"ruler-printable-area-vertical",children:[i.jsx("div",{className:`${me.dragEdgeTop} ${s==="margin-top"?me.dragEdgeActiveV:""}`,title:a("rulerMarginTop"),"aria-label":a("rulerMarginTop"),"data-testid":"ruler-margin-splitter-top",onPointerDown:S=>k({type:"margin-top",startMarginPx:p},S)}),i.jsx("div",{className:`${me.dragEdgeBottom} ${s==="margin-bottom"?me.dragEdgeActiveV:""}`,title:a("rulerMarginBottom"),"aria-label":a("rulerMarginBottom"),"data-testid":"ruler-margin-splitter-bottom",onPointerDown:S=>k({type:"margin-bottom",startMarginPx:h},S)})]}),v.map((S,D)=>i.jsxs(c.Fragment,{children:[i.jsx("div",{className:me.tickV,style:{top:`${S.positionPx}px`,width:`${S.height}px`}}),S.label?i.jsx("span",{className:me.tickLabelV,style:{top:`${S.positionPx}px`},children:S.label}):null]},D)),u?i.jsx("div",{className:me.rulerTooltip,style:{left:u.clientX,top:u.clientY},"data-testid":"ruler-drag-tooltip",children:cf(u.measurementPx,t)}):null]})};function cp(e){if(e!==1)return{zoom:e,"--page-zoom":String(e)}}function up({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}){if(!e)return null;const d=ap;return i.jsx("div",{className:ce.multiPageRulerLayer,children:i.jsxs("div",{className:ce.pageBlock,children:[i.jsx("div",{className:ce.pageSurfaceRulerGutter,style:{width:`${d}px`,flex:`0 0 ${d}px`},"aria-hidden":!0}),i.jsx(RE,{geometry:t,indentState:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u})]})})}function dp({showVerticalRuler:e=!1,pageSized:t=!1,geometry:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:u,pageBlockStyle:d}){const g=o>0?o:1,p=e?ap/g:0;return i.jsxs("div",{className:`${ce.pageBlock} ${t?"":ce.pageBlockFluid}`,style:d,children:[i.jsx("div",{className:ce.pageSurfaceRulerGutter,style:{width:`${p}px`,flex:`0 0 ${p}px`},children:e?i.jsx(EE,{geometry:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s}):null}),u]})}function jE({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u,children:d}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:e?"center":"stretch",width:"100%",height:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(up,{showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}),i.jsx("div",{className:ce.pageZoomContent,style:cp(o),children:i.jsx(dp,{showVerticalRuler:e,pageSized:e,geometry:t,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:d})})]})}function dc(){return{firstLineIndentPx:0,leftIndentPx:0,rightIndentPx:0,mixed:!1}}function Oi(e){const t=Kt(e);if(t.length===0)return dc();let n=null,r=null,o=null,a=!1;for(const s of t){const u=s.style.textIndent,d=s.style.marginLeft,g=s.style.marginRight,p=u?An(u,0):0,h=d?An(d,0):0,x=g?An(g,0):0;n===null?(n=p,r=h,o=x):(Math.abs(n-p)>1||Math.abs((r??0)-h)>1||Math.abs((o??0)-x)>1)&&(a=!0)}return{firstLineIndentPx:n??0,leftIndentPx:r??0,rightIndentPx:o??0,mixed:a}}function TE(e){var r;const t=(r=window.getSelection())==null?void 0:r.getRangeAt(0);if(!t)return null;let n=t.startContainer;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);n&&n!==e&&n!==document.body;){if(n instanceof HTMLElement){const o=n.tagName.toLowerCase();if(["p","h1","h2","h3","h4","h5","h6","li","blockquote","div"].includes(o))return n}n=n.parentNode}return null}function NE(e,t){return gn(e,()=>{let n=Nn(e);if(n.length===0){const a=TE(e);a&&(n=[a])}if(n.length===0)return!1;const r=t.unit??"in";let o=!1;for(const a of n){if(t.firstLineIndentPx!==void 0)if(Math.abs(t.firstLineIndentPx)<.5)a.style.textIndent&&(a.style.removeProperty("text-indent"),o=!0);else{const s=he(Cs(t.firstLineIndentPx,r));a.style.textIndent!==s&&(a.style.textIndent=s,o=!0)}if(t.leftIndentPx!==void 0)if(t.leftIndentPx<=.5)a.style.marginLeft&&(a.style.removeProperty("margin-left"),o=!0);else{const s=he(Cs(t.leftIndentPx,r));a.style.marginLeft!==s&&(a.style.marginLeft=s,o=!0)}if(t.rightIndentPx!==void 0)if(t.rightIndentPx<=.5)a.style.marginRight&&(a.style.removeProperty("margin-right"),o=!0);else{const s=he(Cs(t.rightIndentPx,r));a.style.marginRight!==s&&(a.style.marginRight=s,o=!0)}We(a)}return o})}function IE(e,t,n=!0){const[r,o]=c.useState(null),[a,s]=c.useState(dc()),u=c.useCallback(()=>{!n||!e||(o(sp(e,t)),s(Oi(e)))},[n,e,t]);return c.useLayoutEffect(()=>{if(!n)return;const d=requestAnimationFrame(u);return()=>cancelAnimationFrame(d)},[n,u]),c.useLayoutEffect(()=>{if(!n||!e||typeof ResizeObserver>"u")return;const d=new ResizeObserver(()=>u());return d.observe(e),()=>d.disconnect()},[n,e,u]),c.useLayoutEffect(()=>{if(!n||!e)return;const d=()=>{s(Oi(e))};return document.addEventListener("selectionchange",d),()=>document.removeEventListener("selectionchange",d)},[n,e]),{geometry:r,indentState:a,refresh:u}}const ME=c.forwardRef(function({html:t,pageHtml:n,onChange:r,placeholder:o,disabled:a,rulerVisible:s=!0,rulerUnit:u="in",zoomScale:d=1,onMarginChange:g,onMarginPreview:p,onIndentChange:h,onBeforeInput:x,onPointerDown:b,onMouseUp:w,onContextMenu:y},v){const k=q(),S=c.useRef(null),[D,I]=c.useState(null),A=c.useRef(x);A.current=x;const P=n??t,R=s&&pl(P),{geometry:L,indentState:E,refresh:N}=IE(D,P,R),j=F=>{S.current=F,I(F),typeof v=="function"?v(F):v&&(v.current=F)};c.useLayoutEffect(()=>{const F=S.current;if(!F)return;const $=or(t);F.innerHTML!==$&&(F.innerHTML=$),Gi(F),mr(F,P)},[t,P]),c.useLayoutEffect(()=>{const F=S.current;if(!F)return;const $=Z=>{var ne;(ne=A.current)==null||ne.call(A,Z)};return F.addEventListener("beforeinput",$),()=>F.removeEventListener("beforeinput",$)},[]);const M=i.jsx("div",{ref:j,className:`${ce.surface} ${ce.visual} ${R?ce.pageSurface:""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":k("visualEditorAria"),"aria-disabled":a||void 0,"data-placeholder":o,onPointerDown:b,onMouseUp:w,onContextMenu:y,onInput:F=>{r(F.currentTarget.innerHTML),R&&N()}});return i.jsx(jE,{showRulers:R,geometry:L,indentState:E,rulerUnit:u,zoomScale:d,onMarginChange:g,onMarginPreview:p,onIndentChange:h,children:M})});function _E(e,t){const n=Object.keys(t);return Object.keys(e).length!==n.length?!1:n.every(r=>{const o=e[Number(r)],a=t[Number(r)];return(o==null?void 0:o.pageWidthPx)===a.pageWidthPx&&(o==null?void 0:o.pageHeightPx)===a.pageHeightPx&&(o==null?void 0:o.marginsPx.top)===a.marginsPx.top&&(o==null?void 0:o.marginsPx.right)===a.marginsPx.right&&(o==null?void 0:o.marginsPx.bottom)===a.marginsPx.bottom&&(o==null?void 0:o.marginsPx.left)===a.marginsPx.left})}function LE(e,t,n,r=!0,o=1){const[a,s]=c.useState({}),[u,d]=c.useState(dc()),g=c.useCallback(h=>a[h]??null,[a]),p=c.useCallback(()=>{const h=e.current;if(!r||!h)return;const x={};for(let w=0;w<t.length;w+=1){const y=et(h,w);if(!y)continue;const v=t[w]??t[0]??"";x[w]=sp(y,v)}s(w=>_E(w,x)?w:x);const b=et(h,n());b&&d(Oi(b))},[r,e,t,n]);return c.useLayoutEffect(()=>{if(!r)return;const h=requestAnimationFrame(p);return()=>cancelAnimationFrame(h)},[r,n,t,o,p]),c.useLayoutEffect(()=>{if(!r||typeof ResizeObserver>"u")return;const h=e.current;if(!h)return;const x=new ResizeObserver(()=>p());for(let b=0;b<t.length;b+=1){const w=et(h,b);w&&x.observe(w)}return()=>x.disconnect()},[r,e,t.length,p]),c.useLayoutEffect(()=>{if(!r)return;const h=()=>{const x=e.current;if(!x)return;const b=et(x,n());b&&d(Oi(b))};return document.addEventListener("selectionchange",h),()=>document.removeEventListener("selectionchange",h)},[r,e,n]),{pageGeometries:a,geometryForPage:g,indentState:u,refresh:p}}const FE=c.forwardRef(function({pages:t,activePageIndex:n,hasSelectedPage:r=!1,onActivePageIndexChange:o,onPageSelected:a,onPageChange:s,placeholder:u,disabled:d,rulerVisible:g=!0,rulerUnit:p="in",zoomScale:h=1,onMarginChange:x,onMarginPreview:b,onIndentChange:w,onBeforeInput:y,onPointerDown:v,onMouseUp:k,onContextMenu:S},D){const I=q(),A=c.useRef(null),P=c.useRef(n);P.current=n;const R=c.useRef(y);R.current=y;const L=c.useRef(t);L.current=t;const E=c.useRef(a);E.current=a;const N=c.useCallback(()=>P.current,[]),{geometryForPage:j,indentState:M,refresh:F}=LE(A,t,N,!0,h),$=r?n:0,Z=t[$]??"",ne=U=>pl(t[U]??""),X=g&&pl(Z),Y=c.useCallback(U=>{var Q;P.current=U,U!==n&&o(U),(Q=E.current)==null||Q.call(E,U),F();const T=A.current;if(!T)return;const V=et(T,U);V&&requestAnimationFrame(()=>er(V))},[n,o,F]);c.useImperativeHandle(D,()=>({getContainer:()=>A.current,getActivePageRoot:()=>{const U=A.current;return U?et(U,P.current):null},getActivePageIndex:()=>P.current,flushPageHtml:U=>{var V;const T=A.current;return T?((V=et(T,U))==null?void 0:V.innerHTML)??null:null}}));const ae=c.useCallback((U,T)=>{const V=or(Ce(T).body);!(U===document.activeElement)&&U.innerHTML!==V&&(U.innerHTML=V),yf(U),sd(U),Gi(U),mr(U,T);const G=pn(U);G&&Dy(U,G)},[]);c.useLayoutEffect(()=>{const U=A.current;if(!U)return;for(let V=0;V<t.length;V+=1){const Q=et(U,V);Q&&ae(Q,t[V]??"")}const T=requestAnimationFrame(F);return()=>cancelAnimationFrame(T)},[t,ae,F]),c.useLayoutEffect(()=>{const U=A.current;if(!U)return;const T=V=>{var ve;const Q=V,G=V.target;G instanceof HTMLElement&&G.hasAttribute(ir)&&(Q.inputType==="insertParagraph"||Q.inputType==="insertLineBreak")&&er(G),(ve=R.current)==null||ve.call(R,Q)};return U.addEventListener("beforeinput",T),()=>U.removeEventListener("beforeinput",T)},[]);const te=c.useCallback((U,T)=>{Y(U),v==null||v(T)},[Y,v]);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:X?"center":"stretch",width:"100%",height:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(up,{showRulers:X,geometry:j($),indentState:M,rulerUnit:p,zoomScale:h,onMarginChange:U=>{x==null||x($,U)},onMarginPreview:U=>{b==null||b($,U)},onIndentChange:U=>{w==null||w(U)}}),i.jsx("div",{className:ce.pageZoomContent,style:cp(h),children:i.jsx("div",{ref:A,className:ce.multiPageContainer,style:{display:"flex",flexDirection:"column",alignItems:X?"center":"stretch",width:"100%",minHeight:X?void 0:"100%",position:"relative"},children:t.map((U,T)=>i.jsx(dp,{showVerticalRuler:X&&ne(T),pageSized:ne(T),geometry:j(T),rulerUnit:p,zoomScale:h,pageBlockStyle:{marginTop:T>0?"1.5rem":"0"},onMarginChange:V=>{x==null||x(T,V)},onMarginPreview:V=>{b==null||b(T,V)},children:i.jsx("div",{className:`${ce.surface} ${ce.visual} ${ne(T)?ce.pageSurface:""}`,[ir]:"","data-page-index":T,contentEditable:!d,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":I("visualEditorAria"),"aria-disabled":d||void 0,"data-placeholder":T===0?u:void 0,onFocus:()=>Y(T),onPointerDown:V=>te(T,V),onMouseUp:k,onContextMenu:S,onInput:V=>{const Q=V.currentTarget;sd(Q)&&er(Q),s(T,Q.innerHTML),F()}})},T))})})]})});function BE(e,t,n){return r=>{const o=e();o&&n(o,t(),r)}}function HE(e,t,n,r){return o=>{const a=e();if(!a)return;const s=n(a,t(),o);r(s.pageHtml)}}function zE(e,t,n){return(r,o)=>{const a=e(r);a&&n(a,t(r),o)}}function OE(e,t,n,r){return(o,a)=>{const s=e(o);if(!s)return;const u=n(s,t(o),a);r(o,u.pageHtml)}}function ym(e,t,n){return r=>{const o=e();o&&NE(o,{...r,unit:t})&&n(o)}}const $E=.005;function KE({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:o,onOpen:a,mode:s,defaultMode:u="visual",onModeChange:d,fullscreen:g,defaultFullscreen:p=!1,onFullscreenChange:h,placeholder:x,disabled:b,readOnly:w=!1,className:y,locale:v="en",toolbarBackground:k,menuColor:S,menuBackground:D,menuFontSize:I,menuFontFamily:A,border:P,menuVisible:R=!0,toolbarVisible:L=!0,allowedChrome:E,customActions:N,customFonts:j,transformHtml:M,sanitizeHtml:F=!0,loadCustomParagraphStyles:$,onSaveCustomParagraphStyle:Z,onDeleteCustomParagraphStyle:ne,customImagePicker:X,disableBuiltinImageInsert:Y,customAudioPicker:ae,disableBuiltinAudioInsert:te,customVideoPicker:U,disableBuiltinVideoInsert:T,disableHtmlFileDrop:V=!1,toolbarCustomization:Q,darkMode:G=!1,darkModePersistence:ve,toolbarPosition:He="top",toolbarPositionPersistence:_e,enablePageProperties:Ut=!1,defaultPageProperties:bn,enableMultiPages:De=!1,pages:na,defaultPages:mp,onPagesChange:mc,defaultRulerVisible:fp=!0,rulerUnit:In="in",enableComments:$e=!1,defaultCommentsVisible:gp=!0,commentAuthor:oo,comments:pp,defaultComments:hp=[],onCommentsChange:bp}){const se=!!(b||w),fr=!!b,yp=De?na!==void 0:e!==void 0,fc=ud(mp??(t.trim()?[t]:[pi()])),gc=!yp&&bn?fc.map(l=>Dd(l,bn)):fc,pc=De?at(gc):gc[0]??"",xp=F?xi(pc):pc,io=De&&na!==void 0?at(ud(na)):e,wp=c.useMemo(()=>{if(io!==void 0)return F?xi(io):io},[io,F]),[Re,hc]=oi({value:wp,defaultValue:xp,onChange:De?void 0:n}),[we,bc]=oi({value:s,defaultValue:u,onChange:d}),[Tt,gr]=oi({value:g,defaultValue:p,onChange:h}),[yt,Cp]=c.useState(gp),[pr,vp]=c.useState(fp),yc=c.useRef(pr);yc.current=pr;const[xt,Nt]=c.useState(null),[Mn,hr]=oi({value:pp,defaultValue:hp,onChange:bp}),B=c.useRef(null),ra=c.useRef(null),ao=c.useRef(null),wt=c.useRef(null),Ze=c.useRef(null),pe=c.useRef(De);pe.current=De;const oa=c.useRef(bn);oa.current=bn;const yn=c.useRef($e);yn.current=$e;const xc=c.useRef(w);xc.current=w;const wc=c.useRef(se);wc.current=se;const so=c.useRef(yt);so.current=yt;const lo=c.useRef(Mn);lo.current=Mn;const co=c.useRef(mc);co.current=mc;const[Wt,ia]=c.useState(0),ze=c.useRef(Wt);ze.current=Wt;const[_n,br]=c.useState(!1),Ct=c.useRef(_n);Ct.current=_n;const aa=c.useRef(null);aa.current===null&&(aa.current=kD(Re));const rt=aa.current,re=c.useRef(Re);re.current=Re;const yr=c.useRef(!0),sa=c.useRef(""),Ln=c.useRef(null),H=c.useRef(we);H.current=we;const Cc=c.useRef(Tt);Cc.current=Tt;const Ee=c.useRef(null),[,kp]=c.useState(0),xr=c.useRef(null);xr.current===null&&(xr.current=d0(()=>{kp(l=>l+1)}));const uo=c.useRef(M);uo.current=M;const vc=c.useRef(F);vc.current=F;const ot=c.useRef({}),Ye=c.useRef(null),it=c.useRef(null),mt=c.useRef(null),ft=c.useRef(null),Vt=c.useRef(null),Xe=c.useRef(null),[mo,la]=c.useState(Ht),ca=c.useRef(mo);ca.current=mo;const It=c.useRef(Rn),[wr,fo]=c.useState({value:null,unit:Rn,mixed:!1}),Gt=c.useRef(wr);Gt.current=wr;const[Cr,ua]=c.useState({value:null,mixed:!1}),vr=c.useRef(Cr);vr.current=Cr;const[kr,da]=c.useState({value:null,mixed:!1}),Sr=c.useRef(kr);Sr.current=kr;const[Pr,ma]=c.useState({value:null,mixed:!1}),Ar=c.useRef(Pr);Ar.current=Pr;const[fa,ga]=c.useState({tag:null,mixed:!1}),pa=c.useRef(fa);pa.current=fa;const[kc,ha]=c.useState({align:"left",mixed:!1}),ba=c.useRef(kc);ba.current=kc;const[Sc,ya]=c.useState({type:null,mixed:!1}),Dr=c.useRef(Sc);Dr.current=Sc;const[Pc,xa]=c.useState(!1),Ac=c.useRef(Pc);Ac.current=Pc;const[wa,Ca]=c.useState(!1),va=c.useRef(wa);va.current=wa;const[ka,Dc]=c.useState(!1),go=c.useRef(ka);go.current=ka;const po=c.useRef(null),ho=c.useRef(null),[Rc,Ec]=c.useState(!1),jc=c.useRef(Rc);jc.current=Rc;const[Rr,bo]=c.useState({open:!1,tab:"general"}),[Sa,Tc]=c.useState(!1),[Er,Nc]=c.useState({open:!1,html:""}),[Pa,yo]=c.useState(null),[Sp,Aa]=c.useState(!1),[Pp,Da]=c.useState(!1),[Fn,xo]=c.useState(()=>ve?G:dm()??G),[gt,wo]=c.useState(()=>_e?He:mm()??He),[Co,Ap]=c.useState(()=>QA()??"fitWidth"),[vo,Dp]=c.useState(1),[qt,Bn]=c.useState({open:!1,tab:"general",value:Qn(),backgroundImage:zt()}),[ko,Ra]=c.useState({open:!1,value:""}),[Zt,xn]=c.useState({open:!1,tab:"font",paragraphTab:"spacing",value:bi()}),[Ea,ja]=c.useState(!1),[Ta,Ic]=c.useState([]),[Na,Ia]=c.useState(!1),[Rp,So]=c.useState(!1),[Te,jr]=c.useState({open:!1}),[Je,Po]=c.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[Ma,_a]=c.useState({open:!1,existingIds:[]}),[Ep,Ao]=c.useState({open:!1}),[jp,Do]=c.useState({open:!1}),[Tp,Tr]=c.useState({open:!1}),[Ro,Eo]=c.useState({open:!1,tab:"general",value:dg(),aspectRatio:1}),[La,Fa]=c.useState({open:!1}),[jo,Ba]=c.useState({open:!1,value:nv()}),[To,Ha]=c.useState({open:!1,value:mv()}),[No,za]=c.useState({open:!1,value:vv()}),[Yt,Oa]=c.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1,canDeletePage:!1}),[Ne,Hn]=c.useState(null),$a=c.useRef(Ne);$a.current=Ne;const[Ka,Mc]=c.useState(!1),_c=c.useRef(Ka);_c.current=Ka;const[Ua,Lc]=c.useState(!1),Fc=c.useRef(Ua);Fc.current=Ua;const[Wa,Bc]=c.useState(!1),Hc=c.useRef(Wa);Hc.current=Wa;const zc=c.useRef(void 0),Io=c.useRef(Ta);Io.current=Ta;const Oc=c.useRef(Na);Oc.current=Na;const Va=!!($&&Z),Ga=c.useRef(Va);Ga.current=Va;const $c=c.useRef($);$c.current=$;const Kc=c.useRef(Z);Kc.current=Z;const Uc=c.useRef(ne);Uc.current=ne;const Wc=c.useRef(o);Wc.current=o;const Vc=c.useRef(a);Vc.current=a;const Gc=c.useRef(X);Gc.current=X;const qc=c.useRef(ae);qc.current=ae;const Zc=c.useRef(U);Zc.current=U;const Yc=c.useRef(Q);Yc.current=Q;const Xc=c.useRef(ve);Xc.current=ve;const Jc=c.useRef(_e);Jc.current=_e;const Qc=c.useRef(Fn);Qc.current=Fn;const eu=c.useRef(gt);eu.current=gt;const Mo=c.useRef(Co);Mo.current=Co;const _o=c.useRef(vo);_o.current=vo;const tu=c.useRef(Y);tu.current=Y;const nu=c.useRef(te);nu.current=te;const ru=c.useRef(T);ru.current=T;const qa=c.useRef(0),Nr=c.useRef(0),ou=c.useRef(0),Lo=c.useRef(0),iu=c.useRef(0),Fo=c.useRef(0),au=c.useRef(0),Xt=c.useMemo(()=>vf(j),[j]),zn=c.useRef(Xt);zn.current=Xt;const Za=c.useMemo(()=>Yy(Re,Xt).join(`
127
+ `),[Re,Xt]),On=c.useMemo(()=>Se(Re).map(l=>Ce(l).body),[Re]),wn=c.useCallback(()=>{var l;if(pe.current){const m=(l=wt.current)==null?void 0:l.getActivePageRoot();if(m instanceof HTMLElement)return m}return B.current},[]);c.useLayoutEffect(()=>{var m;if(!De)return;const l=(m=wt.current)==null?void 0:m.getActivePageRoot();l instanceof HTMLDivElement&&(B.current=l)},[De,Wt,On.length]);const Bo=c.useMemo(()=>De?On[_n?Wt:0]??"":Ce(Re).body,[De,On,Wt,_n,Re]),Cn=c.useMemo(()=>gf(Qe(Bo)),[Bo]),su=c.useRef(Bo);su.current=Bo;const lu=c.useRef(Cn);lu.current=Cn;const Ho=c.useRef(()=>{}),Ya=c.useRef(!1),Np=c.useCallback(()=>{if(Ya.current||H.current!=="visual")return;const l=ao.current;if(l){Ya.current=!0;try{const m=getComputedStyle(l),C=parseFloat(m.paddingLeft)+parseFloat(m.paddingRight),_=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom),z=Math.max(0,l.clientWidth-C),J=Math.max(0,l.clientHeight-_);let ye=0,Lt=0;if(lu.current){const kt=Cy(Qe(su.current));kt&&(ye=kt.width,Lt=kt.height)}else{const kt=wn(),Vu=_o.current>0?_o.current:1;ye=((kt==null?void 0:kt.offsetWidth)??0)/Vu,Lt=((kt==null?void 0:kt.offsetHeight)??0)/Vu}ye<=0&&(ye=z),Lt<=0&&(Lt=J);const Wu=Cx(Mo.current,z,J,ye,Lt);Math.abs(Wu-_o.current)>=$E&&Dp(Wu)}finally{Ya.current=!1}}},[wn]);Ho.current=Np,c.useLayoutEffect(()=>{if(we!=="visual")return;const l=wn();!l||l!==document.activeElement||er(l)},[we,Cn,Wt,On,wn]),c.useEffect(()=>{const m=(Za?Za.split(`
128
+ `):[]).map(C=>{const _=document.createElement("link");return _.rel="stylesheet",_.href=C,_.setAttribute(qi,""),document.head.append(_),_});return()=>{for(const C of m)C.remove()}},[Za]);const zo=c.useCallback(async()=>{const l=$c.current;if(!l)return;const m=++qa.current;Ia(!0);try{const C=await l();if(m!==qa.current)return;Ic(C)}catch{}finally{m===qa.current&&Ia(!1)}},[]);c.useEffect(()=>{if(!$||!Z){Ic([]),Ia(!1);return}zo()},[$,Z,zo]);const cu=c.useCallback(async l=>{yo(l);const m=Yc.current;if(m!=null&&m.load&&m.save){const C=++ou.current;Da(!0);try{await m.save(l)}catch{}finally{C===ou.current&&Da(!1)}return}DD(l)},[]);c.useEffect(()=>{const l=Q;if(!(l!=null&&l.load)||!l.save){yo(AD()),Aa(!1),Da(!1);return}const m=++Nr.current;return Aa(!0),(async()=>{try{const C=await l.load();if(m!==Nr.current)return;yo(C)}catch{if(m!==Nr.current)return;yo(null)}finally{m===Nr.current&&Aa(!1)}})(),()=>{Nr.current+=1}},[Q]);const uu=c.useCallback(async l=>{xo(l);const m=Xc.current;if(m!=null&&m.load&&m.save){const C=++iu.current;try{await m.save(l)}catch{}finally{if(C!==iu.current)return}return}YA(l)},[]),du=c.useCallback(l=>{Mo.current=l,Ap(l),eD(l);const m=ao.current;m&&(m.scrollTop=0,m.scrollLeft=0),Ho.current()},[]);c.useEffect(()=>{const l=ve;if(!(l!=null&&l.load)||!l.save){xo(dm()??G);return}const m=++Lo.current;return(async()=>{try{const C=await l.load();if(m!==Lo.current)return;xo(typeof C=="boolean"?C:G)}catch{if(m!==Lo.current)return;xo(G)}})(),()=>{Lo.current+=1}},[ve,G]),c.useLayoutEffect(()=>{if(Ho.current(),we!=="visual")return;const l=ao.current;if(!l||typeof ResizeObserver>"u")return;let m=null;const C=new ResizeObserver(()=>{m===null&&(m=window.requestAnimationFrame(()=>{m=null,Ho.current()}))});return C.observe(l),()=>{C.disconnect(),m!==null&&(window.cancelAnimationFrame(m),m=null)}},[we,Re,Wt,On,Co,Cn,De]);const mu=c.useCallback(async l=>{wo(l);const m=Jc.current;if(m!=null&&m.load&&m.save){const C=++au.current;try{await m.save(l)}catch{}finally{if(C!==au.current)return}return}nD(l)},[]);c.useEffect(()=>{const l=_e;if(!(l!=null&&l.load)||!l.save){wo(mm()??He);return}const m=++Fo.current;return(async()=>{try{const C=await l.load();if(m!==Fo.current)return;wo(ep(C)??He)}catch{if(m!==Fo.current)return;wo(He)}})(),()=>{Fo.current+=1}},[_e,He]);const $n=c.useCallback(l=>{var _,z;const m=vc.current?xi(l):l,C=((_=uo.current)==null?void 0:_.call(uo,m))??m;return C!==re.current&&(yr.current=!0),hc(C),pe.current&&((z=co.current)==null||z.call(co,Se(C),ze.current)),C},[hc]),be=c.useCallback((l,m)=>{const C=$n(l);return rt.record(C,{coalesce:m}),C},[$n,rt]),Ip=c.useCallback(l=>{if(pe.current){const m=Se(re.current),C=ze.current,_=[...m];_[C]=l,be(at(_),!1);return}be(l,!1)},[be]),Ir=xD({enabled:!se&&!V,onHtml:Ip}),le=c.useCallback((l,m)=>be(ti(l,ni(l,re.current,zn.current)),m),[be]),Mp=c.useCallback((l,m)=>le(Pt(l,re.current),m),[le]),Oo=c.useCallback((l,m,C)=>{Py(l,m,C)},[]),$o=c.useCallback((l,m,C)=>{const _={...yi(l),atRule:Qe(pf(m,C))};return al(l,_)},[]),Ko=c.useCallback((l,m)=>ti(l,ni(l,m,zn.current)),[]),Ke=c.useCallback(()=>{const l=wt.current;return(l==null?void 0:l.getContainer())?Se(re.current).map((_,z)=>{const J=l==null?void 0:l.flushPageHtml(z);if(J===null)return _;const ye=Pt(J,Ce(_).body);return Ko(ye,_)}):Se(re.current)},[Ko]),vn=c.useCallback((l,m,C)=>{const _=Se(re.current),z=[..._];z[l]=Ko(m,_[l]??""),be(at(z),C)},[be,Ko]),Mr=c.useCallback((l,m)=>{const C=Ce(l).body;pe.current?vn(ze.current,C,m):le(C,m)},[vn,le]),oe=c.useCallback((l,m)=>{var _;if(!pe.current){le(Pt(l.innerHTML,re.current),m);return}const C=(_=wt.current)==null?void 0:_.getContainer();if(!C){le(Pt(l.innerHTML,re.current),m);return}for(let z=0;z<Se(re.current).length;z+=1)if(et(C,z)===l){const J=Se(re.current)[z]??"";vn(z,Pt(l.innerHTML,Ce(J).body),m);return}le(Pt(l.innerHTML,re.current),m)},[vn,le]),fu=c.useCallback((l,m)=>{xc.current||oe(l,m)},[oe]),_p=c.useMemo(()=>BE(()=>B.current,()=>re.current,Oo),[Oo]),Lp=c.useMemo(()=>HE(()=>B.current,()=>re.current,$o,l=>le(Ce(l).body,!1)),[$o,le]),Fp=c.useMemo(()=>ym(()=>B.current,In??"in",l=>oe(l,!1)),[In,oe]),Bp=c.useMemo(()=>zE(l=>{var C;const m=(C=wt.current)==null?void 0:C.getContainer();return m?et(m,l):null},l=>Se(re.current)[l]??"",Oo),[Oo]),Hp=c.useMemo(()=>OE(l=>{var C;const m=(C=wt.current)==null?void 0:C.getContainer();return m?et(m,l):null},l=>Se(re.current)[l]??"",$o,(l,m)=>vn(l,Ce(m).body,!1)),[$o,vn]),zp=c.useMemo(()=>ym(()=>{var m;const l=(m=wt.current)==null?void 0:m.getContainer();return l?et(l,ze.current):null},In??"in",l=>oe(l,!1)),[In,oe]),gu=c.useCallback(()=>{const l=pe.current?Ke():Se(re.current);return l[ze.current]??l[0]??""},[Ke]),Kn=c.useCallback(()=>pe.current?Ke():[re.current],[Ke]),Uo=c.useCallback(l=>{if(!pe.current||H.current!=="visual"||!Ct.current)return;const m=Ke(),C=Math.max(0,Math.min(l,m.length)),_=[...m],z=oa.current?Dd(pi(),oa.current):pi();_.splice(C,0,z),be(at(_),!1),ze.current=C,ia(C),br(!0)},[Ke,be]),Un=c.useCallback(()=>{var C;const l=B.current;if(l!=null&&l.hasAttribute(ir)){const _=My(l);if(_!==null)return _}const m=(C=wt.current)==null?void 0:C.getActivePageIndex();return typeof m=="number"?m:ze.current},[]),pu=c.useCallback(()=>{const l=Un();l===null||!Ct.current||Uo(l)},[Uo,Un]),hu=c.useCallback(()=>{const l=Un();l===null||!Ct.current||Uo(l+1)},[Uo,Un]),bu=c.useCallback(()=>{if(!pe.current||H.current!=="visual"||!Ct.current)return;const l=Ke();if(l.length<=1)return;const m=Un();if(m===null)return;const C=l.filter((z,J)=>J!==m);be(at(C),!1);const _=Math.min(m,C.length-1);ze.current=_,ia(_),br(!0)},[Ke,be,Un]);c.useEffect(()=>{De||br(!1)},[De]);const Wo=c.useCallback(()=>{const l=rt.undo();l!==null&&(rt.markApplying(),$n(l))},[$n,rt]),Vo=c.useCallback(()=>{const l=rt.redo();l!==null&&(rt.markApplying(),$n(l))},[$n,rt]);c.useEffect(()=>{rt.syncExternal(Re)},[Re,rt]);const O=c.useCallback(()=>{Ee.current=St({mode:H.current,visualEl:B.current,htmlEl:Ze.current})},[]),vt=c.useCallback(l=>{if(!l||H.current!=="visual"){Mc(!1),Lc(!1),Bc(!1);return}Mc(ql(l)!==null),Lc(gd(l)),Bc(pd(l))},[]),Xa=c.useCallback(()=>{const l=St({mode:H.current,visualEl:B.current,htmlEl:Ze.current}),m=Ee.current;Qu(m,l)||(Ee.current=l)},[]),Ja=c.useCallback(()=>{const l=B.current;if(H.current!=="visual"||!l){fo({value:null,unit:It.current,mixed:!1});return}const m=Tf(l,It.current);Ye.current&&(m.value=Ye.current.value,m.unit=Ye.current.unit,m.mixed=!1),It.current=m.unit,fo(C=>C.value===m.value&&C.unit===m.unit&&C.mixed===m.mixed?C:m)},[]),Qa=c.useCallback(()=>{const l=B.current;if(H.current!=="visual"||!l){ua({value:null,mixed:!1});return}const m=Pf(l);it.current&&(m.value=it.current.value,m.mixed=!1),ua(C=>C.value===m.value&&C.mixed===m.mixed?C:m)},[]),es=c.useCallback(()=>{const l=B.current;if(H.current!=="visual"||!l){da({value:null,mixed:!1}),ma({value:null,mixed:!1});return}const m=ki(l,"color");mt.current&&(m.value=mt.current.value,m.mixed=!1);const C=ki(l,"backgroundColor");ft.current&&(C.value=ft.current.value,C.mixed=!1),da(_=>_.value===m.value&&_.mixed===m.mixed?_:m),ma(_=>_.value===C.value&&_.mixed===C.mixed?_:C)},[]),ts=c.useCallback(()=>{const l=B.current;if(H.current!=="visual"||!l){ga({tag:null,mixed:!1});return}const m=u1(l);ga(C=>C.tag===m.tag&&C.mixed===m.mixed?C:m)},[]),ns=c.useCallback(()=>{const l=B.current;if(H.current!=="visual"||!l){ha({align:null,mixed:!1}),ya({type:null,mixed:!1}),xa(!1),Ec(!1);return}const m=ig(l);ha(J=>J.align===m.align&&J.mixed===m.mixed?J:m);const C=Uf(l);ya(J=>J.type===C.type&&J.mixed===C.mixed?J:C);const _=w1(l);xa(J=>J===_?J:_);const z=jC(l);Ec(J=>J===z?J:z)},[]),K=c.useCallback(()=>{const l=B.current;if(H.current!=="visual"||!l){la(Ht()),Ca(!1),Ja(),Qa(),es(),ts(),ns();return}const m=Ee.current,C=!!(m&&!m.collapsed);Ca(z=>z===C?z:C);const _=Lf(Yn(l),ot.current);la(z=>$x(z,_)?z:_),Ja(),Qa(),es(),ts(),ns()},[Ja,Qa,es,ts,ns]),yu=c.useCallback(()=>{const l=Ee.current,m=Xe.current;!m||!l||l.collapsed&&l.start===m.start&&l.end===m.end||(ot.current={},Ye.current=null,it.current=null,mt.current=null,ft.current=null,Vt.current=null,Xe.current=null)},[]);c.useEffect(()=>{yr.current=!0},[Re]),c.useEffect(()=>{if(we==="visual"){K();return}ot.current={},Ye.current=null,it.current=null,mt.current=null,ft.current=null,Vt.current=null,Xe.current=null,la(Ht()),fo({value:null,unit:It.current,mixed:!1}),ua({value:null,mixed:!1}),da({value:null,mixed:!1}),ma({value:null,mixed:!1}),ga({tag:null,mixed:!1}),ha({align:null,mixed:!1}),ya({type:null,mixed:!1}),xa(!1),Ca(!1)},[we,K]);const Wn=c.useCallback((l,m,C)=>{Cb({snapshot:l,visualEl:B.current,htmlEl:Ze.current,getHtml:()=>H.current==="visual"&&B.current?B.current.innerHTML:re.current,setHtml:_=>{if(H.current==="visual"){const z=pe.current?Se(re.current)[ze.current]??"":re.current;Mr(Pt(Ce(_).body,Ce(z).body),!1);return}be(_,!1)},content:m,asHtml:C})},[be,Mr]),xu=c.useCallback(l=>{if(H.current==="visual"&&l==="html"){if(pe.current){const m=at(Ke());m!==re.current&&be(m,!0)}else if(B.current){const m=Pt(B.current.innerHTML,Ce(re.current).body),C=ti(m,ni(m,re.current,zn.current));C!==re.current&&be(C,!0)}}bc(l),l!=="visual"&&br(!1)},[be,bc,Ke]);c.useEffect(()=>{if(!Tt)return;const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}},[Tt]),c.useEffect(()=>{if(!Tt)return;const l=m=>{m.key==="Escape"&&(m.defaultPrevented||Rr.open||ko.open||qt.open||Zt.open||Ea||La.open||jo.open||To.open||No.open||Sa||Er.open||(m.preventDefault(),gr(!1)))};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[Tt,gr,Rr.open,ko.open,qt.open,Zt.open,Ea,La.open,jo.open,To.open,No.open,Sa,Er.open]),c.useEffect(()=>{const l=()=>{if(H.current!=="visual"||!B.current)return;const m=window.getSelection();if(!m||m.rangeCount===0)return;const C=m.anchorNode;!C||!B.current.contains(C)&&B.current!==C||Ln.current===null&&(Ln.current=window.requestAnimationFrame(()=>{var z;Ln.current=null;const _=B.current;if(!(!_||H.current!=="visual")&&(O(),yu(),K(),Hn(rn(_)),vt(_),yn.current&&so.current&&!((z=ra.current)!=null&&z.contains(document.activeElement)))){const J=Ee.current;J&&Nt(Nd(_,J))}}))};return document.addEventListener("selectionchange",l),()=>{document.removeEventListener("selectionchange",l),Ln.current!==null&&(window.cancelAnimationFrame(Ln.current),Ln.current=null)}},[O,yu,K,vt]),c.useEffect(()=>{(!$e||we!=="visual"||!yt)&&Nt(null)},[$e,we,yt]),c.useEffect(()=>{if(!xt)return;const l=m=>{var z;const C=m.target;if((z=ra.current)!=null&&z.contains(C))return;const _=B.current;_&&Md(_,C)||Nt(null)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[xt]),c.useEffect(()=>{if(we!=="html")return;const l=Ze.current;if(!l)return;const m=()=>O();return l.addEventListener("select",m),l.addEventListener("keyup",m),l.addEventListener("mouseup",m),()=>{l.removeEventListener("select",m),l.removeEventListener("keyup",m),l.removeEventListener("mouseup",m)}},[we,O]),c.useLayoutEffect(()=>{if(we!=="visual"||se){Hn(null);return}const l=B.current;if(!l)return;const m=rn(l);Hn(C=>m||(C&&C.isConnected&&l.contains(C)?C:null))},[Re,we,se]);const W=c.useCallback(l=>{const m=St({mode:"visual",visualEl:l,htmlEl:Ze.current}),C=Ee.current,_=Qu(C,m)?C:m.visualRange?m:C??m;Ee.current=_,l.focus();const z=wb(l,_);if(z){const J=window.getSelection();try{J==null||J.removeAllRanges(),J==null||J.addRange(z),Ee.current={..._,visualRange:z}}catch{}}return Ee.current??_},[]),Mt=c.useCallback(()=>{po.current=null,ho.current=null,Dc(!1)},[]),wu=c.useCallback(()=>{if(!go.current||!po.current||!ho.current||H.current!=="visual")return;const l=B.current;if(!l)return;O();const m=Ee.current;!m||m.collapsed||s0(m,ho.current)||(W(l),c0(l,po.current),oe(l,!1),O(),K(),Mt())},[O,W,le,K,Mt]),Cu=c.useCallback(()=>{if(H.current!=="visual"){Mt();return}if(go.current){Mt();return}const l=B.current;if(!l){Mt();return}const m=W(l);if(m.collapsed){Mt();return}po.current=l0(l),ho.current={...m},Dc(!0),O()},[Mt,W,O]),vu=c.useCallback(()=>{wu()},[wu]);c.useEffect(()=>{(we!=="visual"||se)&&Mt()},[we,se,Mt]);const rs=c.useCallback((l,m)=>{if(H.current!=="visual")return;const C=B.current;if(!C)return;const _=m??It.current,z=En(l,_);if(!z)return;It.current=z.unit;const J=W(C);if(J.collapsed){Ye.current=z,Xe.current={start:J.start,end:J.end},K();return}Ye.current=null,Vs(C,z.value,z.unit)&&(oe(C,!1),O(),K())},[W,le,O,K]),ku=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(C.collapsed){it.current={value:l},Xe.current={start:C.start,end:C.end},K();return}it.current=null,Ks(m,l)&&(oe(m,!1),O(),K())},[W,le,O,K]),os=c.useCallback((l,m)=>{if(H.current!=="visual")return;const C=B.current;if(!C)return;const _=W(C),z=l==="color"?mt:ft;if(_.collapsed){z.current={value:m},Xe.current={start:_.start,end:_.end},K();return}z.current=null,Or(C,l,m)&&(oe(C,!1),O(),K())},[W,le,O,K]),is=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(bo({open:!1,tab:"general"}),C.collapsed){if(l.size!==null){const ye=En(l.size,l.unit);ye&&(Ye.current=ye,It.current=ye.unit)}const z=Yn(m),J={};for(const ye of ct)l.marks[ye]!==z[ye]&&(J[ye]=l.marks[ye]);ot.current=J,l.fontColorMixed||(mt.current={value:l.fontColor}),l.highlightColorMixed||(ft.current={value:l.highlightColor}),l.fontFamilyMixed||(it.current={value:l.fontFamily}),Xe.current={start:C.start,end:C.end},K();return}if(ot.current={},Ye.current=null,it.current=null,mt.current=null,ft.current=null,Xe.current=null,l.size!==null){const z=En(l.size,l.unit);z&&(It.current=z.unit,Vs(m,z.value,z.unit))}const _=Yn(m);for(const z of ct)l.marks[z]!==_[z]&&Zs(m,z);l.fontFamilyMixed||Ks(m,l.fontFamily),l.fontColorMixed||Or(m,"color",l.fontColor),l.highlightColorMixed||Or(m,"backgroundColor",l.highlightColor),oe(m,!1),O(),K()},[W,le,O,K]),Su=c.useCallback((l,m)=>{if(H.current!=="visual")return;const C=B.current;if(!C)return;W(C),Bn(z=>({...z,open:!1}));let _=sg(C,l);if(m&&nC(C,m)&&(_=!0),!_){O(),K();return}oe(C,!1),O(),K()},[W,le,O,K]),Pu=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(Ra(_=>({..._,open:!1})),!Yi(l)){O(),K();return}if(C.collapsed){Vt.current=l,Xe.current={start:C.start,end:C.end},K();return}if(Vt.current=null,!_f(m,l)){O(),K();return}oe(m,!1),O(),K()},[W,le,O,K]),Au=c.useCallback(l=>{if(H.current!=="visual")return;const m=wn();if(!m)return;W(m),xn(J=>({...J,open:!1}));const C=pe.current?Se(re.current)[ze.current]??"":re.current,_=JSON.stringify(l.atRule)!==JSON.stringify(Qe(Ce(C).body)),z=al(m,l);if(_&&mr(m,z.pageHtml),!z.changed&&!_){O(),K();return}Mr(z.pageHtml,!1),O(),K()},[W,Mr,O,K,wn]),Du=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Po(C=>({...C,open:!1})),!LC(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),Ru=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),_a(C=>({...C,open:!1})),!zC(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),Go=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Ao({open:!1}),!xw(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),qo=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Do({open:!1}),!k0(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),Eu=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Tr({open:!1}),!T0(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),ju=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Fa({open:!1}),!j1(m,l)){O(),K();return}oe(m,!1),O(),K(),vt(m)}},[W,le,O,K,vt]),Tu=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Ba(C=>({...C,open:!1})),!av(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),Nu=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Ha(C=>({...C,open:!1})),!hv(m,l)){O(),K();return}oe(m,!1),O(),K(),vt(m)}},[W,le,O,K,vt]),Iu=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),za(C=>({...C,open:!1})),!Av(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),_t=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),!l(m)){O(),K();return}oe(m,!1),O(),K(),vt(m)}},[W,le,O,K,vt]),as=c.useCallback(l=>{Go({src:l.src,alt:l.alt??"",title:l.title??"",css:l.css})},[Go]),ss=c.useCallback(l=>{qo({src:l.src,title:l.title??"",css:l.css})},[qo]),ls=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Tr({open:!1}),!N0(m,{src:l.src,title:l.title??"",css:l.css})){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),Mu=c.useCallback(l=>{if(H.current!=="visual")return;const m=B.current;if(m){if(W(m),Eo(C=>({...C,open:!1})),!Tw(m,l)){O(),K();return}oe(m,!1),O(),K()}},[W,le,O,K]),Op=c.useCallback((l,m)=>{Ne!=null&&Ne.isConnected&&tv(Ne,l,m)},[Ne]),$p=c.useCallback(()=>{const l=B.current;!l||!(Ne!=null&&Ne.isConnected)||(oe(l,!1),Ps(l,Ne),O(),K())},[Ne,le,O,K]),Jt=c.useCallback(()=>{if(!yr.current)return re.current;if(pe.current){if(H.current==="visual"){const l=Ke(),m=at(l);if(m!==re.current)return be(m,!0)}return re.current}if(H.current==="visual"&&B.current){const l=Pt(B.current.innerHTML,Ce(re.current).body),m=ti(l,ni(l,re.current,zn.current));if(m!==re.current)return be(m,!0)}return re.current},[be,Ke]),cs=c.useCallback(()=>{if(!yr.current&&sa.current)return sa.current;const l=JSON.stringify(Kn());return sa.current=l,l},[Kn]),Kp=c.useCallback(()=>pe.current?cs():Jt(),[Jt,cs]);Iv({onAutoSave:r?async()=>{const l=pe.current?JSON.parse(cs()):Jt();return yr.current=!1,r(l)}:void 0,getHtml:Kp}),c.useEffect(()=>()=>{var l;(l=xr.current)==null||l.cancel()},[]);const ge=c.useMemo(()=>({getHtml:Jt,setHtml:l=>{be(l,!1)},getMode:()=>H.current,setMode:xu,getFullscreen:()=>Cc.current,setFullscreen:gr,getDarkMode:()=>Qc.current,setDarkMode:l=>{uu(l)},getPageZoom:()=>Mo.current,setPageZoom:du,getToolbarPosition:()=>eu.current,setToolbarPosition:l=>{mu(l)},openCustomizeToolbar:()=>{Tc(!0)},openDocumentPreview:()=>{Nc({open:!0,html:Jt()})},toggleReadAloud:()=>{const l=xr.current;if(!l)return;const m=Ee.current??St({mode:H.current,visualEl:B.current,htmlEl:Ze.current}),C=Ld(Jo(m),Jt());C&&l.toggle(C)},toggleRuler:()=>{vp(l=>!l)},isReadingAloud:()=>{var l;return((l=xr.current)==null?void 0:l.isSpeaking())??!1},isRulerVisible:()=>yc.current,canReadAloud:()=>{if(!wi())return!1;const l=Ee.current??St({mode:H.current,visualEl:B.current,htmlEl:Ze.current});return Ld(Jo(l),Jt())!==null},undo:Wo,redo:Vo,canUndo:()=>rt.canUndo(),canRedo:()=>rt.canRedo(),getSelection:()=>{const l=Ee.current??St({mode:H.current,visualEl:B.current,htmlEl:Ze.current});return Jo(l)},insertText:l=>{const m=Ee.current??St({mode:H.current,visualEl:B.current,htmlEl:Ze.current});Wn(m,l,!1)},insertHtml:(l,m)=>{const C=Ee.current??St({mode:H.current,visualEl:B.current,htmlEl:Ze.current}),_=m===void 0;Wn(C,_?l:m,_)},toggleFontMark:l=>{if(H.current!=="visual")return;const m=B.current;if(!m)return;const C=W(m);if(C.collapsed){const _=Yn(m);ot.current=Ux(ot.current,_,l),Xe.current={start:C.start,end:C.end},K();return}ot.current={},Xe.current=null,Zs(m,l)&&(oe(m,!1),O(),K())},clearFormatting:()=>{if(H.current!=="visual")return;const l=B.current;!l||W(l).collapsed||(ot.current={},Ye.current=null,it.current=null,mt.current=null,ft.current=null,Vt.current=null,Xe.current=null,a0(l)&&(oe(l,!1),O(),K()))},toggleFormatBrush:Cu,isFormatBrushActive:()=>go.current,isFontMarkActive:l=>ca.current[l],hasTextSelection:()=>H.current==="visual"&&va.current,setFontSize:(l,m)=>{rs(l,m)},setFontSizeUnit:l=>{var ye;const m=B.current,C=Gt.current;if(H.current!=="visual"||!m||C.value===null||C.mixed){It.current=l,fo(Lt=>({...Lt,unit:l}));return}const _=W(m),z=Tx(m,((ye=_.visualRange)==null?void 0:ye.startContainer)??m),J=_m(C.value,C.unit,l,z.parentPx,z.rootPx);rs(J,l)},getFontSize:()=>Gt.current.value,getFontSizeUnit:()=>Gt.current.unit,isFontSizeMixed:()=>Gt.current.mixed,setFontFamily:l=>{ku(l)},getFontFamily:()=>vr.current.value,isFontFamilyMixed:()=>vr.current.mixed,getFontFaces:()=>zn.current,setFontColor:l=>{os("color",l)},setHighlightColor:l=>{os("backgroundColor",l)},getFontColor:()=>Sr.current.value,isFontColorMixed:()=>Sr.current.mixed,getHighlightColor:()=>Ar.current.value,isHighlightColorMixed:()=>Ar.current.mixed,setParagraphStyle:l=>{if(H.current!=="visual")return;const m=B.current;m&&(W(m),d1(m,l)&&(oe(m,!1),O(),K()))},getParagraphStyle:()=>pa.current.tag,isParagraphStyleMixed:()=>pa.current.mixed,setTextAlign:l=>{if(H.current!=="visual")return;const m=B.current;m&&(W(m),ag(m,l)&&(oe(m,!1),O(),K()))},getTextAlign:()=>ba.current.align,isTextAlignMixed:()=>ba.current.mixed,indent:()=>{if(H.current!=="visual")return;const l=B.current;l&&(W(l),C1(l)&&(oe(l,!1),O(),K()))},outdent:()=>{if(H.current!=="visual")return;const l=B.current;l&&(W(l),v1(l)&&(oe(l,!1),O(),K()))},canOutdent:()=>H.current==="visual"&&Ac.current,toggleList:l=>{if(H.current!=="visual")return;const m=B.current;m&&(W(m),g1(m,l)&&(oe(m,!1),O(),K()))},isBulletList:()=>Dr.current.type==="ul"&&!Dr.current.mixed,isNumberedList:()=>Dr.current.type==="ol"&&!Dr.current.mixed,openFontProperties:l=>{H.current==="visual"&&bo({open:!0,tab:l??"general"})},applyFontProperties:l=>{is(l)},openCustomCss:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l);const m=l?If(l):{value:null,mixed:!1},C=m.mixed||!m.value?"":Fx(m.value);Ra({open:!0,value:C})},applyCustomCss:l=>{Pu(l)},openParagraphProperties:l=>{if(H.current!=="visual")return;const m=B.current;m&&W(m),Bn({open:!0,tab:l??"general",value:m?Ss(m):Qn(),backgroundImage:m?Ad(m):zt()})},applyParagraphProperties:(l,m)=>{Su(l,m)},openPageProperties:(l,m)=>{if(H.current!=="visual")return;const C=B.current;C&&W(C);const _=pe.current?Se(re.current)[ze.current]??"":re.current,z=C?yi(C):bi();xn({open:!0,tab:l==="print"&&!Ut?"font":l??"font",paragraphTab:m??"spacing",value:{...z,atRule:Qe(Ce(_).body)}})},applyPageProperties:l=>{Au(l)},openPageBackgroundImage:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l);const m=pe.current?Se(re.current)[ze.current]??"":re.current,C=l?yi(l):bi();xn({open:!0,tab:"paragraph",paragraphTab:"backgroundImage",value:{...C,atRule:Qe(Ce(m).body)}})},openParagraphBackgroundImage:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l),Bn({open:!0,tab:"backgroundImage",value:l?Ss(l):Qn(),backgroundImage:l?Ad(l):zt()})},openCustomParagraphStyleDialog:l=>{if(H.current!=="visual"||!Ga.current)return;if(l){const C=Io.current.find(_=>_.id===l);if(!C)return;jr({open:!0,mode:"edit",style:C});return}const m=B.current;m&&W(m),jr({open:!0,mode:"create",font:{size:Gt.current.mixed?null:Gt.current.value,unit:Gt.current.unit,marks:{...ca.current},fontFamily:vr.current.mixed?null:vr.current.value,fontColor:Sr.current.mixed?null:Sr.current.value,highlightColor:Ar.current.mixed?null:Ar.current.value},paragraph:lg(m?Ss(m):Qn())})},applyCustomParagraphStyle:l=>{const m=Io.current.find(_=>_.id===l);if(!m||(is({size:m.font.size,unit:m.font.unit,marks:m.font.marks,fontFamily:m.font.fontFamily??null,fontFamilyMixed:!1,fontColor:m.font.fontColor,highlightColor:m.font.highlightColor,fontColorMixed:!1,highlightColorMixed:!1}),!m.paragraph))return;const C=B.current;!C||H.current!=="visual"||(W(C),G1(C,m.paragraph)&&(oe(C,!1),O(),K()))},customParagraphStylesEnabled:()=>Ga.current,getCustomParagraphStyles:()=>Io.current,isCustomParagraphStylesLoading:()=>Oc.current,openLinkDialog:l=>{if(H.current!=="visual")return;const m=B.current;m&&W(m);const C=m?Pg(m):Qi(),_=m?ll(m):[],z=(C==null?void 0:C.href)??"",J=z.startsWith("#")?z.slice(1):"",ye=_.some(Lt=>Lt.id===J)?J:"";Po({open:!0,tab:l??"link",href:z,title:(C==null?void 0:C.title)??"",targetBlank:(C==null?void 0:C.targetBlank)??!1,textDecorationNone:(C==null?void 0:C.textDecorationNone)??!1,hoverMode:(C==null?void 0:C.hoverMode)??"color",hoverColor:(C==null?void 0:C.hoverColor)??null,hoverHtml:(C==null?void 0:C.hoverHtml)??"",bookmarks:_,selectedBookmarkId:ye})},applyLink:l=>{Du(l)},openBookmarkDialog:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l),_a({open:!0,existingIds:l?ll(l).map(m=>m.id):[]})},applyBookmark:l=>{Ru(l)},openImageDialog:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l);const m=Gc.current;if(tu.current&&m){m.onPick(as);return}Ao({open:!0})},applyImage:l=>{Go(l)},openAudioDialog:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l);const m=qc.current;if(nu.current&&m){m.onPick(ss);return}Do({open:!0})},applyAudio:l=>{qo(l)},openYoutubeDialog:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l);const m=Zc.current;if(ru.current&&m){m.onPick(ls);return}Tr({open:!0})},applyYoutube:l=>{Eu(l)},openImageProperties:l=>{if(H.current!=="visual")return;const m=B.current;if(!m)return;W(m);const C=rn(m),_=jw(m);!C||!_||Eo({open:!0,tab:l??"general",value:_,aspectRatio:Dw(C)})},applyImageProperties:l=>{Mu(l)},insertHorizontalRule:()=>{if(H.current!=="visual")return;const l=B.current;l&&(W(l),U0(l)&&(oe(l,!1),O(),K()))},insertPageBreak:()=>{if(H.current!=="visual")return;const l=B.current;l&&(W(l),Z0(l)&&(oe(l,!1),O(),K()))},insertPageBefore:()=>{pu()},insertPageAfter:()=>{hu()},deletePage:()=>{!pe.current||H.current!=="visual"||Ct.current&&(Kn().length<=1||ja(!0))},isMultiPagesEnabled:()=>pe.current,hasSelectedPage:()=>pe.current&&H.current==="visual"&&Ct.current,canDeletePage:()=>pe.current&&H.current==="visual"&&Ct.current&&Kn().length>1,canInsertPageBackgroundImage:()=>!(H.current!=="visual"||pe.current&&!Ct.current),canInsertParagraphBackgroundImage:()=>{if(H.current!=="visual")return!1;const l=B.current;return l?Kt(l).length>0:!1},getActivePageHtml:()=>gu(),getAllPagesHtml:()=>Kn(),openTableDialog:()=>{if(H.current!=="visual")return;const l=B.current;l&&W(l),Fa({open:!0})},applyTable:l=>{ju(l)},openTableProperties:()=>{if(H.current!=="visual")return;const l=B.current;if(!l)return;W(l);const m=iv(l);m&&Ba({open:!0,value:m})},applyTableProperties:l=>{Tu(l)},openCellProperties:()=>{if(H.current!=="visual")return;const l=B.current;if(!l)return;W(l);const m=pv(l);m&&Ha({open:!0,value:m})},applyCellProperties:l=>{Nu(l)},openRowProperties:()=>{if(H.current!=="visual")return;const l=B.current;if(!l)return;W(l);const m=Pv(l);m&&za({open:!0,value:m})},applyRowProperties:l=>{Iu(l)},insertRowBelow:()=>{_t(l=>Js(l,"below"))},insertRowBefore:()=>{_t(l=>Js(l,"before"))},deleteRow:()=>{_t(l=>T1(l))},insertColumnAfter:()=>{_t(l=>fd(l,"after"))},insertColumnBefore:()=>{_t(l=>fd(l,"before"))},deleteColumn:()=>{_t(l=>N1(l))},mergeCells:()=>{_t(l=>_1(l))},unmergeCells:()=>{_t(l=>L1(l))},cut:async()=>{if(H.current!=="visual")return;const l=B.current;l&&(W(l),await t0(l)&&(oe(l,!1),O(),K()))},copy:async()=>{if(H.current!=="visual")return;const l=B.current;l&&(W(l),await Tg(l))},deleteSelection:()=>{if(H.current!=="visual")return;const l=B.current;l&&(W(l),jg(l)&&(oe(l,!1),O(),K()))},addComment:()=>{if(!yn.current||b||H.current!=="visual")return;const l=B.current;if(!l)return;const m=W(l),C=Nd(l,m);if(C){Nt(C);return}const _=UC(l,m);if(!_)return;const z=ZC(_);WC(l,z.id,m)&&(_d(l,z.id),O(),fu(l,!1),hr([...lo.current,z]),Nt(z.id))},toggleCommentsVisible:()=>{Cp(l=>{const m=!l,C=B.current;return C&&Id(C,m),m})},areCommentsVisible:()=>so.current,canAddComment:()=>!yn.current||b||H.current!=="visual"?!1:va.current||$a.current!==null,isCommentsEnabled:()=>yn.current,getCommentThreads:()=>lo.current,setCommentThreads:l=>hr(l),openCommentThread:l=>{const m=B.current;!m||H.current!=="visual"||_d(m,l)&&(O(),Nt(l))},isContentLocked:()=>wc.current,isLink:()=>jc.current,isImageSelected:()=>H.current==="visual"&&$a.current!==null,isInTable:()=>H.current==="visual"&&_c.current,canMergeCells:()=>H.current==="visual"&&Fc.current,canUnmergeCells:()=>H.current==="visual"&&Hc.current,...o!=null?{onSave:l=>Wc.current(l)}:{},...a!=null?{onOpen:()=>Vc.current()}:{}}),[be,le,oe,fu,xu,gr,uu,du,mu,Wn,Wo,Vo,O,K,W,rs,ku,os,is,Pu,Su,Au,Du,Ru,Go,qo,Eu,Mu,ju,Tu,Nu,Iu,_t,as,ss,ls,Jt,gu,Kn,pu,hu,bu,Cu,o,a,b,hr,Ut]),_u=c.useCallback(()=>{const l=Ee.current??St({mode:H.current,visualEl:B.current,htmlEl:Ze.current});return{mode:l.mode,selection:Jo(l),getHtml:ge.getHtml,setHtml:m=>{be(m,!1)},insertText:m=>Wn(l,m,!1),insertHtml:(m,C)=>{const _=C===void 0;Wn(l,_?m:C,_)}}},[Wn,ge.getHtml,be]),{catalog:Zo,layout:Lu}=c.useMemo(()=>Wh(N,xR,wR),[N]),Yo=c.useMemo(()=>XD(Lu,E),[Lu,E]),Fu=c.useMemo(()=>({...Yo,iconGroups:SD(Yo.iconGroups,Pa)}),[Yo,Pa]),Bu=De&&we==="visual",us=c.useMemo(()=>_R(Fu,Bu),[Fu,Bu]),ds=c.useMemo(()=>$e?SR(Zo,yt):Zo,[Zo,$e,yt]),ms=c.useMemo(()=>$e?PR(us):us,[us,$e]),fs=c.useMemo(()=>({disabled:fr,readOnly:w,enableComments:$e}),[fr,w,$e]),Hu=c.useMemo(()=>xt?JC(Mn,xt):null,[xt,Mn]),Up=c.useCallback(l=>{if(!xt||!oo||b)return;const m=YC(oo,l);hr(XC(lo.current,xt,m))},[xt,oo,b,hr]),Vn=c.useMemo(()=>({...Ax(ge),...Vh(N,_u)}),[ge,N,_u]),gs=c.useMemo(()=>Dx(ge),[ge,mo,wr,Cr,kr,Pr,fa,Ta,Na,Va,Xt,Ne,Ka,Ua,Wa,wa,ka,Fn,gt,Co,_n]),zu=c.useCallback(l=>{if(se||l.inputType!=="insertText"&&l.inputType!=="insertReplacementText"||!l.data||!Kx(ot.current)&&!Ye.current&&!ex(it.current)&&!Ib({color:mt.current,backgroundColor:ft.current})&&!zx(Vt.current))return;const m=B.current;m&&(l.preventDefault(),Qx(m,l.data,ot.current,Ye.current,{color:mt.current,backgroundColor:ft.current},it.current,Vt.current),ot.current={},Ye.current=null,it.current=null,mt.current=null,ft.current=null,Vt.current=null,Xe.current=null,oe(m,!0),O(),K())},[se,le,O,K]),Ou=c.useCallback(l=>{if(se||!lb(l,zc.current))return;l.preventDefault(),l.stopPropagation();const m=B.current;if(!m)return;W(m);const C=nl(m,l.target),_=Mi(m,l.target);_&&!ro(m).includes(_)&&M1(m,_);const z={inTable:Ge(m,l.target)!==null,canMergeCells:gd(m),canUnmergeCells:pd(m)},J={canDeletePage:pe.current&&Ct.current&&Ke().length>1};if(C){Ps(m,C),O(),Hn(C),Oa({open:!0,x:l.clientX,y:l.clientY,kind:"image",...z,...J,inTable:Ge(m,C)!==null});return}const ye=St({mode:"visual",visualEl:m,htmlEl:Ze.current});Ee.current=ye,Oa({open:!0,x:l.clientX,y:l.clientY,kind:ye.collapsed?"caret":"text",...z,...J})},[se,O,W,Ke]),$u=c.useCallback(l=>{if(zc.current=l.pointerType,b)return;const m=B.current;if(!m)return;if(yn.current&&so.current){const _=Md(m,l.target);if(_){const z=_.getAttribute("data-comment-thread");z&&Nt(z);return}}if(se&&!yn.current)return;const C=nl(m,l.target);if(!C){Hn(null);return}l.preventDefault(),Ps(m,C),O(),Hn(C)},[b,se,O]);c.useEffect(()=>{if(!$e||we!=="visual")return;const l=B.current;l&&(qC(l,Mn),Id(l,yt))},[$e,we,Mn,yt,Re]);const Ku=c.useCallback(l=>{if(se)return;if(l.key==="Tab"&&!l.ctrlKey&&!l.metaKey&&!l.altKey){if(H.current!=="visual")return;const C=B.current;if(!C)return;const _=l.target;if(!(_ instanceof Node)||!C.contains(_))return;W(C);const z=I1(C,l.shiftKey);if(!z)return;l.preventDefault(),typeof z=="object"&&z.changed&&oe(C,!1),O(),K(),vt(C);return}if(!(l.ctrlKey||l.metaKey))return;if(l.key==="Enter"&&!l.shiftKey){l.preventDefault(),ge.insertPageBreak();return}const m=l.key.toLowerCase();if(m==="z"&&!l.shiftKey){l.preventDefault(),Wo();return}if(m==="z"&&l.shiftKey||m==="y"){l.preventDefault(),Vo();return}if(m==="b"&&!l.shiftKey){l.preventDefault(),ge.toggleFontMark("bold");return}if(m==="i"&&!l.shiftKey){l.preventDefault(),ge.toggleFontMark("italic");return}if(m==="u"&&!l.shiftKey){l.preventDefault(),ge.toggleFontMark("underline");return}if(m==="x"&&l.shiftKey){l.preventDefault(),ge.toggleFontMark("strikethrough");return}m==="p"&&!l.shiftKey&&(l.preventDefault(),Vn.print())},[se,Wo,Vo,ge,Vn,W,le,O,K,vt]),Wp=c.useCallback(l=>{if(l.key==="Escape"&&xt){l.preventDefault(),Nt(null);return}Ku(l)},[xt,Ku]),Vp=[ce.root,Bs(Fn).className,Tt?ce.fullscreen:"",y].filter(Boolean).join(" "),Gp=UE({toolbarBackground:k,menuColor:S,menuBackground:D,menuFontSize:I,menuFontFamily:A,border:P}),qp=Bs(Fn)["data-wysiwyg-theme"],Zp=we==="visual"&&pr&&Cn,Uu=we==="visual"?De?i.jsx(FE,{ref:wt,pages:On,activePageIndex:Wt,hasSelectedPage:_n,onActivePageIndexChange:l=>{var _;ze.current=l,ia(l);const m=(_=wt.current)==null?void 0:_.getContainer(),C=m?et(m,l):null;C instanceof HTMLDivElement&&(B.current=C)},onPageSelected:()=>{br(!0)},onPageChange:(l,m)=>{const C=Se(re.current)[l]??"";vn(l,Pt(m,Ce(C).body),!0)},onBeforeInput:zu,onPointerDown:l=>{if(l.currentTarget instanceof HTMLDivElement&&(B.current=l.currentTarget),$u(l),l.currentTarget instanceof HTMLDivElement){const m=l.currentTarget;requestAnimationFrame(()=>er(m))}},onMouseUp:vu,onContextMenu:Ou,placeholder:x,disabled:se,rulerVisible:pr,rulerUnit:In,zoomScale:vo,onMarginPreview:Bp,onMarginChange:Hp,onIndentChange:zp}):i.jsx(ME,{ref:B,html:Ce(Re).body,pageHtml:Re,rulerVisible:pr,rulerUnit:In,zoomScale:vo,onMarginPreview:_p,onMarginChange:Lp,onIndentChange:Fp,onChange:l=>Mp(l,!0),onBeforeInput:zu,onPointerDown:l=>{if($u(l),l.currentTarget instanceof HTMLDivElement){const m=l.currentTarget;requestAnimationFrame(()=>er(m))}},onMouseUp:vu,onContextMenu:Ou,placeholder:x,disabled:se}):i.jsx(oE,{ref:Ze,html:Re,onChange:l=>be(l,!0),placeholder:x,disabled:se});return i.jsx(eb,{locale:v,children:i.jsx(Yh,{dark:Fn,children:i.jsxs("div",{className:Vp,style:Gp,"data-fullscreen":Tt?"":void 0,"data-wysiwyg-theme":qp,"data-toolbar-position":gt,"data-comments-visible":$e&&yt?"":void 0,onKeyDown:Wp,children:[R?i.jsx("div",{className:ce.menuChrome,onPointerDownCapture:Xa,children:i.jsx(Ls,{catalog:ds,layout:ms,commands:Vn,queries:gs,disabled:fr,chromeLock:fs,menuVisible:!0,toolbarVisible:!1})}):null,i.jsxs("div",{className:ce.body,"data-icon-dock":L?gt:void 0,children:[L&&(gt==="top"||gt==="left")?i.jsx("div",{className:ce.iconChrome,onPointerDownCapture:Xa,children:i.jsx(Ls,{catalog:ds,layout:ms,commands:Vn,queries:gs,disabled:fr,chromeLock:fs,menuVisible:!1,toolbarVisible:!0,position:gt})}):null,i.jsxs("div",{ref:ao,className:`${ce.workspace} ${Cn?ce.workspacePageSized:""} ${Zp?ce.workspaceWithRuler:""}`,onDragEnter:Ir.onDragEnter,onDragOver:Ir.onDragOver,onDragLeave:Ir.onDragLeave,onDrop:Ir.onDrop,children:[we==="visual"?i.jsx("div",{className:ce.pageCanvasViewport,"data-page-canvas-sized":Cn?"":void 0,children:Uu}):Uu,Ir.dragging?i.jsx(VE,{}):null]}),L&&(gt==="bottom"||gt==="right")?i.jsx("div",{className:ce.iconChrome,onPointerDownCapture:Xa,children:i.jsx(Ls,{catalog:ds,layout:ms,commands:Vn,queries:gs,disabled:fr,chromeLock:fs,menuVisible:!1,toolbarVisible:!0,position:gt})}):null]}),Tt?i.jsx(WE,{onClick:()=>gr(!1)}):null,i.jsx(YD,{open:Sa,catalog:Zo,groups:Yo.iconGroups,settings:Pa,loading:Sp,busy:Pp,disabled:se,onChange:l=>{cu(l)},onReset:()=>{cu(null)},onClose:()=>Tc(!1)}),i.jsx(qA,{open:Er.open,html:Er.html,onClose:()=>Nc({open:!1,html:Er.html})}),i.jsx(oP,{open:Rr.open,tab:Rr.tab,size:wr.value,unit:wr.unit,marks:mo,fontFamily:Cr.value,fontFamilyMixed:Cr.mixed,fontColor:kr.value,fontColorMixed:kr.mixed,highlightColor:Pr.value,highlightColorMixed:Pr.mixed,fonts:Xt,disabled:se,onTabChange:l=>bo({open:!0,tab:l}),onApply:l=>ge.applyFontProperties(l),onClose:()=>bo({open:!1,tab:Rr.tab})}),i.jsx(DP,{open:qt.open,tab:qt.tab,value:qt.value,backgroundImage:qt.backgroundImage,disabled:se,customImagePicker:X,onCustomImagePick:()=>{X==null||X.onPick(l=>{Bn(m=>({...m,tab:"backgroundImage",backgroundImage:{...m.backgroundImage,src:l.src}}))})},onTabChange:l=>Bn({...qt,open:!0,tab:l}),onApply:({value:l,backgroundImage:m})=>ge.applyParagraphProperties(l,m),onClose:()=>Bn({...qt,open:!1})}),i.jsx(OP,{open:ko.open,value:ko.value,disabled:se,onApply:l=>ge.applyCustomCss(l),onClose:()=>Ra(l=>({...l,open:!1}))}),i.jsx(_P,{open:Zt.open,tab:Zt.tab,initialParagraphTab:Zt.paragraphTab,value:Zt.value,fonts:Xt,disabled:se,printTabVisible:Ut,customImagePicker:X,onCustomImagePick:()=>{X==null||X.onPick(l=>{xn(m=>({...m,tab:"paragraph",paragraphTab:"backgroundImage",value:{...m.value,backgroundImage:{...m.value.backgroundImage,src:l.src}}}))})},onTabChange:l=>xn({...Zt,open:!0,tab:l}),onApply:l=>ge.applyPageProperties(l),onResetAtRule:()=>{const l=wn();if(!l||H.current!=="visual")return;const m=pe.current?Se(re.current)[ze.current]??"":Ce(re.current).body,C=pC(l,m);C.changed&&(Mr(C.pageHtml,!1),xn(_=>({..._,value:{..._.value,atRule:nn()}})))},onClose:()=>xn({...Zt,open:!1})}),i.jsx(LP,{open:Ea,disabled:se,onClose:()=>ja(!1),onConfirm:()=>{bu(),ja(!1)}}),i.jsx(HP,{open:Te.open,mode:Te.open?Te.mode:"create",styleId:Te.open&&Te.mode==="edit"?Te.style.id:void 0,name:Te.open&&Te.mode==="edit"?Te.style.name:"",font:Te.open?Te.mode==="edit"?Te.style.font:Te.font:{size:null,unit:Rn,marks:Ht(),fontFamily:null,fontColor:null,highlightColor:null},paragraph:Te.open?Te.mode==="edit"?Te.style.paragraph:Te.paragraph:void 0,canDelete:!!ne,fonts:Xt,busy:Rp,disabled:se,onSave:async l=>{const m=Kc.current;if(m){So(!0);try{await m(l),jr({open:!1}),await zo()}finally{So(!1)}}},onDelete:async l=>{const m=Uc.current;if(m){So(!0);try{await m(l),jr({open:!1}),await zo()}finally{So(!1)}}},onClose:()=>jr({open:!1})}),i.jsx(gA,{open:Je.open,tab:Je.tab,href:Je.href,title:Je.title,targetBlank:Je.targetBlank,textDecorationNone:Je.textDecorationNone,hoverMode:Je.hoverMode,hoverColor:Je.hoverColor,hoverHtml:Je.hoverHtml,bookmarks:Je.bookmarks,selectedBookmarkId:Je.selectedBookmarkId,disabled:se,onTabChange:l=>Po({...Je,open:!0,tab:l}),onApply:l=>ge.applyLink(l),onClose:()=>Po({...Je,open:!1})}),i.jsx(KP,{open:Ma.open,existingIds:Ma.existingIds,disabled:se,onApply:l=>ge.applyBookmark(l),onClose:()=>_a({...Ma,open:!1})}),i.jsx(GP,{open:Ep.open,disabled:se,customImagePicker:X,onApply:l=>ge.applyImage(l),onCustomPick:()=>{Ao({open:!1}),X==null||X.onPick(as)},onClose:()=>Ao({open:!1})}),i.jsx(VP,{open:jp.open,disabled:se,customAudioPicker:ae,onApply:l=>ge.applyAudio(l),onCustomPick:()=>{Do({open:!1}),ae==null||ae.onPick(ss)},onClose:()=>Do({open:!1})}),i.jsx(pA,{open:Tp.open,disabled:se,customVideoPicker:U,onApply:l=>ge.applyYoutube(l),onCustomPick:()=>{Tr({open:!1}),U==null||U.onPick(ls)},onClose:()=>Tr({open:!1})}),i.jsx(aA,{open:Ro.open,tab:Ro.tab,value:Ro.value,aspectRatio:Ro.aspectRatio,disabled:se,onTabChange:l=>Eo(m=>({...m,tab:l})),onApply:l=>ge.applyImageProperties(l),onClose:()=>Eo(l=>({...l,open:!1}))}),i.jsx(CA,{open:La.open,disabled:se,onApply:l=>ge.applyTable(l),onClose:()=>Fa({open:!1})}),i.jsx(AA,{open:jo.open,value:jo.value,disabled:se,onApply:l=>ge.applyTableProperties(l),onClose:()=>Ba(l=>({...l,open:!1}))}),i.jsx(IA,{open:To.open,value:To.value,disabled:se,onApply:l=>ge.applyCellProperties(l),onClose:()=>Ha(l=>({...l,open:!1}))}),i.jsx(FA,{open:No.open,value:No.value,disabled:se,onApply:l=>ge.applyRowProperties(l),onClose:()=>za(l=>({...l,open:!1}))}),we==="visual"&&!se&&(Ne!=null&&Ne.isConnected)?i.jsx(fA,{img:Ne,onResize:Op,onResizeEnd:$p}):null,$e&&yt&&Hu?i.jsx(yD,{panelRef:ra,thread:Hu,locale:v,disabled:b,commentAuthor:oo,onPost:Up,onClose:()=>Nt(null)}):null,i.jsx(ab,{open:Yt.open,x:Yt.x,y:Yt.y,kind:Yt.kind,inTable:Yt.inTable,canMergeCells:Yt.canMergeCells,canUnmergeCells:Yt.canUnmergeCells,canDeletePage:Yt.canDeletePage,commands:Vn,onClose:()=>Oa(l=>({...l,open:!1}))})]})})})}function UE({toolbarBackground:e,menuColor:t,menuBackground:n,menuFontSize:r,menuFontFamily:o,border:a}){const s={};return e&&(s["--wysiwyg-toolbar-background"]=e),t&&(s["--wysiwyg-menu-color"]=t),n&&(s["--wysiwyg-menu-background"]=n),r&&(s["--wysiwyg-menu-font-size"]=r),o&&(s["--wysiwyg-menu-font-family"]=o),a==="none"?(s["--wysiwyg-border-width"]="0",s["--wysiwyg-border-radius"]="0",s["--wysiwyg-border-shadow"]="none"):a&&(a.width&&(s["--wysiwyg-border-width"]=a.width),a.color&&(s["--wysiwyg-border-color"]=a.color),a.radius&&(s["--wysiwyg-border-radius"]=a.radius),a.shadow&&(s["--wysiwyg-border-shadow"]=a.shadow)),Object.keys(s).length?s:void 0}function WE({onClick:e}){const t=q();return i.jsx("button",{type:"button",className:ce.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:i.jsx(Be,{className:ce.exitFullscreenIcon})})}function VE(){const e=q();return i.jsx("div",{className:ce.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function GE(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)===Le?!0:t.length===2&&t.some(r=>r.name===Le)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function qE(e){for(const t of[...e.querySelectorAll(`[${Le}]`)])t.removeAttribute(Le),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!GE(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function ZE(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return qE(n.body),n.body.innerHTML}exports.Editor=KE;exports.PAGE_SEPARATOR=Ei;exports.joinPagesToHtml=at;exports.sanitizeDocumentHtml=xi;exports.sanitizePageHtml=sl;exports.splitPagesFromHtml=Se;exports.stripCommentAnchors=ZE;