commspliant-html-editor 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/EditorWorkspaceHost.d.ts +2 -2
- package/dist/components/EditorWorkspaceHost.d.ts.map +1 -1
- package/dist/components/MultiPageVisualSurface.d.ts +3 -3
- package/dist/components/MultiPageVisualSurface.d.ts.map +1 -1
- package/dist/components/VisualSurface.d.ts +1 -1
- package/dist/components/VisualSurface.d.ts.map +1 -1
- package/dist/core/cellProperties.d.ts.map +1 -1
- package/dist/core/commandTypes.d.ts +2 -0
- package/dist/core/commandTypes.d.ts.map +1 -1
- package/dist/core/imageProperties.d.ts.map +1 -1
- package/dist/core/pageProperties.d.ts.map +1 -1
- package/dist/core/rowProperties.d.ts.map +1 -1
- package/dist/core/tableProperties.d.ts.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/types.d.ts +1 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.js +2869 -2856
- package/dist/modules/comments/catalog.d.ts.map +1 -1
- package/dist/modules/format/commands.d.ts +1 -1
- package/dist/modules/format/commands.d.ts.map +1 -1
- package/dist/modules/insert/ImageDialog.d.ts.map +1 -1
- package/dist/modules/ruler/HorizontalRuler.d.ts.map +1 -1
- package/dist/modules/ruler/VerticalRuler.d.ts.map +1 -1
- package/dist/toolbar/toolbarShellProps.d.ts +1 -1
- package/dist/toolbar/toolbarShellProps.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("react"),Yc=require("react-dom");function ny({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 ss({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 Yf({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 ls({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 cs({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 ry({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 oy({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 Xf({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 iy({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 ay({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 Je({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 Im({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 sy({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 ly({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 cy({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 uy({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 dy({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 my({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 Jf({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 fy({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 py({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 gy({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 hy({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 by({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 Hl({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":"help",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.jsx("path",{d:"M12 17h.01"})]})}function Qf({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 yy({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 xy({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 ep({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 Cy({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 wy({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 vy({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 ky({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 Sy({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 Py({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 tp({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 Ay({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 Ty({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 Ry({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 Zo({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 np({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 Dy({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 Iy({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 jy({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 Ey({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 My({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 _y({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 Ny({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 Ly({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 By({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 zl({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 jm({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 Ol({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 Fy({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 Hy({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 zy({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 Oy({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 Ky({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 $y({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 ve="---";function Gn(e){return e===ve}function Zn(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Xc=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"]),Uy=new Set(["file","edit","view","insert","format","table","help"]),rp="custom",op="custom";function ip(e){return`custom:${e}`}function Vy(e){return e==="menu"||e==="both"}function Wy(e){return e==="toolbar"||e==="both"}function ap(e){return e.map(t=>Zn(t)?{submenu:t.submenu,items:ap(t.items)}:t)}function Gy(e){return{menus:e.menus.map(t=>({id:t.id,items:ap(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function sp(e){return Gn(e)?!0:Zn(e)?e.items.every(sp):Xc.has(e)}function lp(e,t){for(const n of e)if(n===t||Zn(n)&&lp(n.items,t))return!0;return!1}function Zy(e){const t=e.tooltip??e.label;return{id:e.id,command:ip(e.id),icon:e.icon??cy,label:e.label,ariaLabel:e.label,tooltip:t}}function qy(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Uy.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===rp&&!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 Yy(e,t,n){if(e.groups[n]||(n===op?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 Xy(e,t,n){var a,s;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},o=Gy(n);for(const u of e??[])if(!(Xc.has(u.id)||Gn(u.id))){if(r.items[u.id]=Zy(u),Vy(u.showIn)){const d=((a=u.menu)==null?void 0:a.id)??rp;qy(r,o,d,(s=u.menu)==null?void 0:s.label);const f=o.menus.find(g=>g.id===d);if(f&&!lp(f.items,u.id)){const g=f.items[f.items.length-1];g!==void 0&&!Gn(g)&&f.items.every(sp)&&f.items.push(ve),f.items.push(u.id)}}if(Wy(u.showIn)){const d=u.toolbarGroup??op;Yy(r,o,d);const f=o.iconGroups.find(g=>g.id===d);f&&!f.items.includes(u.id)&&f.items.push(u.id)}}return{catalog:r,layout:o}}function Jy(e,t){const n={};for(const r of e??[])Xc.has(r.id)||Gn(r.id)||(n[ip(r.id)]=()=>r.onAction(t()));return n}function Qy(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const ex="_chrome_boy0f_1",tx={chrome:ex},cp=l.createContext(!1);function nx({dark:e,children:t}){return i.jsx(cp.Provider,{value:e,children:t})}function rx(){return l.useContext(cp)}function mc(e){return{className:tx.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function ke({children:e}){const t=rx(),n=mc(t);return Yc.createPortal(i.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function Jc(e,t){const n=e[t];n==null||n()}const Qc={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",htmlModePageTab:"Page {n}",htmlModePageTabsAria:"HTML source pages",htmlModePageTabsScrollLeftAria:"Scroll page tabs left",htmlModePageTabsScrollRightAria:"Scroll page tabs right",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",commandBackgroundImageProperties:"Background image properties…",commandBackgroundImagePropertiesAria:"Background image 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",menuHelp:"Help",menuHelpAria:"Help menu",commandEditorHelp:"Editor Help",commandEditorHelpAria:"Open editor help",commandKeyboardShortcuts:"Keyboard shortcuts",commandKeyboardShortcutsAria:"Open keyboard shortcuts help",commandAbout:"About",commandAboutAria:"About this editor",helpDialogTitle:"Help",helpDialogCloseAria:"Close help",helpDialogSearchPlaceholder:"Search help topics…",helpDialogSearchAria:"Search help",helpDialogContentsAria:"Help contents",helpDialogNoResults:"No help topics match your search.",helpDialogRelatedTitle:"Related topics",aboutDialogTitle:"About",aboutDialogCloseAria:"Close about dialog",aboutDialogClose:"Close",aboutDialogVersion:"Version {version}",aboutDialogDescription:"CommsPliant HTML editor is a reusable React WYSIWYG component with Visual and HTML editing modes. Licensed under the MIT License.",aboutDialogWebsiteCta:"See what we're building for regulated communication solutions.",aboutDialogWebsite:"Visit commspliant.com",aboutDialogWebsiteAria:"Visit CommsPliant — regulated communication management",helpCategoryGetStarted:"Get started",helpCategoryFile:"File",helpCategoryEdit:"Edit",helpCategoryInsert:"Insert",helpCategoryFormat:"Format",helpCategoryTable:"Table",helpCategoryView:"View",helpCategoryKeyboard:"Keyboard",helpTopicGetStartedTitle:"How do I use this editor?",helpTopicGetStartedBody:`1. Type in the visual editing area.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("react"),Xc=require("react-dom");function ry({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 ls({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 Yf({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 cs({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 us({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 oy({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 iy({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 Xf({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 ay({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 sy({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 Je({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 Im({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 ly({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 cy({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 uy({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 dy({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 my({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 fy({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 Jf({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 py({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 gy({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 hy({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 by({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 yy({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 zl({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":"help",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.jsx("path",{d:"M12 17h.01"})]})}function Qf({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 xy({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 Cy({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 ep({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 wy({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 vy({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 ky({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 Sy({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 Py({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 Ay({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 tp({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 Ty({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 Ry({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 Dy({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 qo({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 np({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 Iy({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 jy({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 Ey({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 My({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 _y({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 Ny({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 Ly({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 By({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 Fy({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 Ol({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 jm({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 Kl({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 Hy({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 zy({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 Oy({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 Ky({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 $y({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 Uy({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 ve="---";function Gn(e){return e===ve}function Zn(e){return typeof e=="object"&&e!==null&&"submenu"in e}const Jc=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"]),Vy=new Set(["file","edit","view","insert","format","table","help"]),rp="custom",op="custom";function ip(e){return`custom:${e}`}function Wy(e){return e==="menu"||e==="both"}function Gy(e){return e==="toolbar"||e==="both"}function ap(e){return e.map(t=>Zn(t)?{submenu:t.submenu,items:ap(t.items)}:t)}function Zy(e){return{menus:e.menus.map(t=>({id:t.id,items:ap(t.items)})),iconGroups:e.iconGroups.map(t=>({id:t.id,items:[...t.items]}))}}function sp(e){return Gn(e)?!0:Zn(e)?e.items.every(sp):Jc.has(e)}function lp(e,t){for(const n of e)if(n===t||Zn(n)&&lp(n.items,t))return!0;return!1}function qy(e){const t=e.tooltip??e.label;return{id:e.id,command:ip(e.id),icon:e.icon??uy,label:e.label,ariaLabel:e.label,tooltip:t}}function Yy(e,t,n,r){if(e.menus[n])r&&!e.menus[n].label&&!Vy.has(n)&&(e.menus[n]={...e.menus[n],label:r,ariaLabel:r});else if(n===rp&&!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 Xy(e,t,n){if(e.groups[n]||(n===op?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 Jy(e,t,n){var a,s;const r={menus:{...t.menus},submenus:{...t.submenus},groups:{...t.groups},items:{...t.items}},o=Zy(n);for(const u of e??[])if(!(Jc.has(u.id)||Gn(u.id))){if(r.items[u.id]=qy(u),Wy(u.showIn)){const d=((a=u.menu)==null?void 0:a.id)??rp;Yy(r,o,d,(s=u.menu)==null?void 0:s.label);const f=o.menus.find(g=>g.id===d);if(f&&!lp(f.items,u.id)){const g=f.items[f.items.length-1];g!==void 0&&!Gn(g)&&f.items.every(sp)&&f.items.push(ve),f.items.push(u.id)}}if(Gy(u.showIn)){const d=u.toolbarGroup??op;Xy(r,o,d);const f=o.iconGroups.find(g=>g.id===d);f&&!f.items.includes(u.id)&&f.items.push(u.id)}}return{catalog:r,layout:o}}function Qy(e,t){const n={};for(const r of e??[])Jc.has(r.id)||Gn(r.id)||(n[ip(r.id)]=()=>r.onAction(t()));return n}function ex(e){return{cut:async()=>{await e.cut()},copy:async()=>{await e.copy()},deleteSelection:()=>{e.deleteSelection()}}}const tx="_chrome_boy0f_1",nx={chrome:tx},cp=l.createContext(!1);function rx({dark:e,children:t}){return i.jsx(cp.Provider,{value:e,children:t})}function ox(){return l.useContext(cp)}function fc(e){return{className:nx.chrome,"data-wysiwyg-theme":e?"dark":"light"}}function ke({children:e}){const t=ox(),n=fc(t);return Xc.createPortal(i.jsx("div",{className:n.className,"data-wysiwyg-theme":n["data-wysiwyg-theme"],children:e}),document.body)}function Qc(e,t){const n=e[t];n==null||n()}const eu={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",htmlModePageTab:"Page {n}",htmlModePageTabsAria:"HTML source pages",htmlModePageTabsScrollLeftAria:"Scroll page tabs left",htmlModePageTabsScrollRightAria:"Scroll page tabs right",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",commandBackgroundImageProperties:"Background image properties…",commandBackgroundImagePropertiesAria:"Background image properties",commandDeletePage:"Delete page",commandDeletePageAria:"Delete selected page",deletePageDialogTitle:"Delete page",deletePageDialogCloseAria:"Close",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",menuHelp:"Help",menuHelpAria:"Help menu",commandEditorHelp:"Editor Help",commandEditorHelpAria:"Open editor help",commandKeyboardShortcuts:"Keyboard shortcuts",commandKeyboardShortcutsAria:"Open keyboard shortcuts help",commandAbout:"About",commandAboutAria:"About this editor",helpDialogTitle:"Help",helpDialogCloseAria:"Close help",helpDialogSearchPlaceholder:"Search help topics…",helpDialogSearchAria:"Search help",helpDialogContentsAria:"Help contents",helpDialogNoResults:"No help topics match your search.",helpDialogRelatedTitle:"Related topics",aboutDialogTitle:"About",aboutDialogCloseAria:"Close about dialog",aboutDialogClose:"Close",aboutDialogVersion:"Version {version}",aboutDialogDescription:"CommsPliant HTML editor is a reusable React WYSIWYG component with Visual and HTML editing modes. Licensed under the MIT License.",aboutDialogWebsiteCta:"See what we're building for regulated communication solutions.",aboutDialogWebsite:"Visit commspliant.com",aboutDialogWebsiteAria:"Visit CommsPliant — regulated communication management",helpCategoryGetStarted:"Get started",helpCategoryFile:"File",helpCategoryEdit:"Edit",helpCategoryInsert:"Insert",helpCategoryFormat:"Format",helpCategoryTable:"Table",helpCategoryView:"View",helpCategoryKeyboard:"Keyboard",helpTopicGetStartedTitle:"How do I use this editor?",helpTopicGetStartedBody:`1. Type in the visual editing area.
|
|
2
2
|
2. Use the menu bar and icon toolbar for formatting and inserts.
|
|
3
3
|
3. Open Help → Editor Help (or press F1) anytime you need guidance.`,helpTopicGetStartedKeywords:"start basics toolbar menu",helpTopicSwitchModesTitle:"How do I switch between Visual and HTML?",helpTopicSwitchModesBody:`1. Open View → Visual for WYSIWYG editing.
|
|
4
4
|
2. Open View → HTML to edit the source directly.
|
|
@@ -67,7 +67,7 @@ Strikethrough: Ctrl+Shift+X
|
|
|
67
67
|
Print: Ctrl+P | Page break: Ctrl+Enter
|
|
68
68
|
Table navigation: Tab / Shift+Tab
|
|
69
69
|
Exit full screen or close panels: Escape
|
|
70
|
-
Open Help: F1`,helpTopicKeyboardShortcutsKeywords:"shortcuts hotkeys keyboard"},ox={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",htmlModePageTab:"Página {n}",htmlModePageTabsAria:"Páginas del código HTML",htmlModePageTabsScrollLeftAria:"Desplazar pestañas de página a la izquierda",htmlModePageTabsScrollRightAria:"Desplazar pestañas de página a la derecha",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",commandBackgroundImageProperties:"Propiedades de imagen de fondo…",commandBackgroundImagePropertiesAria:"Propiedades de imagen de fondo",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",menuHelp:"Ayuda",menuHelpAria:"Menú Ayuda",commandEditorHelp:"Ayuda del editor",commandEditorHelpAria:"Abrir la ayuda del editor",commandKeyboardShortcuts:"Atajos de teclado",commandKeyboardShortcutsAria:"Abrir ayuda de atajos de teclado",commandAbout:"Acerca de",commandAboutAria:"Acerca de este editor",helpDialogTitle:"Ayuda",helpDialogCloseAria:"Cerrar ayuda",helpDialogSearchPlaceholder:"Buscar temas de ayuda…",helpDialogSearchAria:"Buscar en la ayuda",helpDialogContentsAria:"Contenido de la ayuda",helpDialogNoResults:"Ningún tema coincide con su búsqueda.",helpDialogRelatedTitle:"Temas relacionados",aboutDialogTitle:"Acerca de",aboutDialogCloseAria:"Cerrar cuadro Acerca de",aboutDialogClose:"Cerrar",aboutDialogVersion:"Versión {version}",aboutDialogDescription:"CommsPliant HTML editor es un componente React WYSIWYG reutilizable con modos de edición Visual y HTML. Licencia MIT.",aboutDialogWebsiteCta:"Descubra lo que estamos construyendo para comunicaciones reguladas.",aboutDialogWebsite:"Visitar commspliant.com",aboutDialogWebsiteAria:"Visitar CommsPliant — gestión de comunicaciones reguladas",helpCategoryGetStarted:"Primeros pasos",helpCategoryFile:"Archivo",helpCategoryEdit:"Editar",helpCategoryInsert:"Insertar",helpCategoryFormat:"Formato",helpCategoryTable:"Tabla",helpCategoryView:"Ver",helpCategoryKeyboard:"Teclado",helpTopicGetStartedTitle:"¿Cómo uso este editor?",helpTopicGetStartedBody:`1. Escriba en el área de edición visual.
|
|
70
|
+
Open Help: F1`,helpTopicKeyboardShortcutsKeywords:"shortcuts hotkeys keyboard"},ix={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",htmlModePageTab:"Página {n}",htmlModePageTabsAria:"Páginas del código HTML",htmlModePageTabsScrollLeftAria:"Desplazar pestañas de página a la izquierda",htmlModePageTabsScrollRightAria:"Desplazar pestañas de página a la derecha",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",commandBackgroundImageProperties:"Propiedades de imagen de fondo…",commandBackgroundImagePropertiesAria:"Propiedades de imagen de fondo",commandDeletePage:"Eliminar página",commandDeletePageAria:"Eliminar la página seleccionada",deletePageDialogTitle:"Eliminar página",deletePageDialogCloseAria:"Cerrar",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",menuHelp:"Ayuda",menuHelpAria:"Menú Ayuda",commandEditorHelp:"Ayuda del editor",commandEditorHelpAria:"Abrir la ayuda del editor",commandKeyboardShortcuts:"Atajos de teclado",commandKeyboardShortcutsAria:"Abrir ayuda de atajos de teclado",commandAbout:"Acerca de",commandAboutAria:"Acerca de este editor",helpDialogTitle:"Ayuda",helpDialogCloseAria:"Cerrar ayuda",helpDialogSearchPlaceholder:"Buscar temas de ayuda…",helpDialogSearchAria:"Buscar en la ayuda",helpDialogContentsAria:"Contenido de la ayuda",helpDialogNoResults:"Ningún tema coincide con su búsqueda.",helpDialogRelatedTitle:"Temas relacionados",aboutDialogTitle:"Acerca de",aboutDialogCloseAria:"Cerrar cuadro Acerca de",aboutDialogClose:"Cerrar",aboutDialogVersion:"Versión {version}",aboutDialogDescription:"CommsPliant HTML editor es un componente React WYSIWYG reutilizable con modos de edición Visual y HTML. Licencia MIT.",aboutDialogWebsiteCta:"Descubra lo que estamos construyendo para comunicaciones reguladas.",aboutDialogWebsite:"Visitar commspliant.com",aboutDialogWebsiteAria:"Visitar CommsPliant — gestión de comunicaciones reguladas",helpCategoryGetStarted:"Primeros pasos",helpCategoryFile:"Archivo",helpCategoryEdit:"Editar",helpCategoryInsert:"Insertar",helpCategoryFormat:"Formato",helpCategoryTable:"Tabla",helpCategoryView:"Ver",helpCategoryKeyboard:"Teclado",helpTopicGetStartedTitle:"¿Cómo uso este editor?",helpTopicGetStartedBody:`1. Escriba en el área de edición visual.
|
|
71
71
|
2. Use la barra de menús y la barra de iconos para formato e inserciones.
|
|
72
72
|
3. Abra Ayuda → Ayuda del editor (o pulse F1) cuando necesite orientación.`,helpTopicGetStartedKeywords:"inicio básicos barra menú",helpTopicSwitchModesTitle:"¿Cómo cambio entre Visual y HTML?",helpTopicSwitchModesBody:`1. Abra Ver → Visual para editar con formato.
|
|
73
73
|
2. Abra Ver → HTML para editar el código fuente.
|
|
@@ -136,10 +136,10 @@ Tachado: Ctrl+Mayús+X
|
|
|
136
136
|
Imprimir: Ctrl+P | Salto de página: Ctrl+Intro
|
|
137
137
|
Tabla: Tab / Mayús+Tab
|
|
138
138
|
Salir de pantalla completa o cerrar paneles: Escape
|
|
139
|
-
Abrir Ayuda: F1`,helpTopicKeyboardShortcutsKeywords:"atajos teclado"},ix={en:Qc,es:ox},up=l.createContext(e=>Qc[e]);function ax({locale:e="en",children:t}){const n=l.useMemo(()=>{const r=ix[e]??Qc;return o=>r[o]},[e]);return i.jsx(up.Provider,{value:n,children:t})}function X(){return l.useContext(up)}const sx="_menu_c1m45_1",lx="_item_c1m45_19",cx="_separator_c1m45_59",Kl={menu:sx,item:lx,separator:cx},xa=8,ux=[{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:"item",command:"addComment",labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:(e,t)=>t.canAddComment&&(e==="text"||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:"openPageBackgroundImage",labelKey:"commandBackgroundImageProperties",ariaKey:"commandBackgroundImagePropertiesAria",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 dx(e,t){const n=[];let r=!1;for(const o of ux){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 Em(){return'[role="menuitem"]:not(:disabled)'}function mx({open:e,x:t,y:n,kind:r,inTable:o=!1,canMergeCells:a=!1,canUnmergeCells:s=!1,canDeletePage:u=!1,canAddComment:d=!1,commands:f,onClose:g}){const h=X(),y=l.useId(),b=l.useRef(null);if(l.useLayoutEffect(()=>{var T;if(!e)return;const v=b.current;if(!v)return;const k=v.getBoundingClientRect(),S=Math.max(xa,Math.min(t,window.innerWidth-k.width-xa)),A=Math.max(xa,Math.min(n,window.innerHeight-k.height-xa));v.style.left=`${S}px`,v.style.top=`${A}px`,(T=v.querySelector(Em()))==null||T.focus()},[e,t,n,r]),l.useEffect(()=>{if(!e)return;const v=T=>{var D;(D=b.current)!=null&&D.contains(T.target)||g()},k=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),g())},S=()=>{g()},A=T=>{var D;if((D=b.current)!=null&&D.contains(T.target)){T.preventDefault();return}T.defaultPrevented||g()};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",k,!0),window.addEventListener("scroll",S,!0),document.addEventListener("contextmenu",A),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",k,!0),window.removeEventListener("scroll",S,!0),document.removeEventListener("contextmenu",A)}},[e,g]),!e)return null;const C=dx(r,{inTable:o,canMergeCells:a,canUnmergeCells:s,canDeletePage:u,canAddComment:d}),x=v=>{var D;if(v.key!=="ArrowDown"&&v.key!=="ArrowUp")return;const k=[...((D=b.current)==null?void 0:D.querySelectorAll(Em()))??[]];if(k.length===0)return;const S=k.indexOf(document.activeElement),A=v.key==="ArrowDown"?1:-1,T=k[(S+A+k.length)%k.length];v.preventDefault(),T==null||T.focus()};return i.jsx(ke,{children:i.jsxs("div",{ref:b,className:Kl.menu,role:"menu","aria-labelledby":y,style:{left:t,top:n},onMouseDown:v=>v.preventDefault(),onKeyDown:x,children:[i.jsx("span",{id:y,hidden:!0,children:h("contextMenuAria")}),C.map((v,k)=>v.type==="separator"?i.jsx("div",{role:"separator",className:Kl.separator},`separator-${k}`):i.jsx("button",{type:"button",role:"menuitem",className:Kl.item,"aria-label":h(v.ariaKey),onClick:()=>{g(),Jc(f,v.command)},children:h(v.labelKey)},v.command))]})})}function fx(e){return e==="touch"||e==="pen"}function px(e,t){return e.button===2||e.ctrlKey?!0:!fx(t)}const gx=new Set(["span","strong","b","em","i","u","s","strike","del"]);function Se(e,t){return t?e===t||e.contains(t):!1}function gn(e){return gx.has(e.tagName.toLowerCase())}function hx(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 vt(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&&hx(e,o)&&n.push(o);return n}function fn(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 Qn(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function Et(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function er(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 Tr(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 ci(e,t){const n=e.parentElement;if(n&&n.tagName.toLowerCase()==="span"&&n.childNodes.length===1)return t(n),n;const r=document.createElement("span");return t(r),n==null||n.insertBefore(r,e),r.appendChild(e),r}const us="data-wysiwyg-font",bx=[{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 kr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function ui(e,t){return e===t?!0:!e||!t?!1:kr(e)===kr(t)}function dp(e=[]){var r;const t=[],n=new Set;for(const o of[...bx,...e]){const a=o.family.trim();if(!a)continue;const s=kr(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 yx(e,t){return e?t.find(n=>ui(n.family,e))??null:null}function xx(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Cx(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function ds(e){const t=new Set,n=[];for(const r of e){const o=r.trim();!o||!xx(o)||t.has(o)||(t.add(o),n.push(o))}return n}function wx(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/&/g,"&")}const vx=new RegExp(`<link\\b[^>]*\\b${us}\\b[^>]*>`,"gi");function he(e){if(!e.includes(us))return{hrefs:[],body:e};const t=[],n=e.replace(vx,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(wx(o)),""});return{hrefs:ds(t),body:n}}function Ca(e,t){const n=ds(t);return n.length===0?e:`${n.map(o=>`<link rel="stylesheet" href="${Cx(o)}" ${us}="">`).join("")}${e}`}function eu(e){return e.style.fontFamily.trim()||null}const kx=32,Uo=new Map;function mp(e,t){return`${kr(t)}\0${e}`}function Sx(e,t){return Uo.get(mp(e,t))}function $l(e,t,n){const r=mp(e,t);if(Uo.size>=kx){const o=Uo.keys().next().value;o!==void 0&&Uo.delete(o)}Uo.set(r,n)}function fp(e,t){const n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=n.currentNode;for(;r;){if(r instanceof HTMLElement){const o=eu(r);if(o&&kr(o)===t)return!0}r=n.nextNode()}return!1}function Px(e,t){const n=kr(t);return n?fp(e,n):!1}function Ax(e,t){const n=kr(t);if(!n)return!1;const r=Sx(e,t);if(r!==void 0)return r;const o=e.toLowerCase();if(!o.includes("font-family")&&!o.includes("face="))return $l(e,t,!1),!1;const a=n.split(",")[0].replace(/['"]/g,"").trim().toLowerCase();if(a&&!o.includes(a))return $l(e,t,!1),!1;const s=new DOMParser().parseFromString(e,"text/html"),u=fp(s.body,n);return $l(e,t,u),u}function wa(e,t,n=[],r){const o=he(t).hrefs,a=n.filter(s=>s.css?r!=null&&r.liveRoot?Px(r.liveRoot,s.family):Ax(e,s.family):!1).map(s=>s.css??"");return ds([...o,...a])}function Mm(e,t=[]){const n=he(e).hrefs,r=t.map(o=>o.css??"");return ds([...n,...r])}function Tx(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function tu(e,t){let n=Tx(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=eu(n);if(r)return r;n=n.parentElement}return null}function fc(e){return e instanceof HTMLElement&&eu(e)!==null}function nu(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Rx(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!gn(r)||!fc(r)){n=r;continue}if(er(r,n),fc(r)&&(nu(r),Qn(r))){Et(r);continue}n=r}}function pp(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function gp(e){const t=pp(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:vt(t).filter(u=>u.data.length>0),o=(n.length>0?n:[t.startContainer]).map(u=>tu(e,u)),a=o[0]??null;return o.every(u=>ui(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function pc(e,t){const n=pp(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;fn(n);const o=vt(n).filter(a=>a.data.length>0);for(const a of o){const s=tu(e,a);if(r===null){if(s===null)continue;Rx(e,a);continue}ui(s,r)||ci(a,u=>{u.style.fontFamily=r})}return Tr(o),!0}function Dx(e,t){if(t){if(t.value===null){nu(e);return}e.style.fontFamily=t.value}}function Ix(e){return e!=null}function jx(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 Ex(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 gc(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!gn(r)||!fc(r)){n=r;continue}if(er(r,n),nu(r),Qn(r)){Et(r);continue}n=r.isConnected?r:t}return t}function Mx(e,t){jx(t);const n=Ex(t);return gc(e,n)}function _x(e,t,n){return!!(n&&n.value===null&&tu(e,t))}const ru=["pt","px","em","rem","%"],ro="pt",Nx={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]},Lx={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},Bx=new Set(ru),Fx=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function ms(e){return Bx.has(e)}function nt(e){return Math.round(e*100)/100}function fe(e){const t=nt(e);return Number.isInteger(t),String(t)}function ou(e,t){return`${fe(e)}${t}`}function iu(e){const t=e.trim();if(!t)return null;const n=t.match(Fx);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 Hx(e,t){const n=e.trim();if(!n)return null;const r=iu(n);if(r)return ms(r.unit)?vr(r.value,r.unit):null;const o=Number(n.replace(",","."));return Number.isFinite(o)?vr(o,t):null}function vr(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Lx[t];return{value:nt(Math.min(r,Math.max(n,e))),unit:t}}function hp(e,t,n,r){const o=n>0?n:16,a=r>0?r:16;switch(t){case"px":return nt(e);case"pt":return nt(e*.75);case"em":return nt(e/o);case"rem":return nt(e/a);case"%":return nt(e/o*100)}}function zx(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 bp(e,t,n,r,o){if(t===n)return nt(e);const a=zx(e,t,r,o);return hp(a,n,r,o)}const au="pt",Ox=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,Kx=/^[+-]?0(?:\.0+)?$/;function je(e){return`${fe(e.value)}${e.unit}`}function ft(e){const t=e.trim();if(!t)return null;if(Kx.test(t))return{value:0,unit:"px"};const n=t.match(Ox);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return ms(o)?{value:nt(r),unit:o}:null}function ti(e,t,n){const r=e.trim();if(!r)return null;const o=ft(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:nt(a),unit:t}:null}function tr(e){return e.value>=0?e:{value:0,unit:e.unit}}function Ft(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function va(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function $x(e,t){return t?e===t||e.contains(t):!1}function _m(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 Nm(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return _m(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 _m(e,t)+r}function Lm(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 su(e,t,n){const r=document.createRange(),o=Lm(e,t),a=Lm(e,n);return r.setStart(o.node,o.offset),r.setEnd(a.node,a.offset),r}function yp(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Bm(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function Ux(e,t){return t.mode!=="visual"?null:t.visualRange&&yp(t.visualRange,e)?t.visualRange:su(e,t.start,t.end)}function ln(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($x(t,a.commonAncestorContainer)){const s=Nm(t,a.startContainer,a.startOffset),u=Nm(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 Fm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Vx(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),s=e.snapshot.start,u=e.snapshot.end,d=e.asHtml?e.content:Fm(e.content);e.setHtml(a.slice(0,s)+d+a.slice(u));const f=e.htmlEl;if(f){const g=s+d.length;f.focus(),f.setSelectionRange(g,g)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:Fm(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&yp(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??su(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 lu=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),xp=new Set(["table","thead","tbody","tr","td","th"]),cu=new Set([...xp,"ul","ol","li","pre","hr"]);function _e(e){return e.tagName.toLowerCase()}function di(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function uu(e){return e instanceof HTMLElement&&(_e(e)==="ul"||_e(e)==="ol")}function Ht(e){return e instanceof HTMLElement&&_e(e)==="li"}function hn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function du(e){const t=e.collapsed?[]:vt(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function oo(e,t,n){var d,f,g;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let y=0,b;for(;b=h.nextNode();){if(b===t)return y+n;y+=((d=b.textContent)==null?void 0:d.length)??0}return y}let r=0;const o=t.childNodes;for(let h=0;h<n&&h<o.length;h+=1)r+=((f=o[h].textContent)==null?void 0:f.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+=((g=u.textContent)==null?void 0:g.length)??0}return s+r}function mu(e,t,n){const r=su(e,t,n),o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function nr(e,t){const n=hn(e);if(!n)return!1;const r=oo(e,n.startContainer,n.startOffset),o=oo(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=t();return mu(e,a,s),u}function fu(e,t){if(_e(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 xt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function Wx(e,t){let n=di(t);for(;n&&n!==e;){if(og(n,e)||kt(n)){n=n.parentElement;continue}const r=_e(n);if(lu.has(r)&&n instanceof HTMLElement)return n;if(xp.has(r)||r==="pre")return null;n=n.parentElement}return null}function In(e){const t=hn(e);if(!t)return[];const n=new Set,r=[];for(const o of du(t)){const a=Wx(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function hc(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return lu.has(t)||cu.has(t)?!1:gn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Gx(e,t){let n=di(t);for(;n&&n!==e;){if(cu.has(_e(n)))return!0;n=n.parentElement}return!1}function Zx(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function qx(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&hc(n[o-1]);)o-=1;for(;a<n.length-1&&hc(n[a+1]);)a+=1;return n.slice(o,a+1)}function bc(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function Yx(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&&kt(r)?bc(e):r}return n.startContainer===t&&e!==t?bc(e):Zx(e,n.startContainer)}function Xx(e,t){const n=ku(e);if(Gx(e,t.startContainer))return null;if(!bc(n)){const s=document.createElement("p");return s.appendChild(document.createElement("br")),n.appendChild(s),s}const r=Yx(n,e,t);if(!r||r instanceof HTMLElement&&kt(r)||r instanceof Element&&cu.has(_e(r))||r instanceof HTMLElement&&lu.has(_e(r))||!hc(r))return null;const o=qx(n,r),a=document.createElement("p");n.insertBefore(a,o[0]);for(const s of o)a.appendChild(s);return a}function Rr(e){const t=In(e);if(t.length>0)return t;const n=hn(e);if(!n)return[];const r=Xx(e,n);return r?[r]:[]}function io(e){const t=e.parentElement;return t&&uu(t)?t:null}function Cp(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&&Jx(r,o)?t[t.length-1].push(o):t.push([o])}return t}function Jx(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 Qx(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Ul(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 Vl(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 Wl(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 eC={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 tC(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function Ke(e){const t=e.trim();if(!t||tC(t))return null;const n=Wl(t);if(n)return n;const r=Ul(t);if(r)return r.a===0?null:Vl(r.r,r.g,r.b);const o=eC[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=Wl(t);if(d==="#010203")return d;const f=Ul(t);return f&&Vl(f.r,f.g,f.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(s.startsWith("#"))return Wl(s);const u=Ul(s);return!u||u.a===0?null:Vl(u.r,u.g,u.b)}function wp(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?Ke(n):null}function Na(e,t,n){let r=Qx(t);for(;r&&r!==e&&r instanceof HTMLElement;){const o=wp(r,n);if(o)return o;r=r.parentElement}return null}function La(e,t){return e instanceof HTMLElement?wp(e,t)!==null:!1}function pu(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function vp(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function nC(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!gn(o)||!La(o,n)){r=o;continue}if(er(o,r),La(o,n)&&(pu(o,n),Qn(o))){Et(o);continue}r=o}}function kp(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function Ba(e,t){const n=kp(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:vt(n).filter(d=>d.data.length>0),a=(r.length>0?r:[n.startContainer]).map(d=>Na(e,d,t)),s=a[0]??null;return a.every(d=>d===s)?{value:s,mixed:!1}:{value:null,mixed:!0}}function qo(e,t,n){const r=kp(e);if(!r||r.collapsed)return!1;const o=n===null?null:Ke(n);if(n!==null&&o===null)return!1;fn(r);const a=vt(r).filter(s=>s.data.length>0);for(const s of a){const u=Na(e,s,t);if(o===null){if(u===null)continue;nC(e,s,t);continue}u!==o&&ci(s,d=>{vp(d,t,o)})}return Tr(a),!0}function Hm(e,t,n){if(n.value===null){pu(e,t);return}const r=Ke(n.value);r&&vp(e,t,r)}function rC(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function oC(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 iC(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 Sp(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!gn(o)||!n.some(a=>La(o,a))){r=o;continue}er(o,r);for(const a of n)La(o,a)&&pu(o,a);if(Qn(o)){Et(o);continue}r=o.isConnected?o:t}return t}function aC(e,t,n){oC(t);const r=iC(t);return Sp(e,r,n)}function sC(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&Na(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&Na(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Pp=["auto","avoid"],yc=["auto","avoid","page"];new Set(Pp);new Set(yc);function Ap(e){return e.trim().toLowerCase()}function zm(e){return Ap(e)==="avoid"?"avoid":"auto"}function Fa(e){const t=Ap(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function Tp(e){const t=e.style.breakInside;if(t)return zm(t);const n=e.style.pageBreakInside;return n?zm(n):"auto"}function Rp(e){const t=e.style.breakAfter;if(t)return Fa(t);const n=e.style.pageBreakAfter;return n?Fa(n):"auto"}function Dp(e){const t=e.style.breakBefore;if(t)return Fa(t);const n=e.style.pageBreakBefore;return n?Fa(n):"auto"}function lC(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function cC(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function uC(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function dC(e){return{breakInside:Tp(e),breakAfter:Rp(e),breakBefore:Dp(e)}}function mC(e,t){return Tp(e)===t?!1:t==="auto"?(lC(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function fC(e,t){return Rp(e)===t?!1:t==="auto"?(cC(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function pC(e,t){return Dp(e)===t?!1:t==="auto"?(uC(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function gC(e,t){return e===t}function Om(e,t){return e===t}const rt=["top","right","bottom","left"],fs=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],Yt={top:null,right:null,bottom:null,left:null},gu={style:"none",width:null,color:null},hC=new Set(fs),Km={value:0,unit:"px"};function bC(){return{margin:{...Yt},padding:{...Yt},lineHeight:null,border:{...gu},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function hu(){const e=bC();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 Rn(e,t){return rt.every(n=>Ft(e[n],t[n]))}function Ip(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 jp(e,t){return e.style===t.style&&Ft(e.width,t.width)&&e.color===t.color}function Ep(e,t){return e===t?!0:!e||!t?!1:Ft(e.offsetX,t.offsetX)&&Ft(e.offsetY,t.offsetY)&&Ft(e.blur,t.blur)&&Ft(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function yC(e){return e.kind==="normal"?"normal":e.kind==="number"?fe(e.value):je({value:e.value,unit:e.unit})}function xC(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)?qn(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?qn(n):null}function qn(e){return nt(Math.min(1,Math.max(0,e)))}function Ha(e){return nt(qn(e)*100)}function Mp(e){return qn(e/100)}function _p(e){return fe(qn(e))}function CC(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:nt(r)}}const n=ft(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function wC(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 vC(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 kC(e){const t=[je(e.offsetX),je(e.offsetY),je(e.blur),je(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function SC(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=wC(t,",")[0];if(!n)return null;const r=vC(n);let o=!1,a=null;const s=[];for(const u of r){if(u.toLowerCase()==="inset"){o=!0;continue}const d=ft(u);if(d){s.push(d);continue}const f=Ke(u);if(f){a=f;continue}return null}return s.length<2||s.length>4?null:{offsetX:s[0],offsetY:s[1],blur:s[2]??Km,spread:s[3]??Km,color:a,inset:o}}function Xr(e,t){return ft(e.style.getPropertyValue(t))}function PC(e,t,n,r){const o=n&&r?tr(n):n,a=o?je(o):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function $m(e,t){return{top:Xr(e,`${t}-top`),right:Xr(e,`${t}-right`),bottom:Xr(e,`${t}-bottom`),left:Xr(e,`${t}-left`)}}function Um(e,t,n,r){let o=!1;for(const a of rt)PC(e,`${t}-${a}`,n[a],r)&&(o=!0);return o}function AC(e){const t=e.trim().toLowerCase();return hC.has(t)?t:"none"}function Np(e){const t=AC(e.style.borderStyle||e.style.borderTopStyle),n=Xr(e,"border-width")??Xr(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,o=r?Ke(r):null;return{style:t,width:n,color:o}}function TC(e,t){const n=Np(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?tr(t.width):null,color:t.color};return jp(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=je(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function Lp(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return ft(n)}function RC(e,t){const n=t?tr(t):null,r=Lp(e);return Ft(r,n)?!1:(n?e.style.borderRadius=je(n):e.style.removeProperty("border-radius"),!0)}function Bp(e){return SC(e.style.boxShadow)}function DC(e,t){const n=Bp(e),r=t?{...t,blur:tr(t.blur)}:null;return Ep(n,r)?!1:(r?e.style.boxShadow=kC(r):e.style.removeProperty("box-shadow"),!0)}function Fp(e){return CC(e.style.lineHeight)}function IC(e,t){const n=Fp(e);return Ip(n,t)?!1:(t?e.style.lineHeight=yC(t):e.style.removeProperty("line-height"),!0)}function Hp(e){const t=e.style.backgroundColor;return t?Ke(t):null}function jC(e,t){const n=t?Ke(t):null;return Hp(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function zp(e){return xC(e.style.opacity)}function EC(e,t){const n=zp(e),r=t===null?null:qn(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=_p(r),!0)}function fo(e){const t=dC(e);return{margin:$m(e,"margin"),padding:$m(e,"padding"),lineHeight:Fp(e),border:Np(e),borderRadius:Lp(e),boxShadow:Bp(e),backgroundColor:Hp(e),opacity:zp(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function po(e,t){let n=!1;return!t.marginMixed&&Um(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&Um(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&IC(e,t.lineHeight)&&(n=!0),!t.borderMixed&&TC(e,t.border)&&(n=!0),!t.radiusMixed&&RC(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&DC(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&jC(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&EC(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&mC(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&fC(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&pC(e,t.breakBefore)&&(n=!0),n&&xt(e),n}function MC(e){const t=hu(),n=In(e);if(n.length===0)return t;const r=n.map(fo),o=r[0];return{margin:o.margin,marginMixed:r.some(a=>!Rn(a.margin,o.margin)),padding:o.padding,paddingMixed:r.some(a=>!Rn(a.padding,o.padding)),lineHeight:o.lineHeight,lineHeightMixed:r.some(a=>!Ip(a.lineHeight,o.lineHeight)),border:o.border,borderMixed:r.some(a=>!jp(a.border,o.border)),borderRadius:o.borderRadius,radiusMixed:r.some(a=>!Ft(a.borderRadius,o.borderRadius)),boxShadow:o.boxShadow,shadowMixed:r.some(a=>!Ep(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=>!gC(a.breakInside,o.breakInside)),breakAfter:o.breakAfter,breakAfterMixed:r.some(a=>!Om(a.breakAfter,o.breakAfter)),breakBefore:o.breakBefore,breakBeforeMixed:r.some(a=>!Om(a.breakBefore,o.breakBefore))}}function _C(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;let r=!1;for(const o of n)po(o,t)&&(r=!0);return r})}const ni=96,NC=25.4,bu=ni/NC,Op=bu*10,Kp=72,LC=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(in|cm|mm|pt|px|em|rem|%)$/i;function $p(e){const t=e.trim();if(!t)return null;if(/^[+-]?0(?:\.0+)?$/.test(t))return{value:0,unit:"px"};const n=t.match(LC);if(!n)return null;const r=Number(n[1]);return Number.isFinite(r)?{value:nt(r),unit:n[2].toLowerCase()}:null}function ri(e,t){switch(t){case"in":return e/ni;case"cm":return e/Op;case"mm":return e/bu;case"pt":return e/ni*Kp;case"px":default:return e}}function oi(e,t){switch(t){case"in":return e*ni;case"cm":return e*Op;case"mm":return e*bu;case"pt":return e/Kp*ni;case"em":case"rem":return e*16;case"px":default:return e}}function On(e,t=0){if(!e)return t;const n=typeof e=="string"?$p(e):e;return!n||!Number.isFinite(n.value)?t:oi(n.value,n.unit)}function Gl(e,t="in"){const n=ri(e,t);return{value:Math.round(n*1e3)/1e3,unit:t}}function Vo(e){const t=ri(e,"pt");return{value:Math.round(t*1e3)/1e3,unit:"pt"}}function Up(e,t="in"){const n=ri(e,t),r=t==="in"?2:t==="cm"?1:0;return`${n.toFixed(r)} ${t}`}function yr(e,t="in",n=!1,r=0){if(n)return e;const o=e-r,s=oi(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 Vp(e,t,n="in"){const r=[];if(e<=0)return r;const o=n==="in",a=o?.125:.1;if(oi(a,n)<=0)return r;const u=-ri(t,n),d=ri(e-t,n),f=Math.floor(u/a),g=Math.ceil(d/a);for(let h=f;h<=g;h++){const y=h*a,b=t+oi(y,n);if(b<0||b>e)continue;const C=Math.round(y),x=Math.abs(y-C)<.001,v=o?Math.abs(y-(Math.floor(y)+.5))<.001:!1,k=o?Math.abs(y-(Math.floor(y)+.25))<.001||Math.abs(y-(Math.floor(y)+.75))<.001:!1;let S=4;x?S=10:v?S=7:k&&(S=5);const A={positionPx:Math.round(b),unitValue:y,major:x,height:S};x&&y>=0&&(A.label=String(Math.abs(C))),r.push(A)}return r}function Wp(e){const t=ft(e);if(t)return t;const n=$p(e);return n&&(n.unit==="in"||n.unit==="cm"||n.unit==="mm")?Vo(oi(n.value,n.unit)):null}const za="data-page-at-rule";function Kn(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...Yt},marginMixed:!1}}function yu(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Gp(e){return e.body.innerHTML.replace(/\s*data-page=""/g," data-page")}function ii(e){var r;const n=yu(e).querySelector(`style[${za}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function ka(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?Wp(r[1].trim()):null}function BC(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...Yt};const n=t[1].trim().split(/\s+/).map(u=>Wp(u)),[r,o=r,a=r,s=o]=n;return{top:r??null,right:o??null,bottom:a??null,left:s??null}}function FC(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 f=ft(d[0]),g=ft(d[1]);if(f&&g)return{sizePreset:"custom",customWidth:f,customHeight:g,orientation:s}}return!u&&s?{sizePreset:"auto",customWidth:null,customHeight:null,orientation:s}:t}function HC(e){const t=Kn();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],o=FC(r),a={top:ka(r,"top"),right:ka(r,"right"),bottom:ka(r,"bottom"),left:ka(r,"left")},u=rt.some(d=>a[d]!==null)?a:BC(r);return{...o,margin:u,marginMixed:!1}}function tt(e){return HC(ii(e))}function cn(e,t){return ii(e)||!ii(t)?e:Oa(e,tt(t))}function zC(e){const t=rt.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?je(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:rt.map(r=>e[r]?`margin-${r}: ${je(e[r])};`:null).filter(Boolean).join(" ")}function OC(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(je(e.customWidth),je(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function KC(e){const t=OC(e),n=zC(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function dn(e){const t=yu(e);for(const n of t.querySelectorAll(`style[${za}]`))n.remove();return Gp(t)}function $C(e,t){const n=yu(e);let r=n.querySelector(`style[${za}]`);return r||(r=n.createElement("style"),r.setAttribute(za,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,Gp(n)}function Oa(e,t){const n=KC(t);return n?$C(e,n):Zp(e)}function Zp(e){return dn(e)}function qp(e){const t=e.map(n=>ii(n)).filter(n=>!!n);return t.length===0?"":t.join(`
|
|
140
|
-
`)}const xu="data-page-sized",
|
|
141
|
-
${
|
|
142
|
-
`)}function zn(){return"<p></p>"}function $n(e){return e.length===0?[zn()]:e.map(t=>t.trim())}function ql(e,t){if(e.length===t.length){let a=!1;const s=[],u=[];for(let d=0;d<t.length;d+=1){const f=t[d]??"";e[d]===f?s.push(e[d]):(s.push(f),a=!0,u.push(d))}return a?{pages:s,changed:!0,changedIndices:u}:{pages:e,changed:!1,changedIndices:[]}}const n=[],r=[];for(let a=0;a<t.length;a+=1){const s=t[a]??"";a<e.length&&e[a]===s?n.push(e[a]):(n.push(s),r.push(a))}return r.length>0||e.length!==t.length||!xr(e,n)?{pages:n,changed:!0,changedIndices:r}:{pages:e,changed:!1,changedIndices:[]}}function xr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function vc(e,t,n){if(t<0||t>=e.length)return{pages:[...e],changed:!1};if(e[t]===n)return{pages:e,changed:!1};const r=e.slice();return r[t]=n,{pages:r,changed:!0}}function Ye(e,t){const n=e.querySelector(`[${Pr}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${Pr}]`)][t]??null)}function uw(e){if(!e)return null;const t=e instanceof Element?e:e.parentElement;return(t==null?void 0:t.closest(`[${Pr}]`))??null}function Vm(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(`[${Pr}]`)].indexOf(e);if(o!==-1)return o;n=n.parentElement}return null}const It="data-wysiwyg-img-id",kc="data-page-bg",dw=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Sc=/background-image:\s*url\(\s*(["']?)(.+?)\1\s*\)/i;function Wm(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Gm(e){return e.body.innerHTML}function Yl(e){return dw.test(e.trim())}function Zm(e){return e.includes("<img")||e.includes("IMG")||e.includes(kc)||e.includes(It)}function mw(e){var r;const t=Sc.exec(e);return t&&(((r=t[2])==null?void 0:r.trim())??"")||null}function Sa(e,t){const r=`url("${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`;if(Sc.test(e))return e.replace(Sc,`background-image: ${r}`);const o=e.trim().replace(/;+$/,"");return o?`${o};background-image: ${r}`:`background-image: ${r}`}function fw(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`img-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function pw(){const e=new Map;function t(b,C){const x=e.get(b);if(x){if(x.dataUrl!==C){URL.revokeObjectURL(x.objectUrl);const k=URL.createObjectURL(qm(C));return e.set(b,{dataUrl:C,objectUrl:k}),k}return x.objectUrl}const v=URL.createObjectURL(qm(C));return e.set(b,{dataUrl:C,objectUrl:v}),v}function n(b,C){if(!(C!=null&&C.trim())){for(const[v,k]of e)if(k.dataUrl===b)return v}const x=(C==null?void 0:C.trim())||fw();return t(x,b),x}function r(b){var C;return((C=e.get(b))==null?void 0:C.dataUrl)??null}function o(b){var C;return((C=e.get(b))==null?void 0:C.objectUrl)??null}function a(b){return e.has(b)}function s(b){const C=b.trim();if(!C)return null;for(const[x,v]of e)if(v.objectUrl===C)return x;return null}function u(b,C){const x=b.trim();if(!x)return null;if(Yl(x))return x;const v=(C==null?void 0:C.trim())||s(x);return v?r(v):null}function d(b,C){var x,v;for(const k of b.querySelectorAll("img")){const S=(x=k.getAttribute(It))==null?void 0:x.trim(),A=((v=k.getAttribute("src"))==null?void 0:v.trim())??"";if(C==="hydrate"){const P=u(A,S);if(!P)continue;k.setAttribute("src",P);continue}if(S&&a(S)){const P=o(S);P&&k.setAttribute("src",P);continue}const T=s(A);if(T){k.setAttribute(It,T);const P=o(T);P&&k.setAttribute("src",P);continue}if(!Yl(A))continue;const D=n(A);k.setAttribute(It,D);const R=o(D);R&&k.setAttribute("src",R)}}function f(b,C){var x;for(const v of b.querySelectorAll(`[${kc}]`)){if(!(v instanceof HTMLElement))continue;const k=(x=v.getAttribute(It))==null?void 0:x.trim(),S=v.getAttribute("style")??"",A=mw(S);if(C==="hydrate"){if(!A)continue;const P=u(A,k);if(!P)continue;v.setAttribute("style",Sa(S,P));continue}if(!A)continue;if(k&&a(k)){const P=o(k);P&&v.setAttribute("style",Sa(S,P));continue}const T=s(A);if(T){v.setAttribute(It,T);const P=o(T);P&&v.setAttribute("style",Sa(S,P));continue}if(!Yl(A))continue;const D=n(A);v.setAttribute(It,D);const R=o(D);R&&v.setAttribute("style",Sa(S,R))}}function g(b){const C=b.trim();if(!C||!Zm(C))return b;const x=Wm(b);return d(x,"externalize"),f(x,"externalize"),Gm(x)}function h(b){const C=b.trim();if(!C||!Zm(C))return b;const x=Wm(b);f(x,"hydrate"),d(x,"hydrate");for(const v of x.querySelectorAll("img"))v.removeAttribute(It);for(const v of x.querySelectorAll(`[${kc}]`))v.removeAttribute(It);return Gm(x)}function y(){for(const b of e.values())URL.revokeObjectURL(b.objectUrl);e.clear()}return{register:n,getDataUrl:r,getObjectUrl:o,has:a,externalizeHtml:g,hydrateHtml:h,clear:y}}function qm(e){const t=e.indexOf(",");if(t<0)return new Blob;const n=e.slice(0,t),r=e.slice(t+1),o=/^data:([^;,]+)/i.exec(n),a=(o==null?void 0:o[1])??"application/octet-stream",s=atob(r),u=new Uint8Array(s.length);for(let d=0;d<s.length;d+=1)u[d]=s.charCodeAt(d);return new Blob([u],{type:a})}const gw=.85,hw=new Set(["image/webp","image/avif","image/gif"]);let zo=null;function bw(){if(zo!==null)return zo;zo=!1;try{zo=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp")}catch{}return zo}function yw(e){const t=e.type.trim().toLowerCase();if(t&&hw.has(t))return!1;const n=ww(e.name);return!(!t&&(n==="webp"||n==="avif"||n==="gif"))}function xw(e,t=gw){return typeof createImageBitmap!="function"?Promise.resolve(null):createImageBitmap(e).then(n=>Cw(n,t)).catch(()=>null)}function Cw(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 ww(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const ag=2*1024*1024,vw="image/jpeg,image/png,image/gif,image/webp,image/bmp,image/avif,.jpg,.jpeg,.png,.gif,.webp,.bmp,.avif",kw=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/x-ms-bmp","image/avif"]),Sw=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),sg=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Pw=/^(javascript|vbscript|file|blob):/i;function Aw(e={}){return{src:"",alt:"",title:"",...e}}function pn(e){const t=e.trim();if(!t)return"empty";if(Pw.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return sg.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 Tw(e){return e.size>ag?"tooLarge":Nw(e)?null:"type"}function Rw(e){const t=Tw(e);return t?Promise.reject(new Error(t)):Dw(e)}async function Dw(e){if(yw(e)&&bw()){const t=await xw(e);if(t&&pn(t)===null&&jw(t)<=ag)return t}return Iw(e)}function Iw(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=String(r.result??"");if(pn(o)){n(new Error("invalid"));return}t(o)},r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsDataURL(e)})}function jw(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 Ew(e,t,n){const r=lg(t,n);e.setAttribute("src",r.src.trim()),r.registryId?e.setAttribute(It,r.registryId):e.removeAttribute(It);const o=t.alt.trim(),a=t.title.trim();o?e.setAttribute("alt",o):e.removeAttribute("alt"),a?e.setAttribute("title",a):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",Mw(e,t.css)}function Mw(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){if(!t)return e;const n=e.src.trim();if(pn(n)||!sg.test(n))return e;const r=t.register(n),o=t.getObjectUrl(r);return o?{...e,src:o,registryId:r}:e}function _w(e,t,n){const r=Aw(t),o=n?lg(r,n):r;if(o.registryId){const d=n==null?void 0:n.getDataUrl(o.registryId);if(!d||pn(d))return!1}else if(pn(o.src))return!1;const a=window.getSelection();if(!a||a.rangeCount===0)return!1;const s=a.getRangeAt(0);if(!Se(e,s.commonAncestorContainer))return!1;s.collapsed||s.deleteContents();const u=document.createElement("img");return Ew(u,o,n),s.insertNode(u),s.setStartAfter(u),s.collapse(!0),a.removeAllRanges(),a.addRange(s),!0}function Pc(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Xl(e,t){if(!Se(e,t)||t===e)return!1;const n=document.createRange();n.selectNode(t);const r=window.getSelection();return r?(r.removeAllRanges(),r.addRange(n),!0):!1}function Nw(e){const t=e.type.trim().toLowerCase();if(t&&kw.has(t))return!0;const n=Lw(e.name);return!!(!t&&n&&Sw.has(n))}function Lw(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const cg=["%","px","pt","pc","em","rem"],Bw="%",Fw={"%":[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]},lo={"%":{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}},Hw=new Set(cg),zw=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function Ow(e){return Hw.has(e)}function Cr(e){return`${fe(e.value)}${e.unit}`}function Ua(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(zw);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 Ow(o)?co(r,o):null}function Ym(e,t){const n=e.trim();if(!n)return null;const r=Ua(n);if(r)return r;const o=Number(n.replace(",","."));return Number.isFinite(o)?co(o,t):null}function co(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=lo[t];return{value:nt(Math.min(r,Math.max(n,e))),unit:t}}function Xo(e,t,n){const r=n>0?n:1;if(e==="width"){const a=co(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:co(t.value*r,t.unit)??t,height:t}}const Ea="data-hover-css",Su=["fill","contain","cover","none","scale-down"],Pu=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],Kw=new Set(Su),$w=new Set(Pu),Xm="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",Uw="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",Vw=/^-?[a-z][a-z0-9-]*$/i,Ww=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,Ac=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function ug(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...Yt},border:{...gu},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function Gw(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function Zw(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=Xo("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=Xo("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function qw(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||Vw.test(a)&&(a==="behavior"||a.endsWith("binding")||Ww.test(s)||t.push(`${a}: ${s}`))}return t.join("; ")}function Vn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return null;if(n.startContainer instanceof HTMLImageElement)return n.startContainer;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const r=n.startContainer.childNodes[n.startOffset];if(r instanceof HTMLImageElement&&Se(e,r))return r}return Pc(e,n.commonAncestorContainer)}function Yw(e){const t=Vn(e);return t?dg(t):null}function dg(e){const t=fo(e),n=t1(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,o=Jw(e);return ug({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:fg(e),objectPosition:i1(e),rotateDeg:pg(e),hoverCss:e.getAttribute(Ea)??""})}function mg(e,t){let n=!1;return Qw(e,t)&&(n=!0),po(e,{margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:Yt,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),n1(e,t.align)&&(n=!0),r1(e,t.objectFit)&&(n=!0),o1(e,t.objectPosition)&&(n=!0),s1(e,t.rotateDeg)&&(n=!0),l1(e,t.hoverCss)&&(n=!0),n}function Xw(e,t){const n=Vn(e);return n?mg(n,t):!1}function Jw(e){const t=Ua(e.style.width),n=Ua(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 Qw(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=e1(t);return r.width?e.style.width=Cr(r.width):e.style.removeProperty("width"),r.height?e.style.height=Cr(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 e1(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 t1(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 n1(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 fg(e){const t=e.style.objectFit.trim().toLowerCase();return Kw.has(t)?t:null}function r1(e,t){return fg(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function o1(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 i1(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?($w.has(t),t):null}function pg(e){const t=Ac.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?nt(n):null}function a1(e){const t=e.trim();return t?Ac.test(t)&&t.replace(Ac,"").trim()==="":!0}function s1(e,t){const n=pg(e),r=t===null||t===0?null:nt(t);return n===r?!1:r===null?a1(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${fe(r)}deg)`,!0)}function l1(e,t){const n=qw(t),r=e.getAttribute(Ea)??"",o=e.getAttribute("onmouseover")??"";return r===n&&(n&&o===Xm||!n&&!o)?!1:n?(e.setAttribute(Ea,n),e.setAttribute("onmouseover",Xm),e.setAttribute("onmouseout",Uw),!0):(e.removeAttribute(Ea),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const no={value:100,unit:"%"},c1=new Set(Su),u1=new Set(Pu),d1=new Set(["cover","contain","scale-down","none"]),Jm={contain:"contain",cover:"cover",auto:"none"},Qm={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function mn(){return{src:null,opacity:null,fit:null,position:null,width:{...no},height:null}}function gg(e){return e!=null&&d1.has(e)}function hg(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?qn(n):null}function ef(e,t){const n=hg(e),r=t===null?null:qn(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=_p(r),!0)}function bg(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 m1(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function tf(e,t){const n=bg(e),r=(t==null?void 0:t.trim())??"",o=r&&pn(r)===null?r:null;return n===o?!1:(o?e.style.backgroundImage=m1(o):e.style.removeProperty("background-image"),!0)}function Au(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Jl(e){return!e||e==="auto"?null:Ua(e)}function f1(e){return gg(e.fit)&&e.fit?Qm[e.fit]:e.fit==="fill"?Qm.fill:e.width&&e.height?`${Cr(e.width)} ${Cr(e.height)}`:e.width?Cr(e.width):e.height?`auto ${Cr(e.height)}`:null}function p1(e){const t=Au(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...no},height:{...no}};if(Jm[t])return{fit:Jm[t],width:null,height:null};if(c1.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:Jl(n[0]),height:null}:n.length===2?{fit:null,width:Jl(n[0]),height:Jl(n[1])}:{fit:null,width:null,height:null}}function g1(e,t){const n=Au(e.style.backgroundSize),r=f1(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function h1(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(u1.has(t),t):null}function nf(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 Va(e){let t=!1;return e.id!==Ka&&(e.id=Ka,t=!0),e.hasAttribute(ao)||(e.setAttribute(ao,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function Wa(e){const t=e.getAttribute("style");e.style.position="absolute",e.style.inset="0",e.style.zIndex="0",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.style.setProperty("print-color-adjust","exact");const n=e.style.cssText;return n.includes("-webkit-print-color-adjust")||e.setAttribute("style",`${n};-webkit-print-color-adjust:exact`),e.getAttribute("style")!==t}function yg(e){const t=Cu(e),n=t[0]??null;if(n){let o=Va(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 Va(r),Wa(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function b1(e){const t=Cu(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function Ga(e){let t=!1;return wu(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 Tu(e){if(!wu(e))return Ga(e);const n=yg(e);let r=n.changed;return Va(n.layer)&&(r=!0),Wa(n.layer)&&(r=!0),Ga(e)&&(r=!0),r}function ys(e){const t=ct(e);if(!t)return!1;let n=hs(e);return Tu(t)&&(n=!0),n}function y1(e){return e.includes(ao)||e.includes(Sr)}function x1(e){const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");hs(t.body);const n=ct(t.body);return n&&(Tu(n),gs(n)),t.body.innerHTML}function rf(e){return y1(e)?x1(e):e}function xg(e){const t=p1(e);return{src:bg(e),opacity:hg(e),fit:t.fit,position:h1(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&&pn(n)===null;let o=!1;return r?(tf(e,n)&&(o=!0),g1(e,t)&&(o=!0),nf(e,t.position)&&(o=!0),ef(e,t.opacity)&&(o=!0),e.style.backgroundRepeat!=="no-repeat"&&(e.style.backgroundRepeat="no-repeat",o=!0),o&&xt(e),o):(tf(e,null)&&(o=!0),Au(e.style.backgroundSize)&&(e.style.removeProperty("background-size"),o=!0),nf(e,null)&&(o=!0),ef(e,null)&&(o=!0),e.style.backgroundRepeat&&(e.style.removeProperty("background-repeat"),o=!0),o&&xt(e),o)}function C1(e){const t=wu(e);return t?xg(t):mn()}function w1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&pn(n)===null)){const d=b1(e),f=Ga(e);return(d||f)&&xt(e),d||f}const o=yg(e),a=o.layer;let s=o.changed;return Va(a)&&(s=!0),Wa(a)&&(s=!0),Ga(e)&&(s=!0),Cg(a,t)&&(s=!0),Wa(a)&&(s=!0),s&&(xt(a),xt(e)),s}function v1(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function k1(e){const t=e.style.backgroundImage.trim();if(t&&t!=="none")return!0;const n=e.getAttribute("style")??"";return/background-image\s*:\s*(?!none\b)/i.test(n)}function of(e){const t=e.trim().match(/^([\d.]+)pt$/i);return t?Number.parseFloat(t[1]):null}function S1(e,t){if(!t)return e;if(!e)return t;const n=of(e),r=of(t);return n!==null&&r!==null?`${Math.max(n,r)}pt`:t}function P1(e,t){const n=tt(t),r=mi(n);e.style.boxSizing="border-box",e.style.position!=="relative"&&(e.style.position="relative"),e.style.isolation!=="isolate"&&(e.style.isolation="isolate");const o=go(n);o?(e.style.width=o.width,e.style.minHeight=o.height):(e.style.width||(e.style.width="100%"),e.style.minHeight="100vh"),e.style.height="auto";for(const a of rt){const s=`padding-${a}`,u=r[a],d=e.style.getPropertyValue(s).trim()||null,f=S1(d,u);f&&e.style.setProperty(s,f)}}function Ru(e){const t=v1(e);let n=!1;hs(t.body);for(const r of t.querySelectorAll(`[${Sr}]`)){if(!(r instanceof HTMLElement))continue;const o=r.querySelector(`[${ao}]`);!(o instanceof HTMLElement)||!k1(o)||(n=!0,P1(r,e),Tu(r))}return{html:t.body.innerHTML,hasBleed:n}}const af=`
|
|
139
|
+
Abrir Ayuda: F1`,helpTopicKeyboardShortcutsKeywords:"atajos teclado"},ax={en:eu,es:ix},up=l.createContext(e=>eu[e]);function sx({locale:e="en",children:t}){const n=l.useMemo(()=>{const r=ax[e]??eu;return o=>r[o]},[e]);return i.jsx(up.Provider,{value:n,children:t})}function X(){return l.useContext(up)}const lx="_menu_c1m45_1",cx="_item_c1m45_19",ux="_separator_c1m45_59",$l={menu:lx,item:cx,separator:ux},Ca=8,dx=[{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:"item",command:"addComment",labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:(e,t)=>t.canAddComment&&(e==="text"||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:"openPageBackgroundImage",labelKey:"commandBackgroundImageProperties",ariaKey:"commandBackgroundImagePropertiesAria",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 mx(e,t){const n=[];let r=!1;for(const o of dx){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 Em(){return'[role="menuitem"]:not(:disabled)'}function fx({open:e,x:t,y:n,kind:r,inTable:o=!1,canMergeCells:a=!1,canUnmergeCells:s=!1,canDeletePage:u=!1,canAddComment:d=!1,commands:f,onClose:g}){const h=X(),y=l.useId(),b=l.useRef(null);if(l.useLayoutEffect(()=>{var T;if(!e)return;const v=b.current;if(!v)return;const k=v.getBoundingClientRect(),S=Math.max(Ca,Math.min(t,window.innerWidth-k.width-Ca)),A=Math.max(Ca,Math.min(n,window.innerHeight-k.height-Ca));v.style.left=`${S}px`,v.style.top=`${A}px`,(T=v.querySelector(Em()))==null||T.focus()},[e,t,n,r]),l.useEffect(()=>{if(!e)return;const v=T=>{var D;(D=b.current)!=null&&D.contains(T.target)||g()},k=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),g())},S=()=>{g()},A=T=>{var D;if((D=b.current)!=null&&D.contains(T.target)){T.preventDefault();return}T.defaultPrevented||g()};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",k,!0),window.addEventListener("scroll",S,!0),document.addEventListener("contextmenu",A),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",k,!0),window.removeEventListener("scroll",S,!0),document.removeEventListener("contextmenu",A)}},[e,g]),!e)return null;const C=mx(r,{inTable:o,canMergeCells:a,canUnmergeCells:s,canDeletePage:u,canAddComment:d}),x=v=>{var D;if(v.key!=="ArrowDown"&&v.key!=="ArrowUp")return;const k=[...((D=b.current)==null?void 0:D.querySelectorAll(Em()))??[]];if(k.length===0)return;const S=k.indexOf(document.activeElement),A=v.key==="ArrowDown"?1:-1,T=k[(S+A+k.length)%k.length];v.preventDefault(),T==null||T.focus()};return i.jsx(ke,{children:i.jsxs("div",{ref:b,className:$l.menu,role:"menu","aria-labelledby":y,style:{left:t,top:n},onMouseDown:v=>v.preventDefault(),onKeyDown:x,children:[i.jsx("span",{id:y,hidden:!0,children:h("contextMenuAria")}),C.map((v,k)=>v.type==="separator"?i.jsx("div",{role:"separator",className:$l.separator},`separator-${k}`):i.jsx("button",{type:"button",role:"menuitem",className:$l.item,"aria-label":h(v.ariaKey),onClick:()=>{g(),Qc(f,v.command)},children:h(v.labelKey)},v.command))]})})}function px(e){return e==="touch"||e==="pen"}function gx(e,t){return e.button===2||e.ctrlKey?!0:!px(t)}const hx=new Set(["span","strong","b","em","i","u","s","strike","del"]);function Se(e,t){return t?e===t||e.contains(t):!1}function gn(e){return hx.has(e.tagName.toLowerCase())}function bx(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 vt(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&&bx(e,o)&&n.push(o);return n}function fn(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 Qn(e){return e.tagName.toLowerCase()!=="span"||e.style.cssText.trim()?!1:(e.removeAttribute("style"),e.attributes.length===0)}function Et(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function er(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 Tr(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 ui(e,t){const n=e.parentElement;if(n&&n.tagName.toLowerCase()==="span"&&n.childNodes.length===1)return t(n),n;const r=document.createElement("span");return t(r),n==null||n.insertBefore(r,e),r.appendChild(e),r}const ds="data-wysiwyg-font",yx=[{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 kr(e){return e.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").toLowerCase()).filter(Boolean).join(",")}function di(e,t){return e===t?!0:!e||!t?!1:kr(e)===kr(t)}function dp(e=[]){var r;const t=[],n=new Set;for(const o of[...yx,...e]){const a=o.family.trim();if(!a)continue;const s=kr(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 xx(e,t){return e?t.find(n=>di(n.family,e))??null:null}function Cx(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function wx(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function ms(e){const t=new Set,n=[];for(const r of e){const o=r.trim();!o||!Cx(o)||t.has(o)||(t.add(o),n.push(o))}return n}function vx(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/&/g,"&")}const kx=new RegExp(`<link\\b[^>]*\\b${ds}\\b[^>]*>`,"gi");function he(e){if(!e.includes(ds))return{hrefs:[],body:e};const t=[],n=e.replace(kx,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(vx(o)),""});return{hrefs:ms(t),body:n}}function wa(e,t){const n=ms(t);return n.length===0?e:`${n.map(o=>`<link rel="stylesheet" href="${wx(o)}" ${ds}="">`).join("")}${e}`}function tu(e){return e.style.fontFamily.trim()||null}const Sx=32,Vo=new Map;function mp(e,t){return`${kr(t)}\0${e}`}function Px(e,t){return Vo.get(mp(e,t))}function Ul(e,t,n){const r=mp(e,t);if(Vo.size>=Sx){const o=Vo.keys().next().value;o!==void 0&&Vo.delete(o)}Vo.set(r,n)}function fp(e,t){const n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=n.currentNode;for(;r;){if(r instanceof HTMLElement){const o=tu(r);if(o&&kr(o)===t)return!0}r=n.nextNode()}return!1}function Ax(e,t){const n=kr(t);return n?fp(e,n):!1}function Tx(e,t){const n=kr(t);if(!n)return!1;const r=Px(e,t);if(r!==void 0)return r;const o=e.toLowerCase();if(!o.includes("font-family")&&!o.includes("face="))return Ul(e,t,!1),!1;const a=n.split(",")[0].replace(/['"]/g,"").trim().toLowerCase();if(a&&!o.includes(a))return Ul(e,t,!1),!1;const s=new DOMParser().parseFromString(e,"text/html"),u=fp(s.body,n);return Ul(e,t,u),u}function va(e,t,n=[],r){const o=he(t).hrefs,a=n.filter(s=>s.css?r!=null&&r.liveRoot?Ax(r.liveRoot,s.family):Tx(e,s.family):!1).map(s=>s.css??"");return ms([...o,...a])}function Mm(e,t=[]){const n=he(e).hrefs,r=t.map(o=>o.css??"");return ms([...n,...r])}function Rx(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function nu(e,t){let n=Rx(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=tu(n);if(r)return r;n=n.parentElement}return null}function pc(e){return e instanceof HTMLElement&&tu(e)!==null}function ru(e){e.style.fontFamily="",e.style.removeProperty("font-family")}function Dx(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!gn(r)||!pc(r)){n=r;continue}if(er(r,n),pc(r)&&(ru(r),Qn(r))){Et(r);continue}n=r}}function pp(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function gp(e){const t=pp(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:vt(t).filter(u=>u.data.length>0),o=(n.length>0?n:[t.startContainer]).map(u=>nu(e,u)),a=o[0]??null;return o.every(u=>di(u,a))?{value:a,mixed:!1}:{value:null,mixed:!0}}function gc(e,t){const n=pp(e);if(!n||n.collapsed)return!1;const r=t!=null&&t.trim()?t.trim():null;fn(n);const o=vt(n).filter(a=>a.data.length>0);for(const a of o){const s=nu(e,a);if(r===null){if(s===null)continue;Dx(e,a);continue}di(s,r)||ui(a,u=>{u.style.fontFamily=r})}return Tr(o),!0}function Ix(e,t){if(t){if(t.value===null){ru(e);return}e.style.fontFamily=t.value}}function jx(e){return e!=null}function Ex(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 Mx(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 hc(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!gn(r)||!pc(r)){n=r;continue}if(er(r,n),ru(r),Qn(r)){Et(r);continue}n=r.isConnected?r:t}return t}function _x(e,t){Ex(t);const n=Mx(t);return hc(e,n)}function Nx(e,t,n){return!!(n&&n.value===null&&nu(e,t))}const ou=["pt","px","em","rem","%"],oo="pt",Lx={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]},Bx={pt:{min:1,max:400},px:{min:1,max:400},em:{min:.1,max:20},rem:{min:.1,max:20},"%":{min:1,max:1e3}},Fx=new Set(ou),Hx=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc|cm|mm|in|ex|ch|q|vw|vh|vmin|vmax)$/i;function fs(e){return Fx.has(e)}function nt(e){return Math.round(e*100)/100}function fe(e){const t=nt(e);return Number.isInteger(t),String(t)}function iu(e,t){return`${fe(e)}${t}`}function au(e){const t=e.trim();if(!t)return null;const n=t.match(Hx);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 zx(e,t){const n=e.trim();if(!n)return null;const r=au(n);if(r)return fs(r.unit)?vr(r.value,r.unit):null;const o=Number(n.replace(",","."));return Number.isFinite(o)?vr(o,t):null}function vr(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=Bx[t];return{value:nt(Math.min(r,Math.max(n,e))),unit:t}}function hp(e,t,n,r){const o=n>0?n:16,a=r>0?r:16;switch(t){case"px":return nt(e);case"pt":return nt(e*.75);case"em":return nt(e/o);case"rem":return nt(e/a);case"%":return nt(e/o*100)}}function Ox(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 bp(e,t,n,r,o){if(t===n)return nt(e);const a=Ox(e,t,r,o);return hp(a,n,r,o)}const su="pt",Kx=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%)$/i,$x=/^[+-]?0(?:\.0+)?$/;function je(e){return`${fe(e.value)}${e.unit}`}function ft(e){const t=e.trim();if(!t)return null;if($x.test(t))return{value:0,unit:"px"};const n=t.match(Kx);if(!n)return null;const r=Number(n[1]);if(!Number.isFinite(r))return null;const o=n[2]==="%"?"%":n[2].toLowerCase();return fs(o)?{value:nt(r),unit:o}:null}function ni(e,t,n){const r=e.trim();if(!r)return null;const o=ft(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:nt(a),unit:t}:null}function tr(e){return e.value>=0?e:{value:0,unit:e.unit}}function Ft(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function ka(e){return{text:e.text,collapsed:e.collapsed,start:e.start,end:e.end}}function Ux(e,t){return t?e===t||e.contains(t):!1}function _m(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 Nm(e,t,n){var a;if(t.nodeType===Node.TEXT_NODE)return _m(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 _m(e,t)+r}function Lm(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 lu(e,t,n){const r=document.createRange(),o=Lm(e,t),a=Lm(e,n);return r.setStart(o.node,o.offset),r.setEnd(a.node,a.offset),r}function yp(e,t){try{const n=e.commonAncestorContainer;return t===n||t.contains(n)}catch{return!1}}function Bm(e,t){return!!(e&&e.mode==="visual"&&e.visualRange&&(!t.visualRange||!e.collapsed&&t.collapsed))}function Vx(e,t){return t.mode!=="visual"?null:t.visualRange&&yp(t.visualRange,e)?t.visualRange:lu(e,t.start,t.end)}function ln(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(Ux(t,a.commonAncestorContainer)){const s=Nm(t,a.startContainer,a.startOffset),u=Nm(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 Fm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Wx(e){if(e.snapshot.mode==="html"){const a=e.getHtml(),s=e.snapshot.start,u=e.snapshot.end,d=e.asHtml?e.content:Fm(e.content);e.setHtml(a.slice(0,s)+d+a.slice(u));const f=e.htmlEl;if(f){const g=s+d.length;f.focus(),f.setSelectionRange(g,g)}return}const t=e.visualEl;if(!t){const a=e.asHtml?e.content:Fm(e.content);e.setHtml(e.getHtml()+a);return}const r=(e.snapshot.visualRange&&yp(e.snapshot.visualRange,t)?e.snapshot.visualRange:null)??lu(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 cu=new Set(["p","h1","h2","h3","h4","h5","h6","div","li","blockquote"]),xp=new Set(["table","thead","tbody","tr","td","th"]),uu=new Set([...xp,"ul","ol","li","pre","hr"]);function _e(e){return e.tagName.toLowerCase()}function mi(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function du(e){return e instanceof HTMLElement&&(_e(e)==="ul"||_e(e)==="ol")}function Ht(e){return e instanceof HTMLElement&&_e(e)==="li"}function hn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function mu(e){const t=e.collapsed?[]:vt(e).filter(n=>n.data.length>0);return t.length>0?t:[e.startContainer]}function io(e,t,n){var d,f,g;if(t.nodeType===Node.TEXT_NODE){const h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let y=0,b;for(;b=h.nextNode();){if(b===t)return y+n;y+=((d=b.textContent)==null?void 0:d.length)??0}return y}let r=0;const o=t.childNodes;for(let h=0;h<n&&h<o.length;h+=1)r+=((f=o[h].textContent)==null?void 0:f.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+=((g=u.textContent)==null?void 0:g.length)??0}return s+r}function fu(e,t,n){const r=lu(e,t,n),o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)}function nr(e,t){const n=hn(e);if(!n)return!1;const r=io(e,n.startContainer,n.startOffset),o=io(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=t();return fu(e,a,s),u}function pu(e,t){if(_e(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 xt(e){var t;(t=e.getAttribute("style"))!=null&&t.trim()||e.removeAttribute("style")}function Gx(e,t){let n=mi(t);for(;n&&n!==e;){if(og(n,e)||kt(n)){n=n.parentElement;continue}const r=_e(n);if(cu.has(r)&&n instanceof HTMLElement)return n;if(xp.has(r)||r==="pre")return null;n=n.parentElement}return null}function In(e){const t=hn(e);if(!t)return[];const n=new Set,r=[];for(const o of mu(t)){const a=Gx(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function bc(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return cu.has(t)||uu.has(t)?!1:gn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Zx(e,t){let n=mi(t);for(;n&&n!==e;){if(uu.has(_e(n)))return!0;n=n.parentElement}return!1}function qx(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Yx(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&bc(n[o-1]);)o-=1;for(;a<n.length-1&&bc(n[a+1]);)a+=1;return n.slice(o,a+1)}function yc(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function Xx(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&&kt(r)?yc(e):r}return n.startContainer===t&&e!==t?yc(e):qx(e,n.startContainer)}function Jx(e,t){const n=ku(e);if(Zx(e,t.startContainer))return null;if(!yc(n)){const s=document.createElement("p");return s.appendChild(document.createElement("br")),n.appendChild(s),s}const r=Xx(n,e,t);if(!r||r instanceof HTMLElement&&kt(r)||r instanceof Element&&uu.has(_e(r))||r instanceof HTMLElement&&cu.has(_e(r))||!bc(r))return null;const o=Yx(n,r),a=document.createElement("p");n.insertBefore(a,o[0]);for(const s of o)a.appendChild(s);return a}function Rr(e){const t=In(e);if(t.length>0)return t;const n=hn(e);if(!n)return[];const r=Jx(e,n);return r?[r]:[]}function ao(e){const t=e.parentElement;return t&&du(t)?t:null}function Cp(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&&Qx(r,o)?t[t.length-1].push(o):t.push([o])}return t}function Qx(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 eC(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function Vl(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 Wl(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 Gl(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 tC={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 nC(e){const t=e.trim().toLowerCase();return t===""||t==="transparent"||t==="inherit"||t==="initial"||t==="unset"||t==="currentcolor"||t==="currentColor"}function Ke(e){const t=e.trim();if(!t||nC(t))return null;const n=Gl(t);if(n)return n;const r=Vl(t);if(r)return r.a===0?null:Wl(r.r,r.g,r.b);const o=tC[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=Gl(t);if(d==="#010203")return d;const f=Vl(t);return f&&Wl(f.r,f.g,f.b)==="#010203"?"#010203":t.trim().toLowerCase()==="black"?"#000000":null}if(s.startsWith("#"))return Gl(s);const u=Vl(s);return!u||u.a===0?null:Wl(u.r,u.g,u.b)}function wp(e,t){const n=t==="color"?e.style.color:e.style.backgroundColor;return n?Ke(n):null}function La(e,t,n){let r=eC(t);for(;r&&r!==e&&r instanceof HTMLElement;){const o=wp(r,n);if(o)return o;r=r.parentElement}return null}function Ba(e,t){return e instanceof HTMLElement?wp(e,t)!==null:!1}function gu(e,t){if(t==="color"){e.style.color="",e.style.removeProperty("color");return}e.style.backgroundColor="",e.style.removeProperty("background-color")}function vp(e,t,n){if(t==="color"){e.style.color=n;return}e.style.backgroundColor=n}function rC(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!gn(o)||!Ba(o,n)){r=o;continue}if(er(o,r),Ba(o,n)&&(gu(o,n),Qn(o))){Et(o);continue}r=o}}function kp(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function Fa(e,t){const n=kp(e);if(!n)return{value:null,mixed:!1};const r=n.collapsed?[]:vt(n).filter(d=>d.data.length>0),a=(r.length>0?r:[n.startContainer]).map(d=>La(e,d,t)),s=a[0]??null;return a.every(d=>d===s)?{value:s,mixed:!1}:{value:null,mixed:!0}}function Yo(e,t,n){const r=kp(e);if(!r||r.collapsed)return!1;const o=n===null?null:Ke(n);if(n!==null&&o===null)return!1;fn(r);const a=vt(r).filter(s=>s.data.length>0);for(const s of a){const u=La(e,s,t);if(o===null){if(u===null)continue;rC(e,s,t);continue}u!==o&&ui(s,d=>{vp(d,t,o)})}return Tr(a),!0}function Hm(e,t,n){if(n.value===null){gu(e,t);return}const r=Ke(n.value);r&&vp(e,t,r)}function oC(e){return!!(e!=null&&e.color||e!=null&&e.backgroundColor)}function iC(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 aC(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 Sp(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!gn(o)||!n.some(a=>Ba(o,a))){r=o;continue}er(o,r);for(const a of n)Ba(o,a)&&gu(o,a);if(Qn(o)){Et(o);continue}r=o.isConnected?o:t}return t}function sC(e,t,n){iC(t);const r=aC(t);return Sp(e,r,n)}function lC(e,t,n){const r=[];return n!=null&&n.color&&n.color.value===null&&La(e,t,"color")&&r.push("color"),n!=null&&n.backgroundColor&&n.backgroundColor.value===null&&La(e,t,"backgroundColor")&&r.push("backgroundColor"),r}const Pp=["auto","avoid"],xc=["auto","avoid","page"];new Set(Pp);new Set(xc);function Ap(e){return e.trim().toLowerCase()}function zm(e){return Ap(e)==="avoid"?"avoid":"auto"}function Ha(e){const t=Ap(e);return t==="avoid"?"avoid":t==="page"||t==="always"?"page":"auto"}function Tp(e){const t=e.style.breakInside;if(t)return zm(t);const n=e.style.pageBreakInside;return n?zm(n):"auto"}function Rp(e){const t=e.style.breakAfter;if(t)return Ha(t);const n=e.style.pageBreakAfter;return n?Ha(n):"auto"}function Dp(e){const t=e.style.breakBefore;if(t)return Ha(t);const n=e.style.pageBreakBefore;return n?Ha(n):"auto"}function cC(e){e.style.removeProperty("break-inside"),e.style.removeProperty("page-break-inside")}function uC(e){e.style.removeProperty("break-after"),e.style.removeProperty("page-break-after")}function dC(e){e.style.removeProperty("break-before"),e.style.removeProperty("page-break-before")}function mC(e){return{breakInside:Tp(e),breakAfter:Rp(e),breakBefore:Dp(e)}}function fC(e,t){return Tp(e)===t?!1:t==="auto"?(cC(e),!0):(e.style.breakInside="avoid",e.style.pageBreakInside="avoid",!0)}function pC(e,t){return Rp(e)===t?!1:t==="auto"?(uC(e),!0):t==="avoid"?(e.style.breakAfter="avoid",e.style.pageBreakAfter="avoid",!0):(e.style.breakAfter="page",e.style.pageBreakAfter="always",!0)}function gC(e,t){return Dp(e)===t?!1:t==="auto"?(dC(e),!0):t==="avoid"?(e.style.breakBefore="avoid",e.style.pageBreakBefore="avoid",!0):(e.style.breakBefore="page",e.style.pageBreakBefore="always",!0)}function hC(e,t){return e===t}function Om(e,t){return e===t}const rt=["top","right","bottom","left"],ps=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],Yt={top:null,right:null,bottom:null,left:null},hu={style:"none",width:null,color:null},bC=new Set(ps),Km={value:0,unit:"px"};function yC(){return{margin:{...Yt},padding:{...Yt},lineHeight:null,border:{...hu},borderRadius:null,boxShadow:null,backgroundColor:null,opacity:null,breakInside:"auto",breakAfter:"auto",breakBefore:"auto"}}function Dr(){const e=yC();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 Rn(e,t){return rt.every(n=>Ft(e[n],t[n]))}function Ip(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 jp(e,t){return e.style===t.style&&Ft(e.width,t.width)&&e.color===t.color}function Ep(e,t){return e===t?!0:!e||!t?!1:Ft(e.offsetX,t.offsetX)&&Ft(e.offsetY,t.offsetY)&&Ft(e.blur,t.blur)&&Ft(e.spread,t.spread)&&e.color===t.color&&e.inset===t.inset}function xC(e){return e.kind==="normal"?"normal":e.kind==="number"?fe(e.value):je({value:e.value,unit:e.unit})}function CC(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)?qn(r/100):null}const n=Number(t.replace(",","."));return Number.isFinite(n)?qn(n):null}function qn(e){return nt(Math.min(1,Math.max(0,e)))}function za(e){return nt(qn(e)*100)}function Mp(e){return qn(e/100)}function _p(e){return fe(qn(e))}function wC(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:nt(r)}}const n=ft(t);return!n||n.value<0?null:{kind:"length",value:n.value,unit:n.unit}}function vC(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 kC(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 SC(e){const t=[je(e.offsetX),je(e.offsetY),je(e.blur),je(e.spread)];e.color&&t.push(e.color);const n=t.join(" ");return e.inset?`inset ${n}`:n}function PC(e){const t=e.trim();if(!t||t.toLowerCase()==="none")return null;const n=vC(t,",")[0];if(!n)return null;const r=kC(n);let o=!1,a=null;const s=[];for(const u of r){if(u.toLowerCase()==="inset"){o=!0;continue}const d=ft(u);if(d){s.push(d);continue}const f=Ke(u);if(f){a=f;continue}return null}return s.length<2||s.length>4?null:{offsetX:s[0],offsetY:s[1],blur:s[2]??Km,spread:s[3]??Km,color:a,inset:o}}function Jr(e,t){return ft(e.style.getPropertyValue(t))}function AC(e,t,n,r){const o=n&&r?tr(n):n,a=o?je(o):"";return e.style.getPropertyValue(t)===a?!1:(a?e.style.setProperty(t,a):e.style.removeProperty(t),!0)}function $m(e,t){return{top:Jr(e,`${t}-top`),right:Jr(e,`${t}-right`),bottom:Jr(e,`${t}-bottom`),left:Jr(e,`${t}-left`)}}function Um(e,t,n,r){let o=!1;for(const a of rt)AC(e,`${t}-${a}`,n[a],r)&&(o=!0);return o}function TC(e){const t=e.trim().toLowerCase();return bC.has(t)?t:"none"}function Np(e){const t=TC(e.style.borderStyle||e.style.borderTopStyle),n=Jr(e,"border-width")??Jr(e,"border-top-width"),r=e.style.borderColor||e.style.borderTopColor,o=r?Ke(r):null;return{style:t,width:n,color:o}}function RC(e,t){const n=Np(e),r=t.style==="none"?{style:"none",width:null,color:null}:{style:t.style,width:t.width?tr(t.width):null,color:t.color};return jp(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=je(r.width):e.style.removeProperty("border-width"),r.color?e.style.borderColor=r.color:e.style.removeProperty("border-color"),!0)}function Lp(e){const t=e.style.borderRadius.trim();if(!t)return null;const n=t.split(/\s+/)[0];return ft(n)}function DC(e,t){const n=t?tr(t):null,r=Lp(e);return Ft(r,n)?!1:(n?e.style.borderRadius=je(n):e.style.removeProperty("border-radius"),!0)}function Bp(e){return PC(e.style.boxShadow)}function IC(e,t){const n=Bp(e),r=t?{...t,blur:tr(t.blur)}:null;return Ep(n,r)?!1:(r?e.style.boxShadow=SC(r):e.style.removeProperty("box-shadow"),!0)}function Fp(e){return wC(e.style.lineHeight)}function jC(e,t){const n=Fp(e);return Ip(n,t)?!1:(t?e.style.lineHeight=xC(t):e.style.removeProperty("line-height"),!0)}function Hp(e){const t=e.style.backgroundColor;return t?Ke(t):null}function EC(e,t){const n=t?Ke(t):null;return Hp(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function zp(e){return CC(e.style.opacity)}function MC(e,t){const n=zp(e),r=t===null?null:qn(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=_p(r),!0)}function po(e){const t=mC(e);return{margin:$m(e,"margin"),padding:$m(e,"padding"),lineHeight:Fp(e),border:Np(e),borderRadius:Lp(e),boxShadow:Bp(e),backgroundColor:Hp(e),opacity:zp(e),breakInside:t.breakInside,breakAfter:t.breakAfter,breakBefore:t.breakBefore}}function go(e,t){let n=!1;return!t.marginMixed&&Um(e,"margin",t.margin,!1)&&(n=!0),!t.paddingMixed&&Um(e,"padding",t.padding,!0)&&(n=!0),!t.lineHeightMixed&&jC(e,t.lineHeight)&&(n=!0),!t.borderMixed&&RC(e,t.border)&&(n=!0),!t.radiusMixed&&DC(e,t.borderRadius)&&(n=!0),!t.shadowMixed&&IC(e,t.boxShadow)&&(n=!0),!t.backgroundMixed&&EC(e,t.backgroundColor)&&(n=!0),!t.opacityMixed&&MC(e,t.opacity)&&(n=!0),!t.breakInsideMixed&&fC(e,t.breakInside)&&(n=!0),!t.breakAfterMixed&&pC(e,t.breakAfter)&&(n=!0),!t.breakBeforeMixed&&gC(e,t.breakBefore)&&(n=!0),n&&xt(e),n}function _C(e){const t=Dr(),n=In(e);if(n.length===0)return t;const r=n.map(po),o=r[0];return{margin:o.margin,marginMixed:r.some(a=>!Rn(a.margin,o.margin)),padding:o.padding,paddingMixed:r.some(a=>!Rn(a.padding,o.padding)),lineHeight:o.lineHeight,lineHeightMixed:r.some(a=>!Ip(a.lineHeight,o.lineHeight)),border:o.border,borderMixed:r.some(a=>!jp(a.border,o.border)),borderRadius:o.borderRadius,radiusMixed:r.some(a=>!Ft(a.borderRadius,o.borderRadius)),boxShadow:o.boxShadow,shadowMixed:r.some(a=>!Ep(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=>!hC(a.breakInside,o.breakInside)),breakAfter:o.breakAfter,breakAfterMixed:r.some(a=>!Om(a.breakAfter,o.breakAfter)),breakBefore:o.breakBefore,breakBeforeMixed:r.some(a=>!Om(a.breakBefore,o.breakBefore))}}function NC(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;let r=!1;for(const o of n)go(o,t)&&(r=!0);return r})}const ri=96,LC=25.4,bu=ri/LC,Op=bu*10,Kp=72,BC=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(in|cm|mm|pt|px|em|rem|%)$/i;function $p(e){const t=e.trim();if(!t)return null;if(/^[+-]?0(?:\.0+)?$/.test(t))return{value:0,unit:"px"};const n=t.match(BC);if(!n)return null;const r=Number(n[1]);return Number.isFinite(r)?{value:nt(r),unit:n[2].toLowerCase()}:null}function oi(e,t){switch(t){case"in":return e/ri;case"cm":return e/Op;case"mm":return e/bu;case"pt":return e/ri*Kp;case"px":default:return e}}function ii(e,t){switch(t){case"in":return e*ri;case"cm":return e*Op;case"mm":return e*bu;case"pt":return e/Kp*ri;case"em":case"rem":return e*16;case"px":default:return e}}function On(e,t=0){if(!e)return t;const n=typeof e=="string"?$p(e):e;return!n||!Number.isFinite(n.value)?t:ii(n.value,n.unit)}function Zl(e,t="in"){const n=oi(e,t);return{value:Math.round(n*1e3)/1e3,unit:t}}function Wo(e){const t=oi(e,"pt");return{value:Math.round(t*1e3)/1e3,unit:"pt"}}function Up(e,t="in"){const n=oi(e,t),r=t==="in"?2:t==="cm"?1:0;return`${n.toFixed(r)} ${t}`}function yr(e,t="in",n=!1,r=0){if(n)return e;const o=e-r,s=ii(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 Vp(e,t,n="in"){const r=[];if(e<=0)return r;const o=n==="in",a=o?.125:.1;if(ii(a,n)<=0)return r;const u=-oi(t,n),d=oi(e-t,n),f=Math.floor(u/a),g=Math.ceil(d/a);for(let h=f;h<=g;h++){const y=h*a,b=t+ii(y,n);if(b<0||b>e)continue;const C=Math.round(y),x=Math.abs(y-C)<.001,v=o?Math.abs(y-(Math.floor(y)+.5))<.001:!1,k=o?Math.abs(y-(Math.floor(y)+.25))<.001||Math.abs(y-(Math.floor(y)+.75))<.001:!1;let S=4;x?S=10:v?S=7:k&&(S=5);const A={positionPx:Math.round(b),unitValue:y,major:x,height:S};x&&y>=0&&(A.label=String(Math.abs(C))),r.push(A)}return r}function Wp(e){const t=ft(e);if(t)return t;const n=$p(e);return n&&(n.unit==="in"||n.unit==="cm"||n.unit==="mm")?Wo(ii(n.value,n.unit)):null}const Oa="data-page-at-rule";function Kn(){return{sizePreset:"auto",customWidth:null,customHeight:null,orientation:null,margin:{...Yt},marginMixed:!1}}function yu(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Gp(e){return e.body.innerHTML.replace(/\s*data-page=""/g," data-page")}function ai(e){var r;const n=yu(e).querySelector(`style[${Oa}]`);return((r=n==null?void 0:n.textContent)==null?void 0:r.trim())??null}function Sa(e,t){const n=new RegExp(`margin-${t}\\s*:\\s*([^;]+)`,"i"),r=e.match(n);return r?Wp(r[1].trim()):null}function FC(e){const t=e.match(/(?:^|[\s{;])margin\s*:\s*([^;]+)/i);if(!t)return{...Yt};const n=t[1].trim().split(/\s+/).map(u=>Wp(u)),[r,o=r,a=r,s=o]=n;return{top:r??null,right:o??null,bottom:a??null,left:s??null}}function HC(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 f=ft(d[0]),g=ft(d[1]);if(f&&g)return{sizePreset:"custom",customWidth:f,customHeight:g,orientation:s}}return!u&&s?{sizePreset:"auto",customWidth:null,customHeight:null,orientation:s}:t}function zC(e){const t=Kn();if(!e)return t;const n=e.match(/@page\s*\{([^}]*)\}/is);if(!n)return t;const r=n[1],o=HC(r),a={top:Sa(r,"top"),right:Sa(r,"right"),bottom:Sa(r,"bottom"),left:Sa(r,"left")},u=rt.some(d=>a[d]!==null)?a:FC(r);return{...o,margin:u,marginMixed:!1}}function tt(e){return zC(ai(e))}function cn(e,t){return ai(e)||!ai(t)?e:Ka(e,tt(t))}function OC(e){const t=rt.map(r=>e[r]);if(t.every(r=>r===null))return null;const n=t.map(r=>r?je(r):"0");return n[0]===n[1]&&n[1]===n[2]&&n[2]===n[3]?`margin: ${n[0]};`:rt.map(r=>e[r]?`margin-${r}: ${je(e[r])};`:null).filter(Boolean).join(" ")}function KC(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(je(e.customWidth),je(e.customHeight)),e.orientation&&t.push(e.orientation),t.length===0?null:`size: ${t.join(" ")};`}function $C(e){const t=KC(e),n=OC(e.margin);return!t&&!n?null:`@page { ${[t,n].filter(Boolean).join(" ")} }`}function dn(e){const t=yu(e);for(const n of t.querySelectorAll(`style[${Oa}]`))n.remove();return Gp(t)}function UC(e,t){const n=yu(e);let r=n.querySelector(`style[${Oa}]`);return r||(r=n.createElement("style"),r.setAttribute(Oa,""),n.body.insertBefore(r,n.body.firstChild)),r.textContent=t,Gp(n)}function Ka(e,t){const n=$C(t);return n?UC(e,n):Zp(e)}function Zp(e){return dn(e)}function qp(e){const t=e.map(n=>ai(n)).filter(n=>!!n);return t.length===0?"":t.join(`
|
|
140
|
+
`)}const xu="data-page-sized",Cc={top:"--wysiwyg-page-margin-top",right:"--wysiwyg-page-margin-right",bottom:"--wysiwyg-page-margin-bottom",left:"--wysiwyg-page-margin-left"},VC="0.75rem",wc=["top","right","bottom","left"],ql={A4:{width:"210mm",height:"297mm"},letter:{width:"8.5in",height:"11in"},legal:{width:"8.5in",height:"14in"}};function ho(e,t=!1){let n=null;return e.sizePreset==="A4"||e.sizePreset==="letter"||e.sizePreset==="legal"?n={...ql[e.sizePreset]}:e.sizePreset==="custom"&&e.customWidth&&e.customHeight?n={width:je(e.customWidth),height:je(e.customHeight)}:e.orientation?n=t?{...ql.letter}:null:n=t?{...ql.letter}:null,n?e.orientation==="landscape"?{width:n.height,height:n.width}:n:null}function Yp(e){return ho(e,!1)!==null}function WC(e){const t=ho(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=fi(e);for(const a of rt){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 fi(e){return GC(e.margin)}function GC(e){return{top:e.top?je(e.top):null,right:e.right?je(e.right):null,bottom:e.bottom?je(e.bottom):null,left:e.left?je(e.left):null}}const ZC=["width","min-height","padding-top","padding-right","padding-bottom","padding-left"];function Xp(e){for(const t of wc)e.style.removeProperty(Cc[t])}function qC(e){const t=e.querySelector("[data-page-bg]");if(!(t instanceof HTMLElement))return!1;const n=t.style.backgroundImage.trim();if(n&&n!=="none")return!0;const r=t.getAttribute("style")??"";return/background-image\s*:\s*(?!none\b)/i.test(r)}function YC(e,t){if(!qC(e)){Xp(e);return}const n=tt(t);if(ho(n)){const o=fi(n);for(const a of wc){const s=o[a]??"0px";e.style.setProperty(Cc[a],s)}return}for(const o of wc)e.style.setProperty(Cc[o],VC)}function XC(e){e.removeAttribute(xu);for(const t of ZC)e.style.removeProperty(t);Xp(e)}function Jp(e,t){const n=tt(e),r={...n.margin};return t.left!==void 0&&(r.left=Wo(t.left)),t.right!==void 0&&(r.right=Wo(t.right)),t.top!==void 0&&(r.top=Wo(t.top)),t.bottom!==void 0&&(r.bottom=Wo(t.bottom)),Ka(e,{...n,margin:r})}function JC(e,t,n){bo(e,Jp(t,n))}function bo(e,t){const n=tt(t),r=ho(n);if(!r){XC(e);return}e.setAttribute(xu,""),e.style.width=r.width,e.style.minHeight=r.height;const o=fi(n);for(const a of rt){const s=`padding-${a}`,u=o[a];u?e.style.setProperty(s,u):e.style.removeProperty(s)}YC(e,t)}const Sr="data-page",so="data-page-bg",$a="commspliant-background";function kt(e){return e instanceof HTMLElement&&(e.id===$a||e.hasAttribute(so))}function QC(e){return e.hasAttribute(Sr)&&e.parentElement?e.parentElement:e}function Cu(e){const t=QC(e),n=new Set,r=[],o=a=>{a instanceof HTMLElement&&kt(a)&&!n.has(a)&&(n.add(a),r.push(a))};o(t.querySelector(`#${$a}`));for(const a of t.querySelectorAll(`[${so}]`))o(a);return o(t),r}function wu(e){return Cu(e)[0]??null}function Xo(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 Qp(e,t){if(!e.hasAttribute(xu))return Xo(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),n}const ew=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","div"]);function eg(e){return ew.has(e.tagName.toLowerCase())}function gs(e){const t=e.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li");return t[t.length-1]??null}function tg(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t))&&t instanceof HTMLElement&&eg(t))return t;return null}function ng(e){const t=tg(e)??gs(e);if(t)return t;const n=e.ownerDocument.createElement("p");return n.appendChild(e.ownerDocument.createElement("br")),e.appendChild(n),n}function hs(e){let t=!1;for(const n of[...e.childNodes]){if(n instanceof HTMLElement&&kt(n)||n.nodeType!==Node.TEXT_NODE)continue;if(!(n.textContent??"").trim()){n.remove(),t=!0;continue}(gs(e)??ng(e)).appendChild(n),t=!0}return t}function bs(e){const t=ct(e);if(!t)return!1;let n=!1;for(const r of[...e.childNodes])r!==t&&r instanceof HTMLElement&&kt(r)&&(t.insertBefore(r,t.firstChild),n=!0);return n}function si(e){const t=ct(e);if(!t)return{changed:!1,absorbedBlocks:[]};let n=bs(e);const r=[];for(const o of[...e.childNodes])if(o!==t&&!(o instanceof HTMLElement&&kt(o))){if(o.nodeType===Node.TEXT_NODE){if(!(o.textContent??"").trim()){o.remove(),n=!0;continue}let s=gs(t);s||(s=document.createElement("p"),t.appendChild(s)),s.appendChild(o),n=!0;continue}o instanceof HTMLElement&&eg(o)&&r.push(o),t.appendChild(o),n=!0}return hs(t)&&(n=!0),{changed:n,absorbedBlocks:r}}function tw(e){const t=document.createRange(),n=e.firstChild;(n==null?void 0:n.nodeType)===Node.TEXT_NODE?t.setStart(n,0):n?t.setStartBefore(n):t.setStart(e,0),t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}const nw="p, h1, h2, h3, h4, h5, h6, li, blockquote, pre";function rg(e,t){if(t<=0)return;const n=ct(e);if(!n)return;const r=n.querySelectorAll(nw);if(r.length===0)return;const o=r[r.length-1],a=window.getSelection();if(!a||a.rangeCount===0)return;const s=a.getRangeAt(0).startContainer;o.contains(s)||tw(o)}function og(e,t){return e instanceof HTMLElement&&e!==t&&e.parentElement===t&&e.hasAttribute(Sr)}function ig(e){return[...e.children].filter(t=>t instanceof HTMLElement)}function rw(e){return[...e.childNodes].some(t=>t.nodeType===Node.TEXT_NODE&&(t.textContent??"").trim()!=="")}function ct(e){return ig(e).find(n=>n.hasAttribute(Sr))??null}function ow(e){if(rw(e))return null;const t=ig(e);if(t.length!==1)return null;const n=t[0];return n.tagName.toLowerCase()!=="div"||kt(n)?null:n}function vu(e){const t=ct(e);if(t)return Xo(t),t;const n=ow(e);if(n)return n.setAttribute(Sr,""),Xo(n),n;const r=document.createElement("div");for(r.setAttribute(Sr,"");e.firstChild;)r.appendChild(e.firstChild);return e.appendChild(r),Xo(r),r}function ku(e){return ct(e)??e}function iw(e,t,n){const{startContainer:r}=n;return r===t||t.contains(r)?!1:r===e?!0:e.contains(r)}function aw(e,t){const{startContainer:n}=t;return n===e||n.nodeType===Node.TEXT_NODE&&n.parentElement===e}function sw(e){var o;const t=document.createRange(),n=e.lastChild;(n==null?void 0:n.nodeType)===Node.TEXT_NODE?t.setStart(n,((o=n.textContent)==null?void 0:o.length)??0):n?t.setStartAfter(n):t.setStart(e,0),t.collapse(!0);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}function vc(e){hs(e);const t=gs(e)??tg(e)??ng(e);sw(t)}function lw(e){const t=ct(e);e.focus(),t&&vc(t)}function lo(e){const t=ct(e);if(!t)return;hs(t);const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0);if(aw(t,r)){vc(t);return}iw(e,t,r)&&vc(t)}const cw=["background-image","background-size","background-position","background-repeat","opacity"];function uw(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 ys(e){const t=ct(e);uw(e,t,"background-color");for(const n of cw)e.style.removeProperty(n)}const Ua="<!-- wysiwyg-page-separator -->",Pr="data-page-surface";function Un(e){const t=e.trim();return t?t.includes(Ua)?e.split(Ua).map(n=>n.trim()):[e]:[""]}function jt(e){return e.length===0?"":e.length===1?e[0]??"":e.join(`
|
|
141
|
+
${Ua}
|
|
142
|
+
`)}function zn(){return"<p></p>"}function $n(e){return e.length===0?[zn()]:e.map(t=>t.trim())}function Yl(e,t){if(e.length===t.length){let a=!1;const s=[],u=[];for(let d=0;d<t.length;d+=1){const f=t[d]??"";e[d]===f?s.push(e[d]):(s.push(f),a=!0,u.push(d))}return a?{pages:s,changed:!0,changedIndices:u}:{pages:e,changed:!1,changedIndices:[]}}const n=[],r=[];for(let a=0;a<t.length;a+=1){const s=t[a]??"";a<e.length&&e[a]===s?n.push(e[a]):(n.push(s),r.push(a))}return r.length>0||e.length!==t.length||!xr(e,n)?{pages:n,changed:!0,changedIndices:r}:{pages:e,changed:!1,changedIndices:[]}}function xr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function kc(e,t,n){if(t<0||t>=e.length)return{pages:[...e],changed:!1};if(e[t]===n)return{pages:e,changed:!1};const r=e.slice();return r[t]=n,{pages:r,changed:!0}}function Ye(e,t){const n=e.querySelector(`[${Pr}][data-page-index="${t}"]`);return n||([...e.querySelectorAll(`[${Pr}]`)][t]??null)}function dw(e){if(!e)return null;const t=e instanceof Element?e:e.parentElement;return(t==null?void 0:t.closest(`[${Pr}]`))??null}function Vm(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(`[${Pr}]`)].indexOf(e);if(o!==-1)return o;n=n.parentElement}return null}const It="data-wysiwyg-img-id",Sc="data-page-bg",mw=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Pc=/background-image:\s*url\(\s*(["']?)(.+?)\1\s*\)/i;function Wm(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Gm(e){return e.body.innerHTML}function Xl(e){return mw.test(e.trim())}function Zm(e){return e.includes("<img")||e.includes("IMG")||e.includes(Sc)||e.includes(It)}function fw(e){var r;const t=Pc.exec(e);return t&&(((r=t[2])==null?void 0:r.trim())??"")||null}function Pa(e,t){const r=`url("${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`;if(Pc.test(e))return e.replace(Pc,`background-image: ${r}`);const o=e.trim().replace(/;+$/,"");return o?`${o};background-image: ${r}`:`background-image: ${r}`}function pw(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`img-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function gw(){const e=new Map;function t(b,C){const x=e.get(b);if(x){if(x.dataUrl!==C){URL.revokeObjectURL(x.objectUrl);const k=URL.createObjectURL(qm(C));return e.set(b,{dataUrl:C,objectUrl:k}),k}return x.objectUrl}const v=URL.createObjectURL(qm(C));return e.set(b,{dataUrl:C,objectUrl:v}),v}function n(b,C){if(!(C!=null&&C.trim())){for(const[v,k]of e)if(k.dataUrl===b)return v}const x=(C==null?void 0:C.trim())||pw();return t(x,b),x}function r(b){var C;return((C=e.get(b))==null?void 0:C.dataUrl)??null}function o(b){var C;return((C=e.get(b))==null?void 0:C.objectUrl)??null}function a(b){return e.has(b)}function s(b){const C=b.trim();if(!C)return null;for(const[x,v]of e)if(v.objectUrl===C)return x;return null}function u(b,C){const x=b.trim();if(!x)return null;if(Xl(x))return x;const v=(C==null?void 0:C.trim())||s(x);return v?r(v):null}function d(b,C){var x,v;for(const k of b.querySelectorAll("img")){const S=(x=k.getAttribute(It))==null?void 0:x.trim(),A=((v=k.getAttribute("src"))==null?void 0:v.trim())??"";if(C==="hydrate"){const P=u(A,S);if(!P)continue;k.setAttribute("src",P);continue}if(S&&a(S)){const P=o(S);P&&k.setAttribute("src",P);continue}const T=s(A);if(T){k.setAttribute(It,T);const P=o(T);P&&k.setAttribute("src",P);continue}if(!Xl(A))continue;const D=n(A);k.setAttribute(It,D);const R=o(D);R&&k.setAttribute("src",R)}}function f(b,C){var x;for(const v of b.querySelectorAll(`[${Sc}]`)){if(!(v instanceof HTMLElement))continue;const k=(x=v.getAttribute(It))==null?void 0:x.trim(),S=v.getAttribute("style")??"",A=fw(S);if(C==="hydrate"){if(!A)continue;const P=u(A,k);if(!P)continue;v.setAttribute("style",Pa(S,P));continue}if(!A)continue;if(k&&a(k)){const P=o(k);P&&v.setAttribute("style",Pa(S,P));continue}const T=s(A);if(T){v.setAttribute(It,T);const P=o(T);P&&v.setAttribute("style",Pa(S,P));continue}if(!Xl(A))continue;const D=n(A);v.setAttribute(It,D);const R=o(D);R&&v.setAttribute("style",Pa(S,R))}}function g(b){const C=b.trim();if(!C||!Zm(C))return b;const x=Wm(b);return d(x,"externalize"),f(x,"externalize"),Gm(x)}function h(b){const C=b.trim();if(!C||!Zm(C))return b;const x=Wm(b);f(x,"hydrate"),d(x,"hydrate");for(const v of x.querySelectorAll("img"))v.removeAttribute(It);for(const v of x.querySelectorAll(`[${Sc}]`))v.removeAttribute(It);return Gm(x)}function y(){for(const b of e.values())URL.revokeObjectURL(b.objectUrl);e.clear()}return{register:n,getDataUrl:r,getObjectUrl:o,has:a,externalizeHtml:g,hydrateHtml:h,clear:y}}function qm(e){const t=e.indexOf(",");if(t<0)return new Blob;const n=e.slice(0,t),r=e.slice(t+1),o=/^data:([^;,]+)/i.exec(n),a=(o==null?void 0:o[1])??"application/octet-stream",s=atob(r),u=new Uint8Array(s.length);for(let d=0;d<s.length;d+=1)u[d]=s.charCodeAt(d);return new Blob([u],{type:a})}const hw=.85,bw=new Set(["image/webp","image/avif","image/gif"]);let Oo=null;function yw(){if(Oo!==null)return Oo;Oo=!1;try{Oo=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp")}catch{}return Oo}function xw(e){const t=e.type.trim().toLowerCase();if(t&&bw.has(t))return!1;const n=vw(e.name);return!(!t&&(n==="webp"||n==="avif"||n==="gif"))}function Cw(e,t=hw){return typeof createImageBitmap!="function"?Promise.resolve(null):createImageBitmap(e).then(n=>ww(n,t)).catch(()=>null)}function ww(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 vw(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const ag=2*1024*1024,kw="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"]),Pw=new Set(["jpg","jpeg","png","gif","webp","bmp","avif"]),sg=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i,Aw=/^(javascript|vbscript|file|blob):/i;function Tw(e={}){return{src:"",alt:"",title:"",...e}}function pn(e){const t=e.trim();if(!t)return"empty";if(Aw.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return sg.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 Rw(e){return e.size>ag?"tooLarge":Lw(e)?null:"type"}function Dw(e){const t=Rw(e);return t?Promise.reject(new Error(t)):Iw(e)}async function Iw(e){if(xw(e)&&yw()){const t=await Cw(e);if(t&&pn(t)===null&&Ew(t)<=ag)return t}return jw(e)}function jw(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=String(r.result??"");if(pn(o)){n(new Error("invalid"));return}t(o)},r.onerror=()=>n(r.error??new Error("Failed to read file")),r.readAsDataURL(e)})}function Ew(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 Mw(e,t,n){const r=lg(t,n);e.setAttribute("src",r.src.trim()),r.registryId?e.setAttribute(It,r.registryId):e.removeAttribute(It);const o=t.alt.trim(),a=t.title.trim();o?e.setAttribute("alt",o):e.removeAttribute("alt"),a?e.setAttribute("title",a):e.removeAttribute("title"),e.style.maxWidth="100%",e.style.height="auto",_w(e,t.css)}function _w(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){if(!t)return e;const n=e.src.trim();if(pn(n)||!sg.test(n))return e;const r=t.register(n),o=t.getObjectUrl(r);return o?{...e,src:o,registryId:r}:e}function Nw(e,t,n){const r=Tw(t),o=n?lg(r,n):r;if(o.registryId){const d=n==null?void 0:n.getDataUrl(o.registryId);if(!d||pn(d))return!1}else if(pn(o.src))return!1;const a=window.getSelection();if(!a||a.rangeCount===0)return!1;const s=a.getRangeAt(0);if(!Se(e,s.commonAncestorContainer))return!1;s.collapsed||s.deleteContents();const u=document.createElement("img");return Mw(u,o,n),s.insertNode(u),s.setStartAfter(u),s.collapse(!0),a.removeAllRanges(),a.addRange(s),!0}function Ac(e,t){let n=t;for(;n&&n!==e;){if(n instanceof HTMLImageElement)return n;n=n.parentNode}return null}function Jl(e,t){if(!Se(e,t)||t===e)return!1;const n=document.createRange();n.selectNode(t);const r=window.getSelection();return r?(r.removeAllRanges(),r.addRange(n),!0):!1}function Lw(e){const t=e.type.trim().toLowerCase();if(t&&Sw.has(t))return!0;const n=Bw(e.name);return!!(!t&&n&&Pw.has(n))}function Bw(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}const cg=["%","px","pt","pc","em","rem"],Fw="%",Hw={"%":[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]},co={"%":{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}},zw=new Set(cg),Ow=/^([+]?(?:\d+(?:\.\d+)?|\.\d+))\s*(pt|px|em|rem|%|pc)$/i;function Kw(e){return zw.has(e)}function Cr(e){return`${fe(e.value)}${e.unit}`}function Va(e){const t=e.trim();if(!t||t.toLowerCase()==="auto")return null;const n=t.match(Ow);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 Kw(o)?uo(r,o):null}function Ym(e,t){const n=e.trim();if(!n)return null;const r=Va(n);if(r)return r;const o=Number(n.replace(",","."));return Number.isFinite(o)?uo(o,t):null}function uo(e,t){if(!Number.isFinite(e)||e<=0)return null;const{min:n,max:r}=co[t];return{value:nt(Math.min(r,Math.max(n,e))),unit:t}}function Jo(e,t,n){const r=n>0?n:1;if(e==="width"){const a=uo(t.value/r,t.unit)??t;return{width:t,height:a}}return{width:uo(t.value*r,t.unit)??t,height:t}}const Ma="data-hover-css",Su=["fill","contain","cover","none","scale-down"],Pu=["center","top","bottom","left","right","top left","top right","bottom left","bottom right"],$w=new Set(Su),Uw=new Set(Pu),Xm="if(this._hp==null)this._hp=this.getAttribute('style')||'';this.setAttribute('style',(this._hp?this._hp+';':'')+(this.getAttribute('data-hover-css')||''))",Vw="if(this._hp!=null){this.setAttribute('style',this._hp);this._hp=null}",Ww=/^-?[a-z][a-z0-9-]*$/i,Gw=/expression\s*\(|javascript:|vbscript:|-moz-binding|\bbehavior\b/i,Tc=/rotate\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*deg\s*\)/i;function ug(e={}){return{sizeMode:"width",width:null,height:null,align:null,margin:{...Yt},border:{...hu},borderRadius:null,boxShadow:null,opacity:null,objectFit:null,objectPosition:null,rotateDeg:null,hoverCss:"",...e}}function Zw(e){const t=e.naturalWidth,n=e.naturalHeight;return t>0&&n>0?t/n:1}function qw(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=Jo("width",e.width,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}if(e.height){const r=Jo("height",e.height,t);return{...e,sizeMode:"lock",width:r.width,height:r.height}}return e}function Yw(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||Ww.test(a)&&(a==="behavior"||a.endsWith("binding")||Gw.test(s)||t.push(`${a}: ${s}`))}return t.join("; ")}function Vn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return null;if(n.startContainer instanceof HTMLImageElement)return n.startContainer;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const r=n.startContainer.childNodes[n.startOffset];if(r instanceof HTMLImageElement&&Se(e,r))return r}return Ac(e,n.commonAncestorContainer)}function Xw(e){const t=Vn(e);return t?dg(t):null}function dg(e){const t=po(e),n=n1(e),r=n==="center"?{...t.margin,left:null,right:null}:t.margin,o=Qw(e);return ug({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:fg(e),objectPosition:a1(e),rotateDeg:pg(e),hoverCss:e.getAttribute(Ma)??""})}function mg(e,t){let n=!1;return e1(e,t)&&(n=!0),go(e,{...Dr(),margin:t.align==="center"?{...t.margin,left:null,right:null}:t.margin,marginMixed:!1,padding:Yt,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),r1(e,t.align)&&(n=!0),o1(e,t.objectFit)&&(n=!0),i1(e,t.objectPosition)&&(n=!0),l1(e,t.rotateDeg)&&(n=!0),c1(e,t.hoverCss)&&(n=!0),n}function Jw(e,t){const n=Vn(e);return n?mg(n,t):!1}function Qw(e){const t=Va(e.style.width),n=Va(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 e1(e,t){const n={width:e.style.width,height:e.style.height,maxWidth:e.style.maxWidth},r=t1(t);return r.width?e.style.width=Cr(r.width):e.style.removeProperty("width"),r.height?e.style.height=Cr(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 t1(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 n1(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 r1(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 fg(e){const t=e.style.objectFit.trim().toLowerCase();return $w.has(t)?t:null}function o1(e,t){return fg(e)===t?!1:(t?e.style.objectFit=t:e.style.removeProperty("object-fit"),!0)}function i1(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 a1(e){const t=e.style.objectPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(Uw.has(t),t):null}function pg(e){const t=Tc.exec(e.style.transform);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?nt(n):null}function s1(e){const t=e.trim();return t?Tc.test(t)&&t.replace(Tc,"").trim()==="":!0}function l1(e,t){const n=pg(e),r=t===null||t===0?null:nt(t);return n===r?!1:r===null?s1(e.style.transform)?(e.style.removeProperty("transform"),!0):!1:(e.style.transform=`rotate(${fe(r)}deg)`,!0)}function c1(e,t){const n=Yw(t),r=e.getAttribute(Ma)??"",o=e.getAttribute("onmouseover")??"";return r===n&&(n&&o===Xm||!n&&!o)?!1:n?(e.setAttribute(Ma,n),e.setAttribute("onmouseover",Xm),e.setAttribute("onmouseout",Vw),!0):(e.removeAttribute(Ma),e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),!0)}const ro={value:100,unit:"%"},u1=new Set(Su),d1=new Set(Pu),m1=new Set(["cover","contain","scale-down","none"]),Jm={contain:"contain",cover:"cover",auto:"none"},Qm={fill:"100% 100%",contain:"contain",cover:"cover",none:"auto","scale-down":"contain"};function mn(){return{src:null,opacity:null,fit:null,position:null,width:{...ro},height:null}}function gg(e){return e!=null&&m1.has(e)}function hg(e){const t=e.style.opacity.trim();if(!t)return null;const n=Number(t);return Number.isFinite(n)?qn(n):null}function ef(e,t){const n=hg(e),r=t===null?null:qn(t);return n===r?!1:(r===null?e.style.removeProperty("opacity"):e.style.opacity=_p(r),!0)}function bg(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 f1(e){return`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function tf(e,t){const n=bg(e),r=(t==null?void 0:t.trim())??"",o=r&&pn(r)===null?r:null;return n===o?!1:(o?e.style.backgroundImage=f1(o):e.style.removeProperty("background-image"),!0)}function Au(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Ql(e){return!e||e==="auto"?null:Va(e)}function p1(e){return gg(e.fit)&&e.fit?Qm[e.fit]:e.fit==="fill"?Qm.fill:e.width&&e.height?`${Cr(e.width)} ${Cr(e.height)}`:e.width?Cr(e.width):e.height?`auto ${Cr(e.height)}`:null}function g1(e){const t=Au(e.style.backgroundSize);if(!t)return{fit:null,width:null,height:null};if(t==="100% 100%")return{fit:"fill",width:{...ro},height:{...ro}};if(Jm[t])return{fit:Jm[t],width:null,height:null};if(u1.has(t))return{fit:t,width:null,height:null};const n=t.split(" ");return n.length===1?{fit:null,width:Ql(n[0]),height:null}:n.length===2?{fit:null,width:Ql(n[0]),height:Ql(n[1])}:{fit:null,width:null,height:null}}function h1(e,t){const n=Au(e.style.backgroundSize),r=p1(t);return n===(r??"")?!1:(r?e.style.backgroundSize=r:e.style.removeProperty("background-size"),!0)}function b1(e){const t=e.style.backgroundPosition.trim().toLowerCase().replace(/\s+/g," ");return t?(d1.has(t),t):null}function nf(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 Wa(e){let t=!1;return e.id!==$a&&(e.id=$a,t=!0),e.hasAttribute(so)||(e.setAttribute(so,""),t=!0),e.getAttribute("contenteditable")!=="false"&&(e.setAttribute("contenteditable","false"),t=!0),t}function Ga(e){const t=e.getAttribute("style");e.style.position="absolute",e.style.inset="0",e.style.zIndex="0",e.style.pointerEvents="none",e.style.userSelect="none",e.style.backgroundRepeat="no-repeat",e.style.setProperty("print-color-adjust","exact");const n=e.style.cssText;return n.includes("-webkit-print-color-adjust")||e.setAttribute("style",`${n};-webkit-print-color-adjust:exact`),e.getAttribute("style")!==t}function yg(e){const t=Cu(e),n=t[0]??null;if(n){let o=Wa(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 Wa(r),Ga(r),e.insertBefore(r,e.firstChild),{layer:r,changed:!0}}function y1(e){const t=Cu(e);if(t.length===0)return!1;for(const n of t)n.remove();return!0}function Za(e){let t=!1;return wu(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 Tu(e){if(!wu(e))return Za(e);const n=yg(e);let r=n.changed;return Wa(n.layer)&&(r=!0),Ga(n.layer)&&(r=!0),Za(e)&&(r=!0),r}function xs(e){const t=ct(e);if(!t)return!1;let n=bs(e);return Tu(t)&&(n=!0),n}function x1(e){return e.includes(so)||e.includes(Sr)}function C1(e){const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");bs(t.body);const n=ct(t.body);return n&&(Tu(n),hs(n)),t.body.innerHTML}function rf(e){return x1(e)?C1(e):e}function xg(e){const t=g1(e);return{src:bg(e),opacity:hg(e),fit:t.fit,position:b1(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&&pn(n)===null;let o=!1;return r?(tf(e,n)&&(o=!0),h1(e,t)&&(o=!0),nf(e,t.position)&&(o=!0),ef(e,t.opacity)&&(o=!0),e.style.backgroundRepeat!=="no-repeat"&&(e.style.backgroundRepeat="no-repeat",o=!0),o&&xt(e),o):(tf(e,null)&&(o=!0),Au(e.style.backgroundSize)&&(e.style.removeProperty("background-size"),o=!0),nf(e,null)&&(o=!0),ef(e,null)&&(o=!0),e.style.backgroundRepeat&&(e.style.removeProperty("background-repeat"),o=!0),o&&xt(e),o)}function w1(e){const t=wu(e);return t?xg(t):mn()}function v1(e,t){var u;const n=((u=t.src)==null?void 0:u.trim())??"";if(!(n.length>0&&pn(n)===null)){const d=y1(e),f=Za(e);return(d||f)&&xt(e),d||f}const o=yg(e),a=o.layer;let s=o.changed;return Wa(a)&&(s=!0),Ga(a)&&(s=!0),Za(e)&&(s=!0),Cg(a,t)&&(s=!0),Ga(a)&&(s=!0),s&&(xt(a),xt(e)),s}function k1(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function S1(e){const t=e.style.backgroundImage.trim();if(t&&t!=="none")return!0;const n=e.getAttribute("style")??"";return/background-image\s*:\s*(?!none\b)/i.test(n)}function of(e){const t=e.trim().match(/^([\d.]+)pt$/i);return t?Number.parseFloat(t[1]):null}function P1(e,t){if(!t)return e;if(!e)return t;const n=of(e),r=of(t);return n!==null&&r!==null?`${Math.max(n,r)}pt`:t}function A1(e,t){const n=tt(t),r=fi(n);e.style.boxSizing="border-box",e.style.position!=="relative"&&(e.style.position="relative"),e.style.isolation!=="isolate"&&(e.style.isolation="isolate");const o=ho(n);o?(e.style.width=o.width,e.style.minHeight=o.height):(e.style.width||(e.style.width="100%"),e.style.minHeight="100vh"),e.style.height="auto";for(const a of rt){const s=`padding-${a}`,u=r[a],d=e.style.getPropertyValue(s).trim()||null,f=P1(d,u);f&&e.style.setProperty(s,f)}}function Ru(e){const t=k1(e);let n=!1;bs(t.body);for(const r of t.querySelectorAll(`[${Sr}]`)){if(!(r instanceof HTMLElement))continue;const o=r.querySelector(`[${so}]`);!(o instanceof HTMLElement)||!S1(o)||(n=!0,A1(r,e),Tu(r))}return{html:t.body.innerHTML,hasBleed:n}}const af=`
|
|
143
143
|
@page {
|
|
144
144
|
margin: 0;
|
|
145
145
|
}
|
|
@@ -289,7 +289,7 @@ body:has(> [data-page-bg]) > [data-page] {
|
|
|
289
289
|
border-top: 0 !important;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
`.trim(),
|
|
292
|
+
`.trim(),T1=`
|
|
293
293
|
body:has([data-page-bg]) {
|
|
294
294
|
padding: 0;
|
|
295
295
|
}
|
|
@@ -310,12 +310,12 @@ body:has([data-page-bg]) {
|
|
|
310
310
|
box-sizing: border-box;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
-
`.trim();function wg(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function
|
|
314
|
-
`),y=Array.from(new Set(a)).map(b=>`<link rel="stylesheet" href="${
|
|
313
|
+
`.trim();function wg(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function R1(e){return wg(e).replace(/'/g,"'")}function vg(e){const t=e.trim();if(!/^<!DOCTYPE/i.test(t)&&!/^<html[\s>]/i.test(t))return e;const n=new DOMParser().parseFromString(t,"text/html"),r=[];for(const o of n.body.childNodes)if(o.nodeType===Node.ELEMENT_NODE)r.push(o.outerHTML);else if(o.nodeType===Node.TEXT_NODE){const a=o.textContent??"";a.trim()&&r.push(a)}return r.join("")||n.body.innerHTML}function D1(e,t="Document"){const n=Un(e),r=n.map(b=>Ru(b)),o=r.some(b=>b.hasBleed),a=[],s=[];for(const b of r){const C=he(b.html);a.push(...C.hrefs),s.push(C.body)}const u=s.length<=1?s[0]??"":s.map((b,C)=>`<div data-wysiwyg-print-page="" style="${C===s.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;"}">${b}</div>`).join(""),d=qp(n),f=o?"@page { margin: 0 !important; }":"",g=kg(o),h=[d,f,g].filter(Boolean).join(`
|
|
314
|
+
`),y=Array.from(new Set(a)).map(b=>`<link rel="stylesheet" href="${R1(b)}" />`).join(`
|
|
315
315
|
`);return["<!DOCTYPE html>",'<html lang="en">',"<head>",'<meta charset="utf-8">',`<title>${wg(t)}</title>`,`<style>${h}</style>`,y,"</head>","<body>",u,"</body>","</html>"].filter(Boolean).join(`
|
|
316
316
|
`)}function kg(e){return e?`${af}
|
|
317
|
-
${A1}`:af}function Tc(e,t,n=""){const r=Ru(t),{hrefs:o,body:a}=he(r.html),s=e.createElement("meta");s.setAttribute("charset","utf-8");const u=e.createElement("title");u.textContent=n;const d=e.createElement("style");d.textContent=kg(r.hasBleed);const f=o.map(g=>{const h=e.createElement("link");return h.rel="stylesheet",h.href=g,h});e.head.replaceChildren(s,u,d,...f),e.title=n,e.body.innerHTML=a}function Du(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 D1(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function Pa(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 I1(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 j1(e){return e?I1(e).find(D1)??null:null}const Sg={description:"HTML",accept:{"text/html":[".html",".htm"]}},E1="document.html";function Pg(){return window}function Ag(e){return e instanceof DOMException&&e.name==="AbortError"}function M1(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 _1(){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}Du(r).then(a=>n(vg(a)),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function N1(e,t=E1){const n=Pg().showSaveFilePicker;if(typeof n=="function"){try{const o=await(await n({suggestedName:t,types:[Sg]})).createWritable();await o.write(e),await o.close()}catch(r){if(Ag(r))return;throw r}return}M1(e,t)}async function L1(){const e=Pg().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[Sg]}),n=await t.getFile();return vg(await Du(n))}catch(t){if(Ag(t))return null;throw t}return _1()}const B1=1e3;function F1(e){var t;return e.complete&&e.naturalWidth>0?Promise.resolve((t=e.decode)==null?void 0:t.call(e)).catch(()=>{}):new Promise(n=>{const r=()=>{var o;Promise.resolve((o=e.decode)==null?void 0:o.call(e)).catch(()=>{}).then(()=>n())};e.addEventListener("load",r,{once:!0}),e.addEventListener("error",r,{once:!0})})}function H1(e){const t=[...e.images];return t.length===0?Promise.resolve():Promise.all(t.map(F1)).then(()=>{})}function Tg(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.width="1px",e.style.height="1px",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}}async function Rg(e,t,n,r){Tc(e,r);let o=!1;const a=()=>{o||(o=!0,n.remove())};t.addEventListener("afterprint",a),await H1(e),t.focus(),t.print(),window.setTimeout(a,B1)}function z1(e){const t=Tg();t&&Rg(t.doc,t.win,t.iframe,e)}function O1(e){const t=Tg();if(!t)return;const n=e.map(Ru),r=n.some(g=>g.hasBleed),o=[],a=[];for(const g of n){const h=he(g.html);o.push(...h.hrefs),a.push(h.body)}const s=a.map((g,h)=>`<div data-wysiwyg-print-page="" style="${h===a.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;"}">${g}</div>`).join(""),u=qp(e),d=r?"@page { margin: 0 !important; }":"",f=[u?`<style>${u}</style>`:"",d?`<style>${d}</style>`:"",...Array.from(new Set(o)).map(g=>`<link rel="stylesheet" href="${g}" />`),s].filter(Boolean).join("");Rg(t.doc,t.win,t.iframe,f)}function K1(e){return{save:async()=>{if(e.onSave){const t=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(t);return}await N1(R1(e.getHtml()))},open:async()=>{const t=e.onOpen?await e.onOpen():await L1();if(t!==null){if(Array.isArray(t)){e.setHtml(jt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(jt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){O1(Un(e.getHtml()));return}z1(e.getHtml())}}}function $1(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 U1(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 V1(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function W1(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function G1(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 Z1(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),hasSelectedPage:()=>e.hasSelectedPage(),canDeletePage:()=>e.canDeletePage(),canInsertPageBackgroundImage:()=>e.canInsertPageBackgroundImage(),canInsertParagraphBackgroundImage:()=>e.canInsertParagraphBackgroundImage()}}function q1(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 Y1(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}function X1(e){return{openHelp:()=>{e.openHelp()},openKeyboardShortcuts:()=>{e.openKeyboardShortcuts()},openAbout:()=>{e.openAbout()}}}const J1=[50,75,100,125,150,200],Q1=.1,ev=3;function Ql(e){return!Number.isFinite(e)||e<=0?1:Math.min(ev,Math.max(Q1,e))}function tv(e,t,n,r,o){if(e==="fitWidth")return r<=0?1:Ql(t/r);if(e==="fitPage"){if(r<=0||o<=0)return 1;const a=t/r,s=n/o;return Ql(Math.min(a,s))}return Ql(e/100)}function nv(e){let t=null;return{schedule(){t===null&&(t=window.requestAnimationFrame(()=>{t=null,e()}))},cancel(){t!==null&&(window.cancelAnimationFrame(t),t=null)}}}function Bn(e,t){return()=>{e.setPageZoom(t)}}function Fn(e,t){return()=>e.getPageZoom()===t}function rv(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:Bn(e,"fitWidth"),setPageZoomFitPage:Bn(e,"fitPage"),setPageZoom50:Bn(e,50),setPageZoom75:Bn(e,75),setPageZoom100:Bn(e,100),setPageZoom125:Bn(e,125),setPageZoom150:Bn(e,150),setPageZoom200:Bn(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function ov(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:Fn(e,"fitWidth"),isPageZoomFitPage:Fn(e,"fitPage"),isPageZoom50:Fn(e,50),isPageZoom75:Fn(e,75),isPageZoom100:Fn(e,100),isPageZoom125:Fn(e,125),isPageZoom150:Fn(e,150),isPageZoom200:Fn(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 iv(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function av(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function sv(e){return{...K1(e),...V1(e),...Qy(e),...G1(e),...q1(e),...rv(e),...$1(e),...iv(e),...X1(e)}}function lv(e){return{...ov(e),...W1(e),...Z1(e),...Y1(e),...U1(e),...av(e)}}function Za(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function cv(e){const t=e.style.fontSize;if(!t)return null;const n=iu(t);return!n||!ms(n.unit)?null:{value:n.value,unit:n.unit}}function Dg(e,t){let n=Za(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=cv(n);if(r)return r;n=n.parentElement}return null}function uv(e,t){const n=Za(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function Ig(e,t){var a;let n=Za(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=Za(t))==null?void 0:a.parentElement)??e,o=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(o)&&o>0?o:16}function jg(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function dv(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function sf(e=ro){return{value:null,unit:e,mixed:!1}}function Eg(e,t=ro){const n=window.getSelection();if(!n||n.rangeCount===0)return sf(t);const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer))return sf(t);const o=r.collapsed?[]:vt(r).filter(f=>f.data.length>0),a=o.length>0?o:[r.startContainer],s=a.map(f=>Dg(e,f)),u=s[0];if(s.every(f=>dv(f,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(s.every(f=>f===null)){const f=a.map(h=>uv(h,e)),g=f[0];if(f.every(h=>Math.abs(h-g)<.05)){const h=Ig(e,a[0]),y=jg(e);return{value:hp(g,t,h,y),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function mv(e,t){return{parentPx:Ig(e,t),rootPx:jg(e)}}function fv(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function Rc(e,t,n){const r=vr(t,n);if(!r)return!1;const o=fv(e);if(!o||o.collapsed)return!1;const a=ou(r.value,r.unit);fn(o);const s=vt(o).filter(u=>u.data.length>0);for(const u of s){const d=Dg(e,u);d&&d.value===r.value&&d.unit===r.unit||ci(u,f=>{f.style.fontSize=a})}return Tr(s),!0}function pv(e,t){e.style.fontSize=ou(t.value,t.unit)}function gv(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function hv(e){return e.trim().toLowerCase()}function Dc(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=hv(r.slice(0,o)),s=r.slice(o+1).trim();a&&(t[a]=s)}return t}function Mg(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function bv(e,t){const n={...e};for(const[r,o]of Object.entries(t))o.trim()?n[r]=o:delete n[r];return n}function yv(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(`
|
|
318
|
-
`)}function xs(e){const t=Dc(e);return Mg(t)}function xv(e,t){let n=gv(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function _g(e){const t=hn(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:vt(t).filter(d=>d.data.length>0),a=(n.length>0?n:[t.startContainer]).map(d=>xv(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 Ng(e,t){const n=Dc(e.style.cssText),r=Dc(t),o=bv(n,r),a=Mg(o);a?e.style.cssText=a:e.removeAttribute("style")}function Lg(e,t){const n=xs(t);if(!n)return!1;const r=hn(e);if(!r||r.collapsed)return!1;fn(r);const o=vt(r).filter(a=>a.data.length>0);if(o.length===0)return!1;for(const a of o)ci(a,s=>{Ng(s,n),Qn(s)&&Et(s)});return Tr(o),!0}function Cv(e,t){const n=xs(t);n&&Ng(e,n)}function wv(e){return!!(e&&xs(e))}const zt=["bold","italic","underline","strikethrough"],Jr={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},vv=new Set(["underline","line-through","overline"]);function Wn(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function kv(e,t){return zt.every(n=>e[n]===t[n])}function Sv(e){return zt.some(t=>e[t]!==void 0)}function Bg(e,t){const n={...e};if(!t)return n;for(const r of zt){const o=t[r];o!==void 0&&(n[r]=o)}return n}function Pv(e,t,n){const r=e[n]??t[n],o={...e,[n]:!r};return o[n]===t[n]&&delete o[n],o}function Yn(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>vv.has(n))}function uo(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 Fg(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(Jr.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(Jr.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(Jr.underline.has(r))return!0;const s=n.style.textDecorationLine||n.style.textDecoration;if(!s)return null;if(s==="none")return!1;const u=Yn(n);return u.includes("underline")?!0:u.length>0?!1:null}if(Jr.strikethrough.has(r))return!0;const o=n.style.textDecorationLine||n.style.textDecoration;if(!o)return null;if(o==="none")return!1;const a=Yn(n);return a.includes("line-through")?!0:a.length>0?!1:null}function qa(e,t){return Fg(e,t)===!0}function mo(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const o=Fg(r,n);if(o!==null)return o;r=r.parentElement}return!1}function Hg(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=Yn(e);r.includes("underline")||r.push("underline"),uo(e,r);return}const n=Yn(e);n.includes("line-through")||n.push("line-through"),uo(e,n)}function zg(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"){uo(e,Yn(e).filter(n=>n!=="underline"));return}uo(e,Yn(e).filter(n=>n!=="line-through"))}function Av(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=Yn(e).filter(o=>o!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}uo(e,r);return}const n=Yn(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}uo(e,n)}function Tv(e,t){ci(e,n=>Hg(n,t))}function Rv(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!gn(o)||!qa(o,n)){r=o;continue}if(er(o,r),qa(o,n)){if(Jr[n].has(o.tagName.toLowerCase())){Et(o);continue}if(zg(o,n),Qn(o)){Et(o);continue}}r=o}}function Dv(e,t,n){const r=vt(t).filter(o=>o.data.length>0);return r.length===0?mo(e,t.startContainer,n):r.every(o=>mo(e,o,n))}function Iv(e,t,n,r){fn(t);const o=vt(t).filter(a=>a.data.length>0);for(const a of o)r?mo(e,a,n)||Tv(a,n):Rv(e,a,n);Tr(o)}function Qr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Wn();const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return Wn();if(n.collapsed)return Ic(e,n);const r=vt(n).filter(a=>a.data.length>0);if(r.length===0)return Ic(e,n);const o=Wn();for(const a of zt)o[a]=mo(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const s of zt)o[s]=o[s]&&mo(e,r[a],s);return o}function Ic(e,t){const n=Wn();for(const r of zt)n[r]=mo(e,t.startContainer,r);return n}function jc(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer)||r.collapsed)return!1;const o=Dv(e,r,t);return Iv(e,r,t,!o),!0}function jv(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 Ev(e,t,n){var a,s,u;jv(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(!gn(d)){o=d;continue}if(!n.some(g=>qa(d,g))){o=d;continue}er(d,o);for(const g of n)if(qa(d,g)){if(Jr[g].has(d.tagName.toLowerCase())){Et(d);break}if(zg(d,g),Qn(d)){Et(d);break}}o=d.isConnected?d:r}return r}function Mv(e,t,n){for(const r of zt)n[r]!==t[r]&&(n[r]?Hg(e,r):Av(e,r))}function _v(e,t,n,r,o,a,s){var S,A;const u=window.getSelection();if(!u||u.rangeCount===0)return;const d=u.getRangeAt(0);if(!Se(e,d.commonAncestorContainer))return;const f=Ic(e,d),g=Bg(f,n),h=zt.filter(T=>f[T]&&!g[T]),y=sC(e,d.startContainer,o),b=_x(e,d.startContainer,a);let C=null;h.length>0?(C=Ev(e,d,h),y.length>0&&Sp(e,C,y),b&&gc(e,C)):y.length>0?(C=aC(e,d,y),b&&gc(e,C)):b?C=Mx(e,d):d.deleteContents();const x=document.createElement("span");Mv(x,f,g),r&&pv(x,r),o!=null&&o.color&&Hm(x,"color",o.color),o!=null&&o.backgroundColor&&Hm(x,"backgroundColor",o.backgroundColor),a&&Dx(x,a),s&&Cv(x,s),x.textContent=t;const v=x.style.cssText.trim()?x:document.createTextNode(t);C?((S=C.parentNode)==null||S.insertBefore(v,C),C.nodeType===Node.TEXT_NODE&&!C.data&&((A=C.parentNode)==null||A.removeChild(C))):d.insertNode(v);const k=document.createRange();k.selectNodeContents(v),k.collapse(!1),u.removeAllRanges(),u.addRange(k)}const Ya=["p","h1","h2","h3","h4","h5","h6"],Nv=new Set(Ya),Og=new Set([...Ya,"div"]),Cs=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),Lv=()=>({tag:null,mixed:!1});function Kg(e){return Nv.has(e)}function Bv(e){return Kg(e)?e:e==="div"?"p":null}function Fv(e){return e instanceof Element&&Cs.has(_e(e))}function $g(e){return e instanceof HTMLElement&&!kt(e)&&Og.has(_e(e))}function Ec(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return Og.has(t)||Cs.has(t)?!1:gn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function Hv(e,t){let n=di(t);for(;n&&n!==e;){if(Cs.has(_e(n)))return!0;n=n.parentElement}return!1}function Ug(e,t){let n=di(t);for(;n&&n!==e;){if(og(n,e)){n=n.parentElement;continue}if($g(n))return n;if(Cs.has(_e(n)))return null;n=n.parentElement}return null}function zv(e,t){const n=new Set,r=[];for(const o of du(t)){const a=Ug(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Ov(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function Kv(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&Ec(n[o-1]);)o-=1;for(;a<n.length-1&&Ec(n[a+1]);)a+=1;return n.slice(o,a+1)}function Mc(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function $v(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&&kt(r)?Mc(e):r}return n.startContainer===t&&e!==t?Mc(e):Ov(e,n.startContainer)}function Uv(e,t,n){const r=ku(e);if(Hv(e,t.startContainer))return!1;if(!Mc(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const o=$v(r,e,t);if(!o||o instanceof HTMLElement&&kt(o)||Fv(o)||$g(o)||!Ec(o))return!1;const a=Kv(r,o),s=document.createElement(n);r.insertBefore(s,a[0]);for(const u of a)s.appendChild(u);return!0}function Vv(e){const t=hn(e);if(!t)return Lv();const n=du(t).map(o=>{const a=Ug(e,o);return a?Bv(_e(a)):null}),r=n[0];return n.every(o=>o===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function Wv(e,t){if(!Kg(t))return!1;const n=hn(e);if(!n)return!1;const r=oo(e,n.startContainer,n.startOffset),o=oo(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=zv(e,n);let d=!1;if(u.length===0)d=Uv(e,n,t);else for(const f of u)_e(f)!==t&&(fu(f,t),d=!0);return mu(e,a,s),d}function Iu(e){if(!Ht(e))return null;const t=io(e);if(!t)return null;const n=_e(t);return n==="ul"||n==="ol"?n:null}function Vg(e){const t=In(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Iu),r=n[0];return n.every(o=>o===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function Gv(e,t,n){const r=[...e.children].filter(o=>uu(o));for(const o of r)t.insertBefore(o,n)}function Wg(e){const t=io(e),n=document.createElement("p");for(const f of[...e.attributes])n.setAttribute(f.name,f.value);for(n.style.marginLeft="",xt(n);e.firstChild&&!uu(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=Ht(a)?a.parentNode??a:a,u=Ht(a)?a.nextSibling:t.nextSibling;e.remove();let d=null;if(r.length>0){d=document.createElement(t.tagName);for(const f of r)d.appendChild(f)}return s.insertBefore(n,u),d&&s.insertBefore(d,n.nextSibling),Gv(e,s,n.nextSibling),t.childElementCount===0&&t.remove(),n}function Zv(e){if(Ht(e))return e;const t=fu(e,"li");return t.style.marginLeft="",xt(t),t}function Gg(e,t){if(e.length===0)return!1;if(e.every(Ht)){const a=io(e[0]);if(a&&e.every(s=>s.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return _e(a)===t?!1:(fu(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=Ht(a)?io(a):null;o.appendChild(Zv(a)),s&&s!==o&&s.childElementCount===0&&s.remove()}return!0}function Zg(e){let t=!1;for(const n of[...e].reverse())Ht(n)&&(Wg(n),t=!0);return t}function qv(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;if(n.every(a=>Iu(a)===t))return Zg(n);let o=!1;for(const a of Cp(n))Gg(a,t)&&(o=!0);return o})}function Yv(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;if(t===null)return Zg(n);if(n.every(a=>Iu(a)===t))return!1;let o=!1;for(const a of Cp(n))Gg(a,t)&&(o=!0);return o})}const qg=40;function ju(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Yg(e,t){if(t<=0){e.style.marginLeft="",xt(e);return}e.style.marginLeft=`${t}px`}function Xv(e){let t=e.previousElementSibling;for(;t;){if(Ht(t))return t;t=t.previousElementSibling}return null}function Jv(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(_e(n)==="ul"||_e(n)==="ol"))return n}return null}function Qv(e){const t=Xv(e);if(!t)return!1;const n=io(e);if(!n)return!1;const r=_e(n)==="ol"?"ol":"ul";let o=Jv(t);return(!o||_e(o)!==r)&&(o=document.createElement(r),t.appendChild(o)),o.appendChild(e),!0}function ek(e){const t=io(e);if(!t)return!1;const n=t.parentElement;if(n&&Ht(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return Wg(e),!0}function tk(e){return In(e).some(n=>Ht(n)||ju(n)>0)}function nk(e){return nr(e,()=>{const t=Rr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Ht(r)){Qv(r)&&(n=!0);continue}Yg(r,ju(r)+qg),n=!0}return n})}function rk(e){return nr(e,()=>{const t=In(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Ht(r)){ek(r)&&(n=!0);continue}const o=ju(r);o<=0||(Yg(r,Math.max(0,o-qg)),n=!0)}return n})}function ws(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function Ar(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 Mt(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 f=ws(d),g={cell:d,originRow:a,originCol:u,rowSpan:f.rowSpan,colSpan:f.colSpan};r.push(g);for(let h=0;h<f.rowSpan;h+=1){const y=a+h;if(y>=t)break;for(let b=0;b<f.colSpan;b+=1)n[y][u+b]=g}u+=f.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 Xa(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function Xt(e,t){return e.unique.find(n=>n.cell===t)??null}function Xg(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 Jg(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 ok(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=Xa(e,o,a);!s||n.has(s.cell)||(n.add(s.cell),r.push(s.cell))}return r}function Qg(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=Xa(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=Xa(e,a,s);if(!u||Xg(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 ik(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=Xa(e,a,s);if(!u)return!1;if(u.cell!==t.cell&&Xg(u,o))return!1}return!0}const lf=10,eo=1,to=50,ak="1px solid #000",sk="0.25em",lk=new Set(["td","th"]);function eh(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=eo&&t>=eo&&e<=to&&t<=to}function wt(e,t){return Mu(e,t,n=>n instanceof HTMLTableElement)}function Ja(e,t){return Mu(e,t,n=>xk(n))}function ck(e,t){return Mu(e,t,n=>n instanceof HTMLTableRowElement)}function Eu(e){return wt(e,_u(e))}function bn(e){return Ja(e,_u(e))}function th(e){return ck(e,_u(e))}function uk(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function fi(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return[];const r=Ja(e,n.startContainer),o=Ja(e,n.endContainer);if(!r)return[];if(!o||r===o)return[r];const a=wt(e,r);if(!a||wt(e,o)!==a)return[r];const s=Mt(a),u=Xt(s,r),d=Xt(s,o);if(!u||!d)return[r];const f=Jg([u,d]);if(!f)return[r];const g=ok(s,f);return g.length>0?g:[r]}function dk(e,t){if(!eh(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer))return!1;const 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 f=0;f<t.cols;f+=1)d.appendChild(Ck("td"));a.appendChild(d)}o.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(o),Sk(e,o);const s=o.querySelector("td, th");return s instanceof HTMLTableCellElement&&Ct(s),!0}function _c(e,t){var h,y,b,C;const n=bn(e);if(!n)return!1;const r=wt(e,n);if(!r)return!1;const o=Mt(r),a=Xt(o,n);if(!a)return!1;const s=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const x of o.unique)if(x.originRow<s&&x.originRow+x.rowSpan>s){Ar(x.cell,x.colSpan,x.rowSpan+1);for(let v=x.originCol;v<x.originCol+x.colSpan;v+=1)u.add(v)}const d=document.createElement("tr"),f=Math.min(s,o.rowCount-1);for(let x=0;x<o.colCount;x+=1){if(u.has(x))continue;const v=((y=(h=o.slots[f])==null?void 0:h[x])==null?void 0:y.cell)??n;d.appendChild(Nu(v))}if(s>=r.rows.length)(b=r.rows[r.rows.length-1].parentNode)==null||b.appendChild(d);else{const x=r.rows[s];(C=x.parentNode)==null||C.insertBefore(d,x)}const g=vk(d,o.colCount,u,a.originCol);return Ct(g||n),!0}function cf(e,t){var f,g,h,y;const n=bn(e);if(!n)return!1;const r=wt(e,n);if(!r)return!1;const o=Mt(r),a=Xt(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){Ar(b.cell,b.colSpan+1,b.rowSpan);for(let C=b.originRow;C<b.originRow+b.rowSpan;C+=1)u.add(C)}let d=null;for(let b=0;b<o.rowCount;b+=1){if(u.has(b))continue;const C=((g=(f=o.slots[b])==null?void 0:f[Math.min(s,Math.max(0,o.colCount-1))])==null?void 0:g.cell)??((y=(h=o.slots[b])==null?void 0:h[Math.max(0,s-1)])==null?void 0:y.cell)??n,x=Nu(C);Lu(r,b,s,x),b===a.originRow&&(d=x)}return d&&Ct(d),!0}function mk(e){var y,b;const t=bn(e);if(!t)return!1;const n=wt(e,t);if(!n)return!1;const r=Mt(n),o=Xt(r,t);if(!o)return!1;if(r.rowCount<=1)return Nc(e,n);const a=o.originRow,s=a+1,u=[];for(const C of r.unique)C.originRow<=a&&C.originRow+C.rowSpan>a&&(C.originRow<a?Ar(C.cell,C.colSpan,C.rowSpan-1):C.originRow===a&&C.rowSpan>1&&u.push(C));u.sort((C,x)=>C.originCol-x.originCol);for(const C of u)Ar(C.cell,C.colSpan,C.rowSpan-1),Lu(n,s,C.originCol,C.cell);const d=o.originCol;n.rows[a].remove();const f=n.rows[Math.min(a,n.rows.length-1)],g=Mt(n),h=(b=(y=g.slots[Math.min(a,g.rowCount-1)])==null?void 0:y[Math.min(d,Math.max(0,g.colCount-1))])==null?void 0:b.cell;return h?Ct(h):f!=null&&f.cells[0]?Ct(f.cells[0]):Ak(n),!0}function fk(e){var f,g,h;const t=bn(e);if(!t)return!1;const n=wt(e,t);if(!n)return!1;const r=Mt(n),o=Xt(r,t);if(!o)return!1;if(r.colCount<=1)return Nc(e,n);const a=o.originCol,s=o.originRow;for(const y of r.unique)a<y.originCol||a>=y.originCol+y.colSpan||(y.colSpan===1?y.cell.remove():Ar(y.cell,y.colSpan-1,y.rowSpan));const u=Mt(n);if(u.colCount===0||u.unique.length===0)return Nc(e,n);const d=((g=(f=u.slots[Math.min(s,u.rowCount-1)])==null?void 0:f[Math.min(a,u.colCount-1)])==null?void 0:g.cell)??((h=u.unique[0])==null?void 0:h.cell);return d&&Ct(d),!0}function pk(e,t){const n=bn(e);if(!n)return!1;const r=wt(e,n);if(!r)return!1;const o=uk(r),a=o.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Ct(o[a-1]),{changed:!1});if(a<o.length-1)return Ct(o[a+1]),{changed:!1};const s=n.parentElement;if(!_c(e,"below"))return!1;const u=s instanceof HTMLTableRowElement?s.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Ct(u.cells[0]),{changed:!0}}function gk(e,t){return!Se(e,t)||t===e?!1:(Ct(t),!0)}function uf(e){return nh(e)!==null}function df(e){const t=bn(e);if(!t)return!1;const n=ws(t);return n.colSpan>1||n.rowSpan>1}function hk(e){const t=nh(e);if(!t)return!1;const n=wt(e,t.origin.cell);return n?rh(n,t):!1}function bk(e){const t=bn(e);if(!t)return!1;const n=wt(e,t);return n?oh(n,t):!1}function yk(e,t,n){const r=bn(e);if(!r)return!1;const o=wt(e,r);if(!o)return!1;const a=Mt(o),s=Xt(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||!ik(a,s,u,d))return!1;if((s.colSpan>1||s.rowSpan>1)&&oh(o,r),u===1&&d===1)return Ct(r),!0;const f=Mt(o),g=Qg(f,{minRow:s.originRow,maxRow:s.originRow+d-1,minCol:s.originCol,maxCol:s.originCol+u-1});return g?rh(o,g):!0}function Mu(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function xk(e){return lk.has(e.tagName.toLowerCase())}function _u(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n.startContainer:null}function nh(e){const t=fi(e);if(t.length<2)return null;const n=wt(e,t[0]);if(!n)return null;const r=Mt(n),o=[];for(const u of t){const d=Xt(r,u);if(!d)return null;o.push(d)}const a=Jg(o);if(!a)return null;const s=Qg(r,a);return!s||s.cells.length<2?null:s}function rh(e,t){const n=t.origin.cell,r=Mt(e),o=t.cells.map(a=>Xt(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&&kk(n,a.cell);Ar(n,t.colSpan,t.rowSpan);for(const a of o)a.cell!==n&&a.cell.remove();return Ct(n),!0}function oh(e,t){const n=Mt(e),r=Xt(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;Ar(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||Lu(e,o,a,Nu(t));return Ct(t),!0}function Ck(e){const t=document.createElement(e);return t.style.border=ak,t.style.padding=sk,t.appendChild(document.createElement("br")),t}function Nu(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 wk(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Lu(e,t,n,r){const o=e.rows[t];if(!o)return;const a=Mt(e);let s=0;for(const u of Array.from(o.cells)){if(u===r)continue;const d=Xt(a,u);if(!d||d.originCol>=n)break;s+=1}wk(o,s,r)}function vk(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 mf(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 kk(e,t){if(!(e===t||mf(t)))for(mf(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function Sk(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),Pk(n)&&n.remove())}function Pk(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 Nc(e,t){if(!t.parentNode||!Se(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 Ct(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Ak(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const ih=["left","center","right","justify"];function Tk(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function Qa(e){return Tk(e.style.textAlign)}function Lc(e,t){const n=t??"left";return Qa(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 ff(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function ah(e){const t=fi(e);if(t.length>0)return ff(t.map(Qa));const n=In(e);return n.length===0?hn(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:ff(n.map(Qa))}function sh(e,t){return ih.includes(t)?nr(e,()=>{const n=fi(e);if(n.length>0){let a=!1;for(const s of n)Lc(s,t)&&(a=!0);return a}const r=Rr(e);if(r.length===0)return!1;let o=!1;for(const a of r)Lc(a,t)&&(o=!0);return o}):!1}function wr(){return{...hu(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function Aa(e){const t=MC(e),n=ah(e),r=Vg(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function lh(e,t){let n=!1;return!t.alignMixed&&t.align&&sh(e,t.align)&&(n=!0),t.listMixed||Yv(e,t.list)&&(n=!0),_C(e,t)&&(n=!0),n}function Rk(e,t){return lh(e,Bc(t))}function ch(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 Bc(e){const t=wr();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}}function Ta(e){return e?Cr(e):""}function Dk(e,t){return e.src===t.src&&e.opacity===t.opacity&&e.fit===t.fit&&e.position===t.position&&Ta(e.width)===Ta(t.width)&&Ta(e.height)===Ta(t.height)}function ec(e){const t=In(e);if(t.length===0)return mn();const n=t.map(xg),r=n[0];return n.some(o=>!Dk(o,r))?mn():r}function Ik(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;let r=!1;for(const o of n)Cg(o,t)&&(r=!0);return r})}function jk(){return{size:null,unit:ro,marks:Wn(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function Jo(){return{font:jk(),box:hu(),backgroundImage:mn(),atRule:Kn()}}function Fc(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 Ek(e,t){if(!t)return e;const{margin:n,padding:r,...o}=t;return{...e,...o,margin:n?Fc(e.margin,n):e.margin,padding:r?Fc(e.padding,r):e.padding}}function Mk(e,t){if(!t)return e;const{marks:n,...r}=t;return{...e,...r,marks:n?{...e.marks,...n}:e.marks}}function _k(e,t){const{margin:n,...r}=t.atRule??{};return{font:Mk(e.font,t.font),box:Ek(e.box,t.box),backgroundImage:t.backgroundImage?{...e.backgroundImage,...t.backgroundImage}:e.backgroundImage,atRule:t.atRule?{...e.atRule,...r,margin:n?Fc(e.atRule.margin,n):e.atRule.margin}:e.atRule}}function Nk(e){return e?!!(e.font||e.box||e.backgroundImage||e.atRule):!1}function pf(e,t){if(!Nk(t))return e;const n=document.createElement("div");n.innerHTML=e;const r=_k(Wo(n),t);return Hc(n,r).pageHtml}function Lk(e){const t=e.style.fontSize,n=t?iu(t):null,r=n&&ms(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)??ro,marks:s,fontFamily:d||null,fontFamilyMixed:!1,fontColor:u?Ke(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function Bk(e,t){const n=e.style.fontSize,r=t.size===null?null:vr(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const o=ou(r.value,r.unit);return n===o?!1:(e.style.fontSize=o,!0)}function Fk(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 ui(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function Hk(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?Ke(t.fontColor):null;return(e.style.color?Ke(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function zk(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 Ok(e,t){let n=!1;return Bk(e,t)&&(n=!0),Fk(e,t)&&(n=!0),Hk(e,t)&&(n=!0),zk(e,t.marks)&&(n=!0),n&&xt(e),n}function Kk(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function Wo(e){const t=ct(e);if(!t)return Jo();const n=fo(t);return{font:Lk(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:C1(t),atRule:tt(e.innerHTML)}}function Hc(e,t){const n=hn(e),r=n?oo(e,n.startContainer,n.startOffset):null,o=n?oo(e,n.endContainer,n.endOffset):null,a=ct(e),s=vu(e);Yo(s);const u=Ok(s,t.font),d=po(s,Kk(t)),f=w1(s,t.backgroundImage);bs(e);const g=tt(e.innerHTML),h=Oa(e.innerHTML,t.atRule),y=dn(h);y!==dn(e.innerHTML)&&(e.innerHTML=y),ho(e,h);const b=JSON.stringify(g)!==JSON.stringify(t.atRule);r!==null&&o!==null&&mu(e,Math.min(r,o),Math.max(r,o)),ys(e);const C=Oa(e.innerHTML,t.atRule);return{changed:!a||u||d||f||b,pageHtml:C}}function $k(e,t){const n=t??e.innerHTML,r=Zp(n);return ii(n)?(e.innerHTML=dn(r),bs(e),ho(e,r),{changed:!0,pageHtml:r}):{changed:!1,pageHtml:r}}const Uk=/<script\b[^>]*>[\s\S]*?<\/script>/gi,Vk=/^\s*javascript\s*:/i;function Wk(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 uh(e){const t=Wk(e).replace(/[\u0000-\u001F\u007F\s]+/g,"");return Vk.test(t)}function Gk(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!uh(r)&&!/url\s*\(\s*["']?\s*javascript:/i.test(r)}).join("; ")}function Zk(e){const t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const n of t)for(const r of[...n.attributes]){if(uh(r.value)){n.removeAttribute(r.name);continue}if(r.name.toLowerCase()==="style"){const o=Gk(r.value);o?o!==r.value&&n.setAttribute(r.name,o):n.removeAttribute(r.name)}}}function qk(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Yk(e){return e.body.innerHTML}function zc(e){if(!e.trim())return e;const n=e.replace(Uk,"");if(!/javascript\s*:/i.test(n))return n;const r=qk(n);return Zk(r.body),Yk(r)}function Yr(e){if(!e.trim())return e;const n=Un(e);return n.length===1?zc(e):jt(n.map(zc))}const Bu="data-hover-html",Xk="noopener noreferrer",Jk="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)",Qk="this._hoverBox&&this._hoverBox.remove()",eS=/^(#(?:[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 vs(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function tS(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function si(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&tS(n))return n;n=n.parentNode}return null}function dh(e){return eS.test(e)}function nS(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&&dh(r)?r:null}function mh(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function rS(e){const t=e.getAttribute(Bu)??"",n=nS(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:mh(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function fh(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return null;const r=si(e,n.commonAncestorContainer);return r?rS(r):null}function oS(e){return fh(e)!==null}function iS(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(Bu)}function aS(e,t){var r;if(iS(e),t.hoverMode==="html"){const o=t.hoverHtml.trim();if(!o)return;e.setAttribute(Bu,o),e.setAttribute("onmouseover",Jk),e.setAttribute("onmouseout",Qk);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!dh(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function Fu(e,t){const n=vs(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",Xk)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":mh(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),aS(e,n)}function sS(e,t){const n=new Set;for(const r of t){const o=si(e,r);o&&!n.has(o)&&n.add(o)}for(const r of n)Et(r)}function lS(e,t,n){fn(t);const r=vt(t).filter(u=>u.data.length>0);sS(e,r),r.length>0&&Tr(r);const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);fn(a);const s=document.createElement("a");Fu(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 cS(e,t){const n=document.createElement("a");Fu(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 uS(e,t){const n=t.href.trim();if(!n)return!1;const r=vs({...t,href:n}),o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Se(e,a.commonAncestorContainer))return!1;const s=si(e,a.startContainer),u=si(e,a.endContainer);return s&&s===u?(Fu(s,r),!0):a.collapsed?cS(a,r):lS(e,a,r)}const dS=/^[A-Za-z][A-Za-z0-9_-]*$/,ph="";function Oc(e){var r;const t=ku(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 mS(e){return new Set(Oc(e).map(t=>t.id))}function gh(e,t){const n=e.trim();return n?dS.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function gf(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ph)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function fS(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ph)),(r=e.parentNode)==null||r.insertBefore(n,e)}function pS(e,t){const n=t.trim();if(gh(n,mS(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Se(e,o.commonAncestorContainer))return!1;const a=si(e,o.startContainer);if(a)return fS(a,n),!0;if(o.collapsed)return gf(o,n),!0;fn(o);const s=document.createElement("span");s.id=n;try{return o.surroundContents(s),!0}catch{return gf(o,n),!0}}const lt="data-comment-thread",hf="wysiwyg-comment-anchor";function gS(){return`cmt_${crypto.randomUUID()}`}function hS(){return crypto.randomUUID()}const es=20;function bf(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${lt}]`);return r instanceof HTMLElement&&Se(t,r)?r:null}function yf(e,t,n){var y;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,f=0,g;for(;g=r.nextNode();){const b=g,C=((y=b.textContent)==null?void 0:y.length)??0;if(!s&&o<=C&&(s=b,u=o),!d&&a<=C){d=b,f=a;break}o-=C,a-=C}if(!s||!d)return null;const h=document.createRange();return h.setStart(s,u),h.setEnd(d,f),h}function bS(e,t,n){const r=e.textContent??"",o=r.slice(Math.max(0,t-es),t),a=r.slice(n,n+es);return{prefix:o,suffix:a}}function yS(e,t){if(t.mode!=="visual")return null;const n=Vn(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}=bS(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:o}}function xf(e,t){if(t.mode!=="visual")return null;const n=Vn(e);if(n!=null&&n.hasAttribute(lt))return n.getAttribute(lt)??null;if(t.visualRange){const r=bf(t.visualRange.startContainer,e);if(r)return r.getAttribute(lt)??null;const o=bf(t.visualRange.endContainer,e);if(o)return o.getAttribute(lt)??null}return null}function Kc(e,t,n){if(!Se(e,n.commonAncestorContainer))return!1;fn(n);const r=document.createElement("span");r.setAttribute(lt,t);try{return n.surroundContents(r),!0}catch{const o=n.toString();if(!o)return!1;const a=document.createElement("span");return a.setAttribute(lt,t),a.textContent=o,n.deleteContents(),n.insertNode(a),!0}}function hh(e,t){e.setAttribute(lt,t)}function xS(e,t,n){const r=Vn(e);return r?(hh(r,t),!0):n.visualRange?Kc(e,t,n.visualRange):!1}function CS(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 wS(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const s=yf(e,n.start,n.end);if(s&&s.toString()===n.text)return Kc(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-es),s),f=r.slice(u,u+es);if(n.prefix!==void 0&&d!==n.prefix){a=s+1;continue}if(n.suffix!==void 0&&f!==n.suffix){a=s+1;continue}const g=yf(e,s,u);return g?Kc(e,t,g):!1}return!1}function vS(e,t){for(const n of t)if(!e.querySelector(`[${lt}="${n.id}"]`)){if(n.anchor.type==="image"){const o=CS(e,n.anchor);o&&hh(o,n.id);continue}wS(e,n.id,n.anchor)}}function bh(e,t){for(const n of e.querySelectorAll(`[${lt}]`))n instanceof HTMLElement&&(t?n.classList.add(hf):n.classList.remove(hf))}function yh(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${lt}]`);return r instanceof HTMLElement&&Se(e,r)?r:null}function Cf(e,t){const n=e.querySelector(`[${lt}="${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 kS(e,t=[]){return{id:gS(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function SS(e,t){return{id:hS(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function PS(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function AS(e,t){return e.find(n=>n.id===t)}function xh(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function TS(e){const t=xh(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 Ch(e){const t=xh(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 RS(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 wh(e){const t=TS(e);return t?RS(t):!1}async function DS(e){return await wh(e)?Ch(e):!1}const IS=new Set(["strong","b","em","i","u","s","strike","del"]),jS=["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 ES(e){for(const t of jS)e.style.removeProperty(t)}function MS(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!gn(r)){n=r;continue}if(er(r,n),IS.has(r.tagName.toLowerCase())){Et(r);continue}if(ES(r),Qn(r)){Et(r);continue}n=r.isConnected?r:t}}function _S(e){const t=hn(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;fn(t);const r=vt(t).filter(o=>o.data.length>0);if(r.length===0)return!1;for(const o of r)MS(e,o);return Tr(r),e.innerHTML!==n}function NS(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function LS(e){const t=Qr(e),n=Eg(e),r=gp(e),o=Ba(e,"color"),a=Ba(e,"backgroundColor"),s=_g(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 BS(e,t){t.size!==null&&Rc(e,t.size,t.unit);const n=Qr(e);for(const r of zt)t.marks[r]!==n[r]&&jc(e,r);return t.fontFamilyMixed||pc(e,t.fontFamily),t.fontColorMixed||qo(e,"color",t.fontColor),t.highlightColorMixed||qo(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&Lg(e,t.customCss),!0}function Ma(){return typeof window<"u"&&"speechSynthesis"in window}function FS(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function wf(e,t){const n=e.text.trim();return n||FS(t)||null}function HS(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!Ma())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 Ma()&&t.speaking},cancel(){Ma()&&t.speaking&&(t.cancel(),n())}}}const zS=5*1024*1024,OS="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",KS=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),$S=new Set(["mp3","wav","ogg","aac","webm","m4a"]),US=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,VS=/^(javascript|vbscript|file|blob):/i;function WS(e={}){return{src:"",title:"",...e}}function Hu(e){const t=e.trim();if(!t)return"empty";if(VS.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return US.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 GS(e){return e.size>zS?"tooLarge":JS(e)?null:"type"}function ZS(e){const t=GS(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");if(Hu(a)){r(new Error("invalid"));return}n(a)},o.onerror=()=>r(o.error??new Error("Failed to read file")),o.readAsDataURL(e)})}function qS(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%",YS(e,t.css)}function YS(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 XS(e,t){const n=WS(t);if(Hu(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Se(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=document.createElement("audio");return qS(a,n),o.insertNode(a),o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}function JS(e){const t=e.type.trim().toLowerCase();if(t&&KS.has(t))return!0;const n=QS(e.name);return!!(!t&&n&&$S.has(n))}function QS(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function vf(e,t){const r=(t?t(e):e).trim();if(!r)return"";if(!r.includes("<"))return r;const o=new DOMParser().parseFromString(`<body>${r}</body>`,"text/html");for(const a of o.querySelectorAll("img"))a.removeAttribute(It);return o.body.innerHTML}function vh(e,t,n){return vf(e,n)===vf(t,n)}const e0=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i;function kf(e,t){var o,a;const n=(o=e.getAttribute(It))==null?void 0:o.trim();if(n&&t){const s=t(n);if(s)return`embedded:${s}`}const r=((a=e.getAttribute("src"))==null?void 0:a.trim())??"";return e0.test(r)?`embedded:${r}`:r.startsWith("blob:")&&n?`registry:${n}`:r?`url:${r}`:"empty"}function t0(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function n0(e,t){for(const n of[...e.attributes])t.hasAttribute(n.name)||e.removeAttribute(n.name);for(const n of[...t.attributes])e.setAttribute(n.name,n.value)}function r0(e,t){e.querySelectorAll("img").forEach((n,r)=>{const o=document.createElement("span");o.setAttribute(t,String(r)),n.replaceWith(o)})}function Sf(e,t){const n=e.cloneNode(!0);return r0(n,t),n.innerHTML}function o0(e,t,n){const r=t0(t),o=[...e.querySelectorAll("img")],a=[...r.querySelectorAll("img")];if(o.length===0||o.length!==a.length)return!1;const s=o.map(h=>kf(h,n)),u=a.map(h=>kf(h,n));if(!s.every((h,y)=>h===u[y]))return!1;const d="data-wysiwyg-img-marker",f=Sf(e,d),g=Sf(r,d);if(f!==g)return!1;for(let h=0;h<o.length;h+=1)n0(o[h],a[h]);return!0}function ts(e,t,n={}){const{resolveDataUrl:r,hydrateEmbeddedImages:o}=n;return vh(e.innerHTML,t,o)?{changed:!1}:e.innerHTML===t?{changed:!1}:o0(e,t,r)?{changed:!0}:(e.innerHTML=t,{changed:!0})}const kh=/^(javascript|vbscript|file|blob):/i,i0=[/(?: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 a0(e={}){return{url:"",title:"",...e}}function s0(e={}){return{src:"",title:"",...e}}function ks(e){const t=e.trim();if(!t)return null;for(const n of i0){const r=t.match(n);if(r!=null&&r[1])return r[1]}return null}function Sh(e){return`https://www.youtube.com/embed/${e}`}function Ph(e){const t=e.trim();return t?kh.test(t)?"invalid":ks(t)?null:"invalid":"empty"}function l0(e){const t=e.trim();if(!t)return"empty";if(kh.test(t))return"invalid";if(ks(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 Ah(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 Th(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",Ah(e,n.css)}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%",Ah(e,t.css)}function u0(e,t){const n=a0(t);if(Ph(n.url))return!1;const r=ks(n.url);if(!r)return!1;const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Se(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const s=document.createElement("iframe");return Th(s,Sh(r),n),a.insertNode(s),a.setStartAfter(s),a.collapse(!0),o.removeAllRanges(),o.addRange(a),!0}function d0(e,t){const n=s0(t);if(l0(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Se(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=ks(n.src);if(a){const s=document.createElement("iframe");Th(s,Sh(a),{title:n.title,css:n.css}),o.insertNode(s),o.setStartAfter(s)}else{const s=document.createElement("video");c0(s,n),o.insertNode(s),o.setStartAfter(s)}return o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}const m0=new Set(["p","h1","h2","h3","h4","h5","h6"]),f0=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function Rh(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const o=p0(e,r.startContainer);if(o){const s=g0(o,r);return(a=o.parentNode)==null||a.insertBefore(t,s),Af(t),!0}return r.insertNode(t),h0(e,t),x0(t),Af(t),!0}function p0(e,t){let n=di(t);for(;n&&n!==e;){const r=_e(n);if(m0.has(r)&&n instanceof HTMLElement)return n;if(f0.has(r))return null;n=n.parentElement}return null}function g0(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),Pf(e),Pf(o),(a=e.parentNode)==null||a.insertBefore(o,e.nextSibling),o}function h0(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!b0(n))return;er(n,t),Et(n)}}function b0(e){const t=_e(e);return gn(e)||t==="a"}function Pf(e){y0(e)&&e.appendChild(document.createElement("br"))}function y0(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 x0(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 Af(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 C0="1em 0",w0="1px solid #d0d0d0";function v0(){const e=document.createElement("hr");return e.style.margin=C0,e.style.border="0",e.style.borderTop=w0,e}function k0(e){return Rh(e,v0())}const S0="1.5em 0",P0="2px dashed #bbb",A0="data-wysiwyg-page-break";function T0(){const e=document.createElement("div");return e.setAttribute(A0,""),e.style.display="block",e.style.clear="both",e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=S0,e.style.border="0",e.style.borderTop=P0,e.style.height="0",e}function R0(e){return Rh(e,T0())}const Dn=16;function Tf(e){return Math.min(lo.px.max,Math.max(Dn,e))}function D0(e){return e.width>0&&e.height>0?e.width/e.height:1}function I0(e,t){const n=Math.max(Dn,Dn*t),r=Math.min(lo.px.max,lo.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(Dn,Dn/t),r=Math.min(lo.px.max,lo.px.max/t),o=Math.min(r,Math.max(n,e));return{width:o*t,height:o}}function E0(e,t,n){const r=D0(t);return e==="e"?I0(t.width+n.x,r):e==="s"?j0(t.height+n.y,r):{width:Tf(t.width+n.x),height:Tf(t.height+n.y)}}function M0(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Dn,height:r>0?r:Dn}}function _0(e,t,n){const r=co(Math.max(Dn,t),"px"),o=co(Math.max(Dn,n),"px");return!r||!o?!1:mg(e,{...dg(e),sizeMode:"lock",width:r,height:o})}function N0(e={}){return{border:{...gu},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function L0(e){const t=fo(e);return{border:t.border,borderCollapse:z0(e),borderSpacing:Dh(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:ft(e.style.width)}}function B0(e,t){let n=po(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 O0(e,t.borderCollapse)&&(n=!0),K0(e,t.borderCollapse,t.borderSpacing)&&(n=!0),$0(e,t.width)&&(n=!0),n&&xt(e),n}function F0(e){const t=Eu(e);return t?L0(t):null}function H0(e,t){const n=Eu(e);return n?B0(n,t):!1}function z0(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function O0(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function Dh(e){const t=e.style.borderSpacing.trim();return t?ft(t.split(/\s+/)[0]??""):null}function K0(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?tr(n):null,o=Dh(e);return Ft(o,r)?!1:(r?e.style.borderSpacing=je(r):e.style.removeProperty("border-spacing"),!0)}function $0(e,t){const n=t?tr(t):null,r=ft(e.style.width);return Ft(r,n)?!1:(n?e.style.width=je(n):e.style.removeProperty("width"),!0)}const Ss=["top","middle","bottom","baseline"],U0=new Set(Ss);function V0(e={}){return{backgroundColor:null,color:null,padding:{...Yt},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function W0(e){const t=fo(e);return{backgroundColor:t.backgroundColor,color:Ih(e),padding:t.padding,textAlign:X0(e),verticalAlign:jh(e),width:ft(e.style.width),...ws(e)}}function G0(e,t){let n=po(e,{margin:{...Yt},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 Y0(e,t.color)&&(n=!0),Lc(e,t.textAlign)&&(n=!0),J0(e,t.verticalAlign)&&(n=!0),Q0(e,t.width)&&(n=!0),n&&xt(e),n}function Z0(e){const t=bn(e);return t?W0(t):null}function q0(e,t){const n=fi(e);if(n.length===0)return!1;let r=!1;for(const a of n)G0(a,t)&&(r=!0);const o=bn(e);if(o){const a=ws(o);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&yk(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function Ih(e){const t=e.style.color;return t?Ke(t):null}function Y0(e,t){const n=t?Ke(t):null;return Ih(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function X0(e){const t=Qa(e);return t==="left"?null:t}function jh(e){const t=e.style.verticalAlign.trim().toLowerCase();return U0.has(t)?t:null}function J0(e,t){return jh(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function Q0(e,t){const n=t?tr(t):null,r=ft(e.style.width);return Ft(r,n)?!1:(n?e.style.width=je(n):e.style.removeProperty("width"),!0)}const eP=new Set(Ss);function tP(e={}){return{backgroundColor:null,color:null,padding:{...Yt},height:null,verticalAlign:null,...e}}function nP(e){const t=e.cells[0],n=t?fo(t).padding:{...Yt};return{backgroundColor:Eh(e),color:Mh(e),padding:n,height:ft(e.style.height),verticalAlign:_h(e)}}function rP(e,t){let n=!1;aP(e,t.backgroundColor)&&(n=!0),sP(e,t.color)&&(n=!0),cP(e,t.height)&&(n=!0),lP(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))po(r,{margin:{...Yt},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&&xt(e),n}function oP(e){const t=th(e);return t?nP(t):null}function iP(e,t){const n=th(e);return n?rP(n,t):!1}function Eh(e){const t=e.style.backgroundColor;return t?Ke(t):null}function aP(e,t){const n=t?Ke(t):null;return Eh(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Mh(e){const t=e.style.color;return t?Ke(t):null}function sP(e,t){const n=t?Ke(t):null;return Mh(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function _h(e){const t=e.style.verticalAlign.trim().toLowerCase();return eP.has(t)?t:null}function lP(e,t){return _h(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function cP(e,t){const n=t?tr(t):null,r=ft(e.style.height);return Ft(r,n)?!1:(n?e.style.height=je(n):e.style.removeProperty("height"),!0)}const uP=1e3;function dP(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function mP({onAutoSave:e,getHtml:t}){const n=l.useRef(e);n.current=e;const r=l.useRef(t);r.current=t;const o=l.useRef(null),a=e!=null;l.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(()=>dP(u,d)))},uP);return()=>{window.clearInterval(s)}},[a])}function fP(){const[e,t]=l.useState({open:!1,tab:"general"}),[n,r]=l.useState(!1),[o,a]=l.useState({open:!1,html:""}),[s,u]=l.useState(null),[d,f]=l.useState(!1),[g,h]=l.useState(!1),[y,b]=l.useState({open:!1,tab:"general",value:wr(),backgroundImage:mn()}),[C,x]=l.useState({open:!1,value:""}),[v,k]=l.useState({open:!1,tab:"font",paragraphTab:"spacing",value:Jo()}),[S,A]=l.useState(!1),[T,D]=l.useState({open:!1}),[R,P]=l.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[M,L]=l.useState({open:!1,existingIds:[]}),[U,j]=l.useState({open:!1}),[_,O]=l.useState({open:!1}),[G,Z]=l.useState({open:!1}),[oe,Y]=l.useState({open:!1,tab:"general",value:ug(),aspectRatio:1}),[J,ie]=l.useState({open:!1}),[de,te]=l.useState({open:!1,value:N0()}),[E,re]=l.useState({open:!1,value:V0()}),[pe,F]=l.useState({open:!1,value:tP()}),[Ee,He]=l.useState({open:!1,topicId:"getStarted"}),[ze,We]=l.useState(!1);return{fontDialog:e,setFontDialog:t,customizeToolbarOpen:n,setCustomizeToolbarOpen:r,documentPreview:o,setDocumentPreview:a,toolbarSettings:s,setToolbarSettings:u,toolbarSettingsLoading:d,setToolbarSettingsLoading:f,toolbarSettingsBusy:g,setToolbarSettingsBusy:h,paragraphDialog:y,setParagraphDialog:b,customCssDialog:C,setCustomCssDialog:x,pageDialog:v,setPageDialog:k,deletePageConfirmOpen:S,setDeletePageConfirmOpen:A,customStyleDialog:T,setCustomStyleDialog:D,linkDialog:R,setLinkDialog:P,bookmarkDialog:M,setBookmarkDialog:L,imageDialog:U,setImageDialog:j,audioDialog:_,setAudioDialog:O,youtubeDialog:G,setYoutubeDialog:Z,imageProperties:oe,setImageProperties:Y,tableDialog:J,setTableDialog:ie,tableProperties:de,setTableProperties:te,cellProperties:E,setCellProperties:re,rowProperties:pe,setRowProperties:F,helpDialog:Ee,setHelpDialog:He,aboutDialogOpen:ze,setAboutDialogOpen:We}}const Rf={changed:!1,pages:[],joined:"",changedIndices:[]};function Df(e){return{changed:e.changed,pages:e.pages,joined:jt(e.pages),changedIndices:e.changedIndices}}function pP({enabled:e,pagesProp:t,defaultPages:n}){const r=e&&t!==void 0,o=l.useMemo(()=>t!==void 0?$n(t):void 0,[t]),[a,s]=l.useState(()=>({pages:$n(n),revision:0})),u=l.useRef(o??$n(n)),d=l.useRef(new Set),f=l.useRef(t);l.useEffect(()=>{if(!e||!r||o===void 0||f.current===t&&xr(u.current,o))return;f.current=t;const k=ql(u.current,o);if(u.current=k.pages,!!k.changed){for(const S of k.changedIndices)d.current.add(S);s(S=>({pages:k.pages,revision:S.revision+1}))}},[e,r,o,t]);const g=l.useMemo(()=>{if(!e)return[];if(r&&o!==void 0){const k=ql(u.current,o);return u.current=k.pages,k.pages}return a.pages},[e,r,o,a.pages,a.revision]),h=l.useCallback((k,S)=>{if(!e)return Rf;const A=r?u.current:a.pages,T=ql(A,k);if(!T.changed)return Df(T);for(const D of T.changedIndices)d.current.add(D);return S!==void 0&&d.current.add(S),r?u.current=T.pages:s(D=>({pages:T.pages,revision:D.revision+1})),Df(T)},[e,a.pages,r]),y=l.useCallback((k,S)=>h(k,S==null?void 0:S.editedIndex),[h]),b=l.useCallback((k,S,A)=>{if(!e)return Rf;const T=r?u.current:a.pages,D=vc(T,k,S);return D.changed?h(D.pages,(A==null?void 0:A.editedIndex)??k):{changed:!1,pages:T,joined:jt(T),changedIndices:[]}},[h,e,a.pages,r]),C=l.useCallback(k=>h($n(k)),[h]),x=l.useCallback(k=>{if(k===void 0){d.current.clear();return}for(const S of k)d.current.delete(S)},[]),v=l.useCallback(()=>jt(g),[g]);return l.useMemo(()=>({pages:g,revision:a.revision,dirtyPagesRef:d,setPages:y,updatePage:b,replacePages:C,markPagesClean:x,getJoinedHtml:v}),[g,a.revision,y,b,C,x,v])}function _a({value:e,defaultValue:t,onChange:n}){const[r,o]=l.useState(t),a=e!==void 0,s=a?e:r,u=l.useCallback(d=>{a||o(d),n==null||n(d)},[a,n]);return[s,u]}const Nh="commspliant-html-editor.darkMode";function gP(e){return typeof e=="boolean"?e:null}function If(){try{const e=localStorage.getItem(Nh);return e?gP(JSON.parse(e)):null}catch{return null}}function hP(e){try{localStorage.setItem(Nh,JSON.stringify(e))}catch{}}const Lh="commspliant-html-editor.pageZoom",bP=new Set(["fitWidth","fitPage"]);function yP(e){return typeof e=="string"&&bP.has(e)||typeof e=="number"&&J1.includes(e)?e:null}function xP(){try{const e=localStorage.getItem(Lh);return e?yP(JSON.parse(e)):null}catch{return null}}function CP(e){try{localStorage.setItem(Lh,JSON.stringify(e))}catch{}}const Bh="commspliant-html-editor.toolbarPosition",wP=["top","left","right","bottom"];function Fh(e){return typeof e=="string"&&wP.includes(e)?e:null}function jf(){try{const e=localStorage.getItem(Bh);return e?Fh(JSON.parse(e)):null}catch{return null}}function vP(e){try{localStorage.setItem(Bh,JSON.stringify(e))}catch{}}function kP({enabled:e,onHtml:t}){const[n,r]=l.useState(!1),o=l.useRef(0),a=l.useRef(e),s=l.useRef(t);a.current=e,s.current=t;const u=l.useCallback(()=>{o.current=0,r(!1)},[]);l.useEffect(()=>{e||u()},[e,u]);const d=l.useCallback(y=>{!a.current||!Pa(y.dataTransfer)||(y.preventDefault(),o.current+=1,r(!0))},[]),f=l.useCallback(y=>{!a.current||!Pa(y.dataTransfer)||(y.preventDefault(),y.dataTransfer&&(y.dataTransfer.dropEffect="copy"))},[]),g=l.useCallback(y=>{if(!a.current||!Pa(y.dataTransfer))return;const b=y.relatedTarget;b instanceof Node&&y.currentTarget.contains(b)||(o.current=Math.max(0,o.current-1),o.current===0&&r(!1))},[]),h=l.useCallback(y=>{if(!a.current||!Pa(y.dataTransfer))return;y.preventDefault(),u();const b=j1(y.dataTransfer);b&&Du(b).then(C=>{a.current&&s.current(C)},()=>{})},[u]);return{dragging:n,onDragEnter:d,onDragOver:f,onDragLeave:g,onDrop:h}}const SP={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:zy,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:_y,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:Zo,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},deletePage:{id:"deletePage",command:"deletePage",icon:Zo,labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:"canDeletePage"}}},Hh=400,ns=100,zh=2e7;function PP(e){let t=[],n=0,r=e,o=[],a=0,s=!1,u=!1,d=0;function f(){if(t.length>ns){const v=t.splice(0,t.length-ns);for(const k of v)n-=k.length}for(;t.length>1&&n+a>zh;){const v=t.shift();v&&(n-=v.length)}}function g(v){t.push(v),n+=v.length,f()}function h(){o=[],a=0}function y(v,k){if(s){r=v,s=!1;return}if(v===r)return;const S=Date.now(),A=(k==null?void 0:k.coalesce)===!0;if(A&&u&&S-d<Hh){r=v,d=S,o.length>0&&h();return}g(r),r=v,h(),d=S,u=A}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,f(),r}function C(){if(o.length===0)return null;u=!1,g(r);const v=o.pop();return a-=v.length,r=v,r}function x(v){if(s){r=v,s=!1;return}v!==r&&(g(r),r=v,h(),u=!1)}return{record:y,undo:b,redo:C,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncExternal:x,markApplying:()=>{s=!0},finishApplying:()=>{s=!1}}}function qe(e){return e.map(t=>t)}function gr(e){switch(e.type){case"pageEdit":return e.before.length;case"insertPage":return e.page.length;case"deletePage":return e.page.length;case"replaceAll":return e.beforePages.reduce((t,n)=>t+n.length,0)}}function AP(e){let t=[],n=0,r=qe(e),o=[],a=0,s=!1,u=!1,d=null,f=0;function g(){if(t.length>ns){const R=t.splice(0,t.length-ns);for(const P of R)n-=gr(P)}for(;t.length>1&&n+a>zh;){const R=t.shift();R&&(n-=gr(R))}}function h(R){t.push(R),n+=gr(R),g()}function y(R){o.push(R),a+=gr(R)}function b(){for(const R of o)a-=gr(R);o=[],a=0}function C(){u=!1,d=null}function x(R,P,M){if(s){const O=qe(r);O[R]=P,r=O,s=!1;return}if(r[R]===P)return;const L=Date.now(),U=(M==null?void 0:M.coalesce)===!0,j=U&&u&&d===R&&L-f<Hh,_=qe(r);if(_[R]=P,j){r=_,f=L;return}h({type:"pageEdit",pageIndex:R,before:r[R]??""}),r=_,b(),f=L,u=U,d=R}function v(R,P){if(s){r=qe(P),s=!1;return}xr(r,P)||(h({type:"insertPage",index:R,page:P[R]??""}),r=qe(P),b(),C())}function k(R,P,M){if(s){r=qe(M),s=!1;return}xr(r,M)||(h({type:"deletePage",index:R,page:P}),r=qe(M),b(),C())}function S(R){if(s){r=qe(R),s=!1;return}xr(r,R)||(h({type:"replaceAll",beforePages:qe(r)}),r=qe(R),b(),C())}function A(R){if(s){r=qe(R),s=!1;return}xr(r,R)||(r=qe(R))}function T(){if(t.length===0)return null;C();const R=t.pop();switch(n-=gr(R),R.type){case"pageEdit":{const P=r[R.pageIndex]??"";y({type:"pageEdit",pageIndex:R.pageIndex,before:P}),r[R.pageIndex]=R.before;break}case"insertPage":{const P=r[R.index]??"";y({type:"insertPage",index:R.index,page:P}),r.splice(R.index,1);break}case"deletePage":{y({type:"deletePage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"replaceAll":{y({type:"replaceAll",beforePages:qe(r)}),r=qe(R.beforePages);break}}return g(),qe(r)}function D(){if(o.length===0)return null;C();const R=o.pop();switch(a-=gr(R),R.type){case"pageEdit":{const P=r[R.pageIndex]??"";h({type:"pageEdit",pageIndex:R.pageIndex,before:P}),r[R.pageIndex]=R.before;break}case"insertPage":{h({type:"insertPage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"deletePage":{const P=r[R.index]??"";h({type:"deletePage",index:R.index,page:P}),r.splice(R.index,1);break}case"replaceAll":{h({type:"replaceAll",beforePages:qe(r)}),r=qe(R.beforePages);break}}return qe(r)}return{getPresent:()=>r,recordPageEdit:x,recordInsertPage:v,recordDeletePage:k,recordReplaceAll:S,undo:T,redo:D,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncPages:R=>S(R),applyPresent:A,markApplying:()=>{s=!0}}}function Bt(e){return typeof e=="object"&&e!==null&&"recordPageEdit"in e&&typeof e.recordPageEdit=="function"}const TP='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',RP='[role="listbox"], [data-color-picker]';function Ve(e,{open:t,onClose:n,focusableSelector:r=TP,escapeIgnoreSelectors:o=RP}){l.useEffect(()=>{if(!t)return;const a=e.current,s=a==null?void 0:a.querySelector(r);s==null||s.focus();const u=d=>{if(d.key==="Escape"){if(o&&document.querySelector(o))return;d.preventDefault(),d.stopPropagation(),n();return}if(d.key!=="Tab"||!a)return;const f=[...a.querySelectorAll(r)];if(f.length===0)return;const g=f[0],h=f[f.length-1];d.shiftKey&&document.activeElement===g?(d.preventDefault(),h.focus()):!d.shiftKey&&document.activeElement===h&&(d.preventDefault(),g.focus())};return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[e,o,r,n,t])}function Xn(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function rs(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):Xn(e,t):""}const un="fullscreen",$c="commspliant-html-editor.toolbarCustomization";function Uc(e){const t=e.filter(n=>n!==un);return e.includes(un)?[...t,un]:t}function zu(e,t){if(!t||t.length===0)return Uc(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 f=s-1;f>=0;f--){const g=e[f],h=a.indexOf(g);if(h>=0){d=h+1;break}}a.splice(d,0,u),o.add(u)}return Uc(a)}function DP(e,t){const n=new Map(e.map(s=>[s.id,s])),r=zu(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(f=>!o.has(f));d.length!==0&&a.push({id:s,items:d})}return a}function IP(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 jP(){try{const e=localStorage.getItem($c);return e?IP(JSON.parse(e)):null}catch{return null}}function EP(e){try{if(!e){localStorage.removeItem($c);return}localStorage.setItem($c,JSON.stringify(e))}catch{}}function Ou(e,t){return zu(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function MP(e,t,n,r){const o=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?o.delete(n):o.add(n),{groupOrder:Ou(e,t),hiddenItemIds:[...o]}}function Oh(e,t,n,r){const o=Ou(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===un||r===un)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],[f]=d.splice(s,1);return d.splice(u,0,f),{groupOrder:Uc(d),hiddenItemIds:a}}function Ef(e,t,n,r){const o=Ou(e,t),a=o.filter(d=>d!==un),s=a.indexOf(n),u=s+r;return s<0||u<0||u>=a.length?{groupOrder:o,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:Oh(e,t,n,a[u])}const _P="_backdrop_11w4e_1",NP="_dialog_11w4e_12",LP="_header_11w4e_31",BP="_body_11w4e_39",FP="_group_11w4e_49",HP="_groupDragging_11w4e_55",zP="_groupDropTarget_11w4e_59",OP="_groupHeader_11w4e_64",KP="_groupTitle_11w4e_72",$P="_dragHandle_11w4e_77",UP="_moveButton_11w4e_78",VP="_items_11w4e_119",WP="_item_11w4e_119",GP="_itemIcon_11w4e_135",ZP="_itemTitle_11w4e_144",qP="_itemCheckbox_11w4e_151",YP="_actions_11w4e_155",XP="_action_11w4e_155",JP="_spinnerWrap_11w4e_191",QP="_spinner_11w4e_191",Be={backdrop:_P,dialog:NP,header:LP,body:BP,group:FP,groupDragging:HP,groupDropTarget:zP,groupHeader:OP,groupTitle:KP,dragHandle:$P,moveButton:UP,items:VP,item:WP,itemIcon:GP,itemTitle:ZP,itemCheckbox:qP,actions:YP,action:XP,spinnerWrap:JP,spinner:QP};function eA(){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 tA({open:e,catalog:t,groups:n,settings:r,loading:o=!1,busy:a=!1,disabled:s,onChange:u,onReset:d,onClose:f}){const g=X(),h=l.useId(),y=l.useRef(null),[b,C]=l.useState(null),[x,v]=l.useState(null),k=zu(n.map(j=>j.id),r==null?void 0:r.groupOrder),S=new Set((r==null?void 0:r.hiddenItemIds)??[]),A=new Map(n.map(j=>[j.id,j])),T=k.map(j=>A.get(j)).filter(j=>!!j),D=s||a||o;if(l.useEffect(()=>{e||(C(null),v(null))},[e]),Ve(y,{open:e,onClose:f,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const R=T.map(j=>j.id).filter(j=>j!==un),P=(j,_)=>{if(D||_===un){j.preventDefault();return}j.dataTransfer.setData("text/plain",_),j.dataTransfer.effectAllowed="move",C(_)},M=(j,_)=>{D||_===un||!b||b===_||(j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move"),v(_))},L=(j,_)=>{var G;j.preventDefault();const O=((G=j.dataTransfer)==null?void 0:G.getData("text/plain"))||b;C(null),v(null),!(!O||O===_||D)&&u(Oh(r,n,O,_))},U=()=>{C(null),v(null)};return i.jsx(ke,{children:i.jsx("div",{className:Be.backdrop,role:"presentation",onMouseDown:f,children:i.jsxs("div",{ref:y,className:Be.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:Be.header,id:h,children:g("customizeToolbarDialogTitle")}),i.jsx("div",{className:Be.body,children:o?i.jsx("div",{className:Be.spinnerWrap,role:"status","aria-live":"polite","aria-label":g("customizeToolbarDialogLoading"),children:i.jsx("span",{className:Be.spinner,"aria-hidden":"true"})}):T.map(j=>{const _=t.groups[j.id],O=_?Xn(g,_):j.id,G=j.id===un,Z=R.indexOf(j.id);return i.jsxs("section",{className:[Be.group,b===j.id?Be.groupDragging:"",x===j.id?Be.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":j.id,"aria-label":O,onDragOver:oe=>M(oe,j.id),onDrop:oe=>L(oe,j.id),onDragLeave:()=>{x===j.id&&v(null)},children:[i.jsxs("div",{className:Be.groupHeader,children:[i.jsx("button",{type:"button",className:Be.dragHandle,draggable:!D&&!G,disabled:D||G,"aria-label":g("customizeToolbarDragHandle"),onDragStart:oe=>P(oe,j.id),onDragEnd:U,children:i.jsx(eA,{})}),i.jsx("span",{className:Be.groupTitle,children:O}),i.jsx("button",{type:"button",className:Be.moveButton,disabled:D||G||Z<=0,"aria-label":g("customizeToolbarMoveUp"),onClick:()=>u(Ef(r,n,j.id,-1)),children:"↑"}),i.jsx("button",{type:"button",className:Be.moveButton,disabled:D||G||Z<0||Z>=R.length-1,"aria-label":g("customizeToolbarMoveDown"),onClick:()=>u(Ef(r,n,j.id,1)),children:"↓"})]}),i.jsx("div",{className:Be.items,children:j.items.map(oe=>{const Y=t.items[oe];if(!Y)return null;const J=Y.icon,ie=Xn(g,Y),de=`${h}-${j.id}-${oe}`,te=!S.has(oe);return i.jsxs("label",{className:Be.item,htmlFor:de,children:[i.jsx("span",{className:Be.itemIcon,"aria-hidden":"true",children:J?i.jsx(J,{}):ie.slice(0,2)}),i.jsx("span",{className:Be.itemTitle,children:ie}),i.jsx("input",{id:de,className:Be.itemCheckbox,type:"checkbox",checked:te,disabled:D,"aria-label":`${ie}: ${g("customizeToolbarItemVisible")}`,onChange:E=>u(MP(r,n,oe,E.target.checked))})]},oe)})})]},j.id)})}),i.jsxs("div",{className:Be.actions,children:[i.jsx("button",{type:"button",className:Be.action,disabled:D,onClick:d,children:g("customizeToolbarDialogReset")}),i.jsx("button",{type:"button",className:Be.action,"aria-label":g("customizeToolbarDialogCloseAria"),onClick:f,children:g("customizeToolbarDialogClose")})]})]})})})}function nA(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 rA={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:By,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:Ay,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:Ey,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},Kh=4;function oA({anchorRect:e,floatingWidth:t,floatingHeight:n,pad:r=Kh,minWidth:o=0,matchAnchorWidth:a=!1}){const s=a?Math.max(e.width,t,o):t;let u=e.bottom;u+n>window.innerHeight-r&&(u=Math.max(r,e.top-n));const d=Math.min(Math.max(e.left,r),window.innerWidth-s-r);return a?{top:u,left:d,width:s}:{top:u,left:d}}function bo(e,t,n,{pad:r=Kh,minWidth:o=0,matchAnchorWidth:a=!1,deps:s=[]}={}){const[u,d]=l.useState({top:0,left:0}),f=l.useCallback(()=>{const g=t.current,h=n.current;if(!g)return;const y=g.getBoundingClientRect(),b=Math.max(a?y.width:0,(h==null?void 0:h.offsetWidth)??0,o),C=(h==null?void 0:h.offsetHeight)??0;d(oA({anchorRect:y,floatingWidth:b,floatingHeight:C,pad:r,minWidth:o,matchAnchorWidth:a}))},[t,n,a,o,r]);return l.useLayoutEffect(()=>{if(!e)return;f();const g=()=>f();return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[e,f,...s]),u}const iA="_toolbar_1aggm_1",aA="_menuBar_1aggm_35",sA="_menuBarDesktop_1aggm_43",lA="_brandMark_1aggm_49",cA="_brandMarkIcon_1aggm_56",uA="_menuBarCompact_1aggm_68",dA="_menuWrap_1aggm_91",mA="_menuButton_1aggm_97",fA="_iconButton_1aggm_98",pA="_menuItem_1aggm_99",gA="_hamburgerButton_1aggm_142",hA="_iconNav_1aggm_149",bA="_iconNavMain_1aggm_160",yA="_iconNavEnd_1aggm_169",xA="_iconGroup_1aggm_185",CA="_tooltipTrigger_1aggm_276",wA="_menu_1aggm_35",vA="_submenuWrap_1aggm_305",kA="_submenu_1aggm_305",SA="_submenuTrigger_1aggm_315",PA="_menuOverlay_1aggm_330",AA="_menuOverlayHeader_1aggm_342",TA="_menuOverlayTitle_1aggm_352",RA="_menuOverlayBody_1aggm_358",DA="_menuSeparator_1aggm_409",IA="_icon_1aggm_98",jA="_tooltip_1aggm_276",EA="_tooltipElevated_1aggm_494",se={toolbar:iA,menuBar:aA,menuBarDesktop:sA,brandMark:lA,brandMarkIcon:cA,menuBarCompact:uA,menuWrap:dA,menuButton:mA,iconButton:fA,menuItem:pA,hamburgerButton:gA,iconNav:hA,iconNavMain:bA,iconNavEnd:yA,iconGroup:xA,tooltipTrigger:CA,menu:wA,submenuWrap:vA,submenu:kA,submenuTrigger:SA,menuOverlay:PA,menuOverlayHeader:AA,menuOverlayTitle:TA,menuOverlayBody:RA,menuSeparator:DA,icon:IA,tooltip:jA,tooltipElevated:EA},MA=400,Mf=6,tc=4;function Jn({label:e,children:t,className:n,elevated:r}){const o=l.useRef(null),a=l.useRef(null),s=l.useRef(null),u=l.useRef(!1),d=l.useRef(!1),[f,g]=l.useState(!1),[h,y]=l.useState({top:0,left:0}),b=l.useCallback(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),C=l.useCallback(k=>{if(!(u.current||d.current)){b(),g(!1);return}if(k||d.current){b(),g(!0);return}b(),s.current=setTimeout(()=>{s.current=null,g(!0)},MA)},[b]),x=l.useCallback(()=>{const k=o.current,S=a.current;if(!k||!S)return;const A=k.getBoundingClientRect(),T=S.offsetWidth,D=S.offsetHeight;let R=A.bottom+Mf;R+D>window.innerHeight-tc&&(R=A.top-Mf-D);let P=A.left+A.width/2-T/2;P=Math.min(Math.max(P,tc),window.innerWidth-T-tc),y({top:R,left:P})},[]);l.useEffect(()=>()=>b(),[b]),l.useEffect(()=>{const k=o.current;if(!k)return;const S=()=>{d.current=!0,C(!0)},A=()=>{d.current=!1,C(!1)};return k.addEventListener("focusin",S),k.addEventListener("focusout",A),()=>{k.removeEventListener("focusin",S),k.removeEventListener("focusout",A)}},[C]),l.useLayoutEffect(()=>{if(!f)return;x();const k=()=>x();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[f,e,x]);const v=n?`${se.tooltipTrigger} ${n}`:se.tooltipTrigger;return i.jsxs(i.Fragment,{children:[i.jsx("span",{ref:o,className:v,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,C(!1)},onMouseLeave:()=>{u.current=!1,C(!1)},children:t}),f?i.jsx(ke,{children:i.jsx("span",{ref:a,className:r?`${se.tooltip} ${se.tooltipElevated}`:se.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const _f=8,Nf=["#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"],_A=8;let Vc=[];const Wc=new Set;function Lf(){return Vc}function NA(e){const t=Ke(e);t&&(Vc=[t,...Vc.filter(n=>n!==t)].slice(0,_A),Wc.forEach(n=>n()))}function LA(e){return Wc.add(e),()=>{Wc.delete(e)}}function Ra(e){const t=Ke(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 hr(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 nc({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 f=0;return d!==0&&(s===r?f=(o-a)/d%6:s===o?f=(a-r)/d+2:f=(r-o)/d+4,f*=60,f<0&&(f+=360)),{h:f,s:s===0?0:d/s,v:s}}function rc({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,f=0;return r<60?(u=o,d=a):r<120?(u=a,d=o):r<180?(d=o,f=a):r<240?(d=a,f=o):r<300?(u=a,f=o):(u=o,f=a),{r:Math.round((u+s)*255),g:Math.round((d+s)*255),b:Math.round((f+s)*255)}}function $h(){return typeof window<"u"&&"EyeDropper"in window}async function BA(){if(!$h())return null;const e=window.EyeDropper;try{const t=await new e().open();return Ke(t.sRGBHex)}catch{return null}}const FA="_picker_ag1yo_1",HA="_none_ag1yo_12",zA="_customToggle_ag1yo_13",OA="_eyedrop_ag1yo_14",KA="_swatch_ag1yo_48",$A="_field_ag1yo_49",UA="_grid_ag1yo_54",VA="_recents_ag1yo_55",WA="_sectionLabel_ag1yo_84",GA="_custom_ag1yo_13",ZA="_sv_ag1yo_95",qA="_svThumb_ag1yo_105",YA="_hue_ag1yo_116",XA="_rgbRow_ag1yo_155",JA="_hexRow_ag1yo_156",et={picker:FA,none:HA,customToggle:zA,eyedrop:OA,swatch:KA,field:$A,grid:UA,recents:VA,sectionLabel:WA,custom:GA,sv:ZA,svThumb:qA,hue:YA,rgbRow:XA,hexRow:JA};function QA(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 Ku({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:o,menu:a=!1,fallbackCustom:s="#000000",onChange:u,onCommit:d}){const f=X(),g=l.useId(),h=a?"menuitemradio":"option",y=t?null:e,b=Ra(y??s)??{r:0,g:0,b:0},[C,x]=l.useState(!1),[v,k]=l.useState(()=>nc(b)),[S,A]=l.useState(()=>({r:String(b.r),g:String(b.g),b:String(b.b)})),[T,D]=l.useState(()=>hr(b.r,b.g,b.b)),[R,P]=l.useState(()=>[...Lf()]),M=l.useRef(null),L=l.useRef(hr(b.r,b.g,b.b));l.useEffect(()=>LA(()=>P([...Lf()])),[]),l.useEffect(()=>{const E=Ra(y??s);if(!E)return;const re=nc(E);k(re),A({r:String(E.r),g:String(E.g),b:String(E.b)}),D(hr(E.r,E.g,E.b))},[y,s]);const U=(E,re,pe)=>{E&&(L.current=E),pe&&E&&NA(E),u(E),re&&(d==null||d(E))},j=(E,re,pe)=>{const F=hr(E.r,E.g,E.b);k(nc(E)),A({r:String(E.r),g:String(E.g),b:String(E.b)}),D(F),U(F,re,pe)},_=(E,re,pe)=>{const F=rc(E),Ee=hr(F.r,F.g,F.b);k(E),A({r:String(F.r),g:String(F.g),b:String(F.b)}),D(Ee),U(Ee,re,pe)},O=E=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(E.key))return;const pe=[...E.currentTarget.querySelectorAll("button")],F=pe.findIndex(ze=>ze===document.activeElement);if(F<0)return;E.preventDefault();const Ee=E.key==="ArrowLeft"?-1:E.key==="ArrowRight"?1:E.key==="ArrowUp"?-_f:_f,He=pe[Math.max(0,Math.min(pe.length-1,F+Ee))];He==null||He.focus()},G=(E,re)=>{const pe=M.current;if(!pe||o)return;const F=pe.getBoundingClientRect(),Ee=Math.max(0,Math.min(1,(E.clientX-F.left)/F.width)),He=Math.max(0,Math.min(1,1-(E.clientY-F.top)/F.height));_({h:v.h,s:Ee,v:He},re,re)},Z=E=>{o||(E.currentTarget.setPointerCapture(E.pointerId),G(E,!1))},oe=rc({h:v.h,s:1,v:1}),Y=hr(oe.r,oe.g,oe.b),J=rc(v),ie=hr(J.r,J.g,J.b),de=new Set(Nf),te=R.filter(E=>!de.has(E));return i.jsxs("div",{className:et.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[i.jsx("button",{type:"button",className:et.none,role:h,"aria-checked":a?y===null&&!t:void 0,"aria-selected":a?void 0:y===null&&!t,disabled:o,onClick:()=>U(null,!0,!1),children:n}),i.jsx("div",{className:et.grid,role:a?"group":"none",onKeyDown:O,children:Nf.map(E=>{const re=y===E;return i.jsx("button",{type:"button",className:et.swatch,role:h,"aria-label":E,"aria-checked":a?re:void 0,"aria-selected":a?void 0:re,disabled:o,style:{backgroundColor:E},onMouseDown:pe=>pe.preventDefault(),onClick:()=>U(E,!0,!1)},E)})}),te.length>0?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:et.sectionLabel,children:f("colorRecent")}),i.jsx("div",{className:et.recents,role:a?"group":"none","aria-label":f("colorRecent"),children:te.map(E=>i.jsx("button",{type:"button",className:et.swatch,role:h,"aria-label":E,"aria-checked":a?y===E:void 0,"aria-selected":a?void 0:y===E,disabled:o,style:{backgroundColor:E},onMouseDown:re=>re.preventDefault(),onClick:()=>U(E,!0,!1)},E))})]}):null,i.jsx("button",{type:"button",className:et.customToggle,disabled:o,"aria-expanded":C,onClick:()=>x(E=>!E),children:f("colorCustom")}),C?i.jsxs("div",{className:et.custom,children:[i.jsx("div",{ref:M,className:et.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${Y})`},onPointerDown:Z,onPointerMove:E=>{E.currentTarget.hasPointerCapture(E.pointerId)&&G(E,!1)},onPointerUp:E=>{G(E,!0)},children:i.jsx("span",{className:et.svThumb,style:{left:`${v.s*100}%`,top:`${(1-v.v)*100}%`}})}),i.jsx("input",{className:et.hue,type:"range",min:0,max:360,value:Math.round(v.h),disabled:o,"aria-label":f("colorCustom"),onChange:E=>_({...v,h:Number(E.target.value)},!1,!1),onPointerUp:()=>U(L.current,!0,!0)}),i.jsx("div",{className:et.rgbRow,children:["r","g","b"].map(E=>i.jsxs("div",{className:et.field,children:[i.jsx("label",{htmlFor:`${g}-${E}`,children:f(E==="r"?"colorRgbR":E==="g"?"colorRgbG":"colorRgbB")}),i.jsx("input",{id:`${g}-${E}`,inputMode:"numeric",value:S[E],disabled:o,onChange:re=>{A(pe=>({...pe,[E]:re.target.value}))},onBlur:()=>{const re=QA(S[E]);if(re===null){A({r:String(J.r),g:String(J.g),b:String(J.b)});return}j({...J,[E]:re},!0,!0)},onKeyDown:re=>{re.key==="Enter"&&re.currentTarget.blur()}})]},E))}),i.jsx("div",{className:et.hexRow,children:i.jsxs("div",{className:et.field,children:[i.jsx("label",{htmlFor:`${g}-hex`,children:f("colorHex")}),i.jsx("input",{id:`${g}-hex`,value:T,disabled:o,onChange:E=>D(E.target.value),onBlur:()=>{const E=Ke(T);if(!E){D(ie);return}const re=Ra(E);re&&j(re,!0,!0)},onKeyDown:E=>{E.key==="Enter"&&E.currentTarget.blur()}})]})}),$h()?i.jsx("button",{type:"button",className:et.eyedrop,disabled:o,onClick:()=>{BA().then(E=>{if(!E)return;const re=Ra(E);re&&j(re,!0,!0)})},children:f("colorPickFromScreen")}):null]}):null]})}const eT="_wrap_hfz5s_1",tT="_button_hfz5s_8",nT="_icon_hfz5s_18",rT="_bar_hfz5s_24",oT="_barEmpty_hfz5s_33",iT="_popover_hfz5s_43",br={wrap:eT,button:tT,icon:nT,bar:rT,barEmpty:oT,popover:iT};function Uh({icon:e,value:t,mixed:n,noneKey:r,labelKey:o,ariaKey:a,fallbackCustom:s,disabled:u,onChange:d}){const f=X(),g=l.useId(),h=l.useRef(null),y=l.useRef(null),b=l.useRef(null),[C,x]=l.useState(!1),v=bo(C,y,b);l.useEffect(()=>{if(!C)return;const D=P=>{var L,U;const M=P.target;(L=h.current)!=null&&L.contains(M)||(U=b.current)!=null&&U.contains(M)||x(!1)},R=P=>{var M;P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),x(!1),(M=y.current)==null||M.focus())};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",R,!0)}},[C]);const k=D=>{d(D)},S=`${br.bar}${!t||n?` ${br.barEmpty}`:""}`,A=t&&!n?{backgroundColor:t}:void 0,T=i.jsxs("div",{className:br.wrap,ref:h,children:[i.jsxs("button",{ref:y,type:"button",className:`${se.iconButton} ${br.button}`,"aria-label":f(a),"aria-expanded":C,"aria-haspopup":"listbox","aria-controls":C?g:void 0,disabled:u,onMouseDown:D=>D.preventDefault(),onClick:()=>x(D=>!D),children:[i.jsx(e,{className:`${se.icon} ${br.icon}`}),i.jsx("span",{className:S,style:A})]}),C?i.jsx(ke,{children:i.jsx("div",{ref:b,id:g,className:br.popover,style:{top:v.top,left:v.left},children:i.jsx(Ku,{value:t,mixed:n,noneLabel:f(r),ariaLabel:f(a),disabled:u,fallbackCustom:s,onChange:k,onCommit:()=>x(!1)})})}):null]});return i.jsx(Jn,{label:f(o),children:T})}function aT({commands:e,queries:t,disabled:n}){return i.jsx(Uh,{icon:Jf,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}const sT="_wrap_1vjt0_1",lT="_wrapToolbar_1vjt0_7",cT="_field_1vjt0_12",uT="_trigger_1vjt0_20",dT="_chevron_1vjt0_50",mT="_list_1vjt0_73",fT="_listInline_1vjt0_88",pT="_option_1vjt0_96",gT="_separator_1vjt0_125",qt={wrap:sT,wrapToolbar:lT,field:cT,trigger:uT,chevron:dT,list:mT,listInline:fT,option:pT,separator:gT};function hT({value:e,mixed:t=!1,fonts:n,disabled:r,listId:o,listRef:a,inline:s,style:u,onSelect:d}){const f=X(),g=!t&&e===null;return i.jsxs("ul",{ref:a,id:o,className:s?`${qt.list} ${qt.listInline}`:qt.list,role:"listbox","aria-label":f("commandFontFamilyAria"),style:u,children:[i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:qt.option,role:"option","aria-checked":g,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>d(null),children:f("fontFamilyDefault")})}),i.jsx("li",{className:qt.separator,role:"separator"}),n.map(h=>{const y=!t&&ui(e,h.family);return i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:qt.option,role:"option","aria-checked":y,disabled:r,style:{fontFamily:h.family},onMouseDown:b=>b.preventDefault(),onClick:()=>d(h.family),children:h.name})},h.family)})]})}function bT(e,t,n,r){var o;return t?"":e===null?r:((o=yx(e,n))==null?void 0:o.name)??e}function Vh({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:o,toolbar:a=!1,triggerId:s,onChange:u}){const d=X(),f=l.useId(),g=l.useRef(null),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState(!1),x=bT(e,t,n,d("fontFamilyDefault")),v=bo(b,h,y,{matchAnchorWidth:!0,deps:[n.length]});l.useEffect(()=>{if(!b)return;const S=T=>{var R,P;const D=T.target;(R=g.current)!=null&&R.contains(D)||(P=y.current)!=null&&P.contains(D)||C(!1)},A=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),C(!1))};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",A,!0)}},[b]);const k=i.jsxs("div",{className:`${qt.wrap}${a?` ${qt.wrapToolbar}`:""}`,ref:g,children:[i.jsxs("div",{className:qt.field,ref:h,children:[i.jsx("button",{type:"button",id:s,className:qt.trigger,disabled:r,"aria-label":a?d("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":b?f:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:S=>S.preventDefault(),onClick:()=>C(S=>!S),children:x}),i.jsx("span",{className:qt.chevron,"aria-hidden":"true"})]}),b?i.jsx(ke,{children:i.jsx(hT,{listRef:y,listId:f,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:v.top,left:v.left,minWidth:v.width},onSelect:S=>{u(S),C(!1)}})}):null]});return o?i.jsx(Jn,{label:o,children:k}):k}function yT({commands:e,queries:t,disabled:n}){const r=X(),o=!!(n||!t.isVisualMode());return i.jsx(Vh,{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 xT="_wrap_58i0x_1",CT="_wrapToolbar_58i0x_9",wT="_field_58i0x_14",vT="_input_58i0x_22",kT="_toggle_58i0x_41",ST="_chevron_58i0x_42",PT="_unit_58i0x_80",AT="_list_58i0x_110",TT="_option_58i0x_125",Ue={wrap:xT,wrapToolbar:CT,field:wT,input:vT,toggle:kT,chevron:ST,unit:PT,list:AT,option:TT},RT={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Wh({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:o,tooltip:a,sizeInputId:s,toolbar:u=!1}){const d=X(),f=l.useId(),g=l.useRef(null),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState(()=>e===null?"":fe(e)),[x,v]=l.useState(!1),[k,S]=l.useState(!1),A=bo(k,h,y,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{x||C(e===null?"":fe(e))},[e,x]),l.useEffect(()=>{if(!k)return;const M=U=>{var _,O;const j=U.target;(_=g.current)!=null&&_.contains(j)||(O=y.current)!=null&&O.contains(j)||S(!1)},L=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),S(!1))};return document.addEventListener("pointerdown",M),document.addEventListener("keydown",L,!0),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("keydown",L,!0)}},[k]);const T=M=>{const L=Hx(M,t);if(!L){C(e===null?"":fe(e));return}n(L.value,L.unit),C(fe(L.value))},D=Nx[t],R=k?i.jsx(ke,{children:i.jsx("ul",{ref:y,className:Ue.list,role:"listbox",id:f,style:{top:A.top,left:A.left,minWidth:A.width},children:D.map(M=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ue.option,role:"option","aria-selected":e===M,onMouseDown:L=>L.preventDefault(),onClick:()=>{n(M,t),C(fe(M)),S(!1)},children:fe(M)})},M))})}):null,P=i.jsxs("div",{className:`${Ue.wrap}${u?` ${Ue.wrapToolbar}`:""}`,ref:g,children:[i.jsxs("div",{className:Ue.field,ref:h,children:[i.jsx("input",{id:s,className:Ue.input,value:b,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":k,"aria-controls":f,role:"combobox",inputMode:"decimal",onFocus:()=>v(!0),onBlur:()=>{v(!1),T(b)},onChange:M=>C(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),T(b),S(!1),M.currentTarget.blur()),M.key==="ArrowDown"&&(M.preventDefault(),S(!0))}}),i.jsx("button",{type:"button",className:Ue.toggle,tabIndex:-1,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-expanded":k,"aria-controls":f,onMouseDown:M=>M.preventDefault(),onClick:()=>S(M=>!M)})]}),i.jsxs("div",{className:Ue.field,children:[i.jsx("select",{className:Ue.unit,value:t,disabled:o,"aria-label":d("commandFontSizeUnitAria"),onChange:M=>{r(M.target.value)},children:ru.map(M=>i.jsx("option",{value:M,children:d(RT[M])},M))}),i.jsx("span",{className:Ue.chevron,"aria-hidden":"true"})]}),R]});return a?i.jsx(Jn,{label:a,children:P}):P}function DT({commands:e,queries:t,disabled:n}){const r=X(),o=!!(n||!t.isVisualMode());return i.jsx(Wh,{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 IT({commands:e,queries:t,disabled:n}){return i.jsx(Uh,{icon:Qf,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function jT({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=X(),a=!!(n||!t.isVisualMode());return i.jsx(Ku,{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 ET="_wrap_1gtdc_1",MT="_wrapToolbar_1gtdc_7",_T="_field_1gtdc_12",NT="_trigger_1gtdc_20",LT="_chevron_1gtdc_46",BT="_list_1gtdc_69",FT="_option_1gtdc_84",HT="_separator_1gtdc_113",Tn={wrap:ET,wrapToolbar:MT,field:_T,trigger:NT,chevron:LT,list:BT,option:FT,separator:HT},zT="_backdrop_1p9zk_1",OT="_dialog_1p9zk_12",KT="_dialogWide_1p9zk_31",$T="_header_1p9zk_35",UT="_tabs_1p9zk_43",VT="_tab_1p9zk_43",WT="_body_1p9zk_76",GT="_field_1p9zk_86",ZT="_label_1p9zk_92",qT="_sizeRow_1p9zk_96",YT="_fileRow_1p9zk_102",XT="_fileName_1p9zk_108",JT="_previewImage_1p9zk_115",QT="_marks_1p9zk_125",eR="_mark_1p9zk_125",tR="_actions_1p9zk_140",nR="_actionsSpread_1p9zk_148",rR="_actionsEnd_1p9zk_152",oR="_headerRow_1p9zk_157",iR="_close_1p9zk_170",aR="_nameSection_1p9zk_187",sR="_nameInput_1p9zk_192",lR="_labelRow_1p9zk_209",cR="_help_1p9zk_215",uR="_textInput_1p9zk_233",dR="_fullSelect_1p9zk_245",mR="_error_1p9zk_249",fR="_emptyHint_1p9zk_254",pR="_action_1p9zk_140",gR="_textarea_1p9zk_265",hR="_actionDanger_1p9zk_279",bR="_confirmBody_1p9zk_285",yR="_nestedPanel_1p9zk_294",xR="_spinnerWrap_1p9zk_309",CR="_spinner_1p9zk_309",wR="_actionPrimary_1p9zk_344",vR="_iconButton_1p9zk_358",kR="_select_1p9zk_359",SR="_lengthInput_1p9zk_360",PR="_lengthUnit_1p9zk_361",AR="_group_1p9zk_369",TR="_nestedGroup_1p9zk_379",RR="_subLabel_1p9zk_389",DR="_iconRow_1p9zk_393",IR="_lengthField_1p9zk_425",jR="_sideLabel_1p9zk_431",ER="_lengthRow_1p9zk_435",MR="_sideGrid_1p9zk_463",_R="_shadowGrid_1p9zk_464",p={backdrop:zT,dialog:OT,dialogWide:KT,header:$T,tabs:UT,tab:VT,body:WT,field:GT,label:ZT,sizeRow:qT,fileRow:YT,fileName:XT,previewImage:JT,marks:QT,mark:eR,actions:tR,actionsSpread:nR,actionsEnd:rR,headerRow:oR,close:iR,nameSection:aR,nameInput:sR,labelRow:lR,help:cR,textInput:uR,fullSelect:dR,error:mR,emptyHint:fR,action:pR,textarea:gR,actionDanger:hR,confirmBody:bR,nestedPanel:yR,spinnerWrap:xR,spinner:CR,actionPrimary:wR,iconButton:vR,select:kR,lengthInput:SR,lengthUnit:PR,group:AR,nestedGroup:TR,subLabel:RR,iconRow:DR,lengthField:IR,sideLabel:jR,lengthRow:ER,sideGrid:MR,shadowGrid:_R},Gc={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},NR={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 Bf(){const e=X();return i.jsx("div",{className:p.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:i.jsx("span",{className:p.spinner,"aria-hidden":"true"})})}function Gh({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:o,listRef:a,style:s,customStylesEnabled:u=!1,customStyles:d=[],customStylesLoading:f=!1,onSelect:g,onSelectCustom:h,onAddNew:y}){const b=X(),C=t?null:e,x=u,v=!!(r&&u&&y);return r?i.jsxs(i.Fragment,{children:[Ya.map(k=>i.jsx("button",{type:"button",className:se.menuItem,role:"menuitemradio","aria-checked":C===k,disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>g(k),children:b(Gc[k])},k)),x?i.jsx("div",{role:"separator",className:se.menuSeparator}):null,x&&f?i.jsx(Bf,{}):null,x&&!f?d.map(k=>i.jsx("button",{type:"button",className:se.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:[x&&(f||d.length>0)?i.jsx("div",{role:"separator",className:se.menuSeparator}):null,i.jsxs("button",{type:"button",className:se.menuItem,role:"menuitem","aria-label":b("styleAddNewAria"),disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>y==null?void 0:y(),children:[i.jsx(jy,{className:se.icon}),b("styleAddNew")]})]}):null]}):i.jsxs("ul",{ref:a,className:Tn.list,role:"listbox",id:o,style:s,"aria-label":b("commandParagraphStyleAria"),"aria-busy":x&&f?!0:void 0,children:[Ya.map(k=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Tn.option,role:"option","aria-selected":C===k,disabled:n,style:NR[k],onMouseDown:S=>S.preventDefault(),onClick:()=>g(k),children:b(Gc[k])})},k)),x&&(f||d.length>0)?i.jsx("li",{role:"separator",className:Tn.separator}):null,x&&f?i.jsx("li",{role:"presentation",children:i.jsx(Bf,{})}):null,x&&!f?d.map(k=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Tn.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]})}function LR({commands:e,queries:t,disabled:n}){const r=X(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useRef(null),[d,f]=l.useState(!1),g=!!(n||!t.isVisualMode()),h=t.isParagraphStyleMixed(),y=h?null:t.getParagraphStyle(),b=y?r(Gc[y]):"",C=t.customParagraphStylesEnabled(),x=C?t.getCustomParagraphStyles():[],v=C&&t.isCustomParagraphStylesLoading(),k=bo(d,s,u,{matchAnchorWidth:!0,deps:[x.length,v]});l.useEffect(()=>{if(!d)return;const A=D=>{var P,M;const R=D.target;(P=a.current)!=null&&P.contains(R)||(M=u.current)!=null&&M.contains(R)||f(!1)},T=D=>{D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),f(!1))};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",T,!0),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",T,!0)}},[d]);const S=i.jsxs("div",{className:`${Tn.wrap} ${Tn.wrapToolbar}`,ref:a,children:[i.jsxs("div",{className:Tn.field,ref:s,children:[i.jsx("button",{type:"button",className:Tn.trigger,disabled:g,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?o:void 0,onMouseDown:A=>A.preventDefault(),onClick:()=>f(A=>!A),children:b}),i.jsx("span",{className:Tn.chevron,"aria-hidden":"true"})]}),d?i.jsx(ke,{children:i.jsx(Gh,{listRef:u,listId:o,value:y,mixed:h,disabled:g,customStylesEnabled:C,customStyles:x,customStylesLoading:v,style:{top:k.top,left:k.left,minWidth:k.width},onSelect:A=>{e.setParagraphStyle(A),f(!1)},onSelectCustom:A=>{e.applyCustomParagraphStyle(A),f(!1)}})}):null]});return i.jsx(Jn,{label:r("commandParagraphStyle"),children:S})}function BR({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():[],f=u&&t.isCustomParagraphStylesLoading();return i.jsx(Gh,{menu:!0,value:s,mixed:a,disabled:o,customStylesEnabled:u,customStyles:d,customStylesLoading:f,onSelect:g=>{e.setParagraphStyle(g),r==null||r()},onSelectCustom:g=>{e.openCustomParagraphStyleDialog(g),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const FR={menus:{format:{id:"format",labelKey:"menuFormat",ariaKey:"menuFormatAria"}},submenus:{paragraphStyles:{id:"paragraphStyles",labelKey:"menuParagraphStyles",ariaKey:"menuParagraphStylesAria",panel:BR,enabled:"isVisualMode"},font:{id:"font",labelKey:"menuFont",ariaKey:"menuFontAria"},highlightColor:{id:"highlightColor",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",panel:jT,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:yT,icon:fy,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:LR,icon:Iy,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:DT,icon:gy,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:py,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:uy,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:np,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:ep,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:aT,icon:Jf,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:IT,icon:Qf,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:ry,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:wy,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:Hy,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:Fy,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:ay,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:hy,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:ls,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:ss,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:cs,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Yf,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:Cy,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Ty,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:Xf,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:tp,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},HR={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:ky,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:oy,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:ep,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},pageBackgroundImage:{id:"pageBackgroundImage",command:"openPageBackgroundImage",icon:Zo,labelKey:"commandPageBackgroundImage",ariaKey:"commandPageBackgroundImageAria",enabled:"canInsertPageBackgroundImage"},paragraphBackgroundImage:{id:"paragraphBackgroundImage",command:"openParagraphBackgroundImage",icon:np,labelKey:"commandParagraphBackgroundImage",ariaKey:"commandParagraphBackgroundImageAria",enabled:"canInsertParagraphBackgroundImage"},audio:{id:"audio",command:"openAudioDialog",icon:ny,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:$y,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:yy,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:Ry,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPageBefore:{id:"insertPageBefore",command:"insertPageBefore",icon:Zo,labelKey:"commandInsertPageBefore",ariaKey:"commandInsertPageBeforeAria",enabled:"hasSelectedPage"},insertPageAfter:{id:"insertPageAfter",command:"insertPageAfter",icon:Zo,labelKey:"commandInsertPageAfter",ariaKey:"commandInsertPageAfterAria",enabled:"hasSelectedPage"}}},zR={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:jm,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:Ol,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:Ol,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:Ol,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:zl,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:zl,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:zl,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:Py,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:Oy,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:jm,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:iy,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:Ny,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},OR={menus:{help:{id:"help",labelKey:"menuHelp",ariaKey:"menuHelpAria"}},groups:{},items:{editorHelp:{id:"editorHelp",command:"openHelp",icon:Hl,labelKey:"commandEditorHelp",ariaKey:"commandEditorHelpAria"},keyboardShortcuts:{id:"keyboardShortcuts",command:"openKeyboardShortcuts",icon:Hl,labelKey:"commandKeyboardShortcuts",ariaKey:"commandKeyboardShortcutsAria"},about:{id:"about",command:"openAbout",icon:Hl,labelKey:"commandAbout",ariaKey:"commandAboutAria"}}},KR=["getStarted","file","edit","insert","format","table","view","keyboard"],Zc=[{id:"getStarted",category:"getStarted",titleKey:"helpTopicGetStartedTitle",bodyKey:"helpTopicGetStartedBody",keywordsKey:"helpTopicGetStartedKeywords",related:["switchModes","searchHelp","keyboardShortcuts"]},{id:"switchModes",category:"getStarted",titleKey:"helpTopicSwitchModesTitle",bodyKey:"helpTopicSwitchModesBody",keywordsKey:"helpTopicSwitchModesKeywords",related:["getStarted","preview"]},{id:"searchHelp",category:"getStarted",titleKey:"helpTopicSearchHelpTitle",bodyKey:"helpTopicSearchHelpBody",keywordsKey:"helpTopicSearchHelpKeywords",related:["getStarted","keyboardShortcuts"]},{id:"saveDocument",category:"file",titleKey:"helpTopicSaveDocumentTitle",bodyKey:"helpTopicSaveDocumentBody",keywordsKey:"helpTopicSaveDocumentKeywords",related:["openDocument","printDocument"]},{id:"openDocument",category:"file",titleKey:"helpTopicOpenDocumentTitle",bodyKey:"helpTopicOpenDocumentBody",keywordsKey:"helpTopicOpenDocumentKeywords",related:["saveDocument","printDocument"]},{id:"printDocument",category:"file",titleKey:"helpTopicPrintDocumentTitle",bodyKey:"helpTopicPrintDocumentBody",keywordsKey:"helpTopicPrintDocumentKeywords",related:["saveDocument","preview"]},{id:"undoRedo",category:"edit",titleKey:"helpTopicUndoRedoTitle",bodyKey:"helpTopicUndoRedoBody",keywordsKey:"helpTopicUndoRedoKeywords",related:["keyboardShortcuts","clearFormatting"]},{id:"pageProperties",category:"edit",titleKey:"helpTopicPagePropertiesTitle",bodyKey:"helpTopicPagePropertiesBody",keywordsKey:"helpTopicPagePropertiesKeywords",related:["insertPage","deletePage"]},{id:"deletePage",category:"edit",titleKey:"helpTopicDeletePageTitle",bodyKey:"helpTopicDeletePageBody",keywordsKey:"helpTopicDeletePageKeywords",related:["insertPage","pageProperties"]},{id:"insertTable",category:"insert",titleKey:"helpTopicInsertTableTitle",bodyKey:"helpTopicInsertTableBody",keywordsKey:"helpTopicInsertTableKeywords",related:["tableRowsColumns","mergeCells"]},{id:"insertImage",category:"insert",titleKey:"helpTopicInsertImageTitle",bodyKey:"helpTopicInsertImageBody",keywordsKey:"helpTopicInsertImageKeywords",related:["insertLink","pageProperties"]},{id:"insertLink",category:"insert",titleKey:"helpTopicInsertLinkTitle",bodyKey:"helpTopicInsertLinkBody",keywordsKey:"helpTopicInsertLinkKeywords",related:["insertBookmark","insertImage"]},{id:"insertBookmark",category:"insert",titleKey:"helpTopicInsertBookmarkTitle",bodyKey:"helpTopicInsertBookmarkBody",keywordsKey:"helpTopicInsertBookmarkKeywords",related:["insertLink"]},{id:"insertMedia",category:"insert",titleKey:"helpTopicInsertMediaTitle",bodyKey:"helpTopicInsertMediaBody",keywordsKey:"helpTopicInsertMediaKeywords",related:["insertImage","insertLink"]},{id:"pageBreak",category:"insert",titleKey:"helpTopicPageBreakTitle",bodyKey:"helpTopicPageBreakBody",keywordsKey:"helpTopicPageBreakKeywords",related:["insertPage","printDocument"]},{id:"insertPage",category:"insert",titleKey:"helpTopicInsertPageTitle",bodyKey:"helpTopicInsertPageBody",keywordsKey:"helpTopicInsertPageKeywords",related:["pageBreak","deletePage"]},{id:"insertComment",category:"insert",titleKey:"helpTopicInsertCommentTitle",bodyKey:"helpTopicInsertCommentBody",keywordsKey:"helpTopicInsertCommentKeywords",related:["preview"]},{id:"formatFont",category:"format",titleKey:"helpTopicFormatFontTitle",bodyKey:"helpTopicFormatFontBody",keywordsKey:"helpTopicFormatFontKeywords",related:["paragraphStyles","textColor","keyboardShortcuts"]},{id:"paragraphStyles",category:"format",titleKey:"helpTopicParagraphStylesTitle",bodyKey:"helpTopicParagraphStylesBody",keywordsKey:"helpTopicParagraphStylesKeywords",related:["formatFont","alignLists"]},{id:"textColor",category:"format",titleKey:"helpTopicTextColorTitle",bodyKey:"helpTopicTextColorBody",keywordsKey:"helpTopicTextColorKeywords",related:["formatFont","clearFormatting"]},{id:"alignLists",category:"format",titleKey:"helpTopicAlignListsTitle",bodyKey:"helpTopicAlignListsBody",keywordsKey:"helpTopicAlignListsKeywords",related:["paragraphStyles","formatFont"]},{id:"clearFormatting",category:"format",titleKey:"helpTopicClearFormattingTitle",bodyKey:"helpTopicClearFormattingBody",keywordsKey:"helpTopicClearFormattingKeywords",related:["formatFont","customCss"]},{id:"customCss",category:"format",titleKey:"helpTopicCustomCssTitle",bodyKey:"helpTopicCustomCssBody",keywordsKey:"helpTopicCustomCssKeywords",related:["formatFont","clearFormatting"]},{id:"tableRowsColumns",category:"table",titleKey:"helpTopicTableRowsColumnsTitle",bodyKey:"helpTopicTableRowsColumnsBody",keywordsKey:"helpTopicTableRowsColumnsKeywords",related:["insertTable","mergeCells","keyboardShortcuts"]},{id:"mergeCells",category:"table",titleKey:"helpTopicMergeCellsTitle",bodyKey:"helpTopicMergeCellsBody",keywordsKey:"helpTopicMergeCellsKeywords",related:["insertTable","tableRowsColumns"]},{id:"customizeToolbar",category:"view",titleKey:"helpTopicCustomizeToolbarTitle",bodyKey:"helpTopicCustomizeToolbarBody",keywordsKey:"helpTopicCustomizeToolbarKeywords",related:["zoom","fullscreen"]},{id:"zoom",category:"view",titleKey:"helpTopicZoomTitle",bodyKey:"helpTopicZoomBody",keywordsKey:"helpTopicZoomKeywords",related:["preview","fullscreen"]},{id:"darkMode",category:"view",titleKey:"helpTopicDarkModeTitle",bodyKey:"helpTopicDarkModeBody",keywordsKey:"helpTopicDarkModeKeywords",related:["customizeToolbar"]},{id:"preview",category:"view",titleKey:"helpTopicPreviewTitle",bodyKey:"helpTopicPreviewBody",keywordsKey:"helpTopicPreviewKeywords",related:["printDocument","switchModes"]},{id:"fullscreen",category:"view",titleKey:"helpTopicFullscreenTitle",bodyKey:"helpTopicFullscreenBody",keywordsKey:"helpTopicFullscreenKeywords",related:["zoom","keyboardShortcuts"]},{id:"ruler",category:"view",titleKey:"helpTopicRulerTitle",bodyKey:"helpTopicRulerBody",keywordsKey:"helpTopicRulerKeywords",related:["pageProperties","alignLists"]},{id:"keyboardShortcuts",category:"keyboard",titleKey:"helpTopicKeyboardShortcutsTitle",bodyKey:"helpTopicKeyboardShortcutsBody",keywordsKey:"helpTopicKeyboardShortcutsKeywords",related:["getStarted","undoRedo","formatFont"]}],Ff=Object.fromEntries(Zc.map(e=>[e.id,e]));function Zh(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function $R(e,t){const n=Zh(t);if(n.length===0)return 1;const r=e.title.toLowerCase(),o=e.body.toLowerCase(),a=e.keywords.toLowerCase(),s=`${r} ${o} ${a}`;let u=0;for(const d of n)r.includes(d)&&(u+=30),a.includes(d)&&(u+=20),o.includes(d)&&(u+=10),s.includes(d)&&(u+=5);return u}function UR(e,t){return Zh(t).length===0?e:e.map(r=>({entry:r,score:$R(r,t)})).filter(({score:r})=>r>0).sort((r,o)=>o.score-r.score||r.entry.title.localeCompare(o.entry.title)).map(({entry:r})=>r)}const VR={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:Ky,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:xy,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:dy,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:vy,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:my,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:Dy,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},ruler:{id:"ruler",command:"toggleRuler",icon:Ly,labelKey:"commandRuler",ariaKey:"commandRulerAria",active:"isRulerVisible",toggle:!0},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:My,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:by,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function WR(...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 GR=WR(rA,SP,HR,zR,VR,FR,OR),ZR={menus:[{id:"file",items:["save","open",ve,"print"]},{id:"edit",items:["undo","redo",ve,{submenu:"page",items:["pageProperties",ve,"deletePage"]}]},{id:"view",items:["visual","html",ve,{submenu:"toolbar",items:["customizeToolbar",ve,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},ve,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",ve,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},ve,"lightMode","darkMode",ve,"toggleCommentsVisible","ruler","preview","readAloud","fullscreen"]},{id:"insert",items:["pageBreak",{submenu:"insertPage",items:["insertPageBefore","insertPageAfter"]},ve,"table",ve,"image","pageBackgroundImage","paragraphBackgroundImage","audio","youtube","horizontalRule",ve,"link","bookmark",ve,"insertComment"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},ve,{submenu:"font",items:["fontProperties","customCss",ve,{submenu:"highlightColor",items:[]},ve,"bold","italic","underline","strikethrough"]},ve,"clearFormatting",ve,{submenu:"paragraph",items:["paragraphProperties",ve,"alignLeft","alignCenter","alignRight","alignJustify",ve,"indent","outdent",ve,"bulletList","numberedList"]},ve,"imageProperties"]},{id:"table",items:["table",ve,{submenu:"insertRow",items:["insertRowBefore","insertRowBelow","deleteRow"]},{submenu:"insertColumn",items:["insertColumnBefore","insertColumnAfter","deleteColumn"]},ve,"mergeCells","unmergeCells",ve,"tableProperties","rowProperties","cellProperties"]},{id:"help",items:["editorHelp","keyboardShortcuts",ve,"about"]}],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"]}]},Hf={items:{addComment:{id:"addComment",command:"addComment",icon:Im,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:Im,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:sy,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},qR=["addComment","insertComment","toggleCommentsVisible"],YR=new Set(["insert","view"]);function qh(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!qR.includes(e):!0:!1}function XR(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!YR.has(e):!0:!1}function JR(e,t){const n=t?"hideComments":"showComments",r=Hf.items.toggleCommentsVisible;return{...e,items:{...e.items,...Hf.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function QR(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.findIndex(a=>Zn(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 zf={canUndo:"history",canRedo:"history",isBold:"marks",isItalic:"marks",isUnderline:"marks",isStrikethrough:"marks",getFontSize:"marks",getFontSizeUnit:"marks",isFontSizeMixed:"marks",getFontFamily:"marks",isFontFamilyMixed:"marks",getFontColor:"marks",isFontColorMixed:"marks",getHighlightColor:"marks",isHighlightColorMixed:"marks",getParagraphStyle:"marks",isParagraphStyleMixed:"marks",isAlignLeft:"marks",isAlignCenter:"marks",isAlignRight:"marks",isAlignJustify:"marks",canOutdent:"marks",isBulletList:"marks",isNumberedList:"marks",isFormatBrushActive:"marks",isInTable:"table",canMergeCells:"table",canUnmergeCells:"table",hasTextSelection:"selection",isImageSelected:"selection",isLink:"selection",canReadAloud:"selection",isReadingAloud:"selection"};function eD(){const e={history:0,marks:0,table:0,selection:0,chrome:0},t=new Map;function n(r,o){let a=t.get(r);return a||(a=new Set,t.set(r,a)),a.add(o),()=>{a==null||a.delete(o)}}return{subscribe:n,getSnapshot:r=>e[r],bump(r){e[r]+=1;const o=t.get(r);if(o)for(const a of o)a()}}}function Yh(e){const t=new Set;return e.active&&t.add(zf[e.active]??"chrome"),e.enabled&&t.add(zf[e.enabled]??"chrome"),t.size===0&&t.add("chrome"),[...t]}const Xh=l.createContext(null);function tD({value:e,children:t}){return i.jsx(Xh.Provider,{value:e,children:t})}function Jh(e){const t=l.useContext(Xh),n=l.useMemo(()=>e.join("\0"),[e]),r=l.useMemo(()=>e,[n,e]);l.useSyncExternalStore(o=>{if(!t)return()=>{};const a=r.map(s=>t.subscribe(s,o));return()=>{for(const s of a)s()}},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o})}const Da="fullscreen";function nD(e){const t=[];let n=null;for(const r of e){const o=r.items.filter(a=>a!==Da);o.length>0&&t.push({id:r.id,items:o}),r.items.includes(Da)&&(n={id:Da,items:[Da]})}return{main:t,trailing:n}}const rD=l.memo(function({item:t,itemId:n,commands:r,queries:o,disabled:a,chromeLock:s}){const u=X(),d=l.useMemo(()=>Yh(t),[t]);if(Jh(d),!t.icon||!t.command)return null;const f=t.icon,g=t.command,h=t.enabled?!o[t.enabled]():!1,y=t.active?o[t.active]():void 0;return i.jsx(Jn,{label:t.tooltip??Xn(u,t),children:i.jsx("button",{type:"button",className:se.iconButton,"aria-label":rs(u,t),"aria-pressed":y,disabled:a||(s?qh(n,s):!1)||h,onPointerDown:b=>b.preventDefault(),onMouseDown:b=>b.preventDefault(),onClick:()=>{Jc(r,g)},children:i.jsx(f,{className:se.icon})})})});function oD({groups:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a}){const s=X(),{main:u,trailing:d}=nD(e),f=g=>{const h=t.groups[g.id];return i.jsx("div",{className:se.iconGroup,role:"group","aria-label":h?Xn(s,h):void 0,"data-toolbar-group":g.id,children:g.items.map(y=>{const b=t.items[y];if(!b)return null;const C=b.enabled?!r[b.enabled]():!1;if(b.widget){const x=b.widget;return i.jsx(x,{commands:n,queries:r,disabled:o||C},y)}return!b.icon||!b.command?null:i.jsx(rD,{itemId:y,item:b,commands:n,queries:r,disabled:o,chromeLock:a},y)})},g.id)};return i.jsxs("div",{className:se.iconNav,role:"toolbar","aria-label":s("toolbarAria"),children:[u.length>0?i.jsx("div",{className:se.iconNavMain,children:u.map(f)}):null,d?i.jsx("div",{className:se.iconNavEnd,children:f(d)}):null]})}const iD=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function aD(e){const t={};for(const n of iD){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 sD({menus:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,compact:s,openMenuId:u,onOpenMenuIdChange:d}){const f=X(),[g,h]=l.useState(!1),[y,b]=l.useState({}),C=l.useRef(null),x=l.useRef(null),v=l.useRef(null),k=l.useRef(null),S=l.useCallback(()=>{h(!1),d(null)},[d]);l.useLayoutEffect(()=>{!g||!C.current||b(aD(C.current))},[g]),l.useEffect(()=>{var T;g&&((T=v.current)==null||T.focus())},[g]),l.useEffect(()=>{if(!g)return;const T=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=T}},[g]),l.useEffect(()=>{if(!g)return;const T=R=>{var P;if(R.key==="Escape"){if(R.preventDefault(),R.stopPropagation(),u){d(null);return}S(),(P=x.current)==null||P.focus()}},D=R=>{var P;k.current&&!k.current.contains(R.target)&&(S(),(P=x.current)==null||P.focus())};return document.addEventListener("keydown",T,!0),document.addEventListener("pointerdown",D),()=>{document.removeEventListener("keydown",T,!0),document.removeEventListener("pointerdown",D)}},[g,u,d,S]);const A=T=>e.map(D=>{const R=t.menus[D.id];return R?i.jsx(cD,{def:R,itemIds:D.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:T,open:(T==="overlay"||!g)&&u===D.id,onOpenChange:P=>d(P?D.id:null),onItemRun:T==="overlay"?()=>{var P;S(),(P=x.current)==null||P.focus()}:void 0},`${T}-${D.id}`):null});return i.jsxs("div",{className:se.menuBar,ref:C,children:[i.jsx(Jn,{label:f("brandMarkAria"),children:i.jsx("span",{className:se.brandMark,role:"img","aria-label":f("brandMarkAria"),children:i.jsx(ly,{className:se.brandMarkIcon})})}),i.jsx("div",{className:se.menuBarCompact,hidden:s===void 0?void 0:!s,children:i.jsx(Jn,{label:f("menuHamburgerAria"),children:i.jsx("button",{ref:x,type:"button",className:`${se.menuButton} ${se.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":g,"aria-label":f("menuHamburgerAria"),disabled:o||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(g){S();return}d(null),h(!0)},children:i.jsx(Sy,{className:se.icon})})})}),i.jsx("div",{className:se.menuBarDesktop,hidden:s===void 0?void 0:s,children:A("dropdown")}),g?i.jsx(ke,{children:i.jsx("div",{className:se.toolbar,"data-menu-overlay-portal":"",style:y,children:i.jsxs("div",{ref:k,className:se.menuOverlay,role:"dialog","aria-modal":"true","aria-label":f("menuOverlayAria"),children:[i.jsxs("div",{className:se.menuOverlayHeader,children:[i.jsx("span",{className:se.menuOverlayTitle,children:f("menuOverlayAria")}),i.jsx("button",{ref:v,type:"button",className:se.iconButton,"aria-label":f("menuCloseAria"),onClick:()=>{var T;S(),(T=x.current)==null||T.focus()},children:i.jsx(Je,{className:se.icon})})]}),i.jsx("div",{className:se.menuOverlayBody,children:A("overlay")})]})})}):null]})}function os(e,t){var n,r;if(Gn(e))return!1;if(Zn(e)){const o=(n=t.submenus)==null?void 0:n[e.submenu];return o?o.panel?!0:e.items.some(a=>os(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function lD(e,t,n){if(!Gn(e[t])||!e.slice(t+1).some(a=>os(a,n)))return!1;let o=!1;for(let a=t-1;a>=0;a--){const s=e[a];if(Gn(s)){o=!0;continue}if(os(s,n))return!o}return!1}function cD({def:e,itemIds:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,open:d,onOpenChange:f,onItemRun:g}){const h=X(),y=l.useRef(null),b=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[C,x]=l.useState(null);l.useEffect(()=>{d||x(null)},[d]),l.useEffect(()=>{if(!d||u==="overlay")return;const k=A=>{y.current&&!y.current.contains(A.target)&&f(!1)},S=A=>{if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),C){x(null);return}f(!1)}};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",S,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",S,!0)}},[d,C,f,u]);const v=()=>{f(!1),g==null||g()};return i.jsxs("div",{className:se.menuWrap,ref:y,children:[i.jsx("button",{type:"button",className:se.menuButton,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":rs(h,e),disabled:a||(s?XR(e.id,s):!1),onClick:()=>f(!d),children:Xn(h,e)}),d?i.jsx("div",{className:se.menu,role:"menu",id:b,onMouseDown:k=>k.preventDefault(),children:i.jsx(Qh,{entries:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,onClose:v,openSubmenuId:C,onOpenSubmenuIdChange:x})}):null]})}function Qh({entries:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:d,onOpenSubmenuIdChange:f}){return i.jsx(i.Fragment,{children:e.map((g,h)=>{if(Gn(g))return lD(e,h,t)?i.jsx("div",{role:"separator",className:se.menuSeparator},`separator-${h}`):null;if(Zn(g))return i.jsx(dD,{entry:g,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d===g.submenu,onOpenChange:b=>f==null?void 0:f(b?g.submenu:null)},`submenu-${g.submenu}-${h}`);const y=t.items[g];return!y||!y.command?null:i.jsx(uD,{item:y,commands:n,queries:r,disabled:o,chromeLock:a,onClose:u},g)})})}function uD({item:e,commands:t,queries:n,disabled:r,chromeLock:o,onClose:a}){const s=X(),u=l.useMemo(()=>Yh(e),[e]);if(Jh(u),!e.command)return null;const d=e.icon,f=e.command,g=e.active?n[e.active]():void 0,h=e.enabled?!n[e.enabled]():!1,y=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return i.jsxs("button",{type:"button",role:y,className:se.menuItem,"aria-checked":g,disabled:r||(o?qh(e.id,o):!1)||h,onClick:()=>{a(),Jc(t,f)},children:[d?i.jsx(d,{className:se.icon}):null,Xn(s,e)]})}function dD({entry:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d,onOpenChange:f}){var R;const g=X(),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState(null),x=(R=t.submenus)==null?void 0:R[e.submenu],v=s==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,k=x==null?void 0:x.panel,S=x!=null&&x.enabled?!r[x.enabled]():!1,A=s==="overlay";if(l.useEffect(()=>{d||C(null)},[d]),!x||!k&&!e.items.some(P=>os(P,t)))return null;const T=P=>{(P.key==="ArrowRight"||P.key==="Enter"||P.key===" ")&&(P.preventDefault(),P.stopPropagation(),f(!0),requestAnimationFrame(()=>{var L;const M=(L=y.current)==null?void 0:L.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');M==null||M.focus()}))},D=P=>{var M;P.key==="ArrowLeft"&&(P.preventDefault(),P.stopPropagation(),f(!1),(M=h.current)==null||M.focus())};return i.jsxs("div",{className:se.submenuWrap,onMouseEnter:A?void 0:()=>f(!0),onMouseLeave:A?void 0:()=>f(!1),children:[i.jsx("button",{ref:h,type:"button",role:"menuitem",className:`${se.menuItem} ${se.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":v,"aria-label":rs(g,x),disabled:o||S||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>f(A?!d:!0),onKeyDown:T,children:Xn(g,x)}),d?i.jsx("div",{ref:y,className:`${se.menu} ${se.submenu}`,role:"menu",id:v,"aria-label":rs(g,x),onMouseDown:P=>P.preventDefault(),onKeyDown:D,children:k?i.jsx(k,{commands:n,queries:r,disabled:o||S,onMenuClose:u}):i.jsx(Qh,{entries:e.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:b,onOpenSubmenuIdChange:C})}):null]})}const qc=l.memo(function({catalog:t,layout:n,commands:r,queries:o,queryRevisions:a,disabled:s,chromeLock:u,menuVisible:d=!0,toolbarVisible:f=!0,compact:g,position:h="top"}){const[y,b]=l.useState(null);if(!d&&!f)return null;const C=i.jsxs("div",{className:se.toolbar,"data-compact":g?"":void 0,"data-toolbar-position":h,children:[d?i.jsx(sD,{menus:n.menus,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u,compact:g,openMenuId:y,onOpenMenuIdChange:b}):null,f?i.jsx(oD,{groups:n.iconGroups,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u}):null]});return a?i.jsx(tD,{value:a,children:C}):C});function mD(e,t){return t?e:{...e,menus:e.menus.map(n=>n.id==="insert"?{...n,items:n.items.filter(r=>!(Zn(r)&&r.submenu==="insertPage"))}:n.id==="edit"?{...n,items:n.items.map(r=>{if(!Zn(r)||r.submenu!=="page")return r;let o=r.items.filter(a=>a!=="deletePage");return o.at(-1)===ve&&(o=o.slice(0,-1)),{...r,items:o}})}:n)}}function li(e){return Yp(tt(e))}const fD=1.5,oc=384;function pD(e,t=16){return e>0?fD*t:0}function eb(e,t,n=16){const r=pD(t,n);if(!li(e))return oc+r;const o=tt(e),a=go(o,!1);return a?On(a.height,oc)+r:oc+r}function Go(e,t){const n=[0];for(let r=0;r<e;r+=1)n.push(n[r]+t(r));return n}function gD(){const e=new Map;return{get(t,n){return e.get(t)??eb(n,t)},set(t,n){n>0&&e.set(t,n)},clear(){e.clear()},invalidateFrom(t){for(const n of[...e.keys()])n>=t&&e.delete(n)}}}const hD=2;function tb(e,t,n){if(n<=0)return 0;let r=0,o=n-1,a=0;for(;r<=o;){const s=r+o>>1;(t[s+1]??0)>e?(a=s,o=s-1):r=s+1}return a}function nb(e,t,n){if(n<=0)return-1;let r=0,o=n-1,a=n-1;for(;r<=o;){const s=r+o>>1;(t[s]??0)<e?(a=s,r=s+1):o=s-1}return a}function Of(e,t,n,r,o,a,s){if(r<=0)return{startIndex:0,endIndex:-1,topSpacerHeight:0,bottomSpacerHeight:0};const u=n[r]??0;if(u<=t)return{startIndex:0,endIndex:r-1,topSpacerHeight:0,bottomSpacerHeight:0};const d=e+t,f=tb(e,n,r),g=nb(d,n,r);let h=Math.max(0,f-o),y=Math.min(r-1,g+o);s&&(h=Math.min(h,a),y=Math.max(y,a));const b=n[h]??0,C=u-(n[y+1]??u);return{startIndex:h,endIndex:y,topSpacerHeight:b,bottomSpacerHeight:C}}function bD({scrollElementRef:e,pageCount:t,getRowHeight:n,overscan:r=hD,activePageIndex:o,pinActivePage:a=!0}){const s=l.useRef(n);s.current=n;const u=l.useRef(new Map),[d,f]=l.useState(0);l.useLayoutEffect(()=>{u.current.clear()},[t]);const g=l.useCallback(S=>{const A=u.current.get(S),T=s.current(S);return A!==void 0?Math.max(A,T):T},[d]),h=l.useMemo(()=>Go(t,g),[t,g]),[y,b]=l.useState(()=>{const S=Go(t,A=>s.current(A));return Of(0,300,S,t,r,o,a)}),C=l.useCallback(()=>{const S=e.current;if(!S||t<=0)return;const A=S.clientHeight>0?S.clientHeight:300,T=Go(t,g);b(Of(S.scrollTop,A,T,t,r,o,a))},[o,r,t,a,g,e]);l.useLayoutEffect(()=>{C()},[C,h,o,t]),l.useLayoutEffect(()=>{const S=e.current;if(!S)return;const A=()=>C();S.addEventListener("scroll",A,{passive:!0});let T;return typeof ResizeObserver<"u"&&(T=new ResizeObserver(()=>C()),T.observe(S)),C(),()=>{S.removeEventListener("scroll",A),T==null||T.disconnect()}},[e,C]);const x=l.useCallback((S,A)=>{if(A<=0)return;const T=u.current.get(S);T!==void 0&&Math.abs(T-A)<1||(u.current.set(S,A),f(D=>D+1))},[]),v=l.useCallback(S=>{const A=e.current;if(!A||S<0||S>=t)return;const T=Go(t,g);A.scrollTop=T[S]??0,C()},[t,g,e,C]),k=l.useMemo(()=>{if(y.endIndex<y.startIndex)return[];const S=[];for(let A=y.startIndex;A<=y.endIndex;A+=1)S.push(A);return S},[y.endIndex,y.startIndex]);return{...y,visibleIndices:k,scrollToIndex:v,notifyRowMeasured:x}}function $u(){return{firstLineIndentPx:0,leftIndentPx:0,rightIndentPx:0,mixed:!1}}function is(e){const t=In(e);if(t.length===0)return $u();let n=null,r=null,o=null,a=!1;for(const s of t){const u=s.style.textIndent,d=s.style.marginLeft,f=s.style.marginRight,g=u?On(u,0):0,h=d?On(d,0):0,y=f?On(f,0):0;n===null?(n=g,r=h,o=y):(Math.abs(n-g)>1||Math.abs((r??0)-h)>1||Math.abs((o??0)-y)>1)&&(a=!0)}return{firstLineIndentPx:n??0,leftIndentPx:r??0,rightIndentPx:o??0,mixed:a}}function yD(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 xD(e,t){return nr(e,()=>{let n=Rr(e);if(n.length===0){const a=yD(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=je(Gl(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=je(Gl(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=je(Gl(t.rightIndentPx,r));a.style.marginRight!==s&&(a.style.marginRight=s,o=!0)}xt(a)}return o})}const rb=24,Qo=48;function ob(e,t){const n=mi(tt(t));return{pageWidthPx:e.offsetWidth,pageHeightPx:e.offsetHeight,marginsPx:{top:On(n.top,0),right:On(n.right,0),bottom:On(n.bottom,0),left:On(n.left,0)}}}function CD(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 wD(e,t,n,r,o=!0,a=1){const[s,u]=l.useState({}),[d,f]=l.useState($u()),g=l.useCallback(y=>s[y]??null,[s]),h=l.useCallback(()=>{const y=e.current;if(!o||!y)return;const b={};for(const x of n){const v=Ye(y,x);if(!v)continue;const k=t[x]??t[0]??"";b[x]=ob(v,k)}u(x=>{const v={...x,...b};return CD(x,v)?x:v});const C=Ye(y,r());C&&f(is(C))},[e,o,r,n,t]);return l.useLayoutEffect(()=>{if(!o)return;const y=requestAnimationFrame(h);return()=>cancelAnimationFrame(y)},[o,r,n,t,a,h]),l.useLayoutEffect(()=>{if(!o||typeof ResizeObserver>"u")return;const y=e.current;if(!y)return;const b=new ResizeObserver(()=>h());for(const C of n){const x=Ye(y,C);x&&b.observe(x)}return()=>b.disconnect()},[e,o,n,h]),l.useLayoutEffect(()=>{if(!o)return;const y=()=>{const b=e.current;if(!b)return;const C=Ye(b,r());C&&f(is(C))};return document.addEventListener("selectionchange",y),()=>document.removeEventListener("selectionchange",y)},[e,o,r]),{pageGeometries:s,geometryForPage:g,indentState:d,refresh:h}}const vD="_rulerRoot_j57vt_5",kD="_horizontalRulerGroup_j57vt_22",SD="_horizontalRulerTrack_j57vt_28",PD="_horizontalRulerShelf_j57vt_42",AD="_horizontalInner_j57vt_51",TD="_dragEdgeLeft_j57vt_63",RD="_dragEdgeRight_j57vt_73",DD="_dragEdgeActive_j57vt_85",ID="_verticalRuler_j57vt_92",jD="_verticalInner_j57vt_102",ED="_dragEdgeTop_j57vt_114",MD="_dragEdgeBottom_j57vt_124",_D="_dragEdgeActiveV_j57vt_136",ND="_tickH_j57vt_143",LD="_tickV_j57vt_152",BD="_tickLabelH_j57vt_161",FD="_tickLabelV_j57vt_175",HD="_arrowIconWrapper_j57vt_192",zD="_arrowDown_j57vt_203",OD="_arrowGlyph_j57vt_211",KD="_arrowActive_j57vt_220",$D="_arrowUp_j57vt_225",UD="_rulerTooltip_j57vt_249",De={rulerRoot:vD,horizontalRulerGroup:kD,horizontalRulerTrack:SD,horizontalRulerShelf:PD,horizontalInner:AD,dragEdgeLeft:TD,dragEdgeRight:RD,dragEdgeActive:DD,verticalRuler:ID,verticalInner:jD,dragEdgeTop:ED,dragEdgeBottom:MD,dragEdgeActiveV:_D,tickH:ND,tickV:LD,tickLabelH:BD,tickLabelV:FD,arrowIconWrapper:HD,arrowDown:zD,arrowGlyph:OD,arrowActive:KD,arrowUp:$D,rulerTooltip:UD},ic=({type:e,active:t=!1,className:n="",style:r,title:o,"aria-label":a,onPointerDown:s,"data-testid":u})=>{const d=e==="down"?De.arrowDown:De.arrowUp;return i.jsx("div",{className:`${De.arrowIconWrapper} ${d} ${t?De.arrowActive:""} ${n}`,style:r,title:o,"aria-label":a||o,onPointerDown:s,"data-testid":u,children:i.jsx("div",{className:De.arrowGlyph})})};function ib(){const[e,t]=l.useState(null),[n,r]=l.useState(null),o=l.useCallback((a,s,u)=>{s.preventDefault(),s.stopPropagation(),t(a);const d=Number.isFinite(s.clientX)?s.clientX:0,f=Number.isFinite(s.clientY)?s.clientY:0,g=s.altKey,h=b=>{var k;const C=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,v=u.updateDragState(C,x,b.altKey);r(v),(k=u.onPreview)==null||k.call(u,v)},y=b=>{const C=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,v=u.updateDragState(C,x,b.altKey);window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),t(null),r(null),u.onCommit(v)};r(u.updateDragState(d,f,g)),window.addEventListener("pointermove",h),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},[]);return{activeTarget:e,dragPreview:n,startPointerDrag:o}}const VD=({geometry:e,indentState:t,unit:n="in",zoomScale:r=1,onMarginChange:o,onMarginPreview:a,onIndentChange:s})=>{const u=X(),{activeTarget:d,dragPreview:f,startPointerDrag:g}=ib(),h=(e==null?void 0:e.pageWidthPx)??816,y=(e==null?void 0:e.marginsPx.left)??96,b=(e==null?void 0:e.marginsPx.right)??96,C=r>0?r:1,x=(f==null?void 0:f.marginLeft)??y,v=(f==null?void 0:f.marginRight)??b,k=(f==null?void 0:f.firstLineIndentPx)??t.firstLineIndentPx,S=(f==null?void 0:f.leftIndentPx)??t.leftIndentPx,A=(f==null?void 0:f.rightIndentPx)??t.rightIndentPx,T=Math.max(0,h-x-v),D=!t.mixed,R=l.useMemo(()=>Vp(h,x,n),[h,x,n]),P=l.useCallback((_,O)=>{const G=Number.isFinite(O.clientX)?O.clientX:0;Number.isFinite(O.clientY)&&O.clientY,g(_.type,O,{updateDragState:(Z,oe,Y)=>{const J=(Z-G)/C;let ie=0;const de={target:_.type,marginLeft:y,marginRight:b,firstLineIndentPx:t.firstLineIndentPx,leftIndentPx:t.leftIndentPx,rightIndentPx:t.rightIndentPx,measurementPx:0,clientX:Z,clientY:oe};if(_.type==="margin-left"){const te=Math.max(0,Math.min(h-b-Qo,_.startMarginPx+J)),E=yr(te,n,Y,0);de.marginLeft=E,ie=E}else if(_.type==="margin-right"){const te=Math.max(0,Math.min(h-y-Qo,_.startMarginPx-J)),E=yr(te,n,Y,0);de.marginRight=E,ie=E}else if(_.type==="first-line-indent"){const te=-_.startLeftIndentPx,E=h-y-b-_.startLeftIndentPx-Qo,re=Math.max(te,Math.min(E,_.startFirstLinePx+J)),pe=yr(re,n,Y,0);de.firstLineIndentPx=pe,ie=pe}else if(_.type==="left-indent"){const te=Math.max(0,_.startLeftIndentPx+J),E=yr(te,n,Y,0);de.leftIndentPx=E,de.firstLineIndentPx=_.startFirstLinePx,ie=E}else if(_.type==="right-indent"){const te=Math.max(0,_.startRightIndentPx-J),E=yr(te,n,Y,0);de.rightIndentPx=E,ie=E}return de.measurementPx=ie,de},onPreview:Z=>{_.type==="margin-left"?a==null||a({left:Z.marginLeft}):_.type==="margin-right"&&(a==null||a({right:Z.marginRight}))},onCommit:Z=>{_.type==="margin-left"?o==null||o({left:Z.marginLeft}):_.type==="margin-right"?o==null||o({right:Z.marginRight}):_.type==="first-line-indent"?s==null||s({firstLineIndentPx:Z.firstLineIndentPx}):_.type==="left-indent"?s==null||s({leftIndentPx:Z.leftIndentPx}):_.type==="right-indent"&&(s==null||s({rightIndentPx:Z.rightIndentPx}))}})},[y,b,h,n,C,t,o,a,s,g]),M=x+S,L=M+k,U=h-v-A,j=h*C;return i.jsxs("div",{className:`${De.rulerRoot} ${De.horizontalRulerGroup}`,style:{width:`${j}px`},"data-testid":"horizontal-ruler",children:[i.jsxs("div",{className:De.horizontalRulerTrack,children:[i.jsxs("div",{className:De.horizontalInner,style:{left:`${x*C}px`,width:`${T*C}px`},"data-testid":"ruler-printable-area",children:[i.jsx("div",{className:`${De.dragEdgeLeft} ${d==="margin-left"?De.dragEdgeActive:""}`,title:u("rulerMarginLeft"),"aria-label":u("rulerMarginLeft"),"data-testid":"ruler-margin-splitter-left",onPointerDown:_=>P({type:"margin-left",startMarginPx:y},_)}),i.jsx("div",{className:`${De.dragEdgeRight} ${d==="margin-right"?De.dragEdgeActive:""}`,title:u("rulerMarginRight"),"aria-label":u("rulerMarginRight"),"data-testid":"ruler-margin-splitter-right",onPointerDown:_=>P({type:"margin-right",startMarginPx:b},_)})]}),R.map((_,O)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:De.tickH,style:{left:`${_.positionPx*C}px`,height:`${_.height}px`}}),_.label?i.jsx("span",{className:De.tickLabelH,style:{left:`${_.positionPx*C}px`},children:_.label}):null]},O)),D?i.jsxs(i.Fragment,{children:[i.jsx(ic,{type:"down",style:{left:`${L*C}px`},active:d==="first-line-indent",title:u("rulerFirstLineIndent"),"aria-label":u("rulerFirstLineIndent"),"data-testid":"ruler-first-line-indent",onPointerDown:_=>P({type:"first-line-indent",startFirstLinePx:t.firstLineIndentPx,startLeftIndentPx:t.leftIndentPx},_)}),i.jsx(ic,{type:"up",style:{left:`${M*C}px`},active:d==="left-indent",title:u("rulerLeftIndent"),"aria-label":u("rulerLeftIndent"),"data-testid":"ruler-left-indent",onPointerDown:_=>P({type:"left-indent",startLeftIndentPx:t.leftIndentPx,startFirstLinePx:t.firstLineIndentPx},_)}),i.jsx(ic,{type:"up",style:{left:`${U*C}px`},active:d==="right-indent",title:u("rulerRightIndent"),"aria-label":u("rulerRightIndent"),"data-testid":"ruler-right-indent",onPointerDown:_=>P({type:"right-indent",startRightIndentPx:t.rightIndentPx},_)})]}):null]}),i.jsx("div",{className:De.horizontalRulerShelf,"aria-hidden":!0}),f?i.jsx("div",{className:De.rulerTooltip,style:{left:f.clientX,top:f.clientY},"data-testid":"ruler-drag-tooltip",children:Up(f.measurementPx,n)}):null]})},WD=({geometry:e,unit:t="in",zoomScale:n=1,onMarginChange:r,onMarginPreview:o})=>{const a=X(),{activeTarget:s,dragPreview:u,startPointerDrag:d}=ib(),f=(e==null?void 0:e.pageHeightPx)??1056,g=(e==null?void 0:e.marginsPx.top)??96,h=(e==null?void 0:e.marginsPx.bottom)??96,y=n>0?n:1,b=(u==null?void 0:u.marginTop)??g,C=(u==null?void 0:u.marginBottom)??h,x=Math.max(0,f-b-C),v=l.useMemo(()=>Vp(f,b,t),[f,b,t]),k=l.useCallback((S,A)=>{Number.isFinite(A.clientX)&&A.clientX;const T=Number.isFinite(A.clientY)?A.clientY:0;d(S.type,A,{updateDragState:(D,R,P)=>{const M=(R-T)/y,L={target:S.type,marginTop:g,marginBottom:h,measurementPx:0,clientX:D,clientY:R};if(S.type==="margin-top"){const U=Math.max(0,Math.min(f-h-Qo,S.startMarginPx+M)),j=yr(U,t,P,0);L.marginTop=j,L.measurementPx=j}else if(S.type==="margin-bottom"){const U=Math.max(0,Math.min(f-g-Qo,S.startMarginPx-M)),j=yr(U,t,P,0);L.marginBottom=j,L.measurementPx=j}return L},onPreview:D=>{S.type==="margin-top"?o==null||o({top:D.marginTop}):S.type==="margin-bottom"&&(o==null||o({bottom:D.marginBottom}))},onCommit:D=>{S.type==="margin-top"?r==null||r({top:D.marginTop}):S.type==="margin-bottom"&&(r==null||r({bottom:D.marginBottom}))}})},[g,h,f,t,y,r,o,d]);return i.jsxs("div",{className:`${De.rulerRoot} ${De.verticalRuler}`,style:{height:`${f}px`},"data-testid":"vertical-ruler",children:[i.jsxs("div",{className:De.verticalInner,style:{top:`${b}px`,height:`${x}px`},"data-testid":"ruler-printable-area-vertical",children:[i.jsx("div",{className:`${De.dragEdgeTop} ${s==="margin-top"?De.dragEdgeActiveV:""}`,title:a("rulerMarginTop"),"aria-label":a("rulerMarginTop"),"data-testid":"ruler-margin-splitter-top",onPointerDown:S=>k({type:"margin-top",startMarginPx:g},S)}),i.jsx("div",{className:`${De.dragEdgeBottom} ${s==="margin-bottom"?De.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,A)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:De.tickV,style:{top:`${S.positionPx}px`,width:`${S.height}px`}}),S.label?i.jsx("span",{className:De.tickLabelV,style:{top:`${S.positionPx}px`},children:S.label}):null]},A)),u?i.jsx("div",{className:De.rulerTooltip,style:{left:u.clientX,top:u.clientY},"data-testid":"ruler-drag-tooltip",children:Up(u.measurementPx,t)}):null]})},GD="_root_ofshu_1",ZD="_fullscreen_ofshu_36",qD="_exitFullscreen_ofshu_48",YD="_exitFullscreenIcon_ofshu_79",XD="_menuChrome_ofshu_94",JD="_body_ofshu_106",QD="_iconChrome_ofshu_136",eI="_workspace_ofshu_181",tI="_workspacePageSized_ofshu_193",nI="_workspaceWithRuler_ofshu_197",rI="_pageCanvasViewport_ofshu_201",oI="_multiPageRulerLayer_ofshu_211",iI="_multiPageContainer_ofshu_234",aI="_pageZoomContent_ofshu_244",sI="_htmlFileDropOverlay_ofshu_262",lI="_surface_ofshu_276",cI="_visual_ofshu_283",uI="_pageBlock_ofshu_341",dI="_pageBlockFluid_ofshu_348",mI="_pageSurfaceRulerGutter_ofshu_357",fI="_pageSurface_ofshu_357",pI="_htmlModeShell_ofshu_378",gI="_html_ofshu_262",Ce={root:GD,fullscreen:ZD,exitFullscreen:qD,exitFullscreenIcon:YD,menuChrome:XD,body:JD,iconChrome:QD,workspace:eI,workspacePageSized:tI,workspaceWithRuler:nI,pageCanvasViewport:rI,multiPageRulerLayer:oI,multiPageContainer:iI,pageZoomContent:aI,htmlFileDropOverlay:sI,surface:lI,visual:cI,pageBlock:uI,pageBlockFluid:dI,pageSurfaceRulerGutter:mI,pageSurface:fI,htmlModeShell:pI,html:gI};function ab(e){if(e!==1)return{zoom:e,"--page-zoom":String(e)}}function sb({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}){if(!e)return null;const d=rb;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(VD,{geometry:t,indentState:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u})]})})}function lb({showVerticalRuler:e=!1,pageSized:t=!1,geometry:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:u,pageBlockStyle:d,pageBlockRef:f}){const g=o>0?o:1,h=e?rb/g:0;return i.jsxs("div",{ref:f,className:`${Ce.pageBlock} ${t?"":Ce.pageBlockFluid}`,style:d,children:[i.jsx("div",{className:Ce.pageSurfaceRulerGutter,style:{width:`${h}px`,flex:`0 0 ${h}px`},children:e?i.jsx(WD,{geometry:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s}):null}),u]})}function hI({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(sb,{showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}),i.jsx("div",{className:Ce.pageZoomContent,style:ab(o),children:i.jsx(lb,{showVerticalRuler:e,pageSized:e,geometry:t,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:d})})]})}const bI=l.memo(function({index:t,pageHtml:n,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,placeholder:d,disabled:f,visualEditorAria:g,onActivate:h,onPointerDown:y,onPageChange:b,onPageFlush:C,suppressPageFlushRef:x,onMeasured:v,onMarginChange:k,onMarginPreview:S,onMouseUp:A,onContextMenu:T,onRulerRefresh:D}){const R=l.useRef(null),P=l.useRef(null),M=l.useRef(""),L=l.useRef(!1),U=l.useRef(C);U.current=C;const j=l.useRef(v);j.current=v,l.useLayoutEffect(()=>{const O=P.current;if(!O||!j.current)return;const G=()=>{var oe;return(oe=j.current)==null?void 0:oe.call(j,t,O.offsetHeight)};if(G(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(G);return Z.observe(O),()=>Z.disconnect()},[t,n,o,r]);const _=l.useCallback(O=>{R.current=O,O&&(M.current=O.innerHTML)},[]);return l.useLayoutEffect(()=>()=>{x!=null&&x.current||!L.current||!U.current||U.current(t,M.current)},[t,x]),i.jsx(lb,{pageBlockRef:P,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,pageBlockStyle:{marginTop:t>0?"1.5rem":"0"},onMarginChange:O=>{k==null||k(t,O)},onMarginPreview:O=>{S==null||S(t,O)},children:i.jsx("div",{ref:_,className:`${Ce.surface} ${Ce.visual} ${o?Ce.pageSurface:""}`,[Pr]:"","data-page-index":t,contentEditable:!f,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":g,"aria-disabled":f||void 0,"data-placeholder":t===0?d:void 0,onFocus:O=>{const G=O.currentTarget;ai(G),so(G),h(t)},onPointerDown:O=>y(t,O),onMouseUp:A,onContextMenu:T,onInput:O=>{const G=O.currentTarget;L.current=!0,M.current=G.innerHTML;const{absorbedBlocks:Z}=ai(G);if(M.current=G.innerHTML,b(t,G.innerHTML),Z.length>0){const oe=Z.length;requestAnimationFrame(()=>rg(G,oe))}D()}})})},yI);function yI(e,t){return e.index===t.index&&e.pageHtml===t.pageHtml&&e.showVerticalRuler===t.showVerticalRuler&&e.pageSized===t.pageSized&&e.geometry===t.geometry&&e.rulerUnit===t.rulerUnit&&e.zoomScale===t.zoomScale&&e.placeholder===t.placeholder&&e.disabled===t.disabled&&e.visualEditorAria===t.visualEditorAria}const xI=l.forwardRef(function({pages:t,activePageIndex:n,hasSelectedPage:r=!1,scrollRootRef:o,onActivePageIndexChange:a,onPageSelected:s,onPageChange:u,onPageFlush:d,suppressPageFlushRef:f,pendingInsertPageFocusRef:g,placeholder:h,disabled:y,rulerVisible:b=!0,rulerUnit:C="in",zoomScale:x=1,onMarginChange:v,onMarginPreview:k,onIndentChange:S,onBeforeInput:A,resolveEmbeddedImageDataUrl:T,hydrateEmbeddedImages:D,onPointerDown:R,onMouseUp:P,onContextMenu:M},L){const U=X(),j=l.useRef(null),_=l.useRef(n);_.current=n;const O=l.useRef(A);O.current=A;const G=l.useRef(u);G.current=u;const Z=l.useRef(d);Z.current=d;const oe=l.useRef(s);oe.current=s;const Y=l.useRef(R);Y.current=R;const J=l.useRef(v);J.current=v;const ie=l.useRef(k);ie.current=k;const de=l.useRef(null),te=l.useRef([]),E=l.useRef(gD()),re=f,pe=l.useCallback(()=>_.current,[]),F=l.useCallback(z=>E.current.get(z,t[z]??""),[t]),{visibleIndices:Ee,topSpacerHeight:He,bottomSpacerHeight:ze,scrollToIndex:We,notifyRowMeasured:ot}=bD({scrollElementRef:o??j,pageCount:t.length,getRowHeight:F,activePageIndex:n,pinActivePage:r}),{geometryForPage:it,indentState:Jt,refresh:at}=wD(j,t,Ee,pe,!0,x),q=r?n:0,ae=t[q]??"",ge=l.useCallback(z=>li(t[z]??""),[t]),Le=b&&li(ae),Kt=l.useCallback(z=>{We(z),requestAnimationFrame(()=>{const Q=j.current;if(!Q)return;const le=Ye(Q,z);le&&so(le)})},[We]),$t=l.useCallback(z=>{if(z<0||z>=t.length)return;const Q=(o==null?void 0:o.current)??j.current;if(!Q)return;const le=Go(t.length,F),Me=Q.scrollTop,St=Me+Q.clientHeight,Cn=tb(Me,le,t.length),Qe=nb(St,le,t.length);z>=Cn&&z<=Qe||We(z)},[F,t.length,o,We]),Ut=l.useCallback(z=>{$t(z),requestAnimationFrame(()=>{const Q=j.current;if(!Q)return;const le=Ye(Q,z);le&&sw(le)})},[$t]),Pe=l.useRef($t);Pe.current=$t,l.useLayoutEffect(()=>{Pe.current(n)},[n,t.length]),l.useLayoutEffect(()=>{const z=g==null?void 0:g.current;z!=null&&(g.current=null,Ut(z))},[n,t.length,g,Ut]);const yn=l.useCallback(z=>{var Me;if(_.current=z,z!==n&&a(z),(Me=oe.current)==null||Me.call(oe,z),!Ee.includes(z)){Kt(z);return}at();const Q=j.current;if(!Q)return;const le=Ye(Q,z);le&&requestAnimationFrame(()=>so(le))},[n,a,at,Kt,Ee]);l.useImperativeHandle(L,()=>({getContainer:()=>j.current,getActivePageRoot:()=>{const z=j.current;return z?Ye(z,_.current):null},getActivePageIndex:()=>_.current,flushPageHtml:z=>{var le;const Q=j.current;return Q?((le=Ye(Q,z))==null?void 0:le.innerHTML)??null:null},ensurePageMounted:z=>{Kt(z)},focusPageAt:Ut,activatePageAt:yn}));const xn=l.useCallback((z,Q,le,Me)=>{const St=dn(he(le).body),Cn=Q===document.activeElement;(Me!=null&&Me.forceBodySync||!Cn)&&ts(Q,St,{resolveDataUrl:T,hydrateEmbeddedImages:D}),vu(Q),ai(Q);const Qe=ys(Q);bs(Q),ho(Q,le);const Oe=ct(Q);if(Oe&&Qp(Q,Oe),Qe){const Ae=dn(he(le).body);Q.innerHTML!==Ae&&G.current(z,Q.innerHTML)}},[D,T]);l.useLayoutEffect(()=>{E.current.clear()},[t.length]),l.useLayoutEffect(()=>{const z=j.current;if(!z)return;const Q=de.current,le=Q===null||Q.length!==t.length;le&&Pe.current(n);const Me=new Set(te.current),St=new Set(Ee);le&&St.add(n);for(const Qe of St){const Oe=!Me.has(Qe),Ae=t[Qe]!==(Q==null?void 0:Q[Qe]);if(!le&&!Oe&&!Ae)continue;const $e=Ye(z,Qe);$e&&xn(Qe,$e,t[Qe]??"",{forceBodySync:le})}de.current=t,te.current=Ee,le&&(re!=null&&re.current)&&(re.current=!1);const Cn=requestAnimationFrame(at);return()=>cancelAnimationFrame(Cn)},[n,t,re,xn,at,Ee]),l.useLayoutEffect(()=>{const z=j.current;if(!z)return;const Q=le=>{var Me;(Me=O.current)==null||Me.call(O,le)};return z.addEventListener("beforeinput",Q),()=>z.removeEventListener("beforeinput",Q)},[]);const Dr=l.useCallback((z,Q)=>{var le;yn(z),(le=Y.current)==null||le.call(Y,Q)},[yn]),Ir=l.useCallback((z,Q)=>{G.current(z,Q)},[]),jr=l.useCallback((z,Q)=>{var le;(le=Z.current)==null||le.call(Z,z,Q)},[]),ye=l.useCallback((z,Q)=>{const le=eb(t[z]??"",z),Me=Math.max(Q,le);E.current.set(z,Me),ot(z,Me)},[ot,t]),Qt=l.useCallback((z,Q)=>{var le;(le=J.current)==null||le.call(J,z,Q)},[]),Er=l.useCallback((z,Q)=>{var le;(le=ie.current)==null||le.call(ie,z,Q)},[]),rr=U("visualEditorAria"),or=l.useMemo(()=>Ee.map(z=>i.jsx(bI,{index:z,pageHtml:t[z]??"",showVerticalRuler:Le&&ge(z),pageSized:ge(z),geometry:it(z),rulerUnit:C,zoomScale:x,placeholder:h,disabled:y,visualEditorAria:rr,onActivate:yn,onPointerDown:Dr,onPageChange:Ir,onPageFlush:jr,suppressPageFlushRef:re,onMeasured:ye,onMarginChange:Qt,onMarginPreview:Er,onMouseUp:P,onContextMenu:M,onRulerRefresh:at},z)),[yn,y,it,Qt,Er,Ir,jr,Dr,ye,M,P,ge,t,h,at,C,Le,Ee,rr,x]);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:Le?"center":"stretch",width:"100%",height:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(sb,{showRulers:Le,geometry:it(q),indentState:Jt,rulerUnit:C,zoomScale:x,onMarginChange:z=>{v==null||v(q,z)},onMarginPreview:z=>{k==null||k(q,z)},onIndentChange:z=>{S==null||S(z)}}),i.jsx("div",{className:Ce.pageZoomContent,style:ab(x),children:i.jsxs("div",{ref:j,className:Ce.multiPageContainer,style:{display:"flex",flexDirection:"column",alignItems:Le?"center":"stretch",width:"100%",minHeight:Le?void 0:"100%",position:"relative"},children:[He>0?i.jsx("div",{"aria-hidden":!0,style:{height:He,flexShrink:0}}):null,or,ze>0?i.jsx("div",{"aria-hidden":!0,style:{height:ze,flexShrink:0}}):null]})})]})});function CI(e,t,n){return r=>{const o=e();o&&n(o,t(),r)}}function wI(e,t,n,r){return o=>{const a=e();if(!a)return;const s=n(a,t(),o);r(s.pageHtml)}}function vI(e,t,n){return(r,o)=>{const a=e(r);a&&n(a,t(r),o)}}function kI(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 Kf(e,t,n){return r=>{const o=e();o&&xD(o,{...r,unit:t})&&n(o)}}const SI="_field_1knrr_1",PI="_label_1knrr_8",AI="_button_1knrr_12",TI="_swatch_1knrr_37",RI="_swatchEmpty_1knrr_44",Oo={field:SI,label:PI,button:AI,swatch:TI,swatchEmpty:RI};function Ot({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:o,fallbackCustom:a,onChange:s}){const u=l.useId(),d=l.useRef(null),f=l.useRef(null),g=l.useRef(null),[h,y]=l.useState(!1),b=bo(h,f,g);l.useEffect(()=>{if(!h)return;const v=S=>{var T,D;const A=S.target;(T=d.current)!=null&&T.contains(A)||(D=g.current)!=null&&D.contains(A)||y(!1)},k=S=>{var A;S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),y(!1),(A=f.current)==null||A.focus())};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",k,!0)}},[h]);const C=`${Oo.swatch}${!n||r?` ${Oo.swatchEmpty}`:""}`,x=n&&!r?{backgroundColor:n}:void 0;return i.jsxs("div",{className:Oo.field,ref:d,children:[i.jsx("span",{className:Oo.label,children:e}),i.jsx("button",{ref:f,type:"button",className:Oo.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:o,onClick:()=>y(v=>!v),children:i.jsx("span",{className:C,style:x})}),h?i.jsx(ke,{children:i.jsx("div",{ref:g,id:u,className:br.popover,style:{top:b.top,left:b.left,zIndex:1400},children:i.jsx(Ku,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:o,fallbackCustom:a,onChange:s,onCommit:()=>y(!1)})})}):null]})}const ac=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],DI={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function Uu({tab:e,value:t,fonts:n,disabled:r,onTabChange:o,onChange:a}){const s=X(),u=l.useId(),d=l.useId(),f=n??dp(),g=ac.find(h=>h.id===e)??ac[0];return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("fontDialogTitle"),children:ac.map(h=>i.jsx("button",{type:"button",className:p.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:p.body,role:"tabpanel",children:g.implemented?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("fontDialogFamily")}),i.jsx(Vh,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:f,disabled:r,triggerId:d,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("fontDialogSize")}),i.jsx("div",{className:p.sizeRow,children:i.jsx(Wh,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,y)=>{a({...t,size:h,unit:y})},onUnitChange:h=>{const y=t.size!==null?bp(t.size,t.unit,h,16,16):t.size;a({...t,size:y,unit:h})}})})]}),i.jsx("div",{className:p.field,children:i.jsx(Ot,{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:p.field,children:i.jsx(Ot,{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:p.marks,children:[i.jsx("legend",{className:p.label,children:s("fontDialogStyle")}),zt.map(h=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.marks[h],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[h]:!t.marks[h]}})}}),s(DI[h].label)]},h))]})]}):null})]})}function II({open:e,tab:t,size:n,unit:r,marks:o,fontFamily:a=null,fontFamilyMixed:s=!1,fontColor:u,fontColorMixed:d=!1,highlightColor:f,highlightColorMixed:g=!1,fonts:h,disabled:y,onTabChange:b,onApply:C,onClose:x}){const v=X(),k=l.useId(),S=l.useRef(null),[A,T]=l.useState({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:g});return l.useEffect(()=>{e&&T({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:g})},[e,n,r,o,a,s,u,d,f,g]),Ve(S,{open:e,onClose:x}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:x,children:i.jsxs("div",{ref:S,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":k,onMouseDown:D=>D.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:k,children:v("fontDialogTitle")}),i.jsx(Uu,{tab:t,value:A,fonts:h,disabled:y,onTabChange:b,onChange:T}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:x,children:v("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:y,onClick:()=>C(A),children:v("fontDialogOk")})]})]})})}):null}const jI={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Xe({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:o,inputId:a,onChange:s}){const u=X(),d=l.useId(),f=a??d,g=(t==null?void 0:t.unit)??au,[h,y]=l.useState(()=>t?fe(t.value):""),[b,C]=l.useState(!1);l.useEffect(()=>{b||y(t?fe(t.value):"")},[t,b]);const x=v=>{const k=v.trim();if(!k){s(null),y("");return}const S=ti(k,g,r);if(!S){y(t?fe(t.value):"");return}s(S),y(fe(S.value))};return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:f,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:f,className:p.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>C(!0),onBlur:()=>{C(!1),x(h)},onChange:v=>y(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),x(h),v.currentTarget.blur())}}),i.jsx("select",{className:p.lengthUnit,value:g,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=ti(h,k,r);s(S)}},children:ru.map(v=>i.jsx("option",{value:v,children:u(jI[v])},v))})]})]})}function Vu({shadow:e,disabled:t,onChange:n}){const r=X();return i.jsxs("div",{className:p.shadowGrid,children:[i.jsx(Xe,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetX:o??{value:0,unit:"px"}})}}),i.jsx(Xe,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetY:o??{value:0,unit:"px"}})}}),i.jsx(Xe,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:o=>{n({...e,blur:o??{value:0,unit:"px"}})}}),i.jsx(Xe,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:o=>{n({...e,spread:o??{value:0,unit:"px"}})}}),i.jsx(Ot,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:o=>{n({...e,color:o})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const cb=[{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}],ub=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],EI={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},MI={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function db({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const o=X(),a=l.useId(),s=l.useId();return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:o(e)}),i.jsx(_I,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("imagePropertiesFit")}),i.jsxs("select",{id:a,className:p.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")}),Su.map(u=>i.jsx("option",{value:u,children:o(EI[u])},u))]})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("imagePropertiesPosition")}),i.jsxs("select",{id:s,className:p.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesPositionDefault")}),Pu.map(u=>i.jsx("option",{value:u,children:o(MI[u])},u))]})]})]})}function _I({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=e===null?null:Ha(e),[s,u]=l.useState(()=>a===null?"":fe(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":fe(a))},[a,d]);const g=h=>{const y=h.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":fe(a));return}const C=Mp(b);n(C),u(fe(Ha(C)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:h=>u(h.target.value),onBlur:()=>{f(!1),g(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const NI={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function as({label:e,inputAria:t,value:n,disabled:r,onChange:o}){const a=X(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),g=l.useRef(null),h=(n==null?void 0:n.unit)??Bw,[y,b]=l.useState(()=>n?fe(n.value):""),[C,x]=l.useState(!1),[v,k]=l.useState(!1),S=bo(v,f,g,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{C||b(n?fe(n.value):"")},[n,C]),l.useEffect(()=>{if(!v)return;const P=L=>{var j,_;const U=L.target;(j=d.current)!=null&&j.contains(U)||(_=g.current)!=null&&_.contains(U)||k(!1)},M=L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",P),document.addEventListener("keydown",M,!0),()=>{document.removeEventListener("pointerdown",P),document.removeEventListener("keydown",M,!0)}},[v]);const A=P=>{const M=P.trim();if(!M){o(null),b("");return}const L=Ym(M,h);if(!L){b(n?fe(n.value):"");return}o(L),b(fe(L.value))},T=Fw[h],D=(n==null?void 0:n.value)??null,R=v?i.jsx(ke,{children:i.jsx("ul",{ref:g,className:Ue.list,role:"listbox",id:s,style:{top:S.top,left:S.left,minWidth:S.width},children:T.map(P=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ue.option,role:"option","aria-selected":D===P,onMouseDown:M=>M.preventDefault(),onClick:()=>{o({value:P,unit:h}),b(fe(P)),k(!1)},children:fe(P)})},P))})}):null;return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:u,children:e}),i.jsxs("div",{className:`${Ue.wrap} ${p.lengthRow}`,ref:d,children:[i.jsxs("div",{className:Ue.field,ref:f,children:[i.jsx("input",{id:u,className:Ue.input,value:y,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":v,"aria-controls":s,role:"combobox",inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),A(y)},onChange:P=>b(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),A(y),k(!1),P.currentTarget.blur()),P.key==="ArrowDown"&&(P.preventDefault(),k(!0))}}),i.jsx("button",{type:"button",className:Ue.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":v,"aria-controls":s,onMouseDown:P=>P.preventDefault(),onClick:()=>k(P=>!P)})]}),i.jsxs("div",{className:Ue.field,children:[i.jsx("select",{className:Ue.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:P=>{const M=P.target.value;if(n){o({value:n.value,unit:M});return}y.trim()&&o(Ym(y,M))},children:cg.map(P=>i.jsx("option",{value:P,children:a(NI[P])},P))}),i.jsx("span",{className:Ue.chevron,"aria-hidden":"true"})]}),R]})]})}const LI={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},BI={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function FI(e,t,n){return t&&n?"custom":e.startsWith("data:")?"file":e.trim()?"url":"file"}function mb({src:e,disabled:t,customImagePicker:n,disableBuiltinSources:r=!1,onSrcChange:o,onCustomPick:a,onSourceChange:s}){const u=X(),d=l.useId(),f=l.useId(),g=l.useRef(null),h=r&&!!n,[y,b]=l.useState(()=>FI(e,r,n)),[C,x]=l.useState(()=>e.startsWith("data:")?"":e),[v,k]=l.useState(""),[S,A]=l.useState(null),[T,D]=l.useState(!1);l.useEffect(()=>{s==null||s(y)},[s,y]),l.useEffect(()=>{h&&b("custom")},[h]);const R=y==="file"&&e.startsWith("data:")?e:y==="url"?C:"",P=y==="custom"?null:pn(R),M=y==="custom"?null:y==="file"&&S?BI[S]:P&&(y==="file"||C.trim().length>0)?LI[P]:null,L=()=>{t||!n||a==null||a()},U=j=>{var O;const _=(O=j.target.files)==null?void 0:O[0];_&&(D(!0),A(null),Rw(_).then(G=>{k(_.name),b("file"),o(G),D(!1)},G=>{const Z=G instanceof Error?G.message:"";k(""),b("file"),A(Z==="tooLarge"||Z==="type"?Z:"type"),D(!1),g.current&&(g.current.value="")}))};return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:u("imageDialogSource")}),h?null:i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":u("imageDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>b("file"),children:u("imageDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:u("imageDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:g,type:"file",accept:vw,hidden:!0,disabled:t,"aria-label":u("imageDialogChooseFile"),onChange:U}),i.jsx("button",{type:"button",className:p.action,disabled:t||T,onClick:()=>{var j;return(j=g.current)==null?void 0:j.click()},children:u("imageDialogChooseFile")}),v?i.jsx("span",{className:p.fileName,children:v}):null,e.startsWith("data:")&&!v?i.jsx("span",{className:p.fileName,children:u("pageBackgroundImageCurrent")}):null]}):null,y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:u("imageDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:C,disabled:t,"aria-invalid":M!==null,"aria-describedby":M?f:void 0,onChange:j=>{const _=j.target.value;x(_),o(_.trim())}})]}):null,(h||y==="custom")&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:L,children:n.buttonCaption})]}):null,M?i.jsx("p",{id:f,className:p.error,children:u(M)}):null]})}function HI(e){return pn(e.trim())===null}function zI(e){return gg(e)?{width:null,height:null}:e==="fill"?{width:{...no},height:{...no}}:{width:{...no},height:null}}function OI({value:e,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomImagePick:o,onChange:a}){const s=X(),u=e.src??"",d=(f,g)=>{a({...e,fit:null,[f]:g})};return i.jsxs(i.Fragment,{children:[u?i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:s("pageBackgroundImagePreview")}),i.jsx("img",{className:p.previewImage,src:u,alt:s("pageBackgroundImagePreviewAlt")}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:()=>{a({...e,src:null})},children:s("pageBackgroundImageClear")})]}):null,i.jsx(mb,{src:u,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomPick:o,onSrcChange:f=>{a({...e,src:f.trim()||null})}}),u?i.jsxs(i.Fragment,{children:[i.jsx(as,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:f=>d("width",f)}),i.jsx(as,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:f=>d("height",f)}),i.jsx(db,{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}:zI(f.fit);a({...e,opacity:f.opacity,fit:f.fit,position:f.position,...g})}})]}):null]})}const KI={left:ls,center:ss,right:cs,justify:Yf},$I={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},UI={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},VI={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},WI={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},GI={value:1,unit:"pt"},ZI={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},qI={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},$f={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function Ko(e){return{top:e,right:e,bottom:e,left:e}}function Uf(e){for(const t of rt)if(e[t])return e[t];return null}function YI(){const e=[...cb];for(const t of ub)e.some(n=>n.id===t.id)||e.push(t);return e}function Wu({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:o="paragraphDialogTitle",backgroundImage:a,customImagePicker:s,disableBuiltinBackgroundImageSources:u,onCustomImagePick:d,onBackgroundImageChange:f,onTabChange:g,onChange:h}){const y=X(),b=r?YI().filter(P=>r.includes(P.id)):cb,C=l.useId(),x=l.useId(),v=l.useId(),k=l.useId(),[S,A]=l.useState(()=>Rn(t.margin,Ko(t.margin.top))),[T,D]=l.useState(()=>Rn(t.padding,Ko(t.padding.top))),R=(P,M,L,U)=>{const j=t[P],_=M?Ko(U):{...j,[L]:U};h({...t,[P]:_,[`${P}Mixed`]:!1})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":y(o),children:b.map(P=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":P.id===e,disabled:!P.implemented,onClick:()=>g(P.id),children:y(P.labelKey)},P.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":y("paragraphDialogAlignment"),children:ih.map(P=>{const M=KI[P],L=!t.alignMixed&&t.align===P;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":L,"aria-label":y($I[P].aria),disabled:n,onClick:()=>{h({...t,align:P,alignMixed:!1})},children:i.jsx(M,{})},P)})})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogLists")}),i.jsxs("div",{className:p.iconRow,children:[i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":y("commandBulletListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ul"?null:"ul";h({...t,list:P,listMixed:!1})},children:i.jsx(Xf,{})}),i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":y("commandNumberedListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ol"?null:"ol";h({...t,list:P,listMixed:!1})},children:i.jsx(tp,{})})]})]})]}):null,e==="spacing"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogSpacing")}),i.jsx(Vf,{legend:y("paragraphDialogMargin"),sides:t.margin,linked:S,disabled:n,allowNegative:!0,onLinkedChange:P=>{A(P),P&&h({...t,margin:Ko(Uf(t.margin)),marginMixed:!1})},onSideChange:(P,M)=>R("margin",S,P,M)}),i.jsx(Vf,{legend:y("paragraphDialogPadding"),sides:t.padding,linked:T,disabled:n,onLinkedChange:P=>{D(P),P&&h({...t,padding:Ko(Uf(t.padding)),paddingMixed:!1})},onSideChange:(P,M)=>R("padding",T,P,M)}),i.jsx(JI,{value:t.lineHeight,disabled:n,onChange:P=>{h({...t,lineHeight:P,lineHeightMixed:!1})}}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:y("paragraphDialogPageBreaks")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:x,children:y("paragraphDialogBreakInside")}),i.jsx("select",{id:x,className:p.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:P=>{h({...t,breakInside:P.target.value,breakInsideMixed:!1})},children:Pp.map(P=>i.jsx("option",{value:P,children:y(qI[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:y("paragraphDialogBreakAfter")}),i.jsx("select",{id:v,className:p.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:P=>{h({...t,breakAfter:P.target.value,breakAfterMixed:!1})},children:yc.map(P=>i.jsx("option",{value:P,children:y($f[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:y("paragraphDialogBreakBefore")}),i.jsx("select",{id:k,className:p.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:P=>{h({...t,breakBefore:P.target.value,breakBeforeMixed:!1})},children:yc.map(P=>i.jsx("option",{value:P,children:y($f[P])},P))})]})]})]}):null,e==="border"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:C,children:y("paragraphDialogBorderStyle")}),i.jsx("select",{id:C,className:p.select,value:t.border.style,disabled:n,onChange:P=>{const M=P.target.value;h({...t,border:{style:M,width:M==="none"?null:t.border.width??GI,color:M==="none"?null:t.border.color},borderMixed:!1})},children:fs.map(P=>i.jsx("option",{value:P,children:y(VI[P])},P))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:y("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:P=>{h({...t,border:{...t.border,width:P},borderMixed:!1})}}),i.jsx(Ot,{label:y("paragraphDialogBorderColor"),noneLabel:y("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:P=>{h({...t,border:{...t.border,color:P},borderMixed:!1})}})]}):null,i.jsx(Xe,{label:y("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:P=>{h({...t,borderRadius:P,radiusMixed:!1})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{h({...t,boxShadow:t.boxShadow?null:ZI,shadowMixed:!1})}}),y("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Vu,{shadow:t.boxShadow,disabled:n,onChange:P=>{h({...t,boxShadow:P,shadowMixed:!1})}}):null]}):null,e==="background"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogTabBackground")}),i.jsx(Ot,{label:y("paragraphDialogBackgroundColor"),noneLabel:y("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:P=>{h({...t,backgroundColor:P,backgroundMixed:!1})}}),i.jsx(XI,{value:t.opacity,disabled:n,onChange:P=>{h({...t,opacity:P,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&f?i.jsx(OI,{value:a,disabled:n,customImagePicker:s,disableBuiltinSources:u,onCustomImagePick:d,onChange:f}):null]})]})}function XI({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=e===null?null:Ha(e),[s,u]=l.useState(()=>a===null?"":fe(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":fe(a))},[a,d]);const g=h=>{const y=h.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":fe(a));return}const C=Mp(b);n(C),u(fe(Ha(C)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:h=>u(h.target.value),onBlur:()=>{f(!1),g(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function Vf({legend:e,sides:t,linked:n,disabled:r,allowNegative:o=!1,onLinkedChange:a,onSideChange:s}){const u=X(),d=n?["top"]:rt;return i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:e}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),u("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:d.map(f=>i.jsx(Xe,{label:n?e:u(UI[f]),value:t[f],disabled:r,allowNegative:o,onChange:g=>s(f,g)},f))})]})}function JI({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=QI(e),s=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,d]=l.useState(()=>s===null?"":fe(s)),f=(e==null?void 0:e.kind)==="length"?e.unit:au;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogLineHeight")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:a==="normal"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:g=>d(g.target.value),onBlur:()=>{const g=u.trim();if(!g){n(null);return}if(a==="number"||a==="empty"){const y=Number(g.replace(",","."));if(!Number.isFinite(y)||y<0){d(s===null?"":fe(s));return}n({kind:"number",value:y}),d(fe(y));return}const h=ti(g,f,!1);if(!h){d(s===null?"":fe(s));return}n({kind:"length",value:h.value,unit:h.unit}),d(fe(h.value))}}),i.jsxs("select",{className:p.lengthUnit,value:a==="length"?f:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:g=>{const h=g.target.value;if(h==="empty"){n(null),d("");return}if(h==="normal"){n({kind:"normal"}),d("");return}if(h==="number"){const x=Number((u||"1.5").replace(",",".")),v=Number.isFinite(x)&&x>=0?x:1.5;n({kind:"number",value:v}),d(fe(v));return}const y=h,b=ti(u||"1",y,!1),C=(b==null?void 0:b.value)??1;n({kind:"length",value:C,unit:y}),d(fe(C))},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(g=>i.jsx("option",{value:g,children:r(WI[g])},g))]})]})]})}function QI(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}function ej({open:e,tab:t,value:n,backgroundImage:r,disabled:o,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onTabChange:d,onApply:f,onClose:g}){const h=X(),y=l.useId(),b=l.useRef(null),[C,x]=l.useState(n),[v,k]=l.useState(r);return l.useEffect(()=>{e&&(x(n),k(r??mn()))},[e,n,r]),Ve(b,{open:e,onClose:g,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:g,children:i.jsxs("div",{ref:b,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,onMouseDown:S=>S.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:y,children:h("paragraphDialogTitle")}),i.jsx(Wu,{tab:t,value:C,disabled:o,backgroundImage:v,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onBackgroundImageChange:k,onTabChange:d,onChange:x}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:g,children:h("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>f({value:C,backgroundImage:v}),children:h("fontDialogOk")})]})]})})}):null}const tj=["auto","A4","letter","legal","custom"],nj={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},rj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Wf(e){return e===null?"":fe(e.value)}function oj({value:e,disabled:t,onChange:n,onReset:r}){const o=X(),a=l.useId(),[s,u]=l.useState(!0),d=e??Kn(),f=(g,h)=>{if(s){n({...d,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...d,margin:{...d.margin,[g]:h},marginMixed:!1})};return i.jsxs("div",{className:p.body,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("pageAtRuleSize")}),i.jsx("select",{id:a,className:p.select,disabled:t,value:d.sizePreset,onChange:g=>n({...d,sizePreset:g.target.value}),children:tj.map(g=>i.jsx("option",{value:g,children:o(nj[g])},g))})]}),d.sizePreset==="custom"?i.jsxs("div",{className:p.sideGrid,children:[i.jsx(sc,{label:o("pageAtRuleWidth"),value:d.customWidth,disabled:t,onChange:g=>n({...d,customWidth:g})}),i.jsx(sc,{label:o("pageAtRuleHeight"),value:d.customHeight,disabled:t,onChange:g=>n({...d,customHeight:g})})]}):null,i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:o("pageAtRuleOrientation")}),i.jsx("div",{className:p.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([g,h])=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"radio",name:"page-orientation",checked:(d.orientation??"none")===g,disabled:t,onChange:()=>n({...d,orientation:g==="none"?null:g})}),o(h)]},g))})]}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:o("pageAtRuleMargins")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:s,disabled:t,onChange:()=>u(!s)}),o("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(s?["top"]:rt).map(g=>i.jsx(sc,{label:o(s?"pageAtRuleMargins":rj[g]),value:d.margin[g],disabled:t,onChange:h=>f(g,h)},g))})]}),i.jsx("div",{className:p.actions,children:i.jsx("button",{type:"button",className:p.action,disabled:t,"aria-label":o("pageAtRuleResetAria"),onClick:r,children:o("pageAtRuleReset")})})]})}function sc({label:e,value:t,disabled:n,onChange:r}){const o=X(),a=l.useId(),[s,u]=l.useState(()=>Wf(t)),d=(t==null?void 0:t.unit)??au;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:a,className:p.lengthInput,value:s,disabled:n,inputMode:"decimal",onChange:f=>u(f.target.value),onBlur:()=>{const f=s.trim();if(!f){r(null);return}const g=ti(f,d,!1);if(!g){u(Wf(t));return}r(g),u(fe(g.value))}}),i.jsxs("select",{className:p.lengthUnit,disabled:n,value:d,"aria-label":o("paragraphDialogLengthUnitAria"),onChange:f=>{const g=f.target.value;t&&r({...t,unit:g})},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 ij=ub.map(e=>e.id);function aj(e){return{...wr(),...e}}function sj(e){const{align:t,alignMixed:n,list:r,listMixed:o,...a}=e;return a}function lj({open:e,tab:t,value:n,fonts:r,disabled:o,printTabVisible:a=!1,initialParagraphTab:s="spacing",customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onTabChange:g,onApply:h,onResetAtRule:y,onClose:b}){const C=X(),x=l.useId(),v=l.useRef(null),[k,S]=l.useState("general"),[A,T]=l.useState("spacing"),[D,R]=l.useState(n.font),[P,M]=l.useState(n.box),[L,U]=l.useState(n.backgroundImage),[j,_]=l.useState(n.atRule??Kn());if(l.useEffect(()=>{e&&(S("general"),T(s==="general"?"spacing":s),R(n.font),M(n.box),U(n.backgroundImage??mn()),_(n.atRule??Kn()),t==="print"&&!a&&g("font"))},[e,n,t,a,s,g]),Ve(v,{open:e,onClose:b,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const O=C("pageDialogTitle"),G=t==="print"&&!a?"font":t;return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:v,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,onMouseDown:Z=>Z.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:x,children:O}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":O,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":G==="font",onClick:()=>g("font"),children:C("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":G==="paragraph",onClick:()=>g("paragraph"),children:C("customStyleDialogTabParagraph")}),a?i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":G==="print",onClick:()=>g("print"),children:C("pageDialogTabPrint")}):null]}),G==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(Uu,{tab:k,value:D,fonts:r,disabled:o,onTabChange:S,onChange:R})}):G==="paragraph"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(Wu,{tab:A,value:aj(P),disabled:o,tabs:ij,tablistLabelKey:"pageDialogTitle",backgroundImage:L,customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onBackgroundImageChange:U,onTabChange:Z=>{Z!=="general"&&T(Z)},onChange:Z=>M(sj(Z))})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(oj,{value:j,disabled:o,onChange:_,onReset:()=>{_(Kn()),y==null||y()}})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:C("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>h({font:D,box:P,backgroundImage:L,atRule:a?j:n.atRule??Kn()}),children:C("fontDialogOk")})]})]})})})}function cj({open:e,disabled:t,onClose:n,onConfirm:r}){const o=X(),a=l.useId(),s=l.useRef(null);if(l.useEffect(()=>{if(!e)return;const d=s.current;if(!d)return;const f=d.querySelector('button:not([disabled]):not([tabindex="-1"])');f==null||f.focus();const g=h=>{h.key==="Escape"&&(h.preventDefault(),n())};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[e,n]),!e)return null;const u=!!t;return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:s,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("deletePageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("fontDialogCloseAria"),onClick:n,children:i.jsx(Je,{})})]}),i.jsx("div",{className:p.confirmBody,children:o("deletePageConfirmMessage")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:u,onClick:n,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:u,onClick:r,children:o("commandDeletePage")})]})]})})})}function uj(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Gf(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 dj(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 mj({open:e,mode:t,styleId:n,name:r="",font:o,paragraph:a,canDelete:s=!1,busy:u,disabled:d,fonts:f,defaultOuterTab:g="font",onSave:h,onDelete:y,onClose:b}){const C=X(),x=l.useId(),v=l.useId(),k=l.useRef(null),[S,A]=l.useState(r),[T,D]=l.useState(g),[R,P]=l.useState("general"),[M,L]=l.useState("general"),[U,j]=l.useState(()=>Gf(o)),[_,O]=l.useState(()=>Bc(a)),[G,Z]=l.useState(!1);l.useEffect(()=>{e&&(A(r),D(g),P("general"),L("general"),j(Gf(o)),O(Bc(a)),Z(!1))},[e,r,o,a,g]);const oe=l.useCallback(()=>{if(G){Z(!1);return}b()},[G,b]);if(Ve(k,{open:e,onClose:oe,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const Y=C(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),J=S.trim().length>0,ie=!!(d||u),de=()=>{const te=S.trim();te&&h({id:n??uj(),name:te,font:dj(U),paragraph:ch(_)})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:k,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,"aria-busy":u||void 0,onMouseDown:te=>te.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:x,children:Y}),i.jsx("button",{type:"button",className:p.close,"aria-label":C("customStyleDialogCloseAria"),onClick:b,children:i.jsx(Je,{})})]}),G?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.confirmBody,children:C("customStyleDialogDeleteConfirm")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:ie,onClick:()=>Z(!1),children:C("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:ie||!n,onClick:()=>{n&&(y==null||y(n))},children:C("customStyleDialogDelete")})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.nameSection,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:C("customStyleDialogName")}),i.jsx("input",{id:v,className:p.nameInput,value:S,disabled:ie,onChange:te=>A(te.target.value)})]})}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":Y,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":T==="font",onClick:()=>D("font"),children:C("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":T==="paragraph",onClick:()=>D("paragraph"),children:C("customStyleDialogTabParagraph")})]}),T==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(Uu,{tab:R,value:U,fonts:f,disabled:ie,onTabChange:P,onChange:j})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(Wu,{tab:M,value:_,disabled:ie,onTabChange:L,onChange:O})}),i.jsxs("div",{className:t==="edit"&&s?`${p.actions} ${p.actionsSpread}`:p.actions,children:[t==="edit"&&s?i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:ie,onClick:()=>Z(!0),children:C("customStyleDialogDelete")}):null,i.jsxs("div",{className:p.actionsEnd,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:C("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:ie||!J,onClick:de,children:C("fontDialogOk")})]})]})]})]})})})}function fj({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),[g,h]=l.useState(t);if(l.useEffect(()=>{e&&h(t)},[e,t]),Ve(d,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),l.useEffect(()=>{var b;e&&((b=f.current)==null||b.focus())},[e]),!e)return null;const y=()=>{n||r(g)};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("customCssDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("customCssDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("customCssDialogField")}),i.jsx("textarea",{ref:f,id:u,className:p.textarea,value:g,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:b=>h(b.target.value)})]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:y,children:a("fontDialogOk")})]})]})})})}const pj={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function gj({open:e,existingIds:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useId(),d=l.useId(),f=l.useRef(null),[g,h]=l.useState(""),[y,b]=l.useState(!1),C=l.useMemo(()=>new Set(t),[t]),x=gh(g,C);if(l.useEffect(()=>{e&&(h(""),b(!1))},[e]),Ve(f,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const v=y||g.trim().length>0?x:null,k=x===null&&!n,S=()=>{b(!0),!(x||n)&&r(g.trim())};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:f,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:A=>A.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("bookmarkDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsxs("div",{className:p.labelRow,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("bookmarkDialogName")}),i.jsx(Jn,{label:a("bookmarkDialogHelp"),elevated:!0,children:i.jsx("button",{type:"button",className:p.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),i.jsx("input",{id:u,className:p.textInput,value:g,disabled:n,"aria-invalid":v!==null,"aria-describedby":v?d:void 0,onChange:A=>h(A.target.value)}),v?i.jsx("p",{id:d,className:p.error,children:a(pj[v])}):null]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!k,onClick:S,children:a("fontDialogOk")})]})]})})})}const hj={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},bj={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function yj({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),g=l.useId(),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState("file"),[x,v]=l.useState(""),[k,S]=l.useState(""),[A,T]=l.useState(""),[D,R]=l.useState(""),[P,M]=l.useState(null),[L,U]=l.useState(!1);if(l.useEffect(()=>{e&&(C("file"),v(""),S(""),T(""),R(""),M(null),U(!1),y.current&&(y.current.value=""))},[e]),Ve(h,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const j=b==="file"?k:b==="url"?x:"",_=b==="custom"?null:Hu(j),O=b==="custom"?null:b==="file"&&P?bj[P]:_&&(b==="file"||x.trim().length>0)?hj[_]:null,G=b!=="custom"&&_===null&&!(b==="file"&&P)&&!t&&!L,Z=()=>{t||!n||o==null||o()},oe=()=>{G&&r({src:j.trim(),title:D.trim()})},Y=J=>{var de;const ie=(de=J.target.files)==null?void 0:de[0];ie&&(U(!0),M(null),ZS(ie).then(te=>{S(te),T(ie.name),C("file"),U(!1)},te=>{const E=te instanceof Error?te.message:"";S(""),T(""),C("file"),M(E==="tooLarge"||E==="type"?E:"type"),U(!1),y.current&&(y.current.value="")}))};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:J=>J.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("audioDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("audioDialogCloseAria"),onClick:a,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="file",disabled:t,onClick:()=>C("file"),children:s("audioDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="url",disabled:t,onClick:()=>C("url"),children:s("audioDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="custom",disabled:t,onClick:()=>C("custom"),children:n.text}):null]}),b==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:y,type:"file",accept:OS,hidden:!0,disabled:t,"aria-label":s("audioDialogChooseFile"),onChange:Y}),i.jsx("button",{type:"button",className:p.action,disabled:t||L,onClick:()=>{var J;return(J=y.current)==null?void 0:J.click()},children:s("audioDialogChooseFile")}),A?i.jsx("span",{className:p.fileName,children:A}):null]}):null,b==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("audioDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:x,disabled:t,"aria-invalid":O!==null,"aria-describedby":O?g:void 0,onChange:J=>v(J.target.value)})]}):null,b==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:Z,children:n.buttonCaption})]}):null]}),b!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("audioDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:D,disabled:t,onChange:J=>R(J.target.value)})]}):null,O?i.jsx("p",{id:g,className:p.error,children:s(O)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),b!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!G,onClick:oe,children:s("fontDialogOk")}):null]})]})})})}function xj({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),g=l.useRef(null),[h,y]=l.useState(""),[b,C]=l.useState(""),[x,v]=l.useState(""),[k,S]=l.useState("file");if(l.useEffect(()=>{e&&(y(""),C(""),v(""),S("file"))},[e]),Ve(g,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const A=HI(h)&&!t,T=()=>{A&&r({src:h.trim(),alt:b.trim(),title:x.trim()})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:g,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("imageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("imageDialogCloseAria"),onClick:a,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx(mb,{src:h,disabled:t,customImagePicker:n,onCustomPick:o,onSourceChange:S,onSrcChange:y}),k!=="custom"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("imageDialogAlt")}),i.jsx("input",{id:d,className:p.textInput,value:b,disabled:t,onChange:D=>C(D.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imageDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:x,disabled:t,onChange:D=>v(D.target.value)})]})]}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),k!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!A,onClick:T,children:s("fontDialogOk")}):null]})]})})})}const Cj=[{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}],wj={left:ls,center:ss,right:cs},vj=["left","center","right"],kj={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},Sj=["width","height","lock"],Pj={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},Aj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Tj={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Rj={value:1,unit:"pt"},Dj={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 lc(e){return{top:e,right:e,bottom:e,left:e}}function Ij(e){for(const t of rt)if(e[t])return e[t];return null}function jj({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:o,onChange:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),[g,h]=l.useState(()=>Rn(t.margin,lc(t.margin.top))),y=t.align==="center",b=(x,v)=>{if(t.sizeMode==="lock"&&v){const k=Xo(x,v,n);a({...t,width:k.width,height:k.height});return}a({...t,[x]:v})},C=x=>{if(x==="width"){a({...t,sizeMode:x,height:null});return}if(x==="height"){a({...t,sizeMode:x,width:null});return}if(t.width){const v=Xo("width",t.width,n);a({...t,sizeMode:x,width:v.width,height:v.height});return}if(t.height){const v=Xo("height",t.height,n);a({...t,sizeMode:x,width:v.width,height:v.height});return}a({...t,sizeMode:x})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("imagePropertiesDialogTitle"),children:Cj.map(x=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":x.id===e,disabled:!x.implemented,onClick:()=>o(x.id),children:s(x.labelKey)},x.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesSize")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("imagePropertiesSizeMode"),children:Sj.map(x=>i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":t.sizeMode===x,disabled:r,onClick:()=>C(x),children:s(Pj[x])},x))}),i.jsx(as,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:x=>b("width",x)}),i.jsx(as,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:x=>b("height",x)})]}):null,e==="alignment"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("paragraphDialogAlignment"),children:vj.map(x=>{const v=wj[x];return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":t.align===x,"aria-label":s(kj[x]),disabled:r,onClick:()=>{a({...t,align:t.align===x?null:x})},children:i.jsx(v,{})},x)})})]}):null,e==="border"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogMargin")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:g,disabled:r||y,onChange:()=>{const x=!g;h(x),x&&a({...t,margin:lc(Ij(t.margin))})}}),s("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(g?["top"]:rt).map(x=>i.jsx(Xe,{label:s(g?"paragraphDialogMargin":Aj[x]),value:t.margin[x],disabled:r||y&&(x==="left"||x==="right"),allowNegative:!0,onChange:v=>{const k=g?lc(v):{...t.margin,[x]:v};a({...t,margin:k})}},x))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("paragraphDialogBorderStyle")}),i.jsx("select",{id:u,className:p.select,value:t.border.style,disabled:r,onChange:x=>{const v=x.target.value;a({...t,border:{style:v,width:v==="none"?null:t.border.width??Rj,color:v==="none"?null:t.border.color}})},children:fs.map(x=>i.jsx("option",{value:x,children:s(Tj[x])},x))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:s("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:x=>{a({...t,border:{...t.border,width:x}})}}),i.jsx(Ot,{label:s("paragraphDialogBorderColor"),noneLabel:s("colorNone"),value:t.border.color,disabled:r,onChange:x=>{a({...t,border:{...t.border,color:x}})}})]}):null,i.jsx(Xe,{label:s("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:x=>{a({...t,borderRadius:x})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:Dj})}}),s("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Vu,{shadow:t.boxShadow,disabled:r,onChange:x=>{a({...t,boxShadow:x})}}):null]})]}):null,e==="advanced"?i.jsxs(i.Fragment,{children:[i.jsx(db,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:x=>{a(Zw({...t,opacity:x.opacity,objectFit:x.fit,objectPosition:x.position},n))}}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesRotation")}),i.jsx("div",{className:p.field,children:i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:d,className:p.lengthInput,value:t.rotateDeg===null?"":fe(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":s("imagePropertiesRotation"),onChange:x=>{const v=x.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:p.lengthUnit,"aria-hidden":"true",children:s("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesTabHover")}),i.jsx("p",{className:p.emptyHint,children:s("imagePropertiesHoverHelp")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imagePropertiesHoverCss")}),i.jsx("textarea",{id:f,className:p.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":s("imagePropertiesHoverCssAria"),onChange:x=>{a({...t,hoverCss:x.target.value})}})]})]}):null]})]})}function Ej({open:e,tab:t,value:n,aspectRatio:r=1,disabled:o,onTabChange:a,onApply:s,onClose:u}){const d=X(),f=l.useId(),g=l.useRef(null),[h,y]=l.useState(n);return l.useEffect(()=>{e&&y(n)},[e,n]),Ve(g,{open:e,onClose:u,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:u,children:i.jsxs("div",{ref:g,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":f,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:f,children:d("imagePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":d("imagePropertiesDialogCloseAria"),onClick:u,children:i.jsx(Je,{})})]}),i.jsx(jj,{tab:t,value:h,aspectRatio:r,disabled:o,onTabChange:a,onChange:y}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:u,children:d("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>s(h),children:d("fontDialogOk")})]})]})})}):null}function Mj({open:e,tab:t,href:n,title:r,targetBlank:o,textDecorationNone:a,hoverMode:s,hoverColor:u,hoverHtml:d,bookmarks:f,selectedBookmarkId:g,disabled:h,onTabChange:y,onApply:b,onClose:C}){const x=X(),v=l.useId(),k=l.useId(),S=l.useId(),A=l.useId(),T=l.useId(),D=l.useRef(null),[R,P]=l.useState(n),[M,L]=l.useState(r),[U,j]=l.useState(o),[_,O]=l.useState(a),[G,Z]=l.useState(s),[oe,Y]=l.useState(u),[J,ie]=l.useState(d),[de,te]=l.useState(g);if(l.useEffect(()=>{e&&(P(n),L(r),j(o),O(a),Z(s),Y(u),ie(d),te(g))},[e,n,r,o,a,s,u,d,g]),Ve(D,{open:e,onClose:C,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),!e)return null;const E=()=>vs({title:M,targetBlank:U,textDecorationNone:_,hoverMode:G,hoverColor:oe,hoverHtml:J}),re=()=>{const F=R.trim();!F||h||b({...E(),href:F})},pe=()=>{!de||h||b({...E(),href:`#${de}`})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:C,children:i.jsxs("div",{ref:D,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:F=>F.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:v,children:x("linkDialogTitle")}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":x("linkDialogTitle"),children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="link",onClick:()=>y("link"),children:x("linkDialogTabLink")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>y("bookmark"),children:x("linkDialogTabBookmark")})]}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[t==="link"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:x("linkDialogHref")}),i.jsx("input",{id:k,className:p.textInput,value:R,disabled:h,onChange:F=>P(F.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:S,children:x("linkDialogHoverTitle")}),i.jsx("input",{id:S,className:p.textInput,value:M,disabled:h,onChange:F=>L(F.target.value)})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:U,disabled:h,onChange:F=>j(F.target.checked)}),x("linkDialogTargetBlank")]})]}):f.length===0?i.jsx("p",{className:p.emptyHint,children:x("linkDialogBookmarkEmpty")}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:A,children:x("linkDialogBookmark")}),i.jsxs("select",{id:A,className:`${p.select} ${p.fullSelect}`,value:de,disabled:h,onChange:F=>te(F.target.value),children:[i.jsx("option",{value:""}),f.map(F=>i.jsx("option",{value:F.id,children:F.id},F.id))]})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:_,disabled:h,onChange:F=>O(F.target.checked)}),x("linkDialogTextDecorationNone")]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:x("linkDialogHover")}),i.jsxs("div",{className:p.sizeRow,role:"group","aria-label":x("linkDialogHover"),children:[i.jsx("button",{type:"button",className:p.action,"aria-pressed":G==="color",disabled:h,onClick:()=>Z("color"),children:x("linkDialogHoverColor")}),i.jsx("button",{type:"button",className:p.action,"aria-pressed":G==="html",disabled:h,onClick:()=>Z("html"),children:x("linkDialogHoverHtml")})]}),G==="color"?i.jsx(Ot,{label:x("linkDialogHoverColorField"),noneLabel:x("colorNone"),value:oe,disabled:h,onChange:Y}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:T,children:x("linkDialogHoverHtmlAria")}),i.jsx("textarea",{id:T,className:p.textarea,value:J,disabled:h,spellCheck:!1,onChange:F=>ie(F.target.value)})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:h||!de,onClick:pe,children:x("linkDialogSelect")}),i.jsx("button",{type:"button",className:p.action,onClick:C,children:x("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:h||!R.trim(),onClick:re,children:x("fontDialogOk")})]})]})})})}const Zf={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function _j({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),g=l.useId(),h=l.useRef(null),[y,b]=l.useState("url"),[C,x]=l.useState(""),[v,k]=l.useState("");if(l.useEffect(()=>{e&&(b("url"),x(""),k(""))},[e]),Ve(h,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const S=y==="custom"?null:Ph(C),A=y==="custom"?null:S&&C.trim().length>0?Zf[S]:S==="empty"&&C.trim().length===0?null:S?Zf[S]:null,T=y!=="custom"&&S===null&&!t&&C.trim().length>0,D=()=>{t||!n||o==null||o()},R=()=>{T&&r({url:C.trim(),title:v.trim()})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:P=>P.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("youtubeDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("youtubeDialogCloseAria"),onClick:a,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:s("youtubeDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("youtubeDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:C,disabled:t,"aria-invalid":A!==null,"aria-describedby":A?g:void 0,onChange:P=>x(P.target.value)})]}):null,y==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:D,children:n.buttonCaption})]}):null]}),y!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("youtubeDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:v,disabled:t,onChange:P=>k(P.target.value)})]}):null,A?i.jsx("p",{id:g,className:p.error,children:s(A)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),y!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!T,onClick:R,children:s("fontDialogOk")}):null]})]})})})}const Nj="_grid_1bpma_1",Lj="_cell_1bpma_8",Bj="_sizeLabel_1bpma_27",Fj="_sizeFields_1bpma_33",Hj="_numberInput_1bpma_37",Zr={grid:Nj,cell:Lj,sizeLabel:Bj,sizeFields:Fj,numberInput:Hj},Hn={rows:3,cols:3};function zj({open:e,disabled:t,onApply:n,onClose:r}){const o=X(),a=l.useId(),s=l.useId(),u=l.useId(),d=l.useRef(null),[f,g]=l.useState(Hn.rows),[h,y]=l.useState(Hn.cols),[b,C]=l.useState(String(Hn.rows)),[x,v]=l.useState(String(Hn.cols)),[k,S]=l.useState(!1);if(l.useEffect(()=>{e&&(g(Hn.rows),y(Hn.cols),C(String(Hn.rows)),v(String(Hn.cols)),S(!1))},[e]),Ve(d,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])'}),!e)return null;const T=eh(f,h)&&!t,D=(L,U)=>{const j=Math.min(to,Math.max(eo,L)),_=Math.min(to,Math.max(eo,U));g(j),y(_),C(String(j)),v(String(_))},R=(L,U)=>{const j=Number.parseInt(L,10);if(!Number.isFinite(j)){U==="rows"?C(String(f)):v(String(h));return}S(!0),U==="rows"?D(j,h):D(f,j)},P=(L,U)=>{const j=L.replace(/\D/g,"");if(U==="rows"?C(j):v(j),j==="")return;const _=Number.parseInt(j,10);Number.isFinite(_)&&(S(!0),U==="rows"?D(_,h):D(f,_))},M=L=>{(L.key==="e"||L.key==="E"||L.key==="+"||L.key==="-"||L.key===".")&&L.preventDefault()};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:L=>L.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("tableDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("tableDialogCloseAria"),onClick:r,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx("div",{className:Zr.grid,role:"grid","aria-label":o("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:lf},(L,U)=>Array.from({length:lf},(j,_)=>{const O=U+1,G=_+1,Z=O<=f&&G<=h;return i.jsx("button",{type:"button",className:Zr.cell,role:"gridcell","data-active":Z?"true":void 0,"aria-label":`${O} × ${G}`,"aria-pressed":Z&&O===f&&G===h,disabled:t,onMouseEnter:()=>{k||D(O,G)},onClick:()=>{S(!0),D(O,G)}},`${O}-${G}`)}))}),i.jsxs("p",{className:Zr.sizeLabel,children:[o("tableDialogSize"),": ",f," × ",h]}),i.jsxs("div",{className:`${p.sizeRow} ${Zr.sizeFields}`,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("tableDialogRows")}),i.jsx("input",{id:s,className:Zr.numberInput,type:"number",inputMode:"numeric",min:eo,max:to,step:1,value:b,disabled:t,onKeyDown:M,onChange:L=>P(L.target.value,"rows"),onBlur:()=>R(b,"rows")})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:o("tableDialogColumns")}),i.jsx("input",{id:u,className:Zr.numberInput,type:"number",inputMode:"numeric",min:eo,max:to,step:1,value:x,disabled:t,onKeyDown:M,onChange:L=>P(L.target.value,"cols"),onBlur:()=>R(x,"cols")})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:r,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!T,onClick:()=>{T&&n({rows:f,cols:h})},children:o("tableDialogInsert")})]})]})})})}const Oj={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Kj={value:1,unit:"pt"},$j={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 Uj({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=l.useId();return i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("tablePropertiesWidth")}),i.jsx(Xe,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:s=>n({...e,width:s})}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("tablePropertiesCollapse")}),i.jsxs("select",{id:o,className:p.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(Xe,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:s=>n({...e,borderSpacing:s})}):null]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),i.jsx("select",{id:a,className:p.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??Kj,color:u==="none"?null:e.border.color}})},children:fs.map(s=>i.jsx("option",{value:s,children:r(Oj[s])},s))})]}),e.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:s=>n({...e,border:{...e.border,width:s}})}),i.jsx(Ot,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:s=>n({...e,border:{...e.border,color:s}})})]}):null,i.jsx(Xe,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:s=>n({...e,borderRadius:s})}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:$j})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?i.jsx(Vu,{shadow:e.boxShadow,disabled:t,onChange:s=>n({...e,boxShadow:s})}):null]})]})}function Vj({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),Ve(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:g=>g.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("tablePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx(Uj,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const Wj=["left","center","right"],Gj={left:ls,center:ss,right:cs},Zj={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},qj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Yj={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Ia(e){return{top:e,right:e,bottom:e,left:e}}function cc(e){for(const t of rt)if(e[t])return e[t];return null}function Xj({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=l.useId(),s=l.useId(),[u,d]=l.useState(()=>Rn(e.padding,Ia(cc(e.padding))));return l.useEffect(()=>{d(Rn(e.padding,Ia(cc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Ot,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:f=>n({...e,backgroundColor:f})}),i.jsx(Ot,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:f=>n({...e,color:f})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:u,disabled:t,onChange:()=>{const f=!u;d(f),f&&n({...e,padding:Ia(cc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(u?["top"]:rt).map(f=>i.jsx(Xe,{label:r(u?"paragraphDialogPadding":qj[f]),value:e.padding[f],disabled:t,onChange:g=>{const h=u?Ia(g):{...e.padding,[f]:g};n({...e,padding:h})}},f))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:Wj.map(f=>{const g=Gj[f],h=(e.textAlign??"left")===f;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":h,"aria-label":r(Zj[f]),disabled:t,onClick:()=>{n({...e,textAlign:f==="left"?null:f})},children:i.jsx(g,{})},f)})})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.select,value:e.verticalAlign??"",disabled:t,onChange:f=>{const g=f.target.value;n({...e,verticalAlign:g||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Ss.map(f=>i.jsx("option",{value:f,children:r(Yj[f])},f))]})]}),i.jsx(Xe,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:f=>n({...e,width:f})}),i.jsxs("div",{className:p.sizeRow,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("cellPropertiesColSpan")}),i.jsx("input",{id:a,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:f=>{const g=Number.parseInt(f.target.value,10);n({...e,colSpan:Number.isFinite(g)?Math.max(1,g):1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:r("cellPropertiesRowSpan")}),i.jsx("input",{id:s,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:f=>{const g=Number.parseInt(f.target.value,10);n({...e,rowSpan:Number.isFinite(g)?Math.max(1,g):1})}})]})]})]})}function Jj({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),Ve(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:g=>g.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("cellPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx(Xj,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const Qj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},eE={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function ja(e){return{top:e,right:e,bottom:e,left:e}}function uc(e){for(const t of rt)if(e[t])return e[t];return null}function tE({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),[a,s]=l.useState(()=>Rn(e.padding,ja(uc(e.padding))));return l.useEffect(()=>{s(Rn(e.padding,ja(uc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Ot,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),i.jsx(Ot,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const u=!a;s(u),u&&n({...e,padding:ja(uc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(a?["top"]:rt).map(u=>i.jsx(Xe,{label:r(a?"paragraphDialogPadding":Qj[u]),value:e.padding[u],disabled:t,onChange:d=>{const f=a?ja(d):{...e.padding,[u]:d};n({...e,padding:f})}},u))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.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")}),Ss.map(u=>i.jsx("option",{value:u,children:r(eE[u])},u))]})]}),i.jsx(Xe,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}function nE({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),Ve(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:g=>g.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("rowPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx(tE,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const rE="_backdrop_9d3gw_1",oE="_dialog_9d3gw_12",iE="_headerRow_9d3gw_29",aE="_header_9d3gw_29",sE="_close_9d3gw_44",lE="_body_9d3gw_66",cE="_frame_9d3gw_75",uE="_actions_9d3gw_83",dE="_action_9d3gw_83",An={backdrop:rE,dialog:oE,headerRow:iE,header:aE,close:sE,body:lE,frame:cE,actions:uE,action:dE};function mE(e){const t=Un(e);if(t.length<=1)return e;const n=[],r=[];for(const a of t){const s=he(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 fE({open:e,html:t,onClose:n}){const r=X(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useMemo(()=>mE(t),[t]);return Ve(a,{open:e,onClose:n,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{var f;if(!e)return;const d=(f=s.current)==null?void 0:f.contentDocument;d&&Tc(d,u,r("previewDialogTitle"))},[e,u,r]),e?i.jsx(ke,{children:i.jsx("div",{className:An.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:a,className:An.dialog,role:"dialog","aria-modal":"true","aria-labelledby":o,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:An.headerRow,children:[i.jsx("h2",{className:An.header,id:o,children:r("previewDialogTitle")}),i.jsx("button",{type:"button",className:An.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:i.jsx(Je,{})})]}),i.jsx("div",{className:An.body,children:i.jsx("iframe",{ref:s,className:An.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var f;const d=(f=s.current)==null?void 0:f.contentDocument;d&&Tc(d,u,r("previewDialogTitle"))}})}),i.jsx("div",{className:An.actions,children:i.jsx("button",{type:"button",className:An.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const pE="0.0.11",gE="_backdrop_72ox3_1",hE="_dialog_72ox3_12",bE="_headerRow_72ox3_30",yE="_header_72ox3_30",xE="_close_72ox3_46",CE="_body_72ox3_68",wE="_product_72ox3_76",vE="_meta_72ox3_82",kE="_description_72ox3_87",SE="_website_72ox3_92",PE="_cta_72ox3_97",AE="_link_72ox3_102",TE="_actions_72ox3_118",RE="_action_72ox3_118",bt={backdrop:gE,dialog:hE,headerRow:bE,header:yE,close:xE,body:CE,product:wE,meta:vE,description:kE,website:SE,cta:PE,link:AE,actions:TE,action:RE};function DE({open:e,onClose:t}){const n=X(),r=l.useId(),o=l.useRef(null);return Ve(o,{open:e,onClose:t,escapeIgnoreSelectors:!1,focusableSelector:'a[href], button:not([disabled]):not([tabindex="-1"])'}),e?i.jsx(ke,{children:i.jsx("div",{className:bt.backdrop,role:"presentation",onMouseDown:t,children:i.jsxs("div",{ref:o,className:bt.dialog,role:"dialog","aria-modal":"true","aria-labelledby":r,onMouseDown:a=>a.stopPropagation(),children:[i.jsxs("div",{className:bt.headerRow,children:[i.jsx("h2",{id:r,className:bt.header,children:n("aboutDialogTitle")}),i.jsx("button",{type:"button",className:bt.close,onClick:t,"aria-label":n("aboutDialogCloseAria"),children:i.jsx(Je,{})})]}),i.jsxs("div",{className:bt.body,children:[i.jsx("p",{className:bt.product,children:n("brandMarkAria")}),i.jsx("p",{className:bt.meta,children:n("aboutDialogVersion").replace("{version}",pE)}),i.jsx("p",{className:bt.description,children:n("aboutDialogDescription")}),i.jsxs("div",{className:bt.website,children:[i.jsx("p",{className:bt.cta,children:n("aboutDialogWebsiteCta")}),i.jsx("a",{className:bt.link,href:"https://commspliant.com/",target:"_blank",rel:"noopener noreferrer","aria-label":n("aboutDialogWebsiteAria"),children:n("aboutDialogWebsite")})]})]}),i.jsx("div",{className:bt.actions,children:i.jsx("button",{type:"button",className:bt.action,onClick:t,children:n("aboutDialogClose")})})]})})}):null}const IE="_backdrop_12fkg_1",jE="_dialog_12fkg_12",EE="_headerRow_12fkg_31",ME="_header_12fkg_31",_E="_close_12fkg_47",NE="_searchRow_12fkg_69",LE="_search_12fkg_69",BE="_body_12fkg_91",FE="_sidebar_12fkg_99",HE="_category_12fkg_111",zE="_topicList_12fkg_121",OE="_topicButton_12fkg_127",KE="_topicButtonActive_12fkg_147",$E="_main_12fkg_157",UE="_articleTitle_12fkg_164",VE="_articleBody_12fkg_171",WE="_noResults_12fkg_176",GE="_related_12fkg_181",ZE="_relatedTitle_12fkg_187",qE="_relatedList_12fkg_194",YE="_relatedButton_12fkg_200",XE="_relatedItem_12fkg_223",Fe={backdrop:IE,dialog:jE,headerRow:EE,header:ME,close:_E,searchRow:NE,search:LE,body:BE,sidebar:FE,category:HE,topicList:zE,topicButton:OE,topicButtonActive:KE,main:$E,articleTitle:UE,articleBody:VE,noResults:WE,related:GE,relatedTitle:ZE,relatedList:qE,relatedButton:YE,relatedItem:XE};function JE(e){return{getStarted:"helpCategoryGetStarted",file:"helpCategoryFile",edit:"helpCategoryEdit",insert:"helpCategoryInsert",format:"helpCategoryFormat",table:"helpCategoryTable",view:"helpCategoryView",keyboard:"helpCategoryKeyboard"}[e]}function QE({open:e,topicId:t,onTopicChange:n,onClose:r}){const o=X(),a=l.useId(),s=l.useRef(null),[u,d]=l.useState("");Ve(s,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{e||d("")},[e]);const f=l.useMemo(()=>Zc.map(b=>({id:b.id,title:o(b.titleKey),body:o(b.bodyKey),keywords:o(b.keywordsKey)})),[o]),g=l.useMemo(()=>{const b=UR(f,u);return new Set(b.map(C=>C.id))},[u,f]),h=Ff[t],y=u.trim().length>0&&g.size===0;return e?i.jsx(ke,{children:i.jsx("div",{className:Fe.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:s,className:Fe.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:Fe.headerRow,children:[i.jsx("h2",{id:a,className:Fe.header,children:o("helpDialogTitle")}),i.jsx("button",{type:"button",className:Fe.close,onClick:r,"aria-label":o("helpDialogCloseAria"),children:i.jsx(Je,{})})]}),i.jsx("div",{className:Fe.searchRow,children:i.jsx("input",{type:"search",className:Fe.search,value:u,onChange:b=>d(b.target.value),placeholder:o("helpDialogSearchPlaceholder"),"aria-label":o("helpDialogSearchAria")})}),i.jsxs("div",{className:Fe.body,children:[i.jsx("aside",{className:Fe.sidebar,"aria-label":o("helpDialogContentsAria"),children:KR.map(b=>{const C=Zc.filter(x=>x.category===b&&g.has(x.id));return C.length===0?null:i.jsxs("div",{children:[i.jsx("h3",{className:Fe.category,children:o(JE(b))}),i.jsx("ul",{className:Fe.topicList,children:C.map(x=>i.jsx("li",{children:i.jsx("button",{type:"button",className:`${Fe.topicButton}${x.id===t?` ${Fe.topicButtonActive}`:""}`,onClick:()=>n(x.id),children:o(x.titleKey)})},x.id))})]},b)})}),i.jsx("div",{className:Fe.main,children:y?i.jsx("p",{className:Fe.noResults,children:o("helpDialogNoResults")}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:Fe.articleTitle,children:o(h.titleKey)}),i.jsx("p",{className:Fe.articleBody,children:o(h.bodyKey)}),h.related.length>0?i.jsxs("div",{className:Fe.related,children:[i.jsx("h4",{className:Fe.relatedTitle,children:o("helpDialogRelatedTitle")}),i.jsx("ul",{className:Fe.relatedList,children:h.related.map(b=>{const C=Ff[b];return!C||!g.has(b)?null:i.jsx("li",{className:Fe.relatedItem,children:i.jsx("button",{type:"button",className:Fe.relatedButton,onClick:()=>n(b),children:o(C.titleKey)})},b)})})]}):null]})})]})]})})}):null}function fb(e){return{catalog:e.catalog,layout:e.layout,commands:e.commands,queries:e.queries,queryRevisions:e.queryRevisions,disabled:e.disabled,chromeLock:e.chromeLock}}function eM(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}const tM=l.memo(function({menuVisible:t,captureChromeSelection:n,displayCatalog:r,displayLayout:o,commands:a,queries:s,queryRevisions:u,chromeDisabled:d,chromeLock:f,contentLocked:g,customizeToolbarOpen:h,baseCatalog:y,allowedLayout:b,toolbarSettings:C,toolbarSettingsLoading:x,toolbarSettingsBusy:v,onCustomizeToolbarClose:k,onToolbarSettingsChange:S,onToolbarSettingsReset:A,documentPreview:T,onDocumentPreviewClose:D,helpDialog:R,onHelpDialogClose:P,onHelpTopicChange:M,aboutDialogOpen:L,onAboutDialogClose:U,fontDialog:j,fontSizeState:_,markState:O,fontFamilyState:G,fontColorState:Z,highlightColorState:oe,fontFaces:Y,onFontDialogTabChange:J,onFontDialogClose:ie,onApplyFontProperties:de,paragraphDialog:te,customBackgroundImagePicker:E,disableBuiltinBackgroundImageSources:re,onParagraphCustomImagePick:pe,onParagraphDialogTabChange:F,onParagraphDialogClose:Ee,onApplyParagraphProperties:He,customCssDialog:ze,onCustomCssDialogClose:We,onApplyCustomCss:ot,pageDialog:it,enablePageProperties:Jt,onPageCustomImagePick:at,onPageDialogTabChange:q,onPageDialogClose:ae,onApplyPageProperties:ge,onPageDialogResetAtRule:Le,deletePageConfirmOpen:Kt,onDeletePageConfirmClose:$t,onDeletePageConfirm:Ut,customStyleDialog:Pe,canDeleteCustomParagraphStyle:yn,customStyleBusy:xn,onCustomStyleDialogClose:Dr,onCustomStyleSave:Ir,onCustomStyleDelete:jr,linkDialog:ye,onLinkDialogTabChange:Qt,onLinkDialogClose:Er,onApplyLink:rr,bookmarkDialog:or,onBookmarkDialogClose:z,onApplyBookmark:Q,imageDialogOpen:le,customImagePicker:Me,customAudioPicker:St,customVideoPicker:Cn,onImageDialogClose:Qe,onApplyImage:Oe,onImageDialogCustomPick:Ae,audioDialogOpen:$e,onAudioDialogClose:en,onApplyAudio:Ps,onAudioDialogCustomPick:pi,youtubeDialogOpen:As,onYoutubeDialogClose:st,onApplyYoutube:gi,onYoutubeDialogCustomPick:Pt,imageProperties:tn,onImagePropertiesTabChange:jn,onImagePropertiesClose:Ts,onApplyImageProperties:yo,tableDialogOpen:Rs,onTableDialogClose:hi,onApplyTable:En,tableProperties:nn,onTablePropertiesClose:xo,onApplyTableProperties:ir,cellProperties:H,onCellPropertiesClose:_t,onApplyCellProperties:bi,rowProperties:ar,onRowPropertiesClose:pt,onApplyRowProperties:sr}){const yi=fb({catalog:r,layout:o,commands:a,queries:s,queryRevisions:u,disabled:d,chromeLock:f});return i.jsxs(i.Fragment,{children:[t?i.jsx("div",{className:Ce.menuChrome,onPointerDownCapture:n,children:i.jsx(qc,{...yi,menuVisible:!0,toolbarVisible:!1})}):null,h?i.jsx(tA,{open:!0,catalog:y,groups:b.iconGroups,settings:C,loading:x,busy:v,disabled:g,onChange:S,onReset:A,onClose:k}):null,T.open?i.jsx(fE,{open:!0,html:T.html,onClose:D}):null,R.open?i.jsx(QE,{open:!0,topicId:R.topicId,onTopicChange:M,onClose:P}):null,L?i.jsx(DE,{open:!0,onClose:U}):null,j.open?i.jsx(II,{open:!0,tab:j.tab,size:_.value,unit:_.unit,marks:O,fontFamily:G.value,fontFamilyMixed:G.mixed,fontColor:Z.value,fontColorMixed:Z.mixed,highlightColor:oe.value,highlightColorMixed:oe.mixed,fonts:Y,disabled:g,onTabChange:J,onApply:de,onClose:ie}):null,te.open?i.jsx(ej,{open:!0,tab:te.tab,value:te.value,backgroundImage:te.backgroundImage,disabled:g,customImagePicker:E,disableBuiltinBackgroundImageSources:re,onCustomImagePick:pe,onTabChange:F,onApply:He,onClose:Ee}):null,ze.open?i.jsx(fj,{open:!0,value:ze.value,disabled:g,onApply:ot,onClose:We}):null,it.open?i.jsx(lj,{open:!0,tab:it.tab,initialParagraphTab:it.paragraphTab,value:it.value,fonts:Y,disabled:g,printTabVisible:Jt,customImagePicker:E,disableBuiltinBackgroundImageSources:re,onCustomImagePick:at,onTabChange:q,onApply:ge,onResetAtRule:Le,onClose:ae}):null,Kt?i.jsx(cj,{open:!0,disabled:g,onClose:$t,onConfirm:Ut}):null,Pe.open?i.jsx(mj,{open:!0,mode:Pe.mode,styleId:Pe.mode==="edit"?Pe.style.id:void 0,name:Pe.mode==="edit"?Pe.style.name:"",font:Pe.mode==="edit"?Pe.style.font:Pe.font,paragraph:Pe.mode==="edit"?Pe.style.paragraph:Pe.paragraph,canDelete:yn,fonts:Y,busy:xn,disabled:g,onSave:Ir,onDelete:jr,onClose:Dr}):null,ye.open?i.jsx(Mj,{open:!0,tab:ye.tab,href:ye.href,title:ye.title,targetBlank:ye.targetBlank,textDecorationNone:ye.textDecorationNone,hoverMode:ye.hoverMode,hoverColor:ye.hoverColor,hoverHtml:ye.hoverHtml,bookmarks:ye.bookmarks,selectedBookmarkId:ye.selectedBookmarkId,disabled:g,onTabChange:Qt,onApply:rr,onClose:Er}):null,or.open?i.jsx(gj,{open:!0,existingIds:or.existingIds,disabled:g,onApply:Q,onClose:z}):null,le?i.jsx(xj,{open:!0,disabled:g,customImagePicker:Me,onApply:Oe,onCustomPick:Ae,onClose:Qe}):null,$e?i.jsx(yj,{open:!0,disabled:g,customAudioPicker:St,onApply:Ps,onCustomPick:pi,onClose:en}):null,As?i.jsx(_j,{open:!0,disabled:g,customVideoPicker:Cn,onApply:gi,onCustomPick:Pt,onClose:st}):null,tn.open?i.jsx(Ej,{open:!0,tab:tn.tab,value:tn.value,aspectRatio:tn.aspectRatio,disabled:g,onTabChange:jn,onApply:yo,onClose:Ts}):null,Rs?i.jsx(zj,{open:!0,disabled:g,onApply:En,onClose:hi}):null,nn.open?i.jsx(Vj,{open:!0,value:nn.value,disabled:g,onApply:ir,onClose:xo}):null,H.open?i.jsx(Jj,{open:!0,value:H.value,disabled:g,onApply:bi,onClose:_t}):null,ar.open?i.jsx(nE,{open:!0,value:ar.value,disabled:g,onApply:sr,onClose:pt}):null]})},eM);function nM({toolbarVisible:e,toolbarPos:t,captureChromeSelection:n,toolbarShellProps:r,children:o}){return i.jsxs("div",{className:Ce.body,"data-icon-dock":e?t:void 0,children:[e&&(t==="top"||t==="left")?i.jsx("div",{className:Ce.iconChrome,onPointerDownCapture:n,children:i.jsx(qc,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null,o,e&&(t==="bottom"||t==="right")?i.jsx("div",{className:Ce.iconChrome,onPointerDownCapture:n,children:i.jsx(qc,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null]})}const pb=l.createContext(null);function rM({value:e,children:t}){return i.jsx(pb.Provider,{value:e,children:t})}function oM(){const e=l.useContext(pb);if(!e)throw new Error("useEditorShellContext must be used within EditorShellProvider");return e}function iM(e,t){const n=l.useRef([]),r=l.useRef([]);return l.useMemo(()=>{const o=n.current,a=r.current,s=[];for(let u=0;u<e.length;u+=1){const d=e[u]??"";o[u]===d&&a[u]!==void 0?s.push(a[u]):s.push(he(d).body)}return n.current=e,r.current=s,s},[e,t,e.length])}const aM="_panel_6xdnw_1",sM="_header_6xdnw_17",lM="_title_6xdnw_26",cM="_close_6xdnw_32",uM="_messages_6xdnw_48",dM="_empty_6xdnw_57",mM="_message_6xdnw_48",fM="_messageHeader_6xdnw_69",pM="_author_6xdnw_77",gM="_time_6xdnw_81",hM="_body_6xdnw_86",bM="_reply_6xdnw_92",yM="_input_6xdnw_100",xM="_post_6xdnw_111",yt={panel:aM,header:sM,title:lM,close:cM,messages:uM,empty:dM,message:mM,messageHeader:fM,author:pM,time:gM,body:hM,reply:bM,input:yM,post:xM};function CM(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function wM({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:o,onPost:a,onClose:s}){const u=X(),[d,f]=l.useState(""),g=l.useRef(null);l.useEffect(()=>{var x;(x=g.current)==null||x.focus()},[e==null?void 0:e.id]);const h=!n&&r&&d.trim().length>0,y=l.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),b=y.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const C=()=>{const x=d.trim();!x||!h||(a(x),f(""))};return Yc.createPortal(i.jsxs("div",{ref:o,className:yt.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[i.jsxs("div",{className:yt.header,children:[i.jsx("h2",{className:yt.title,children:u("commentPanelTitle")}),i.jsx("button",{type:"button",className:yt.close,onClick:s,"aria-label":u("commentPanelCloseAria"),children:i.jsx(Je,{})})]}),i.jsx("div",{className:yt.messages,children:y.length===0?i.jsx("p",{className:yt.empty,children:u("commentEmpty")}):y.map(x=>i.jsxs("article",{className:yt.message,children:[i.jsxs("header",{className:yt.messageHeader,children:[i.jsx("span",{className:yt.author,children:x.userName}),i.jsx("time",{className:yt.time,dateTime:x.createdAt,children:CM(x.createdAt,t)})]}),i.jsx("p",{className:yt.body,children:x.message})]},x.id))}),i.jsxs("div",{className:yt.reply,children:[i.jsx("textarea",{ref:g,className:yt.input,value:d,onChange:x=>f(x.target.value),placeholder:b,rows:3,disabled:n||!r}),i.jsx("button",{type:"button",className:yt.post,onClick:C,disabled:!h,children:u("commentPost")})]})]}),document.body)}const vM=l.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:o},a){const s=X();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})}),kM="_shell_yvznc_1",SM="_scrollButton_yvznc_10",PM="_tabList_yvznc_48",AM="_tab_yvznc_48",TM="_tabActive_yvznc_86",qr={shell:kM,scrollButton:SM,tabList:PM,tab:AM,tabActive:TM},RM=5,qf=120;function DM({pageCount:e,activeIndex:t,onSelect:n}){const r=X(),o=l.useRef(null),[a,s]=l.useState(!1),[u,d]=l.useState(!1),f=e>=RM,g=l.useCallback(()=>{const b=o.current;if(!b)return;const{scrollLeft:C,scrollWidth:x,clientWidth:v}=b;s(C>1),d(C+v<x-1)},[]);l.useEffect(()=>{g()},[e,t,g]),l.useEffect(()=>{var x;const b=o.current;if(!b)return;const C=b.querySelector(`[data-page-tab="${t}"]`);(x=C==null?void 0:C.scrollIntoView)==null||x.call(C,{block:"nearest",inline:"nearest"}),g()},[t,g]),l.useEffect(()=>{const b=o.current;if(!b)return;const C=()=>g();if(b.addEventListener("scroll",C,{passive:!0}),typeof ResizeObserver>"u")return()=>{b.removeEventListener("scroll",C)};const x=new ResizeObserver(()=>g());return x.observe(b),()=>{b.removeEventListener("scroll",C),x.disconnect()}},[g]);const h=b=>{var C;(C=o.current)==null||C.scrollBy({left:b,behavior:"smooth"})},y=b=>r("htmlModePageTab").replace("{n}",String(b+1));return i.jsxs("div",{className:qr.shell,children:[f?i.jsx("button",{type:"button",className:qr.scrollButton,"aria-label":r("htmlModePageTabsScrollLeftAria"),disabled:!a,onClick:()=>h(-qf),children:"‹"}):null,i.jsx("div",{ref:o,className:qr.tabList,role:"tablist","aria-label":r("htmlModePageTabsAria"),children:Array.from({length:e},(b,C)=>i.jsx("button",{type:"button",role:"tab","data-page-tab":C,className:`${qr.tab} ${C===t?qr.tabActive:""}`,"aria-selected":C===t,tabIndex:C===t?0:-1,onClick:()=>n(C),children:y(C)},C))}),f?i.jsx("button",{type:"button",className:qr.scrollButton,"aria-label":r("htmlModePageTabsScrollRightAria"),disabled:!u,onClick:()=>h(qf),children:"›"}):null]})}function IM(e,t,n=!0){const[r,o]=l.useState(null),[a,s]=l.useState($u()),u=l.useCallback(()=>{!n||!e||(o(ob(e,t)),s(is(e)))},[n,e,t]);return l.useLayoutEffect(()=>{if(!n)return;const d=requestAnimationFrame(u);return()=>cancelAnimationFrame(d)},[n,u]),l.useLayoutEffect(()=>{if(!n||!e||typeof ResizeObserver>"u")return;const d=new ResizeObserver(()=>u());return d.observe(e),()=>d.disconnect()},[n,e,u]),l.useLayoutEffect(()=>{if(!n||!e)return;const d=()=>{s(is(e))};return document.addEventListener("selectionchange",d),()=>document.removeEventListener("selectionchange",d)},[n,e]),{geometry:r,indentState:a,refresh:u}}const jM=l.forwardRef(function({html:t,pageHtml:n,onChange:r,placeholder:o,disabled:a,rulerVisible:s=!0,rulerUnit:u="in",zoomScale:d=1,onMarginChange:f,onMarginPreview:g,onIndentChange:h,onBeforeInput:y,propSyncGuardRef:b,resolveEmbeddedImageDataUrl:C,hydrateEmbeddedImages:x,onPointerDown:v,onMouseUp:k,onContextMenu:S},A){const T=X(),D=l.useRef(null),R=l.useRef(!1),[P,M]=l.useState(null),L=l.useRef(y);L.current=y;const U=n??t,j=s&&li(U),{geometry:_,indentState:O,refresh:G}=IM(P,U,j),Z=Y=>{D.current=Y,M(Y),typeof A=="function"?A(Y):A&&(A.current=Y)};l.useLayoutEffect(()=>{const Y=D.current;if(!Y)return;const J=dn(t),de=Y===document.activeElement&&R.current;if(R.current=!1,de||ts(Y,J,{resolveDataUrl:C,hydrateEmbeddedImages:x}),ct(Y)||li(U)){vu(Y),ai(Y),ys(Y);const te=ct(Y);te&&Qp(Y,te)}bs(Y),ho(Y,U)},[t,U,C,x]),l.useLayoutEffect(()=>{if(b)return b.current=()=>{R.current=!0},()=>{b.current=null}},[b]),l.useLayoutEffect(()=>{const Y=D.current;if(!Y)return;const J=ie=>{var de;(de=L.current)==null||de.call(L,ie)};return Y.addEventListener("beforeinput",J),()=>Y.removeEventListener("beforeinput",J)},[]);const oe=i.jsx("div",{ref:Z,className:`${Ce.surface} ${Ce.visual} ${j?Ce.pageSurface:""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":T("visualEditorAria"),"aria-disabled":a||void 0,"data-placeholder":o,onPointerDown:v,onMouseUp:k,onContextMenu:S,onInput:Y=>{const J=Y.currentTarget;if(R.current=!0,ct(J)){const{absorbedBlocks:ie}=ai(J);if(r(J.innerHTML),ie.length>0){const de=ie.length;requestAnimationFrame(()=>rg(J,de))}}else r(J.innerHTML);j&&G()}});return i.jsx(hI,{showRulers:j,geometry:_,indentState:O,rulerUnit:u,zoomScale:d,onMarginChange:f,onMarginPreview:g,onIndentChange:h,children:oe})}),EM="_frame_bwkh8_1",MM="_handle_bwkh8_9",_M="_handleEast_bwkh8_29",NM="_handleSouth_bwkh8_37",LM="_handleSouthEast_bwkh8_45",ei={frame:EM,handle:MM,handleEast:_M,handleSouth:NM,handleSouthEast:LM};function $o(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const BM=[{handle:"e",className:ei.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:ei.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:ei.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function dc(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function FM({img:e,onResize:t,onResizeEnd:n}){const r=X(),o=l.useRef(null),a=l.useRef(e),s=l.useRef(t),u=l.useRef(n),d=l.useRef(null);a.current=e,s.current=t,u.current=n;const f=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`)};l.useLayoutEffect(()=>{f($o(e));const k=()=>{e.isConnected&&f($o(e))};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[e]);const g=(k,S)=>{const A=d.current,T=a.current;if(!A||!T)return;const D=E0(A.handle,A.start,{x:k-A.originX,y:S-A.originY});s.current(D.width,D.height),T.isConnected&&f($o(T))},h=()=>{if(!d.current)return;d.current=null;const k=a.current;u.current(),k!=null&&k.isConnected&&f($o(k))};l.useLayoutEffect(()=>{const k=A=>{if(!d.current)return;const T=dc(A);T&&g(T.x,T.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 y=(k,S)=>{const A=dc(S);A&&(d.current={handle:k,start:M0(a.current),originX:A.x,originY:A.y})},b=k=>S=>{S.preventDefault(),S.stopPropagation(),y(k,S);try{S.currentTarget.setPointerCapture(S.pointerId)}catch{}},C=k=>S=>{S.preventDefault(),S.stopPropagation(),y(k,S)},x=k=>{const S=dc(k);S&&g(S.x,S.y)};if(!e.isConnected)return null;const v=$o(e);return Yc.createPortal(i.jsx("div",{ref:o,className:ei.frame,"data-image-resize-overlay":"",style:{left:v.left,top:v.top,width:v.width,height:v.height},children:BM.map(k=>i.jsx("button",{type:"button",className:`${ei.handle} ${k.className}`,style:{cursor:k.cursor},"aria-label":r(k.ariaKey),"data-resize-handle":k.handle,onPointerDown:b(k.handle),onPointerMove:x,onPointerUp:h,onPointerCancel:h,onMouseDown:C(k.handle),onMouseMove:x,onMouseUp:h},k.handle))}),document.body)}function HM(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}function zM(){const e=X();return i.jsx("div",{className:Ce.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function OM({propsRef:e,pageStore:t,mode:n,enableMultiPages:r,contentLocked:o,activePageIndex:a,hasSelectedPage:s,pageZoomScale:u,rulerVisible:d,rulerUnit:f,optimizeEmbeddedImages:g,placeholder:h,controlledHtml:y,initialHtml:b,initialStorageHtml:C,defaultPages:x,ingestedPagesProp:v,onChange:k,fontFaces:S,enableComments:A,commentsVisible:T,disabled:D,locale:R,commentAuthor:P,activeThreadId:M,contextMenu:L,commentThreads:U,commands:j,htmlFileDropDragging:_,selectedImage:O}){const{htmlRef:G,pagesRef:Z,documentBridgeRef:oe}=oM(),[Y,J]=l.useState(C),[ie,de]=_a({value:g?void 0:y,defaultValue:b,onChange:r||g?void 0:k}),te=g?Y:ie,[E,re]=l.useState(()=>r?x[0]??"":""),pe=l.useRef(E);pe.current=E;const F=e.current;g?r||(G.current=Y):G.current=ie,r&&(Z.current=t.pages);const Ee=l.useCallback(()=>r?t.getJoinedHtml():g?Y:ie,[r,ie,g,t,Y]);l.useLayoutEffect(()=>{const q={pageStore:t,setHtml:de,setStorageHtml:J,getEditorHtml:Ee,replacePagesFromHistory:ae=>t.replacePages([...ae])};return oe.current=q,()=>{oe.current===q&&(oe.current=null)}},[oe,Ee,t,de,J]);const He=l.useMemo(()=>{if(r){const q=t.pages[a]??t.pages[0]??"";return Mm(q,S).join(`
|
|
317
|
+
${T1}`:af}function Rc(e,t,n=""){const r=Ru(t),{hrefs:o,body:a}=he(r.html),s=e.createElement("meta");s.setAttribute("charset","utf-8");const u=e.createElement("title");u.textContent=n;const d=e.createElement("style");d.textContent=kg(r.hasBleed);const f=o.map(g=>{const h=e.createElement("link");return h.rel="stylesheet",h.href=g,h});e.head.replaceChildren(s,u,d,...f),e.title=n,e.body.innerHTML=a}function Du(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 I1(e){const t=e.name.toLowerCase();return e.type==="text/html"||t.endsWith(".html")||t.endsWith(".htm")}function Aa(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 j1(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 E1(e){return e?j1(e).find(I1)??null:null}const Sg={description:"HTML",accept:{"text/html":[".html",".htm"]}},M1="document.html";function Pg(){return window}function Ag(e){return e instanceof DOMException&&e.name==="AbortError"}function _1(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 N1(){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}Du(r).then(a=>n(vg(a)),()=>n(null))}),t.addEventListener("cancel",()=>n(null)),document.body.append(t),t.click()})}async function L1(e,t=M1){const n=Pg().showSaveFilePicker;if(typeof n=="function"){try{const o=await(await n({suggestedName:t,types:[Sg]})).createWritable();await o.write(e),await o.close()}catch(r){if(Ag(r))return;throw r}return}_1(e,t)}async function B1(){const e=Pg().showOpenFilePicker;if(typeof e=="function")try{const[t]=await e({multiple:!1,types:[Sg]}),n=await t.getFile();return vg(await Du(n))}catch(t){if(Ag(t))return null;throw t}return N1()}const F1=1e3;function H1(e){var t;return e.complete&&e.naturalWidth>0?Promise.resolve((t=e.decode)==null?void 0:t.call(e)).catch(()=>{}):new Promise(n=>{const r=()=>{var o;Promise.resolve((o=e.decode)==null?void 0:o.call(e)).catch(()=>{}).then(()=>n())};e.addEventListener("load",r,{once:!0}),e.addEventListener("error",r,{once:!0})})}function z1(e){const t=[...e.images];return t.length===0?Promise.resolve():Promise.all(t.map(H1)).then(()=>{})}function Tg(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.setAttribute("data-wysiwyg-print",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.width="1px",e.style.height="1px",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}}async function Rg(e,t,n,r){Rc(e,r);let o=!1;const a=()=>{o||(o=!0,n.remove())};t.addEventListener("afterprint",a),await z1(e),t.focus(),t.print(),window.setTimeout(a,F1)}function O1(e){const t=Tg();t&&Rg(t.doc,t.win,t.iframe,e)}function K1(e){const t=Tg();if(!t)return;const n=e.map(Ru),r=n.some(g=>g.hasBleed),o=[],a=[];for(const g of n){const h=he(g.html);o.push(...h.hrefs),a.push(h.body)}const s=a.map((g,h)=>`<div data-wysiwyg-print-page="" style="${h===a.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;"}">${g}</div>`).join(""),u=qp(e),d=r?"@page { margin: 0 !important; }":"",f=[u?`<style>${u}</style>`:"",d?`<style>${d}</style>`:"",...Array.from(new Set(o)).map(g=>`<link rel="stylesheet" href="${g}" />`),s].filter(Boolean).join("");Rg(t.doc,t.win,t.iframe,f)}function $1(e){return{save:async()=>{if(e.onSave){const t=e.isMultiPagesEnabled()?e.getAllPagesHtml():e.getHtml();await e.onSave(t);return}await L1(D1(e.getHtml()))},open:async()=>{const t=e.onOpen?await e.onOpen():await B1();if(t!==null){if(Array.isArray(t)){e.setHtml(jt(t));return}if(e.isMultiPagesEnabled()){e.setHtml(jt([t]));return}e.setHtml(t)}},print:()=>{if(e.isMultiPagesEnabled()){K1(Un(e.getHtml()));return}O1(e.getHtml())}}}function U1(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 V1(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 W1(e){return{undo:()=>{e.undo()},redo:()=>{e.redo()}}}function G1(e){return{canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo()}}function Z1(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 q1(e){return{isLink:()=>e.isLink(),isImageSelected:()=>e.isImageSelected(),isMultiPagesEnabled:()=>e.isMultiPagesEnabled(),hasSelectedPage:()=>e.hasSelectedPage(),canDeletePage:()=>e.canDeletePage(),canInsertPageBackgroundImage:()=>e.canInsertPageBackgroundImage(),canInsertParagraphBackgroundImage:()=>e.canInsertParagraphBackgroundImage()}}function Y1(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 X1(e){return{isInTable:()=>e.isInTable(),canMergeCells:()=>e.canMergeCells(),canUnmergeCells:()=>e.canUnmergeCells()}}function J1(e){return{openHelp:()=>{e.openHelp()},openKeyboardShortcuts:()=>{e.openKeyboardShortcuts()},openAbout:()=>{e.openAbout()}}}const Q1=[50,75,100,125,150,200],ev=.1,tv=3;function ec(e){return!Number.isFinite(e)||e<=0?1:Math.min(tv,Math.max(ev,e))}function nv(e,t,n,r,o){if(e==="fitWidth")return r<=0?1:ec(t/r);if(e==="fitPage"){if(r<=0||o<=0)return 1;const a=t/r,s=n/o;return ec(Math.min(a,s))}return ec(e/100)}function rv(e){let t=null;return{schedule(){t===null&&(t=window.requestAnimationFrame(()=>{t=null,e()}))},cancel(){t!==null&&(window.cancelAnimationFrame(t),t=null)}}}function Bn(e,t){return()=>{e.setPageZoom(t)}}function Fn(e,t){return()=>e.getPageZoom()===t}function ov(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:Bn(e,"fitWidth"),setPageZoomFitPage:Bn(e,"fitPage"),setPageZoom50:Bn(e,50),setPageZoom75:Bn(e,75),setPageZoom100:Bn(e,100),setPageZoom125:Bn(e,125),setPageZoom150:Bn(e,150),setPageZoom200:Bn(e,200),setToolbarPositionTop:()=>{e.setToolbarPosition("top")},setToolbarPositionLeft:()=>{e.setToolbarPosition("left")},setToolbarPositionRight:()=>{e.setToolbarPosition("right")},setToolbarPositionBottom:()=>{e.setToolbarPosition("bottom")}}}function iv(e){return{isVisualMode:()=>e.getMode()==="visual",isHtmlMode:()=>e.getMode()==="html",isFullscreen:()=>e.getFullscreen(),isLightMode:()=>!e.getDarkMode(),isDarkMode:()=>e.getDarkMode(),isPageZoomFitWidth:Fn(e,"fitWidth"),isPageZoomFitPage:Fn(e,"fitPage"),isPageZoom50:Fn(e,50),isPageZoom75:Fn(e,75),isPageZoom100:Fn(e,100),isPageZoom125:Fn(e,125),isPageZoom150:Fn(e,150),isPageZoom200:Fn(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 av(e){return{addComment:()=>e.addComment(),toggleCommentsVisible:()=>e.toggleCommentsVisible()}}function sv(e){return{canAddComment:()=>e.canAddComment(),areCommentsVisible:()=>e.areCommentsVisible(),isCommentsEnabled:()=>e.isCommentsEnabled()}}function lv(e){return{...$1(e),...W1(e),...ex(e),...Z1(e),...Y1(e),...ov(e),...U1(e),...av(e),...J1(e)}}function cv(e){return{...iv(e),...G1(e),...q1(e),...X1(e),...V1(e),...sv(e)}}function qa(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function uv(e){const t=e.style.fontSize;if(!t)return null;const n=au(t);return!n||!fs(n.unit)?null:{value:n.value,unit:n.unit}}function Dg(e,t){let n=qa(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=uv(n);if(r)return r;n=n.parentElement}return null}function dv(e,t){const n=qa(e)??t,r=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(r)&&r>0?r:16}function Ig(e,t){var a;let n=qa(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=qa(t))==null?void 0:a.parentElement)??e,o=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(o)&&o>0?o:16}function jg(e){const t=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(t)&&t>0?t:16}function mv(e,t){return e===t?!0:!e||!t?!1:e.value===t.value&&e.unit===t.unit}function sf(e=oo){return{value:null,unit:e,mixed:!1}}function Eg(e,t=oo){const n=window.getSelection();if(!n||n.rangeCount===0)return sf(t);const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer))return sf(t);const o=r.collapsed?[]:vt(r).filter(f=>f.data.length>0),a=o.length>0?o:[r.startContainer],s=a.map(f=>Dg(e,f)),u=s[0];if(s.every(f=>mv(f,u))&&u)return{value:u.value,unit:u.unit,mixed:!1};if(s.every(f=>f===null)){const f=a.map(h=>dv(h,e)),g=f[0];if(f.every(h=>Math.abs(h-g)<.05)){const h=Ig(e,a[0]),y=jg(e);return{value:hp(g,t,h,y),unit:t,mixed:!1}}return{value:null,unit:t,mixed:!0}}return{value:null,unit:t,mixed:!0}}function fv(e,t){return{parentPx:Ig(e,t),rootPx:jg(e)}}function pv(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function Dc(e,t,n){const r=vr(t,n);if(!r)return!1;const o=pv(e);if(!o||o.collapsed)return!1;const a=iu(r.value,r.unit);fn(o);const s=vt(o).filter(u=>u.data.length>0);for(const u of s){const d=Dg(e,u);d&&d.value===r.value&&d.unit===r.unit||ui(u,f=>{f.style.fontSize=a})}return Tr(s),!0}function gv(e,t){e.style.fontSize=iu(t.value,t.unit)}function hv(e){return e.nodeType===Node.TEXT_NODE?e.parentElement:e instanceof Element?e:e.parentElement}function bv(e){return e.trim().toLowerCase()}function Ic(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=bv(r.slice(0,o)),s=r.slice(o+1).trim();a&&(t[a]=s)}return t}function Mg(e){return Object.entries(e).filter(([t])=>t.trim()).map(([t,n])=>`${t}: ${n}`).join("; ")}function yv(e,t){const n={...e};for(const[r,o]of Object.entries(t))o.trim()?n[r]=o:delete n[r];return n}function xv(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(`
|
|
318
|
+
`)}function Cs(e){const t=Ic(e);return Mg(t)}function Cv(e,t){let n=hv(t);for(;n&&n!==e&&n instanceof HTMLElement;){const r=n.style.cssText.trim();if(r)return r;n=n.parentElement}return""}function _g(e){const t=hn(e);if(!t)return{value:null,mixed:!1};const n=t.collapsed?[]:vt(t).filter(d=>d.data.length>0),a=(n.length>0?n:[t.startContainer]).map(d=>Cv(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 Ng(e,t){const n=Ic(e.style.cssText),r=Ic(t),o=yv(n,r),a=Mg(o);a?e.style.cssText=a:e.removeAttribute("style")}function Lg(e,t){const n=Cs(t);if(!n)return!1;const r=hn(e);if(!r||r.collapsed)return!1;fn(r);const o=vt(r).filter(a=>a.data.length>0);if(o.length===0)return!1;for(const a of o)ui(a,s=>{Ng(s,n),Qn(s)&&Et(s)});return Tr(o),!0}function wv(e,t){const n=Cs(t);n&&Ng(e,n)}function vv(e){return!!(e&&Cs(e))}const zt=["bold","italic","underline","strikethrough"],Qr={bold:new Set(["strong","b"]),italic:new Set(["em","i"]),underline:new Set(["u"]),strikethrough:new Set(["s","strike","del"])},kv=new Set(["underline","line-through","overline"]);function Wn(){return{bold:!1,italic:!1,underline:!1,strikethrough:!1}}function Sv(e,t){return zt.every(n=>e[n]===t[n])}function Pv(e){return zt.some(t=>e[t]!==void 0)}function Bg(e,t){const n={...e};if(!t)return n;for(const r of zt){const o=t[r];o!==void 0&&(n[r]=o)}return n}function Av(e,t,n){const r=e[n]??t[n],o={...e,[n]:!r};return o[n]===t[n]&&delete o[n],o}function Yn(e){return(e.style.textDecorationLine||e.style.textDecoration).split(/\s+/).filter(n=>kv.has(n))}function mo(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 Fg(e,t){const n=e,r=e.tagName.toLowerCase();if(t==="bold"){if(Qr.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(Qr.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(Qr.underline.has(r))return!0;const s=n.style.textDecorationLine||n.style.textDecoration;if(!s)return null;if(s==="none")return!1;const u=Yn(n);return u.includes("underline")?!0:u.length>0?!1:null}if(Qr.strikethrough.has(r))return!0;const o=n.style.textDecorationLine||n.style.textDecoration;if(!o)return null;if(o==="none")return!1;const a=Yn(n);return a.includes("line-through")?!0:a.length>0?!1:null}function Ya(e,t){return Fg(e,t)===!0}function fo(e,t,n){let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t;for(;r&&r!==e&&r instanceof Element;){const o=Fg(r,n);if(o!==null)return o;r=r.parentElement}return!1}function Hg(e,t){if(t==="bold"){e.style.fontWeight="700";return}if(t==="italic"){e.style.fontStyle="italic";return}if(t==="underline"){const r=Yn(e);r.includes("underline")||r.push("underline"),mo(e,r);return}const n=Yn(e);n.includes("line-through")||n.push("line-through"),mo(e,n)}function zg(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"){mo(e,Yn(e).filter(n=>n!=="underline"));return}mo(e,Yn(e).filter(n=>n!=="line-through"))}function Tv(e,t){if(t==="bold"){e.style.fontWeight="400";return}if(t==="italic"){e.style.fontStyle="normal";return}if(t==="underline"){const r=Yn(e).filter(o=>o!=="underline");if(r.length===0){e.style.textDecorationLine="none";return}mo(e,r);return}const n=Yn(e).filter(r=>r!=="line-through");if(n.length===0){e.style.textDecorationLine="none";return}mo(e,n)}function Rv(e,t){ui(e,n=>Hg(n,t))}function Dv(e,t,n){let r=t;for(;r.parentElement&&r.parentElement!==e;){const o=r.parentElement;if(!gn(o)||!Ya(o,n)){r=o;continue}if(er(o,r),Ya(o,n)){if(Qr[n].has(o.tagName.toLowerCase())){Et(o);continue}if(zg(o,n),Qn(o)){Et(o);continue}}r=o}}function Iv(e,t,n){const r=vt(t).filter(o=>o.data.length>0);return r.length===0?fo(e,t.startContainer,n):r.every(o=>fo(e,o,n))}function jv(e,t,n,r){fn(t);const o=vt(t).filter(a=>a.data.length>0);for(const a of o)r?fo(e,a,n)||Rv(a,n):Dv(e,a,n);Tr(o)}function eo(e){const t=window.getSelection();if(!t||t.rangeCount===0)return Wn();const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return Wn();if(n.collapsed)return jc(e,n);const r=vt(n).filter(a=>a.data.length>0);if(r.length===0)return jc(e,n);const o=Wn();for(const a of zt)o[a]=fo(e,r[0],a);for(let a=1;a<r.length;a+=1)for(const s of zt)o[s]=o[s]&&fo(e,r[a],s);return o}function jc(e,t){const n=Wn();for(const r of zt)n[r]=fo(e,t.startContainer,r);return n}function Ec(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer)||r.collapsed)return!1;const o=Iv(e,r,t);return jv(e,r,t,!o),!0}function Ev(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 Mv(e,t,n){var a,s,u;Ev(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(!gn(d)){o=d;continue}if(!n.some(g=>Ya(d,g))){o=d;continue}er(d,o);for(const g of n)if(Ya(d,g)){if(Qr[g].has(d.tagName.toLowerCase())){Et(d);break}if(zg(d,g),Qn(d)){Et(d);break}}o=d.isConnected?d:r}return r}function _v(e,t,n){for(const r of zt)n[r]!==t[r]&&(n[r]?Hg(e,r):Tv(e,r))}function Nv(e,t,n,r,o,a,s){var S,A;const u=window.getSelection();if(!u||u.rangeCount===0)return;const d=u.getRangeAt(0);if(!Se(e,d.commonAncestorContainer))return;const f=jc(e,d),g=Bg(f,n),h=zt.filter(T=>f[T]&&!g[T]),y=lC(e,d.startContainer,o),b=Nx(e,d.startContainer,a);let C=null;h.length>0?(C=Mv(e,d,h),y.length>0&&Sp(e,C,y),b&&hc(e,C)):y.length>0?(C=sC(e,d,y),b&&hc(e,C)):b?C=_x(e,d):d.deleteContents();const x=document.createElement("span");_v(x,f,g),r&&gv(x,r),o!=null&&o.color&&Hm(x,"color",o.color),o!=null&&o.backgroundColor&&Hm(x,"backgroundColor",o.backgroundColor),a&&Ix(x,a),s&&wv(x,s),x.textContent=t;const v=x.style.cssText.trim()?x:document.createTextNode(t);C?((S=C.parentNode)==null||S.insertBefore(v,C),C.nodeType===Node.TEXT_NODE&&!C.data&&((A=C.parentNode)==null||A.removeChild(C))):d.insertNode(v);const k=document.createRange();k.selectNodeContents(v),k.collapse(!1),u.removeAllRanges(),u.addRange(k)}const Xa=["p","h1","h2","h3","h4","h5","h6"],Lv=new Set(Xa),Og=new Set([...Xa,"div"]),ws=new Set(["li","ul","ol","td","th","tr","thead","tbody","table","blockquote","pre"]),Bv=()=>({tag:null,mixed:!1});function Kg(e){return Lv.has(e)}function Fv(e){return Kg(e)?e:e==="div"?"p":null}function Hv(e){return e instanceof Element&&ws.has(_e(e))}function $g(e){return e instanceof HTMLElement&&!kt(e)&&Og.has(_e(e))}function Mc(e){if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.COMMENT_NODE||!(e instanceof Element))return!0;const t=_e(e);return Og.has(t)||ws.has(t)?!1:gn(e)||t==="br"||t==="a"||t==="img"||t==="span"}function zv(e,t){let n=mi(t);for(;n&&n!==e;){if(ws.has(_e(n)))return!0;n=n.parentElement}return!1}function Ug(e,t){let n=mi(t);for(;n&&n!==e;){if(og(n,e)){n=n.parentElement;continue}if($g(n))return n;if(ws.has(_e(n)))return null;n=n.parentElement}return null}function Ov(e,t){const n=new Set,r=[];for(const o of mu(t)){const a=Ug(e,o);a&&!n.has(a)&&(n.add(a),r.push(a))}return r}function Kv(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.parentNode===e?n:null}function $v(e,t){const n=[...e.childNodes],r=n.indexOf(t);if(r<0)return[t];let o=r,a=r;for(;o>0&&Mc(n[o-1]);)o-=1;for(;a<n.length-1&&Mc(n[a+1]);)a+=1;return n.slice(o,a+1)}function _c(e){for(const t of e.childNodes)if(!(t instanceof HTMLElement&&kt(t)))return t;return null}function Uv(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&&kt(r)?_c(e):r}return n.startContainer===t&&e!==t?_c(e):Kv(e,n.startContainer)}function Vv(e,t,n){const r=ku(e);if(zv(e,t.startContainer))return!1;if(!_c(r)){const u=document.createElement(n);return u.appendChild(document.createElement("br")),r.appendChild(u),!0}const o=Uv(r,e,t);if(!o||o instanceof HTMLElement&&kt(o)||Hv(o)||$g(o)||!Mc(o))return!1;const a=$v(r,o),s=document.createElement(n);r.insertBefore(s,a[0]);for(const u of a)s.appendChild(u);return!0}function Wv(e){const t=hn(e);if(!t)return Bv();const n=mu(t).map(o=>{const a=Ug(e,o);return a?Fv(_e(a)):null}),r=n[0];return n.every(o=>o===r)?{tag:r??null,mixed:!1}:{tag:null,mixed:!0}}function Gv(e,t){if(!Kg(t))return!1;const n=hn(e);if(!n)return!1;const r=io(e,n.startContainer,n.startOffset),o=io(e,n.endContainer,n.endOffset),a=Math.min(r,o),s=Math.max(r,o),u=Ov(e,n);let d=!1;if(u.length===0)d=Vv(e,n,t);else for(const f of u)_e(f)!==t&&(pu(f,t),d=!0);return fu(e,a,s),d}function Iu(e){if(!Ht(e))return null;const t=ao(e);if(!t)return null;const n=_e(t);return n==="ul"||n==="ol"?n:null}function Vg(e){const t=In(e);if(t.length===0)return{type:null,mixed:!1};const n=t.map(Iu),r=n[0];return n.every(o=>o===r)?{type:r,mixed:!1}:{type:null,mixed:!0}}function Zv(e,t,n){const r=[...e.children].filter(o=>du(o));for(const o of r)t.insertBefore(o,n)}function Wg(e){const t=ao(e),n=document.createElement("p");for(const f of[...e.attributes])n.setAttribute(f.name,f.value);for(n.style.marginLeft="",xt(n);e.firstChild&&!du(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=Ht(a)?a.parentNode??a:a,u=Ht(a)?a.nextSibling:t.nextSibling;e.remove();let d=null;if(r.length>0){d=document.createElement(t.tagName);for(const f of r)d.appendChild(f)}return s.insertBefore(n,u),d&&s.insertBefore(d,n.nextSibling),Zv(e,s,n.nextSibling),t.childElementCount===0&&t.remove(),n}function qv(e){if(Ht(e))return e;const t=pu(e,"li");return t.style.marginLeft="",xt(t),t}function Gg(e,t){if(e.length===0)return!1;if(e.every(Ht)){const a=ao(e[0]);if(a&&e.every(s=>s.parentElement===a)&&[...a.children].every(u=>u instanceof HTMLElement&&e.includes(u)))return _e(a)===t?!1:(pu(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=Ht(a)?ao(a):null;o.appendChild(qv(a)),s&&s!==o&&s.childElementCount===0&&s.remove()}return!0}function Zg(e){let t=!1;for(const n of[...e].reverse())Ht(n)&&(Wg(n),t=!0);return t}function Yv(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;if(n.every(a=>Iu(a)===t))return Zg(n);let o=!1;for(const a of Cp(n))Gg(a,t)&&(o=!0);return o})}function Xv(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;if(t===null)return Zg(n);if(n.every(a=>Iu(a)===t))return!1;let o=!1;for(const a of Cp(n))Gg(a,t)&&(o=!0);return o})}const qg=40;function ju(e){const t=e.style.marginLeft;if(!t)return 0;const n=Number.parseFloat(t);return Number.isFinite(n)?n:0}function Yg(e,t){if(t<=0){e.style.marginLeft="",xt(e);return}e.style.marginLeft=`${t}px`}function Jv(e){let t=e.previousElementSibling;for(;t;){if(Ht(t))return t;t=t.previousElementSibling}return null}function Qv(e){for(let t=e.children.length-1;t>=0;t-=1){const n=e.children[t];if(n instanceof HTMLElement&&(_e(n)==="ul"||_e(n)==="ol"))return n}return null}function ek(e){const t=Jv(e);if(!t)return!1;const n=ao(e);if(!n)return!1;const r=_e(n)==="ol"?"ol":"ul";let o=Qv(t);return(!o||_e(o)!==r)&&(o=document.createElement(r),t.appendChild(o)),o.appendChild(e),!0}function tk(e){const t=ao(e);if(!t)return!1;const n=t.parentElement;if(n&&Ht(n)){const r=n.parentElement;return r?(r.insertBefore(e,n.nextSibling),t.childElementCount===0&&t.remove(),!0):!1}return Wg(e),!0}function nk(e){return In(e).some(n=>Ht(n)||ju(n)>0)}function rk(e){return nr(e,()=>{const t=Rr(e);if(t.length===0)return!1;let n=!1;for(const r of t){if(Ht(r)){ek(r)&&(n=!0);continue}Yg(r,ju(r)+qg),n=!0}return n})}function ok(e){return nr(e,()=>{const t=In(e);if(t.length===0)return!1;let n=!1;for(const r of[...t].reverse()){if(Ht(r)){tk(r)&&(n=!0);continue}const o=ju(r);o<=0||(Yg(r,Math.max(0,o-qg)),n=!0)}return n})}function vs(e){return{colSpan:Math.max(1,e.colSpan||1),rowSpan:Math.max(1,e.rowSpan||1)}}function Ar(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 Mt(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 f=vs(d),g={cell:d,originRow:a,originCol:u,rowSpan:f.rowSpan,colSpan:f.colSpan};r.push(g);for(let h=0;h<f.rowSpan;h+=1){const y=a+h;if(y>=t)break;for(let b=0;b<f.colSpan;b+=1)n[y][u+b]=g}u+=f.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 Ja(e,t,n){var r;return((r=e.slots[t])==null?void 0:r[n])??null}function Xt(e,t){return e.unique.find(n=>n.cell===t)??null}function Xg(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 Jg(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 ik(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=Ja(e,o,a);!s||n.has(s.cell)||(n.add(s.cell),r.push(s.cell))}return r}function Qg(e,t){if(t.minRow>t.maxRow||t.minCol>t.maxCol)return null;const n=Ja(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=Ja(e,a,s);if(!u||Xg(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 ak(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=Ja(e,a,s);if(!u)return!1;if(u.cell!==t.cell&&Xg(u,o))return!1}return!0}const lf=10,to=1,no=50,sk="1px solid #000",lk="0.25em",ck=new Set(["td","th"]);function eh(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=to&&t>=to&&e<=no&&t<=no}function wt(e,t){return Mu(e,t,n=>n instanceof HTMLTableElement)}function Qa(e,t){return Mu(e,t,n=>Ck(n))}function uk(e,t){return Mu(e,t,n=>n instanceof HTMLTableRowElement)}function Eu(e){return wt(e,_u(e))}function bn(e){return Qa(e,_u(e))}function th(e){return uk(e,_u(e))}function dk(e){const t=[];for(const n of Array.from(e.rows))t.push(...Array.from(n.cells));return t}function pi(e){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return[];const r=Qa(e,n.startContainer),o=Qa(e,n.endContainer);if(!r)return[];if(!o||r===o)return[r];const a=wt(e,r);if(!a||wt(e,o)!==a)return[r];const s=Mt(a),u=Xt(s,r),d=Xt(s,o);if(!u||!d)return[r];const f=Jg([u,d]);if(!f)return[r];const g=ik(s,f);return g.length>0?g:[r]}function mk(e,t){if(!eh(t.rows,t.cols))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer))return!1;const 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 f=0;f<t.cols;f+=1)d.appendChild(wk("td"));a.appendChild(d)}o.appendChild(a),r.collapsed||r.deleteContents(),r.insertNode(o),Pk(e,o);const s=o.querySelector("td, th");return s instanceof HTMLTableCellElement&&Ct(s),!0}function Nc(e,t){var h,y,b,C;const n=bn(e);if(!n)return!1;const r=wt(e,n);if(!r)return!1;const o=Mt(r),a=Xt(o,n);if(!a)return!1;const s=t==="before"?a.originRow:a.originRow+a.rowSpan,u=new Set;for(const x of o.unique)if(x.originRow<s&&x.originRow+x.rowSpan>s){Ar(x.cell,x.colSpan,x.rowSpan+1);for(let v=x.originCol;v<x.originCol+x.colSpan;v+=1)u.add(v)}const d=document.createElement("tr"),f=Math.min(s,o.rowCount-1);for(let x=0;x<o.colCount;x+=1){if(u.has(x))continue;const v=((y=(h=o.slots[f])==null?void 0:h[x])==null?void 0:y.cell)??n;d.appendChild(Nu(v))}if(s>=r.rows.length)(b=r.rows[r.rows.length-1].parentNode)==null||b.appendChild(d);else{const x=r.rows[s];(C=x.parentNode)==null||C.insertBefore(d,x)}const g=kk(d,o.colCount,u,a.originCol);return Ct(g||n),!0}function cf(e,t){var f,g,h,y;const n=bn(e);if(!n)return!1;const r=wt(e,n);if(!r)return!1;const o=Mt(r),a=Xt(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){Ar(b.cell,b.colSpan+1,b.rowSpan);for(let C=b.originRow;C<b.originRow+b.rowSpan;C+=1)u.add(C)}let d=null;for(let b=0;b<o.rowCount;b+=1){if(u.has(b))continue;const C=((g=(f=o.slots[b])==null?void 0:f[Math.min(s,Math.max(0,o.colCount-1))])==null?void 0:g.cell)??((y=(h=o.slots[b])==null?void 0:h[Math.max(0,s-1)])==null?void 0:y.cell)??n,x=Nu(C);Lu(r,b,s,x),b===a.originRow&&(d=x)}return d&&Ct(d),!0}function fk(e){var y,b;const t=bn(e);if(!t)return!1;const n=wt(e,t);if(!n)return!1;const r=Mt(n),o=Xt(r,t);if(!o)return!1;if(r.rowCount<=1)return Lc(e,n);const a=o.originRow,s=a+1,u=[];for(const C of r.unique)C.originRow<=a&&C.originRow+C.rowSpan>a&&(C.originRow<a?Ar(C.cell,C.colSpan,C.rowSpan-1):C.originRow===a&&C.rowSpan>1&&u.push(C));u.sort((C,x)=>C.originCol-x.originCol);for(const C of u)Ar(C.cell,C.colSpan,C.rowSpan-1),Lu(n,s,C.originCol,C.cell);const d=o.originCol;n.rows[a].remove();const f=n.rows[Math.min(a,n.rows.length-1)],g=Mt(n),h=(b=(y=g.slots[Math.min(a,g.rowCount-1)])==null?void 0:y[Math.min(d,Math.max(0,g.colCount-1))])==null?void 0:b.cell;return h?Ct(h):f!=null&&f.cells[0]?Ct(f.cells[0]):Tk(n),!0}function pk(e){var f,g,h;const t=bn(e);if(!t)return!1;const n=wt(e,t);if(!n)return!1;const r=Mt(n),o=Xt(r,t);if(!o)return!1;if(r.colCount<=1)return Lc(e,n);const a=o.originCol,s=o.originRow;for(const y of r.unique)a<y.originCol||a>=y.originCol+y.colSpan||(y.colSpan===1?y.cell.remove():Ar(y.cell,y.colSpan-1,y.rowSpan));const u=Mt(n);if(u.colCount===0||u.unique.length===0)return Lc(e,n);const d=((g=(f=u.slots[Math.min(s,u.rowCount-1)])==null?void 0:f[Math.min(a,u.colCount-1)])==null?void 0:g.cell)??((h=u.unique[0])==null?void 0:h.cell);return d&&Ct(d),!0}function gk(e,t){const n=bn(e);if(!n)return!1;const r=wt(e,n);if(!r)return!1;const o=dk(r),a=o.indexOf(n);if(a<0)return!1;if(t)return a===0?!1:(Ct(o[a-1]),{changed:!1});if(a<o.length-1)return Ct(o[a+1]),{changed:!1};const s=n.parentElement;if(!Nc(e,"below"))return!1;const u=s instanceof HTMLTableRowElement?s.nextElementSibling:null;return u instanceof HTMLTableRowElement&&u.cells[0]&&Ct(u.cells[0]),{changed:!0}}function hk(e,t){return!Se(e,t)||t===e?!1:(Ct(t),!0)}function uf(e){return nh(e)!==null}function df(e){const t=bn(e);if(!t)return!1;const n=vs(t);return n.colSpan>1||n.rowSpan>1}function bk(e){const t=nh(e);if(!t)return!1;const n=wt(e,t.origin.cell);return n?rh(n,t):!1}function yk(e){const t=bn(e);if(!t)return!1;const n=wt(e,t);return n?oh(n,t):!1}function xk(e,t,n){const r=bn(e);if(!r)return!1;const o=wt(e,r);if(!o)return!1;const a=Mt(o),s=Xt(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||!ak(a,s,u,d))return!1;if((s.colSpan>1||s.rowSpan>1)&&oh(o,r),u===1&&d===1)return Ct(r),!0;const f=Mt(o),g=Qg(f,{minRow:s.originRow,maxRow:s.originRow+d-1,minCol:s.originCol,maxCol:s.originCol+u-1});return g?rh(o,g):!0}function Mu(e,t,n){let r=t;for(;r&&r!==e;){if(r instanceof HTMLElement&&n(r))return r;r=r.parentNode}return null}function Ck(e){return ck.has(e.tagName.toLowerCase())}function _u(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n.startContainer:null}function nh(e){const t=pi(e);if(t.length<2)return null;const n=wt(e,t[0]);if(!n)return null;const r=Mt(n),o=[];for(const u of t){const d=Xt(r,u);if(!d)return null;o.push(d)}const a=Jg(o);if(!a)return null;const s=Qg(r,a);return!s||s.cells.length<2?null:s}function rh(e,t){const n=t.origin.cell,r=Mt(e),o=t.cells.map(a=>Xt(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&&Sk(n,a.cell);Ar(n,t.colSpan,t.rowSpan);for(const a of o)a.cell!==n&&a.cell.remove();return Ct(n),!0}function oh(e,t){const n=Mt(e),r=Xt(n,t);if(!r||r.colSpan===1&&r.rowSpan===1)return!1;Ar(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||Lu(e,o,a,Nu(t));return Ct(t),!0}function wk(e){const t=document.createElement(e);return t.style.border=sk,t.style.padding=lk,t.appendChild(document.createElement("br")),t}function Nu(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 vk(e,t,n){t>=e.cells.length?e.appendChild(n):e.insertBefore(n,e.cells[t])}function Lu(e,t,n,r){const o=e.rows[t];if(!o)return;const a=Mt(e);let s=0;for(const u of Array.from(o.cells)){if(u===r)continue;const d=Xt(a,u);if(!d||d.originCol>=n)break;s+=1}vk(o,s,r)}function kk(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 mf(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 Sk(e,t){if(!(e===t||mf(t)))for(mf(e)?e.innerHTML="":e.appendChild(document.createTextNode(" "));t.firstChild;)e.appendChild(t.firstChild)}function Pk(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),Ak(n)&&n.remove())}function Ak(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 Lc(e,t){if(!t.parentNode||!Se(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 Ct(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Tk(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const ih=["left","center","right","justify"];function Rk(e){const t=e.trim().toLowerCase();return t==="center"?"center":t==="right"||t==="end"?"right":t==="justify"?"justify":"left"}function es(e){return Rk(e.style.textAlign)}function Bc(e,t){const n=t??"left";return es(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 ff(e){const t=e[0];return e.every(n=>n===t)?{align:t,mixed:!1}:{align:null,mixed:!0}}function ah(e){const t=pi(e);if(t.length>0)return ff(t.map(es));const n=In(e);return n.length===0?hn(e)?{align:"left",mixed:!1}:{align:null,mixed:!1}:ff(n.map(es))}function sh(e,t){return ih.includes(t)?nr(e,()=>{const n=pi(e);if(n.length>0){let a=!1;for(const s of n)Bc(s,t)&&(a=!0);return a}const r=Rr(e);if(r.length===0)return!1;let o=!1;for(const a of r)Bc(a,t)&&(o=!0);return o}):!1}function wr(){return{...Dr(),align:"left",alignMixed:!1,list:null,listMixed:!1}}function Ta(e){const t=_C(e),n=ah(e),r=Vg(e);return{...t,align:n.align,alignMixed:n.mixed,list:r.type,listMixed:r.mixed}}function lh(e,t){let n=!1;return!t.alignMixed&&t.align&&sh(e,t.align)&&(n=!0),t.listMixed||Xv(e,t.list)&&(n=!0),NC(e,t)&&(n=!0),n}function Dk(e,t){return lh(e,Fc(t))}function ch(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 Fc(e){const t=wr();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}}function Ra(e){return e?Cr(e):""}function Ik(e,t){return e.src===t.src&&e.opacity===t.opacity&&e.fit===t.fit&&e.position===t.position&&Ra(e.width)===Ra(t.width)&&Ra(e.height)===Ra(t.height)}function tc(e){const t=In(e);if(t.length===0)return mn();const n=t.map(xg),r=n[0];return n.some(o=>!Ik(o,r))?mn():r}function jk(e,t){return nr(e,()=>{const n=Rr(e);if(n.length===0)return!1;let r=!1;for(const o of n)Cg(o,t)&&(r=!0);return r})}function Ek(){return{size:null,unit:oo,marks:Wn(),fontFamily:null,fontFamilyMixed:!1,fontColor:null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function Qo(){return{font:Ek(),box:Dr(),backgroundImage:mn(),atRule:Kn()}}function Hc(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 Mk(e,t){if(!t)return e;const{margin:n,padding:r,...o}=t;return{...e,...o,margin:n?Hc(e.margin,n):e.margin,padding:r?Hc(e.padding,r):e.padding}}function _k(e,t){if(!t)return e;const{marks:n,...r}=t;return{...e,...r,marks:n?{...e.marks,...n}:e.marks}}function Nk(e,t){const{margin:n,...r}=t.atRule??{};return{font:_k(e.font,t.font),box:Mk(e.box,t.box),backgroundImage:t.backgroundImage?{...e.backgroundImage,...t.backgroundImage}:e.backgroundImage,atRule:t.atRule?{...e.atRule,...r,margin:n?Hc(e.atRule.margin,n):e.atRule.margin}:e.atRule}}function Lk(e){return e?!!(e.font||e.box||e.backgroundImage||e.atRule):!1}function pf(e,t){if(!Lk(t))return e;const n=document.createElement("div");n.innerHTML=e;const r=Nk(Go(n),t);return zc(n,r).pageHtml}function Bk(e){const t=e.style.fontSize,n=t?au(t):null,r=n&&fs(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)??oo,marks:s,fontFamily:d||null,fontFamilyMixed:!1,fontColor:u?Ke(u):null,highlightColor:null,fontColorMixed:!1,highlightColorMixed:!1}}function Fk(e,t){const n=e.style.fontSize,r=t.size===null?null:vr(t.size,t.unit);if(!r)return n?(e.style.removeProperty("font-size"),!0):!1;const o=iu(r.value,r.unit);return n===o?!1:(e.style.fontSize=o,!0)}function Hk(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 di(r,n)?!1:(n?e.style.fontFamily=n:e.style.removeProperty("font-family"),!0)}function zk(e,t){if(t.fontColorMixed)return!1;const n=t.fontColor?Ke(t.fontColor):null;return(e.style.color?Ke(e.style.color):null)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function Ok(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 Kk(e,t){let n=!1;return Fk(e,t)&&(n=!0),Hk(e,t)&&(n=!0),zk(e,t)&&(n=!0),Ok(e,t.marks)&&(n=!0),n&&xt(e),n}function $k(e){const t=e.box;return t.backgroundMixed||t.backgroundColor?t:!e.font.highlightColorMixed&&e.font.highlightColor?{...t,backgroundColor:e.font.highlightColor}:t}function Go(e){const t=ct(e);if(!t)return Qo();const n=po(t);return{font:Bk(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,breakInside:n.breakInside,breakInsideMixed:!1,breakAfter:n.breakAfter,breakAfterMixed:!1,breakBefore:n.breakBefore,breakBeforeMixed:!1},backgroundImage:w1(t),atRule:tt(e.innerHTML)}}function zc(e,t){const n=hn(e),r=n?io(e,n.startContainer,n.startOffset):null,o=n?io(e,n.endContainer,n.endOffset):null,a=ct(e),s=vu(e);Xo(s);const u=Kk(s,t.font),d=go(s,$k(t)),f=v1(s,t.backgroundImage);ys(e);const g=tt(e.innerHTML),h=Ka(e.innerHTML,t.atRule),y=dn(h);y!==dn(e.innerHTML)&&(e.innerHTML=y),bo(e,h);const b=JSON.stringify(g)!==JSON.stringify(t.atRule);r!==null&&o!==null&&fu(e,Math.min(r,o),Math.max(r,o)),xs(e);const C=Ka(e.innerHTML,t.atRule);return{changed:!a||u||d||f||b,pageHtml:C}}function Uk(e,t){const n=t??e.innerHTML,r=Zp(n);return ai(n)?(e.innerHTML=dn(r),ys(e),bo(e,r),{changed:!0,pageHtml:r}):{changed:!1,pageHtml:r}}const Vk=/<script\b[^>]*>[\s\S]*?<\/script>/gi,Wk=/^\s*javascript\s*:/i;function Gk(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 uh(e){const t=Gk(e).replace(/[\u0000-\u001F\u007F\s]+/g,"");return Wk.test(t)}function Zk(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!uh(r)&&!/url\s*\(\s*["']?\s*javascript:/i.test(r)}).join("; ")}function qk(e){const t=e instanceof Element?[e,...e.querySelectorAll("*")]:[...e.querySelectorAll("*")];for(const n of t)for(const r of[...n.attributes]){if(uh(r.value)){n.removeAttribute(r.name);continue}if(r.name.toLowerCase()==="style"){const o=Zk(r.value);o?o!==r.value&&n.setAttribute(r.name,o):n.removeAttribute(r.name)}}}function Yk(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html")}function Xk(e){return e.body.innerHTML}function Oc(e){if(!e.trim())return e;const n=e.replace(Vk,"");if(!/javascript\s*:/i.test(n))return n;const r=Yk(n);return qk(r.body),Xk(r)}function Xr(e){if(!e.trim())return e;const n=Un(e);return n.length===1?Oc(e):jt(n.map(Oc))}const Bu="data-hover-html",Jk="noopener noreferrer",Qk="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)",eS="this._hoverBox&&this._hoverBox.remove()",tS=/^(#(?:[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 ks(e={}){return{href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",...e}}function nS(e){return e.tagName.toLowerCase()==="a"&&e.hasAttribute("href")}function li(e,t){let n=t;for(;n&&n!==e;){if(n instanceof Element&&nS(n))return n;n=n.parentNode}return null}function dh(e){return tS.test(e)}function rS(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&&dh(r)?r:null}function mh(e){const t=`${e.style.textDecoration} ${e.style.textDecorationLine}`.toLowerCase();return/\bnone\b/.test(t)}function oS(e){const t=e.getAttribute(Bu)??"",n=rS(e);return{href:e.getAttribute("href")??"",title:e.getAttribute("title")??"",targetBlank:e.getAttribute("target")==="_blank",textDecorationNone:mh(e),hoverMode:t.trim()?"html":"color",hoverColor:n,hoverHtml:t}}function fh(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!Se(e,n.commonAncestorContainer))return null;const r=li(e,n.commonAncestorContainer);return r?oS(r):null}function iS(e){return fh(e)!==null}function aS(e){e.removeAttribute("onmouseover"),e.removeAttribute("onmouseout"),e.removeAttribute(Bu)}function sS(e,t){var r;if(aS(e),t.hoverMode==="html"){const o=t.hoverHtml.trim();if(!o)return;e.setAttribute(Bu,o),e.setAttribute("onmouseover",Qk),e.setAttribute("onmouseout",eS);return}const n=((r=t.hoverColor)==null?void 0:r.trim())??"";!n||!dh(n)||(e.setAttribute("onmouseover",`this.style.color='${n}'`),e.setAttribute("onmouseout","this.style.color=''"))}function Fu(e,t){const n=ks(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",Jk)):(e.removeAttribute("target"),e.removeAttribute("rel")),n.textDecorationNone?e.style.textDecoration="none":mh(e)&&(e.style.removeProperty("text-decoration"),e.style.removeProperty("text-decoration-line")),sS(e,n)}function lS(e,t){const n=new Set;for(const r of t){const o=li(e,r);o&&!n.has(o)&&n.add(o)}for(const r of n)Et(r)}function cS(e,t,n){fn(t);const r=vt(t).filter(u=>u.data.length>0);lS(e,r),r.length>0&&Tr(r);const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);fn(a);const s=document.createElement("a");Fu(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 uS(e,t){const n=document.createElement("a");Fu(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 dS(e,t){const n=t.href.trim();if(!n)return!1;const r=ks({...t,href:n}),o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Se(e,a.commonAncestorContainer))return!1;const s=li(e,a.startContainer),u=li(e,a.endContainer);return s&&s===u?(Fu(s,r),!0):a.collapsed?uS(a,r):cS(e,a,r)}const mS=/^[A-Za-z][A-Za-z0-9_-]*$/,ph="";function Kc(e){var r;const t=ku(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 fS(e){return new Set(Kc(e).map(t=>t.id))}function gh(e,t){const n=e.trim();return n?mS.test(n)?t.has(n)?"duplicate":null:"invalid":"empty"}function gf(e,t){const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ph)),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(e)}function pS(e,t){var r;const n=document.createElement("a");n.id=t,n.appendChild(document.createTextNode(ph)),(r=e.parentNode)==null||r.insertBefore(n,e)}function gS(e,t){const n=t.trim();if(gh(n,fS(e)))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Se(e,o.commonAncestorContainer))return!1;const a=li(e,o.startContainer);if(a)return pS(a,n),!0;if(o.collapsed)return gf(o,n),!0;fn(o);const s=document.createElement("span");s.id=n;try{return o.surroundContents(s),!0}catch{return gf(o,n),!0}}const lt="data-comment-thread",hf="wysiwyg-comment-anchor";function hS(){return`cmt_${crypto.randomUUID()}`}function bS(){return crypto.randomUUID()}const ts=20;function bf(e,t){if(!e)return null;const n=e instanceof Element?e:e.parentElement;if(!n)return null;const r=n.closest(`[${lt}]`);return r instanceof HTMLElement&&Se(t,r)?r:null}function yf(e,t,n){var y;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,f=0,g;for(;g=r.nextNode();){const b=g,C=((y=b.textContent)==null?void 0:y.length)??0;if(!s&&o<=C&&(s=b,u=o),!d&&a<=C){d=b,f=a;break}o-=C,a-=C}if(!s||!d)return null;const h=document.createRange();return h.setStart(s,u),h.setEnd(d,f),h}function yS(e,t,n){const r=e.textContent??"",o=r.slice(Math.max(0,t-ts),t),a=r.slice(n,n+ts);return{prefix:o,suffix:a}}function xS(e,t){if(t.mode!=="visual")return null;const n=Vn(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}=yS(e,t.start,t.end);return{type:"text",text:t.text,start:t.start,end:t.end,prefix:r,suffix:o}}function xf(e,t){if(t.mode!=="visual")return null;const n=Vn(e);if(n!=null&&n.hasAttribute(lt))return n.getAttribute(lt)??null;if(t.visualRange){const r=bf(t.visualRange.startContainer,e);if(r)return r.getAttribute(lt)??null;const o=bf(t.visualRange.endContainer,e);if(o)return o.getAttribute(lt)??null}return null}function $c(e,t,n){if(!Se(e,n.commonAncestorContainer))return!1;fn(n);const r=document.createElement("span");r.setAttribute(lt,t);try{return n.surroundContents(r),!0}catch{const o=n.toString();if(!o)return!1;const a=document.createElement("span");return a.setAttribute(lt,t),a.textContent=o,n.deleteContents(),n.insertNode(a),!0}}function hh(e,t){e.setAttribute(lt,t)}function CS(e,t,n){const r=Vn(e);return r?(hh(r,t),!0):n.visualRange?$c(e,t,n.visualRange):!1}function wS(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 vS(e,t,n){if(n.type!=="text")return!1;if(n.start!==void 0&&n.end!==void 0){const s=yf(e,n.start,n.end);if(s&&s.toString()===n.text)return $c(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-ts),s),f=r.slice(u,u+ts);if(n.prefix!==void 0&&d!==n.prefix){a=s+1;continue}if(n.suffix!==void 0&&f!==n.suffix){a=s+1;continue}const g=yf(e,s,u);return g?$c(e,t,g):!1}return!1}function kS(e,t){for(const n of t)if(!e.querySelector(`[${lt}="${n.id}"]`)){if(n.anchor.type==="image"){const o=wS(e,n.anchor);o&&hh(o,n.id);continue}vS(e,n.id,n.anchor)}}function bh(e,t){for(const n of e.querySelectorAll(`[${lt}]`))n instanceof HTMLElement&&(t?n.classList.add(hf):n.classList.remove(hf))}function yh(e,t){if(!t)return null;const n=t instanceof Element?t:t.parentElement;if(!n)return null;const r=n.closest(`[${lt}]`);return r instanceof HTMLElement&&Se(e,r)?r:null}function Cf(e,t){const n=e.querySelector(`[${lt}="${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 SS(e,t=[]){return{id:hS(),anchor:e,messages:t,createdAt:new Date().toISOString(),resolvedAt:null,resolvedBy:null}}function PS(e,t){return{id:bS(),userId:e.userId,userName:e.userName,message:t.trim(),createdAt:new Date().toISOString()}}function AS(e,t,n){return e.map(r=>r.id===t?{...r,messages:[...r.messages,n]}:r)}function TS(e,t){return e.find(n=>n.id===t)}function xh(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return Se(e,n.commonAncestorContainer)?n:null}function RS(e){const t=xh(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 Ch(e){const t=xh(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 DS(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 wh(e){const t=RS(e);return t?DS(t):!1}async function IS(e){return await wh(e)?Ch(e):!1}const jS=new Set(["strong","b","em","i","u","s","strike","del"]),ES=["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 MS(e){for(const t of ES)e.style.removeProperty(t)}function _S(e,t){let n=t;for(;n.parentElement&&n.parentElement!==e;){const r=n.parentElement;if(!gn(r)){n=r;continue}if(er(r,n),jS.has(r.tagName.toLowerCase())){Et(r);continue}if(MS(r),Qn(r)){Et(r);continue}n=r.isConnected?r:t}}function NS(e){const t=hn(e);if(!t||t.collapsed)return!1;const n=e.innerHTML;fn(t);const r=vt(t).filter(o=>o.data.length>0);if(r.length===0)return!1;for(const o of r)_S(e,o);return Tr(r),e.innerHTML!==n}function LS(e,t){return e.start===t.start&&e.end===t.end&&e.collapsed===t.collapsed}function BS(e){const t=eo(e),n=Eg(e),r=gp(e),o=Fa(e,"color"),a=Fa(e,"backgroundColor"),s=_g(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 FS(e,t){t.size!==null&&Dc(e,t.size,t.unit);const n=eo(e);for(const r of zt)t.marks[r]!==n[r]&&Ec(e,r);return t.fontFamilyMixed||gc(e,t.fontFamily),t.fontColorMixed||Yo(e,"color",t.fontColor),t.highlightColorMixed||Yo(e,"backgroundColor",t.highlightColor),!t.customCssMixed&&t.customCss&&Lg(e,t.customCss),!0}function _a(){return typeof window<"u"&&"speechSynthesis"in window}function HS(e){const t=document.createElement("div");return t.innerHTML=e,(t.innerText??t.textContent??"").trim()}function wf(e,t){const n=e.text.trim();return n||HS(t)||null}function zS(e){const t=window.speechSynthesis,n=()=>{e()};return{toggle(r){if(!_a())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 _a()&&t.speaking},cancel(){_a()&&t.speaking&&(t.cancel(),n())}}}const OS=5*1024*1024,KS="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",$S=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/aac","audio/webm","audio/mp4","audio/x-m4a"]),US=new Set(["mp3","wav","ogg","aac","webm","m4a"]),VS=/^data:audio\/(?:mpeg|mp3|wav|x-wav|ogg|aac|webm|mp4|x-m4a)(?:;charset=[^;,]+)?;base64,/i,WS=/^(javascript|vbscript|file|blob):/i;function GS(e={}){return{src:"",title:"",...e}}function Hu(e){const t=e.trim();if(!t)return"empty";if(WS.test(t))return"invalid";if(t.toLowerCase().startsWith("data:"))return VS.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 ZS(e){return e.size>OS?"tooLarge":QS(e)?null:"type"}function qS(e){const t=ZS(e);return t?Promise.reject(new Error(t)):new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");if(Hu(a)){r(new Error("invalid"));return}n(a)},o.onerror=()=>r(o.error??new Error("Failed to read file")),o.readAsDataURL(e)})}function YS(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%",XS(e,t.css)}function XS(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 JS(e,t){const n=GS(t);if(Hu(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Se(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=document.createElement("audio");return YS(a,n),o.insertNode(a),o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}function QS(e){const t=e.type.trim().toLowerCase();if(t&&$S.has(t))return!0;const n=e0(e.name);return!!(!t&&n&&US.has(n))}function e0(e){const t=e.lastIndexOf(".");return t<0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function vf(e,t){const r=(t?t(e):e).trim();if(!r)return"";if(!r.includes("<"))return r;const o=new DOMParser().parseFromString(`<body>${r}</body>`,"text/html");for(const a of o.querySelectorAll("img"))a.removeAttribute(It);return o.body.innerHTML}function vh(e,t,n){return vf(e,n)===vf(t,n)}const t0=/^data:image\/(?:jpeg|jpg|png|gif|webp|bmp|avif)(?:;charset=[^;,]+)?;base64,/i;function kf(e,t){var o,a;const n=(o=e.getAttribute(It))==null?void 0:o.trim();if(n&&t){const s=t(n);if(s)return`embedded:${s}`}const r=((a=e.getAttribute("src"))==null?void 0:a.trim())??"";return t0.test(r)?`embedded:${r}`:r.startsWith("blob:")&&n?`registry:${n}`:r?`url:${r}`:"empty"}function n0(e){return new DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function r0(e,t){for(const n of[...e.attributes])t.hasAttribute(n.name)||e.removeAttribute(n.name);for(const n of[...t.attributes])e.setAttribute(n.name,n.value)}function o0(e,t){e.querySelectorAll("img").forEach((n,r)=>{const o=document.createElement("span");o.setAttribute(t,String(r)),n.replaceWith(o)})}function Sf(e,t){const n=e.cloneNode(!0);return o0(n,t),n.innerHTML}function i0(e,t,n){const r=n0(t),o=[...e.querySelectorAll("img")],a=[...r.querySelectorAll("img")];if(o.length===0||o.length!==a.length)return!1;const s=o.map(h=>kf(h,n)),u=a.map(h=>kf(h,n));if(!s.every((h,y)=>h===u[y]))return!1;const d="data-wysiwyg-img-marker",f=Sf(e,d),g=Sf(r,d);if(f!==g)return!1;for(let h=0;h<o.length;h+=1)r0(o[h],a[h]);return!0}function ns(e,t,n={}){const{resolveDataUrl:r,hydrateEmbeddedImages:o}=n;return vh(e.innerHTML,t,o)?{changed:!1}:e.innerHTML===t?{changed:!1}:i0(e,t,r)?{changed:!0}:(e.innerHTML=t,{changed:!0})}const kh=/^(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 s0(e={}){return{url:"",title:"",...e}}function l0(e={}){return{src:"",title:"",...e}}function Ss(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 Sh(e){return`https://www.youtube.com/embed/${e}`}function Ph(e){const t=e.trim();return t?kh.test(t)?"invalid":Ss(t)?null:"invalid":"empty"}function c0(e){const t=e.trim();if(!t)return"empty";if(kh.test(t))return"invalid";if(Ss(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 Ah(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 Th(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",Ah(e,n.css)}function u0(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%",Ah(e,t.css)}function d0(e,t){const n=s0(t);if(Ph(n.url))return!1;const r=Ss(n.url);if(!r)return!1;const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const a=o.getRangeAt(0);if(!Se(e,a.commonAncestorContainer))return!1;a.collapsed||a.deleteContents();const s=document.createElement("iframe");return Th(s,Sh(r),n),a.insertNode(s),a.setStartAfter(s),a.collapse(!0),o.removeAllRanges(),o.addRange(a),!0}function m0(e,t){const n=l0(t);if(c0(n.src))return!1;const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const o=r.getRangeAt(0);if(!Se(e,o.commonAncestorContainer))return!1;o.collapsed||o.deleteContents();const a=Ss(n.src);if(a){const s=document.createElement("iframe");Th(s,Sh(a),{title:n.title,css:n.css}),o.insertNode(s),o.setStartAfter(s)}else{const s=document.createElement("video");u0(s,n),o.insertNode(s),o.setStartAfter(s)}return o.collapse(!0),r.removeAllRanges(),r.addRange(o),!0}const f0=new Set(["p","h1","h2","h3","h4","h5","h6"]),p0=new Set(["td","th","li","blockquote","pre","table","thead","tbody","tr"]);function Rh(e,t){var a;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!Se(e,r.commonAncestorContainer))return!1;r.collapsed||r.deleteContents();const o=g0(e,r.startContainer);if(o){const s=h0(o,r);return(a=o.parentNode)==null||a.insertBefore(t,s),Af(t),!0}return r.insertNode(t),b0(e,t),C0(t),Af(t),!0}function g0(e,t){let n=mi(t);for(;n&&n!==e;){const r=_e(n);if(f0.has(r)&&n instanceof HTMLElement)return n;if(p0.has(r))return null;n=n.parentElement}return null}function h0(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),Pf(e),Pf(o),(a=e.parentNode)==null||a.insertBefore(o,e.nextSibling),o}function b0(e,t){for(;;){const n=t.parentElement;if(!n||n===e||!y0(n))return;er(n,t),Et(n)}}function y0(e){const t=_e(e);return gn(e)||t==="a"}function Pf(e){x0(e)&&e.appendChild(document.createElement("br"))}function x0(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 C0(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 Af(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 w0="1em 0",v0="1px solid #d0d0d0";function k0(){const e=document.createElement("hr");return e.style.margin=w0,e.style.border="0",e.style.borderTop=v0,e}function S0(e){return Rh(e,k0())}const P0="1.5em 0",A0="2px dashed #bbb",T0="data-wysiwyg-page-break";function R0(){const e=document.createElement("div");return e.setAttribute(T0,""),e.style.display="block",e.style.clear="both",e.style.breakAfter="page",e.style.pageBreakAfter="always",e.style.margin=P0,e.style.border="0",e.style.borderTop=A0,e.style.height="0",e}function D0(e){return Rh(e,R0())}const Dn=16;function Tf(e){return Math.min(co.px.max,Math.max(Dn,e))}function I0(e){return e.width>0&&e.height>0?e.width/e.height:1}function j0(e,t){const n=Math.max(Dn,Dn*t),r=Math.min(co.px.max,co.px.max*t),o=Math.min(r,Math.max(n,e));return{width:o,height:o/t}}function E0(e,t){const n=Math.max(Dn,Dn/t),r=Math.min(co.px.max,co.px.max/t),o=Math.min(r,Math.max(n,e));return{width:o*t,height:o}}function M0(e,t,n){const r=I0(t);return e==="e"?j0(t.width+n.x,r):e==="s"?E0(t.height+n.y,r):{width:Tf(t.width+n.x),height:Tf(t.height+n.y)}}function _0(e){const t=e.getBoundingClientRect(),n=e.offsetWidth||t.width,r=e.offsetHeight||t.height;return{width:n>0?n:Dn,height:r>0?r:Dn}}function N0(e,t,n){const r=uo(Math.max(Dn,t),"px"),o=uo(Math.max(Dn,n),"px");return!r||!o?!1:mg(e,{...dg(e),sizeMode:"lock",width:r,height:o})}function L0(e={}){return{border:{...hu},borderCollapse:"collapse",borderSpacing:null,borderRadius:null,boxShadow:null,width:{value:100,unit:"%"},...e}}function B0(e){const t=po(e);return{border:t.border,borderCollapse:O0(e),borderSpacing:Dh(e),borderRadius:t.borderRadius,boxShadow:t.boxShadow,width:ft(e.style.width)}}function F0(e,t){let n=go(e,{...Dr(),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 K0(e,t.borderCollapse)&&(n=!0),$0(e,t.borderCollapse,t.borderSpacing)&&(n=!0),U0(e,t.width)&&(n=!0),n&&xt(e),n}function H0(e){const t=Eu(e);return t?B0(t):null}function z0(e,t){const n=Eu(e);return n?F0(n,t):!1}function O0(e){return e.style.borderCollapse.trim().toLowerCase()==="separate"?"separate":"collapse"}function K0(e,t){return e.style.borderCollapse.trim().toLowerCase()===t?!1:(e.style.borderCollapse=t,!0)}function Dh(e){const t=e.style.borderSpacing.trim();return t?ft(t.split(/\s+/)[0]??""):null}function $0(e,t,n){if(t!=="separate")return e.style.borderSpacing?(e.style.removeProperty("border-spacing"),!0):!1;const r=n?tr(n):null,o=Dh(e);return Ft(o,r)?!1:(r?e.style.borderSpacing=je(r):e.style.removeProperty("border-spacing"),!0)}function U0(e,t){const n=t?tr(t):null,r=ft(e.style.width);return Ft(r,n)?!1:(n?e.style.width=je(n):e.style.removeProperty("width"),!0)}const Ps=["top","middle","bottom","baseline"],V0=new Set(Ps);function W0(e={}){return{backgroundColor:null,color:null,padding:{...Yt},textAlign:null,verticalAlign:null,width:null,colSpan:1,rowSpan:1,...e}}function G0(e){const t=po(e);return{backgroundColor:t.backgroundColor,color:Ih(e),padding:t.padding,textAlign:J0(e),verticalAlign:jh(e),width:ft(e.style.width),...vs(e)}}function Z0(e,t){let n=go(e,{...Dr(),margin:{...Yt},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 X0(e,t.color)&&(n=!0),Bc(e,t.textAlign)&&(n=!0),Q0(e,t.verticalAlign)&&(n=!0),eP(e,t.width)&&(n=!0),n&&xt(e),n}function q0(e){const t=bn(e);return t?G0(t):null}function Y0(e,t){const n=pi(e);if(n.length===0)return!1;let r=!1;for(const a of n)Z0(a,t)&&(r=!0);const o=bn(e);if(o){const a=vs(o);(a.colSpan!==t.colSpan||a.rowSpan!==t.rowSpan)&&xk(e,t.colSpan,t.rowSpan)&&(r=!0)}return r}function Ih(e){const t=e.style.color;return t?Ke(t):null}function X0(e,t){const n=t?Ke(t):null;return Ih(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function J0(e){const t=es(e);return t==="left"?null:t}function jh(e){const t=e.style.verticalAlign.trim().toLowerCase();return V0.has(t)?t:null}function Q0(e,t){return jh(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function eP(e,t){const n=t?tr(t):null,r=ft(e.style.width);return Ft(r,n)?!1:(n?e.style.width=je(n):e.style.removeProperty("width"),!0)}const tP=new Set(Ps);function nP(e={}){return{backgroundColor:null,color:null,padding:{...Yt},height:null,verticalAlign:null,...e}}function rP(e){const t=e.cells[0],n=t?po(t).padding:{...Yt};return{backgroundColor:Eh(e),color:Mh(e),padding:n,height:ft(e.style.height),verticalAlign:_h(e)}}function oP(e,t){let n=!1;sP(e,t.backgroundColor)&&(n=!0),lP(e,t.color)&&(n=!0),uP(e,t.height)&&(n=!0),cP(e,t.verticalAlign)&&(n=!0);for(const r of Array.from(e.cells))go(r,{...Dr(),margin:{...Yt},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&&xt(e),n}function iP(e){const t=th(e);return t?rP(t):null}function aP(e,t){const n=th(e);return n?oP(n,t):!1}function Eh(e){const t=e.style.backgroundColor;return t?Ke(t):null}function sP(e,t){const n=t?Ke(t):null;return Eh(e)===n?!1:(n?e.style.backgroundColor=n:e.style.removeProperty("background-color"),!0)}function Mh(e){const t=e.style.color;return t?Ke(t):null}function lP(e,t){const n=t?Ke(t):null;return Mh(e)===n?!1:(n?e.style.color=n:e.style.removeProperty("color"),!0)}function _h(e){const t=e.style.verticalAlign.trim().toLowerCase();return tP.has(t)?t:null}function cP(e,t){return _h(e)===t?!1:(t?e.style.verticalAlign=t:e.style.removeProperty("vertical-align"),!0)}function uP(e,t){const n=t?tr(t):null,r=ft(e.style.height);return Ft(r,n)?!1:(n?e.style.height=je(n):e.style.removeProperty("height"),!0)}const dP=1e3;function mP(e,t){try{Promise.resolve(e(t)).catch(()=>{})}catch{}}function fP({onAutoSave:e,getHtml:t}){const n=l.useRef(e);n.current=e;const r=l.useRef(t);r.current=t;const o=l.useRef(null),a=e!=null;l.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(()=>mP(u,d)))},dP);return()=>{window.clearInterval(s)}},[a])}function pP(){const[e,t]=l.useState({open:!1,tab:"general"}),[n,r]=l.useState(!1),[o,a]=l.useState({open:!1,html:""}),[s,u]=l.useState(null),[d,f]=l.useState(!1),[g,h]=l.useState(!1),[y,b]=l.useState({open:!1,tab:"general",value:wr(),backgroundImage:mn()}),[C,x]=l.useState({open:!1,value:""}),[v,k]=l.useState({open:!1,tab:"font",paragraphTab:"spacing",value:Qo()}),[S,A]=l.useState(!1),[T,D]=l.useState({open:!1}),[R,P]=l.useState({open:!1,tab:"link",href:"",title:"",targetBlank:!1,textDecorationNone:!1,hoverMode:"color",hoverColor:null,hoverHtml:"",bookmarks:[],selectedBookmarkId:""}),[M,L]=l.useState({open:!1,existingIds:[]}),[U,j]=l.useState({open:!1}),[_,K]=l.useState({open:!1}),[G,Z]=l.useState({open:!1}),[oe,Y]=l.useState({open:!1,tab:"general",value:ug(),aspectRatio:1}),[Q,ie]=l.useState({open:!1}),[de,te]=l.useState({open:!1,value:L0()}),[E,re]=l.useState({open:!1,value:W0()}),[pe,F]=l.useState({open:!1,value:nP()}),[Ee,He]=l.useState({open:!1,topicId:"getStarted"}),[ze,We]=l.useState(!1);return{fontDialog:e,setFontDialog:t,customizeToolbarOpen:n,setCustomizeToolbarOpen:r,documentPreview:o,setDocumentPreview:a,toolbarSettings:s,setToolbarSettings:u,toolbarSettingsLoading:d,setToolbarSettingsLoading:f,toolbarSettingsBusy:g,setToolbarSettingsBusy:h,paragraphDialog:y,setParagraphDialog:b,customCssDialog:C,setCustomCssDialog:x,pageDialog:v,setPageDialog:k,deletePageConfirmOpen:S,setDeletePageConfirmOpen:A,customStyleDialog:T,setCustomStyleDialog:D,linkDialog:R,setLinkDialog:P,bookmarkDialog:M,setBookmarkDialog:L,imageDialog:U,setImageDialog:j,audioDialog:_,setAudioDialog:K,youtubeDialog:G,setYoutubeDialog:Z,imageProperties:oe,setImageProperties:Y,tableDialog:Q,setTableDialog:ie,tableProperties:de,setTableProperties:te,cellProperties:E,setCellProperties:re,rowProperties:pe,setRowProperties:F,helpDialog:Ee,setHelpDialog:He,aboutDialogOpen:ze,setAboutDialogOpen:We}}const Rf={changed:!1,pages:[],joined:"",changedIndices:[]};function Df(e){return{changed:e.changed,pages:e.pages,joined:jt(e.pages),changedIndices:e.changedIndices}}function gP({enabled:e,pagesProp:t,defaultPages:n}){const r=e&&t!==void 0,o=l.useMemo(()=>t!==void 0?$n(t):void 0,[t]),[a,s]=l.useState(()=>({pages:$n(n),revision:0})),u=l.useRef(o??$n(n)),d=l.useRef(new Set),f=l.useRef(t);l.useEffect(()=>{if(!e||!r||o===void 0||f.current===t&&xr(u.current,o))return;f.current=t;const k=Yl(u.current,o);if(u.current=k.pages,!!k.changed){for(const S of k.changedIndices)d.current.add(S);s(S=>({pages:k.pages,revision:S.revision+1}))}},[e,r,o,t]);const g=l.useMemo(()=>{if(!e)return[];if(r&&o!==void 0){const k=Yl(u.current,o);return u.current=k.pages,k.pages}return a.pages},[e,r,o,a.pages,a.revision]),h=l.useCallback((k,S)=>{if(!e)return Rf;const A=r?u.current:a.pages,T=Yl(A,k);if(!T.changed)return Df(T);for(const D of T.changedIndices)d.current.add(D);return S!==void 0&&d.current.add(S),r?u.current=T.pages:s(D=>({pages:T.pages,revision:D.revision+1})),Df(T)},[e,a.pages,r]),y=l.useCallback((k,S)=>h(k,S==null?void 0:S.editedIndex),[h]),b=l.useCallback((k,S,A)=>{if(!e)return Rf;const T=r?u.current:a.pages,D=kc(T,k,S);return D.changed?h(D.pages,(A==null?void 0:A.editedIndex)??k):{changed:!1,pages:T,joined:jt(T),changedIndices:[]}},[h,e,a.pages,r]),C=l.useCallback(k=>h($n(k)),[h]),x=l.useCallback(k=>{if(k===void 0){d.current.clear();return}for(const S of k)d.current.delete(S)},[]),v=l.useCallback(()=>jt(g),[g]);return l.useMemo(()=>({pages:g,revision:a.revision,dirtyPagesRef:d,setPages:y,updatePage:b,replacePages:C,markPagesClean:x,getJoinedHtml:v}),[g,a.revision,y,b,C,x,v])}function Na({value:e,defaultValue:t,onChange:n}){const[r,o]=l.useState(t),a=e!==void 0,s=a?e:r,u=l.useCallback(d=>{a||o(d),n==null||n(d)},[a,n]);return[s,u]}const Nh="commspliant-html-editor.darkMode";function hP(e){return typeof e=="boolean"?e:null}function If(){try{const e=localStorage.getItem(Nh);return e?hP(JSON.parse(e)):null}catch{return null}}function bP(e){try{localStorage.setItem(Nh,JSON.stringify(e))}catch{}}const Lh="commspliant-html-editor.pageZoom",yP=new Set(["fitWidth","fitPage"]);function xP(e){return typeof e=="string"&&yP.has(e)||typeof e=="number"&&Q1.includes(e)?e:null}function CP(){try{const e=localStorage.getItem(Lh);return e?xP(JSON.parse(e)):null}catch{return null}}function wP(e){try{localStorage.setItem(Lh,JSON.stringify(e))}catch{}}const Bh="commspliant-html-editor.toolbarPosition",vP=["top","left","right","bottom"];function Fh(e){return typeof e=="string"&&vP.includes(e)?e:null}function jf(){try{const e=localStorage.getItem(Bh);return e?Fh(JSON.parse(e)):null}catch{return null}}function kP(e){try{localStorage.setItem(Bh,JSON.stringify(e))}catch{}}function SP({enabled:e,onHtml:t}){const[n,r]=l.useState(!1),o=l.useRef(0),a=l.useRef(e),s=l.useRef(t);a.current=e,s.current=t;const u=l.useCallback(()=>{o.current=0,r(!1)},[]);l.useEffect(()=>{e||u()},[e,u]);const d=l.useCallback(y=>{!a.current||!Aa(y.dataTransfer)||(y.preventDefault(),o.current+=1,r(!0))},[]),f=l.useCallback(y=>{!a.current||!Aa(y.dataTransfer)||(y.preventDefault(),y.dataTransfer&&(y.dataTransfer.dropEffect="copy"))},[]),g=l.useCallback(y=>{if(!a.current||!Aa(y.dataTransfer))return;const b=y.relatedTarget;b instanceof Node&&y.currentTarget.contains(b)||(o.current=Math.max(0,o.current-1),o.current===0&&r(!1))},[]),h=l.useCallback(y=>{if(!a.current||!Aa(y.dataTransfer))return;y.preventDefault(),u();const b=E1(y.dataTransfer);b&&Du(b).then(C=>{a.current&&s.current(C)},()=>{})},[u]);return{dragging:n,onDragEnter:d,onDragOver:f,onDragLeave:g,onDrop:h}}const PP={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:Oy,labelKey:"commandUndo",ariaKey:"commandUndoAria",enabled:"canUndo"},redo:{id:"redo",command:"redo",icon:Ny,labelKey:"commandRedo",ariaKey:"commandRedoAria",enabled:"canRedo"},pageProperties:{id:"pageProperties",command:"openPageProperties",icon:qo,labelKey:"commandPageProperties",ariaKey:"commandPagePropertiesAria",enabled:"isVisualMode"},deletePage:{id:"deletePage",command:"deletePage",icon:qo,labelKey:"commandDeletePage",ariaKey:"commandDeletePageAria",enabled:"canDeletePage"}}},Hh=400,rs=100,zh=2e7;function AP(e){let t=[],n=0,r=e,o=[],a=0,s=!1,u=!1,d=0;function f(){if(t.length>rs){const v=t.splice(0,t.length-rs);for(const k of v)n-=k.length}for(;t.length>1&&n+a>zh;){const v=t.shift();v&&(n-=v.length)}}function g(v){t.push(v),n+=v.length,f()}function h(){o=[],a=0}function y(v,k){if(s){r=v,s=!1;return}if(v===r)return;const S=Date.now(),A=(k==null?void 0:k.coalesce)===!0;if(A&&u&&S-d<Hh){r=v,d=S,o.length>0&&h();return}g(r),r=v,h(),d=S,u=A}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,f(),r}function C(){if(o.length===0)return null;u=!1,g(r);const v=o.pop();return a-=v.length,r=v,r}function x(v){if(s){r=v,s=!1;return}v!==r&&(g(r),r=v,h(),u=!1)}return{record:y,undo:b,redo:C,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncExternal:x,markApplying:()=>{s=!0},finishApplying:()=>{s=!1}}}function qe(e){return e.map(t=>t)}function gr(e){switch(e.type){case"pageEdit":return e.before.length;case"insertPage":return e.page.length;case"deletePage":return e.page.length;case"replaceAll":return e.beforePages.reduce((t,n)=>t+n.length,0)}}function TP(e){let t=[],n=0,r=qe(e),o=[],a=0,s=!1,u=!1,d=null,f=0;function g(){if(t.length>rs){const R=t.splice(0,t.length-rs);for(const P of R)n-=gr(P)}for(;t.length>1&&n+a>zh;){const R=t.shift();R&&(n-=gr(R))}}function h(R){t.push(R),n+=gr(R),g()}function y(R){o.push(R),a+=gr(R)}function b(){for(const R of o)a-=gr(R);o=[],a=0}function C(){u=!1,d=null}function x(R,P,M){if(s){const K=qe(r);K[R]=P,r=K,s=!1;return}if(r[R]===P)return;const L=Date.now(),U=(M==null?void 0:M.coalesce)===!0,j=U&&u&&d===R&&L-f<Hh,_=qe(r);if(_[R]=P,j){r=_,f=L;return}h({type:"pageEdit",pageIndex:R,before:r[R]??""}),r=_,b(),f=L,u=U,d=R}function v(R,P){if(s){r=qe(P),s=!1;return}xr(r,P)||(h({type:"insertPage",index:R,page:P[R]??""}),r=qe(P),b(),C())}function k(R,P,M){if(s){r=qe(M),s=!1;return}xr(r,M)||(h({type:"deletePage",index:R,page:P}),r=qe(M),b(),C())}function S(R){if(s){r=qe(R),s=!1;return}xr(r,R)||(h({type:"replaceAll",beforePages:qe(r)}),r=qe(R),b(),C())}function A(R){if(s){r=qe(R),s=!1;return}xr(r,R)||(r=qe(R))}function T(){if(t.length===0)return null;C();const R=t.pop();switch(n-=gr(R),R.type){case"pageEdit":{const P=r[R.pageIndex]??"";y({type:"pageEdit",pageIndex:R.pageIndex,before:P}),r[R.pageIndex]=R.before;break}case"insertPage":{const P=r[R.index]??"";y({type:"insertPage",index:R.index,page:P}),r.splice(R.index,1);break}case"deletePage":{y({type:"deletePage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"replaceAll":{y({type:"replaceAll",beforePages:qe(r)}),r=qe(R.beforePages);break}}return g(),qe(r)}function D(){if(o.length===0)return null;C();const R=o.pop();switch(a-=gr(R),R.type){case"pageEdit":{const P=r[R.pageIndex]??"";h({type:"pageEdit",pageIndex:R.pageIndex,before:P}),r[R.pageIndex]=R.before;break}case"insertPage":{h({type:"insertPage",index:R.index,page:R.page}),r.splice(R.index,0,R.page);break}case"deletePage":{const P=r[R.index]??"";h({type:"deletePage",index:R.index,page:P}),r.splice(R.index,1);break}case"replaceAll":{h({type:"replaceAll",beforePages:qe(r)}),r=qe(R.beforePages);break}}return qe(r)}return{getPresent:()=>r,recordPageEdit:x,recordInsertPage:v,recordDeletePage:k,recordReplaceAll:S,undo:T,redo:D,canUndo:()=>t.length>0,canRedo:()=>o.length>0,syncPages:R=>S(R),applyPresent:A,markApplying:()=>{s=!0}}}function Bt(e){return typeof e=="object"&&e!==null&&"recordPageEdit"in e&&typeof e.recordPageEdit=="function"}const RP='button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled])',DP='[role="listbox"], [data-color-picker]';function Ve(e,{open:t,onClose:n,focusableSelector:r=RP,escapeIgnoreSelectors:o=DP}){l.useEffect(()=>{if(!t)return;const a=e.current,s=a==null?void 0:a.querySelector(r);s==null||s.focus();const u=d=>{if(d.key==="Escape"){if(o&&document.querySelector(o))return;d.preventDefault(),d.stopPropagation(),n();return}if(d.key!=="Tab"||!a)return;const f=[...a.querySelectorAll(r)];if(f.length===0)return;const g=f[0],h=f[f.length-1];d.shiftKey&&document.activeElement===g?(d.preventDefault(),h.focus()):!d.shiftKey&&document.activeElement===h&&(d.preventDefault(),g.focus())};return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[e,o,r,n,t])}function Xn(e,t){return t?t.label?t.label:t.labelKey?e(t.labelKey):"":""}function os(e,t){return t?t.ariaLabel?t.ariaLabel:t.ariaKey?e(t.ariaKey):Xn(e,t):""}const un="fullscreen",Uc="commspliant-html-editor.toolbarCustomization";function Vc(e){const t=e.filter(n=>n!==un);return e.includes(un)?[...t,un]:t}function zu(e,t){if(!t||t.length===0)return Vc(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 f=s-1;f>=0;f--){const g=e[f],h=a.indexOf(g);if(h>=0){d=h+1;break}}a.splice(d,0,u),o.add(u)}return Vc(a)}function IP(e,t){const n=new Map(e.map(s=>[s.id,s])),r=zu(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(f=>!o.has(f));d.length!==0&&a.push({id:s,items:d})}return a}function jP(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 EP(){try{const e=localStorage.getItem(Uc);return e?jP(JSON.parse(e)):null}catch{return null}}function MP(e){try{if(!e){localStorage.removeItem(Uc);return}localStorage.setItem(Uc,JSON.stringify(e))}catch{}}function Ou(e,t){return zu(t.map(n=>n.id),e==null?void 0:e.groupOrder)}function _P(e,t,n,r){const o=new Set((e==null?void 0:e.hiddenItemIds)??[]);return r?o.delete(n):o.add(n),{groupOrder:Ou(e,t),hiddenItemIds:[...o]}}function Oh(e,t,n,r){const o=Ou(e,t),a=[...(e==null?void 0:e.hiddenItemIds)??[]];if(n===un||r===un)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],[f]=d.splice(s,1);return d.splice(u,0,f),{groupOrder:Vc(d),hiddenItemIds:a}}function Ef(e,t,n,r){const o=Ou(e,t),a=o.filter(d=>d!==un),s=a.indexOf(n),u=s+r;return s<0||u<0||u>=a.length?{groupOrder:o,hiddenItemIds:[...(e==null?void 0:e.hiddenItemIds)??[]]}:Oh(e,t,n,a[u])}const NP="_backdrop_11w4e_1",LP="_dialog_11w4e_12",BP="_header_11w4e_31",FP="_body_11w4e_39",HP="_group_11w4e_49",zP="_groupDragging_11w4e_55",OP="_groupDropTarget_11w4e_59",KP="_groupHeader_11w4e_64",$P="_groupTitle_11w4e_72",UP="_dragHandle_11w4e_77",VP="_moveButton_11w4e_78",WP="_items_11w4e_119",GP="_item_11w4e_119",ZP="_itemIcon_11w4e_135",qP="_itemTitle_11w4e_144",YP="_itemCheckbox_11w4e_151",XP="_actions_11w4e_155",JP="_action_11w4e_155",QP="_spinnerWrap_11w4e_191",eA="_spinner_11w4e_191",Be={backdrop:NP,dialog:LP,header:BP,body:FP,group:HP,groupDragging:zP,groupDropTarget:OP,groupHeader:KP,groupTitle:$P,dragHandle:UP,moveButton:VP,items:WP,item:GP,itemIcon:ZP,itemTitle:qP,itemCheckbox:YP,actions:XP,action:JP,spinnerWrap:QP,spinner:eA};function tA(){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 nA({open:e,catalog:t,groups:n,settings:r,loading:o=!1,busy:a=!1,disabled:s,onChange:u,onReset:d,onClose:f}){const g=X(),h=l.useId(),y=l.useRef(null),[b,C]=l.useState(null),[x,v]=l.useState(null),k=zu(n.map(j=>j.id),r==null?void 0:r.groupOrder),S=new Set((r==null?void 0:r.hiddenItemIds)??[]),A=new Map(n.map(j=>[j.id,j])),T=k.map(j=>A.get(j)).filter(j=>!!j),D=s||a||o;if(l.useEffect(()=>{e||(C(null),v(null))},[e]),Ve(y,{open:e,onClose:f,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const R=T.map(j=>j.id).filter(j=>j!==un),P=(j,_)=>{if(D||_===un){j.preventDefault();return}j.dataTransfer.setData("text/plain",_),j.dataTransfer.effectAllowed="move",C(_)},M=(j,_)=>{D||_===un||!b||b===_||(j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move"),v(_))},L=(j,_)=>{var G;j.preventDefault();const K=((G=j.dataTransfer)==null?void 0:G.getData("text/plain"))||b;C(null),v(null),!(!K||K===_||D)&&u(Oh(r,n,K,_))},U=()=>{C(null),v(null)};return i.jsx(ke,{children:i.jsx("div",{className:Be.backdrop,role:"presentation",onMouseDown:f,children:i.jsxs("div",{ref:y,className:Be.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:Be.header,id:h,children:g("customizeToolbarDialogTitle")}),i.jsx("div",{className:Be.body,children:o?i.jsx("div",{className:Be.spinnerWrap,role:"status","aria-live":"polite","aria-label":g("customizeToolbarDialogLoading"),children:i.jsx("span",{className:Be.spinner,"aria-hidden":"true"})}):T.map(j=>{const _=t.groups[j.id],K=_?Xn(g,_):j.id,G=j.id===un,Z=R.indexOf(j.id);return i.jsxs("section",{className:[Be.group,b===j.id?Be.groupDragging:"",x===j.id?Be.groupDropTarget:""].filter(Boolean).join(" "),"data-toolbar-customize-group":j.id,"aria-label":K,onDragOver:oe=>M(oe,j.id),onDrop:oe=>L(oe,j.id),onDragLeave:()=>{x===j.id&&v(null)},children:[i.jsxs("div",{className:Be.groupHeader,children:[i.jsx("button",{type:"button",className:Be.dragHandle,draggable:!D&&!G,disabled:D||G,"aria-label":g("customizeToolbarDragHandle"),onDragStart:oe=>P(oe,j.id),onDragEnd:U,children:i.jsx(tA,{})}),i.jsx("span",{className:Be.groupTitle,children:K}),i.jsx("button",{type:"button",className:Be.moveButton,disabled:D||G||Z<=0,"aria-label":g("customizeToolbarMoveUp"),onClick:()=>u(Ef(r,n,j.id,-1)),children:"↑"}),i.jsx("button",{type:"button",className:Be.moveButton,disabled:D||G||Z<0||Z>=R.length-1,"aria-label":g("customizeToolbarMoveDown"),onClick:()=>u(Ef(r,n,j.id,1)),children:"↓"})]}),i.jsx("div",{className:Be.items,children:j.items.map(oe=>{const Y=t.items[oe];if(!Y)return null;const Q=Y.icon,ie=Xn(g,Y),de=`${h}-${j.id}-${oe}`,te=!S.has(oe);return i.jsxs("label",{className:Be.item,htmlFor:de,children:[i.jsx("span",{className:Be.itemIcon,"aria-hidden":"true",children:Q?i.jsx(Q,{}):ie.slice(0,2)}),i.jsx("span",{className:Be.itemTitle,children:ie}),i.jsx("input",{id:de,className:Be.itemCheckbox,type:"checkbox",checked:te,disabled:D,"aria-label":`${ie}: ${g("customizeToolbarItemVisible")}`,onChange:E=>u(_P(r,n,oe,E.target.checked))})]},oe)})})]},j.id)})}),i.jsxs("div",{className:Be.actions,children:[i.jsx("button",{type:"button",className:Be.action,disabled:D,onClick:d,children:g("customizeToolbarDialogReset")}),i.jsx("button",{type:"button",className:Be.action,"aria-label":g("customizeToolbarDialogCloseAria"),onClick:f,children:g("customizeToolbarDialogClose")})]})]})})})}function rA(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 oA={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:Fy,labelKey:"commandSave",ariaKey:"commandSaveAria"},open:{id:"open",command:"open",icon:Ty,labelKey:"commandOpen",ariaKey:"commandOpenAria"},print:{id:"print",command:"print",icon:My,labelKey:"commandPrint",ariaKey:"commandPrintAria"}}},Kh=4;function iA({anchorRect:e,floatingWidth:t,floatingHeight:n,pad:r=Kh,minWidth:o=0,matchAnchorWidth:a=!1}){const s=a?Math.max(e.width,t,o):t;let u=e.bottom;u+n>window.innerHeight-r&&(u=Math.max(r,e.top-n));const d=Math.min(Math.max(e.left,r),window.innerWidth-s-r);return a?{top:u,left:d,width:s}:{top:u,left:d}}function yo(e,t,n,{pad:r=Kh,minWidth:o=0,matchAnchorWidth:a=!1,deps:s=[]}={}){const[u,d]=l.useState({top:0,left:0}),f=l.useCallback(()=>{const g=t.current,h=n.current;if(!g)return;const y=g.getBoundingClientRect(),b=Math.max(a?y.width:0,(h==null?void 0:h.offsetWidth)??0,o),C=(h==null?void 0:h.offsetHeight)??0;d(iA({anchorRect:y,floatingWidth:b,floatingHeight:C,pad:r,minWidth:o,matchAnchorWidth:a}))},[t,n,a,o,r]);return l.useLayoutEffect(()=>{if(!e)return;f();const g=()=>f();return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[e,f,...s]),u}const aA="_toolbar_1aggm_1",sA="_menuBar_1aggm_35",lA="_menuBarDesktop_1aggm_43",cA="_brandMark_1aggm_49",uA="_brandMarkIcon_1aggm_56",dA="_menuBarCompact_1aggm_68",mA="_menuWrap_1aggm_91",fA="_menuButton_1aggm_97",pA="_iconButton_1aggm_98",gA="_menuItem_1aggm_99",hA="_hamburgerButton_1aggm_142",bA="_iconNav_1aggm_149",yA="_iconNavMain_1aggm_160",xA="_iconNavEnd_1aggm_169",CA="_iconGroup_1aggm_185",wA="_tooltipTrigger_1aggm_276",vA="_menu_1aggm_35",kA="_submenuWrap_1aggm_305",SA="_submenu_1aggm_305",PA="_submenuTrigger_1aggm_315",AA="_menuOverlay_1aggm_330",TA="_menuOverlayHeader_1aggm_342",RA="_menuOverlayTitle_1aggm_352",DA="_menuOverlayBody_1aggm_358",IA="_menuSeparator_1aggm_409",jA="_icon_1aggm_98",EA="_tooltip_1aggm_276",MA="_tooltipElevated_1aggm_494",se={toolbar:aA,menuBar:sA,menuBarDesktop:lA,brandMark:cA,brandMarkIcon:uA,menuBarCompact:dA,menuWrap:mA,menuButton:fA,iconButton:pA,menuItem:gA,hamburgerButton:hA,iconNav:bA,iconNavMain:yA,iconNavEnd:xA,iconGroup:CA,tooltipTrigger:wA,menu:vA,submenuWrap:kA,submenu:SA,submenuTrigger:PA,menuOverlay:AA,menuOverlayHeader:TA,menuOverlayTitle:RA,menuOverlayBody:DA,menuSeparator:IA,icon:jA,tooltip:EA,tooltipElevated:MA},_A=400,Mf=6,nc=4;function Jn({label:e,children:t,className:n,elevated:r}){const o=l.useRef(null),a=l.useRef(null),s=l.useRef(null),u=l.useRef(!1),d=l.useRef(!1),[f,g]=l.useState(!1),[h,y]=l.useState({top:0,left:0}),b=l.useCallback(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),C=l.useCallback(k=>{if(!(u.current||d.current)){b(),g(!1);return}if(k||d.current){b(),g(!0);return}b(),s.current=setTimeout(()=>{s.current=null,g(!0)},_A)},[b]),x=l.useCallback(()=>{const k=o.current,S=a.current;if(!k||!S)return;const A=k.getBoundingClientRect(),T=S.offsetWidth,D=S.offsetHeight;let R=A.bottom+Mf;R+D>window.innerHeight-nc&&(R=A.top-Mf-D);let P=A.left+A.width/2-T/2;P=Math.min(Math.max(P,nc),window.innerWidth-T-nc),y({top:R,left:P})},[]);l.useEffect(()=>()=>b(),[b]),l.useEffect(()=>{const k=o.current;if(!k)return;const S=()=>{d.current=!0,C(!0)},A=()=>{d.current=!1,C(!1)};return k.addEventListener("focusin",S),k.addEventListener("focusout",A),()=>{k.removeEventListener("focusin",S),k.removeEventListener("focusout",A)}},[C]),l.useLayoutEffect(()=>{if(!f)return;x();const k=()=>x();return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[f,e,x]);const v=n?`${se.tooltipTrigger} ${n}`:se.tooltipTrigger;return i.jsxs(i.Fragment,{children:[i.jsx("span",{ref:o,className:v,"data-tooltip-trigger":"",onMouseEnter:()=>{u.current=!0,C(!1)},onMouseLeave:()=>{u.current=!1,C(!1)},children:t}),f?i.jsx(ke,{children:i.jsx("span",{ref:a,className:r?`${se.tooltip} ${se.tooltipElevated}`:se.tooltip,"data-toolbar-tooltip":"",style:{top:h.top,left:h.left},"aria-hidden":"true",children:e})}):null]})}const _f=8,Nf=["#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"],NA=8;let Wc=[];const Gc=new Set;function Lf(){return Wc}function LA(e){const t=Ke(e);t&&(Wc=[t,...Wc.filter(n=>n!==t)].slice(0,NA),Gc.forEach(n=>n()))}function BA(e){return Gc.add(e),()=>{Gc.delete(e)}}function Da(e){const t=Ke(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 hr(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 rc({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 f=0;return d!==0&&(s===r?f=(o-a)/d%6:s===o?f=(a-r)/d+2:f=(r-o)/d+4,f*=60,f<0&&(f+=360)),{h:f,s:s===0?0:d/s,v:s}}function oc({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,f=0;return r<60?(u=o,d=a):r<120?(u=a,d=o):r<180?(d=o,f=a):r<240?(d=a,f=o):r<300?(u=a,f=o):(u=o,f=a),{r:Math.round((u+s)*255),g:Math.round((d+s)*255),b:Math.round((f+s)*255)}}function $h(){return typeof window<"u"&&"EyeDropper"in window}async function FA(){if(!$h())return null;const e=window.EyeDropper;try{const t=await new e().open();return Ke(t.sRGBHex)}catch{return null}}const HA="_picker_ag1yo_1",zA="_none_ag1yo_12",OA="_customToggle_ag1yo_13",KA="_eyedrop_ag1yo_14",$A="_swatch_ag1yo_48",UA="_field_ag1yo_49",VA="_grid_ag1yo_54",WA="_recents_ag1yo_55",GA="_sectionLabel_ag1yo_84",ZA="_custom_ag1yo_13",qA="_sv_ag1yo_95",YA="_svThumb_ag1yo_105",XA="_hue_ag1yo_116",JA="_rgbRow_ag1yo_155",QA="_hexRow_ag1yo_156",et={picker:HA,none:zA,customToggle:OA,eyedrop:KA,swatch:$A,field:UA,grid:VA,recents:WA,sectionLabel:GA,custom:ZA,sv:qA,svThumb:YA,hue:XA,rgbRow:JA,hexRow:QA};function eT(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 Ku({value:e,mixed:t=!1,noneLabel:n,ariaLabel:r,disabled:o,menu:a=!1,fallbackCustom:s="#000000",onChange:u,onCommit:d}){const f=X(),g=l.useId(),h=a?"menuitemradio":"option",y=t?null:e,b=Da(y??s)??{r:0,g:0,b:0},[C,x]=l.useState(!1),[v,k]=l.useState(()=>rc(b)),[S,A]=l.useState(()=>({r:String(b.r),g:String(b.g),b:String(b.b)})),[T,D]=l.useState(()=>hr(b.r,b.g,b.b)),[R,P]=l.useState(()=>[...Lf()]),M=l.useRef(null),L=l.useRef(hr(b.r,b.g,b.b));l.useEffect(()=>BA(()=>P([...Lf()])),[]),l.useEffect(()=>{const E=Da(y??s);if(!E)return;const re=rc(E);k(re),A({r:String(E.r),g:String(E.g),b:String(E.b)}),D(hr(E.r,E.g,E.b))},[y,s]);const U=(E,re,pe)=>{E&&(L.current=E),pe&&E&&LA(E),u(E),re&&(d==null||d(E))},j=(E,re,pe)=>{const F=hr(E.r,E.g,E.b);k(rc(E)),A({r:String(E.r),g:String(E.g),b:String(E.b)}),D(F),U(F,re,pe)},_=(E,re,pe)=>{const F=oc(E),Ee=hr(F.r,F.g,F.b);k(E),A({r:String(F.r),g:String(F.g),b:String(F.b)}),D(Ee),U(Ee,re,pe)},K=E=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(E.key))return;const pe=[...E.currentTarget.querySelectorAll("button")],F=pe.findIndex(ze=>ze===document.activeElement);if(F<0)return;E.preventDefault();const Ee=E.key==="ArrowLeft"?-1:E.key==="ArrowRight"?1:E.key==="ArrowUp"?-_f:_f,He=pe[Math.max(0,Math.min(pe.length-1,F+Ee))];He==null||He.focus()},G=(E,re)=>{const pe=M.current;if(!pe||o)return;const F=pe.getBoundingClientRect(),Ee=Math.max(0,Math.min(1,(E.clientX-F.left)/F.width)),He=Math.max(0,Math.min(1,1-(E.clientY-F.top)/F.height));_({h:v.h,s:Ee,v:He},re,re)},Z=E=>{o||(E.currentTarget.setPointerCapture(E.pointerId),G(E,!1))},oe=oc({h:v.h,s:1,v:1}),Y=hr(oe.r,oe.g,oe.b),Q=oc(v),ie=hr(Q.r,Q.g,Q.b),de=new Set(Nf),te=R.filter(E=>!de.has(E));return i.jsxs("div",{className:et.picker,role:a?void 0:"listbox","aria-label":r,"data-color-picker":"",children:[i.jsx("button",{type:"button",className:et.none,role:h,"aria-checked":a?y===null&&!t:void 0,"aria-selected":a?void 0:y===null&&!t,disabled:o,onClick:()=>U(null,!0,!1),children:n}),i.jsx("div",{className:et.grid,role:a?"group":"none",onKeyDown:K,children:Nf.map(E=>{const re=y===E;return i.jsx("button",{type:"button",className:et.swatch,role:h,"aria-label":E,"aria-checked":a?re:void 0,"aria-selected":a?void 0:re,disabled:o,style:{backgroundColor:E},onMouseDown:pe=>pe.preventDefault(),onClick:()=>U(E,!0,!1)},E)})}),te.length>0?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:et.sectionLabel,children:f("colorRecent")}),i.jsx("div",{className:et.recents,role:a?"group":"none","aria-label":f("colorRecent"),children:te.map(E=>i.jsx("button",{type:"button",className:et.swatch,role:h,"aria-label":E,"aria-checked":a?y===E:void 0,"aria-selected":a?void 0:y===E,disabled:o,style:{backgroundColor:E},onMouseDown:re=>re.preventDefault(),onClick:()=>U(E,!0,!1)},E))})]}):null,i.jsx("button",{type:"button",className:et.customToggle,disabled:o,"aria-expanded":C,onClick:()=>x(E=>!E),children:f("colorCustom")}),C?i.jsxs("div",{className:et.custom,children:[i.jsx("div",{ref:M,className:et.sv,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${Y})`},onPointerDown:Z,onPointerMove:E=>{E.currentTarget.hasPointerCapture(E.pointerId)&&G(E,!1)},onPointerUp:E=>{G(E,!0)},children:i.jsx("span",{className:et.svThumb,style:{left:`${v.s*100}%`,top:`${(1-v.v)*100}%`}})}),i.jsx("input",{className:et.hue,type:"range",min:0,max:360,value:Math.round(v.h),disabled:o,"aria-label":f("colorCustom"),onChange:E=>_({...v,h:Number(E.target.value)},!1,!1),onPointerUp:()=>U(L.current,!0,!0)}),i.jsx("div",{className:et.rgbRow,children:["r","g","b"].map(E=>i.jsxs("div",{className:et.field,children:[i.jsx("label",{htmlFor:`${g}-${E}`,children:f(E==="r"?"colorRgbR":E==="g"?"colorRgbG":"colorRgbB")}),i.jsx("input",{id:`${g}-${E}`,inputMode:"numeric",value:S[E],disabled:o,onChange:re=>{A(pe=>({...pe,[E]:re.target.value}))},onBlur:()=>{const re=eT(S[E]);if(re===null){A({r:String(Q.r),g:String(Q.g),b:String(Q.b)});return}j({...Q,[E]:re},!0,!0)},onKeyDown:re=>{re.key==="Enter"&&re.currentTarget.blur()}})]},E))}),i.jsx("div",{className:et.hexRow,children:i.jsxs("div",{className:et.field,children:[i.jsx("label",{htmlFor:`${g}-hex`,children:f("colorHex")}),i.jsx("input",{id:`${g}-hex`,value:T,disabled:o,onChange:E=>D(E.target.value),onBlur:()=>{const E=Ke(T);if(!E){D(ie);return}const re=Da(E);re&&j(re,!0,!0)},onKeyDown:E=>{E.key==="Enter"&&E.currentTarget.blur()}})]})}),$h()?i.jsx("button",{type:"button",className:et.eyedrop,disabled:o,onClick:()=>{FA().then(E=>{if(!E)return;const re=Da(E);re&&j(re,!0,!0)})},children:f("colorPickFromScreen")}):null]}):null]})}const tT="_wrap_hfz5s_1",nT="_button_hfz5s_8",rT="_icon_hfz5s_18",oT="_bar_hfz5s_24",iT="_barEmpty_hfz5s_33",aT="_popover_hfz5s_43",br={wrap:tT,button:nT,icon:rT,bar:oT,barEmpty:iT,popover:aT};function Uh({icon:e,value:t,mixed:n,noneKey:r,labelKey:o,ariaKey:a,fallbackCustom:s,disabled:u,onChange:d}){const f=X(),g=l.useId(),h=l.useRef(null),y=l.useRef(null),b=l.useRef(null),[C,x]=l.useState(!1),v=yo(C,y,b);l.useEffect(()=>{if(!C)return;const D=P=>{var L,U;const M=P.target;(L=h.current)!=null&&L.contains(M)||(U=b.current)!=null&&U.contains(M)||x(!1)},R=P=>{var M;P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),x(!1),(M=y.current)==null||M.focus())};return document.addEventListener("pointerdown",D),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",D),document.removeEventListener("keydown",R,!0)}},[C]);const k=D=>{d(D)},S=`${br.bar}${!t||n?` ${br.barEmpty}`:""}`,A=t&&!n?{backgroundColor:t}:void 0,T=i.jsxs("div",{className:br.wrap,ref:h,children:[i.jsxs("button",{ref:y,type:"button",className:`${se.iconButton} ${br.button}`,"aria-label":f(a),"aria-expanded":C,"aria-haspopup":"listbox","aria-controls":C?g:void 0,disabled:u,onMouseDown:D=>D.preventDefault(),onClick:()=>x(D=>!D),children:[i.jsx(e,{className:`${se.icon} ${br.icon}`}),i.jsx("span",{className:S,style:A})]}),C?i.jsx(ke,{children:i.jsx("div",{ref:b,id:g,className:br.popover,style:{top:v.top,left:v.left},children:i.jsx(Ku,{value:t,mixed:n,noneLabel:f(r),ariaLabel:f(a),disabled:u,fallbackCustom:s,onChange:k,onCommit:()=>x(!1)})})}):null]});return i.jsx(Jn,{label:f(o),children:T})}function sT({commands:e,queries:t,disabled:n}){return i.jsx(Uh,{icon:Jf,value:t.getFontColor(),mixed:t.isFontColorMixed(),noneKey:"colorAutomatic",labelKey:"commandFontColor",ariaKey:"commandFontColorAria",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setFontColor(r)})}const lT="_wrap_1vjt0_1",cT="_wrapToolbar_1vjt0_7",uT="_field_1vjt0_12",dT="_trigger_1vjt0_20",mT="_chevron_1vjt0_50",fT="_list_1vjt0_73",pT="_listInline_1vjt0_88",gT="_option_1vjt0_96",hT="_separator_1vjt0_125",qt={wrap:lT,wrapToolbar:cT,field:uT,trigger:dT,chevron:mT,list:fT,listInline:pT,option:gT,separator:hT};function bT({value:e,mixed:t=!1,fonts:n,disabled:r,listId:o,listRef:a,inline:s,style:u,onSelect:d}){const f=X(),g=!t&&e===null;return i.jsxs("ul",{ref:a,id:o,className:s?`${qt.list} ${qt.listInline}`:qt.list,role:"listbox","aria-label":f("commandFontFamilyAria"),style:u,children:[i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:qt.option,role:"option","aria-checked":g,disabled:r,onMouseDown:h=>h.preventDefault(),onClick:()=>d(null),children:f("fontFamilyDefault")})}),i.jsx("li",{className:qt.separator,role:"separator"}),n.map(h=>{const y=!t&&di(e,h.family);return i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:qt.option,role:"option","aria-checked":y,disabled:r,style:{fontFamily:h.family},onMouseDown:b=>b.preventDefault(),onClick:()=>d(h.family),children:h.name})},h.family)})]})}function yT(e,t,n,r){var o;return t?"":e===null?r:((o=xx(e,n))==null?void 0:o.name)??e}function Vh({family:e,mixed:t=!1,fonts:n,disabled:r,tooltip:o,toolbar:a=!1,triggerId:s,onChange:u}){const d=X(),f=l.useId(),g=l.useRef(null),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState(!1),x=yT(e,t,n,d("fontFamilyDefault")),v=yo(b,h,y,{matchAnchorWidth:!0,deps:[n.length]});l.useEffect(()=>{if(!b)return;const S=T=>{var R,P;const D=T.target;(R=g.current)!=null&&R.contains(D)||(P=y.current)!=null&&P.contains(D)||C(!1)},A=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),C(!1))};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",A,!0),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",A,!0)}},[b]);const k=i.jsxs("div",{className:`${qt.wrap}${a?` ${qt.wrapToolbar}`:""}`,ref:g,children:[i.jsxs("div",{className:qt.field,ref:h,children:[i.jsx("button",{type:"button",id:s,className:qt.trigger,disabled:r,"aria-label":a?d("commandFontFamilyAria"):void 0,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":b?f:void 0,style:e&&!t?{fontFamily:e}:void 0,onMouseDown:S=>S.preventDefault(),onClick:()=>C(S=>!S),children:x}),i.jsx("span",{className:qt.chevron,"aria-hidden":"true"})]}),b?i.jsx(ke,{children:i.jsx(bT,{listRef:y,listId:f,value:t?null:e,mixed:t,fonts:n,disabled:r,style:{top:v.top,left:v.left,minWidth:v.width},onSelect:S=>{u(S),C(!1)}})}):null]});return o?i.jsx(Jn,{label:o,children:k}):k}function xT({commands:e,queries:t,disabled:n}){const r=X(),o=!!(n||!t.isVisualMode());return i.jsx(Vh,{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 CT="_wrap_58i0x_1",wT="_wrapToolbar_58i0x_9",vT="_field_58i0x_14",kT="_input_58i0x_22",ST="_toggle_58i0x_41",PT="_chevron_58i0x_42",AT="_unit_58i0x_80",TT="_list_58i0x_110",RT="_option_58i0x_125",Ue={wrap:CT,wrapToolbar:wT,field:vT,input:kT,toggle:ST,chevron:PT,unit:AT,list:TT,option:RT},DT={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Wh({size:e,unit:t,onSizeChange:n,onUnitChange:r,disabled:o,tooltip:a,sizeInputId:s,toolbar:u=!1}){const d=X(),f=l.useId(),g=l.useRef(null),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState(()=>e===null?"":fe(e)),[x,v]=l.useState(!1),[k,S]=l.useState(!1),A=yo(k,h,y,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{x||C(e===null?"":fe(e))},[e,x]),l.useEffect(()=>{if(!k)return;const M=U=>{var _,K;const j=U.target;(_=g.current)!=null&&_.contains(j)||(K=y.current)!=null&&K.contains(j)||S(!1)},L=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),S(!1))};return document.addEventListener("pointerdown",M),document.addEventListener("keydown",L,!0),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("keydown",L,!0)}},[k]);const T=M=>{const L=zx(M,t);if(!L){C(e===null?"":fe(e));return}n(L.value,L.unit),C(fe(L.value))},D=Lx[t],R=k?i.jsx(ke,{children:i.jsx("ul",{ref:y,className:Ue.list,role:"listbox",id:f,style:{top:A.top,left:A.left,minWidth:A.width},children:D.map(M=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ue.option,role:"option","aria-selected":e===M,onMouseDown:L=>L.preventDefault(),onClick:()=>{n(M,t),C(fe(M)),S(!1)},children:fe(M)})},M))})}):null,P=i.jsxs("div",{className:`${Ue.wrap}${u?` ${Ue.wrapToolbar}`:""}`,ref:g,children:[i.jsxs("div",{className:Ue.field,ref:h,children:[i.jsx("input",{id:s,className:Ue.input,value:b,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-autocomplete":"list","aria-expanded":k,"aria-controls":f,role:"combobox",inputMode:"decimal",onFocus:()=>v(!0),onBlur:()=>{v(!1),T(b)},onChange:M=>C(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),T(b),S(!1),M.currentTarget.blur()),M.key==="ArrowDown"&&(M.preventDefault(),S(!0))}}),i.jsx("button",{type:"button",className:Ue.toggle,tabIndex:-1,disabled:o,"aria-label":d("commandFontSizeAria"),"aria-expanded":k,"aria-controls":f,onMouseDown:M=>M.preventDefault(),onClick:()=>S(M=>!M)})]}),i.jsxs("div",{className:Ue.field,children:[i.jsx("select",{className:Ue.unit,value:t,disabled:o,"aria-label":d("commandFontSizeUnitAria"),onChange:M=>{r(M.target.value)},children:ou.map(M=>i.jsx("option",{value:M,children:d(DT[M])},M))}),i.jsx("span",{className:Ue.chevron,"aria-hidden":"true"})]}),R]});return a?i.jsx(Jn,{label:a,children:P}):P}function IT({commands:e,queries:t,disabled:n}){const r=X(),o=!!(n||!t.isVisualMode());return i.jsx(Wh,{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 jT({commands:e,queries:t,disabled:n}){return i.jsx(Uh,{icon:Qf,value:t.getHighlightColor(),mixed:t.isHighlightColorMixed(),noneKey:"colorNone",labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",fallbackCustom:"#ffff00",disabled:!!(n||!t.isVisualMode()),onChange:r=>e.setHighlightColor(r)})}function ET({commands:e,queries:t,disabled:n,onMenuClose:r}){const o=X(),a=!!(n||!t.isVisualMode());return i.jsx(Ku,{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 MT="_wrap_1gtdc_1",_T="_wrapToolbar_1gtdc_7",NT="_field_1gtdc_12",LT="_trigger_1gtdc_20",BT="_chevron_1gtdc_46",FT="_list_1gtdc_69",HT="_option_1gtdc_84",zT="_separator_1gtdc_113",Tn={wrap:MT,wrapToolbar:_T,field:NT,trigger:LT,chevron:BT,list:FT,option:HT,separator:zT},OT="_backdrop_1p9zk_1",KT="_dialog_1p9zk_12",$T="_dialogWide_1p9zk_31",UT="_header_1p9zk_35",VT="_tabs_1p9zk_43",WT="_tab_1p9zk_43",GT="_body_1p9zk_76",ZT="_field_1p9zk_86",qT="_label_1p9zk_92",YT="_sizeRow_1p9zk_96",XT="_fileRow_1p9zk_102",JT="_fileName_1p9zk_108",QT="_previewImage_1p9zk_115",eR="_marks_1p9zk_125",tR="_mark_1p9zk_125",nR="_actions_1p9zk_140",rR="_actionsSpread_1p9zk_148",oR="_actionsEnd_1p9zk_152",iR="_headerRow_1p9zk_157",aR="_close_1p9zk_170",sR="_nameSection_1p9zk_187",lR="_nameInput_1p9zk_192",cR="_labelRow_1p9zk_209",uR="_help_1p9zk_215",dR="_textInput_1p9zk_233",mR="_fullSelect_1p9zk_245",fR="_error_1p9zk_249",pR="_emptyHint_1p9zk_254",gR="_action_1p9zk_140",hR="_textarea_1p9zk_265",bR="_actionDanger_1p9zk_279",yR="_confirmBody_1p9zk_285",xR="_nestedPanel_1p9zk_294",CR="_spinnerWrap_1p9zk_309",wR="_spinner_1p9zk_309",vR="_actionPrimary_1p9zk_344",kR="_iconButton_1p9zk_358",SR="_select_1p9zk_359",PR="_lengthInput_1p9zk_360",AR="_lengthUnit_1p9zk_361",TR="_group_1p9zk_369",RR="_nestedGroup_1p9zk_379",DR="_subLabel_1p9zk_389",IR="_iconRow_1p9zk_393",jR="_lengthField_1p9zk_425",ER="_sideLabel_1p9zk_431",MR="_lengthRow_1p9zk_435",_R="_sideGrid_1p9zk_463",NR="_shadowGrid_1p9zk_464",p={backdrop:OT,dialog:KT,dialogWide:$T,header:UT,tabs:VT,tab:WT,body:GT,field:ZT,label:qT,sizeRow:YT,fileRow:XT,fileName:JT,previewImage:QT,marks:eR,mark:tR,actions:nR,actionsSpread:rR,actionsEnd:oR,headerRow:iR,close:aR,nameSection:sR,nameInput:lR,labelRow:cR,help:uR,textInput:dR,fullSelect:mR,error:fR,emptyHint:pR,action:gR,textarea:hR,actionDanger:bR,confirmBody:yR,nestedPanel:xR,spinnerWrap:CR,spinner:wR,actionPrimary:vR,iconButton:kR,select:SR,lengthInput:PR,lengthUnit:AR,group:TR,nestedGroup:RR,subLabel:DR,iconRow:IR,lengthField:jR,sideLabel:ER,lengthRow:MR,sideGrid:_R,shadowGrid:NR},Zc={p:"styleParagraph",h1:"styleHeading1",h2:"styleHeading2",h3:"styleHeading3",h4:"styleHeading4",h5:"styleHeading5",h6:"styleHeading6"},LR={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 Bf(){const e=X();return i.jsx("div",{className:p.spinnerWrap,role:"status","aria-live":"polite","aria-label":e("customStyleLoading"),children:i.jsx("span",{className:p.spinner,"aria-hidden":"true"})})}function Gh({value:e,mixed:t=!1,disabled:n,menu:r=!1,listId:o,listRef:a,style:s,customStylesEnabled:u=!1,customStyles:d=[],customStylesLoading:f=!1,onSelect:g,onSelectCustom:h,onAddNew:y}){const b=X(),C=t?null:e,x=u,v=!!(r&&u&&y);return r?i.jsxs(i.Fragment,{children:[Xa.map(k=>i.jsx("button",{type:"button",className:se.menuItem,role:"menuitemradio","aria-checked":C===k,disabled:n,onMouseDown:S=>S.preventDefault(),onClick:()=>g(k),children:b(Zc[k])},k)),x?i.jsx("div",{role:"separator",className:se.menuSeparator}):null,x&&f?i.jsx(Bf,{}):null,x&&!f?d.map(k=>i.jsx("button",{type:"button",className:se.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:[x&&(f||d.length>0)?i.jsx("div",{role:"separator",className:se.menuSeparator}):null,i.jsxs("button",{type:"button",className:se.menuItem,role:"menuitem","aria-label":b("styleAddNewAria"),disabled:n,onMouseDown:k=>k.preventDefault(),onClick:()=>y==null?void 0:y(),children:[i.jsx(Ey,{className:se.icon}),b("styleAddNew")]})]}):null]}):i.jsxs("ul",{ref:a,className:Tn.list,role:"listbox",id:o,style:s,"aria-label":b("commandParagraphStyleAria"),"aria-busy":x&&f?!0:void 0,children:[Xa.map(k=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Tn.option,role:"option","aria-selected":C===k,disabled:n,style:LR[k],onMouseDown:S=>S.preventDefault(),onClick:()=>g(k),children:b(Zc[k])})},k)),x&&(f||d.length>0)?i.jsx("li",{role:"separator",className:Tn.separator}):null,x&&f?i.jsx("li",{role:"presentation",children:i.jsx(Bf,{})}):null,x&&!f?d.map(k=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Tn.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]})}function BR({commands:e,queries:t,disabled:n}){const r=X(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useRef(null),[d,f]=l.useState(!1),g=!!(n||!t.isVisualMode()),h=t.isParagraphStyleMixed(),y=h?null:t.getParagraphStyle(),b=y?r(Zc[y]):"",C=t.customParagraphStylesEnabled(),x=C?t.getCustomParagraphStyles():[],v=C&&t.isCustomParagraphStylesLoading(),k=yo(d,s,u,{matchAnchorWidth:!0,deps:[x.length,v]});l.useEffect(()=>{if(!d)return;const A=D=>{var P,M;const R=D.target;(P=a.current)!=null&&P.contains(R)||(M=u.current)!=null&&M.contains(R)||f(!1)},T=D=>{D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),f(!1))};return document.addEventListener("pointerdown",A),document.addEventListener("keydown",T,!0),()=>{document.removeEventListener("pointerdown",A),document.removeEventListener("keydown",T,!0)}},[d]);const S=i.jsxs("div",{className:`${Tn.wrap} ${Tn.wrapToolbar}`,ref:a,children:[i.jsxs("div",{className:Tn.field,ref:s,children:[i.jsx("button",{type:"button",className:Tn.trigger,disabled:g,"aria-label":r("commandParagraphStyleAria"),"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?o:void 0,onMouseDown:A=>A.preventDefault(),onClick:()=>f(A=>!A),children:b}),i.jsx("span",{className:Tn.chevron,"aria-hidden":"true"})]}),d?i.jsx(ke,{children:i.jsx(Gh,{listRef:u,listId:o,value:y,mixed:h,disabled:g,customStylesEnabled:C,customStyles:x,customStylesLoading:v,style:{top:k.top,left:k.left,minWidth:k.width},onSelect:A=>{e.setParagraphStyle(A),f(!1)},onSelectCustom:A=>{e.applyCustomParagraphStyle(A),f(!1)}})}):null]});return i.jsx(Jn,{label:r("commandParagraphStyle"),children:S})}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():[],f=u&&t.isCustomParagraphStylesLoading();return i.jsx(Gh,{menu:!0,value:s,mixed:a,disabled:o,customStylesEnabled:u,customStyles:d,customStylesLoading:f,onSelect:g=>{e.setParagraphStyle(g),r==null||r()},onSelectCustom:g=>{e.openCustomParagraphStyleDialog(g),r==null||r()},onAddNew:()=>{e.openCustomParagraphStyleDialog(),r==null||r()}})}const HR={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:ET,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:xT,icon:py,labelKey:"commandFontFamily",ariaKey:"commandFontFamilyAria",enabled:"isVisualMode"},paragraphStyle:{id:"paragraphStyle",widget:BR,icon:jy,labelKey:"commandParagraphStyle",ariaKey:"commandParagraphStyleAria",enabled:"isVisualMode"},fontSize:{id:"fontSize",widget:IT,icon:hy,labelKey:"commandFontSize",ariaKey:"commandFontSizeAria",enabled:"isVisualMode"},fontProperties:{id:"fontProperties",command:"openFontProperties",icon:gy,labelKey:"commandFontProperties",ariaKey:"commandFontPropertiesAria",enabled:"isVisualMode"},customCss:{id:"customCss",command:"openCustomCss",icon:dy,labelKey:"commandCustomCss",ariaKey:"commandCustomCssAria",enabled:"isVisualMode"},paragraphProperties:{id:"paragraphProperties",command:"openParagraphProperties",icon:np,labelKey:"commandParagraphProperties",ariaKey:"commandParagraphPropertiesAria",enabled:"isVisualMode"},imageProperties:{id:"imageProperties",command:"openImageProperties",icon:ep,labelKey:"menuImage",ariaKey:"menuImageAria",enabled:"isImageSelected"},fontColor:{id:"fontColor",widget:sT,icon:Jf,labelKey:"commandFontColor",ariaKey:"commandFontColorAria",enabled:"isVisualMode"},highlightColor:{id:"highlightColor",widget:jT,icon:Qf,labelKey:"commandHighlightColor",ariaKey:"commandHighlightColorAria",enabled:"isVisualMode"},bold:{id:"bold",command:"toggleBold",icon:oy,labelKey:"commandBold",ariaKey:"commandBoldAria",active:"isBold",enabled:"isVisualMode",toggle:!0},italic:{id:"italic",command:"toggleItalic",icon:vy,labelKey:"commandItalic",ariaKey:"commandItalicAria",active:"isItalic",enabled:"isVisualMode",toggle:!0},underline:{id:"underline",command:"toggleUnderline",icon:zy,labelKey:"commandUnderline",ariaKey:"commandUnderlineAria",active:"isUnderline",enabled:"isVisualMode",toggle:!0},strikethrough:{id:"strikethrough",command:"toggleStrikethrough",icon:Hy,labelKey:"commandStrikethrough",ariaKey:"commandStrikethroughAria",active:"isStrikethrough",enabled:"isVisualMode",toggle:!0},clearFormatting:{id:"clearFormatting",command:"clearFormatting",icon:sy,labelKey:"commandClearFormatting",ariaKey:"commandClearFormattingAria",enabled:"hasTextSelection"},formatBrush:{id:"formatBrush",command:"toggleFormatBrush",icon:by,labelKey:"commandFormatBrush",ariaKey:"commandFormatBrushAria",active:"isFormatBrushActive",enabled:"isVisualMode",toggle:!0},alignLeft:{id:"alignLeft",command:"alignLeft",icon:cs,labelKey:"commandAlignLeft",ariaKey:"commandAlignLeftAria",active:"isAlignLeft",enabled:"isVisualMode"},alignCenter:{id:"alignCenter",command:"alignCenter",icon:ls,labelKey:"commandAlignCenter",ariaKey:"commandAlignCenterAria",active:"isAlignCenter",enabled:"isVisualMode"},alignRight:{id:"alignRight",command:"alignRight",icon:us,labelKey:"commandAlignRight",ariaKey:"commandAlignRightAria",active:"isAlignRight",enabled:"isVisualMode"},alignJustify:{id:"alignJustify",command:"alignJustify",icon:Yf,labelKey:"commandAlignJustify",ariaKey:"commandAlignJustifyAria",active:"isAlignJustify",enabled:"isVisualMode"},indent:{id:"indent",command:"indent",icon:wy,labelKey:"commandIndent",ariaKey:"commandIndentAria",enabled:"isVisualMode"},outdent:{id:"outdent",command:"outdent",icon:Ry,labelKey:"commandOutdent",ariaKey:"commandOutdentAria",enabled:"canOutdent"},bulletList:{id:"bulletList",command:"toggleBulletList",icon:Xf,labelKey:"commandBulletList",ariaKey:"commandBulletListAria",active:"isBulletList",enabled:"isVisualMode",toggle:!0},numberedList:{id:"numberedList",command:"toggleNumberedList",icon:tp,labelKey:"commandNumberedList",ariaKey:"commandNumberedListAria",active:"isNumberedList",enabled:"isVisualMode",toggle:!0}}},zR={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:Sy,labelKey:"commandLink",ariaKey:"commandLinkAria",enabled:"isVisualMode",active:"isLink",toggle:!0},bookmark:{id:"bookmark",command:"openBookmarkDialog",icon:iy,labelKey:"commandBookmark",ariaKey:"commandBookmarkAria",enabled:"isVisualMode"},image:{id:"image",command:"openImageDialog",icon:ep,labelKey:"commandImage",ariaKey:"commandImageAria",enabled:"isVisualMode"},pageBackgroundImage:{id:"pageBackgroundImage",command:"openPageBackgroundImage",icon:qo,labelKey:"commandPageBackgroundImage",ariaKey:"commandPageBackgroundImageAria",enabled:"canInsertPageBackgroundImage"},paragraphBackgroundImage:{id:"paragraphBackgroundImage",command:"openParagraphBackgroundImage",icon:np,labelKey:"commandParagraphBackgroundImage",ariaKey:"commandParagraphBackgroundImageAria",enabled:"canInsertParagraphBackgroundImage"},audio:{id:"audio",command:"openAudioDialog",icon:ry,labelKey:"commandAudio",ariaKey:"commandAudioAria",enabled:"isVisualMode"},youtube:{id:"youtube",command:"openYoutubeDialog",icon:Uy,labelKey:"commandYoutube",ariaKey:"commandYoutubeAria",enabled:"isVisualMode"},horizontalRule:{id:"horizontalRule",command:"insertHorizontalRule",icon:xy,labelKey:"commandHorizontalRule",ariaKey:"commandHorizontalRuleAria",enabled:"isVisualMode"},pageBreak:{id:"pageBreak",command:"insertPageBreak",icon:Dy,labelKey:"commandPageBreak",ariaKey:"commandPageBreakAria",enabled:"isVisualMode"},insertPageBefore:{id:"insertPageBefore",command:"insertPageBefore",icon:qo,labelKey:"commandInsertPageBefore",ariaKey:"commandInsertPageBeforeAria",enabled:"hasSelectedPage"},insertPageAfter:{id:"insertPageAfter",command:"insertPageAfter",icon:qo,labelKey:"commandInsertPageAfter",ariaKey:"commandInsertPageAfterAria",enabled:"hasSelectedPage"}}},OR={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:jm,labelKey:"commandTable",ariaKey:"commandTableAria",enabled:"isVisualMode"},insertRowBelow:{id:"insertRowBelow",command:"insertRowBelow",icon:Kl,labelKey:"commandInsertRowBelow",ariaKey:"commandInsertRowBelowAria",enabled:"isInTable"},insertRowBefore:{id:"insertRowBefore",command:"insertRowBefore",icon:Kl,labelKey:"commandInsertRowBefore",ariaKey:"commandInsertRowBeforeAria",enabled:"isInTable"},deleteRow:{id:"deleteRow",command:"deleteRow",icon:Kl,labelKey:"commandDeleteRow",ariaKey:"commandDeleteRowAria",enabled:"isInTable"},insertColumnAfter:{id:"insertColumnAfter",command:"insertColumnAfter",icon:Ol,labelKey:"commandInsertColumnAfter",ariaKey:"commandInsertColumnAfterAria",enabled:"isInTable"},insertColumnBefore:{id:"insertColumnBefore",command:"insertColumnBefore",icon:Ol,labelKey:"commandInsertColumnBefore",ariaKey:"commandInsertColumnBeforeAria",enabled:"isInTable"},deleteColumn:{id:"deleteColumn",command:"deleteColumn",icon:Ol,labelKey:"commandDeleteColumn",ariaKey:"commandDeleteColumnAria",enabled:"isInTable"},mergeCells:{id:"mergeCells",command:"mergeCells",icon:Ay,labelKey:"commandMergeCells",ariaKey:"commandMergeCellsAria",enabled:"canMergeCells"},unmergeCells:{id:"unmergeCells",command:"unmergeCells",icon:Ky,labelKey:"commandUnmergeCells",ariaKey:"commandUnmergeCellsAria",enabled:"canUnmergeCells"},tableProperties:{id:"tableProperties",command:"openTableProperties",icon:jm,labelKey:"commandTableProperties",ariaKey:"commandTablePropertiesAria",enabled:"isInTable"},cellProperties:{id:"cellProperties",command:"openCellProperties",icon:ay,labelKey:"commandCellProperties",ariaKey:"commandCellPropertiesAria",enabled:"isInTable"},rowProperties:{id:"rowProperties",command:"openRowProperties",icon:Ly,labelKey:"commandRowProperties",ariaKey:"commandRowPropertiesAria",enabled:"isInTable"}}},KR={menus:{help:{id:"help",labelKey:"menuHelp",ariaKey:"menuHelpAria"}},groups:{},items:{editorHelp:{id:"editorHelp",command:"openHelp",icon:zl,labelKey:"commandEditorHelp",ariaKey:"commandEditorHelpAria"},keyboardShortcuts:{id:"keyboardShortcuts",command:"openKeyboardShortcuts",icon:zl,labelKey:"commandKeyboardShortcuts",ariaKey:"commandKeyboardShortcutsAria"},about:{id:"about",command:"openAbout",icon:zl,labelKey:"commandAbout",ariaKey:"commandAboutAria"}}},$R=["getStarted","file","edit","insert","format","table","view","keyboard"],qc=[{id:"getStarted",category:"getStarted",titleKey:"helpTopicGetStartedTitle",bodyKey:"helpTopicGetStartedBody",keywordsKey:"helpTopicGetStartedKeywords",related:["switchModes","searchHelp","keyboardShortcuts"]},{id:"switchModes",category:"getStarted",titleKey:"helpTopicSwitchModesTitle",bodyKey:"helpTopicSwitchModesBody",keywordsKey:"helpTopicSwitchModesKeywords",related:["getStarted","preview"]},{id:"searchHelp",category:"getStarted",titleKey:"helpTopicSearchHelpTitle",bodyKey:"helpTopicSearchHelpBody",keywordsKey:"helpTopicSearchHelpKeywords",related:["getStarted","keyboardShortcuts"]},{id:"saveDocument",category:"file",titleKey:"helpTopicSaveDocumentTitle",bodyKey:"helpTopicSaveDocumentBody",keywordsKey:"helpTopicSaveDocumentKeywords",related:["openDocument","printDocument"]},{id:"openDocument",category:"file",titleKey:"helpTopicOpenDocumentTitle",bodyKey:"helpTopicOpenDocumentBody",keywordsKey:"helpTopicOpenDocumentKeywords",related:["saveDocument","printDocument"]},{id:"printDocument",category:"file",titleKey:"helpTopicPrintDocumentTitle",bodyKey:"helpTopicPrintDocumentBody",keywordsKey:"helpTopicPrintDocumentKeywords",related:["saveDocument","preview"]},{id:"undoRedo",category:"edit",titleKey:"helpTopicUndoRedoTitle",bodyKey:"helpTopicUndoRedoBody",keywordsKey:"helpTopicUndoRedoKeywords",related:["keyboardShortcuts","clearFormatting"]},{id:"pageProperties",category:"edit",titleKey:"helpTopicPagePropertiesTitle",bodyKey:"helpTopicPagePropertiesBody",keywordsKey:"helpTopicPagePropertiesKeywords",related:["insertPage","deletePage"]},{id:"deletePage",category:"edit",titleKey:"helpTopicDeletePageTitle",bodyKey:"helpTopicDeletePageBody",keywordsKey:"helpTopicDeletePageKeywords",related:["insertPage","pageProperties"]},{id:"insertTable",category:"insert",titleKey:"helpTopicInsertTableTitle",bodyKey:"helpTopicInsertTableBody",keywordsKey:"helpTopicInsertTableKeywords",related:["tableRowsColumns","mergeCells"]},{id:"insertImage",category:"insert",titleKey:"helpTopicInsertImageTitle",bodyKey:"helpTopicInsertImageBody",keywordsKey:"helpTopicInsertImageKeywords",related:["insertLink","pageProperties"]},{id:"insertLink",category:"insert",titleKey:"helpTopicInsertLinkTitle",bodyKey:"helpTopicInsertLinkBody",keywordsKey:"helpTopicInsertLinkKeywords",related:["insertBookmark","insertImage"]},{id:"insertBookmark",category:"insert",titleKey:"helpTopicInsertBookmarkTitle",bodyKey:"helpTopicInsertBookmarkBody",keywordsKey:"helpTopicInsertBookmarkKeywords",related:["insertLink"]},{id:"insertMedia",category:"insert",titleKey:"helpTopicInsertMediaTitle",bodyKey:"helpTopicInsertMediaBody",keywordsKey:"helpTopicInsertMediaKeywords",related:["insertImage","insertLink"]},{id:"pageBreak",category:"insert",titleKey:"helpTopicPageBreakTitle",bodyKey:"helpTopicPageBreakBody",keywordsKey:"helpTopicPageBreakKeywords",related:["insertPage","printDocument"]},{id:"insertPage",category:"insert",titleKey:"helpTopicInsertPageTitle",bodyKey:"helpTopicInsertPageBody",keywordsKey:"helpTopicInsertPageKeywords",related:["pageBreak","deletePage"]},{id:"insertComment",category:"insert",titleKey:"helpTopicInsertCommentTitle",bodyKey:"helpTopicInsertCommentBody",keywordsKey:"helpTopicInsertCommentKeywords",related:["preview"]},{id:"formatFont",category:"format",titleKey:"helpTopicFormatFontTitle",bodyKey:"helpTopicFormatFontBody",keywordsKey:"helpTopicFormatFontKeywords",related:["paragraphStyles","textColor","keyboardShortcuts"]},{id:"paragraphStyles",category:"format",titleKey:"helpTopicParagraphStylesTitle",bodyKey:"helpTopicParagraphStylesBody",keywordsKey:"helpTopicParagraphStylesKeywords",related:["formatFont","alignLists"]},{id:"textColor",category:"format",titleKey:"helpTopicTextColorTitle",bodyKey:"helpTopicTextColorBody",keywordsKey:"helpTopicTextColorKeywords",related:["formatFont","clearFormatting"]},{id:"alignLists",category:"format",titleKey:"helpTopicAlignListsTitle",bodyKey:"helpTopicAlignListsBody",keywordsKey:"helpTopicAlignListsKeywords",related:["paragraphStyles","formatFont"]},{id:"clearFormatting",category:"format",titleKey:"helpTopicClearFormattingTitle",bodyKey:"helpTopicClearFormattingBody",keywordsKey:"helpTopicClearFormattingKeywords",related:["formatFont","customCss"]},{id:"customCss",category:"format",titleKey:"helpTopicCustomCssTitle",bodyKey:"helpTopicCustomCssBody",keywordsKey:"helpTopicCustomCssKeywords",related:["formatFont","clearFormatting"]},{id:"tableRowsColumns",category:"table",titleKey:"helpTopicTableRowsColumnsTitle",bodyKey:"helpTopicTableRowsColumnsBody",keywordsKey:"helpTopicTableRowsColumnsKeywords",related:["insertTable","mergeCells","keyboardShortcuts"]},{id:"mergeCells",category:"table",titleKey:"helpTopicMergeCellsTitle",bodyKey:"helpTopicMergeCellsBody",keywordsKey:"helpTopicMergeCellsKeywords",related:["insertTable","tableRowsColumns"]},{id:"customizeToolbar",category:"view",titleKey:"helpTopicCustomizeToolbarTitle",bodyKey:"helpTopicCustomizeToolbarBody",keywordsKey:"helpTopicCustomizeToolbarKeywords",related:["zoom","fullscreen"]},{id:"zoom",category:"view",titleKey:"helpTopicZoomTitle",bodyKey:"helpTopicZoomBody",keywordsKey:"helpTopicZoomKeywords",related:["preview","fullscreen"]},{id:"darkMode",category:"view",titleKey:"helpTopicDarkModeTitle",bodyKey:"helpTopicDarkModeBody",keywordsKey:"helpTopicDarkModeKeywords",related:["customizeToolbar"]},{id:"preview",category:"view",titleKey:"helpTopicPreviewTitle",bodyKey:"helpTopicPreviewBody",keywordsKey:"helpTopicPreviewKeywords",related:["printDocument","switchModes"]},{id:"fullscreen",category:"view",titleKey:"helpTopicFullscreenTitle",bodyKey:"helpTopicFullscreenBody",keywordsKey:"helpTopicFullscreenKeywords",related:["zoom","keyboardShortcuts"]},{id:"ruler",category:"view",titleKey:"helpTopicRulerTitle",bodyKey:"helpTopicRulerBody",keywordsKey:"helpTopicRulerKeywords",related:["pageProperties","alignLists"]},{id:"keyboardShortcuts",category:"keyboard",titleKey:"helpTopicKeyboardShortcutsTitle",bodyKey:"helpTopicKeyboardShortcutsBody",keywordsKey:"helpTopicKeyboardShortcutsKeywords",related:["getStarted","undoRedo","formatFont"]}],Ff=Object.fromEntries(qc.map(e=>[e.id,e]));function Zh(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function UR(e,t){const n=Zh(t);if(n.length===0)return 1;const r=e.title.toLowerCase(),o=e.body.toLowerCase(),a=e.keywords.toLowerCase(),s=`${r} ${o} ${a}`;let u=0;for(const d of n)r.includes(d)&&(u+=30),a.includes(d)&&(u+=20),o.includes(d)&&(u+=10),s.includes(d)&&(u+=5);return u}function VR(e,t){return Zh(t).length===0?e:e.map(r=>({entry:r,score:UR(r,t)})).filter(({score:r})=>r>0).sort((r,o)=>o.score-r.score||r.entry.title.localeCompare(o.entry.title)).map(({entry:r})=>r)}const WR={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:$y,labelKey:"modeVisual",ariaKey:"modeVisualAria",active:"isVisualMode"},html:{id:"html",command:"setHtmlMode",icon:Cy,labelKey:"modeHtml",ariaKey:"modeHtmlAria",active:"isHtmlMode"},customizeToolbar:{id:"customizeToolbar",command:"openCustomizeToolbar",icon:my,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:ky,labelKey:"modeLight",ariaKey:"modeLightAria",active:"isLightMode"},darkMode:{id:"darkMode",command:"setDarkMode",icon:fy,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:Iy,labelKey:"commandPreview",ariaKey:"commandPreviewAria"},ruler:{id:"ruler",command:"toggleRuler",icon:By,labelKey:"commandRuler",ariaKey:"commandRulerAria",active:"isRulerVisible",toggle:!0},readAloud:{id:"readAloud",command:"toggleReadAloud",icon:_y,labelKey:"commandReadAloud",ariaKey:"commandReadAloudAria",active:"isReadingAloud",toggle:!0,enabled:"canReadAloud"},fullscreen:{id:"fullscreen",command:"toggleFullscreen",icon:yy,labelKey:"modeFullscreen",ariaKey:"modeFullscreenAria",active:"isFullscreen",toggle:!0}}};function GR(...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 ZR=GR(oA,PP,zR,OR,WR,HR,KR),qR={menus:[{id:"file",items:["save","open",ve,"print"]},{id:"edit",items:["undo","redo",ve,{submenu:"page",items:["pageProperties",ve,"deletePage"]}]},{id:"view",items:["visual","html",ve,{submenu:"toolbar",items:["customizeToolbar",ve,{submenu:"toolbarPosition",items:["toolbarPositionTop","toolbarPositionLeft","toolbarPositionRight","toolbarPositionBottom"]}]},ve,{submenu:"zoom",items:["pageZoomFitWidth","pageZoomFitPage",ve,"pageZoom50","pageZoom75","pageZoom100","pageZoom125","pageZoom150","pageZoom200"]},ve,"lightMode","darkMode",ve,"toggleCommentsVisible","ruler","preview","readAloud","fullscreen"]},{id:"insert",items:["pageBreak",{submenu:"insertPage",items:["insertPageBefore","insertPageAfter"]},ve,"table",ve,"image","pageBackgroundImage","paragraphBackgroundImage","audio","youtube","horizontalRule",ve,"link","bookmark",ve,"insertComment"]},{id:"format",items:[{submenu:"paragraphStyles",items:[]},ve,{submenu:"font",items:["fontProperties","customCss",ve,{submenu:"highlightColor",items:[]},ve,"bold","italic","underline","strikethrough"]},ve,"clearFormatting",ve,{submenu:"paragraph",items:["paragraphProperties",ve,"alignLeft","alignCenter","alignRight","alignJustify",ve,"indent","outdent",ve,"bulletList","numberedList"]},ve,"imageProperties"]},{id:"table",items:["table",ve,{submenu:"insertRow",items:["insertRowBefore","insertRowBelow","deleteRow"]},{submenu:"insertColumn",items:["insertColumnBefore","insertColumnAfter","deleteColumn"]},ve,"mergeCells","unmergeCells",ve,"tableProperties","rowProperties","cellProperties"]},{id:"help",items:["editorHelp","keyboardShortcuts",ve,"about"]}],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"]}]},Hf={items:{addComment:{id:"addComment",command:"addComment",icon:Im,labelKey:"commandAddComment",ariaKey:"commandAddCommentAria",enabled:"canAddComment"},insertComment:{id:"insertComment",command:"addComment",icon:Im,labelKey:"commandInsertComment",ariaKey:"commandInsertCommentAria",enabled:"canAddComment"},toggleCommentsVisible:{id:"toggleCommentsVisible",command:"toggleCommentsVisible",icon:ly,labelKey:"showComments",ariaKey:"toggleCommentsVisibleAria",toggle:!0,active:"areCommentsVisible"}}},YR=["addComment","insertComment","toggleCommentsVisible"],XR=new Set(["insert","view"]);function qh(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!YR.includes(e):!0:!1}function JR(e,t){return t.disabled?!0:t.readOnly?t.enableComments?!XR.has(e):!0:!1}function QR(e,t){const n=t?"hideComments":"showComments",r=Hf.items.toggleCommentsVisible;return{...e,items:{...e.items,...Hf.items,toggleCommentsVisible:r&&{...r,labelKey:n}}}}function eD(e){return{...e,menus:e.menus.map(t=>{if(t.id==="insert"){const n=[...t.items],r=n.findIndex(a=>Zn(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 zf={canUndo:"history",canRedo:"history",isBold:"marks",isItalic:"marks",isUnderline:"marks",isStrikethrough:"marks",getFontSize:"marks",getFontSizeUnit:"marks",isFontSizeMixed:"marks",getFontFamily:"marks",isFontFamilyMixed:"marks",getFontColor:"marks",isFontColorMixed:"marks",getHighlightColor:"marks",isHighlightColorMixed:"marks",getParagraphStyle:"marks",isParagraphStyleMixed:"marks",isAlignLeft:"marks",isAlignCenter:"marks",isAlignRight:"marks",isAlignJustify:"marks",canOutdent:"marks",isBulletList:"marks",isNumberedList:"marks",isFormatBrushActive:"marks",isInTable:"table",canMergeCells:"table",canUnmergeCells:"table",hasTextSelection:"selection",isImageSelected:"selection",isLink:"selection",canReadAloud:"selection",isReadingAloud:"selection"};function Yh(){const e={history:0,marks:0,table:0,selection:0,chrome:0},t=new Map;function n(r,o){let a=t.get(r);return a||(a=new Set,t.set(r,a)),a.add(o),()=>{a==null||a.delete(o)}}return{subscribe:n,getSnapshot:r=>e[r],bump(r){e[r]+=1;const o=t.get(r);if(o)for(const a of o)a()}}}function Xh(e){const t=new Set;return e.active&&t.add(zf[e.active]??"chrome"),e.enabled&&t.add(zf[e.enabled]??"chrome"),t.size===0&&t.add("chrome"),[...t]}const Jh=l.createContext(null);function tD({value:e,children:t}){return i.jsx(Jh.Provider,{value:e,children:t})}function Qh(e){const t=l.useContext(Jh),n=l.useMemo(()=>e.join("\0"),[e]),r=l.useMemo(()=>e,[n,e]);l.useSyncExternalStore(o=>{if(!t)return()=>{};const a=r.map(s=>t.subscribe(s,o));return()=>{for(const s of a)s()}},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o},()=>{if(!t)return 0;let o=0;for(const a of r)o+=t.getSnapshot(a);return o})}const Ia="fullscreen";function nD(e){const t=[];let n=null;for(const r of e){const o=r.items.filter(a=>a!==Ia);o.length>0&&t.push({id:r.id,items:o}),r.items.includes(Ia)&&(n={id:Ia,items:[Ia]})}return{main:t,trailing:n}}const rD=l.memo(function({item:t,itemId:n,commands:r,queries:o,disabled:a,chromeLock:s}){const u=X(),d=l.useMemo(()=>Xh(t),[t]);if(Qh(d),!t.icon||!t.command)return null;const f=t.icon,g=t.command,h=t.enabled?!o[t.enabled]():!1,y=t.active?o[t.active]():void 0;return i.jsx(Jn,{label:t.tooltip??Xn(u,t),children:i.jsx("button",{type:"button",className:se.iconButton,"aria-label":os(u,t),"aria-pressed":y,disabled:a||(s?qh(n,s):!1)||h,onPointerDown:b=>b.preventDefault(),onMouseDown:b=>b.preventDefault(),onClick:()=>{Qc(r,g)},children:i.jsx(f,{className:se.icon})})})});function oD({groups:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a}){const s=X(),{main:u,trailing:d}=nD(e),f=g=>{const h=t.groups[g.id];return i.jsx("div",{className:se.iconGroup,role:"group","aria-label":h?Xn(s,h):void 0,"data-toolbar-group":g.id,children:g.items.map(y=>{const b=t.items[y];if(!b)return null;const C=b.enabled?!r[b.enabled]():!1;if(b.widget){const x=b.widget;return i.jsx(x,{commands:n,queries:r,disabled:o||C},y)}return!b.icon||!b.command?null:i.jsx(rD,{itemId:y,item:b,commands:n,queries:r,disabled:o,chromeLock:a},y)})},g.id)};return i.jsxs("div",{className:se.iconNav,role:"toolbar","aria-label":s("toolbarAria"),children:[u.length>0?i.jsx("div",{className:se.iconNavMain,children:u.map(f)}):null,d?i.jsx("div",{className:se.iconNavEnd,children:f(d)}):null]})}const iD=["--wysiwyg-menu-color","--wysiwyg-menu-background","--wysiwyg-menu-font-size","--wysiwyg-menu-font-family"];function aD(e){const t={};for(const n of iD){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 sD({menus:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,compact:s,openMenuId:u,onOpenMenuIdChange:d}){const f=X(),[g,h]=l.useState(!1),[y,b]=l.useState({}),C=l.useRef(null),x=l.useRef(null),v=l.useRef(null),k=l.useRef(null),S=l.useCallback(()=>{h(!1),d(null)},[d]);l.useLayoutEffect(()=>{!g||!C.current||b(aD(C.current))},[g]),l.useEffect(()=>{var T;g&&((T=v.current)==null||T.focus())},[g]),l.useEffect(()=>{if(!g)return;const T=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=T}},[g]),l.useEffect(()=>{if(!g)return;const T=R=>{var P;if(R.key==="Escape"){if(R.preventDefault(),R.stopPropagation(),u){d(null);return}S(),(P=x.current)==null||P.focus()}},D=R=>{var P;k.current&&!k.current.contains(R.target)&&(S(),(P=x.current)==null||P.focus())};return document.addEventListener("keydown",T,!0),document.addEventListener("pointerdown",D),()=>{document.removeEventListener("keydown",T,!0),document.removeEventListener("pointerdown",D)}},[g,u,d,S]);const A=T=>e.map(D=>{const R=t.menus[D.id];return R?i.jsx(cD,{def:R,itemIds:D.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:T,open:(T==="overlay"||!g)&&u===D.id,onOpenChange:P=>d(P?D.id:null),onItemRun:T==="overlay"?()=>{var P;S(),(P=x.current)==null||P.focus()}:void 0},`${T}-${D.id}`):null});return i.jsxs("div",{className:se.menuBar,ref:C,children:[i.jsx(Jn,{label:f("brandMarkAria"),children:i.jsx("span",{className:se.brandMark,role:"img","aria-label":f("brandMarkAria"),children:i.jsx(cy,{className:se.brandMarkIcon})})}),i.jsx("div",{className:se.menuBarCompact,hidden:s===void 0?void 0:!s,children:i.jsx(Jn,{label:f("menuHamburgerAria"),children:i.jsx("button",{ref:x,type:"button",className:`${se.menuButton} ${se.hamburgerButton}`,"aria-haspopup":"dialog","aria-expanded":g,"aria-label":f("menuHamburgerAria"),disabled:o||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>{if(g){S();return}d(null),h(!0)},children:i.jsx(Py,{className:se.icon})})})}),i.jsx("div",{className:se.menuBarDesktop,hidden:s===void 0?void 0:s,children:A("dropdown")}),g?i.jsx(ke,{children:i.jsx("div",{className:se.toolbar,"data-menu-overlay-portal":"",style:y,children:i.jsxs("div",{ref:k,className:se.menuOverlay,role:"dialog","aria-modal":"true","aria-label":f("menuOverlayAria"),children:[i.jsxs("div",{className:se.menuOverlayHeader,children:[i.jsx("span",{className:se.menuOverlayTitle,children:f("menuOverlayAria")}),i.jsx("button",{ref:v,type:"button",className:se.iconButton,"aria-label":f("menuCloseAria"),onClick:()=>{var T;S(),(T=x.current)==null||T.focus()},children:i.jsx(Je,{className:se.icon})})]}),i.jsx("div",{className:se.menuOverlayBody,children:A("overlay")})]})})}):null]})}function is(e,t){var n,r;if(Gn(e))return!1;if(Zn(e)){const o=(n=t.submenus)==null?void 0:n[e.submenu];return o?o.panel?!0:e.items.some(a=>is(a,t)):!1}return!!((r=t.items[e])!=null&&r.command)}function lD(e,t,n){if(!Gn(e[t])||!e.slice(t+1).some(a=>is(a,n)))return!1;let o=!1;for(let a=t-1;a>=0;a--){const s=e[a];if(Gn(s)){o=!0;continue}if(is(s,n))return!o}return!1}function cD({def:e,itemIds:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,open:d,onOpenChange:f,onItemRun:g}){const h=X(),y=l.useRef(null),b=u==="overlay"?`overlay-${e.id}-menu`:`${e.id}-menu`,[C,x]=l.useState(null);l.useEffect(()=>{d||x(null)},[d]),l.useEffect(()=>{if(!d||u==="overlay")return;const k=A=>{y.current&&!y.current.contains(A.target)&&f(!1)},S=A=>{if(A.key==="Escape"){if(A.preventDefault(),A.stopPropagation(),C){x(null);return}f(!1)}};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",S,!0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",S,!0)}},[d,C,f,u]);const v=()=>{f(!1),g==null||g()};return i.jsxs("div",{className:se.menuWrap,ref:y,children:[i.jsx("button",{type:"button",className:se.menuButton,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":b,"aria-label":os(h,e),disabled:a||(s?JR(e.id,s):!1),onClick:()=>f(!d),children:Xn(h,e)}),d?i.jsx("div",{className:se.menu,role:"menu",id:b,onMouseDown:k=>k.preventDefault(),children:i.jsx(eb,{entries:t,catalog:n,commands:r,queries:o,disabled:a,chromeLock:s,variant:u,onClose:v,openSubmenuId:C,onOpenSubmenuIdChange:x})}):null]})}function eb({entries:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:d,onOpenSubmenuIdChange:f}){return i.jsx(i.Fragment,{children:e.map((g,h)=>{if(Gn(g))return lD(e,h,t)?i.jsx("div",{role:"separator",className:se.menuSeparator},`separator-${h}`):null;if(Zn(g))return i.jsx(dD,{entry:g,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d===g.submenu,onOpenChange:b=>f==null?void 0:f(b?g.submenu:null)},`submenu-${g.submenu}-${h}`);const y=t.items[g];return!y||!y.command?null:i.jsx(uD,{item:y,commands:n,queries:r,disabled:o,chromeLock:a,onClose:u},g)})})}function uD({item:e,commands:t,queries:n,disabled:r,chromeLock:o,onClose:a}){const s=X(),u=l.useMemo(()=>Xh(e),[e]);if(Qh(u),!e.command)return null;const d=e.icon,f=e.command,g=e.active?n[e.active]():void 0,h=e.enabled?!n[e.enabled]():!1,y=e.toggle?"menuitemcheckbox":e.active?"menuitemradio":"menuitem";return i.jsxs("button",{type:"button",role:y,className:se.menuItem,"aria-checked":g,disabled:r||(o?qh(e.id,o):!1)||h,onClick:()=>{a(),Qc(t,f)},children:[d?i.jsx(d,{className:se.icon}):null,Xn(s,e)]})}function dD({entry:e,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,open:d,onOpenChange:f}){var R;const g=X(),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState(null),x=(R=t.submenus)==null?void 0:R[e.submenu],v=s==="overlay"?`overlay-${e.submenu}-submenu`:`${e.submenu}-submenu`,k=x==null?void 0:x.panel,S=x!=null&&x.enabled?!r[x.enabled]():!1,A=s==="overlay";if(l.useEffect(()=>{d||C(null)},[d]),!x||!k&&!e.items.some(P=>is(P,t)))return null;const T=P=>{(P.key==="ArrowRight"||P.key==="Enter"||P.key===" ")&&(P.preventDefault(),P.stopPropagation(),f(!0),requestAnimationFrame(()=>{var L;const M=(L=y.current)==null?void 0:L.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]');M==null||M.focus()}))},D=P=>{var M;P.key==="ArrowLeft"&&(P.preventDefault(),P.stopPropagation(),f(!1),(M=h.current)==null||M.focus())};return i.jsxs("div",{className:se.submenuWrap,onMouseEnter:A?void 0:()=>f(!0),onMouseLeave:A?void 0:()=>f(!1),children:[i.jsx("button",{ref:h,type:"button",role:"menuitem",className:`${se.menuItem} ${se.submenuTrigger}`,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":v,"aria-label":os(g,x),disabled:o||S||(a==null?void 0:a.readOnly)&&!(a!=null&&a.enableComments),onClick:()=>f(A?!d:!0),onKeyDown:T,children:Xn(g,x)}),d?i.jsx("div",{ref:y,className:`${se.menu} ${se.submenu}`,role:"menu",id:v,"aria-label":os(g,x),onMouseDown:P=>P.preventDefault(),onKeyDown:D,children:k?i.jsx(k,{commands:n,queries:r,disabled:o||S,onMenuClose:u}):i.jsx(eb,{entries:e.items,catalog:t,commands:n,queries:r,disabled:o,chromeLock:a,variant:s,onClose:u,openSubmenuId:b,onOpenSubmenuIdChange:C})}):null]})}const Yc=l.memo(function({catalog:t,layout:n,commands:r,queries:o,queryRevisions:a,disabled:s,chromeLock:u,menuVisible:d=!0,toolbarVisible:f=!0,compact:g,position:h="top"}){const[y,b]=l.useState(null);if(!d&&!f)return null;const C=i.jsxs("div",{className:se.toolbar,"data-compact":g?"":void 0,"data-toolbar-position":h,children:[d?i.jsx(sD,{menus:n.menus,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u,compact:g,openMenuId:y,onOpenMenuIdChange:b}):null,f?i.jsx(oD,{groups:n.iconGroups,catalog:t,commands:r,queries:o,disabled:s,chromeLock:u}):null]});return a?i.jsx(tD,{value:a,children:C}):C});function mD(e,t){return t?e:{...e,menus:e.menus.map(n=>n.id==="insert"?{...n,items:n.items.filter(r=>!(Zn(r)&&r.submenu==="insertPage"))}:n.id==="edit"?{...n,items:n.items.map(r=>{if(!Zn(r)||r.submenu!=="page")return r;let o=r.items.filter(a=>a!=="deletePage");return o.at(-1)===ve&&(o=o.slice(0,-1)),{...r,items:o}})}:n)}}function ci(e){return Yp(tt(e))}const fD=1.5,ic=384;function pD(e,t=16){return e>0?fD*t:0}function tb(e,t,n=16){const r=pD(t,n);if(!ci(e))return ic+r;const o=tt(e),a=ho(o,!1);return a?On(a.height,ic)+r:ic+r}function Zo(e,t){const n=[0];for(let r=0;r<e;r+=1)n.push(n[r]+t(r));return n}function gD(){const e=new Map;return{get(t,n){return e.get(t)??tb(n,t)},set(t,n){n>0&&e.set(t,n)},clear(){e.clear()},invalidateFrom(t){for(const n of[...e.keys()])n>=t&&e.delete(n)}}}const hD=2;function nb(e,t,n){if(n<=0)return 0;let r=0,o=n-1,a=0;for(;r<=o;){const s=r+o>>1;(t[s+1]??0)>e?(a=s,o=s-1):r=s+1}return a}function rb(e,t,n){if(n<=0)return-1;let r=0,o=n-1,a=n-1;for(;r<=o;){const s=r+o>>1;(t[s]??0)<e?(a=s,r=s+1):o=s-1}return a}function Of(e,t,n,r,o,a,s){if(r<=0)return{startIndex:0,endIndex:-1,topSpacerHeight:0,bottomSpacerHeight:0};const u=n[r]??0;if(u<=t)return{startIndex:0,endIndex:r-1,topSpacerHeight:0,bottomSpacerHeight:0};const d=e+t,f=nb(e,n,r),g=rb(d,n,r);let h=Math.max(0,f-o),y=Math.min(r-1,g+o);s&&(h=Math.min(h,a),y=Math.max(y,a));const b=n[h]??0,C=u-(n[y+1]??u);return{startIndex:h,endIndex:y,topSpacerHeight:b,bottomSpacerHeight:C}}function bD({scrollElementRef:e,pageCount:t,getRowHeight:n,overscan:r=hD,activePageIndex:o,pinActivePage:a=!0}){const s=l.useRef(n);s.current=n;const u=l.useRef(new Map),[d,f]=l.useState(0);l.useLayoutEffect(()=>{u.current.clear()},[t]);const g=l.useCallback(S=>{const A=u.current.get(S),T=s.current(S);return A!==void 0?Math.max(A,T):T},[d]),h=l.useMemo(()=>Zo(t,g),[t,g]),[y,b]=l.useState(()=>{const S=Zo(t,A=>s.current(A));return Of(0,300,S,t,r,o,a)}),C=l.useCallback(()=>{const S=e.current;if(!S||t<=0)return;const A=S.clientHeight>0?S.clientHeight:300,T=Zo(t,g);b(Of(S.scrollTop,A,T,t,r,o,a))},[o,r,t,a,g,e]);l.useLayoutEffect(()=>{C()},[C,h,o,t]),l.useLayoutEffect(()=>{const S=e.current;if(!S)return;const A=()=>C();S.addEventListener("scroll",A,{passive:!0});let T;return typeof ResizeObserver<"u"&&(T=new ResizeObserver(()=>C()),T.observe(S)),C(),()=>{S.removeEventListener("scroll",A),T==null||T.disconnect()}},[e,C]);const x=l.useCallback((S,A)=>{if(A<=0)return;const T=u.current.get(S);T!==void 0&&Math.abs(T-A)<1||(u.current.set(S,A),f(D=>D+1))},[]),v=l.useCallback(S=>{const A=e.current;if(!A||S<0||S>=t)return;const T=Zo(t,g);A.scrollTop=T[S]??0,C()},[t,g,e,C]),k=l.useMemo(()=>{if(y.endIndex<y.startIndex)return[];const S=[];for(let A=y.startIndex;A<=y.endIndex;A+=1)S.push(A);return S},[y.endIndex,y.startIndex]);return{...y,visibleIndices:k,scrollToIndex:v,notifyRowMeasured:x}}function $u(){return{firstLineIndentPx:0,leftIndentPx:0,rightIndentPx:0,mixed:!1}}function as(e){const t=In(e);if(t.length===0)return $u();let n=null,r=null,o=null,a=!1;for(const s of t){const u=s.style.textIndent,d=s.style.marginLeft,f=s.style.marginRight,g=u?On(u,0):0,h=d?On(d,0):0,y=f?On(f,0):0;n===null?(n=g,r=h,o=y):(Math.abs(n-g)>1||Math.abs((r??0)-h)>1||Math.abs((o??0)-y)>1)&&(a=!0)}return{firstLineIndentPx:n??0,leftIndentPx:r??0,rightIndentPx:o??0,mixed:a}}function yD(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 xD(e,t){return nr(e,()=>{let n=Rr(e);if(n.length===0){const a=yD(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=je(Zl(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=je(Zl(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=je(Zl(t.rightIndentPx,r));a.style.marginRight!==s&&(a.style.marginRight=s,o=!0)}xt(a)}return o})}const ob=24,ei=48;function ib(e,t){const n=fi(tt(t));return{pageWidthPx:e.offsetWidth,pageHeightPx:e.offsetHeight,marginsPx:{top:On(n.top,0),right:On(n.right,0),bottom:On(n.bottom,0),left:On(n.left,0)}}}function CD(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 wD(e,t,n,r,o=!0,a=1){const[s,u]=l.useState({}),[d,f]=l.useState($u()),g=l.useCallback(y=>s[y]??null,[s]),h=l.useCallback(()=>{const y=e.current;if(!o||!y)return;const b={};for(const x of n){const v=Ye(y,x);if(!v)continue;const k=t[x]??t[0]??"";b[x]=ib(v,k)}u(x=>{const v={...x,...b};return CD(x,v)?x:v});const C=Ye(y,r());C&&f(as(C))},[e,o,r,n,t]);return l.useLayoutEffect(()=>{if(!o)return;const y=requestAnimationFrame(h);return()=>cancelAnimationFrame(y)},[o,r,n,t,a,h]),l.useLayoutEffect(()=>{if(!o||typeof ResizeObserver>"u")return;const y=e.current;if(!y)return;const b=new ResizeObserver(()=>h());for(const C of n){const x=Ye(y,C);x&&b.observe(x)}return()=>b.disconnect()},[e,o,n,h]),l.useLayoutEffect(()=>{if(!o)return;const y=()=>{const b=e.current;if(!b)return;const C=Ye(b,r());C&&f(as(C))};return document.addEventListener("selectionchange",y),()=>document.removeEventListener("selectionchange",y)},[e,o,r]),{pageGeometries:s,geometryForPage:g,indentState:d,refresh:h}}const vD="_rulerRoot_j57vt_5",kD="_horizontalRulerGroup_j57vt_22",SD="_horizontalRulerTrack_j57vt_28",PD="_horizontalRulerShelf_j57vt_42",AD="_horizontalInner_j57vt_51",TD="_dragEdgeLeft_j57vt_63",RD="_dragEdgeRight_j57vt_73",DD="_dragEdgeActive_j57vt_85",ID="_verticalRuler_j57vt_92",jD="_verticalInner_j57vt_102",ED="_dragEdgeTop_j57vt_114",MD="_dragEdgeBottom_j57vt_124",_D="_dragEdgeActiveV_j57vt_136",ND="_tickH_j57vt_143",LD="_tickV_j57vt_152",BD="_tickLabelH_j57vt_161",FD="_tickLabelV_j57vt_175",HD="_arrowIconWrapper_j57vt_192",zD="_arrowDown_j57vt_203",OD="_arrowGlyph_j57vt_211",KD="_arrowActive_j57vt_220",$D="_arrowUp_j57vt_225",UD="_rulerTooltip_j57vt_249",De={rulerRoot:vD,horizontalRulerGroup:kD,horizontalRulerTrack:SD,horizontalRulerShelf:PD,horizontalInner:AD,dragEdgeLeft:TD,dragEdgeRight:RD,dragEdgeActive:DD,verticalRuler:ID,verticalInner:jD,dragEdgeTop:ED,dragEdgeBottom:MD,dragEdgeActiveV:_D,tickH:ND,tickV:LD,tickLabelH:BD,tickLabelV:FD,arrowIconWrapper:HD,arrowDown:zD,arrowGlyph:OD,arrowActive:KD,arrowUp:$D,rulerTooltip:UD},ac=({type:e,active:t=!1,className:n="",style:r,title:o,"aria-label":a,onPointerDown:s,"data-testid":u})=>{const d=e==="down"?De.arrowDown:De.arrowUp;return i.jsx("div",{className:`${De.arrowIconWrapper} ${d} ${t?De.arrowActive:""} ${n}`,style:r,title:o,"aria-label":a||o,onPointerDown:s,"data-testid":u,children:i.jsx("div",{className:De.arrowGlyph})})};function ab(){const[e,t]=l.useState(null),[n,r]=l.useState(null),o=l.useCallback((a,s,u)=>{s.preventDefault(),s.stopPropagation(),t(a);const d=Number.isFinite(s.clientX)?s.clientX:0,f=Number.isFinite(s.clientY)?s.clientY:0,g=s.altKey,h=b=>{var k;const C=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,v=u.updateDragState(C,x,b.altKey);r(v),(k=u.onPreview)==null||k.call(u,v)},y=b=>{const C=Number.isFinite(b.clientX)?b.clientX:d,x=Number.isFinite(b.clientY)?b.clientY:f,v=u.updateDragState(C,x,b.altKey);window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),t(null),r(null),u.onCommit(v)};r(u.updateDragState(d,f,g)),window.addEventListener("pointermove",h),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)},[]);return{activeTarget:e,dragPreview:n,startPointerDrag:o}}const VD=({geometry:e,indentState:t,unit:n="in",zoomScale:r=1,onMarginChange:o,onMarginPreview:a,onIndentChange:s})=>{const u=X(),{activeTarget:d,dragPreview:f,startPointerDrag:g}=ab(),h=(e==null?void 0:e.pageWidthPx)??816,y=(e==null?void 0:e.marginsPx.left)??96,b=(e==null?void 0:e.marginsPx.right)??96,C=r>0?r:1,x=(f==null?void 0:f.marginLeft)??y,v=(f==null?void 0:f.marginRight)??b,k=(f==null?void 0:f.firstLineIndentPx)??t.firstLineIndentPx,S=(f==null?void 0:f.leftIndentPx)??t.leftIndentPx,A=(f==null?void 0:f.rightIndentPx)??t.rightIndentPx,T=Math.max(0,h-x-v),D=!t.mixed,R=l.useMemo(()=>Vp(h,x,n),[h,x,n]),P=l.useCallback((_,K)=>{const G=Number.isFinite(K.clientX)?K.clientX:0;g(_.type,K,{updateDragState:(Z,oe,Y)=>{const Q=(Z-G)/C;let ie=0;const de={target:_.type,marginLeft:y,marginRight:b,firstLineIndentPx:t.firstLineIndentPx,leftIndentPx:t.leftIndentPx,rightIndentPx:t.rightIndentPx,measurementPx:0,clientX:Z,clientY:oe};if(_.type==="margin-left"){const te=Math.max(0,Math.min(h-b-ei,_.startMarginPx+Q)),E=yr(te,n,Y,0);de.marginLeft=E,ie=E}else if(_.type==="margin-right"){const te=Math.max(0,Math.min(h-y-ei,_.startMarginPx-Q)),E=yr(te,n,Y,0);de.marginRight=E,ie=E}else if(_.type==="first-line-indent"){const te=-_.startLeftIndentPx,E=h-y-b-_.startLeftIndentPx-ei,re=Math.max(te,Math.min(E,_.startFirstLinePx+Q)),pe=yr(re,n,Y,0);de.firstLineIndentPx=pe,ie=pe}else if(_.type==="left-indent"){const te=Math.max(0,_.startLeftIndentPx+Q),E=yr(te,n,Y,0);de.leftIndentPx=E,de.firstLineIndentPx=_.startFirstLinePx,ie=E}else if(_.type==="right-indent"){const te=Math.max(0,_.startRightIndentPx-Q),E=yr(te,n,Y,0);de.rightIndentPx=E,ie=E}return de.measurementPx=ie,de},onPreview:Z=>{_.type==="margin-left"?a==null||a({left:Z.marginLeft}):_.type==="margin-right"&&(a==null||a({right:Z.marginRight}))},onCommit:Z=>{_.type==="margin-left"?o==null||o({left:Z.marginLeft}):_.type==="margin-right"?o==null||o({right:Z.marginRight}):_.type==="first-line-indent"?s==null||s({firstLineIndentPx:Z.firstLineIndentPx}):_.type==="left-indent"?s==null||s({leftIndentPx:Z.leftIndentPx}):_.type==="right-indent"&&(s==null||s({rightIndentPx:Z.rightIndentPx}))}})},[y,b,h,n,C,t,o,a,s,g]),M=x+S,L=M+k,U=h-v-A,j=h*C;return i.jsxs("div",{className:`${De.rulerRoot} ${De.horizontalRulerGroup}`,style:{width:`${j}px`},"data-testid":"horizontal-ruler",children:[i.jsxs("div",{className:De.horizontalRulerTrack,children:[i.jsxs("div",{className:De.horizontalInner,style:{left:`${x*C}px`,width:`${T*C}px`},"data-testid":"ruler-printable-area",children:[i.jsx("div",{className:`${De.dragEdgeLeft} ${d==="margin-left"?De.dragEdgeActive:""}`,title:u("rulerMarginLeft"),"aria-label":u("rulerMarginLeft"),"data-testid":"ruler-margin-splitter-left",onPointerDown:_=>P({type:"margin-left",startMarginPx:y},_)}),i.jsx("div",{className:`${De.dragEdgeRight} ${d==="margin-right"?De.dragEdgeActive:""}`,title:u("rulerMarginRight"),"aria-label":u("rulerMarginRight"),"data-testid":"ruler-margin-splitter-right",onPointerDown:_=>P({type:"margin-right",startMarginPx:b},_)})]}),R.map((_,K)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:De.tickH,style:{left:`${_.positionPx*C}px`,height:`${_.height}px`}}),_.label?i.jsx("span",{className:De.tickLabelH,style:{left:`${_.positionPx*C}px`},children:_.label}):null]},K)),D?i.jsxs(i.Fragment,{children:[i.jsx(ac,{type:"down",style:{left:`${L*C}px`},active:d==="first-line-indent",title:u("rulerFirstLineIndent"),"aria-label":u("rulerFirstLineIndent"),"data-testid":"ruler-first-line-indent",onPointerDown:_=>P({type:"first-line-indent",startFirstLinePx:t.firstLineIndentPx,startLeftIndentPx:t.leftIndentPx},_)}),i.jsx(ac,{type:"up",style:{left:`${M*C}px`},active:d==="left-indent",title:u("rulerLeftIndent"),"aria-label":u("rulerLeftIndent"),"data-testid":"ruler-left-indent",onPointerDown:_=>P({type:"left-indent",startLeftIndentPx:t.leftIndentPx,startFirstLinePx:t.firstLineIndentPx},_)}),i.jsx(ac,{type:"up",style:{left:`${U*C}px`},active:d==="right-indent",title:u("rulerRightIndent"),"aria-label":u("rulerRightIndent"),"data-testid":"ruler-right-indent",onPointerDown:_=>P({type:"right-indent",startRightIndentPx:t.rightIndentPx},_)})]}):null]}),i.jsx("div",{className:De.horizontalRulerShelf,"aria-hidden":!0}),f?i.jsx("div",{className:De.rulerTooltip,style:{left:f.clientX,top:f.clientY},"data-testid":"ruler-drag-tooltip",children:Up(f.measurementPx,n)}):null]})},WD=({geometry:e,unit:t="in",zoomScale:n=1,onMarginChange:r,onMarginPreview:o})=>{const a=X(),{activeTarget:s,dragPreview:u,startPointerDrag:d}=ab(),f=(e==null?void 0:e.pageHeightPx)??1056,g=(e==null?void 0:e.marginsPx.top)??96,h=(e==null?void 0:e.marginsPx.bottom)??96,y=n>0?n:1,b=(u==null?void 0:u.marginTop)??g,C=(u==null?void 0:u.marginBottom)??h,x=Math.max(0,f-b-C),v=l.useMemo(()=>Vp(f,b,t),[f,b,t]),k=l.useCallback((S,A)=>{const T=Number.isFinite(A.clientY)?A.clientY:0;d(S.type,A,{updateDragState:(D,R,P)=>{const M=(R-T)/y,L={target:S.type,marginTop:g,marginBottom:h,measurementPx:0,clientX:D,clientY:R};if(S.type==="margin-top"){const U=Math.max(0,Math.min(f-h-ei,S.startMarginPx+M)),j=yr(U,t,P,0);L.marginTop=j,L.measurementPx=j}else if(S.type==="margin-bottom"){const U=Math.max(0,Math.min(f-g-ei,S.startMarginPx-M)),j=yr(U,t,P,0);L.marginBottom=j,L.measurementPx=j}return L},onPreview:D=>{S.type==="margin-top"?o==null||o({top:D.marginTop}):S.type==="margin-bottom"&&(o==null||o({bottom:D.marginBottom}))},onCommit:D=>{S.type==="margin-top"?r==null||r({top:D.marginTop}):S.type==="margin-bottom"&&(r==null||r({bottom:D.marginBottom}))}})},[g,h,f,t,y,r,o,d]);return i.jsxs("div",{className:`${De.rulerRoot} ${De.verticalRuler}`,style:{height:`${f}px`},"data-testid":"vertical-ruler",children:[i.jsxs("div",{className:De.verticalInner,style:{top:`${b}px`,height:`${x}px`},"data-testid":"ruler-printable-area-vertical",children:[i.jsx("div",{className:`${De.dragEdgeTop} ${s==="margin-top"?De.dragEdgeActiveV:""}`,title:a("rulerMarginTop"),"aria-label":a("rulerMarginTop"),"data-testid":"ruler-margin-splitter-top",onPointerDown:S=>k({type:"margin-top",startMarginPx:g},S)}),i.jsx("div",{className:`${De.dragEdgeBottom} ${s==="margin-bottom"?De.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,A)=>i.jsxs(l.Fragment,{children:[i.jsx("div",{className:De.tickV,style:{top:`${S.positionPx}px`,width:`${S.height}px`}}),S.label?i.jsx("span",{className:De.tickLabelV,style:{top:`${S.positionPx}px`},children:S.label}):null]},A)),u?i.jsx("div",{className:De.rulerTooltip,style:{left:u.clientX,top:u.clientY},"data-testid":"ruler-drag-tooltip",children:Up(u.measurementPx,t)}):null]})},GD="_root_ofshu_1",ZD="_fullscreen_ofshu_36",qD="_exitFullscreen_ofshu_48",YD="_exitFullscreenIcon_ofshu_79",XD="_menuChrome_ofshu_94",JD="_body_ofshu_106",QD="_iconChrome_ofshu_136",eI="_workspace_ofshu_181",tI="_workspacePageSized_ofshu_193",nI="_workspaceWithRuler_ofshu_197",rI="_pageCanvasViewport_ofshu_201",oI="_multiPageRulerLayer_ofshu_211",iI="_multiPageContainer_ofshu_234",aI="_pageZoomContent_ofshu_244",sI="_htmlFileDropOverlay_ofshu_262",lI="_surface_ofshu_276",cI="_visual_ofshu_283",uI="_pageBlock_ofshu_341",dI="_pageBlockFluid_ofshu_348",mI="_pageSurfaceRulerGutter_ofshu_357",fI="_pageSurface_ofshu_357",pI="_htmlModeShell_ofshu_378",gI="_html_ofshu_262",Ce={root:GD,fullscreen:ZD,exitFullscreen:qD,exitFullscreenIcon:YD,menuChrome:XD,body:JD,iconChrome:QD,workspace:eI,workspacePageSized:tI,workspaceWithRuler:nI,pageCanvasViewport:rI,multiPageRulerLayer:oI,multiPageContainer:iI,pageZoomContent:aI,htmlFileDropOverlay:sI,surface:lI,visual:cI,pageBlock:uI,pageBlockFluid:dI,pageSurfaceRulerGutter:mI,pageSurface:fI,htmlModeShell:pI,html:gI};function sb(e){if(e!==1)return{zoom:e,"--page-zoom":String(e)}}function lb({showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}){if(!e)return null;const d=ob;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(VD,{geometry:t,indentState:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u})]})})}function cb({showVerticalRuler:e=!1,pageSized:t=!1,geometry:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:u,pageBlockStyle:d,pageBlockRef:f}){const g=o>0?o:1,h=e?ob/g:0;return i.jsxs("div",{ref:f,className:`${Ce.pageBlock} ${t?"":Ce.pageBlockFluid}`,style:d,children:[i.jsx("div",{className:Ce.pageSurfaceRulerGutter,style:{width:`${h}px`,flex:`0 0 ${h}px`},children:e?i.jsx(WD,{geometry:n,unit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s}):null}),u]})}function hI({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(lb,{showRulers:e,geometry:t,indentState:n,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,onIndentChange:u}),i.jsx("div",{className:Ce.pageZoomContent,style:sb(o),children:i.jsx(cb,{showVerticalRuler:e,pageSized:e,geometry:t,rulerUnit:r,zoomScale:o,onMarginChange:a,onMarginPreview:s,children:d})})]})}const bI=l.memo(function({index:t,pageHtml:n,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,placeholder:d,disabled:f,visualEditorAria:g,onActivate:h,onPointerDown:y,onPageChange:b,onPageFlush:C,suppressPageFlushRef:x,onMeasured:v,onMarginChange:k,onMarginPreview:S,onMouseUp:A,onContextMenu:T,onRulerRefresh:D}){const R=l.useRef(null),P=l.useRef(null),M=l.useRef(""),L=l.useRef(!1),U=l.useRef(C);U.current=C;const j=l.useRef(v);j.current=v,l.useLayoutEffect(()=>{const K=P.current;if(!K||!j.current)return;const G=()=>{var oe;return(oe=j.current)==null?void 0:oe.call(j,t,K.offsetHeight)};if(G(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(G);return Z.observe(K),()=>Z.disconnect()},[t,n,o,r]);const _=l.useCallback(K=>{R.current=K,K&&(M.current=K.innerHTML)},[]);return l.useLayoutEffect(()=>()=>{x!=null&&x.current||!L.current||!U.current||U.current(t,M.current)},[t,x]),i.jsx(cb,{pageBlockRef:P,showVerticalRuler:r,pageSized:o,geometry:a,rulerUnit:s,zoomScale:u,pageBlockStyle:{marginTop:t>0?"1.5rem":"0"},onMarginChange:K=>{k==null||k(t,K)},onMarginPreview:K=>{S==null||S(t,K)},children:i.jsx("div",{ref:_,className:`${Ce.surface} ${Ce.visual} ${o?Ce.pageSurface:""}`,[Pr]:"","data-page-index":t,contentEditable:!f,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":g,"aria-disabled":f||void 0,"data-placeholder":t===0?d:void 0,onFocus:K=>{const G=K.currentTarget;si(G),lo(G),h(t)},onPointerDown:K=>y(t,K),onMouseUp:A,onContextMenu:T,onInput:K=>{const G=K.currentTarget;L.current=!0,M.current=G.innerHTML;const{absorbedBlocks:Z}=si(G);if(M.current=G.innerHTML,b(t,G.innerHTML),Z.length>0){const oe=Z.length;requestAnimationFrame(()=>rg(G,oe))}D()}})})},yI);function yI(e,t){return e.index===t.index&&e.pageHtml===t.pageHtml&&e.showVerticalRuler===t.showVerticalRuler&&e.pageSized===t.pageSized&&e.geometry===t.geometry&&e.rulerUnit===t.rulerUnit&&e.zoomScale===t.zoomScale&&e.placeholder===t.placeholder&&e.disabled===t.disabled&&e.visualEditorAria===t.visualEditorAria}const xI=l.forwardRef(function({pages:t,activePageIndex:n,hasSelectedPage:r=!1,scrollRootRef:o,onActivePageIndexChange:a,onPageSelected:s,onPageChange:u,onPageFlush:d,suppressPageFlushRef:f,pendingInsertPageFocusRef:g,placeholder:h,disabled:y,rulerVisible:b=!0,rulerUnit:C="in",zoomScale:x=1,onMarginChange:v,onMarginPreview:k,onIndentChange:S,onBeforeInput:A,resolveEmbeddedImageDataUrl:T,hydrateEmbeddedImages:D,onPointerDown:R,onMouseUp:P,onContextMenu:M},L){const U=X(),j=l.useRef(null),_=l.useRef(n);_.current=n;const K=l.useRef(A);K.current=A;const G=l.useRef(u);G.current=u;const Z=l.useRef(d);Z.current=d;const oe=l.useRef(s);oe.current=s;const Y=l.useRef(R);Y.current=R;const Q=l.useRef(v);Q.current=v;const ie=l.useRef(k);ie.current=k;const de=l.useRef(null),te=l.useRef([]),E=l.useRef(gD()),re=f,pe=l.useCallback(()=>_.current,[]),F=l.useCallback(z=>E.current.get(z,t[z]??""),[t]),{visibleIndices:Ee,topSpacerHeight:He,bottomSpacerHeight:ze,scrollToIndex:We,notifyRowMeasured:ot}=bD({scrollElementRef:o??j,pageCount:t.length,getRowHeight:F,activePageIndex:n,pinActivePage:r}),{geometryForPage:it,indentState:Jt,refresh:at}=wD(j,t,Ee,pe,!0,x),q=r?n:0,ae=t[q]??"",ge=l.useCallback(z=>ci(t[z]??""),[t]),Le=b&&ci(ae),Kt=l.useCallback(z=>{We(z),requestAnimationFrame(()=>{const J=j.current;if(!J)return;const le=Ye(J,z);le&&lo(le)})},[We]),$t=l.useCallback(z=>{if(z<0||z>=t.length)return;const J=(o==null?void 0:o.current)??j.current;if(!J)return;const le=Zo(t.length,F),Me=J.scrollTop,St=Me+J.clientHeight,Cn=nb(Me,le,t.length),Qe=rb(St,le,t.length);z>=Cn&&z<=Qe||We(z)},[F,t.length,o,We]),Ut=l.useCallback(z=>{$t(z),requestAnimationFrame(()=>{const J=j.current;if(!J)return;const le=Ye(J,z);le&&lw(le)})},[$t]),Pe=l.useRef($t);Pe.current=$t,l.useLayoutEffect(()=>{Pe.current(n)},[n,t.length]),l.useLayoutEffect(()=>{const z=g;if(!z)return;const J=z.current;J!=null&&(z.current=null,Ut(J))},[n,t.length,g,Ut]);const yn=l.useCallback(z=>{var Me;if(_.current=z,z!==n&&a(z),(Me=oe.current)==null||Me.call(oe,z),!Ee.includes(z)){Kt(z);return}at();const J=j.current;if(!J)return;const le=Ye(J,z);le&&requestAnimationFrame(()=>lo(le))},[n,a,at,Kt,Ee]);l.useImperativeHandle(L,()=>({getContainer:()=>j.current,getActivePageRoot:()=>{const z=j.current;return z?Ye(z,_.current):null},getActivePageIndex:()=>_.current,flushPageHtml:z=>{var le;const J=j.current;return J?((le=Ye(J,z))==null?void 0:le.innerHTML)??null:null},ensurePageMounted:z=>{Kt(z)},focusPageAt:Ut,activatePageAt:yn}));const xn=l.useCallback((z,J,le,Me)=>{const St=dn(he(le).body),Cn=J===document.activeElement;(Me!=null&&Me.forceBodySync||!Cn)&&ns(J,St,{resolveDataUrl:T,hydrateEmbeddedImages:D}),vu(J),si(J);const Qe=xs(J);ys(J),bo(J,le);const Oe=ct(J);if(Oe&&Qp(J,Oe),Qe){const Ae=dn(he(le).body);J.innerHTML!==Ae&&G.current(z,J.innerHTML)}},[D,T]);l.useLayoutEffect(()=>{E.current.clear()},[t.length]),l.useLayoutEffect(()=>{const z=j.current;if(!z)return;const J=de.current,le=J===null||J.length!==t.length;le&&Pe.current(n);const Me=new Set(te.current),St=new Set(Ee);le&&St.add(n);for(const Qe of St){const Oe=!Me.has(Qe),Ae=t[Qe]!==(J==null?void 0:J[Qe]);if(!le&&!Oe&&!Ae)continue;const $e=Ye(z,Qe);$e&&xn(Qe,$e,t[Qe]??"",{forceBodySync:le})}de.current=t,te.current=Ee,le&&(re!=null&&re.current)&&(re.current=!1);const Cn=requestAnimationFrame(at);return()=>cancelAnimationFrame(Cn)},[n,t,re,xn,at,Ee]),l.useLayoutEffect(()=>{const z=j.current;if(!z)return;const J=le=>{var Me;(Me=K.current)==null||Me.call(K,le)};return z.addEventListener("beforeinput",J),()=>z.removeEventListener("beforeinput",J)},[]);const Ir=l.useCallback((z,J)=>{var le;yn(z),(le=Y.current)==null||le.call(Y,J)},[yn]),jr=l.useCallback((z,J)=>{G.current(z,J)},[]),Er=l.useCallback((z,J)=>{var le;(le=Z.current)==null||le.call(Z,z,J)},[]),ye=l.useCallback((z,J)=>{const le=tb(t[z]??"",z),Me=Math.max(J,le);E.current.set(z,Me),ot(z,Me)},[ot,t]),Qt=l.useCallback((z,J)=>{var le;(le=Q.current)==null||le.call(Q,z,J)},[]),Mr=l.useCallback((z,J)=>{var le;(le=ie.current)==null||le.call(ie,z,J)},[]),rr=U("visualEditorAria"),or=l.useMemo(()=>Ee.map(z=>i.jsx(bI,{index:z,pageHtml:t[z]??"",showVerticalRuler:Le&&ge(z),pageSized:ge(z),geometry:it(z),rulerUnit:C,zoomScale:x,placeholder:h,disabled:y,visualEditorAria:rr,onActivate:yn,onPointerDown:Ir,onPageChange:jr,onPageFlush:Er,suppressPageFlushRef:re,onMeasured:ye,onMarginChange:Qt,onMarginPreview:Mr,onMouseUp:P,onContextMenu:M,onRulerRefresh:at},z)),[yn,y,it,Qt,Mr,jr,Er,Ir,ye,M,P,ge,t,h,at,C,Le,Ee,rr,x]);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:Le?"center":"stretch",width:"100%",height:"100%",minHeight:"100%",position:"relative"},children:[i.jsx(lb,{showRulers:Le,geometry:it(q),indentState:Jt,rulerUnit:C,zoomScale:x,onMarginChange:z=>{v==null||v(q,z)},onMarginPreview:z=>{k==null||k(q,z)},onIndentChange:z=>{S==null||S(z)}}),i.jsx("div",{className:Ce.pageZoomContent,style:sb(x),children:i.jsxs("div",{ref:j,className:Ce.multiPageContainer,style:{display:"flex",flexDirection:"column",alignItems:Le?"center":"stretch",width:"100%",minHeight:Le?void 0:"100%",position:"relative"},children:[He>0?i.jsx("div",{"aria-hidden":!0,style:{height:He,flexShrink:0}}):null,or,ze>0?i.jsx("div",{"aria-hidden":!0,style:{height:ze,flexShrink:0}}):null]})})]})});function CI(e,t,n){return r=>{const o=e();o&&n(o,t(),r)}}function wI(e,t,n,r){return o=>{const a=e();if(!a)return;const s=n(a,t(),o);r(s.pageHtml)}}function vI(e,t,n){return(r,o)=>{const a=e(r);a&&n(a,t(r),o)}}function kI(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 Kf(e,t,n){return r=>{const o=e();o&&xD(o,{...r,unit:t})&&n(o)}}const SI="_field_1knrr_1",PI="_label_1knrr_8",AI="_button_1knrr_12",TI="_swatch_1knrr_37",RI="_swatchEmpty_1knrr_44",Ko={field:SI,label:PI,button:AI,swatch:TI,swatchEmpty:RI};function Ot({label:e,noneLabel:t,value:n,mixed:r=!1,disabled:o,fallbackCustom:a,onChange:s}){const u=l.useId(),d=l.useRef(null),f=l.useRef(null),g=l.useRef(null),[h,y]=l.useState(!1),b=yo(h,f,g);l.useEffect(()=>{if(!h)return;const v=S=>{var T,D;const A=S.target;(T=d.current)!=null&&T.contains(A)||(D=g.current)!=null&&D.contains(A)||y(!1)},k=S=>{var A;S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),y(!1),(A=f.current)==null||A.focus())};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",k,!0)}},[h]);const C=`${Ko.swatch}${!n||r?` ${Ko.swatchEmpty}`:""}`,x=n&&!r?{backgroundColor:n}:void 0;return i.jsxs("div",{className:Ko.field,ref:d,children:[i.jsx("span",{className:Ko.label,children:e}),i.jsx("button",{ref:f,type:"button",className:Ko.button,"aria-label":e,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?u:void 0,disabled:o,onClick:()=>y(v=>!v),children:i.jsx("span",{className:C,style:x})}),h?i.jsx(ke,{children:i.jsx("div",{ref:g,id:u,className:br.popover,style:{top:b.top,left:b.left,zIndex:1400},children:i.jsx(Ku,{value:n,mixed:r,noneLabel:t,ariaLabel:e,disabled:o,fallbackCustom:a,onChange:s,onCommit:()=>y(!1)})})}):null]})}const sc=[{id:"general",labelKey:"fontDialogTabGeneral",implemented:!0}],DI={bold:{label:"commandBold"},italic:{label:"commandItalic"},underline:{label:"commandUnderline"},strikethrough:{label:"commandStrikethrough"}};function Uu({tab:e,value:t,fonts:n,disabled:r,onTabChange:o,onChange:a}){const s=X(),u=l.useId(),d=l.useId(),f=n??dp(),g=sc.find(h=>h.id===e)??sc[0];return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("fontDialogTitle"),children:sc.map(h=>i.jsx("button",{type:"button",className:p.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:p.body,role:"tabpanel",children:g.implemented?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("fontDialogFamily")}),i.jsx(Vh,{family:t.fontFamilyMixed?null:t.fontFamily,mixed:t.fontFamilyMixed,fonts:f,disabled:r,triggerId:d,onChange:h=>{a({...t,fontFamily:h,fontFamilyMixed:!1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("fontDialogSize")}),i.jsx("div",{className:p.sizeRow,children:i.jsx(Wh,{size:t.size,unit:t.unit,sizeInputId:u,disabled:r,onSizeChange:(h,y)=>{a({...t,size:h,unit:y})},onUnitChange:h=>{const y=t.size!==null?bp(t.size,t.unit,h,16,16):t.size;a({...t,size:y,unit:h})}})})]}),i.jsx("div",{className:p.field,children:i.jsx(Ot,{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:p.field,children:i.jsx(Ot,{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:p.marks,children:[i.jsx("legend",{className:p.label,children:s("fontDialogStyle")}),zt.map(h=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.marks[h],disabled:r,onChange:()=>{a({...t,marks:{...t.marks,[h]:!t.marks[h]}})}}),s(DI[h].label)]},h))]})]}):null})]})}function II({open:e,tab:t,size:n,unit:r,marks:o,fontFamily:a=null,fontFamilyMixed:s=!1,fontColor:u,fontColorMixed:d=!1,highlightColor:f,highlightColorMixed:g=!1,fonts:h,disabled:y,onTabChange:b,onApply:C,onClose:x}){const v=X(),k=l.useId(),S=l.useRef(null),[A,T]=l.useState({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:g});return l.useEffect(()=>{e&&T({size:n,unit:r,marks:o,fontFamily:a,fontFamilyMixed:s,fontColor:u,highlightColor:f,fontColorMixed:d,highlightColorMixed:g})},[e,n,r,o,a,s,u,d,f,g]),Ve(S,{open:e,onClose:x}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:x,children:i.jsxs("div",{ref:S,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":k,onMouseDown:D=>D.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:k,children:v("fontDialogTitle")}),i.jsx(Uu,{tab:t,value:A,fonts:h,disabled:y,onTabChange:b,onChange:T}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:x,children:v("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:y,onClick:()=>C(A),children:v("fontDialogOk")})]})]})})}):null}const jI={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"};function Xe({label:e,value:t,disabled:n,allowNegative:r=!1,unitAria:o,inputId:a,onChange:s}){const u=X(),d=l.useId(),f=a??d,g=(t==null?void 0:t.unit)??su,[h,y]=l.useState(()=>t?fe(t.value):""),[b,C]=l.useState(!1);l.useEffect(()=>{b||y(t?fe(t.value):"")},[t,b]);const x=v=>{const k=v.trim();if(!k){s(null),y("");return}const S=ni(k,g,r);if(!S){y(t?fe(t.value):"");return}s(S),y(fe(S.value))};return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:f,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:f,className:p.lengthInput,value:h,disabled:n,inputMode:"decimal",onFocus:()=>C(!0),onBlur:()=>{C(!1),x(h)},onChange:v=>y(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),x(h),v.currentTarget.blur())}}),i.jsx("select",{className:p.lengthUnit,value:g,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=ni(h,k,r);s(S)}},children:ou.map(v=>i.jsx("option",{value:v,children:u(jI[v])},v))})]})]})}function Vu({shadow:e,disabled:t,onChange:n}){const r=X();return i.jsxs("div",{className:p.shadowGrid,children:[i.jsx(Xe,{label:r("paragraphDialogShadowOffsetX"),value:e.offsetX,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetX:o??{value:0,unit:"px"}})}}),i.jsx(Xe,{label:r("paragraphDialogShadowOffsetY"),value:e.offsetY,disabled:t,allowNegative:!0,onChange:o=>{n({...e,offsetY:o??{value:0,unit:"px"}})}}),i.jsx(Xe,{label:r("paragraphDialogShadowBlur"),value:e.blur,disabled:t,onChange:o=>{n({...e,blur:o??{value:0,unit:"px"}})}}),i.jsx(Xe,{label:r("paragraphDialogShadowSpread"),value:e.spread,disabled:t,allowNegative:!0,onChange:o=>{n({...e,spread:o??{value:0,unit:"px"}})}}),i.jsx(Ot,{label:r("paragraphDialogShadowColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:o=>{n({...e,color:o})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.inset,disabled:t,onChange:()=>{n({...e,inset:!e.inset})}}),r("paragraphDialogShadowInset")]})]})}const ub=[{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}],db=[{id:"spacing",labelKey:"paragraphDialogSpacing",implemented:!0},{id:"border",labelKey:"paragraphDialogTabBorder",implemented:!0},{id:"background",labelKey:"paragraphDialogTabBackground",implemented:!0},{id:"backgroundImage",labelKey:"pageDialogTabBackgroundImage",implemented:!0}],EI={fill:"imagePropertiesFitFill",contain:"imagePropertiesFitContain",cover:"imagePropertiesFitCover",none:"imagePropertiesFitNoneValue","scale-down":"imagePropertiesFitScaleDown"},MI={center:"imagePropertiesPositionCenter",top:"imagePropertiesPositionTop",bottom:"imagePropertiesPositionBottom",left:"imagePropertiesPositionLeft",right:"imagePropertiesPositionRight","top left":"imagePropertiesPositionTopLeft","top right":"imagePropertiesPositionTopRight","bottom left":"imagePropertiesPositionBottomLeft","bottom right":"imagePropertiesPositionBottomRight"};function mb({legendKey:e="imagePropertiesTabAdvanced",value:t,disabled:n,onChange:r}){const o=X(),a=l.useId(),s=l.useId();return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:o(e)}),i.jsx(_I,{value:t.opacity,disabled:n,onChange:u=>{r({...t,opacity:u})}}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("imagePropertiesFit")}),i.jsxs("select",{id:a,className:p.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")}),Su.map(u=>i.jsx("option",{value:u,children:o(EI[u])},u))]})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("imagePropertiesPosition")}),i.jsxs("select",{id:s,className:p.select,value:t.position??"",disabled:n,onChange:u=>{r({...t,position:u.target.value||null})},children:[i.jsx("option",{value:"",children:o("imagePropertiesPositionDefault")}),Pu.map(u=>i.jsx("option",{value:u,children:o(MI[u])},u))]})]})]})}function _I({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=e===null?null:za(e),[s,u]=l.useState(()=>a===null?"":fe(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":fe(a))},[a,d]);const g=h=>{const y=h.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":fe(a));return}const C=Mp(b);n(C),u(fe(za(C)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:h=>u(h.target.value),onBlur:()=>{f(!1),g(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}const NI={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent",pc:"fontSizeUnitPc"};function ss({label:e,inputAria:t,value:n,disabled:r,onChange:o}){const a=X(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),g=l.useRef(null),h=(n==null?void 0:n.unit)??Fw,[y,b]=l.useState(()=>n?fe(n.value):""),[C,x]=l.useState(!1),[v,k]=l.useState(!1),S=yo(v,f,g,{matchAnchorWidth:!0,minWidth:72});l.useEffect(()=>{C||b(n?fe(n.value):"")},[n,C]),l.useEffect(()=>{if(!v)return;const P=L=>{var j,_;const U=L.target;(j=d.current)!=null&&j.contains(U)||(_=g.current)!=null&&_.contains(U)||k(!1)},M=L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),k(!1))};return document.addEventListener("pointerdown",P),document.addEventListener("keydown",M,!0),()=>{document.removeEventListener("pointerdown",P),document.removeEventListener("keydown",M,!0)}},[v]);const A=P=>{const M=P.trim();if(!M){o(null),b("");return}const L=Ym(M,h);if(!L){b(n?fe(n.value):"");return}o(L),b(fe(L.value))},T=Hw[h],D=(n==null?void 0:n.value)??null,R=v?i.jsx(ke,{children:i.jsx("ul",{ref:g,className:Ue.list,role:"listbox",id:s,style:{top:S.top,left:S.left,minWidth:S.width},children:T.map(P=>i.jsx("li",{role:"presentation",children:i.jsx("button",{type:"button",className:Ue.option,role:"option","aria-selected":D===P,onMouseDown:M=>M.preventDefault(),onClick:()=>{o({value:P,unit:h}),b(fe(P)),k(!1)},children:fe(P)})},P))})}):null;return i.jsxs("div",{className:p.lengthField,children:[i.jsx("label",{className:p.sideLabel,htmlFor:u,children:e}),i.jsxs("div",{className:`${Ue.wrap} ${p.lengthRow}`,ref:d,children:[i.jsxs("div",{className:Ue.field,ref:f,children:[i.jsx("input",{id:u,className:Ue.input,value:y,disabled:r,"aria-label":t,"aria-autocomplete":"list","aria-expanded":v,"aria-controls":s,role:"combobox",inputMode:"decimal",onFocus:()=>x(!0),onBlur:()=>{x(!1),A(y)},onChange:P=>b(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),A(y),k(!1),P.currentTarget.blur()),P.key==="ArrowDown"&&(P.preventDefault(),k(!0))}}),i.jsx("button",{type:"button",className:Ue.toggle,tabIndex:-1,disabled:r,"aria-label":t,"aria-expanded":v,"aria-controls":s,onMouseDown:P=>P.preventDefault(),onClick:()=>k(P=>!P)})]}),i.jsxs("div",{className:Ue.field,children:[i.jsx("select",{className:Ue.unit,value:h,disabled:r,"aria-label":a("imagePropertiesSizeUnitAria"),onChange:P=>{const M=P.target.value;if(n){o({value:n.value,unit:M});return}y.trim()&&o(Ym(y,M))},children:cg.map(P=>i.jsx("option",{value:P,children:a(NI[P])},P))}),i.jsx("span",{className:Ue.chevron,"aria-hidden":"true"})]}),R]})]})}const LI={empty:"imageDialogErrorEmpty",invalid:"imageDialogErrorInvalid"},BI={type:"imageDialogErrorType",tooLarge:"imageDialogErrorTooLarge"};function FI(e,t,n){return t&&n?"custom":e.startsWith("data:")?"file":e.trim()?"url":"file"}function fb({src:e,disabled:t,customImagePicker:n,disableBuiltinSources:r=!1,onSrcChange:o,onCustomPick:a,onSourceChange:s}){const u=X(),d=l.useId(),f=l.useId(),g=l.useRef(null),h=r&&!!n,[y,b]=l.useState(()=>FI(e,r,n)),[C,x]=l.useState(()=>e.startsWith("data:")?"":e),[v,k]=l.useState(""),[S,A]=l.useState(null),[T,D]=l.useState(!1);l.useEffect(()=>{s==null||s(y)},[s,y]),l.useEffect(()=>{h&&b("custom")},[h]);const R=y==="file"&&e.startsWith("data:")?e:y==="url"?C:"",P=y==="custom"?null:pn(R),M=y==="custom"?null:y==="file"&&S?BI[S]:P&&(y==="file"||C.trim().length>0)?LI[P]:null,L=()=>{t||!n||a==null||a()},U=j=>{var K;const _=(K=j.target.files)==null?void 0:K[0];_&&(D(!0),A(null),Dw(_).then(G=>{k(_.name),b("file"),o(G),D(!1)},G=>{const Z=G instanceof Error?G.message:"";k(""),b("file"),A(Z==="tooLarge"||Z==="type"?Z:"type"),D(!1),g.current&&(g.current.value="")}))};return i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:u("imageDialogSource")}),h?null:i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":u("imageDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="file",disabled:t,onClick:()=>b("file"),children:u("imageDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:u("imageDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:g,type:"file",accept:kw,hidden:!0,disabled:t,"aria-label":u("imageDialogChooseFile"),onChange:U}),i.jsx("button",{type:"button",className:p.action,disabled:t||T,onClick:()=>{var j;return(j=g.current)==null?void 0:j.click()},children:u("imageDialogChooseFile")}),v?i.jsx("span",{className:p.fileName,children:v}):null,e.startsWith("data:")&&!v?i.jsx("span",{className:p.fileName,children:u("pageBackgroundImageCurrent")}):null]}):null,y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:u("imageDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:C,disabled:t,"aria-invalid":M!==null,"aria-describedby":M?f:void 0,onChange:j=>{const _=j.target.value;x(_),o(_.trim())}})]}):null,(h||y==="custom")&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:L,children:n.buttonCaption})]}):null,M?i.jsx("p",{id:f,className:p.error,children:u(M)}):null]})}function HI(e){return pn(e.trim())===null}function zI(e){return gg(e)?{width:null,height:null}:e==="fill"?{width:{...ro},height:{...ro}}:{width:{...ro},height:null}}function OI({value:e,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomImagePick:o,onChange:a}){const s=X(),u=e.src??"",d=(f,g)=>{a({...e,fit:null,[f]:g})};return i.jsxs(i.Fragment,{children:[u?i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:s("pageBackgroundImagePreview")}),i.jsx("img",{className:p.previewImage,src:u,alt:s("pageBackgroundImagePreviewAlt")}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:()=>{a({...e,src:null})},children:s("pageBackgroundImageClear")})]}):null,i.jsx(fb,{src:u,disabled:t,customImagePicker:n,disableBuiltinSources:r,onCustomPick:o,onSrcChange:f=>{a({...e,src:f.trim()||null})}}),u?i.jsxs(i.Fragment,{children:[i.jsx(ss,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:e.width,disabled:t,onChange:f=>d("width",f)}),i.jsx(ss,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:e.height,disabled:t,onChange:f=>d("height",f)}),i.jsx(mb,{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}:zI(f.fit);a({...e,opacity:f.opacity,fit:f.fit,position:f.position,...g})}})]}):null]})}const KI={left:cs,center:ls,right:us,justify:Yf},$I={left:{aria:"commandAlignLeftAria"},center:{aria:"commandAlignCenterAria"},right:{aria:"commandAlignRightAria"},justify:{aria:"commandAlignJustifyAria"}},UI={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},VI={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},WI={pt:"fontSizeUnitPt",px:"fontSizeUnitPx",em:"fontSizeUnitEm",rem:"fontSizeUnitRem","%":"fontSizeUnitPercent"},GI={value:1,unit:"pt"},ZI={offsetX:{value:0,unit:"px"},offsetY:{value:4,unit:"px"},blur:{value:8,unit:"px"},spread:{value:0,unit:"px"},color:"#000000",inset:!1},qI={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid"},$f={auto:"paragraphDialogBreakAuto",avoid:"paragraphDialogBreakAvoid",page:"paragraphDialogBreakPage"};function $o(e){return{top:e,right:e,bottom:e,left:e}}function Uf(e){for(const t of rt)if(e[t])return e[t];return null}function YI(){const e=[...ub];for(const t of db)e.some(n=>n.id===t.id)||e.push(t);return e}function Wu({tab:e,value:t,disabled:n,tabs:r,tablistLabelKey:o="paragraphDialogTitle",backgroundImage:a,customImagePicker:s,disableBuiltinBackgroundImageSources:u,onCustomImagePick:d,onBackgroundImageChange:f,onTabChange:g,onChange:h}){const y=X(),b=r?YI().filter(P=>r.includes(P.id)):ub,C=l.useId(),x=l.useId(),v=l.useId(),k=l.useId(),[S,A]=l.useState(()=>Rn(t.margin,$o(t.margin.top))),[T,D]=l.useState(()=>Rn(t.padding,$o(t.padding.top))),R=(P,M,L,U)=>{const j=t[P],_=M?$o(U):{...j,[L]:U};h({...t,[P]:_,[`${P}Mixed`]:!1})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":y(o),children:b.map(P=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":P.id===e,disabled:!P.implemented,onClick:()=>g(P.id),children:y(P.labelKey)},P.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":y("paragraphDialogAlignment"),children:ih.map(P=>{const M=KI[P],L=!t.alignMixed&&t.align===P;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":L,"aria-label":y($I[P].aria),disabled:n,onClick:()=>{h({...t,align:P,alignMixed:!1})},children:i.jsx(M,{})},P)})})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogLists")}),i.jsxs("div",{className:p.iconRow,children:[i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ul","aria-label":y("commandBulletListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ul"?null:"ul";h({...t,list:P,listMixed:!1})},children:i.jsx(Xf,{})}),i.jsx("button",{type:"button",className:p.iconButton,"aria-pressed":!t.listMixed&&t.list==="ol","aria-label":y("commandNumberedListAria"),disabled:n,onClick:()=>{const P=!t.listMixed&&t.list==="ol"?null:"ol";h({...t,list:P,listMixed:!1})},children:i.jsx(tp,{})})]})]})]}):null,e==="spacing"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogSpacing")}),i.jsx(Vf,{legend:y("paragraphDialogMargin"),sides:t.margin,linked:S,disabled:n,allowNegative:!0,onLinkedChange:P=>{A(P),P&&h({...t,margin:$o(Uf(t.margin)),marginMixed:!1})},onSideChange:(P,M)=>R("margin",S,P,M)}),i.jsx(Vf,{legend:y("paragraphDialogPadding"),sides:t.padding,linked:T,disabled:n,onLinkedChange:P=>{D(P),P&&h({...t,padding:$o(Uf(t.padding)),paddingMixed:!1})},onSideChange:(P,M)=>R("padding",T,P,M)}),i.jsx(JI,{value:t.lineHeight,disabled:n,onChange:P=>{h({...t,lineHeight:P,lineHeightMixed:!1})}}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:y("paragraphDialogPageBreaks")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:x,children:y("paragraphDialogBreakInside")}),i.jsx("select",{id:x,className:p.select,value:t.breakInsideMixed?"auto":t.breakInside,disabled:n,onChange:P=>{h({...t,breakInside:P.target.value,breakInsideMixed:!1})},children:Pp.map(P=>i.jsx("option",{value:P,children:y(qI[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:y("paragraphDialogBreakAfter")}),i.jsx("select",{id:v,className:p.select,value:t.breakAfterMixed?"auto":t.breakAfter,disabled:n,onChange:P=>{h({...t,breakAfter:P.target.value,breakAfterMixed:!1})},children:xc.map(P=>i.jsx("option",{value:P,children:y($f[P])},P))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:y("paragraphDialogBreakBefore")}),i.jsx("select",{id:k,className:p.select,value:t.breakBeforeMixed?"auto":t.breakBefore,disabled:n,onChange:P=>{h({...t,breakBefore:P.target.value,breakBeforeMixed:!1})},children:xc.map(P=>i.jsx("option",{value:P,children:y($f[P])},P))})]})]})]}):null,e==="border"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:C,children:y("paragraphDialogBorderStyle")}),i.jsx("select",{id:C,className:p.select,value:t.border.style,disabled:n,onChange:P=>{const M=P.target.value;h({...t,border:{style:M,width:M==="none"?null:t.border.width??GI,color:M==="none"?null:t.border.color},borderMixed:!1})},children:ps.map(P=>i.jsx("option",{value:P,children:y(VI[P])},P))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:y("paragraphDialogBorderWidth"),value:t.border.width,disabled:n,onChange:P=>{h({...t,border:{...t.border,width:P},borderMixed:!1})}}),i.jsx(Ot,{label:y("paragraphDialogBorderColor"),noneLabel:y("colorNone"),value:t.border.color,mixed:t.borderMixed,disabled:n,onChange:P=>{h({...t,border:{...t.border,color:P},borderMixed:!1})}})]}):null,i.jsx(Xe,{label:y("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:n,onChange:P=>{h({...t,borderRadius:P,radiusMixed:!1})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:n,onChange:()=>{h({...t,boxShadow:t.boxShadow?null:ZI,shadowMixed:!1})}}),y("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Vu,{shadow:t.boxShadow,disabled:n,onChange:P=>{h({...t,boxShadow:P,shadowMixed:!1})}}):null]}):null,e==="background"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:y("paragraphDialogTabBackground")}),i.jsx(Ot,{label:y("paragraphDialogBackgroundColor"),noneLabel:y("colorNone"),value:t.backgroundColor,mixed:t.backgroundMixed,disabled:n,onChange:P=>{h({...t,backgroundColor:P,backgroundMixed:!1})}}),i.jsx(XI,{value:t.opacity,disabled:n,onChange:P=>{h({...t,opacity:P,opacityMixed:!1})}})]}):null,e==="backgroundImage"&&a&&f?i.jsx(OI,{value:a,disabled:n,customImagePicker:s,disableBuiltinSources:u,onCustomImagePick:d,onChange:f}):null]})]})}function XI({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=e===null?null:za(e),[s,u]=l.useState(()=>a===null?"":fe(a)),[d,f]=l.useState(!1);l.useEffect(()=>{d||u(a===null?"":fe(a))},[a,d]);const g=h=>{const y=h.trim();if(!y){n(null),u("");return}const b=Number(y.replace(",","."));if(!Number.isFinite(b)){u(a===null?"":fe(a));return}const C=Mp(b);n(C),u(fe(za(C)))};return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogOpacity")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:s,disabled:t,inputMode:"decimal",onFocus:()=>f(!0),onChange:h=>u(h.target.value),onBlur:()=>{f(!1),g(s)}}),i.jsx("span",{className:p.lengthUnit,"aria-hidden":"true",children:r("fontSizeUnitPercent")})]})]})}function Vf({legend:e,sides:t,linked:n,disabled:r,allowNegative:o=!1,onLinkedChange:a,onSideChange:s}){const u=X(),d=n?["top"]:rt;return i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:e}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:()=>a(!n)}),u("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:d.map(f=>i.jsx(Xe,{label:n?e:u(UI[f]),value:t[f],disabled:r,allowNegative:o,onChange:g=>s(f,g)},f))})]})}function JI({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=QI(e),s=(e==null?void 0:e.kind)==="number"||(e==null?void 0:e.kind)==="length"?e.value:null,[u,d]=l.useState(()=>s===null?"":fe(s)),f=(e==null?void 0:e.kind)==="length"?e.unit:su;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("paragraphDialogLineHeight")}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:o,className:p.lengthInput,value:a==="normal"?"":u,disabled:t||a==="normal",inputMode:"decimal",onChange:g=>d(g.target.value),onBlur:()=>{const g=u.trim();if(!g){n(null);return}if(a==="number"||a==="empty"){const y=Number(g.replace(",","."));if(!Number.isFinite(y)||y<0){d(s===null?"":fe(s));return}n({kind:"number",value:y}),d(fe(y));return}const h=ni(g,f,!1);if(!h){d(s===null?"":fe(s));return}n({kind:"length",value:h.value,unit:h.unit}),d(fe(h.value))}}),i.jsxs("select",{className:p.lengthUnit,value:a==="length"?f:a,disabled:t,"aria-label":r("paragraphDialogLengthUnitAria"),onChange:g=>{const h=g.target.value;if(h==="empty"){n(null),d("");return}if(h==="normal"){n({kind:"normal"}),d("");return}if(h==="number"){const x=Number((u||"1.5").replace(",",".")),v=Number.isFinite(x)&&x>=0?x:1.5;n({kind:"number",value:v}),d(fe(v));return}const y=h,b=ni(u||"1",y,!1),C=(b==null?void 0:b.value)??1;n({kind:"length",value:C,unit:y}),d(fe(C))},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(g=>i.jsx("option",{value:g,children:r(WI[g])},g))]})]})]})}function QI(e){return e?e.kind==="normal"?"normal":e.kind==="number"?"number":"length":"empty"}function ej({open:e,tab:t,value:n,backgroundImage:r,disabled:o,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onTabChange:d,onApply:f,onClose:g}){const h=X(),y=l.useId(),b=l.useRef(null),[C,x]=l.useState(n),[v,k]=l.useState(r);return l.useEffect(()=>{e&&(x(n),k(r??mn()))},[e,n,r]),Ve(b,{open:e,onClose:g,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:g,children:i.jsxs("div",{ref:b,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":y,onMouseDown:S=>S.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:y,children:h("paragraphDialogTitle")}),i.jsx(Wu,{tab:t,value:C,disabled:o,backgroundImage:v,customImagePicker:a,disableBuiltinBackgroundImageSources:s,onCustomImagePick:u,onBackgroundImageChange:k,onTabChange:d,onChange:x}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:g,children:h("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>f({value:C,backgroundImage:v}),children:h("fontDialogOk")})]})]})})}):null}const tj=["auto","A4","letter","legal","custom"],nj={auto:"pageAtRuleSizeAuto",A4:"pageAtRuleSizeA4",letter:"pageAtRuleSizeLetter",legal:"pageAtRuleSizeLegal",custom:"pageAtRuleSizeCustom"},rj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"};function Wf(e){return e===null?"":fe(e.value)}function oj({value:e,disabled:t,onChange:n,onReset:r}){const o=X(),a=l.useId(),[s,u]=l.useState(!0),d=e??Kn(),f=(g,h)=>{if(s){n({...d,margin:{top:h,right:h,bottom:h,left:h},marginMixed:!1});return}n({...d,margin:{...d.margin,[g]:h},marginMixed:!1})};return i.jsxs("div",{className:p.body,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:o("pageAtRuleSize")}),i.jsx("select",{id:a,className:p.select,disabled:t,value:d.sizePreset,onChange:g=>n({...d,sizePreset:g.target.value}),children:tj.map(g=>i.jsx("option",{value:g,children:o(nj[g])},g))})]}),d.sizePreset==="custom"?i.jsxs("div",{className:p.sideGrid,children:[i.jsx(lc,{label:o("pageAtRuleWidth"),value:d.customWidth,disabled:t,onChange:g=>n({...d,customWidth:g})}),i.jsx(lc,{label:o("pageAtRuleHeight"),value:d.customHeight,disabled:t,onChange:g=>n({...d,customHeight:g})})]}):null,i.jsxs("div",{className:p.field,children:[i.jsx("span",{className:p.label,children:o("pageAtRuleOrientation")}),i.jsx("div",{className:p.marks,children:[["none","pageAtRuleOrientationNone"],["portrait","pageAtRuleOrientationPortrait"],["landscape","pageAtRuleOrientationLandscape"]].map(([g,h])=>i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"radio",name:"page-orientation",checked:(d.orientation??"none")===g,disabled:t,onChange:()=>n({...d,orientation:g==="none"?null:g})}),o(h)]},g))})]}),i.jsxs("fieldset",{className:p.nestedGroup,children:[i.jsx("legend",{className:p.subLabel,children:o("pageAtRuleMargins")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:s,disabled:t,onChange:()=>u(!s)}),o("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(s?["top"]:rt).map(g=>i.jsx(lc,{label:o(s?"pageAtRuleMargins":rj[g]),value:d.margin[g],disabled:t,onChange:h=>f(g,h)},g))})]}),i.jsx("div",{className:p.actions,children:i.jsx("button",{type:"button",className:p.action,disabled:t,"aria-label":o("pageAtRuleResetAria"),onClick:r,children:o("pageAtRuleReset")})})]})}function lc({label:e,value:t,disabled:n,onChange:r}){const o=X(),a=l.useId(),[s,u]=l.useState(()=>Wf(t)),d=(t==null?void 0:t.unit)??su;return i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:e}),i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:a,className:p.lengthInput,value:s,disabled:n,inputMode:"decimal",onChange:f=>u(f.target.value),onBlur:()=>{const f=s.trim();if(!f){r(null);return}const g=ni(f,d,!1);if(!g){u(Wf(t));return}r(g),u(fe(g.value))}}),i.jsxs("select",{className:p.lengthUnit,disabled:n,value:d,"aria-label":o("paragraphDialogLengthUnitAria"),onChange:f=>{const g=f.target.value;t&&r({...t,unit:g})},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 ij=db.map(e=>e.id);function aj(e){return{...wr(),...e}}function sj(e){const{align:t,alignMixed:n,list:r,listMixed:o,...a}=e;return a}function lj({open:e,tab:t,value:n,fonts:r,disabled:o,printTabVisible:a=!1,initialParagraphTab:s="spacing",customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onTabChange:g,onApply:h,onResetAtRule:y,onClose:b}){const C=X(),x=l.useId(),v=l.useRef(null),[k,S]=l.useState("general"),[A,T]=l.useState("spacing"),[D,R]=l.useState(n.font),[P,M]=l.useState(n.box),[L,U]=l.useState(n.backgroundImage),[j,_]=l.useState(n.atRule??Kn());if(l.useEffect(()=>{e&&(S("general"),T(s==="general"?"spacing":s),R(n.font),M(n.box),U(n.backgroundImage??mn()),_(n.atRule??Kn()),t==="print"&&!a&&g("font"))},[e,n,t,a,s,g]),Ve(v,{open:e,onClose:b,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const K=C("pageDialogTitle"),G=t==="print"&&!a?"font":t;return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:v,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,onMouseDown:Z=>Z.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:x,children:K}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":K,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":G==="font",onClick:()=>g("font"),children:C("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":G==="paragraph",onClick:()=>g("paragraph"),children:C("customStyleDialogTabParagraph")}),a?i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":G==="print",onClick:()=>g("print"),children:C("pageDialogTabPrint")}):null]}),G==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(Uu,{tab:k,value:D,fonts:r,disabled:o,onTabChange:S,onChange:R})}):G==="paragraph"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(Wu,{tab:A,value:aj(P),disabled:o,tabs:ij,tablistLabelKey:"pageDialogTitle",backgroundImage:L,customImagePicker:u,disableBuiltinBackgroundImageSources:d,onCustomImagePick:f,onBackgroundImageChange:U,onTabChange:Z=>{Z!=="general"&&T(Z)},onChange:Z=>M(sj(Z))})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(oj,{value:j,disabled:o,onChange:_,onReset:()=>{_(Kn()),y==null||y()}})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:C("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>h({font:D,box:P,backgroundImage:L,atRule:a?j:n.atRule??Kn()}),children:C("fontDialogOk")})]})]})})})}function cj({open:e,disabled:t,onClose:n,onConfirm:r}){const o=X(),a=l.useId(),s=l.useRef(null);if(l.useEffect(()=>{if(!e)return;const d=s.current;if(!d)return;const f=d.querySelector('button:not([disabled]):not([tabindex="-1"])');f==null||f.focus();const g=h=>{h.key==="Escape"&&(h.preventDefault(),n())};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[e,n]),!e)return null;const u=!!t;return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:s,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("deletePageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("deletePageDialogCloseAria"),onClick:n,children:i.jsx(Je,{})})]}),i.jsx("div",{className:p.confirmBody,children:o("deletePageConfirmMessage")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:u,onClick:n,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:u,onClick:r,children:o("commandDeletePage")})]})]})})})}function uj(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`style-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Gf(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 dj(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 mj({open:e,mode:t,styleId:n,name:r="",font:o,paragraph:a,canDelete:s=!1,busy:u,disabled:d,fonts:f,defaultOuterTab:g="font",onSave:h,onDelete:y,onClose:b}){const C=X(),x=l.useId(),v=l.useId(),k=l.useRef(null),[S,A]=l.useState(r),[T,D]=l.useState(g),[R,P]=l.useState("general"),[M,L]=l.useState("general"),[U,j]=l.useState(()=>Gf(o)),[_,K]=l.useState(()=>Fc(a)),[G,Z]=l.useState(!1);l.useEffect(()=>{e&&(A(r),D(g),P("general"),L("general"),j(Gf(o)),K(Fc(a)),Z(!1))},[e,r,o,a,g]);const oe=l.useCallback(()=>{if(G){Z(!1);return}b()},[G,b]);if(Ve(k,{open:e,onClose:oe,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const Y=C(t==="create"?"customStyleDialogAddTitle":"customStyleDialogEditTitle"),Q=S.trim().length>0,ie=!!(d||u),de=()=>{const te=S.trim();te&&h({id:n??uj(),name:te,font:dj(U),paragraph:ch(_)})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:b,children:i.jsxs("div",{ref:k,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":x,"aria-busy":u||void 0,onMouseDown:te=>te.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:x,children:Y}),i.jsx("button",{type:"button",className:p.close,"aria-label":C("customStyleDialogCloseAria"),onClick:b,children:i.jsx(Je,{})})]}),G?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.confirmBody,children:C("customStyleDialogDeleteConfirm")}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:ie,onClick:()=>Z(!1),children:C("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:ie||!n,onClick:()=>{n&&(y==null||y(n))},children:C("customStyleDialogDelete")})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.nameSection,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:v,children:C("customStyleDialogName")}),i.jsx("input",{id:v,className:p.nameInput,value:S,disabled:ie,onChange:te=>A(te.target.value)})]})}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":Y,children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":T==="font",onClick:()=>D("font"),children:C("customStyleDialogTabFont")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":T==="paragraph",onClick:()=>D("paragraph"),children:C("customStyleDialogTabParagraph")})]}),T==="font"?i.jsx("div",{className:p.nestedPanel,children:i.jsx(Uu,{tab:R,value:U,fonts:f,disabled:ie,onTabChange:P,onChange:j})}):i.jsx("div",{className:p.nestedPanel,children:i.jsx(Wu,{tab:M,value:_,disabled:ie,onTabChange:L,onChange:K})}),i.jsxs("div",{className:t==="edit"&&s?`${p.actions} ${p.actionsSpread}`:p.actions,children:[t==="edit"&&s?i.jsx("button",{type:"button",className:`${p.action} ${p.actionDanger}`,disabled:ie,onClick:()=>Z(!0),children:C("customStyleDialogDelete")}):null,i.jsxs("div",{className:p.actionsEnd,children:[i.jsx("button",{type:"button",className:p.action,onClick:b,children:C("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:ie||!Q,onClick:de,children:C("fontDialogOk")})]})]})]})]})})})}function fj({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useId(),d=l.useRef(null),f=l.useRef(null),[g,h]=l.useState(t);if(l.useEffect(()=>{e&&h(t)},[e,t]),Ve(d,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),l.useEffect(()=>{var b;e&&((b=f.current)==null||b.focus())},[e]),!e)return null;const y=()=>{n||r(g)};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("customCssDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("customCssDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("customCssDialogField")}),i.jsx("textarea",{ref:f,id:u,className:p.textarea,value:g,disabled:n,spellCheck:!1,"aria-label":a("customCssDialogFieldAria"),rows:8,onChange:b=>h(b.target.value)})]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:y,children:a("fontDialogOk")})]})]})})})}const pj={empty:"bookmarkDialogErrorEmpty",invalid:"bookmarkDialogErrorInvalid",duplicate:"bookmarkDialogErrorDuplicate"};function gj({open:e,existingIds:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useId(),d=l.useId(),f=l.useRef(null),[g,h]=l.useState(""),[y,b]=l.useState(!1),C=l.useMemo(()=>new Set(t),[t]),x=gh(g,C);if(l.useEffect(()=>{e&&(h(""),b(!1))},[e]),Ve(f,{open:e,onClose:o,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),!e)return null;const v=y||g.trim().length>0?x:null,k=x===null&&!n,S=()=>{b(!0),!(x||n)&&r(g.trim())};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:f,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:A=>A.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("bookmarkDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("bookmarkDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx("div",{className:p.body,children:i.jsxs("div",{className:p.field,children:[i.jsxs("div",{className:p.labelRow,children:[i.jsx("label",{className:p.label,htmlFor:u,children:a("bookmarkDialogName")}),i.jsx(Jn,{label:a("bookmarkDialogHelp"),elevated:!0,children:i.jsx("button",{type:"button",className:p.help,"aria-label":a("bookmarkDialogHelpAria"),children:"?"})})]}),i.jsx("input",{id:u,className:p.textInput,value:g,disabled:n,"aria-invalid":v!==null,"aria-describedby":v?d:void 0,onChange:A=>h(A.target.value)}),v?i.jsx("p",{id:d,className:p.error,children:a(pj[v])}):null]})}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!k,onClick:S,children:a("fontDialogOk")})]})]})})})}const hj={empty:"audioDialogErrorEmpty",invalid:"audioDialogErrorInvalid"},bj={type:"audioDialogErrorType",tooLarge:"audioDialogErrorTooLarge"};function yj({open:e,disabled:t,customAudioPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),g=l.useId(),h=l.useRef(null),y=l.useRef(null),[b,C]=l.useState("file"),[x,v]=l.useState(""),[k,S]=l.useState(""),[A,T]=l.useState(""),[D,R]=l.useState(""),[P,M]=l.useState(null),[L,U]=l.useState(!1);if(l.useEffect(()=>{e&&(C("file"),v(""),S(""),T(""),R(""),M(null),U(!1),y.current&&(y.current.value=""))},[e]),Ve(h,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const j=b==="file"?k:b==="url"?x:"",_=b==="custom"?null:Hu(j),K=b==="custom"?null:b==="file"&&P?bj[P]:_&&(b==="file"||x.trim().length>0)?hj[_]:null,G=b!=="custom"&&_===null&&!(b==="file"&&P)&&!t&&!L,Z=()=>{t||!n||o==null||o()},oe=()=>{G&&r({src:j.trim(),title:D.trim()})},Y=Q=>{var de;const ie=(de=Q.target.files)==null?void 0:de[0];ie&&(U(!0),M(null),qS(ie).then(te=>{S(te),T(ie.name),C("file"),U(!1)},te=>{const E=te instanceof Error?te.message:"";S(""),T(""),C("file"),M(E==="tooLarge"||E==="type"?E:"type"),U(!1),y.current&&(y.current.value="")}))};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:Q=>Q.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("audioDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("audioDialogCloseAria"),onClick:a,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="file",disabled:t,onClick:()=>C("file"),children:s("audioDialogFile")}),i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="url",disabled:t,onClick:()=>C("url"),children:s("audioDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":b==="custom",disabled:t,onClick:()=>C("custom"),children:n.text}):null]}),b==="file"?i.jsxs("div",{className:p.fileRow,children:[i.jsx("input",{ref:y,type:"file",accept:KS,hidden:!0,disabled:t,"aria-label":s("audioDialogChooseFile"),onChange:Y}),i.jsx("button",{type:"button",className:p.action,disabled:t||L,onClick:()=>{var Q;return(Q=y.current)==null?void 0:Q.click()},children:s("audioDialogChooseFile")}),A?i.jsx("span",{className:p.fileName,children:A}):null]}):null,b==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("audioDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:x,disabled:t,"aria-invalid":K!==null,"aria-describedby":K?g:void 0,onChange:Q=>v(Q.target.value)})]}):null,b==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:Z,children:n.buttonCaption})]}):null]}),b!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("audioDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:D,disabled:t,onChange:Q=>R(Q.target.value)})]}):null,K?i.jsx("p",{id:g,className:p.error,children:s(K)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),b!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!G,onClick:oe,children:s("fontDialogOk")}):null]})]})})})}function xj({open:e,disabled:t,customImagePicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),g=l.useRef(null),[h,y]=l.useState(""),[b,C]=l.useState(""),[x,v]=l.useState(""),[k,S]=l.useState("file");if(l.useEffect(()=>{e&&(y(""),C(""),v(""),S("file"))},[e]),Ve(g,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const A=HI(h)&&!t,T=()=>{A&&r({src:h.trim(),alt:b.trim(),title:x.trim()})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:g,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:D=>D.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("imageDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("imageDialogCloseAria"),onClick:a,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx(fb,{src:h,disabled:t,customImagePicker:n,onCustomPick:o,onSourceChange:S,onSrcChange:y}),k!=="custom"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("imageDialogAlt")}),i.jsx("input",{id:d,className:p.textInput,value:b,disabled:t,onChange:D=>C(D.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imageDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:x,disabled:t,onChange:D=>v(D.target.value)})]})]}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),k!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!A,onClick:T,children:s("fontDialogOk")}):null]})]})})})}const Cj=[{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}],wj={left:cs,center:ls,right:us},vj=["left","center","right"],kj={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},Sj=["width","height","lock"],Pj={width:"imagePropertiesSizeWidth",height:"imagePropertiesSizeHeight",lock:"imagePropertiesSizeLock"},Aj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Tj={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Rj={value:1,unit:"pt"},Dj={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 cc(e){return{top:e,right:e,bottom:e,left:e}}function Ij(e){for(const t of rt)if(e[t])return e[t];return null}function jj({tab:e,value:t,aspectRatio:n,disabled:r,onTabChange:o,onChange:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),[g,h]=l.useState(()=>Rn(t.margin,cc(t.margin.top))),y=t.align==="center",b=(x,v)=>{if(t.sizeMode==="lock"&&v){const k=Jo(x,v,n);a({...t,width:k.width,height:k.height});return}a({...t,[x]:v})},C=x=>{if(x==="width"){a({...t,sizeMode:x,height:null});return}if(x==="height"){a({...t,sizeMode:x,width:null});return}if(t.width){const v=Jo("width",t.width,n);a({...t,sizeMode:x,width:v.width,height:v.height});return}if(t.height){const v=Jo("height",t.height,n);a({...t,sizeMode:x,width:v.width,height:v.height});return}a({...t,sizeMode:x})};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:p.tabs,role:"tablist","aria-label":s("imagePropertiesDialogTitle"),children:Cj.map(x=>i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":x.id===e,disabled:!x.implemented,onClick:()=>o(x.id),children:s(x.labelKey)},x.id))}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[e==="general"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesSize")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("imagePropertiesSizeMode"),children:Sj.map(x=>i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":t.sizeMode===x,disabled:r,onClick:()=>C(x),children:s(Pj[x])},x))}),i.jsx(ss,{label:s("imagePropertiesWidth"),inputAria:s("imagePropertiesWidthAria"),value:t.width,disabled:r||t.sizeMode==="height",onChange:x=>b("width",x)}),i.jsx(ss,{label:s("imagePropertiesHeight"),inputAria:s("imagePropertiesHeightAria"),value:t.height,disabled:r||t.sizeMode==="width",onChange:x=>b("height",x)})]}):null,e==="alignment"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":s("paragraphDialogAlignment"),children:vj.map(x=>{const v=wj[x];return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":t.align===x,"aria-label":s(kj[x]),disabled:r,onClick:()=>{a({...t,align:t.align===x?null:x})},children:i.jsx(v,{})},x)})})]}):null,e==="border"?i.jsxs(i.Fragment,{children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogMargin")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:g,disabled:r||y,onChange:()=>{const x=!g;h(x),x&&a({...t,margin:cc(Ij(t.margin))})}}),s("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(g?["top"]:rt).map(x=>i.jsx(Xe,{label:s(g?"paragraphDialogMargin":Aj[x]),value:t.margin[x],disabled:r||y&&(x==="left"||x==="right"),allowNegative:!0,onChange:v=>{const k=g?cc(v):{...t.margin,[x]:v};a({...t,margin:k})}},x))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:s("paragraphDialogBorderStyle")}),i.jsx("select",{id:u,className:p.select,value:t.border.style,disabled:r,onChange:x=>{const v=x.target.value;a({...t,border:{style:v,width:v==="none"?null:t.border.width??Rj,color:v==="none"?null:t.border.color}})},children:ps.map(x=>i.jsx("option",{value:x,children:s(Tj[x])},x))})]}),t.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:s("paragraphDialogBorderWidth"),value:t.border.width,disabled:r,onChange:x=>{a({...t,border:{...t.border,width:x}})}}),i.jsx(Ot,{label:s("paragraphDialogBorderColor"),noneLabel:s("colorNone"),value:t.border.color,disabled:r,onChange:x=>{a({...t,border:{...t.border,color:x}})}})]}):null,i.jsx(Xe,{label:s("paragraphDialogBorderRadius"),value:t.borderRadius,disabled:r,onChange:x=>{a({...t,borderRadius:x})}}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:t.boxShadow!==null,disabled:r,onChange:()=>{a({...t,boxShadow:t.boxShadow?null:Dj})}}),s("paragraphDialogBoxShadow")]}),t.boxShadow?i.jsx(Vu,{shadow:t.boxShadow,disabled:r,onChange:x=>{a({...t,boxShadow:x})}}):null]})]}):null,e==="advanced"?i.jsxs(i.Fragment,{children:[i.jsx(mb,{value:{opacity:t.opacity,fit:t.objectFit,position:t.objectPosition},disabled:r,onChange:x=>{a(qw({...t,opacity:x.opacity,objectFit:x.fit,objectPosition:x.position},n))}}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesRotation")}),i.jsx("div",{className:p.field,children:i.jsxs("div",{className:p.lengthRow,children:[i.jsx("input",{id:d,className:p.lengthInput,value:t.rotateDeg===null?"":fe(t.rotateDeg),disabled:r,inputMode:"decimal","aria-label":s("imagePropertiesRotation"),onChange:x=>{const v=x.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:p.lengthUnit,"aria-hidden":"true",children:s("imagePropertiesRotationUnit")})]})})]})]}):null,e==="hover"?i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:s("imagePropertiesTabHover")}),i.jsx("p",{className:p.emptyHint,children:s("imagePropertiesHoverHelp")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("imagePropertiesHoverCss")}),i.jsx("textarea",{id:f,className:p.textarea,value:t.hoverCss,disabled:r,spellCheck:!1,"aria-label":s("imagePropertiesHoverCssAria"),onChange:x=>{a({...t,hoverCss:x.target.value})}})]})]}):null]})]})}function Ej({open:e,tab:t,value:n,aspectRatio:r=1,disabled:o,onTabChange:a,onApply:s,onClose:u}){const d=X(),f=l.useId(),g=l.useRef(null),[h,y]=l.useState(n);return l.useEffect(()=>{e&&y(n)},[e,n]),Ve(g,{open:e,onClose:u,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:u,children:i.jsxs("div",{ref:g,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":f,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:f,children:d("imagePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":d("imagePropertiesDialogCloseAria"),onClick:u,children:i.jsx(Je,{})})]}),i.jsx(jj,{tab:t,value:h,aspectRatio:r,disabled:o,onTabChange:a,onChange:y}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:u,children:d("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:o,onClick:()=>s(h),children:d("fontDialogOk")})]})]})})}):null}function Mj({open:e,tab:t,href:n,title:r,targetBlank:o,textDecorationNone:a,hoverMode:s,hoverColor:u,hoverHtml:d,bookmarks:f,selectedBookmarkId:g,disabled:h,onTabChange:y,onApply:b,onClose:C}){const x=X(),v=l.useId(),k=l.useId(),S=l.useId(),A=l.useId(),T=l.useId(),D=l.useRef(null),[R,P]=l.useState(n),[M,L]=l.useState(r),[U,j]=l.useState(o),[_,K]=l.useState(a),[G,Z]=l.useState(s),[oe,Y]=l.useState(u),[Q,ie]=l.useState(d),[de,te]=l.useState(g);if(l.useEffect(()=>{e&&(P(n),L(r),j(o),K(a),Z(s),Y(u),ie(d),te(g))},[e,n,r,o,a,s,u,d,g]),Ve(D,{open:e,onClose:C,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),!e)return null;const E=()=>ks({title:M,targetBlank:U,textDecorationNone:_,hoverMode:G,hoverColor:oe,hoverHtml:Q}),re=()=>{const F=R.trim();!F||h||b({...E(),href:F})},pe=()=>{!de||h||b({...E(),href:`#${de}`})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:C,children:i.jsxs("div",{ref:D,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:F=>F.stopPropagation(),children:[i.jsx("h2",{className:p.header,id:v,children:x("linkDialogTitle")}),i.jsxs("div",{className:p.tabs,role:"tablist","aria-label":x("linkDialogTitle"),children:[i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="link",onClick:()=>y("link"),children:x("linkDialogTabLink")}),i.jsx("button",{type:"button",className:p.tab,role:"tab","aria-selected":t==="bookmark",onClick:()=>y("bookmark"),children:x("linkDialogTabBookmark")})]}),i.jsxs("div",{className:p.body,role:"tabpanel",children:[t==="link"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:k,children:x("linkDialogHref")}),i.jsx("input",{id:k,className:p.textInput,value:R,disabled:h,onChange:F=>P(F.target.value)})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:S,children:x("linkDialogHoverTitle")}),i.jsx("input",{id:S,className:p.textInput,value:M,disabled:h,onChange:F=>L(F.target.value)})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:U,disabled:h,onChange:F=>j(F.target.checked)}),x("linkDialogTargetBlank")]})]}):f.length===0?i.jsx("p",{className:p.emptyHint,children:x("linkDialogBookmarkEmpty")}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:A,children:x("linkDialogBookmark")}),i.jsxs("select",{id:A,className:`${p.select} ${p.fullSelect}`,value:de,disabled:h,onChange:F=>te(F.target.value),children:[i.jsx("option",{value:""}),f.map(F=>i.jsx("option",{value:F.id,children:F.id},F.id))]})]}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:_,disabled:h,onChange:F=>K(F.target.checked)}),x("linkDialogTextDecorationNone")]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:x("linkDialogHover")}),i.jsxs("div",{className:p.sizeRow,role:"group","aria-label":x("linkDialogHover"),children:[i.jsx("button",{type:"button",className:p.action,"aria-pressed":G==="color",disabled:h,onClick:()=>Z("color"),children:x("linkDialogHoverColor")}),i.jsx("button",{type:"button",className:p.action,"aria-pressed":G==="html",disabled:h,onClick:()=>Z("html"),children:x("linkDialogHoverHtml")})]}),G==="color"?i.jsx(Ot,{label:x("linkDialogHoverColorField"),noneLabel:x("colorNone"),value:oe,disabled:h,onChange:Y}):i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:T,children:x("linkDialogHoverHtmlAria")}),i.jsx("textarea",{id:T,className:p.textarea,value:Q,disabled:h,spellCheck:!1,onChange:F=>ie(F.target.value)})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,disabled:h||!de,onClick:pe,children:x("linkDialogSelect")}),i.jsx("button",{type:"button",className:p.action,onClick:C,children:x("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:h||!R.trim(),onClick:re,children:x("fontDialogOk")})]})]})})})}const Zf={empty:"youtubeDialogErrorEmpty",invalid:"youtubeDialogErrorInvalid"};function _j({open:e,disabled:t,customVideoPicker:n,onApply:r,onCustomPick:o,onClose:a}){const s=X(),u=l.useId(),d=l.useId(),f=l.useId(),g=l.useId(),h=l.useRef(null),[y,b]=l.useState("url"),[C,x]=l.useState(""),[v,k]=l.useState("");if(l.useEffect(()=>{e&&(b("url"),x(""),k(""))},[e]),Ve(h,{open:e,onClose:a,escapeIgnoreSelectors:!1}),!e)return null;const S=y==="custom"?null:Ph(C),A=y==="custom"?null:S&&C.trim().length>0?Zf[S]:S==="empty"&&C.trim().length===0?null:S?Zf[S]:null,T=y!=="custom"&&S===null&&!t&&C.trim().length>0,D=()=>{t||!n||o==null||o()},R=()=>{T&&r({url:C.trim(),title:v.trim()})};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:a,children:i.jsxs("div",{ref:h,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":u,onMouseDown:P=>P.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:u,children:s("youtubeDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":s("youtubeDialogCloseAria"),onClick:a,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.subLabel,children:s("audioDialogSource")}),i.jsxs("div",{className:p.sizeRow,role:"radiogroup","aria-label":s("audioDialogSource"),children:[i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="url",disabled:t,onClick:()=>b("url"),children:s("youtubeDialogUrl")}),n?i.jsx("button",{type:"button",className:p.action,role:"radio","aria-checked":y==="custom",disabled:t,onClick:()=>b("custom"),children:n.text}):null]}),y==="url"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:d,children:s("youtubeDialogUrl")}),i.jsx("input",{id:d,className:p.textInput,value:C,disabled:t,"aria-invalid":A!==null,"aria-describedby":A?g:void 0,onChange:P=>x(P.target.value)})]}):null,y==="custom"&&n?i.jsxs("div",{className:p.field,children:[i.jsx("p",{className:p.emptyHint,children:n.description}),i.jsx("button",{type:"button",className:p.action,disabled:t,onClick:D,children:n.buttonCaption})]}):null]}),y!=="custom"?i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:f,children:s("youtubeDialogTitleField")}),i.jsx("input",{id:f,className:p.textInput,value:v,disabled:t,onChange:P=>k(P.target.value)})]}):null,A?i.jsx("p",{id:g,className:p.error,children:s(A)}):null]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:a,children:s("fontDialogCancel")}),y!=="custom"?i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!T,onClick:R,children:s("fontDialogOk")}):null]})]})})})}const Nj="_grid_1bpma_1",Lj="_cell_1bpma_8",Bj="_sizeLabel_1bpma_27",Fj="_sizeFields_1bpma_33",Hj="_numberInput_1bpma_37",qr={grid:Nj,cell:Lj,sizeLabel:Bj,sizeFields:Fj,numberInput:Hj},Hn={rows:3,cols:3};function zj({open:e,disabled:t,onApply:n,onClose:r}){const o=X(),a=l.useId(),s=l.useId(),u=l.useId(),d=l.useRef(null),[f,g]=l.useState(Hn.rows),[h,y]=l.useState(Hn.cols),[b,C]=l.useState(String(Hn.rows)),[x,v]=l.useState(String(Hn.cols)),[k,S]=l.useState(!1);if(l.useEffect(()=>{e&&(g(Hn.rows),y(Hn.cols),C(String(Hn.rows)),v(String(Hn.cols)),S(!1))},[e]),Ve(d,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([hidden]), select:not([disabled])'}),!e)return null;const T=eh(f,h)&&!t,D=(L,U)=>{const j=Math.min(no,Math.max(to,L)),_=Math.min(no,Math.max(to,U));g(j),y(_),C(String(j)),v(String(_))},R=(L,U)=>{const j=Number.parseInt(L,10);if(!Number.isFinite(j)){U==="rows"?C(String(f)):v(String(h));return}S(!0),U==="rows"?D(j,h):D(f,j)},P=(L,U)=>{const j=L.replace(/\D/g,"");if(U==="rows"?C(j):v(j),j==="")return;const _=Number.parseInt(j,10);Number.isFinite(_)&&(S(!0),U==="rows"?D(_,h):D(f,_))},M=L=>{(L.key==="e"||L.key==="E"||L.key==="+"||L.key==="-"||L.key===".")&&L.preventDefault()};return i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:d,className:p.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:L=>L.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:a,children:o("tableDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":o("tableDialogCloseAria"),onClick:r,children:i.jsx(Je,{})})]}),i.jsxs("div",{className:p.body,children:[i.jsx("div",{className:qr.grid,role:"grid","aria-label":o("tableDialogGridAria"),onMouseLeave:()=>{},children:Array.from({length:lf},(L,U)=>Array.from({length:lf},(j,_)=>{const K=U+1,G=_+1,Z=K<=f&&G<=h;return i.jsx("button",{type:"button",className:qr.cell,role:"gridcell","data-active":Z?"true":void 0,"aria-label":`${K} × ${G}`,"aria-pressed":Z&&K===f&&G===h,disabled:t,onMouseEnter:()=>{k||D(K,G)},onClick:()=>{S(!0),D(K,G)}},`${K}-${G}`)}))}),i.jsxs("p",{className:qr.sizeLabel,children:[o("tableDialogSize"),": ",f," × ",h]}),i.jsxs("div",{className:`${p.sizeRow} ${qr.sizeFields}`,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:o("tableDialogRows")}),i.jsx("input",{id:s,className:qr.numberInput,type:"number",inputMode:"numeric",min:to,max:no,step:1,value:b,disabled:t,onKeyDown:M,onChange:L=>P(L.target.value,"rows"),onBlur:()=>R(b,"rows")})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:u,children:o("tableDialogColumns")}),i.jsx("input",{id:u,className:qr.numberInput,type:"number",inputMode:"numeric",min:to,max:no,step:1,value:x,disabled:t,onKeyDown:M,onChange:L=>P(L.target.value,"cols"),onBlur:()=>R(x,"cols")})]})]})]}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:r,children:o("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:!T,onClick:()=>{T&&n({rows:f,cols:h})},children:o("tableDialogInsert")})]})]})})})}const Oj={none:"paragraphDialogBorderStyleNone",solid:"paragraphDialogBorderStyleSolid",dotted:"paragraphDialogBorderStyleDotted",dashed:"paragraphDialogBorderStyleDashed",double:"paragraphDialogBorderStyleDouble",groove:"paragraphDialogBorderStyleGroove",ridge:"paragraphDialogBorderStyleRidge",inset:"paragraphDialogBorderStyleInset",outset:"paragraphDialogBorderStyleOutset"},Kj={value:1,unit:"pt"},$j={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 Uj({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=l.useId();return i.jsxs("div",{className:p.body,children:[i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("tablePropertiesWidth")}),i.jsx(Xe,{label:r("tablePropertiesWidth"),value:e.width,disabled:t,onChange:s=>n({...e,width:s})}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("tablePropertiesCollapse")}),i.jsxs("select",{id:o,className:p.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(Xe,{label:r("tablePropertiesSpacing"),value:e.borderSpacing,disabled:t,onChange:s=>n({...e,borderSpacing:s})}):null]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogBorder")}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("paragraphDialogBorderStyle")}),i.jsx("select",{id:a,className:p.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??Kj,color:u==="none"?null:e.border.color}})},children:ps.map(s=>i.jsx("option",{value:s,children:r(Oj[s])},s))})]}),e.border.style!=="none"?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:r("paragraphDialogBorderWidth"),value:e.border.width,disabled:t,onChange:s=>n({...e,border:{...e.border,width:s}})}),i.jsx(Ot,{label:r("paragraphDialogBorderColor"),noneLabel:r("colorNone"),value:e.border.color,disabled:t,onChange:s=>n({...e,border:{...e.border,color:s}})})]}):null,i.jsx(Xe,{label:r("paragraphDialogBorderRadius"),value:e.borderRadius,disabled:t,onChange:s=>n({...e,borderRadius:s})}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:e.boxShadow!==null,disabled:t,onChange:()=>{n({...e,boxShadow:e.boxShadow?null:$j})}}),r("paragraphDialogBoxShadow")]}),e.boxShadow?i.jsx(Vu,{shadow:e.boxShadow,disabled:t,onChange:s=>n({...e,boxShadow:s})}):null]})]})}function Vj({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),Ve(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:g=>g.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("tablePropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("tablePropertiesDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx(Uj,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const Wj=["left","center","right"],Gj={left:cs,center:ls,right:us},Zj={left:"commandAlignLeftAria",center:"commandAlignCenterAria",right:"commandAlignRightAria"},qj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},Yj={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function ja(e){return{top:e,right:e,bottom:e,left:e}}function uc(e){for(const t of rt)if(e[t])return e[t];return null}function Xj({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),a=l.useId(),s=l.useId(),[u,d]=l.useState(()=>Rn(e.padding,ja(uc(e.padding))));return l.useEffect(()=>{d(Rn(e.padding,ja(uc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Ot,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:f=>n({...e,backgroundColor:f})}),i.jsx(Ot,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:f=>n({...e,color:f})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:u,disabled:t,onChange:()=>{const f=!u;d(f),f&&n({...e,padding:ja(uc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(u?["top"]:rt).map(f=>i.jsx(Xe,{label:r(u?"paragraphDialogPadding":qj[f]),value:e.padding[f],disabled:t,onChange:g=>{const h=u?ja(g):{...e.padding,[f]:g};n({...e,padding:h})}},f))})]}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogAlignment")}),i.jsx("div",{className:p.iconRow,role:"radiogroup","aria-label":r("paragraphDialogAlignment"),children:Wj.map(f=>{const g=Gj[f],h=(e.textAlign??"left")===f;return i.jsx("button",{type:"button",className:p.iconButton,role:"radio","aria-checked":h,"aria-label":r(Zj[f]),disabled:t,onClick:()=>{n({...e,textAlign:f==="left"?null:f})},children:i.jsx(g,{})},f)})})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.select,value:e.verticalAlign??"",disabled:t,onChange:f=>{const g=f.target.value;n({...e,verticalAlign:g||null})},children:[i.jsx("option",{value:"",children:r("cellPropertiesVerticalAlignDefault")}),Ps.map(f=>i.jsx("option",{value:f,children:r(Yj[f])},f))]})]}),i.jsx(Xe,{label:r("cellPropertiesWidth"),value:e.width,disabled:t,onChange:f=>n({...e,width:f})}),i.jsxs("div",{className:p.sizeRow,children:[i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:a,children:r("cellPropertiesColSpan")}),i.jsx("input",{id:a,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.colSpan,disabled:t,onChange:f=>{const g=Number.parseInt(f.target.value,10);n({...e,colSpan:Number.isFinite(g)?Math.max(1,g):1})}})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:s,children:r("cellPropertiesRowSpan")}),i.jsx("input",{id:s,className:p.lengthInput,type:"number",inputMode:"numeric",min:1,step:1,value:e.rowSpan,disabled:t,onChange:f=>{const g=Number.parseInt(f.target.value,10);n({...e,rowSpan:Number.isFinite(g)?Math.max(1,g):1})}})]})]})]})}function Jj({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),Ve(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:g=>g.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("cellPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("cellPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx(Xj,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const Qj={top:"paragraphDialogSideTop",right:"paragraphDialogSideRight",bottom:"paragraphDialogSideBottom",left:"paragraphDialogSideLeft"},eE={top:"cellPropertiesVerticalAlignTop",middle:"cellPropertiesVerticalAlignMiddle",bottom:"cellPropertiesVerticalAlignBottom",baseline:"cellPropertiesVerticalAlignBaseline"};function Ea(e){return{top:e,right:e,bottom:e,left:e}}function dc(e){for(const t of rt)if(e[t])return e[t];return null}function tE({value:e,disabled:t,onChange:n}){const r=X(),o=l.useId(),[a,s]=l.useState(()=>Rn(e.padding,Ea(dc(e.padding))));return l.useEffect(()=>{s(Rn(e.padding,Ea(dc(e.padding))))},[e.padding]),i.jsxs("div",{className:p.body,children:[i.jsx(Ot,{label:r("paragraphDialogBackgroundColor"),noneLabel:r("colorNone"),value:e.backgroundColor,disabled:t,onChange:u=>n({...e,backgroundColor:u})}),i.jsx(Ot,{label:r("cellPropertiesColor"),noneLabel:r("colorNone"),value:e.color,disabled:t,onChange:u=>n({...e,color:u})}),i.jsxs("fieldset",{className:p.group,children:[i.jsx("legend",{className:p.label,children:r("paragraphDialogPadding")}),i.jsxs("label",{className:p.mark,children:[i.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:()=>{const u=!a;s(u),u&&n({...e,padding:Ea(dc(e.padding))})}}),r("paragraphDialogLinkSides")]}),i.jsx("div",{className:p.sideGrid,children:(a?["top"]:rt).map(u=>i.jsx(Xe,{label:r(a?"paragraphDialogPadding":Qj[u]),value:e.padding[u],disabled:t,onChange:d=>{const f=a?Ea(d):{...e.padding,[u]:d};n({...e,padding:f})}},u))})]}),i.jsxs("div",{className:p.field,children:[i.jsx("label",{className:p.label,htmlFor:o,children:r("cellPropertiesVerticalAlign")}),i.jsxs("select",{id:o,className:p.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")}),Ps.map(u=>i.jsx("option",{value:u,children:r(eE[u])},u))]})]}),i.jsx(Xe,{label:r("rowPropertiesHeight"),value:e.height,disabled:t,onChange:u=>n({...e,height:u})})]})}function nE({open:e,value:t,disabled:n,onApply:r,onClose:o}){const a=X(),s=l.useId(),u=l.useRef(null),[d,f]=l.useState(t);return l.useEffect(()=>{e&&f(t)},[e,t]),Ve(u,{open:e,onClose:o,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'}),e?i.jsx(ke,{children:i.jsx("div",{className:p.backdrop,role:"presentation",onMouseDown:o,children:i.jsxs("div",{ref:u,className:`${p.dialog} ${p.dialogWide}`,role:"dialog","aria-modal":"true","aria-labelledby":s,onMouseDown:g=>g.stopPropagation(),children:[i.jsxs("div",{className:p.headerRow,children:[i.jsx("h2",{className:p.header,id:s,children:a("rowPropertiesDialogTitle")}),i.jsx("button",{type:"button",className:p.close,"aria-label":a("rowPropertiesDialogCloseAria"),onClick:o,children:i.jsx(Je,{})})]}),i.jsx(tE,{value:d,disabled:n,onChange:f}),i.jsxs("div",{className:p.actions,children:[i.jsx("button",{type:"button",className:p.action,onClick:o,children:a("fontDialogCancel")}),i.jsx("button",{type:"button",className:`${p.action} ${p.actionPrimary}`,disabled:n,onClick:()=>r(d),children:a("fontDialogOk")})]})]})})}):null}const rE="_backdrop_9d3gw_1",oE="_dialog_9d3gw_12",iE="_headerRow_9d3gw_29",aE="_header_9d3gw_29",sE="_close_9d3gw_44",lE="_body_9d3gw_66",cE="_frame_9d3gw_75",uE="_actions_9d3gw_83",dE="_action_9d3gw_83",An={backdrop:rE,dialog:oE,headerRow:iE,header:aE,close:sE,body:lE,frame:cE,actions:uE,action:dE};function mE(e){const t=Un(e);if(t.length<=1)return e;const n=[],r=[];for(const a of t){const s=he(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 fE({open:e,html:t,onClose:n}){const r=X(),o=l.useId(),a=l.useRef(null),s=l.useRef(null),u=l.useMemo(()=>mE(t),[t]);return Ve(a,{open:e,onClose:n,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{var f;if(!e)return;const d=(f=s.current)==null?void 0:f.contentDocument;d&&Rc(d,u,r("previewDialogTitle"))},[e,u,r]),e?i.jsx(ke,{children:i.jsx("div",{className:An.backdrop,role:"presentation",onMouseDown:n,children:i.jsxs("div",{ref:a,className:An.dialog,role:"dialog","aria-modal":"true","aria-labelledby":o,onMouseDown:d=>d.stopPropagation(),children:[i.jsxs("div",{className:An.headerRow,children:[i.jsx("h2",{className:An.header,id:o,children:r("previewDialogTitle")}),i.jsx("button",{type:"button",className:An.close,"aria-label":r("previewDialogCloseAria"),onClick:n,children:i.jsx(Je,{})})]}),i.jsx("div",{className:An.body,children:i.jsx("iframe",{ref:s,className:An.frame,title:r("previewDialogTitle"),sandbox:"allow-same-origin",tabIndex:-1,onLoad:()=>{var f;const d=(f=s.current)==null?void 0:f.contentDocument;d&&Rc(d,u,r("previewDialogTitle"))}})}),i.jsx("div",{className:An.actions,children:i.jsx("button",{type:"button",className:An.action,onClick:n,children:r("previewDialogClose")})})]})})}):null}const pE="0.0.11",gE="_backdrop_72ox3_1",hE="_dialog_72ox3_12",bE="_headerRow_72ox3_30",yE="_header_72ox3_30",xE="_close_72ox3_46",CE="_body_72ox3_68",wE="_product_72ox3_76",vE="_meta_72ox3_82",kE="_description_72ox3_87",SE="_website_72ox3_92",PE="_cta_72ox3_97",AE="_link_72ox3_102",TE="_actions_72ox3_118",RE="_action_72ox3_118",bt={backdrop:gE,dialog:hE,headerRow:bE,header:yE,close:xE,body:CE,product:wE,meta:vE,description:kE,website:SE,cta:PE,link:AE,actions:TE,action:RE};function DE({open:e,onClose:t}){const n=X(),r=l.useId(),o=l.useRef(null);return Ve(o,{open:e,onClose:t,escapeIgnoreSelectors:!1,focusableSelector:'a[href], button:not([disabled]):not([tabindex="-1"])'}),e?i.jsx(ke,{children:i.jsx("div",{className:bt.backdrop,role:"presentation",onMouseDown:t,children:i.jsxs("div",{ref:o,className:bt.dialog,role:"dialog","aria-modal":"true","aria-labelledby":r,onMouseDown:a=>a.stopPropagation(),children:[i.jsxs("div",{className:bt.headerRow,children:[i.jsx("h2",{id:r,className:bt.header,children:n("aboutDialogTitle")}),i.jsx("button",{type:"button",className:bt.close,onClick:t,"aria-label":n("aboutDialogCloseAria"),children:i.jsx(Je,{})})]}),i.jsxs("div",{className:bt.body,children:[i.jsx("p",{className:bt.product,children:n("brandMarkAria")}),i.jsx("p",{className:bt.meta,children:n("aboutDialogVersion").replace("{version}",pE)}),i.jsx("p",{className:bt.description,children:n("aboutDialogDescription")}),i.jsxs("div",{className:bt.website,children:[i.jsx("p",{className:bt.cta,children:n("aboutDialogWebsiteCta")}),i.jsx("a",{className:bt.link,href:"https://commspliant.com/",target:"_blank",rel:"noopener noreferrer","aria-label":n("aboutDialogWebsiteAria"),children:n("aboutDialogWebsite")})]})]}),i.jsx("div",{className:bt.actions,children:i.jsx("button",{type:"button",className:bt.action,onClick:t,children:n("aboutDialogClose")})})]})})}):null}const IE="_backdrop_12fkg_1",jE="_dialog_12fkg_12",EE="_headerRow_12fkg_31",ME="_header_12fkg_31",_E="_close_12fkg_47",NE="_searchRow_12fkg_69",LE="_search_12fkg_69",BE="_body_12fkg_91",FE="_sidebar_12fkg_99",HE="_category_12fkg_111",zE="_topicList_12fkg_121",OE="_topicButton_12fkg_127",KE="_topicButtonActive_12fkg_147",$E="_main_12fkg_157",UE="_articleTitle_12fkg_164",VE="_articleBody_12fkg_171",WE="_noResults_12fkg_176",GE="_related_12fkg_181",ZE="_relatedTitle_12fkg_187",qE="_relatedList_12fkg_194",YE="_relatedButton_12fkg_200",XE="_relatedItem_12fkg_223",Fe={backdrop:IE,dialog:jE,headerRow:EE,header:ME,close:_E,searchRow:NE,search:LE,body:BE,sidebar:FE,category:HE,topicList:zE,topicButton:OE,topicButtonActive:KE,main:$E,articleTitle:UE,articleBody:VE,noResults:WE,related:GE,relatedTitle:ZE,relatedList:qE,relatedButton:YE,relatedItem:XE};function JE(e){return{getStarted:"helpCategoryGetStarted",file:"helpCategoryFile",edit:"helpCategoryEdit",insert:"helpCategoryInsert",format:"helpCategoryFormat",table:"helpCategoryTable",view:"helpCategoryView",keyboard:"helpCategoryKeyboard"}[e]}function QE({open:e,topicId:t,onTopicChange:n,onClose:r}){const o=X(),a=l.useId(),s=l.useRef(null),[u,d]=l.useState("");Ve(s,{open:e,onClose:r,escapeIgnoreSelectors:!1,focusableSelector:'button:not([disabled]):not([tabindex="-1"]), input:not([disabled]), select:not([disabled])'}),l.useEffect(()=>{e||d("")},[e]);const f=l.useMemo(()=>qc.map(b=>({id:b.id,title:o(b.titleKey),body:o(b.bodyKey),keywords:o(b.keywordsKey)})),[o]),g=l.useMemo(()=>{const b=VR(f,u);return new Set(b.map(C=>C.id))},[u,f]),h=Ff[t],y=u.trim().length>0&&g.size===0;return e?i.jsx(ke,{children:i.jsx("div",{className:Fe.backdrop,role:"presentation",onMouseDown:r,children:i.jsxs("div",{ref:s,className:Fe.dialog,role:"dialog","aria-modal":"true","aria-labelledby":a,onMouseDown:b=>b.stopPropagation(),children:[i.jsxs("div",{className:Fe.headerRow,children:[i.jsx("h2",{id:a,className:Fe.header,children:o("helpDialogTitle")}),i.jsx("button",{type:"button",className:Fe.close,onClick:r,"aria-label":o("helpDialogCloseAria"),children:i.jsx(Je,{})})]}),i.jsx("div",{className:Fe.searchRow,children:i.jsx("input",{type:"search",className:Fe.search,value:u,onChange:b=>d(b.target.value),placeholder:o("helpDialogSearchPlaceholder"),"aria-label":o("helpDialogSearchAria")})}),i.jsxs("div",{className:Fe.body,children:[i.jsx("aside",{className:Fe.sidebar,"aria-label":o("helpDialogContentsAria"),children:$R.map(b=>{const C=qc.filter(x=>x.category===b&&g.has(x.id));return C.length===0?null:i.jsxs("div",{children:[i.jsx("h3",{className:Fe.category,children:o(JE(b))}),i.jsx("ul",{className:Fe.topicList,children:C.map(x=>i.jsx("li",{children:i.jsx("button",{type:"button",className:`${Fe.topicButton}${x.id===t?` ${Fe.topicButtonActive}`:""}`,onClick:()=>n(x.id),children:o(x.titleKey)})},x.id))})]},b)})}),i.jsx("div",{className:Fe.main,children:y?i.jsx("p",{className:Fe.noResults,children:o("helpDialogNoResults")}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:Fe.articleTitle,children:o(h.titleKey)}),i.jsx("p",{className:Fe.articleBody,children:o(h.bodyKey)}),h.related.length>0?i.jsxs("div",{className:Fe.related,children:[i.jsx("h4",{className:Fe.relatedTitle,children:o("helpDialogRelatedTitle")}),i.jsx("ul",{className:Fe.relatedList,children:h.related.map(b=>{const C=Ff[b];return!C||!g.has(b)?null:i.jsx("li",{className:Fe.relatedItem,children:i.jsx("button",{type:"button",className:Fe.relatedButton,onClick:()=>n(b),children:o(C.titleKey)})},b)})})]}):null]})})]})]})})}):null}function pb(e){return{catalog:e.catalog,layout:e.layout,commands:e.commands,queries:e.queries,queryRevisions:e.queryRevisions??Yh(),disabled:e.disabled,chromeLock:e.chromeLock}}function eM(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}const tM=l.memo(function({menuVisible:t,captureChromeSelection:n,displayCatalog:r,displayLayout:o,commands:a,queries:s,queryRevisions:u,chromeDisabled:d,chromeLock:f,contentLocked:g,customizeToolbarOpen:h,baseCatalog:y,allowedLayout:b,toolbarSettings:C,toolbarSettingsLoading:x,toolbarSettingsBusy:v,onCustomizeToolbarClose:k,onToolbarSettingsChange:S,onToolbarSettingsReset:A,documentPreview:T,onDocumentPreviewClose:D,helpDialog:R,onHelpDialogClose:P,onHelpTopicChange:M,aboutDialogOpen:L,onAboutDialogClose:U,fontDialog:j,fontSizeState:_,markState:K,fontFamilyState:G,fontColorState:Z,highlightColorState:oe,fontFaces:Y,onFontDialogTabChange:Q,onFontDialogClose:ie,onApplyFontProperties:de,paragraphDialog:te,customBackgroundImagePicker:E,disableBuiltinBackgroundImageSources:re,onParagraphCustomImagePick:pe,onParagraphDialogTabChange:F,onParagraphDialogClose:Ee,onApplyParagraphProperties:He,customCssDialog:ze,onCustomCssDialogClose:We,onApplyCustomCss:ot,pageDialog:it,enablePageProperties:Jt,onPageCustomImagePick:at,onPageDialogTabChange:q,onPageDialogClose:ae,onApplyPageProperties:ge,onPageDialogResetAtRule:Le,deletePageConfirmOpen:Kt,onDeletePageConfirmClose:$t,onDeletePageConfirm:Ut,customStyleDialog:Pe,canDeleteCustomParagraphStyle:yn,customStyleBusy:xn,onCustomStyleDialogClose:Ir,onCustomStyleSave:jr,onCustomStyleDelete:Er,linkDialog:ye,onLinkDialogTabChange:Qt,onLinkDialogClose:Mr,onApplyLink:rr,bookmarkDialog:or,onBookmarkDialogClose:z,onApplyBookmark:J,imageDialogOpen:le,customImagePicker:Me,customAudioPicker:St,customVideoPicker:Cn,onImageDialogClose:Qe,onApplyImage:Oe,onImageDialogCustomPick:Ae,audioDialogOpen:$e,onAudioDialogClose:en,onApplyAudio:As,onAudioDialogCustomPick:gi,youtubeDialogOpen:Ts,onYoutubeDialogClose:st,onApplyYoutube:hi,onYoutubeDialogCustomPick:Pt,imageProperties:tn,onImagePropertiesTabChange:jn,onImagePropertiesClose:Rs,onApplyImageProperties:xo,tableDialogOpen:Ds,onTableDialogClose:bi,onApplyTable:En,tableProperties:nn,onTablePropertiesClose:Co,onApplyTableProperties:ir,cellProperties:H,onCellPropertiesClose:_t,onApplyCellProperties:yi,rowProperties:ar,onRowPropertiesClose:pt,onApplyRowProperties:sr}){const xi=pb({catalog:r,layout:o,commands:a,queries:s,queryRevisions:u,disabled:d,chromeLock:f});return i.jsxs(i.Fragment,{children:[t?i.jsx("div",{className:Ce.menuChrome,onPointerDownCapture:n,children:i.jsx(Yc,{...xi,menuVisible:!0,toolbarVisible:!1})}):null,h?i.jsx(nA,{open:!0,catalog:y,groups:b.iconGroups,settings:C,loading:x,busy:v,disabled:g,onChange:S,onReset:A,onClose:k}):null,T.open?i.jsx(fE,{open:!0,html:T.html,onClose:D}):null,R.open?i.jsx(QE,{open:!0,topicId:R.topicId,onTopicChange:M,onClose:P}):null,L?i.jsx(DE,{open:!0,onClose:U}):null,j.open?i.jsx(II,{open:!0,tab:j.tab,size:_.value,unit:_.unit,marks:K,fontFamily:G.value,fontFamilyMixed:G.mixed,fontColor:Z.value,fontColorMixed:Z.mixed,highlightColor:oe.value,highlightColorMixed:oe.mixed,fonts:Y,disabled:g,onTabChange:Q,onApply:de,onClose:ie}):null,te.open?i.jsx(ej,{open:!0,tab:te.tab,value:te.value,backgroundImage:te.backgroundImage,disabled:g,customImagePicker:E,disableBuiltinBackgroundImageSources:re,onCustomImagePick:pe,onTabChange:F,onApply:He,onClose:Ee}):null,ze.open?i.jsx(fj,{open:!0,value:ze.value,disabled:g,onApply:ot,onClose:We}):null,it.open?i.jsx(lj,{open:!0,tab:it.tab,initialParagraphTab:it.paragraphTab,value:it.value,fonts:Y,disabled:g,printTabVisible:Jt,customImagePicker:E,disableBuiltinBackgroundImageSources:re,onCustomImagePick:at,onTabChange:q,onApply:ge,onResetAtRule:Le,onClose:ae}):null,Kt?i.jsx(cj,{open:!0,disabled:g,onClose:$t,onConfirm:Ut}):null,Pe.open?i.jsx(mj,{open:!0,mode:Pe.mode,styleId:Pe.mode==="edit"?Pe.style.id:void 0,name:Pe.mode==="edit"?Pe.style.name:"",font:Pe.mode==="edit"?Pe.style.font:Pe.font,paragraph:Pe.mode==="edit"?Pe.style.paragraph:Pe.paragraph,canDelete:yn,fonts:Y,busy:xn,disabled:g,onSave:jr,onDelete:Er,onClose:Ir}):null,ye.open?i.jsx(Mj,{open:!0,tab:ye.tab,href:ye.href,title:ye.title,targetBlank:ye.targetBlank,textDecorationNone:ye.textDecorationNone,hoverMode:ye.hoverMode,hoverColor:ye.hoverColor,hoverHtml:ye.hoverHtml,bookmarks:ye.bookmarks,selectedBookmarkId:ye.selectedBookmarkId,disabled:g,onTabChange:Qt,onApply:rr,onClose:Mr}):null,or.open?i.jsx(gj,{open:!0,existingIds:or.existingIds,disabled:g,onApply:J,onClose:z}):null,le?i.jsx(xj,{open:!0,disabled:g,customImagePicker:Me,onApply:Oe,onCustomPick:Ae,onClose:Qe}):null,$e?i.jsx(yj,{open:!0,disabled:g,customAudioPicker:St,onApply:As,onCustomPick:gi,onClose:en}):null,Ts?i.jsx(_j,{open:!0,disabled:g,customVideoPicker:Cn,onApply:hi,onCustomPick:Pt,onClose:st}):null,tn.open?i.jsx(Ej,{open:!0,tab:tn.tab,value:tn.value,aspectRatio:tn.aspectRatio,disabled:g,onTabChange:jn,onApply:xo,onClose:Rs}):null,Ds?i.jsx(zj,{open:!0,disabled:g,onApply:En,onClose:bi}):null,nn.open?i.jsx(Vj,{open:!0,value:nn.value,disabled:g,onApply:ir,onClose:Co}):null,H.open?i.jsx(Jj,{open:!0,value:H.value,disabled:g,onApply:yi,onClose:_t}):null,ar.open?i.jsx(nE,{open:!0,value:ar.value,disabled:g,onApply:sr,onClose:pt}):null]})},eM);function nM({toolbarVisible:e,toolbarPos:t,captureChromeSelection:n,toolbarShellProps:r,children:o}){return i.jsxs("div",{className:Ce.body,"data-icon-dock":e?t:void 0,children:[e&&(t==="top"||t==="left")?i.jsx("div",{className:Ce.iconChrome,onPointerDownCapture:n,children:i.jsx(Yc,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null,o,e&&(t==="bottom"||t==="right")?i.jsx("div",{className:Ce.iconChrome,onPointerDownCapture:n,children:i.jsx(Yc,{...r,menuVisible:!1,toolbarVisible:!0,position:t})}):null]})}const gb=l.createContext(null);function rM({value:e,children:t}){return i.jsx(gb.Provider,{value:e,children:t})}function oM(){const e=l.useContext(gb);if(!e)throw new Error("useEditorShellContext must be used within EditorShellProvider");return e}function iM(e,t){const n=l.useRef([]),r=l.useRef([]);return l.useMemo(()=>{const o=n.current,a=r.current,s=[];for(let u=0;u<e.length;u+=1){const d=e[u]??"";o[u]===d&&a[u]!==void 0?s.push(a[u]):s.push(he(d).body)}return n.current=e,r.current=s,s},[e,t,e.length])}const aM="_panel_6xdnw_1",sM="_header_6xdnw_17",lM="_title_6xdnw_26",cM="_close_6xdnw_32",uM="_messages_6xdnw_48",dM="_empty_6xdnw_57",mM="_message_6xdnw_48",fM="_messageHeader_6xdnw_69",pM="_author_6xdnw_77",gM="_time_6xdnw_81",hM="_body_6xdnw_86",bM="_reply_6xdnw_92",yM="_input_6xdnw_100",xM="_post_6xdnw_111",yt={panel:aM,header:sM,title:lM,close:cM,messages:uM,empty:dM,message:mM,messageHeader:fM,author:pM,time:gM,body:hM,reply:bM,input:yM,post:xM};function CM(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function wM({thread:e,locale:t,disabled:n,commentAuthor:r,panelRef:o,onPost:a,onClose:s}){const u=X(),[d,f]=l.useState(""),g=l.useRef(null);l.useEffect(()=>{var x;(x=g.current)==null||x.focus()},[e==null?void 0:e.id]);const h=!n&&r&&d.trim().length>0,y=l.useMemo(()=>(e==null?void 0:e.messages)??[],[e==null?void 0:e.messages]),b=y.length===0?u("commentPlaceholder"):u("commentReplyPlaceholder");if(!e)return null;const C=()=>{const x=d.trim();!x||!h||(a(x),f(""))};return Xc.createPortal(i.jsxs("div",{ref:o,className:yt.panel,role:"dialog","aria-label":u("commentPanelTitle"),children:[i.jsxs("div",{className:yt.header,children:[i.jsx("h2",{className:yt.title,children:u("commentPanelTitle")}),i.jsx("button",{type:"button",className:yt.close,onClick:s,"aria-label":u("commentPanelCloseAria"),children:i.jsx(Je,{})})]}),i.jsx("div",{className:yt.messages,children:y.length===0?i.jsx("p",{className:yt.empty,children:u("commentEmpty")}):y.map(x=>i.jsxs("article",{className:yt.message,children:[i.jsxs("header",{className:yt.messageHeader,children:[i.jsx("span",{className:yt.author,children:x.userName}),i.jsx("time",{className:yt.time,dateTime:x.createdAt,children:CM(x.createdAt,t)})]}),i.jsx("p",{className:yt.body,children:x.message})]},x.id))}),i.jsxs("div",{className:yt.reply,children:[i.jsx("textarea",{ref:g,className:yt.input,value:d,onChange:x=>f(x.target.value),placeholder:b,rows:3,disabled:n||!r}),i.jsx("button",{type:"button",className:yt.post,onClick:C,disabled:!h,children:u("commentPost")})]})]}),document.body)}const vM=l.forwardRef(function({html:t,onChange:n,placeholder:r,disabled:o},a){const s=X();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})}),kM="_shell_yvznc_1",SM="_scrollButton_yvznc_10",PM="_tabList_yvznc_48",AM="_tab_yvznc_48",TM="_tabActive_yvznc_86",Yr={shell:kM,scrollButton:SM,tabList:PM,tab:AM,tabActive:TM},RM=5,qf=120;function DM({pageCount:e,activeIndex:t,onSelect:n}){const r=X(),o=l.useRef(null),[a,s]=l.useState(!1),[u,d]=l.useState(!1),f=e>=RM,g=l.useCallback(()=>{const b=o.current;if(!b)return;const{scrollLeft:C,scrollWidth:x,clientWidth:v}=b;s(C>1),d(C+v<x-1)},[]);l.useEffect(()=>{g()},[e,t,g]),l.useEffect(()=>{var x;const b=o.current;if(!b)return;const C=b.querySelector(`[data-page-tab="${t}"]`);(x=C==null?void 0:C.scrollIntoView)==null||x.call(C,{block:"nearest",inline:"nearest"}),g()},[t,g]),l.useEffect(()=>{const b=o.current;if(!b)return;const C=()=>g();if(b.addEventListener("scroll",C,{passive:!0}),typeof ResizeObserver>"u")return()=>{b.removeEventListener("scroll",C)};const x=new ResizeObserver(()=>g());return x.observe(b),()=>{b.removeEventListener("scroll",C),x.disconnect()}},[g]);const h=b=>{var C;(C=o.current)==null||C.scrollBy({left:b,behavior:"smooth"})},y=b=>r("htmlModePageTab").replace("{n}",String(b+1));return i.jsxs("div",{className:Yr.shell,children:[f?i.jsx("button",{type:"button",className:Yr.scrollButton,"aria-label":r("htmlModePageTabsScrollLeftAria"),disabled:!a,onClick:()=>h(-qf),children:"‹"}):null,i.jsx("div",{ref:o,className:Yr.tabList,role:"tablist","aria-label":r("htmlModePageTabsAria"),children:Array.from({length:e},(b,C)=>i.jsx("button",{type:"button",role:"tab","data-page-tab":C,className:`${Yr.tab} ${C===t?Yr.tabActive:""}`,"aria-selected":C===t,tabIndex:C===t?0:-1,onClick:()=>n(C),children:y(C)},C))}),f?i.jsx("button",{type:"button",className:Yr.scrollButton,"aria-label":r("htmlModePageTabsScrollRightAria"),disabled:!u,onClick:()=>h(qf),children:"›"}):null]})}function IM(e,t,n=!0){const[r,o]=l.useState(null),[a,s]=l.useState($u()),u=l.useCallback(()=>{!n||!e||(o(ib(e,t)),s(as(e)))},[n,e,t]);return l.useLayoutEffect(()=>{if(!n)return;const d=requestAnimationFrame(u);return()=>cancelAnimationFrame(d)},[n,u]),l.useLayoutEffect(()=>{if(!n||!e||typeof ResizeObserver>"u")return;const d=new ResizeObserver(()=>u());return d.observe(e),()=>d.disconnect()},[n,e,u]),l.useLayoutEffect(()=>{if(!n||!e)return;const d=()=>{s(as(e))};return document.addEventListener("selectionchange",d),()=>document.removeEventListener("selectionchange",d)},[n,e]),{geometry:r,indentState:a,refresh:u}}const jM=l.forwardRef(function({html:t,pageHtml:n,onChange:r,placeholder:o,disabled:a,rulerVisible:s=!0,rulerUnit:u="in",zoomScale:d=1,onMarginChange:f,onMarginPreview:g,onIndentChange:h,onBeforeInput:y,propSyncGuardRef:b,resolveEmbeddedImageDataUrl:C,hydrateEmbeddedImages:x,onPointerDown:v,onMouseUp:k,onContextMenu:S},A){const T=X(),D=l.useRef(null),R=l.useRef(!1),[P,M]=l.useState(null),L=l.useRef(y);L.current=y;const U=n??t,j=s&&ci(U),{geometry:_,indentState:K,refresh:G}=IM(P,U,j),Z=Y=>{D.current=Y,M(Y),typeof A=="function"?A(Y):A&&(A.current=Y)};l.useLayoutEffect(()=>{const Y=D.current;if(!Y)return;const Q=dn(t),de=Y===document.activeElement&&R.current;if(R.current=!1,de||ns(Y,Q,{resolveDataUrl:C,hydrateEmbeddedImages:x}),ct(Y)||ci(U)){vu(Y),si(Y),xs(Y);const te=ct(Y);te&&Qp(Y,te)}ys(Y),bo(Y,U)},[t,U,C,x]),l.useLayoutEffect(()=>{if(b)return b.current=()=>{R.current=!0},()=>{b.current=null}},[b]),l.useLayoutEffect(()=>{const Y=D.current;if(!Y)return;const Q=ie=>{var de;(de=L.current)==null||de.call(L,ie)};return Y.addEventListener("beforeinput",Q),()=>Y.removeEventListener("beforeinput",Q)},[]);const oe=i.jsx("div",{ref:Z,className:`${Ce.surface} ${Ce.visual} ${j?Ce.pageSurface:""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":T("visualEditorAria"),"aria-disabled":a||void 0,"data-placeholder":o,onPointerDown:v,onMouseUp:k,onContextMenu:S,onInput:Y=>{const Q=Y.currentTarget;if(R.current=!0,ct(Q)){const{absorbedBlocks:ie}=si(Q);if(r(Q.innerHTML),ie.length>0){const de=ie.length;requestAnimationFrame(()=>rg(Q,de))}}else r(Q.innerHTML);j&&G()}});return i.jsx(hI,{showRulers:j,geometry:_,indentState:K,rulerUnit:u,zoomScale:d,onMarginChange:f,onMarginPreview:g,onIndentChange:h,children:oe})}),EM="_frame_bwkh8_1",MM="_handle_bwkh8_9",_M="_handleEast_bwkh8_29",NM="_handleSouth_bwkh8_37",LM="_handleSouthEast_bwkh8_45",ti={frame:EM,handle:MM,handleEast:_M,handleSouth:NM,handleSouthEast:LM};function Uo(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}const BM=[{handle:"e",className:ti.handleEast,cursor:"e-resize",ariaKey:"imageResizeHandleEastAria"},{handle:"s",className:ti.handleSouth,cursor:"s-resize",ariaKey:"imageResizeHandleSouthAria"},{handle:"se",className:ti.handleSouthEast,cursor:"se-resize",ariaKey:"imageResizeHandleSouthEastAria"}];function mc(e){return!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY)?null:{x:e.clientX,y:e.clientY}}function FM({img:e,onResize:t,onResizeEnd:n}){const r=X(),o=l.useRef(null),a=l.useRef(e),s=l.useRef(t),u=l.useRef(n),d=l.useRef(null);a.current=e,s.current=t,u.current=n;const f=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`)};l.useLayoutEffect(()=>{f(Uo(e));const k=()=>{e.isConnected&&f(Uo(e))};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[e]);const g=(k,S)=>{const A=d.current,T=a.current;if(!A||!T)return;const D=M0(A.handle,A.start,{x:k-A.originX,y:S-A.originY});s.current(D.width,D.height),T.isConnected&&f(Uo(T))},h=()=>{if(!d.current)return;d.current=null;const k=a.current;u.current(),k!=null&&k.isConnected&&f(Uo(k))};l.useLayoutEffect(()=>{const k=A=>{if(!d.current)return;const T=mc(A);T&&g(T.x,T.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 y=(k,S)=>{const A=mc(S);A&&(d.current={handle:k,start:_0(a.current),originX:A.x,originY:A.y})},b=k=>S=>{S.preventDefault(),S.stopPropagation(),y(k,S);try{S.currentTarget.setPointerCapture(S.pointerId)}catch{}},C=k=>S=>{S.preventDefault(),S.stopPropagation(),y(k,S)},x=k=>{const S=mc(k);S&&g(S.x,S.y)};if(!e.isConnected)return null;const v=Uo(e);return Xc.createPortal(i.jsx("div",{ref:o,className:ti.frame,"data-image-resize-overlay":"",style:{left:v.left,top:v.top,width:v.width,height:v.height},children:BM.map(k=>i.jsx("button",{type:"button",className:`${ti.handle} ${k.className}`,style:{cursor:k.cursor},"aria-label":r(k.ariaKey),"data-resize-handle":k.handle,onPointerDown:b(k.handle),onPointerMove:x,onPointerUp:h,onPointerCancel:h,onMouseDown:C(k.handle),onMouseMove:x,onMouseUp:h},k.handle))}),document.body)}function HM(e,t){for(const n of Object.keys(e)){const r=e[n],o=t[n];if(!(typeof r=="function"&&typeof o=="function")&&r!==o)return!1}return!0}function zM(){const e=X();return i.jsx("div",{className:Ce.htmlFileDropOverlay,"aria-hidden":"true",children:e("htmlFileDropOverlay")})}function OM({propsRef:e,pageStore:t,mode:n,enableMultiPages:r,contentLocked:o,activePageIndex:a,hasSelectedPage:s,pageZoomScale:u,rulerVisible:d,rulerUnit:f,optimizeEmbeddedImages:g,placeholder:h,controlledHtml:y,initialHtml:b,initialStorageHtml:C,defaultPages:x,ingestedPagesProp:v,onChange:k,fontFaces:S,enableComments:A,commentsVisible:T,disabled:D,locale:R,commentAuthor:P,activeThreadId:M,contextMenu:L,commentThreads:U,commands:j,htmlFileDropDragging:_,selectedImage:K}){const{htmlRef:G,pagesRef:Z,documentBridgeRef:oe}=oM(),[Y,Q]=l.useState(C),[ie,de]=Na({value:g?void 0:y,defaultValue:b,onChange:r||g?void 0:k}),te=g?Y:ie,[E,re]=l.useState(()=>r?x[0]??"":""),pe=l.useRef(E);pe.current=E;const F=e.current;g?r||(G.current=Y):G.current=ie,r&&(Z.current=t.pages);const Ee=l.useCallback(()=>r?t.getJoinedHtml():g?Y:ie,[r,ie,g,t,Y]);l.useLayoutEffect(()=>{const q={pageStore:t,setHtml:de,setStorageHtml:Q,getEditorHtml:Ee,replacePagesFromHistory:ae=>t.replacePages([...ae])};return oe.current=q,()=>{oe.current===q&&(oe.current=null)}},[oe,Ee,t,de,Q]);const He=l.useMemo(()=>{if(r){const q=t.pages[a]??t.pages[0]??"";return Mm(q,S).join(`
|
|
319
319
|
`)}return Mm(te,S).join(`
|
|
320
320
|
`)},[r,t.pages,t.revision,a,te,S]),ze=iM(r?t.pages:[],r?t.revision:0);l.useLayoutEffect(()=>{var ae;if(!r)return;const q=(ae=e.current.multiPageVisualRef.current)==null?void 0:ae.getActivePageRoot();q instanceof HTMLDivElement&&(e.current.visualRootRef.current=q)},[r,a,ze.length,e]);const We=l.useMemo(()=>r?ze[s?a:0]??"":he(te).body,[r,ze,a,s,te]),ot=l.useMemo(()=>Yp(tt(We)),[We]);F.activePageHtmlRef.current=We,F.pageCanvasSizedRef.current=ot,l.useEffect(()=>{const ae=(He?He.split(`
|
|
321
|
-
`):[]).map(ge=>{const Le=document.createElement("link");return Le.rel="stylesheet",Le.href=ge,Le.setAttribute(us,""),document.head.append(Le),Le});return()=>{for(const ge of ae)ge.remove()}},[He]),l.useEffect(()=>{(!A||n!=="visual"||!T)&&e.current.setActiveThreadId(null)},[A,n,T,e]),l.useEffect(()=>{if(!M)return;const q=ae=>{var $t;const ge=e.current,Le=ae.target;if(($t=ge.commentPanelRef.current)!=null&&$t.contains(Le))return;const Kt=ge.visualRootRef.current;Kt&&yh(Kt,Le)||ge.setActiveThreadId(null)};return document.addEventListener("pointerdown",q),()=>document.removeEventListener("pointerdown",q)},[M,e]),l.useEffect(()=>{if(!r||n!=="html")return;const q=t.pages[a]??"";q!==pe.current&&(pe.current=q,re(q))},[r,n,t.pages,t.revision,a]),l.useEffect(()=>{if(!A||n!=="visual")return;const q=e.current.visualRootRef.current;q&&(vS(q,U),bh(q,T))},[A,n,U,T,te,e]),F.htmlModePageHtmlRef.current=pe.current;const it=n==="visual"&&d&&ot,Jt=l.useMemo(()=>M?AS(U,M):null,[M,U]),at=n==="visual"?r?i.jsx(xI,{ref:F.multiPageVisualRef,pages:ze,activePageIndex:a,hasSelectedPage:s,scrollRootRef:F.workspaceRef,suppressPageFlushRef:F.suppressPageFlushRef,pendingInsertPageFocusRef:F.pendingInsertPageFocusRef,onActivePageIndexChange:q=>{var Le;F.activePageIndexRef.current=q,F.setActivePageIndex(q);const ae=(Le=F.multiPageVisualRef.current)==null?void 0:Le.getContainer(),ge=ae?Ye(ae,q):null;ge instanceof HTMLDivElement&&(F.visualRootRef.current=ge)},onPageSelected:()=>{F.setHasSelectedPage(!0)},onPageChange:(q,ae)=>{const ge=Z.current[q]??"";F.recordPageVisualHtml(q,cn(ae,he(ge).body),!0)},onPageFlush:(q,ae)=>{const ge=Z.current[q]??"";F.recordPageVisualHtml(q,cn(ae,he(ge).body),!1)},onBeforeInput:F.handleVisualBeforeInput,onPointerDown:q=>{if(q.currentTarget instanceof HTMLDivElement&&(F.visualRootRef.current=q.currentTarget),F.handleVisualPointerDown(q),q.currentTarget instanceof HTMLDivElement){const ae=q.currentTarget;requestAnimationFrame(()=>so(ae))}},onMouseUp:F.handleVisualMouseUp,onContextMenu:F.handleVisualContextMenu,placeholder:h,disabled:o,rulerVisible:d,rulerUnit:f,zoomScale:u,onMarginPreview:F.multiPageRulerMarginPreview,onMarginChange:F.multiPageRulerMarginChange,onIndentChange:F.multiPageRulerIndentChange,resolveEmbeddedImageDataUrl:g?F.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:g?F.hydrateExportHtml:void 0}):i.jsx(jM,{ref:F.visualRootRef,html:he(te).body,pageHtml:te,rulerVisible:d,rulerUnit:f,zoomScale:u,propSyncGuardRef:F.visualPropSyncGuardRef,resolveEmbeddedImageDataUrl:g?F.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:g?F.hydrateExportHtml:void 0,onMarginPreview:F.singlePageRulerMarginPreview,onMarginChange:F.singlePageRulerMarginChange,onIndentChange:F.singlePageRulerIndentChange,onChange:q=>F.recordVisualInputHtml(q,!0),onBeforeInput:F.handleVisualBeforeInput,onPointerDown:q=>{if(F.handleVisualPointerDown(q),q.currentTarget instanceof HTMLDivElement){const ae=q.currentTarget;requestAnimationFrame(()=>so(ae))}},onMouseUp:F.handleVisualMouseUp,onContextMenu:F.handleVisualContextMenu,placeholder:h,disabled:o}):i.jsxs("div",{className:Ce.htmlModeShell,children:[r&&t.pages.length>1?i.jsx(DM,{pageCount:t.pages.length,activeIndex:a,onSelect:F.handleHtmlPageTabSelect}):null,i.jsx(vM,{ref:F.htmlAreaRef,html:r?E:te,onChange:F.handleHtmlSurfaceChange,placeholder:h,disabled:o})]});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{ref:F.workspaceRef,className:`${Ce.workspace} ${ot?Ce.workspacePageSized:""} ${it?Ce.workspaceWithRuler:""}`,onDragEnter:F.htmlFileDrop.onDragEnter,onDragOver:F.htmlFileDrop.onDragOver,onDragLeave:F.htmlFileDrop.onDragLeave,onDrop:F.htmlFileDrop.onDrop,children:[n==="visual"?i.jsx("div",{className:Ce.pageCanvasViewport,"data-page-canvas-sized":ot?"":void 0,children:at}):at,F.htmlFileDrop.dragging?i.jsx(zM,{}):null]}),n==="visual"&&!o&&(O!=null&&O.isConnected)?i.jsx(FM,{img:O,onResize:F.handleImageResize,onResizeEnd:F.handleImageResizeEnd}):null,A&&T&&Jt?i.jsx(wM,{panelRef:F.commentPanelRef,thread:Jt,locale:R,disabled:D,commentAuthor:P,onPost:F.postCommentMessage,onClose:()=>F.setActiveThreadId(null)}):null,i.jsx(mx,{open:L.open,x:L.x,y:L.y,kind:L.kind,inTable:L.inTable,canMergeCells:L.canMergeCells,canUnmergeCells:L.canUnmergeCells,canDeletePage:L.canDeletePage,canAddComment:L.canAddComment,commands:j,onClose:()=>F.setContextMenu(q=>({...q,open:!1}))})]})}const KM=l.memo(OM,HM),$M=.005;function UM({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:o,onOpen:a,mode:s,defaultMode:u="visual",onModeChange:d,fullscreen:f,defaultFullscreen:g=!1,onFullscreenChange:h,placeholder:y,disabled:b,readOnly:C=!1,className:x,locale:v="en",toolbarBackground:k,menuColor:S,menuBackground:A,menuFontSize:T,menuFontFamily:D,border:R,menuVisible:P=!0,toolbarVisible:M=!0,allowedChrome:L,customActions:U,customFonts:j,transformHtml:_,sanitizeHtml:O=!0,loadCustomParagraphStyles:G,onSaveCustomParagraphStyle:Z,onDeleteCustomParagraphStyle:oe,customImagePicker:Y,disableBuiltinImageInsert:J,customBackgroundImagePicker:ie,disableBuiltinBackgroundImageInsert:de,disableBuiltinBackgroundImageSources:te,customAudioPicker:E,disableBuiltinAudioInsert:re,customVideoPicker:pe,disableBuiltinVideoInsert:F,disableHtmlFileDrop:Ee=!1,toolbarCustomization:He,darkMode:ze=!1,darkModePersistence:We,toolbarPosition:ot="top",toolbarPositionPersistence:it,enablePageProperties:Jt=!1,defaultPageProperties:at,optimizeEmbeddedImages:q=!1,enableMultiPages:ae=!1,pages:ge,defaultPages:Le,onPagesChange:Kt,defaultRulerVisible:$t=!0,rulerUnit:Ut="in",enableComments:Pe=!1,defaultCommentsVisible:yn=!0,commentAuthor:xn,comments:Dr,defaultComments:Ir=[],onCommentsChange:jr}){var Sm;const ye=!!(b||C),Qt=!!b,Er=ae?ge!==void 0:e!==void 0,rr=$n(Le??(t.trim()?[t]:[zn()])),or=!Er&&at?rr.map(c=>pf(c,at)):rr,z=l.useRef(null);q&&z.current===null&&(z.current=pw());const Q=l.useRef(null);Q.current===null&&(Q.current=q&&z.current?or.map(c=>z.current.externalizeHtml(c)):[...or]);const le=ae?jt(Q.current):Q.current[0]??"",Me=O?Yr(le):le,St=ae&&ge!==void 0?jt($n(ge)):e,Cn=l.useMemo(()=>{if(St!==void 0)return O?Yr(St):St},[St,O]),Qe=l.useRef(n);Qe.current=n;const Oe=l.useRef(q);Oe.current=q;const Ae=l.useCallback(c=>!Oe.current||!z.current?c:z.current.externalizeHtml(c),[]),$e=l.useCallback(c=>!Oe.current||!z.current?c:z.current.hydrateHtml(c),[]),en=l.useCallback(c=>c.map(m=>$e(m)),[$e]),Ps=l.useCallback(c=>{var m;return((m=z.current)==null?void 0:m.getDataUrl(c))??null},[]),pi=l.useCallback(c=>{var m;(m=Qe.current)==null||m.call(Qe,$e(c))},[$e]),[As]=l.useState(()=>{if(q&&e!==void 0&&!ae){const c=O?Yr(e):e;return z.current?z.current.externalizeHtml(c):c}return Me}),[st,gi]=_a({value:s,defaultValue:u,onChange:d}),[Pt,tn]=_a({value:f,defaultValue:g,onChange:h}),[jn,Ts]=l.useState(yn),[yo,Rs]=l.useState($t),hi=l.useRef(yo);hi.current=yo;const[En,nn]=l.useState(null),[xo,ir]=_a({value:Dr,defaultValue:Ir,onChange:jr}),H=l.useRef(null),_t=l.useRef(null),bi=l.useRef(null),ar=l.useRef(null),pt=l.useRef(null),sr=l.useRef(!1),yi=l.useRef(null),At=l.useRef(null),we=l.useRef(ae);we.current=ae;const Ds=l.useRef(at);Ds.current=at;const Mn=l.useRef(Pe);Mn.current=Pe;const Gu=l.useRef(C);Gu.current=C;const Zu=l.useRef(ye);Zu.current=ye;const xi=l.useRef(jn);xi.current=jn;const Ci=l.useRef(xo);Ci.current=xo;const wi=l.useRef(Kt);wi.current=Kt;const vi=l.useRef(null),ki=l.useRef(!1),Si=l.useCallback(()=>{var m;ki.current=!1;const c=vi.current;vi.current=null,c&&((m=wi.current)==null||m.call(wi,c.pages,c.activePageIndex))},[]),Mr=l.useCallback((c,m)=>{vi.current={pages:[...c],activePageIndex:m},!ki.current&&(ki.current=!0,queueMicrotask(Si))},[Si]),Is=l.useRef(ge);Is.current=ge;const qu=l.useMemo(()=>!q||ge===void 0?ge:$n(ge).map(c=>{var w;const m=O?Yr(c):c;return((w=z.current)==null?void 0:w.externalizeHtml(m))??m}),[q,ge,O]),ut=pP({enabled:ae,pagesProp:qu,defaultPages:Q.current??[zn()]}),_r=l.useRef(null),Yu=l.useRef(null),[Nr,Co]=l.useState(0),Te=l.useRef(Nr);Te.current=Nr;const wn=l.useRef(ae?((Sm=Q.current)==null?void 0:Sm[0])??"":""),[wo,lr]=l.useState(!1),Vt=l.useRef(wo);Vt.current=wo;const[Xu,gb]=l.useState(0),Ju=l.useRef(!1),Qu=l.useRef(!1),Tt=l.useMemo(()=>eD(),[]),js=l.useRef(null);js.current===null&&(js.current=ae?AP(Q.current??[zn()]):PP(Ae(Me)));const ne=js.current,rn=l.useCallback(()=>{const c=ne.canUndo(),m=ne.canRedo();c===Ju.current&&m===Qu.current||(Ju.current=c,Qu.current=m,gb(w=>w+1))},[ne]),ce=l.useRef(Me),Ne=l.useRef(Q.current??[zn()]);ae&&(Ne.current=ut.pages);const ed=l.useRef(""),td=l.useRef(!1),Wt=l.useRef(!0),Lr=l.useRef(""),Br=l.useRef(null),B=l.useRef(st);B.current=st;const nd=l.useRef(Pt);nd.current=Pt;const Ge=l.useRef(null),[,hb]=l.useState(0),vo=l.useRef(null);vo.current===null&&(vo.current=HS(()=>{hb(c=>c+1)}));const Pi=l.useRef(_);Pi.current=_;const rd=l.useRef(O);rd.current=O;const Nt=l.useRef({}),Rt=l.useRef(null),Lt=l.useRef(null),Gt=l.useRef(null),Zt=l.useRef(null),_n=l.useRef(null),Dt=l.useRef(null),[ko,Es]=l.useState(Wn),Ms=l.useRef(ko);Ms.current=ko;const vn=l.useRef(ro),[So,Ai]=l.useState({value:null,unit:ro,mixed:!1}),Nn=l.useRef(So);Nn.current=So;const[Po,_s]=l.useState({value:null,mixed:!1}),Ao=l.useRef(Po);Ao.current=Po;const[To,Ns]=l.useState({value:null,mixed:!1}),Ro=l.useRef(To);Ro.current=To;const[Do,Ls]=l.useState({value:null,mixed:!1}),Io=l.useRef(Do);Io.current=Do;const[Ti,Bs]=l.useState({tag:null,mixed:!1}),Fs=l.useRef(Ti);Fs.current=Ti;const[od,Hs]=l.useState({align:"left",mixed:!1}),zs=l.useRef(od);zs.current=od;const[id,Os]=l.useState({type:null,mixed:!1}),jo=l.useRef(id);jo.current=id;const[ad,Ks]=l.useState(!1),sd=l.useRef(ad);sd.current=ad;const[Ri,$s]=l.useState(!1),Us=l.useRef(Ri);Us.current=Ri;const[Di,ld]=l.useState(!1),Ii=l.useRef(Di);Ii.current=Di;const ji=l.useRef(null),Ei=l.useRef(null),[cd,ud]=l.useState(!1),dd=l.useRef(cd);dd.current=cd;const{fontDialog:Mi,setFontDialog:_i,customizeToolbarOpen:Vs,setCustomizeToolbarOpen:md,documentPreview:Ni,setDocumentPreview:fd,toolbarSettings:Ws,setToolbarSettings:Li,toolbarSettingsLoading:bb,setToolbarSettingsLoading:Gs,toolbarSettingsBusy:yb,setToolbarSettingsBusy:Zs,paragraphDialog:Eo,setParagraphDialog:Fr,customCssDialog:qs,setCustomCssDialog:Ys,pageDialog:Mo,setPageDialog:cr,deletePageConfirmOpen:Xs,setDeletePageConfirmOpen:Js,customStyleDialog:xb,setCustomStyleDialog:_o,linkDialog:Qs,setLinkDialog:Bi,bookmarkDialog:pd,setBookmarkDialog:el,imageDialog:Cb,setImageDialog:Fi,audioDialog:wb,setAudioDialog:Hi,youtubeDialog:vb,setYoutubeDialog:No,imageProperties:kb,setImageProperties:zi,tableDialog:tl,setTableDialog:nl,tableProperties:rl,setTableProperties:ol,cellProperties:il,setCellProperties:al,rowProperties:sl,setRowProperties:ll,helpDialog:cl,setHelpDialog:Lo,aboutDialogOpen:ul,setAboutDialogOpen:gd}=fP(),[ur,Oi]=l.useState(()=>We?ze:If()??ze),[Hr,Ki]=l.useState(()=>it?ot:jf()??ot),[Bo,Sb]=l.useState(()=>xP()??"fitWidth"),[dl,Pb]=l.useState(1),[$i,hd]=l.useState([]),[Ui,ml]=l.useState(!1),[Ab,Vi]=l.useState(!1),[Tb,fl]=l.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1,canDeletePage:!1,canAddComment:!1}),[dt,zr]=l.useState(null),pl=l.useRef(dt);pl.current=dt;const[Wi,bd]=l.useState(!1),yd=l.useRef(Wi);yd.current=Wi;const[Gi,xd]=l.useState(!1),Cd=l.useRef(Gi);Cd.current=Gi;const[Zi,wd]=l.useState(!1),vd=l.useRef(Zi);vd.current=Zi;const kd=l.useRef(void 0),qi=l.useRef($i);qi.current=$i;const Sd=l.useRef(Ui);Sd.current=Ui;const Yi=!!(G&&Z),gl=l.useRef(Yi);gl.current=Yi;const Pd=l.useRef(G);Pd.current=G;const Ad=l.useRef(Z);Ad.current=Z;const Td=l.useRef(oe);Td.current=oe;const Rd=l.useRef(o);Rd.current=o;const Dd=l.useRef(a);Dd.current=a;const Id=l.useRef(Y);Id.current=Y;const kn=ie??Y,jd=de??J??!1,hl=te??J??!1,bl=l.useRef(kn);bl.current=kn;const yl=l.useRef(jd);yl.current=jd;const Rb=l.useRef(hl);Rb.current=hl;const Ed=l.useRef(E);Ed.current=E;const Md=l.useRef(pe);Md.current=pe;const _d=l.useRef(He);_d.current=He;const Nd=l.useRef(We);Nd.current=We;const Ld=l.useRef(it);Ld.current=it;const Bd=l.useRef(ur);Bd.current=ur;const Fd=l.useRef(Hr);Fd.current=Hr;const Xi=l.useRef(Bo);Xi.current=Bo;const Ji=l.useRef(dl);Ji.current=dl;const Hd=l.useRef(J);Hd.current=J;const zd=l.useRef(re);zd.current=re;const Od=l.useRef(F);Od.current=F;const xl=l.useRef(0),Fo=l.useRef(0),Kd=l.useRef(0),Qi=l.useRef(0),$d=l.useRef(0),ea=l.useRef(0),Ud=l.useRef(0),Or=l.useMemo(()=>dp(j),[j]),Kr=l.useRef(Or);Kr.current=Or;const ta=l.useCallback(()=>{var c;if(we.current){const m=(c=pt.current)==null?void 0:c.getActivePageRoot();if(m instanceof HTMLElement)return m}return H.current},[]),on=l.useCallback(()=>{var w;const c=H.current;if(c!=null&&c.hasAttribute(Pr)){const I=Vm(c);if(I!==null)return I}const m=(w=pt.current)==null?void 0:w.getActivePageIndex();return typeof m=="number"?m:Te.current},[]),Ho=l.useCallback(()=>{if(we.current){const c=pt.current;if(!c)return null;const m=on();if(m===null)return null;c.ensurePageMounted(m);const w=c.getContainer(),I=w?Ye(w,m):null;return I instanceof HTMLDivElement?(H.current=I,I):null}return H.current},[on]),$r=l.useCallback(()=>{if(!we.current)return ce.current;const c=on()??Te.current;return Ne.current[c]??""},[on]);l.useLayoutEffect(()=>{var m;if(!ae)return;const c=(m=pt.current)==null?void 0:m.getActivePageRoot();c instanceof HTMLDivElement&&(H.current=c)},[ae,Nr]);const na=l.useRef(()=>{}),Cl=l.useRef(!1),Db=l.useCallback(()=>{if(Cl.current||B.current!=="visual")return;const c=ar.current;if(c){Cl.current=!0;try{const m=getComputedStyle(c),w=parseFloat(m.paddingLeft)+parseFloat(m.paddingRight),I=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom),N=Math.max(0,c.clientWidth-w),V=Math.max(0,c.clientHeight-I);let ee=0,me=0;if(td.current){const xe=VC(tt(ed.current));xe&&(ee=xe.width,me=xe.height)}else{const xe=ta(),Ze=Ji.current>0?Ji.current:1;ee=((xe==null?void 0:xe.offsetWidth)??0)/Ze,me=((xe==null?void 0:xe.offsetHeight)??0)/Ze}ee<=0&&(ee=N),me<=0&&(me=V);const Re=tv(Xi.current,N,V,ee,me);Math.abs(Re-Ji.current)>=$M&&Pb(Re)}finally{Cl.current=!1}}},[ta]);na.current=Db,l.useLayoutEffect(()=>{if(st!=="visual")return;const c=ta();!c||c!==document.activeElement||so(c)},[st,Nr,ta]);const ra=l.useCallback(async()=>{const c=Pd.current;if(!c)return;const m=++xl.current;ml(!0);try{const w=await c();if(m!==xl.current)return;hd(w)}catch{}finally{m===xl.current&&ml(!1)}},[]);l.useEffect(()=>{if(!G||!Z){hd([]),ml(!1);return}ra()},[G,Z,ra]);const Vd=l.useCallback(async c=>{Li(c);const m=_d.current;if(m!=null&&m.load&&m.save){const w=++Kd.current;Zs(!0);try{await m.save(c)}catch{}finally{w===Kd.current&&Zs(!1)}return}EP(c)},[]);l.useEffect(()=>{const c=He;if(!(c!=null&&c.load)||!c.save){Li(jP()),Gs(!1),Zs(!1);return}const m=++Fo.current;return Gs(!0),(async()=>{try{const w=await c.load();if(m!==Fo.current)return;Li(w)}catch{if(m!==Fo.current)return;Li(null)}finally{m===Fo.current&&Gs(!1)}})(),()=>{Fo.current+=1}},[He]);const Wd=l.useCallback(async c=>{Oi(c);const m=Nd.current;if(m!=null&&m.load&&m.save){const w=++$d.current;try{await m.save(c)}catch{}finally{if(w!==$d.current)return}return}hP(c)},[]),Gd=l.useCallback(c=>{Xi.current=c,Sb(c),CP(c);const m=ar.current;m&&(m.scrollTop=0,m.scrollLeft=0),na.current()},[]);l.useEffect(()=>{const c=We;if(!(c!=null&&c.load)||!c.save){Oi(If()??ze);return}const m=++Qi.current;return(async()=>{try{const w=await c.load();if(m!==Qi.current)return;Oi(typeof w=="boolean"?w:ze)}catch{if(m!==Qi.current)return;Oi(ze)}})(),()=>{Qi.current+=1}},[We,ze]),l.useLayoutEffect(()=>{if(na.current(),st!=="visual")return;const c=ar.current;if(!c||typeof ResizeObserver>"u")return;const m=nv(()=>{na.current()}),w=new ResizeObserver(()=>{m.schedule()});return w.observe(c),()=>{w.disconnect(),m.cancel()}},[st,Nr,Bo,ae]);const Zd=l.useCallback(async c=>{Ki(c);const m=Ld.current;if(m!=null&&m.load&&m.save){const w=++Ud.current;try{await m.save(c)}catch{}finally{if(w!==Ud.current)return}return}vP(c)},[]);l.useEffect(()=>{const c=it;if(!(c!=null&&c.load)||!c.save){Ki(jf()??ot);return}const m=++ea.current;return(async()=>{try{const w=await c.load();if(m!==ea.current)return;Ki(Fh(w)??ot)}catch{if(m!==ea.current)return;Ki(ot)}})(),()=>{ea.current+=1}},[it,ot]);const Ur=l.useCallback((c,m)=>{var me,Re;const w=rd.current?Yr(c):c,I=((me=Pi.current)==null?void 0:me.call(Pi,w))??w,N=vh(ce.current,I,$e);m!=null&&m.fullReplace&&!N&&Oe.current&&((Re=z.current)==null||Re.clear());const V=Ae(I);if(N)return ce.current=V,{stored:V,stateUpdated:!1};V!==ce.current&&(Wt.current=!0);const ee=_r.current;if(we.current){const xe=ut;if(!xe)return ce.current=V,{stored:V,stateUpdated:!1};const Ze=xe.replacePages(Un(V));return ce.current=Ze.joined,Ne.current=Ze.pages,B.current==="html"&&!Oe.current&&(ee==null||ee.setHtml(V)),Mr(en(Ze.pages),Te.current),{stored:V,stateUpdated:!0}}return Oe.current?(ce.current=V,ee==null||ee.setStorageHtml(V),pi(V),{stored:V,stateUpdated:!0}):(ce.current=V,ee==null||ee.setHtml(V),{stored:V,stateUpdated:!0})},[Ae,$e,en,pi,Mr]),an=l.useCallback((c,m,w,I)=>{var me;const N=c.map(Re=>Ae(Re)),V=ut;if(!V)return jt(N);const ee=V.setPages(N,{editedIndex:w});if(!ee.changed)return ee.joined;if(Ne.current=ee.pages,Wt.current=!0,ce.current=ee.joined,Is.current===void 0&&B.current==="html"&&!Oe.current&&((me=_r.current)==null||me.setHtml(ee.joined)),Mr(en(ee.pages),Te.current),!(I!=null&&I.skipHistory)&&Bt(ne)){const{changedIndices:Re,pages:xe}=ee;if(Re.length===1){const Ze=w??Re[0];ne.recordPageEdit(Ze,xe[Ze]??"",{coalesce:m})}else Re.length>1?ne.recordReplaceAll(xe):w!==void 0?ne.recordPageEdit(w,xe[w]??"",{coalesce:m}):ne.recordReplaceAll(xe)}return rn(),ee.joined},[rn,Ae,en,ne,ut,Mr]),Ln=l.useCallback(c=>{var V,ee;if(B.current!=="visual")return;const m=Oe.current?me=>{var Re;return((Re=z.current)==null?void 0:Re.getDataUrl(me))??null}:void 0,w=Oe.current?$e:void 0;if((V=_t.current)==null||V.call(_t),we.current){const me=(ee=pt.current)==null?void 0:ee.getContainer();if(!me)return;const Re=Un(c);for(let xe=0;xe<Re.length;xe+=1){const Ze=Ye(me,xe);if(!Ze)continue;const mt=dn(he(Re[xe]??"").body);ts(Ze,mt,{resolveDataUrl:m,hydrateEmbeddedImages:w})}return}const I=H.current;if(!I)return;const N=dn(he(c).body);ts(I,N,{resolveDataUrl:m,hydrateEmbeddedImages:w})},[$e]),gt=l.useCallback((c,m)=>{const{stored:w,stateUpdated:I}=Ur(c,{fullReplace:!m});return!m&&I&&Ln(w),Bt(ne)?ne.recordReplaceAll(Un(w)):ne.record(w,{coalesce:m}),rn(),w},[rn,Ur,ne,Ln]),Ib=l.useCallback(c=>{if(we.current){const m=Te.current,I=Ne.current.slice();I[m]=c,an(I,!1,m);return}gt(c,!1)},[an,gt]),qd=kP({enabled:!ye&&!Ee,onHtml:Ib}),be=l.useCallback((c,m)=>{var w;return(w=_t.current)==null||w.call(_t),gt(Ca(c,wa(c,ce.current,Kr.current,{liveRoot:H.current??void 0})),m)},[gt]),jb=l.useCallback((c,m)=>be(cn(c,ce.current),m),[be]),oa=l.useCallback((c,m,w)=>{XC(c,m,w)},[]),ia=l.useCallback((c,m,w)=>{const I={...Wo(c),atRule:tt(Jp(m,w))};return Hc(c,I)},[]),dr=l.useCallback((c,m,w)=>Ca(c,wa(c,m,Kr.current,{liveRoot:w})),[]),ht=l.useCallback(c=>{const m=pt.current,w=m==null?void 0:m.getContainer(),I=ut.pages.length>0?ut.pages:Ne.current;if(!w)return[...I];const N=ut;if(!N)return[...I];const V=N.dirtyPagesRef.current,ee=(c==null?void 0:c.allPages)===!0,me=Te.current;let Re=!1;const xe=I.map((mt,Gr)=>{if(!(ee||V.has(Gr)||Gr===me))return mt;const ba=Ye(w,Gr);let ya=null;if(ba?(ys(ba),ya=ba.innerHTML):ya=m.flushPageHtml(Gr),ya===null){const Tm=dn(he(mt).body),Rm=rf(Tm);if(Rm===Tm)return mt;const Dm=dr(cn(Rm,he(mt).body),mt);return Dm!==mt&&(Re=!0),Dm}const ty=cn(ya,he(mt).body),Am=dr(ty,mt,ba??void 0);return Am!==mt&&(Re=!0),Am});if(Re){const mt=Oe.current?xe.map(Pm=>Ae(Pm)):xe,Gr=N.setPages(mt);ce.current=Gr.joined}N.markPagesClean();const Ze=Re?N.pages:I;return Oe.current?Ze.map(mt=>Ae(mt)):[...Ze]},[Ae,ut,dr]),mr=l.useCallback((c,m,w)=>{const I=dr(m,Ne.current[c]??""),N=vc(Ne.current,c,I);N.changed&&an(N.pages,w,c)},[an,dr]),fr=l.useCallback((c,m,w)=>{const I=Ne.current[c]??"",N=he(m).body,V=rf(N),ee=V===N?m:dr(cn(V,he(I).body),I),me=vc(Ne.current,c,ee);me.changed&&an(me.pages,w,c)},[an,dr]),Yd=l.useCallback((c,m)=>{const w=he(c).body;we.current?mr(Te.current,w,m):be(w,m)},[mr,be]),ue=l.useCallback((c,m,w)=>{var ee;const I=w?he(w).body:c.innerHTML,N=me=>w?I:cn(I,he(me).body);if(!we.current){be(N(ce.current),m);return}const V=(ee=pt.current)==null?void 0:ee.getContainer();if(!V){be(N(ce.current),m);return}for(let me=0;me<Ne.current.length;me+=1)if(Ye(V,me)===c){mr(me,N(Ne.current[me]??""),m);return}be(N(ce.current),m)},[mr,be]),Xd=l.useCallback((c,m)=>{Gu.current||ue(c,m)},[ue]),Eb=l.useMemo(()=>CI(()=>H.current,()=>ce.current,oa),[oa]),Mb=l.useMemo(()=>wI(()=>H.current,()=>ce.current,ia,c=>be(he(c).body,!1)),[ia,be]),_b=l.useMemo(()=>Kf(()=>H.current,Ut??"in",c=>ue(c,!1)),[Ut,ue]),Nb=l.useMemo(()=>vI(c=>{var w;const m=(w=pt.current)==null?void 0:w.getContainer();return m?Ye(m,c):null},c=>Ne.current[c]??"",oa),[oa]),Lb=l.useMemo(()=>kI(c=>{var w;const m=(w=pt.current)==null?void 0:w.getContainer();return m?Ye(m,c):null},c=>Ne.current[c]??"",ia,(c,m)=>mr(c,he(m).body,!1)),[ia,mr]),Bb=l.useMemo(()=>Kf(()=>{var m;const c=(m=pt.current)==null?void 0:m.getContainer();return c?Ye(c,Te.current):null},Ut??"in",c=>ue(c,!1)),[Ut,ue]),Jd=l.useCallback(()=>{const c=we.current?ht():[ce.current];return c[Te.current]??c[0]??""},[ht]),pr=l.useCallback(()=>{if(!we.current)return[ce.current];if(B.current==="html"){const c=Ne.current.slice();return c[Te.current]=wn.current,c}return ht({allPages:!0})},[ht]),aa=l.useCallback(c=>{if(!we.current||B.current!=="visual"||!Vt.current)return;sr.current=!0;const m=ht(),w=Math.max(0,Math.min(c,m.length)),I=[...m],N=Ds.current?pf(zn(),Ds.current):zn();I.splice(w,0,N);const V=I.map(ee=>Ae(ee));an(I,!1,void 0,{skipHistory:!0}),Bt(ne)&&ne.recordInsertPage(w,V),Te.current=w,Co(w),lr(!0),yi.current=w},[ht,an,ne,Ae]),Qd=l.useCallback(()=>{const c=on();c===null||!Vt.current||aa(c)},[aa,on]),em=l.useCallback(()=>{const c=on();c===null||!Vt.current||aa(c+1)},[aa,on]),tm=l.useCallback(()=>{if(!we.current||B.current!=="visual"||!Vt.current)return;sr.current=!0;const c=ht();if(c.length<=1){sr.current=!1;return}const m=on();if(m===null){sr.current=!1;return}const w=c[m]??"",I=c.filter((me,Re)=>Re!==m),N=Ae(w),V=I.map(me=>Ae(me));an(I,!1,void 0,{skipHistory:!0}),Bt(ne)&&ne.recordDeletePage(m,N,V);const ee=Math.min(m,I.length-1);Te.current=ee,Co(ee),lr(!0)},[ht,an,ne,on,Ae]);l.useEffect(()=>{ae||lr(!1)},[ae]),l.useEffect(()=>()=>{vi.current&&(ki.current=!1,Si())},[Si]);const sa=l.useCallback(c=>{var I,N;const m=ut.replacePages([...c]);ce.current=m.joined,Ne.current=m.pages,Wt.current=!0,Mr(en(m.pages),Te.current);const w=Math.max(0,Math.min(Te.current,m.pages.length-1));w!==Te.current&&(Te.current=w,Co(w)),Is.current===void 0&&B.current==="html"&&!Oe.current&&((I=_r.current)==null||I.setHtml(m.joined)),(N=_t.current)==null||N.call(_t),Ln(m.joined),Bt(ne)&&ne.applyPresent(m.pages)},[en,ne,ut,Mr,Ln]),la=l.useCallback(()=>{if(B.current!=="visual"||ye){zr(null);return}const c=H.current;if(!c)return;const m=Vn(c);zr(w=>m||(w&&w.isConnected&&c.contains(w)?w:null))},[ye]),ca=l.useCallback(()=>{if(Bt(ne)){const m=ne.undo();if(m===null)return;ne.markApplying(),sa(m),rn();return}const c=ne.undo();c!==null&&(ne.markApplying(),Ur(c,{fullReplace:!0}),Ln(c),ne.finishApplying(),la(),rn())},[sa,rn,Ur,ne,la,Ln]),ua=l.useCallback(()=>{if(Bt(ne)){const m=ne.redo();if(m===null)return;ne.markApplying(),sa(m),rn();return}const c=ne.redo();c!==null&&(ne.markApplying(),Ur(c,{fullReplace:!0}),Ln(c),ne.finishApplying(),la(),rn())},[sa,rn,Ur,ne,la,Ln]);l.useEffect(()=>{if(ae){Bt(ne)&&(ge!==void 0&&!q?ne.syncPages(Ne.current):ne.applyPresent(Ne.current));return}Bt(ne)||ne.syncExternal(ce.current)},[ae,q,ne,ge]);const K=l.useCallback(()=>{Ge.current=ln({mode:B.current,visualEl:H.current,htmlEl:At.current})},[]),sn=l.useCallback(c=>{if(!c||B.current!=="visual"){bd(!1),xd(!1),wd(!1);return}bd(Eu(c)!==null),xd(uf(c)),wd(df(c))},[]),nm=l.useCallback(()=>{const c=ln({mode:B.current,visualEl:H.current,htmlEl:At.current}),m=Ge.current;Bm(m,c)||(Ge.current=c)},[]),wl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Ai({value:null,unit:vn.current,mixed:!1});return}const m=Eg(c,vn.current);Rt.current&&(m.value=Rt.current.value,m.unit=Rt.current.unit,m.mixed=!1),vn.current=m.unit,Ai(w=>w.value===m.value&&w.unit===m.unit&&w.mixed===m.mixed?w:m)},[]),vl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){_s({value:null,mixed:!1});return}const m=gp(c);Lt.current&&(m.value=Lt.current.value,m.mixed=!1),_s(w=>w.value===m.value&&w.mixed===m.mixed?w:m)},[]),kl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Ns({value:null,mixed:!1}),Ls({value:null,mixed:!1});return}const m=Ba(c,"color");Gt.current&&(m.value=Gt.current.value,m.mixed=!1);const w=Ba(c,"backgroundColor");Zt.current&&(w.value=Zt.current.value,w.mixed=!1),Ns(I=>I.value===m.value&&I.mixed===m.mixed?I:m),Ls(I=>I.value===w.value&&I.mixed===w.mixed?I:w)},[]),Sl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Bs({tag:null,mixed:!1});return}const m=Vv(c);Bs(w=>w.tag===m.tag&&w.mixed===m.mixed?w:m)},[]),Pl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Hs({align:null,mixed:!1}),Os({type:null,mixed:!1}),Ks(!1),ud(!1);return}const m=ah(c);Hs(V=>V.align===m.align&&V.mixed===m.mixed?V:m);const w=Vg(c);Os(V=>V.type===w.type&&V.mixed===w.mixed?V:w);const I=tk(c);Ks(V=>V===I?V:I);const N=oS(c);ud(V=>V===N?V:N)},[]),$=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Es(Wn()),$s(!1),wl(),vl(),kl(),Sl(),Pl();return}const m=Ge.current,w=!!(m&&!m.collapsed);$s(N=>N===w?N:w);const I=Bg(Qr(c),Nt.current);Es(N=>kv(N,I)?N:I),wl(),vl(),kl(),Sl(),Pl()},[wl,vl,kl,Sl,Pl]),rm=l.useCallback(()=>{const c=Ge.current,m=Dt.current;!m||!c||c.collapsed&&c.start===m.start&&c.end===m.end||(Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null)},[]);l.useEffect(()=>{if(st==="visual"){$();return}Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null,Es(Wn()),Ai({value:null,unit:vn.current,mixed:!1}),_s({value:null,mixed:!1}),Ns({value:null,mixed:!1}),Ls({value:null,mixed:!1}),Bs({tag:null,mixed:!1}),Hs({align:null,mixed:!1}),Os({type:null,mixed:!1}),Ks(!1),$s(!1)},[st,$]);const Vr=l.useCallback((c,m,w)=>{Vx({snapshot:c,visualEl:H.current,htmlEl:At.current,getHtml:()=>B.current==="visual"&&H.current?H.current.innerHTML:ce.current,setHtml:I=>{if(B.current==="visual"){const N=we.current?Ne.current[Te.current]??"":ce.current;Yd(cn(he(I).body,he(N).body),!1);return}gt(I,!1)},content:m,asHtml:w})},[gt,Yd]),Fb=l.useCallback(c=>{if(!we.current||c===Te.current)return;fr(Te.current,wn.current,!0),Te.current=c,Co(c);const m=Ne.current[c]??"";wn.current=m},[fr]),Hb=l.useCallback(c=>{if(we.current){if(Oe.current){const m=Ae(c);wn.current=m,fr(Te.current,m,!0)}else wn.current=c,fr(Te.current,c,!0);return}gt(c,!0)},[Ae,gt,fr]),om=l.useCallback(c=>{var m;if(B.current==="visual"&&c==="html"){if(we.current){const w=ht({allPages:!0}),I=Te.current,N=w[I]??w[0]??"";wn.current=N,ce.current=jt(w)}else if(H.current){const w=cn(H.current.innerHTML,he(ce.current).body),I=Ca(w,wa(w,ce.current,Kr.current,{liveRoot:H.current??void 0}));if(Oe.current){const N=Ae(I),V=ce.current;(m=_r.current)==null||m.setStorageHtml(N),ce.current=N,N!==V&&(Wt.current=!0,Bt(ne)||ne.record(N,{coalesce:!0}))}else I!==ce.current&>(I,!0)}}B.current==="html"&&c==="visual"&&we.current&&fr(Te.current,wn.current,!0),gi(c),c!=="visual"&&lr(!1)},[Ae,ne,gt,fr,gi,ht]);l.useEffect(()=>{if(!Pt)return;const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}},[Pt]),l.useEffect(()=>{if(!Pt)return;const c=m=>{m.key==="Escape"&&(m.defaultPrevented||Mi.open||qs.open||Eo.open||Mo.open||Xs||tl.open||rl.open||il.open||sl.open||Vs||Ni.open||cl.open||ul||(m.preventDefault(),tn(!1)))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[Pt,tn,Mi.open,qs.open,Eo.open,Mo.open,Xs,tl.open,rl.open,il.open,sl.open,Vs,Ni.open,cl.open,ul]),l.useEffect(()=>{const c=()=>{if(B.current!=="visual"||!H.current)return;const m=window.getSelection();if(!m||m.rangeCount===0)return;const w=m.anchorNode;!w||!H.current.contains(w)&&H.current!==w||Br.current===null&&(Br.current=window.requestAnimationFrame(()=>{var N;Br.current=null;const I=H.current;if(!(!I||B.current!=="visual")&&(K(),rm(),$(),zr(Vn(I)),sn(I),Mn.current&&xi.current&&!((N=bi.current)!=null&&N.contains(document.activeElement)))){const V=Ge.current;V&&nn(xf(I,V))}}))};return document.addEventListener("selectionchange",c),()=>{document.removeEventListener("selectionchange",c),Br.current!==null&&(window.cancelAnimationFrame(Br.current),Br.current=null)}},[K,rm,$,sn]),l.useEffect(()=>{if(st!=="html")return;const c=At.current;if(!c)return;const m=()=>K();return c.addEventListener("select",m),c.addEventListener("keyup",m),c.addEventListener("mouseup",m),()=>{c.removeEventListener("select",m),c.removeEventListener("keyup",m),c.removeEventListener("mouseup",m)}},[st,K]);const W=l.useCallback(c=>{const m=ln({mode:"visual",visualEl:c,htmlEl:At.current}),w=Ge.current,I=Bm(w,m)?w:m.visualRange?m:w??m;Ge.current=I,c.focus();const N=Ux(c,I);if(N){const V=window.getSelection();try{V==null||V.removeAllRanges(),V==null||V.addRange(N),Ge.current={...I,visualRange:N}}catch{}}return Ge.current??I},[]),Sn=l.useCallback(()=>{ji.current=null,Ei.current=null,ld(!1)},[]),im=l.useCallback(()=>{if(!Ii.current||!ji.current||!Ei.current||B.current!=="visual")return;const c=H.current;if(!c)return;K();const m=Ge.current;!m||m.collapsed||NS(m,Ei.current)||(W(c),BS(c,ji.current),ue(c,!1),K(),$(),Sn())},[K,W,be,$,Sn]),am=l.useCallback(()=>{if(B.current!=="visual"){Sn();return}if(Ii.current){Sn();return}const c=H.current;if(!c){Sn();return}const m=W(c);if(m.collapsed){Sn();return}ji.current=LS(c),Ei.current={...m},ld(!0),K()},[Sn,W,K]),zb=l.useCallback(()=>{im()},[im]);l.useEffect(()=>{(st!=="visual"||ye)&&Sn()},[st,ye,Sn]);const Al=l.useCallback((c,m)=>{if(B.current!=="visual")return;const w=H.current;if(!w)return;const I=m??vn.current,N=vr(c,I);if(!N)return;vn.current=N.unit;const V=W(w);if(V.collapsed){Rt.current=N,Dt.current={start:V.start,end:V.end},$();return}Rt.current=null,Rc(w,N.value,N.unit)&&(ue(w,!1),K(),$())},[W,be,K,$]),sm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(w.collapsed){Lt.current={value:c},Dt.current={start:w.start,end:w.end},$();return}Lt.current=null,pc(m,c)&&(ue(m,!1),K(),$())},[W,be,K,$]),Tl=l.useCallback((c,m)=>{if(B.current!=="visual")return;const w=H.current;if(!w)return;const I=W(w),N=c==="color"?Gt:Zt;if(I.collapsed){N.current={value:m},Dt.current={start:I.start,end:I.end},$();return}N.current=null,qo(w,c,m)&&(ue(w,!1),K(),$())},[W,be,K,$]),Rl=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(_i({open:!1,tab:"general"}),w.collapsed){if(c.size!==null){const ee=vr(c.size,c.unit);ee&&(Rt.current=ee,vn.current=ee.unit)}const N=Qr(m),V={};for(const ee of zt)c.marks[ee]!==N[ee]&&(V[ee]=c.marks[ee]);Nt.current=V,c.fontColorMixed||(Gt.current={value:c.fontColor}),c.highlightColorMixed||(Zt.current={value:c.highlightColor}),c.fontFamilyMixed||(Lt.current={value:c.fontFamily}),Dt.current={start:w.start,end:w.end},$();return}if(Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,Dt.current=null,c.size!==null){const N=vr(c.size,c.unit);N&&(vn.current=N.unit,Rc(m,N.value,N.unit))}const I=Qr(m);for(const N of zt)c.marks[N]!==I[N]&&jc(m,N);c.fontFamilyMixed||pc(m,c.fontFamily),c.fontColorMixed||qo(m,"color",c.fontColor),c.highlightColorMixed||qo(m,"backgroundColor",c.highlightColor),ue(m,!1),K(),$()},[W,be,K,$]),Dl=l.useCallback((c,m)=>{if(B.current!=="visual")return;const w=H.current;if(!w)return;W(w),Fr(N=>({...N,open:!1}));let I=lh(w,c);if(m&&Ik(w,m)&&(I=!0),!I){K(),$();return}ue(w,!1),K(),$()},[W,be,K,$]),lm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(Ys(I=>({...I,open:!1})),!xs(c)){K(),$();return}if(w.collapsed){_n.current=c,Dt.current={start:w.start,end:w.end},$();return}if(_n.current=null,!Lg(m,c)){K(),$();return}ue(m,!1),K(),$()},[W,be,K,$]),Il=l.useCallback(c=>{if(B.current!=="visual")return;const m=Ho();if(!m)return;W(m),cr(V=>({...V,open:!1}));const w=$r(),I=JSON.stringify(c.atRule)!==JSON.stringify(tt(he(w).body)),N=Hc(m,c);if(I&&ho(m,N.pageHtml),!N.changed&&!I){K(),$();return}ue(m,!1,N.pageHtml),K(),$()},[W,ue,K,$,Ho,$r]),cm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Bi(w=>({...w,open:!1})),!uS(m,c)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),um=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),el(w=>({...w,open:!1})),!pS(m,c)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),da=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Fi({open:!1}),!_w(m,c,z.current)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),ma=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Hi({open:!1}),!XS(m,c)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),dm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),No({open:!1}),!u0(m,c)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),mm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),nl({open:!1}),!dk(m,c)){K(),$();return}ue(m,!1),K(),$(),sn(m)}},[W,be,K,$,sn]),fm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),ol(w=>({...w,open:!1})),!H0(m,c)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),pm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),al(w=>({...w,open:!1})),!q0(m,c)){K(),$();return}ue(m,!1),K(),$(),sn(m)}},[W,be,K,$,sn]),gm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),ll(w=>({...w,open:!1})),!iP(m,c)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),Pn=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),!c(m)){K(),$();return}ue(m,!1),K(),$(),sn(m)}},[W,be,K,$,sn]),jl=l.useCallback(c=>{da({src:c.src,alt:c.alt??"",title:c.title??"",css:c.css})},[da]),El=l.useCallback(c=>{ma({src:c.src,title:c.title??"",css:c.css})},[ma]),Ml=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),No({open:!1}),!d0(m,{src:c.src,title:c.title??"",css:c.css})){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),hm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),zi(w=>({...w,open:!1})),!Xw(m,c)){K(),$();return}ue(m,!1),K(),$()}},[W,be,K,$]),Ob=l.useCallback((c,m)=>{dt!=null&&dt.isConnected&&_0(dt,c,m)},[dt]),Kb=l.useCallback(()=>{const c=H.current;!c||!(dt!=null&&dt.isConnected)||(ue(c,!1),Xl(c,dt),K(),$())},[dt,be,K,$]),fa=l.useCallback(()=>{if(B.current!=="visual"||!H.current)return ce.current;const c=cn(H.current.innerHTML,he(ce.current).body);return Ca(c,wa(c,ce.current,Kr.current,{liveRoot:H.current}))},[]),pa=l.useCallback(()=>{if(we.current){const c=jt(pr());return ce.current=c,$e(c)}if(Wt.current){const c=B.current==="visual"?fa():ce.current;c!==ce.current&&(ce.current=c)}return $e(ce.current)},[pr,$e,fa]),$b=l.useRef(-1),bm=l.useCallback(()=>{if(!Wt.current&&Lr.current)return Lr.current;const c=Wt.current&&B.current==="visual"?fa():ce.current;return c!==ce.current&&(ce.current=c),Lr.current=c,Wt.current=!1,c},[fa]),ym=l.useCallback(()=>{if(!Wt.current&&Lr.current)return Lr.current;const c=ht(),m=JSON.stringify(c);return Lr.current=m,$b.current=ut.revision,Wt.current=!1,m},[ht,ut.revision]),Ub=l.useCallback(()=>we.current?ym():bm(),[ym,bm]);mP({onAutoSave:r?async c=>{Wt.current=!1;const m=we.current?en(JSON.parse(c)):$e(c);return r(m)}:void 0,getHtml:Ub}),l.useEffect(()=>()=>{var c;(c=z.current)==null||c.clear()},[]),l.useEffect(()=>{var m;if(!q||e===void 0||ae)return;const c=Ae(e);(m=_r.current)==null||m.setStorageHtml(c),ce.current=c,Bt(ne)||ne.syncExternal(c)},[ae,Ae,ne,q,e]),l.useEffect(()=>{if(!q||!ae||ge===void 0)return;const c=$n(ge).map(w=>Ae(w));if(xr(c,Ne.current))return;const m=ut.replacePages(c);if(ce.current=m.joined,Ne.current=m.pages,Bt(ne)&&ne.syncPages(m.pages),B.current==="html"){const w=m.pages[Te.current]??"";wn.current=w}},[ae,Ae,ne,q,ut,ge]),l.useEffect(()=>()=>{var c;(c=vo.current)==null||c.cancel()},[]);const Ie=l.useMemo(()=>({getHtml:pa,setHtml:c=>{gt(c,!1)},getMode:()=>B.current,setMode:om,getFullscreen:()=>nd.current,setFullscreen:tn,getDarkMode:()=>Bd.current,setDarkMode:c=>{Wd(c)},getPageZoom:()=>Xi.current,setPageZoom:Gd,getToolbarPosition:()=>Fd.current,setToolbarPosition:c=>{Zd(c)},openCustomizeToolbar:()=>{md(!0)},openDocumentPreview:()=>{fd({open:!0,html:$e(jt(pr()))})},openHelp:()=>{Lo({open:!0,topicId:"getStarted"})},openKeyboardShortcuts:()=>{Lo({open:!0,topicId:"keyboardShortcuts"})},openAbout:()=>{gd(!0)},toggleReadAloud:()=>{const c=vo.current;if(!c)return;const m=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current}),w=wf(va(m),pa());w&&c.toggle(w)},toggleRuler:()=>{Rs(c=>!c)},isReadingAloud:()=>{var c;return((c=vo.current)==null?void 0:c.isSpeaking())??!1},isRulerVisible:()=>hi.current,canReadAloud:()=>{if(!Ma())return!1;const c=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});return wf(va(c),pa())!==null},undo:ca,redo:ua,canUndo:()=>ne.canUndo(),canRedo:()=>ne.canRedo(),getSelection:()=>{const c=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});return va(c)},insertText:c=>{const m=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});Vr(m,c,!1)},insertHtml:(c,m)=>{const w=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current}),I=m===void 0;Vr(w,I?c:m,I)},toggleFontMark:c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(w.collapsed){const I=Qr(m);Nt.current=Pv(Nt.current,I,c),Dt.current={start:w.start,end:w.end},$();return}Nt.current={},Dt.current=null,jc(m,c)&&(ue(m,!1),K(),$())},clearFormatting:()=>{if(B.current!=="visual")return;const c=H.current;!c||W(c).collapsed||(Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null,_S(c)&&(ue(c,!1),K(),$()))},toggleFormatBrush:am,isFormatBrushActive:()=>Ii.current,isFontMarkActive:c=>Ms.current[c],hasTextSelection:()=>B.current==="visual"&&Us.current,setFontSize:(c,m)=>{Al(c,m)},setFontSizeUnit:c=>{var ee;const m=H.current,w=Nn.current;if(B.current!=="visual"||!m||w.value===null||w.mixed){vn.current=c,Ai(me=>({...me,unit:c}));return}const I=W(m),N=mv(m,((ee=I.visualRange)==null?void 0:ee.startContainer)??m),V=bp(w.value,w.unit,c,N.parentPx,N.rootPx);Al(V,c)},getFontSize:()=>Nn.current.value,getFontSizeUnit:()=>Nn.current.unit,isFontSizeMixed:()=>Nn.current.mixed,setFontFamily:c=>{sm(c)},getFontFamily:()=>Ao.current.value,isFontFamilyMixed:()=>Ao.current.mixed,getFontFaces:()=>Kr.current,setFontColor:c=>{Tl("color",c)},setHighlightColor:c=>{Tl("backgroundColor",c)},getFontColor:()=>Ro.current.value,isFontColorMixed:()=>Ro.current.mixed,getHighlightColor:()=>Io.current.value,isHighlightColorMixed:()=>Io.current.mixed,setParagraphStyle:c=>{if(B.current!=="visual")return;const m=H.current;m&&(W(m),Wv(m,c)&&(ue(m,!1),K(),$()))},getParagraphStyle:()=>Fs.current.tag,isParagraphStyleMixed:()=>Fs.current.mixed,setTextAlign:c=>{if(B.current!=="visual")return;const m=H.current;m&&(W(m),sh(m,c)&&(ue(m,!1),K(),$()))},getTextAlign:()=>zs.current.align,isTextAlignMixed:()=>zs.current.mixed,indent:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),nk(c)&&(ue(c,!1),K(),$()))},outdent:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),rk(c)&&(ue(c,!1),K(),$()))},canOutdent:()=>B.current==="visual"&&sd.current,toggleList:c=>{if(B.current!=="visual")return;const m=H.current;m&&(W(m),qv(m,c)&&(ue(m,!1),K(),$()))},isBulletList:()=>jo.current.type==="ul"&&!jo.current.mixed,isNumberedList:()=>jo.current.type==="ol"&&!jo.current.mixed,openFontProperties:c=>{B.current==="visual"&&_i({open:!0,tab:c??"general"})},applyFontProperties:c=>{Rl(c)},openCustomCss:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=c?_g(c):{value:null,mixed:!1},w=m.mixed||!m.value?"":yv(m.value);Ys({open:!0,value:w})},applyCustomCss:c=>{lm(c)},openParagraphProperties:c=>{if(B.current!=="visual")return;const m=H.current;m&&W(m),Fr({open:!0,tab:c??"general",value:m?Aa(m):wr(),backgroundImage:m?ec(m):mn()})},applyParagraphProperties:(c,m)=>{Dl(c,m)},openPageProperties:(c,m)=>{if(B.current!=="visual")return;const w=Ho();w&&W(w);const I=$r(),N=w?Wo(w):Jo();cr({open:!0,tab:c==="print"&&!Jt?"font":c??"font",paragraphTab:m??"spacing",value:{...N,atRule:tt(he(I).body)}})},applyPageProperties:c=>{Il(c)},openPageBackgroundImage:()=>{if(B.current!=="visual")return;const c=Ho();c&&W(c);const m=bl.current;if(yl.current&&m){m.onPick(N=>{const V=$r(),ee=c?Wo(c):Jo();Il({...ee,backgroundImage:{...ee.backgroundImage,src:N.src},atRule:tt(he(V).body)})});return}const w=$r(),I=c?Wo(c):Jo();cr({open:!0,tab:"paragraph",paragraphTab:"backgroundImage",value:{...I,atRule:tt(he(w).body)}})},openParagraphBackgroundImage:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=bl.current;if(yl.current&&m){m.onPick(w=>{const I=c?Aa(c):wr(),N=c?ec(c):mn();Dl(I,{...N,src:w.src})});return}Fr({open:!0,tab:"backgroundImage",value:c?Aa(c):wr(),backgroundImage:c?ec(c):mn()})},openCustomParagraphStyleDialog:c=>{if(B.current!=="visual"||!gl.current)return;if(c){const w=qi.current.find(I=>I.id===c);if(!w)return;_o({open:!0,mode:"edit",style:w});return}const m=H.current;m&&W(m),_o({open:!0,mode:"create",font:{size:Nn.current.mixed?null:Nn.current.value,unit:Nn.current.unit,marks:{...Ms.current},fontFamily:Ao.current.mixed?null:Ao.current.value,fontColor:Ro.current.mixed?null:Ro.current.value,highlightColor:Io.current.mixed?null:Io.current.value},paragraph:ch(m?Aa(m):wr())})},applyCustomParagraphStyle:c=>{const m=qi.current.find(I=>I.id===c);if(!m||(Rl({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=H.current;!w||B.current!=="visual"||(W(w),Rk(w,m.paragraph)&&(ue(w,!1),K(),$()))},customParagraphStylesEnabled:()=>gl.current,getCustomParagraphStyles:()=>qi.current,isCustomParagraphStylesLoading:()=>Sd.current,openLinkDialog:c=>{if(B.current!=="visual")return;const m=H.current;m&&W(m);const w=m?fh(m):vs(),I=m?Oc(m):[],N=(w==null?void 0:w.href)??"",V=N.startsWith("#")?N.slice(1):"",ee=I.some(me=>me.id===V)?V:"";Bi({open:!0,tab:c??"link",href:N,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:I,selectedBookmarkId:ee})},applyLink:c=>{cm(c)},openBookmarkDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c),el({open:!0,existingIds:c?Oc(c).map(m=>m.id):[]})},applyBookmark:c=>{um(c)},openImageDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=Id.current;if(Hd.current&&m){m.onPick(jl);return}Fi({open:!0})},applyImage:c=>{da(c)},openAudioDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=Ed.current;if(zd.current&&m){m.onPick(El);return}Hi({open:!0})},applyAudio:c=>{ma(c)},openYoutubeDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=Md.current;if(Od.current&&m){m.onPick(Ml);return}No({open:!0})},applyYoutube:c=>{dm(c)},openImageProperties:c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;W(m);const w=Vn(m),I=Yw(m);!w||!I||zi({open:!0,tab:c??"general",value:I,aspectRatio:Gw(w)})},applyImageProperties:c=>{hm(c)},insertHorizontalRule:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),k0(c)&&(ue(c,!1),K(),$()))},insertPageBreak:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),R0(c)&&(ue(c,!1),K(),$()))},insertPageBefore:()=>{Qd()},insertPageAfter:()=>{em()},deletePage:()=>{!we.current||B.current!=="visual"||Vt.current&&(pr().length<=1||Js(!0))},isMultiPagesEnabled:()=>we.current,hasSelectedPage:()=>we.current&&B.current==="visual"&&Vt.current,canDeletePage:()=>we.current&&B.current==="visual"&&Vt.current&&pr().length>1,canInsertPageBackgroundImage:()=>!(B.current!=="visual"||we.current&&!Vt.current),canInsertParagraphBackgroundImage:()=>{if(B.current!=="visual")return!1;const c=H.current;return c?In(c).length>0:!1},getActivePageHtml:()=>Jd(),getAllPagesHtml:()=>en(pr()),openTableDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c),nl({open:!0})},applyTable:c=>{mm(c)},openTableProperties:()=>{if(B.current!=="visual")return;const c=H.current;if(!c)return;W(c);const m=F0(c);m&&ol({open:!0,value:m})},applyTableProperties:c=>{fm(c)},openCellProperties:()=>{if(B.current!=="visual")return;const c=H.current;if(!c)return;W(c);const m=Z0(c);m&&al({open:!0,value:m})},applyCellProperties:c=>{pm(c)},openRowProperties:()=>{if(B.current!=="visual")return;const c=H.current;if(!c)return;W(c);const m=oP(c);m&&ll({open:!0,value:m})},applyRowProperties:c=>{gm(c)},insertRowBelow:()=>{Pn(c=>_c(c,"below"))},insertRowBefore:()=>{Pn(c=>_c(c,"before"))},deleteRow:()=>{Pn(c=>mk(c))},insertColumnAfter:()=>{Pn(c=>cf(c,"after"))},insertColumnBefore:()=>{Pn(c=>cf(c,"before"))},deleteColumn:()=>{Pn(c=>fk(c))},mergeCells:()=>{Pn(c=>hk(c))},unmergeCells:()=>{Pn(c=>bk(c))},cut:async()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),await DS(c)&&(ue(c,!1),K(),$()))},copy:async()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),await wh(c))},deleteSelection:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),Ch(c)&&(ue(c,!1),K(),$()))},addComment:()=>{if(!Mn.current||b||B.current!=="visual")return;const c=H.current;if(!c)return;const m=W(c),w=xf(c,m);if(w){nn(w);return}const I=yS(c,m);if(!I)return;const N=kS(I);xS(c,N.id,m)&&(Cf(c,N.id),K(),Xd(c,!1),ir([...Ci.current,N]),nn(N.id))},toggleCommentsVisible:()=>{Ts(c=>{const m=!c,w=H.current;return w&&bh(w,m),m})},areCommentsVisible:()=>xi.current,canAddComment:()=>!Mn.current||b||B.current!=="visual"?!1:Us.current||pl.current!==null,isCommentsEnabled:()=>Mn.current,getCommentThreads:()=>Ci.current,setCommentThreads:c=>ir(c),openCommentThread:c=>{const m=H.current;!m||B.current!=="visual"||Cf(m,c)&&(K(),nn(c))},isContentLocked:()=>Zu.current,isLink:()=>dd.current,isImageSelected:()=>B.current==="visual"&&pl.current!==null,isInTable:()=>B.current==="visual"&&yd.current,canMergeCells:()=>B.current==="visual"&&Cd.current,canUnmergeCells:()=>B.current==="visual"&&vd.current,...o!=null?{onSave:c=>Rd.current(c)}:{},...a!=null?{onOpen:()=>Dd.current()}:{}}),[gt,be,ue,Xd,om,tn,Wd,Gd,Zd,Vr,ca,ua,K,$,W,Al,sm,Tl,Rl,lm,Dl,Il,cm,um,da,ma,dm,hm,mm,fm,pm,gm,Pn,jl,El,Ml,pa,Jd,pr,Qd,em,tm,am,o,a,b,ir,Jt]),xm=l.useCallback(()=>{const c=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});return{mode:c.mode,selection:va(c),getHtml:Ie.getHtml,setHtml:m=>{gt(m,!1)},insertText:m=>Vr(c,m,!1),insertHtml:(m,w)=>{const I=w===void 0;Vr(c,I?m:w,I)}}},[Vr,Ie.getHtml,gt]),{catalog:ga,layout:Cm}=l.useMemo(()=>Xy(U,GR,ZR),[U]),ha=l.useMemo(()=>nA(Cm,L),[Cm,L]),wm=l.useMemo(()=>({...ha,iconGroups:DP(ha.iconGroups,Ws)}),[ha,Ws]),vm=ae&&st==="visual",_l=l.useMemo(()=>mD(wm,vm),[wm,vm]),Nl=l.useMemo(()=>Pe?JR(ga,jn):ga,[ga,Pe,jn]),Ll=l.useMemo(()=>Pe?QR(_l):_l,[_l,Pe]),Bl=l.useMemo(()=>({disabled:Qt,readOnly:C,enableComments:Pe}),[Qt,C,Pe]),Vb=l.useCallback(c=>{if(!En||!xn||b)return;const m=SS(xn,c);ir(PS(Ci.current,En,m))},[En,xn,b,ir]),Wr=l.useMemo(()=>({...sv(Ie),...Jy(U,xm)}),[Ie,U,xm]),Fl=l.useMemo(()=>lv(Ie),[Ie,ko,So,Po,To,Do,Ti,$i,Ui,Yi,Or,dt,Wi,Gi,Zi,Ri,Di,ur,Hr,Bo,wo,Xu,Pt]);l.useLayoutEffect(()=>{Tt.bump("history")},[Xu,Tt]),l.useLayoutEffect(()=>{Tt.bump("marks")},[ko,So,Po,To,Do,Ti,Di,Tt]),l.useLayoutEffect(()=>{Tt.bump("table")},[Wi,Gi,Zi,Tt]),l.useLayoutEffect(()=>{Tt.bump("selection")},[Ri,dt,Tt]),l.useLayoutEffect(()=>{Tt.bump("chrome")},[ur,Hr,Bo,wo,Pt,$i,Ui,Yi,Or,Tt]);const Wb=l.useCallback(c=>{if(ye||c.inputType!=="insertText"&&c.inputType!=="insertReplacementText"||!c.data||!Sv(Nt.current)&&!Rt.current&&!Ix(Lt.current)&&!rC({color:Gt.current,backgroundColor:Zt.current})&&!wv(_n.current))return;const m=H.current;m&&(c.preventDefault(),_v(m,c.data,Nt.current,Rt.current,{color:Gt.current,backgroundColor:Zt.current},Lt.current,_n.current),Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null,ue(m,!0),K(),$())},[ye,be,K,$]),Gb=l.useCallback(c=>{var Re;if(ye||!px(c,kd.current))return;c.preventDefault(),c.stopPropagation();let m=H.current;if(we.current){const xe=c.currentTarget instanceof HTMLElement&&c.currentTarget.hasAttribute(Pr)?c.currentTarget:uw(c.target);if(xe instanceof HTMLElement){const Ze=Vm(xe);Ze!==null&&((Re=pt.current)==null||Re.activatePageAt(Ze),H.current=xe,m=xe,Vt.current=!0,lr(!0))}}else c.currentTarget instanceof HTMLDivElement&&(H.current=c.currentTarget,m=c.currentTarget);if(!m)return;W(m);const w=Pc(m,c.target),I=Ja(m,c.target);I&&!fi(m).includes(I)&&gk(m,I);const N={inTable:wt(m,c.target)!==null,canMergeCells:uf(m),canUnmergeCells:df(m)},V={canDeletePage:we.current&&Vt.current&&ht().length>1},ee={canAddComment:Mn.current&&!b};if(w){Xl(m,w),K(),zr(w),fl({open:!0,x:c.clientX,y:c.clientY,kind:"image",...N,...V,...ee,inTable:wt(m,w)!==null});return}const me=ln({mode:"visual",visualEl:m,htmlEl:At.current});Ge.current=me,fl({open:!0,x:c.clientX,y:c.clientY,kind:me.collapsed?"caret":"text",...N,...V,canAddComment:ee.canAddComment&&!me.collapsed})},[ye,K,W,ht,b,lr]),Zb=l.useCallback(c=>{if(kd.current=c.pointerType,b)return;const m=H.current;if(!m)return;if(Mn.current&&xi.current){const I=yh(m,c.target);if(I){const N=I.getAttribute("data-comment-thread");N&&nn(N);return}}if(ye&&!Mn.current)return;const w=Pc(m,c.target);if(!w){zr(null);return}c.preventDefault(),Xl(m,w),K(),zr(w)},[b,ye,K]),km=l.useCallback(c=>{if(ye)return;if(c.key==="Tab"&&!c.ctrlKey&&!c.metaKey&&!c.altKey){if(B.current!=="visual")return;const w=H.current;if(!w)return;const I=c.target;if(!(I instanceof Node)||!w.contains(I))return;W(w);const N=pk(w,c.shiftKey);if(!N)return;c.preventDefault(),typeof N=="object"&&N.changed&&ue(w,!1),K(),$(),sn(w);return}if(!(c.ctrlKey||c.metaKey))return;if(c.key==="Enter"&&!c.shiftKey){c.preventDefault(),Ie.insertPageBreak();return}const m=c.key.toLowerCase();if(m==="z"&&!c.shiftKey){c.preventDefault(),ca();return}if(m==="z"&&c.shiftKey||m==="y"){c.preventDefault(),ua();return}if(m==="b"&&!c.shiftKey){c.preventDefault(),Ie.toggleFontMark("bold");return}if(m==="i"&&!c.shiftKey){c.preventDefault(),Ie.toggleFontMark("italic");return}if(m==="u"&&!c.shiftKey){c.preventDefault(),Ie.toggleFontMark("underline");return}if(m==="x"&&c.shiftKey){c.preventDefault(),Ie.toggleFontMark("strikethrough");return}m==="p"&&!c.shiftKey&&(c.preventDefault(),Wr.print())},[ye,ca,ua,Ie,Wr,W,be,K,$,sn]),qb=l.useCallback(c=>{if(c.key==="F1"){c.preventDefault(),Lo({open:!0,topicId:"getStarted"});return}if(c.key==="Escape"&&En){c.preventDefault(),nn(null);return}km(c)},[En,km]),Yb=[Ce.root,mc(ur).className,Pt?Ce.fullscreen:"",x].filter(Boolean).join(" "),Xb=VM({toolbarBackground:k,menuColor:S,menuBackground:A,menuFontSize:T,menuFontFamily:D,border:R}),Jb=mc(ur)["data-wysiwyg-theme"];Yu.current={multiPageVisualRef:pt,workspaceRef:ar,suppressPageFlushRef:sr,pendingInsertPageFocusRef:yi,visualRootRef:H,visualPropSyncGuardRef:_t,htmlAreaRef:At,commentPanelRef:bi,activePageIndexRef:Te,htmlModePageHtmlRef:wn,activePageHtmlRef:ed,pageCanvasSizedRef:td,setActivePageIndex:Co,setHasSelectedPage:lr,setActiveThreadId:nn,setContextMenu:fl,recordVisualInputHtml:jb,recordPageVisualHtml:mr,handleVisualBeforeInput:Wb,handleVisualPointerDown:Zb,handleVisualMouseUp:zb,handleVisualContextMenu:Gb,handleHtmlPageTabSelect:Fb,handleHtmlSurfaceChange:Hb,handleImageResize:Ob,handleImageResizeEnd:Kb,multiPageRulerMarginPreview:Nb,multiPageRulerMarginChange:Lb,multiPageRulerIndentChange:Bb,singlePageRulerMarginPreview:Eb,singlePageRulerMarginChange:Mb,singlePageRulerIndentChange:_b,resolveEmbeddedImageDataUrl:q?Ps:void 0,hydrateExportHtml:$e,postCommentMessage:Vb,htmlFileDrop:qd};const Qb=l.useMemo(()=>fb({catalog:Nl,layout:Ll,commands:Wr,queries:Fl,queryRevisions:Tt,disabled:Qt,chromeLock:Bl}),[Qt,Bl,Wr,Nl,Ll,Fl,Tt]),ey=l.useMemo(()=>({documentBridgeRef:_r,htmlRef:ce,pagesRef:Ne}),[]);return i.jsx(ax,{locale:v,children:i.jsx(nx,{dark:ur,children:i.jsx(rM,{value:ey,children:i.jsxs("div",{className:Yb,style:Xb,"data-fullscreen":Pt?"":void 0,"data-wysiwyg-theme":Jb,"data-toolbar-position":Hr,"data-comments-visible":Pe&&jn?"":void 0,onKeyDown:qb,children:[i.jsx(tM,{menuVisible:P,captureChromeSelection:nm,displayCatalog:Nl,displayLayout:Ll,commands:Wr,queries:Fl,queryRevisions:Tt,chromeDisabled:Qt,chromeLock:Bl,contentLocked:ye,customizeToolbarOpen:Vs,baseCatalog:ga,allowedLayout:ha,toolbarSettings:Ws,toolbarSettingsLoading:bb,toolbarSettingsBusy:yb,onCustomizeToolbarClose:()=>md(!1),onToolbarSettingsChange:c=>{Vd(c)},onToolbarSettingsReset:()=>{Vd(null)},documentPreview:Ni,onDocumentPreviewClose:()=>fd({open:!1,html:Ni.html}),helpDialog:cl,onHelpDialogClose:()=>Lo(c=>({...c,open:!1})),onHelpTopicChange:c=>Lo(m=>({...m,open:!0,topicId:c})),aboutDialogOpen:ul,onAboutDialogClose:()=>gd(!1),fontDialog:Mi,fontSizeState:So,markState:ko,fontFamilyState:Po,fontColorState:To,highlightColorState:Do,fontFaces:Or,onFontDialogTabChange:c=>_i({open:!0,tab:c}),onFontDialogClose:()=>_i({open:!1,tab:Mi.tab}),onApplyFontProperties:c=>Ie.applyFontProperties(c),paragraphDialog:Eo,customBackgroundImagePicker:kn,disableBuiltinBackgroundImageSources:hl,onParagraphCustomImagePick:()=>{kn==null||kn.onPick(c=>{Fr(m=>({...m,tab:"backgroundImage",backgroundImage:{...m.backgroundImage,src:c.src}}))})},onParagraphDialogTabChange:c=>Fr({...Eo,open:!0,tab:c}),onParagraphDialogClose:()=>Fr({...Eo,open:!1}),onApplyParagraphProperties:({value:c,backgroundImage:m})=>Ie.applyParagraphProperties(c,m),customCssDialog:qs,onCustomCssDialogClose:()=>Ys(c=>({...c,open:!1})),onApplyCustomCss:c=>Ie.applyCustomCss(c),pageDialog:Mo,enablePageProperties:Jt,onPageCustomImagePick:()=>{kn==null||kn.onPick(c=>{cr(m=>({...m,tab:"paragraph",paragraphTab:"backgroundImage",value:{...m.value,backgroundImage:{...m.value.backgroundImage,src:c.src}}}))})},onPageDialogTabChange:c=>cr({...Mo,open:!0,tab:c}),onPageDialogClose:()=>cr({...Mo,open:!1}),onApplyPageProperties:c=>Ie.applyPageProperties(c),onPageDialogResetAtRule:()=>{const c=Ho();if(!c||B.current!=="visual")return;const m=we.current?$r():he(ce.current).body,w=$k(c,m);w.changed&&(ue(c,!1,w.pageHtml),cr(I=>({...I,value:{...I.value,atRule:Kn()}})))},deletePageConfirmOpen:Xs,onDeletePageConfirmClose:()=>Js(!1),onDeletePageConfirm:()=>{tm(),Js(!1)},customStyleDialog:xb,canDeleteCustomParagraphStyle:!!oe,customStyleBusy:Ab,onCustomStyleDialogClose:()=>_o({open:!1}),onCustomStyleSave:async c=>{const m=Ad.current;if(m){Vi(!0);try{await m(c),_o({open:!1}),await ra()}finally{Vi(!1)}}},onCustomStyleDelete:async c=>{const m=Td.current;if(m){Vi(!0);try{await m(c),_o({open:!1}),await ra()}finally{Vi(!1)}}},linkDialog:Qs,onLinkDialogTabChange:c=>Bi({...Qs,open:!0,tab:c}),onLinkDialogClose:()=>Bi({...Qs,open:!1}),onApplyLink:c=>Ie.applyLink(c),bookmarkDialog:pd,onBookmarkDialogClose:()=>el({...pd,open:!1}),onApplyBookmark:c=>Ie.applyBookmark(c),imageDialogOpen:Cb.open,customImagePicker:Y,customAudioPicker:E,customVideoPicker:pe,onImageDialogClose:()=>Fi({open:!1}),onApplyImage:c=>Ie.applyImage(c),onImageDialogCustomPick:()=>{Fi({open:!1}),Y==null||Y.onPick(jl)},audioDialogOpen:wb.open,onAudioDialogClose:()=>Hi({open:!1}),onApplyAudio:c=>Ie.applyAudio(c),onAudioDialogCustomPick:()=>{Hi({open:!1}),E==null||E.onPick(El)},youtubeDialogOpen:vb.open,onYoutubeDialogClose:()=>No({open:!1}),onApplyYoutube:c=>Ie.applyYoutube(c),onYoutubeDialogCustomPick:()=>{No({open:!1}),pe==null||pe.onPick(Ml)},imageProperties:kb,onImagePropertiesTabChange:c=>zi(m=>({...m,tab:c})),onImagePropertiesClose:()=>zi(c=>({...c,open:!1})),onApplyImageProperties:c=>Ie.applyImageProperties(c),tableDialogOpen:tl.open,onTableDialogClose:()=>nl({open:!1}),onApplyTable:c=>Ie.applyTable(c),tableProperties:rl,onTablePropertiesClose:()=>ol(c=>({...c,open:!1})),onApplyTableProperties:c=>Ie.applyTableProperties(c),cellProperties:il,onCellPropertiesClose:()=>al(c=>({...c,open:!1})),onApplyCellProperties:c=>Ie.applyCellProperties(c),rowProperties:sl,onRowPropertiesClose:()=>ll(c=>({...c,open:!1})),onApplyRowProperties:c=>Ie.applyRowProperties(c)}),i.jsx(nM,{toolbarVisible:M,toolbarPos:Hr,captureChromeSelection:nm,toolbarShellProps:Qb,children:i.jsx(KM,{propsRef:Yu,pageStore:ut,mode:st,enableMultiPages:ae,contentLocked:ye,activePageIndex:Nr,hasSelectedPage:wo,pageZoomScale:dl,rulerVisible:yo,rulerUnit:Ut,optimizeEmbeddedImages:q,placeholder:y,value:e,pagesProp:ge,controlledHtml:Cn,initialHtml:Me,initialStorageHtml:As,defaultPages:Q.current??[zn()],ingestedPagesProp:qu,onChange:n,fontFaces:Or,enableComments:Pe,commentsVisible:jn,disabled:b,locale:v,commentAuthor:xn,activeThreadId:En,contextMenu:Tb,commentThreads:xo,commands:Wr,htmlFileDropDragging:qd.dragging,selectedImage:dt})}),Pt?i.jsx(WM,{onClick:()=>tn(!1)}):null]})})})})}function VM({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 WM({onClick:e}){const t=X();return i.jsx("button",{type:"button",className:Ce.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:i.jsx(Je,{className:Ce.exitFullscreenIcon})})}function GM(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)===lt?!0:t.length===2&&t.some(r=>r.name===lt)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function ZM(e){for(const t of[...e.querySelectorAll(`[${lt}]`)])t.removeAttribute(lt),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!GM(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function qM(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return ZM(n.body),n.body.innerHTML}exports.Editor=UM;exports.PAGE_SEPARATOR=$a;exports.joinPagesToHtml=jt;exports.sanitizeDocumentHtml=Yr;exports.sanitizePageHtml=zc;exports.splitPagesFromHtml=Un;exports.stripCommentAnchors=qM;
|
|
321
|
+
`):[]).map(ge=>{const Le=document.createElement("link");return Le.rel="stylesheet",Le.href=ge,Le.setAttribute(ds,""),document.head.append(Le),Le});return()=>{for(const ge of ae)ge.remove()}},[He]),l.useEffect(()=>{(!A||n!=="visual"||!T)&&e.current.setActiveThreadId(null)},[A,n,T,e]),l.useEffect(()=>{if(!M)return;const q=ae=>{var $t;const ge=e.current,Le=ae.target;if(($t=ge.commentPanelRef.current)!=null&&$t.contains(Le))return;const Kt=ge.visualRootRef.current;Kt&&yh(Kt,Le)||ge.setActiveThreadId(null)};return document.addEventListener("pointerdown",q),()=>document.removeEventListener("pointerdown",q)},[M,e]),l.useEffect(()=>{if(!r||n!=="html")return;const q=t.pages[a]??"";q!==pe.current&&(pe.current=q,re(q))},[r,n,t.pages,t.revision,a]),l.useEffect(()=>{if(!A||n!=="visual")return;const q=e.current.visualRootRef.current;q&&(kS(q,U),bh(q,T))},[A,n,U,T,te,e]),F.htmlModePageHtmlRef.current=pe.current;const it=n==="visual"&&d&&ot,Jt=l.useMemo(()=>M?TS(U,M):null,[M,U]),at=n==="visual"?r?i.jsx(xI,{ref:F.multiPageVisualRef,pages:ze,activePageIndex:a,hasSelectedPage:s,scrollRootRef:F.workspaceRef,suppressPageFlushRef:F.suppressPageFlushRef,pendingInsertPageFocusRef:F.pendingInsertPageFocusRef,onActivePageIndexChange:q=>{var Le;F.activePageIndexRef.current=q,F.setActivePageIndex(q);const ae=(Le=F.multiPageVisualRef.current)==null?void 0:Le.getContainer(),ge=ae?Ye(ae,q):null;ge instanceof HTMLDivElement&&(F.visualRootRef.current=ge)},onPageSelected:()=>{F.setHasSelectedPage(!0)},onPageChange:(q,ae)=>{const ge=Z.current[q]??"";F.recordPageVisualHtml(q,cn(ae,he(ge).body),!0)},onPageFlush:(q,ae)=>{const ge=Z.current[q]??"";F.recordPageVisualHtml(q,cn(ae,he(ge).body),!1)},onBeforeInput:F.handleVisualBeforeInput,onPointerDown:q=>{if(q.currentTarget instanceof HTMLDivElement&&(F.visualRootRef.current=q.currentTarget),F.handleVisualPointerDown(q),q.currentTarget instanceof HTMLDivElement){const ae=q.currentTarget;requestAnimationFrame(()=>lo(ae))}},onMouseUp:F.handleVisualMouseUp,onContextMenu:F.handleVisualContextMenu,placeholder:h,disabled:o,rulerVisible:d,rulerUnit:f,zoomScale:u,onMarginPreview:F.multiPageRulerMarginPreview,onMarginChange:F.multiPageRulerMarginChange,onIndentChange:F.multiPageRulerIndentChange,resolveEmbeddedImageDataUrl:g?F.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:g?F.hydrateExportHtml:void 0}):i.jsx(jM,{ref:F.visualRootRef,html:he(te).body,pageHtml:te,rulerVisible:d,rulerUnit:f,zoomScale:u,propSyncGuardRef:F.visualPropSyncGuardRef,resolveEmbeddedImageDataUrl:g?F.resolveEmbeddedImageDataUrl:void 0,hydrateEmbeddedImages:g?F.hydrateExportHtml:void 0,onMarginPreview:F.singlePageRulerMarginPreview,onMarginChange:F.singlePageRulerMarginChange,onIndentChange:F.singlePageRulerIndentChange,onChange:q=>F.recordVisualInputHtml(q,!0),onBeforeInput:F.handleVisualBeforeInput,onPointerDown:q=>{if(F.handleVisualPointerDown(q),q.currentTarget instanceof HTMLDivElement){const ae=q.currentTarget;requestAnimationFrame(()=>lo(ae))}},onMouseUp:F.handleVisualMouseUp,onContextMenu:F.handleVisualContextMenu,placeholder:h,disabled:o}):i.jsxs("div",{className:Ce.htmlModeShell,children:[r&&t.pages.length>1?i.jsx(DM,{pageCount:t.pages.length,activeIndex:a,onSelect:F.handleHtmlPageTabSelect}):null,i.jsx(vM,{ref:F.htmlAreaRef,html:r?E:te,onChange:F.handleHtmlSurfaceChange,placeholder:h,disabled:o})]});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{ref:F.workspaceRef,className:`${Ce.workspace} ${ot?Ce.workspacePageSized:""} ${it?Ce.workspaceWithRuler:""}`,onDragEnter:F.htmlFileDrop.onDragEnter,onDragOver:F.htmlFileDrop.onDragOver,onDragLeave:F.htmlFileDrop.onDragLeave,onDrop:F.htmlFileDrop.onDrop,children:[n==="visual"?i.jsx("div",{className:Ce.pageCanvasViewport,"data-page-canvas-sized":ot?"":void 0,children:at}):at,F.htmlFileDrop.dragging?i.jsx(zM,{}):null]}),n==="visual"&&!o&&(K!=null&&K.isConnected)?i.jsx(FM,{img:K,onResize:F.handleImageResize,onResizeEnd:F.handleImageResizeEnd}):null,A&&T&&Jt?i.jsx(wM,{panelRef:F.commentPanelRef,thread:Jt,locale:R,disabled:D,commentAuthor:P,onPost:F.postCommentMessage,onClose:()=>F.setActiveThreadId(null)}):null,i.jsx(fx,{open:L.open,x:L.x,y:L.y,kind:L.kind,inTable:L.inTable,canMergeCells:L.canMergeCells,canUnmergeCells:L.canUnmergeCells,canDeletePage:L.canDeletePage,canAddComment:L.canAddComment,commands:j,onClose:()=>F.setContextMenu(q=>({...q,open:!1}))})]})}const KM=l.memo(OM,HM),$M=.005;function UM({value:e,defaultValue:t="",onChange:n,onAutoSave:r,onSave:o,onOpen:a,mode:s,defaultMode:u="visual",onModeChange:d,fullscreen:f,defaultFullscreen:g=!1,onFullscreenChange:h,placeholder:y,disabled:b,readOnly:C=!1,className:x,locale:v="en",toolbarBackground:k,menuColor:S,menuBackground:A,menuFontSize:T,menuFontFamily:D,border:R,menuVisible:P=!0,toolbarVisible:M=!0,allowedChrome:L,customActions:U,customFonts:j,transformHtml:_,sanitizeHtml:K=!0,loadCustomParagraphStyles:G,onSaveCustomParagraphStyle:Z,onDeleteCustomParagraphStyle:oe,customImagePicker:Y,disableBuiltinImageInsert:Q,customBackgroundImagePicker:ie,disableBuiltinBackgroundImageInsert:de,disableBuiltinBackgroundImageSources:te,customAudioPicker:E,disableBuiltinAudioInsert:re,customVideoPicker:pe,disableBuiltinVideoInsert:F,disableHtmlFileDrop:Ee=!1,toolbarCustomization:He,darkMode:ze=!1,darkModePersistence:We,toolbarPosition:ot="top",toolbarPositionPersistence:it,enablePageProperties:Jt=!1,defaultPageProperties:at,optimizeEmbeddedImages:q=!1,enableMultiPages:ae=!1,pages:ge,defaultPages:Le,onPagesChange:Kt,defaultRulerVisible:$t=!0,rulerUnit:Ut="in",enableComments:Pe=!1,defaultCommentsVisible:yn=!0,commentAuthor:xn,comments:Ir,defaultComments:jr=[],onCommentsChange:Er}){var Sm;const ye=!!(b||C),Qt=!!b,Mr=ae?ge!==void 0:e!==void 0,rr=$n(Le??(t.trim()?[t]:[zn()])),or=!Mr&&at?rr.map(c=>pf(c,at)):rr,z=l.useRef(null);q&&z.current===null&&(z.current=gw());const J=l.useRef(null);J.current===null&&(J.current=q&&z.current?or.map(c=>z.current.externalizeHtml(c)):[...or]);const le=ae?jt(J.current):J.current[0]??"",Me=K?Xr(le):le,St=ae&&ge!==void 0?jt($n(ge)):e,Cn=l.useMemo(()=>{if(St!==void 0)return K?Xr(St):St},[St,K]),Qe=l.useRef(n);Qe.current=n;const Oe=l.useRef(q);Oe.current=q;const Ae=l.useCallback(c=>!Oe.current||!z.current?c:z.current.externalizeHtml(c),[]),$e=l.useCallback(c=>!Oe.current||!z.current?c:z.current.hydrateHtml(c),[]),en=l.useCallback(c=>c.map(m=>$e(m)),[$e]),As=l.useCallback(c=>{var m;return((m=z.current)==null?void 0:m.getDataUrl(c))??null},[]),gi=l.useCallback(c=>{var m;(m=Qe.current)==null||m.call(Qe,$e(c))},[$e]),[Ts]=l.useState(()=>{if(q&&e!==void 0&&!ae){const c=K?Xr(e):e;return z.current?z.current.externalizeHtml(c):c}return Me}),[st,hi]=Na({value:s,defaultValue:u,onChange:d}),[Pt,tn]=Na({value:f,defaultValue:g,onChange:h}),[jn,Rs]=l.useState(yn),[xo,Ds]=l.useState($t),bi=l.useRef(xo);bi.current=xo;const[En,nn]=l.useState(null),[Co,ir]=Na({value:Ir,defaultValue:jr,onChange:Er}),H=l.useRef(null),_t=l.useRef(null),yi=l.useRef(null),ar=l.useRef(null),pt=l.useRef(null),sr=l.useRef(!1),xi=l.useRef(null),At=l.useRef(null),we=l.useRef(ae);we.current=ae;const Is=l.useRef(at);Is.current=at;const Mn=l.useRef(Pe);Mn.current=Pe;const Gu=l.useRef(C);Gu.current=C;const Zu=l.useRef(ye);Zu.current=ye;const Ci=l.useRef(jn);Ci.current=jn;const wi=l.useRef(Co);wi.current=Co;const vi=l.useRef(Kt);vi.current=Kt;const ki=l.useRef(null),Si=l.useRef(!1),Pi=l.useCallback(()=>{var m;Si.current=!1;const c=ki.current;ki.current=null,c&&((m=vi.current)==null||m.call(vi,c.pages,c.activePageIndex))},[]),_r=l.useCallback((c,m)=>{ki.current={pages:[...c],activePageIndex:m},!Si.current&&(Si.current=!0,queueMicrotask(Pi))},[Pi]),js=l.useRef(ge);js.current=ge;const qu=l.useMemo(()=>!q||ge===void 0?ge:$n(ge).map(c=>{var w;const m=K?Xr(c):c;return((w=z.current)==null?void 0:w.externalizeHtml(m))??m}),[q,ge,K]),ut=gP({enabled:ae,pagesProp:qu,defaultPages:J.current??[zn()]}),Nr=l.useRef(null),Yu=l.useRef(null),[Lr,wo]=l.useState(0),Te=l.useRef(Lr);Te.current=Lr;const wn=l.useRef(ae?((Sm=J.current)==null?void 0:Sm[0])??"":""),[vo,lr]=l.useState(!1),Vt=l.useRef(vo);Vt.current=vo;const[Xu,hb]=l.useState(0),Ju=l.useRef(!1),Qu=l.useRef(!1),Tt=l.useMemo(()=>Yh(),[]),Es=l.useRef(null);Es.current===null&&(Es.current=ae?TP(J.current??[zn()]):AP(Ae(Me)));const ne=Es.current,rn=l.useCallback(()=>{const c=ne.canUndo(),m=ne.canRedo();c===Ju.current&&m===Qu.current||(Ju.current=c,Qu.current=m,hb(w=>w+1))},[ne]),ce=l.useRef(Me),Ne=l.useRef(J.current??[zn()]);ae&&(Ne.current=ut.pages);const ed=l.useRef(""),td=l.useRef(!1),Wt=l.useRef(!0),Br=l.useRef(""),Fr=l.useRef(null),B=l.useRef(st);B.current=st;const nd=l.useRef(Pt);nd.current=Pt;const Ge=l.useRef(null),[,bb]=l.useState(0),ko=l.useRef(null);ko.current===null&&(ko.current=zS(()=>{bb(c=>c+1)}));const Ai=l.useRef(_);Ai.current=_;const rd=l.useRef(K);rd.current=K;const Nt=l.useRef({}),Rt=l.useRef(null),Lt=l.useRef(null),Gt=l.useRef(null),Zt=l.useRef(null),_n=l.useRef(null),Dt=l.useRef(null),[So,Ms]=l.useState(Wn),_s=l.useRef(So);_s.current=So;const vn=l.useRef(oo),[Po,Ti]=l.useState({value:null,unit:oo,mixed:!1}),Nn=l.useRef(Po);Nn.current=Po;const[Ao,Ns]=l.useState({value:null,mixed:!1}),To=l.useRef(Ao);To.current=Ao;const[Ro,Ls]=l.useState({value:null,mixed:!1}),Do=l.useRef(Ro);Do.current=Ro;const[Io,Bs]=l.useState({value:null,mixed:!1}),jo=l.useRef(Io);jo.current=Io;const[Ri,Fs]=l.useState({tag:null,mixed:!1}),Hs=l.useRef(Ri);Hs.current=Ri;const[od,zs]=l.useState({align:"left",mixed:!1}),Os=l.useRef(od);Os.current=od;const[id,Ks]=l.useState({type:null,mixed:!1}),Eo=l.useRef(id);Eo.current=id;const[ad,$s]=l.useState(!1),sd=l.useRef(ad);sd.current=ad;const[Di,Us]=l.useState(!1),Vs=l.useRef(Di);Vs.current=Di;const[Ii,ld]=l.useState(!1),ji=l.useRef(Ii);ji.current=Ii;const Ei=l.useRef(null),Mi=l.useRef(null),[cd,ud]=l.useState(!1),dd=l.useRef(cd);dd.current=cd;const{fontDialog:_i,setFontDialog:Ni,customizeToolbarOpen:Ws,setCustomizeToolbarOpen:md,documentPreview:Li,setDocumentPreview:fd,toolbarSettings:Gs,setToolbarSettings:Bi,toolbarSettingsLoading:yb,setToolbarSettingsLoading:Zs,toolbarSettingsBusy:xb,setToolbarSettingsBusy:qs,paragraphDialog:Mo,setParagraphDialog:Hr,customCssDialog:Ys,setCustomCssDialog:Xs,pageDialog:_o,setPageDialog:cr,deletePageConfirmOpen:Js,setDeletePageConfirmOpen:Qs,customStyleDialog:Cb,setCustomStyleDialog:No,linkDialog:el,setLinkDialog:Fi,bookmarkDialog:pd,setBookmarkDialog:tl,imageDialog:wb,setImageDialog:Hi,audioDialog:vb,setAudioDialog:zi,youtubeDialog:kb,setYoutubeDialog:Lo,imageProperties:Sb,setImageProperties:Oi,tableDialog:nl,setTableDialog:rl,tableProperties:ol,setTableProperties:il,cellProperties:al,setCellProperties:sl,rowProperties:ll,setRowProperties:cl,helpDialog:ul,setHelpDialog:Bo,aboutDialogOpen:dl,setAboutDialogOpen:gd}=pP(),[ur,Ki]=l.useState(()=>We?ze:If()??ze),[zr,$i]=l.useState(()=>it?ot:jf()??ot),[Fo,Pb]=l.useState(()=>CP()??"fitWidth"),[ml,Ab]=l.useState(1),[Ui,hd]=l.useState([]),[Vi,fl]=l.useState(!1),[Tb,Wi]=l.useState(!1),[Rb,pl]=l.useState({open:!1,x:0,y:0,kind:"caret",inTable:!1,canMergeCells:!1,canUnmergeCells:!1,canDeletePage:!1,canAddComment:!1}),[dt,Or]=l.useState(null),gl=l.useRef(dt);gl.current=dt;const[Gi,bd]=l.useState(!1),yd=l.useRef(Gi);yd.current=Gi;const[Zi,xd]=l.useState(!1),Cd=l.useRef(Zi);Cd.current=Zi;const[qi,wd]=l.useState(!1),vd=l.useRef(qi);vd.current=qi;const kd=l.useRef(void 0),Yi=l.useRef(Ui);Yi.current=Ui;const Sd=l.useRef(Vi);Sd.current=Vi;const Xi=!!(G&&Z),hl=l.useRef(Xi);hl.current=Xi;const Pd=l.useRef(G);Pd.current=G;const Ad=l.useRef(Z);Ad.current=Z;const Td=l.useRef(oe);Td.current=oe;const Rd=l.useRef(o);Rd.current=o;const Dd=l.useRef(a);Dd.current=a;const Id=l.useRef(Y);Id.current=Y;const kn=ie??Y,jd=de??Q??!1,bl=te??Q??!1,yl=l.useRef(kn);yl.current=kn;const xl=l.useRef(jd);xl.current=jd;const Db=l.useRef(bl);Db.current=bl;const Ed=l.useRef(E);Ed.current=E;const Md=l.useRef(pe);Md.current=pe;const _d=l.useRef(He);_d.current=He;const Nd=l.useRef(We);Nd.current=We;const Ld=l.useRef(it);Ld.current=it;const Bd=l.useRef(ur);Bd.current=ur;const Fd=l.useRef(zr);Fd.current=zr;const Ji=l.useRef(Fo);Ji.current=Fo;const Qi=l.useRef(ml);Qi.current=ml;const Hd=l.useRef(Q);Hd.current=Q;const zd=l.useRef(re);zd.current=re;const Od=l.useRef(F);Od.current=F;const Cl=l.useRef(0),Ho=l.useRef(0),Kd=l.useRef(0),ea=l.useRef(0),$d=l.useRef(0),ta=l.useRef(0),Ud=l.useRef(0),Kr=l.useMemo(()=>dp(j),[j]),$r=l.useRef(Kr);$r.current=Kr;const na=l.useCallback(()=>{var c;if(we.current){const m=(c=pt.current)==null?void 0:c.getActivePageRoot();if(m instanceof HTMLElement)return m}return H.current},[]),on=l.useCallback(()=>{var w;const c=H.current;if(c!=null&&c.hasAttribute(Pr)){const I=Vm(c);if(I!==null)return I}const m=(w=pt.current)==null?void 0:w.getActivePageIndex();return typeof m=="number"?m:Te.current},[]),zo=l.useCallback(()=>{if(we.current){const c=pt.current;if(!c)return null;const m=on();if(m===null)return null;c.ensurePageMounted(m);const w=c.getContainer(),I=w?Ye(w,m):null;return I instanceof HTMLDivElement?(H.current=I,I):null}return H.current},[on]),Ur=l.useCallback(()=>{if(!we.current)return ce.current;const c=on()??Te.current;return Ne.current[c]??""},[on]);l.useLayoutEffect(()=>{var m;if(!ae)return;const c=(m=pt.current)==null?void 0:m.getActivePageRoot();c instanceof HTMLDivElement&&(H.current=c)},[ae,Lr]);const ra=l.useRef(()=>{}),wl=l.useRef(!1),Ib=l.useCallback(()=>{if(wl.current||B.current!=="visual")return;const c=ar.current;if(c){wl.current=!0;try{const m=getComputedStyle(c),w=parseFloat(m.paddingLeft)+parseFloat(m.paddingRight),I=parseFloat(m.paddingTop)+parseFloat(m.paddingBottom),N=Math.max(0,c.clientWidth-w),V=Math.max(0,c.clientHeight-I);let ee=0,me=0;if(td.current){const xe=WC(tt(ed.current));xe&&(ee=xe.width,me=xe.height)}else{const xe=na(),Ze=Qi.current>0?Qi.current:1;ee=((xe==null?void 0:xe.offsetWidth)??0)/Ze,me=((xe==null?void 0:xe.offsetHeight)??0)/Ze}ee<=0&&(ee=N),me<=0&&(me=V);const Re=nv(Ji.current,N,V,ee,me);Math.abs(Re-Qi.current)>=$M&&Ab(Re)}finally{wl.current=!1}}},[na]);ra.current=Ib,l.useLayoutEffect(()=>{if(st!=="visual")return;const c=na();!c||c!==document.activeElement||lo(c)},[st,Lr,na]);const oa=l.useCallback(async()=>{const c=Pd.current;if(!c)return;const m=++Cl.current;fl(!0);try{const w=await c();if(m!==Cl.current)return;hd(w)}catch{}finally{m===Cl.current&&fl(!1)}},[]);l.useEffect(()=>{if(!G||!Z){hd([]),fl(!1);return}oa()},[G,Z,oa]);const Vd=l.useCallback(async c=>{Bi(c);const m=_d.current;if(m!=null&&m.load&&m.save){const w=++Kd.current;qs(!0);try{await m.save(c)}catch{}finally{w===Kd.current&&qs(!1)}return}MP(c)},[]);l.useEffect(()=>{const c=He;if(!(c!=null&&c.load)||!c.save){Bi(EP()),Zs(!1),qs(!1);return}const m=++Ho.current;return Zs(!0),(async()=>{try{const w=await c.load();if(m!==Ho.current)return;Bi(w)}catch{if(m!==Ho.current)return;Bi(null)}finally{m===Ho.current&&Zs(!1)}})(),()=>{Ho.current+=1}},[He]);const Wd=l.useCallback(async c=>{Ki(c);const m=Nd.current;if(m!=null&&m.load&&m.save){const w=++$d.current;try{await m.save(c)}catch{}finally{if(w!==$d.current)return}return}bP(c)},[]),Gd=l.useCallback(c=>{Ji.current=c,Pb(c),wP(c);const m=ar.current;m&&(m.scrollTop=0,m.scrollLeft=0),ra.current()},[]);l.useEffect(()=>{const c=We;if(!(c!=null&&c.load)||!c.save){Ki(If()??ze);return}const m=++ea.current;return(async()=>{try{const w=await c.load();if(m!==ea.current)return;Ki(typeof w=="boolean"?w:ze)}catch{if(m!==ea.current)return;Ki(ze)}})(),()=>{ea.current+=1}},[We,ze]),l.useLayoutEffect(()=>{if(ra.current(),st!=="visual")return;const c=ar.current;if(!c||typeof ResizeObserver>"u")return;const m=rv(()=>{ra.current()}),w=new ResizeObserver(()=>{m.schedule()});return w.observe(c),()=>{w.disconnect(),m.cancel()}},[st,Lr,Fo,ae]);const Zd=l.useCallback(async c=>{$i(c);const m=Ld.current;if(m!=null&&m.load&&m.save){const w=++Ud.current;try{await m.save(c)}catch{}finally{if(w!==Ud.current)return}return}kP(c)},[]);l.useEffect(()=>{const c=it;if(!(c!=null&&c.load)||!c.save){$i(jf()??ot);return}const m=++ta.current;return(async()=>{try{const w=await c.load();if(m!==ta.current)return;$i(Fh(w)??ot)}catch{if(m!==ta.current)return;$i(ot)}})(),()=>{ta.current+=1}},[it,ot]);const Vr=l.useCallback((c,m)=>{var me,Re;const w=rd.current?Xr(c):c,I=((me=Ai.current)==null?void 0:me.call(Ai,w))??w,N=vh(ce.current,I,$e);m!=null&&m.fullReplace&&!N&&Oe.current&&((Re=z.current)==null||Re.clear());const V=Ae(I);if(N)return ce.current=V,{stored:V,stateUpdated:!1};V!==ce.current&&(Wt.current=!0);const ee=Nr.current;if(we.current){const xe=ut;if(!xe)return ce.current=V,{stored:V,stateUpdated:!1};const Ze=xe.replacePages(Un(V));return ce.current=Ze.joined,Ne.current=Ze.pages,B.current==="html"&&!Oe.current&&(ee==null||ee.setHtml(V)),_r(en(Ze.pages),Te.current),{stored:V,stateUpdated:!0}}return Oe.current?(ce.current=V,ee==null||ee.setStorageHtml(V),gi(V),{stored:V,stateUpdated:!0}):(ce.current=V,ee==null||ee.setHtml(V),{stored:V,stateUpdated:!0})},[Ae,$e,en,gi,_r]),an=l.useCallback((c,m,w,I)=>{var me;const N=c.map(Re=>Ae(Re)),V=ut;if(!V)return jt(N);const ee=V.setPages(N,{editedIndex:w});if(!ee.changed)return ee.joined;if(Ne.current=ee.pages,Wt.current=!0,ce.current=ee.joined,js.current===void 0&&B.current==="html"&&!Oe.current&&((me=Nr.current)==null||me.setHtml(ee.joined)),_r(en(ee.pages),Te.current),!(I!=null&&I.skipHistory)&&Bt(ne)){const{changedIndices:Re,pages:xe}=ee;if(Re.length===1){const Ze=w??Re[0];ne.recordPageEdit(Ze,xe[Ze]??"",{coalesce:m})}else Re.length>1?ne.recordReplaceAll(xe):w!==void 0?ne.recordPageEdit(w,xe[w]??"",{coalesce:m}):ne.recordReplaceAll(xe)}return rn(),ee.joined},[rn,Ae,en,ne,ut,_r]),Ln=l.useCallback(c=>{var V,ee;if(B.current!=="visual")return;const m=Oe.current?me=>{var Re;return((Re=z.current)==null?void 0:Re.getDataUrl(me))??null}:void 0,w=Oe.current?$e:void 0;if((V=_t.current)==null||V.call(_t),we.current){const me=(ee=pt.current)==null?void 0:ee.getContainer();if(!me)return;const Re=Un(c);for(let xe=0;xe<Re.length;xe+=1){const Ze=Ye(me,xe);if(!Ze)continue;const mt=dn(he(Re[xe]??"").body);ns(Ze,mt,{resolveDataUrl:m,hydrateEmbeddedImages:w})}return}const I=H.current;if(!I)return;const N=dn(he(c).body);ns(I,N,{resolveDataUrl:m,hydrateEmbeddedImages:w})},[$e]),gt=l.useCallback((c,m)=>{const{stored:w,stateUpdated:I}=Vr(c,{fullReplace:!m});return!m&&I&&Ln(w),Bt(ne)?ne.recordReplaceAll(Un(w)):ne.record(w,{coalesce:m}),rn(),w},[rn,Vr,ne,Ln]),jb=l.useCallback(c=>{if(we.current){const m=Te.current,I=Ne.current.slice();I[m]=c,an(I,!1,m);return}gt(c,!1)},[an,gt]),qd=SP({enabled:!ye&&!Ee,onHtml:jb}),be=l.useCallback((c,m)=>{var w;return(w=_t.current)==null||w.call(_t),gt(wa(c,va(c,ce.current,$r.current,{liveRoot:H.current??void 0})),m)},[gt]),Eb=l.useCallback((c,m)=>be(cn(c,ce.current),m),[be]),ia=l.useCallback((c,m,w)=>{JC(c,m,w)},[]),aa=l.useCallback((c,m,w)=>{const I={...Go(c),atRule:tt(Jp(m,w))};return zc(c,I)},[]),dr=l.useCallback((c,m,w)=>wa(c,va(c,m,$r.current,{liveRoot:w})),[]),ht=l.useCallback(c=>{const m=pt.current,w=m==null?void 0:m.getContainer(),I=ut.pages.length>0?ut.pages:Ne.current;if(!w||!m)return[...I];const N=ut;if(!N)return[...I];const V=N.dirtyPagesRef.current,ee=(c==null?void 0:c.allPages)===!0,me=Te.current;let Re=!1;const xe=I.map((mt,Zr)=>{if(!(ee||V.has(Zr)||Zr===me))return mt;const ya=Ye(w,Zr);let xa=null;if(ya?(xs(ya),xa=ya.innerHTML):xa=m.flushPageHtml(Zr),xa===null){const Tm=dn(he(mt).body),Rm=rf(Tm);if(Rm===Tm)return mt;const Dm=dr(cn(Rm,he(mt).body),mt);return Dm!==mt&&(Re=!0),Dm}const ny=cn(xa,he(mt).body),Am=dr(ny,mt,ya??void 0);return Am!==mt&&(Re=!0),Am});if(Re){const mt=Oe.current?xe.map(Pm=>Ae(Pm)):xe,Zr=N.setPages(mt);ce.current=Zr.joined}N.markPagesClean();const Ze=Re?N.pages:I;return Oe.current?Ze.map(mt=>Ae(mt)):[...Ze]},[Ae,ut,dr]),mr=l.useCallback((c,m,w)=>{const I=dr(m,Ne.current[c]??""),N=kc(Ne.current,c,I);N.changed&&an(N.pages,w,c)},[an,dr]),fr=l.useCallback((c,m,w)=>{const I=Ne.current[c]??"",N=he(m).body,V=rf(N),ee=V===N?m:dr(cn(V,he(I).body),I),me=kc(Ne.current,c,ee);me.changed&&an(me.pages,w,c)},[an,dr]),Yd=l.useCallback((c,m)=>{const w=he(c).body;we.current?mr(Te.current,w,m):be(w,m)},[mr,be]),ue=l.useCallback((c,m,w)=>{var ee;const I=w?he(w).body:c.innerHTML,N=me=>w?I:cn(I,he(me).body);if(!we.current){be(N(ce.current),m);return}const V=(ee=pt.current)==null?void 0:ee.getContainer();if(!V){be(N(ce.current),m);return}for(let me=0;me<Ne.current.length;me+=1)if(Ye(V,me)===c){mr(me,N(Ne.current[me]??""),m);return}be(N(ce.current),m)},[mr,be]),Xd=l.useCallback((c,m)=>{Gu.current||ue(c,m)},[ue]),Mb=l.useMemo(()=>CI(()=>H.current,()=>ce.current,ia),[ia]),_b=l.useMemo(()=>wI(()=>H.current,()=>ce.current,aa,c=>be(he(c).body,!1)),[aa,be]),Nb=l.useMemo(()=>Kf(()=>H.current,Ut??"in",c=>ue(c,!1)),[Ut,ue]),Lb=l.useMemo(()=>vI(c=>{var w;const m=(w=pt.current)==null?void 0:w.getContainer();return m?Ye(m,c):null},c=>Ne.current[c]??"",ia),[ia]),Bb=l.useMemo(()=>kI(c=>{var w;const m=(w=pt.current)==null?void 0:w.getContainer();return m?Ye(m,c):null},c=>Ne.current[c]??"",aa,(c,m)=>mr(c,he(m).body,!1)),[aa,mr]),Fb=l.useMemo(()=>Kf(()=>{var m;const c=(m=pt.current)==null?void 0:m.getContainer();return c?Ye(c,Te.current):null},Ut??"in",c=>ue(c,!1)),[Ut,ue]),Jd=l.useCallback(()=>{const c=we.current?ht():[ce.current];return c[Te.current]??c[0]??""},[ht]),pr=l.useCallback(()=>{if(!we.current)return[ce.current];if(B.current==="html"){const c=Ne.current.slice();return c[Te.current]=wn.current,c}return ht({allPages:!0})},[ht]),sa=l.useCallback(c=>{if(!we.current||B.current!=="visual"||!Vt.current)return;sr.current=!0;const m=ht(),w=Math.max(0,Math.min(c,m.length)),I=[...m],N=Is.current?pf(zn(),Is.current):zn();I.splice(w,0,N);const V=I.map(ee=>Ae(ee));an(I,!1,void 0,{skipHistory:!0}),Bt(ne)&&ne.recordInsertPage(w,V),Te.current=w,wo(w),lr(!0),xi.current=w},[ht,an,ne,Ae]),Qd=l.useCallback(()=>{const c=on();c===null||!Vt.current||sa(c)},[sa,on]),em=l.useCallback(()=>{const c=on();c===null||!Vt.current||sa(c+1)},[sa,on]),tm=l.useCallback(()=>{if(!we.current||B.current!=="visual"||!Vt.current)return;sr.current=!0;const c=ht();if(c.length<=1){sr.current=!1;return}const m=on();if(m===null){sr.current=!1;return}const w=c[m]??"",I=c.filter((me,Re)=>Re!==m),N=Ae(w),V=I.map(me=>Ae(me));an(I,!1,void 0,{skipHistory:!0}),Bt(ne)&&ne.recordDeletePage(m,N,V);const ee=Math.min(m,I.length-1);Te.current=ee,wo(ee),lr(!0)},[ht,an,ne,on,Ae]);l.useEffect(()=>{ae||lr(!1)},[ae]),l.useEffect(()=>()=>{ki.current&&(Si.current=!1,Pi())},[Pi]);const la=l.useCallback(c=>{var I,N;const m=ut.replacePages([...c]);ce.current=m.joined,Ne.current=m.pages,Wt.current=!0,_r(en(m.pages),Te.current);const w=Math.max(0,Math.min(Te.current,m.pages.length-1));w!==Te.current&&(Te.current=w,wo(w)),js.current===void 0&&B.current==="html"&&!Oe.current&&((I=Nr.current)==null||I.setHtml(m.joined)),(N=_t.current)==null||N.call(_t),Ln(m.joined),Bt(ne)&&ne.applyPresent(m.pages)},[en,ne,ut,_r,Ln]),ca=l.useCallback(()=>{if(B.current!=="visual"||ye){Or(null);return}const c=H.current;if(!c)return;const m=Vn(c);Or(w=>m||(w&&w.isConnected&&c.contains(w)?w:null))},[ye]),ua=l.useCallback(()=>{if(Bt(ne)){const m=ne.undo();if(m===null)return;ne.markApplying(),la(m),rn();return}const c=ne.undo();c!==null&&(ne.markApplying(),Vr(c,{fullReplace:!0}),Ln(c),ne.finishApplying(),ca(),rn())},[la,rn,Vr,ne,ca,Ln]),da=l.useCallback(()=>{if(Bt(ne)){const m=ne.redo();if(m===null)return;ne.markApplying(),la(m),rn();return}const c=ne.redo();c!==null&&(ne.markApplying(),Vr(c,{fullReplace:!0}),Ln(c),ne.finishApplying(),ca(),rn())},[la,rn,Vr,ne,ca,Ln]);l.useEffect(()=>{if(ae){Bt(ne)&&(ge!==void 0&&!q?ne.syncPages(Ne.current):ne.applyPresent(Ne.current));return}Bt(ne)||ne.syncExternal(ce.current)},[ae,q,ne,ge]);const O=l.useCallback(()=>{Ge.current=ln({mode:B.current,visualEl:H.current,htmlEl:At.current})},[]),sn=l.useCallback(c=>{if(!c||B.current!=="visual"){bd(!1),xd(!1),wd(!1);return}bd(Eu(c)!==null),xd(uf(c)),wd(df(c))},[]),nm=l.useCallback(()=>{const c=ln({mode:B.current,visualEl:H.current,htmlEl:At.current}),m=Ge.current;Bm(m,c)||(Ge.current=c)},[]),vl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Ti({value:null,unit:vn.current,mixed:!1});return}const m=Eg(c,vn.current);Rt.current&&(m.value=Rt.current.value,m.unit=Rt.current.unit,m.mixed=!1),vn.current=m.unit,Ti(w=>w.value===m.value&&w.unit===m.unit&&w.mixed===m.mixed?w:m)},[]),kl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Ns({value:null,mixed:!1});return}const m=gp(c);Lt.current&&(m.value=Lt.current.value,m.mixed=!1),Ns(w=>w.value===m.value&&w.mixed===m.mixed?w:m)},[]),Sl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Ls({value:null,mixed:!1}),Bs({value:null,mixed:!1});return}const m=Fa(c,"color");Gt.current&&(m.value=Gt.current.value,m.mixed=!1);const w=Fa(c,"backgroundColor");Zt.current&&(w.value=Zt.current.value,w.mixed=!1),Ls(I=>I.value===m.value&&I.mixed===m.mixed?I:m),Bs(I=>I.value===w.value&&I.mixed===w.mixed?I:w)},[]),Pl=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Fs({tag:null,mixed:!1});return}const m=Wv(c);Fs(w=>w.tag===m.tag&&w.mixed===m.mixed?w:m)},[]),Al=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){zs({align:null,mixed:!1}),Ks({type:null,mixed:!1}),$s(!1),ud(!1);return}const m=ah(c);zs(V=>V.align===m.align&&V.mixed===m.mixed?V:m);const w=Vg(c);Ks(V=>V.type===w.type&&V.mixed===w.mixed?V:w);const I=nk(c);$s(V=>V===I?V:I);const N=iS(c);ud(V=>V===N?V:N)},[]),$=l.useCallback(()=>{const c=H.current;if(B.current!=="visual"||!c){Ms(Wn()),Us(!1),vl(),kl(),Sl(),Pl(),Al();return}const m=Ge.current,w=!!(m&&!m.collapsed);Us(N=>N===w?N:w);const I=Bg(eo(c),Nt.current);Ms(N=>Sv(N,I)?N:I),vl(),kl(),Sl(),Pl(),Al()},[vl,kl,Sl,Pl,Al]),rm=l.useCallback(()=>{const c=Ge.current,m=Dt.current;!m||!c||c.collapsed&&c.start===m.start&&c.end===m.end||(Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null)},[]);l.useEffect(()=>{if(st==="visual"){$();return}Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null,Ms(Wn()),Ti({value:null,unit:vn.current,mixed:!1}),Ns({value:null,mixed:!1}),Ls({value:null,mixed:!1}),Bs({value:null,mixed:!1}),Fs({tag:null,mixed:!1}),zs({align:null,mixed:!1}),Ks({type:null,mixed:!1}),$s(!1),Us(!1)},[st,$]);const Wr=l.useCallback((c,m,w)=>{Wx({snapshot:c,visualEl:H.current,htmlEl:At.current,getHtml:()=>B.current==="visual"&&H.current?H.current.innerHTML:ce.current,setHtml:I=>{if(B.current==="visual"){const N=we.current?Ne.current[Te.current]??"":ce.current;Yd(cn(he(I).body,he(N).body),!1);return}gt(I,!1)},content:m,asHtml:w})},[gt,Yd]),Hb=l.useCallback(c=>{if(!we.current||c===Te.current)return;fr(Te.current,wn.current,!0),Te.current=c,wo(c);const m=Ne.current[c]??"";wn.current=m},[fr]),zb=l.useCallback(c=>{if(we.current){if(Oe.current){const m=Ae(c);wn.current=m,fr(Te.current,m,!0)}else wn.current=c,fr(Te.current,c,!0);return}gt(c,!0)},[Ae,gt,fr]),om=l.useCallback(c=>{var m;if(B.current==="visual"&&c==="html"){if(we.current){const w=ht({allPages:!0}),I=Te.current,N=w[I]??w[0]??"";wn.current=N,ce.current=jt(w)}else if(H.current){const w=cn(H.current.innerHTML,he(ce.current).body),I=wa(w,va(w,ce.current,$r.current,{liveRoot:H.current??void 0}));if(Oe.current){const N=Ae(I),V=ce.current;(m=Nr.current)==null||m.setStorageHtml(N),ce.current=N,N!==V&&(Wt.current=!0,Bt(ne)||ne.record(N,{coalesce:!0}))}else I!==ce.current&>(I,!0)}}B.current==="html"&&c==="visual"&&we.current&&fr(Te.current,wn.current,!0),hi(c),c!=="visual"&&lr(!1)},[Ae,ne,gt,fr,hi,ht]);l.useEffect(()=>{if(!Pt)return;const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}},[Pt]),l.useEffect(()=>{if(!Pt)return;const c=m=>{m.key==="Escape"&&(m.defaultPrevented||_i.open||Ys.open||Mo.open||_o.open||Js||nl.open||ol.open||al.open||ll.open||Ws||Li.open||ul.open||dl||(m.preventDefault(),tn(!1)))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[Pt,tn,_i.open,Ys.open,Mo.open,_o.open,Js,nl.open,ol.open,al.open,ll.open,Ws,Li.open,ul.open,dl]),l.useEffect(()=>{const c=()=>{if(B.current!=="visual"||!H.current)return;const m=window.getSelection();if(!m||m.rangeCount===0)return;const w=m.anchorNode;!w||!H.current.contains(w)&&H.current!==w||Fr.current===null&&(Fr.current=window.requestAnimationFrame(()=>{var N;Fr.current=null;const I=H.current;if(!(!I||B.current!=="visual")&&(O(),rm(),$(),Or(Vn(I)),sn(I),Mn.current&&Ci.current&&!((N=yi.current)!=null&&N.contains(document.activeElement)))){const V=Ge.current;V&&nn(xf(I,V))}}))};return document.addEventListener("selectionchange",c),()=>{document.removeEventListener("selectionchange",c),Fr.current!==null&&(window.cancelAnimationFrame(Fr.current),Fr.current=null)}},[O,rm,$,sn]),l.useEffect(()=>{if(st!=="html")return;const c=At.current;if(!c)return;const m=()=>O();return c.addEventListener("select",m),c.addEventListener("keyup",m),c.addEventListener("mouseup",m),()=>{c.removeEventListener("select",m),c.removeEventListener("keyup",m),c.removeEventListener("mouseup",m)}},[st,O]);const W=l.useCallback(c=>{const m=ln({mode:"visual",visualEl:c,htmlEl:At.current}),w=Ge.current,I=Bm(w,m)?w:m.visualRange?m:w??m;Ge.current=I,c.focus();const N=Vx(c,I);if(N){const V=window.getSelection();try{V==null||V.removeAllRanges(),V==null||V.addRange(N),Ge.current={...I,visualRange:N}}catch{}}return Ge.current??I},[]),Sn=l.useCallback(()=>{Ei.current=null,Mi.current=null,ld(!1)},[]),im=l.useCallback(()=>{if(!ji.current||!Ei.current||!Mi.current||B.current!=="visual")return;const c=H.current;if(!c)return;O();const m=Ge.current;!m||m.collapsed||LS(m,Mi.current)||(W(c),FS(c,Ei.current),ue(c,!1),O(),$(),Sn())},[O,W,be,$,Sn]),am=l.useCallback(()=>{if(B.current!=="visual"){Sn();return}if(ji.current){Sn();return}const c=H.current;if(!c){Sn();return}const m=W(c);if(m.collapsed){Sn();return}Ei.current=BS(c),Mi.current={...m},ld(!0),O()},[Sn,W,O]),Ob=l.useCallback(()=>{im()},[im]);l.useEffect(()=>{(st!=="visual"||ye)&&Sn()},[st,ye,Sn]);const Tl=l.useCallback((c,m)=>{if(B.current!=="visual")return;const w=H.current;if(!w)return;const I=m??vn.current,N=vr(c,I);if(!N)return;vn.current=N.unit;const V=W(w);if(V.collapsed){Rt.current=N,Dt.current={start:V.start,end:V.end},$();return}Rt.current=null,Dc(w,N.value,N.unit)&&(ue(w,!1),O(),$())},[W,be,O,$]),sm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(w.collapsed){Lt.current={value:c},Dt.current={start:w.start,end:w.end},$();return}Lt.current=null,gc(m,c)&&(ue(m,!1),O(),$())},[W,be,O,$]),Rl=l.useCallback((c,m)=>{if(B.current!=="visual")return;const w=H.current;if(!w)return;const I=W(w),N=c==="color"?Gt:Zt;if(I.collapsed){N.current={value:m},Dt.current={start:I.start,end:I.end},$();return}N.current=null,Yo(w,c,m)&&(ue(w,!1),O(),$())},[W,be,O,$]),Dl=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(Ni({open:!1,tab:"general"}),w.collapsed){if(c.size!==null){const ee=vr(c.size,c.unit);ee&&(Rt.current=ee,vn.current=ee.unit)}const N=eo(m),V={};for(const ee of zt)c.marks[ee]!==N[ee]&&(V[ee]=c.marks[ee]);Nt.current=V,c.fontColorMixed||(Gt.current={value:c.fontColor}),c.highlightColorMixed||(Zt.current={value:c.highlightColor}),c.fontFamilyMixed||(Lt.current={value:c.fontFamily}),Dt.current={start:w.start,end:w.end},$();return}if(Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,Dt.current=null,c.size!==null){const N=vr(c.size,c.unit);N&&(vn.current=N.unit,Dc(m,N.value,N.unit))}const I=eo(m);for(const N of zt)c.marks[N]!==I[N]&&Ec(m,N);c.fontFamilyMixed||gc(m,c.fontFamily),c.fontColorMixed||Yo(m,"color",c.fontColor),c.highlightColorMixed||Yo(m,"backgroundColor",c.highlightColor),ue(m,!1),O(),$()},[W,be,O,$]),Il=l.useCallback((c,m)=>{if(B.current!=="visual")return;const w=H.current;if(!w)return;W(w),Hr(N=>({...N,open:!1}));let I=lh(w,c);if(m&&jk(w,m)&&(I=!0),!I){O(),$();return}ue(w,!1),O(),$()},[W,be,O,$]),lm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(Xs(I=>({...I,open:!1})),!Cs(c)){O(),$();return}if(w.collapsed){_n.current=c,Dt.current={start:w.start,end:w.end},$();return}if(_n.current=null,!Lg(m,c)){O(),$();return}ue(m,!1),O(),$()},[W,be,O,$]),jl=l.useCallback(c=>{if(B.current!=="visual")return;const m=zo();if(!m)return;W(m),cr(V=>({...V,open:!1}));const w=Ur(),I=JSON.stringify(c.atRule)!==JSON.stringify(tt(he(w).body)),N=zc(m,c);if(I&&bo(m,N.pageHtml),!N.changed&&!I){O(),$();return}ue(m,!1,N.pageHtml),O(),$()},[W,ue,O,$,zo,Ur]),cm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Fi(w=>({...w,open:!1})),!dS(m,c)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),um=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),tl(w=>({...w,open:!1})),!gS(m,c)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),ma=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Hi({open:!1}),!Nw(m,c,z.current)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),fa=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),zi({open:!1}),!JS(m,c)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),dm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Lo({open:!1}),!d0(m,c)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),mm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),rl({open:!1}),!mk(m,c)){O(),$();return}ue(m,!1),O(),$(),sn(m)}},[W,be,O,$,sn]),fm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),il(w=>({...w,open:!1})),!z0(m,c)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),pm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),sl(w=>({...w,open:!1})),!Y0(m,c)){O(),$();return}ue(m,!1),O(),$(),sn(m)}},[W,be,O,$,sn]),gm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),cl(w=>({...w,open:!1})),!aP(m,c)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),Pn=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),!c(m)){O(),$();return}ue(m,!1),O(),$(),sn(m)}},[W,be,O,$,sn]),El=l.useCallback(c=>{ma({src:c.src,alt:c.alt??"",title:c.title??"",css:c.css})},[ma]),Ml=l.useCallback(c=>{fa({src:c.src,title:c.title??"",css:c.css})},[fa]),_l=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Lo({open:!1}),!m0(m,{src:c.src,title:c.title??"",css:c.css})){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),hm=l.useCallback(c=>{if(B.current!=="visual")return;const m=H.current;if(m){if(W(m),Oi(w=>({...w,open:!1})),!Jw(m,c)){O(),$();return}ue(m,!1),O(),$()}},[W,be,O,$]),Kb=l.useCallback((c,m)=>{dt!=null&&dt.isConnected&&N0(dt,c,m)},[dt]),$b=l.useCallback(()=>{const c=H.current;!c||!(dt!=null&&dt.isConnected)||(ue(c,!1),Jl(c,dt),O(),$())},[dt,be,O,$]),pa=l.useCallback(()=>{if(B.current!=="visual"||!H.current)return ce.current;const c=cn(H.current.innerHTML,he(ce.current).body);return wa(c,va(c,ce.current,$r.current,{liveRoot:H.current}))},[]),ga=l.useCallback(()=>{if(we.current){const c=jt(pr());return ce.current=c,$e(c)}if(Wt.current){const c=B.current==="visual"?pa():ce.current;c!==ce.current&&(ce.current=c)}return $e(ce.current)},[pr,$e,pa]),Ub=l.useRef(-1),bm=l.useCallback(()=>{if(!Wt.current&&Br.current)return Br.current;const c=Wt.current&&B.current==="visual"?pa():ce.current;return c!==ce.current&&(ce.current=c),Br.current=c,Wt.current=!1,c},[pa]),ym=l.useCallback(()=>{if(!Wt.current&&Br.current)return Br.current;const c=ht(),m=JSON.stringify(c);return Br.current=m,Ub.current=ut.revision,Wt.current=!1,m},[ht,ut.revision]),Vb=l.useCallback(()=>we.current?ym():bm(),[ym,bm]);fP({onAutoSave:r?async c=>{Wt.current=!1;const m=we.current?en(JSON.parse(c)):$e(c);return r(m)}:void 0,getHtml:Vb}),l.useEffect(()=>()=>{var c;(c=z.current)==null||c.clear()},[]),l.useEffect(()=>{var m;if(!q||e===void 0||ae)return;const c=Ae(e);(m=Nr.current)==null||m.setStorageHtml(c),ce.current=c,Bt(ne)||ne.syncExternal(c)},[ae,Ae,ne,q,e]),l.useEffect(()=>{if(!q||!ae||ge===void 0)return;const c=$n(ge).map(w=>Ae(w));if(xr(c,Ne.current))return;const m=ut.replacePages(c);if(ce.current=m.joined,Ne.current=m.pages,Bt(ne)&&ne.syncPages(m.pages),B.current==="html"){const w=m.pages[Te.current]??"";wn.current=w}},[ae,Ae,ne,q,ut,ge]),l.useEffect(()=>()=>{var c;(c=ko.current)==null||c.cancel()},[]);const Ie=l.useMemo(()=>({getHtml:ga,setHtml:c=>{gt(c,!1)},getMode:()=>B.current,setMode:om,getFullscreen:()=>nd.current,setFullscreen:tn,getDarkMode:()=>Bd.current,setDarkMode:c=>{Wd(c)},getPageZoom:()=>Ji.current,setPageZoom:Gd,getToolbarPosition:()=>Fd.current,setToolbarPosition:c=>{Zd(c)},openCustomizeToolbar:()=>{md(!0)},openDocumentPreview:()=>{fd({open:!0,html:$e(jt(pr()))})},openHelp:()=>{Bo({open:!0,topicId:"getStarted"})},openKeyboardShortcuts:()=>{Bo({open:!0,topicId:"keyboardShortcuts"})},openAbout:()=>{gd(!0)},toggleReadAloud:()=>{const c=ko.current;if(!c)return;const m=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current}),w=wf(ka(m),ga());w&&c.toggle(w)},toggleRuler:()=>{Ds(c=>!c)},isReadingAloud:()=>{var c;return((c=ko.current)==null?void 0:c.isSpeaking())??!1},isRulerVisible:()=>bi.current,canReadAloud:()=>{if(!_a())return!1;const c=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});return wf(ka(c),ga())!==null},undo:ua,redo:da,canUndo:()=>ne.canUndo(),canRedo:()=>ne.canRedo(),getSelection:()=>{const c=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});return ka(c)},insertText:c=>{const m=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});Wr(m,c,!1)},insertHtml:(c,m)=>{const w=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current}),I=m===void 0;Wr(w,I?c:m,I)},toggleFontMark:c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;const w=W(m);if(w.collapsed){const I=eo(m);Nt.current=Av(Nt.current,I,c),Dt.current={start:w.start,end:w.end},$();return}Nt.current={},Dt.current=null,Ec(m,c)&&(ue(m,!1),O(),$())},clearFormatting:()=>{if(B.current!=="visual")return;const c=H.current;!c||W(c).collapsed||(Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null,NS(c)&&(ue(c,!1),O(),$()))},toggleFormatBrush:am,isFormatBrushActive:()=>ji.current,isFontMarkActive:c=>_s.current[c],hasTextSelection:()=>B.current==="visual"&&Vs.current,setFontSize:(c,m)=>{Tl(c,m)},setFontSizeUnit:c=>{var ee;const m=H.current,w=Nn.current;if(B.current!=="visual"||!m||w.value===null||w.mixed){vn.current=c,Ti(me=>({...me,unit:c}));return}const I=W(m),N=fv(m,((ee=I.visualRange)==null?void 0:ee.startContainer)??m),V=bp(w.value,w.unit,c,N.parentPx,N.rootPx);Tl(V,c)},getFontSize:()=>Nn.current.value,getFontSizeUnit:()=>Nn.current.unit,isFontSizeMixed:()=>Nn.current.mixed,setFontFamily:c=>{sm(c)},getFontFamily:()=>To.current.value,isFontFamilyMixed:()=>To.current.mixed,getFontFaces:()=>$r.current,setFontColor:c=>{Rl("color",c)},setHighlightColor:c=>{Rl("backgroundColor",c)},getFontColor:()=>Do.current.value,isFontColorMixed:()=>Do.current.mixed,getHighlightColor:()=>jo.current.value,isHighlightColorMixed:()=>jo.current.mixed,setParagraphStyle:c=>{if(B.current!=="visual")return;const m=H.current;m&&(W(m),Gv(m,c)&&(ue(m,!1),O(),$()))},getParagraphStyle:()=>Hs.current.tag,isParagraphStyleMixed:()=>Hs.current.mixed,setTextAlign:c=>{if(B.current!=="visual")return;const m=H.current;m&&(W(m),sh(m,c)&&(ue(m,!1),O(),$()))},getTextAlign:()=>Os.current.align,isTextAlignMixed:()=>Os.current.mixed,indent:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),rk(c)&&(ue(c,!1),O(),$()))},outdent:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),ok(c)&&(ue(c,!1),O(),$()))},canOutdent:()=>B.current==="visual"&&sd.current,toggleList:c=>{if(B.current!=="visual")return;const m=H.current;m&&(W(m),Yv(m,c)&&(ue(m,!1),O(),$()))},isBulletList:()=>Eo.current.type==="ul"&&!Eo.current.mixed,isNumberedList:()=>Eo.current.type==="ol"&&!Eo.current.mixed,openFontProperties:c=>{B.current==="visual"&&Ni({open:!0,tab:c??"general"})},applyFontProperties:c=>{Dl(c)},openCustomCss:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=c?_g(c):{value:null,mixed:!1},w=m.mixed||!m.value?"":xv(m.value);Xs({open:!0,value:w})},applyCustomCss:c=>{lm(c)},openParagraphProperties:c=>{if(B.current!=="visual")return;const m=H.current;m&&W(m),Hr({open:!0,tab:c??"general",value:m?Ta(m):wr(),backgroundImage:m?tc(m):mn()})},applyParagraphProperties:(c,m)=>{Il(c,m)},openPageProperties:(c,m)=>{if(B.current!=="visual")return;const w=zo();w&&W(w);const I=Ur(),N=w?Go(w):Qo();cr({open:!0,tab:c==="print"&&!Jt?"font":c??"font",paragraphTab:m??"spacing",value:{...N,atRule:tt(he(I).body)}})},applyPageProperties:c=>{jl(c)},openPageBackgroundImage:()=>{if(B.current!=="visual")return;const c=zo();c&&W(c);const m=yl.current;if(xl.current&&m){m.onPick(N=>{const V=Ur(),ee=c?Go(c):Qo();jl({...ee,backgroundImage:{...ee.backgroundImage,src:N.src},atRule:tt(he(V).body)})});return}const w=Ur(),I=c?Go(c):Qo();cr({open:!0,tab:"paragraph",paragraphTab:"backgroundImage",value:{...I,atRule:tt(he(w).body)}})},openParagraphBackgroundImage:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=yl.current;if(xl.current&&m){m.onPick(w=>{const I=c?Ta(c):wr(),N=c?tc(c):mn();Il(I,{...N,src:w.src})});return}Hr({open:!0,tab:"backgroundImage",value:c?Ta(c):wr(),backgroundImage:c?tc(c):mn()})},openCustomParagraphStyleDialog:c=>{if(B.current!=="visual"||!hl.current)return;if(c){const w=Yi.current.find(I=>I.id===c);if(!w)return;No({open:!0,mode:"edit",style:w});return}const m=H.current;m&&W(m),No({open:!0,mode:"create",font:{size:Nn.current.mixed?null:Nn.current.value,unit:Nn.current.unit,marks:{..._s.current},fontFamily:To.current.mixed?null:To.current.value,fontColor:Do.current.mixed?null:Do.current.value,highlightColor:jo.current.mixed?null:jo.current.value},paragraph:ch(m?Ta(m):wr())})},applyCustomParagraphStyle:c=>{const m=Yi.current.find(I=>I.id===c);if(!m||(Dl({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=H.current;!w||B.current!=="visual"||(W(w),Dk(w,m.paragraph)&&(ue(w,!1),O(),$()))},customParagraphStylesEnabled:()=>hl.current,getCustomParagraphStyles:()=>Yi.current,isCustomParagraphStylesLoading:()=>Sd.current,openLinkDialog:c=>{if(B.current!=="visual")return;const m=H.current;m&&W(m);const w=m?fh(m):ks(),I=m?Kc(m):[],N=(w==null?void 0:w.href)??"",V=N.startsWith("#")?N.slice(1):"",ee=I.some(me=>me.id===V)?V:"";Fi({open:!0,tab:c??"link",href:N,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:I,selectedBookmarkId:ee})},applyLink:c=>{cm(c)},openBookmarkDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c),tl({open:!0,existingIds:c?Kc(c).map(m=>m.id):[]})},applyBookmark:c=>{um(c)},openImageDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=Id.current;if(Hd.current&&m){m.onPick(El);return}Hi({open:!0})},applyImage:c=>{ma(c)},openAudioDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=Ed.current;if(zd.current&&m){m.onPick(Ml);return}zi({open:!0})},applyAudio:c=>{fa(c)},openYoutubeDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c);const m=Md.current;if(Od.current&&m){m.onPick(_l);return}Lo({open:!0})},applyYoutube:c=>{dm(c)},openImageProperties:c=>{if(B.current!=="visual")return;const m=H.current;if(!m)return;W(m);const w=Vn(m),I=Xw(m);!w||!I||Oi({open:!0,tab:c??"general",value:I,aspectRatio:Zw(w)})},applyImageProperties:c=>{hm(c)},insertHorizontalRule:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),S0(c)&&(ue(c,!1),O(),$()))},insertPageBreak:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),D0(c)&&(ue(c,!1),O(),$()))},insertPageBefore:()=>{Qd()},insertPageAfter:()=>{em()},deletePage:()=>{!we.current||B.current!=="visual"||Vt.current&&(pr().length<=1||Qs(!0))},isMultiPagesEnabled:()=>we.current,hasSelectedPage:()=>we.current&&B.current==="visual"&&Vt.current,canDeletePage:()=>we.current&&B.current==="visual"&&Vt.current&&pr().length>1,canInsertPageBackgroundImage:()=>!(B.current!=="visual"||we.current&&!Vt.current),canInsertParagraphBackgroundImage:()=>{if(B.current!=="visual")return!1;const c=H.current;return c?In(c).length>0:!1},getActivePageHtml:()=>Jd(),getAllPagesHtml:()=>en(pr()),openTableDialog:()=>{if(B.current!=="visual")return;const c=H.current;c&&W(c),rl({open:!0})},applyTable:c=>{mm(c)},openTableProperties:()=>{if(B.current!=="visual")return;const c=H.current;if(!c)return;W(c);const m=H0(c);m&&il({open:!0,value:m})},applyTableProperties:c=>{fm(c)},openCellProperties:()=>{if(B.current!=="visual")return;const c=H.current;if(!c)return;W(c);const m=q0(c);m&&sl({open:!0,value:m})},applyCellProperties:c=>{pm(c)},openRowProperties:()=>{if(B.current!=="visual")return;const c=H.current;if(!c)return;W(c);const m=iP(c);m&&cl({open:!0,value:m})},applyRowProperties:c=>{gm(c)},insertRowBelow:()=>{Pn(c=>Nc(c,"below"))},insertRowBefore:()=>{Pn(c=>Nc(c,"before"))},deleteRow:()=>{Pn(c=>fk(c))},insertColumnAfter:()=>{Pn(c=>cf(c,"after"))},insertColumnBefore:()=>{Pn(c=>cf(c,"before"))},deleteColumn:()=>{Pn(c=>pk(c))},mergeCells:()=>{Pn(c=>bk(c))},unmergeCells:()=>{Pn(c=>yk(c))},cut:async()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),await IS(c)&&(ue(c,!1),O(),$()))},copy:async()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),await wh(c))},deleteSelection:()=>{if(B.current!=="visual")return;const c=H.current;c&&(W(c),Ch(c)&&(ue(c,!1),O(),$()))},addComment:()=>{if(!Mn.current||b||B.current!=="visual")return;const c=H.current;if(!c)return;const m=W(c),w=xf(c,m);if(w){nn(w);return}const I=xS(c,m);if(!I)return;const N=SS(I);CS(c,N.id,m)&&(Cf(c,N.id),O(),Xd(c,!1),ir([...wi.current,N]),nn(N.id))},toggleCommentsVisible:()=>{Rs(c=>{const m=!c,w=H.current;return w&&bh(w,m),m})},areCommentsVisible:()=>Ci.current,canAddComment:()=>!Mn.current||b||B.current!=="visual"?!1:Vs.current||gl.current!==null,isCommentsEnabled:()=>Mn.current,getCommentThreads:()=>wi.current,setCommentThreads:c=>ir(c),openCommentThread:c=>{const m=H.current;!m||B.current!=="visual"||Cf(m,c)&&(O(),nn(c))},isContentLocked:()=>Zu.current,isLink:()=>dd.current,isImageSelected:()=>B.current==="visual"&&gl.current!==null,isInTable:()=>B.current==="visual"&&yd.current,canMergeCells:()=>B.current==="visual"&&Cd.current,canUnmergeCells:()=>B.current==="visual"&&vd.current,...o!=null?{onSave:c=>Rd.current(c)}:{},...a!=null?{onOpen:()=>Dd.current()}:{}}),[gt,be,ue,Xd,om,tn,Wd,Gd,Zd,Wr,ua,da,O,$,W,Tl,sm,Rl,Dl,lm,Il,jl,cm,um,ma,fa,dm,hm,mm,fm,pm,gm,Pn,El,Ml,_l,ga,Jd,pr,Qd,em,tm,am,o,a,b,ir,Jt]),xm=l.useCallback(()=>{const c=Ge.current??ln({mode:B.current,visualEl:H.current,htmlEl:At.current});return{mode:c.mode,selection:ka(c),getHtml:Ie.getHtml,setHtml:m=>{gt(m,!1)},insertText:m=>Wr(c,m,!1),insertHtml:(m,w)=>{const I=w===void 0;Wr(c,I?m:w,I)}}},[Wr,Ie.getHtml,gt]),{catalog:ha,layout:Cm}=l.useMemo(()=>Jy(U,ZR,qR),[U]),ba=l.useMemo(()=>rA(Cm,L),[Cm,L]),wm=l.useMemo(()=>({...ba,iconGroups:IP(ba.iconGroups,Gs)}),[ba,Gs]),vm=ae&&st==="visual",Nl=l.useMemo(()=>mD(wm,vm),[wm,vm]),Ll=l.useMemo(()=>Pe?QR(ha,jn):ha,[ha,Pe,jn]),Bl=l.useMemo(()=>Pe?eD(Nl):Nl,[Nl,Pe]),Fl=l.useMemo(()=>({disabled:Qt,readOnly:C,enableComments:Pe}),[Qt,C,Pe]),Wb=l.useCallback(c=>{if(!En||!xn||b)return;const m=PS(xn,c);ir(AS(wi.current,En,m))},[En,xn,b,ir]),Gr=l.useMemo(()=>({...lv(Ie),...Qy(U,xm)}),[Ie,U,xm]),Hl=l.useMemo(()=>cv(Ie),[Ie,So,Po,Ao,Ro,Io,Ri,Ui,Vi,Xi,Kr,dt,Gi,Zi,qi,Di,Ii,ur,zr,Fo,vo,Xu,Pt]);l.useLayoutEffect(()=>{Tt.bump("history")},[Xu,Tt]),l.useLayoutEffect(()=>{Tt.bump("marks")},[So,Po,Ao,Ro,Io,Ri,Ii,Tt]),l.useLayoutEffect(()=>{Tt.bump("table")},[Gi,Zi,qi,Tt]),l.useLayoutEffect(()=>{Tt.bump("selection")},[Di,dt,Tt]),l.useLayoutEffect(()=>{Tt.bump("chrome")},[ur,zr,Fo,vo,Pt,Ui,Vi,Xi,Kr,Tt]);const Gb=l.useCallback(c=>{if(ye||c.inputType!=="insertText"&&c.inputType!=="insertReplacementText"||!c.data||!Pv(Nt.current)&&!Rt.current&&!jx(Lt.current)&&!oC({color:Gt.current,backgroundColor:Zt.current})&&!vv(_n.current))return;const m=H.current;m&&(c.preventDefault(),Nv(m,c.data,Nt.current,Rt.current,{color:Gt.current,backgroundColor:Zt.current},Lt.current,_n.current),Nt.current={},Rt.current=null,Lt.current=null,Gt.current=null,Zt.current=null,_n.current=null,Dt.current=null,ue(m,!0),O(),$())},[ye,be,O,$]),Zb=l.useCallback(c=>{var Re;if(ye||!gx(c,kd.current))return;c.preventDefault(),c.stopPropagation();let m=H.current;if(we.current){const xe=c.currentTarget instanceof HTMLElement&&c.currentTarget.hasAttribute(Pr)?c.currentTarget:dw(c.target);if(xe instanceof HTMLElement){const Ze=Vm(xe);Ze!==null&&((Re=pt.current)==null||Re.activatePageAt(Ze),H.current=xe,m=xe,Vt.current=!0,lr(!0))}}else c.currentTarget instanceof HTMLDivElement&&(H.current=c.currentTarget,m=c.currentTarget);if(!m)return;W(m);const w=Ac(m,c.target),I=Qa(m,c.target);I&&!pi(m).includes(I)&&hk(m,I);const N={inTable:wt(m,c.target)!==null,canMergeCells:uf(m),canUnmergeCells:df(m)},V={canDeletePage:we.current&&Vt.current&&ht().length>1},ee={canAddComment:Mn.current&&!b};if(w){Jl(m,w),O(),Or(w),pl({open:!0,x:c.clientX,y:c.clientY,kind:"image",...N,...V,...ee,inTable:wt(m,w)!==null});return}const me=ln({mode:"visual",visualEl:m,htmlEl:At.current});Ge.current=me,pl({open:!0,x:c.clientX,y:c.clientY,kind:me.collapsed?"caret":"text",...N,...V,canAddComment:ee.canAddComment&&!me.collapsed})},[ye,O,W,ht,b,lr]),qb=l.useCallback(c=>{if(kd.current=c.pointerType,b)return;const m=H.current;if(!m)return;if(Mn.current&&Ci.current){const I=yh(m,c.target);if(I){const N=I.getAttribute("data-comment-thread");N&&nn(N);return}}if(ye&&!Mn.current)return;const w=Ac(m,c.target);if(!w){Or(null);return}c.preventDefault(),Jl(m,w),O(),Or(w)},[b,ye,O]),km=l.useCallback(c=>{if(ye)return;if(c.key==="Tab"&&!c.ctrlKey&&!c.metaKey&&!c.altKey){if(B.current!=="visual")return;const w=H.current;if(!w)return;const I=c.target;if(!(I instanceof Node)||!w.contains(I))return;W(w);const N=gk(w,c.shiftKey);if(!N)return;c.preventDefault(),typeof N=="object"&&N.changed&&ue(w,!1),O(),$(),sn(w);return}if(!(c.ctrlKey||c.metaKey))return;if(c.key==="Enter"&&!c.shiftKey){c.preventDefault(),Ie.insertPageBreak();return}const m=c.key.toLowerCase();if(m==="z"&&!c.shiftKey){c.preventDefault(),ua();return}if(m==="z"&&c.shiftKey||m==="y"){c.preventDefault(),da();return}if(m==="b"&&!c.shiftKey){c.preventDefault(),Ie.toggleFontMark("bold");return}if(m==="i"&&!c.shiftKey){c.preventDefault(),Ie.toggleFontMark("italic");return}if(m==="u"&&!c.shiftKey){c.preventDefault(),Ie.toggleFontMark("underline");return}if(m==="x"&&c.shiftKey){c.preventDefault(),Ie.toggleFontMark("strikethrough");return}m==="p"&&!c.shiftKey&&(c.preventDefault(),Gr.print())},[ye,ua,da,Ie,Gr,W,be,O,$,sn]),Yb=l.useCallback(c=>{if(c.key==="F1"){c.preventDefault(),Bo({open:!0,topicId:"getStarted"});return}if(c.key==="Escape"&&En){c.preventDefault(),nn(null);return}km(c)},[En,km]),Xb=[Ce.root,fc(ur).className,Pt?Ce.fullscreen:"",x].filter(Boolean).join(" "),Jb=VM({toolbarBackground:k,menuColor:S,menuBackground:A,menuFontSize:T,menuFontFamily:D,border:R}),Qb=fc(ur)["data-wysiwyg-theme"];Yu.current={multiPageVisualRef:pt,workspaceRef:ar,suppressPageFlushRef:sr,pendingInsertPageFocusRef:xi,visualRootRef:H,visualPropSyncGuardRef:_t,htmlAreaRef:At,commentPanelRef:yi,activePageIndexRef:Te,htmlModePageHtmlRef:wn,activePageHtmlRef:ed,pageCanvasSizedRef:td,setActivePageIndex:wo,setHasSelectedPage:lr,setActiveThreadId:nn,setContextMenu:pl,recordVisualInputHtml:Eb,recordPageVisualHtml:mr,handleVisualBeforeInput:Gb,handleVisualPointerDown:qb,handleVisualMouseUp:Ob,handleVisualContextMenu:Zb,handleHtmlPageTabSelect:Hb,handleHtmlSurfaceChange:zb,handleImageResize:Kb,handleImageResizeEnd:$b,multiPageRulerMarginPreview:Lb,multiPageRulerMarginChange:Bb,multiPageRulerIndentChange:Fb,singlePageRulerMarginPreview:Mb,singlePageRulerMarginChange:_b,singlePageRulerIndentChange:Nb,resolveEmbeddedImageDataUrl:q?As:void 0,hydrateExportHtml:$e,postCommentMessage:Wb,htmlFileDrop:qd};const ey=l.useMemo(()=>pb({catalog:Ll,layout:Bl,commands:Gr,queries:Hl,queryRevisions:Tt,disabled:Qt,chromeLock:Fl}),[Qt,Fl,Gr,Ll,Bl,Hl,Tt]),ty=l.useMemo(()=>({documentBridgeRef:Nr,htmlRef:ce,pagesRef:Ne}),[]);return i.jsx(sx,{locale:v,children:i.jsx(rx,{dark:ur,children:i.jsx(rM,{value:ty,children:i.jsxs("div",{className:Xb,style:Jb,"data-fullscreen":Pt?"":void 0,"data-wysiwyg-theme":Qb,"data-toolbar-position":zr,"data-comments-visible":Pe&&jn?"":void 0,onKeyDown:Yb,children:[i.jsx(tM,{menuVisible:P,captureChromeSelection:nm,displayCatalog:Ll,displayLayout:Bl,commands:Gr,queries:Hl,queryRevisions:Tt,chromeDisabled:Qt,chromeLock:Fl,contentLocked:ye,customizeToolbarOpen:Ws,baseCatalog:ha,allowedLayout:ba,toolbarSettings:Gs,toolbarSettingsLoading:yb,toolbarSettingsBusy:xb,onCustomizeToolbarClose:()=>md(!1),onToolbarSettingsChange:c=>{Vd(c)},onToolbarSettingsReset:()=>{Vd(null)},documentPreview:Li,onDocumentPreviewClose:()=>fd({open:!1,html:Li.html}),helpDialog:ul,onHelpDialogClose:()=>Bo(c=>({...c,open:!1})),onHelpTopicChange:c=>Bo(m=>({...m,open:!0,topicId:c})),aboutDialogOpen:dl,onAboutDialogClose:()=>gd(!1),fontDialog:_i,fontSizeState:Po,markState:So,fontFamilyState:Ao,fontColorState:Ro,highlightColorState:Io,fontFaces:Kr,onFontDialogTabChange:c=>Ni({open:!0,tab:c}),onFontDialogClose:()=>Ni({open:!1,tab:_i.tab}),onApplyFontProperties:c=>Ie.applyFontProperties(c),paragraphDialog:Mo,customBackgroundImagePicker:kn,disableBuiltinBackgroundImageSources:bl,onParagraphCustomImagePick:()=>{kn==null||kn.onPick(c=>{Hr(m=>({...m,tab:"backgroundImage",backgroundImage:{...m.backgroundImage,src:c.src}}))})},onParagraphDialogTabChange:c=>Hr({...Mo,open:!0,tab:c}),onParagraphDialogClose:()=>Hr({...Mo,open:!1}),onApplyParagraphProperties:({value:c,backgroundImage:m})=>Ie.applyParagraphProperties(c,m),customCssDialog:Ys,onCustomCssDialogClose:()=>Xs(c=>({...c,open:!1})),onApplyCustomCss:c=>Ie.applyCustomCss(c),pageDialog:_o,enablePageProperties:Jt,onPageCustomImagePick:()=>{kn==null||kn.onPick(c=>{cr(m=>({...m,tab:"paragraph",paragraphTab:"backgroundImage",value:{...m.value,backgroundImage:{...m.value.backgroundImage,src:c.src}}}))})},onPageDialogTabChange:c=>cr({..._o,open:!0,tab:c}),onPageDialogClose:()=>cr({..._o,open:!1}),onApplyPageProperties:c=>Ie.applyPageProperties(c),onPageDialogResetAtRule:()=>{const c=zo();if(!c||B.current!=="visual")return;const m=we.current?Ur():he(ce.current).body,w=Uk(c,m);w.changed&&(ue(c,!1,w.pageHtml),cr(I=>({...I,value:{...I.value,atRule:Kn()}})))},deletePageConfirmOpen:Js,onDeletePageConfirmClose:()=>Qs(!1),onDeletePageConfirm:()=>{tm(),Qs(!1)},customStyleDialog:Cb,canDeleteCustomParagraphStyle:!!oe,customStyleBusy:Tb,onCustomStyleDialogClose:()=>No({open:!1}),onCustomStyleSave:async c=>{const m=Ad.current;if(m){Wi(!0);try{await m(c),No({open:!1}),await oa()}finally{Wi(!1)}}},onCustomStyleDelete:async c=>{const m=Td.current;if(m){Wi(!0);try{await m(c),No({open:!1}),await oa()}finally{Wi(!1)}}},linkDialog:el,onLinkDialogTabChange:c=>Fi({...el,open:!0,tab:c}),onLinkDialogClose:()=>Fi({...el,open:!1}),onApplyLink:c=>Ie.applyLink(c),bookmarkDialog:pd,onBookmarkDialogClose:()=>tl({...pd,open:!1}),onApplyBookmark:c=>Ie.applyBookmark(c),imageDialogOpen:wb.open,customImagePicker:Y,customAudioPicker:E,customVideoPicker:pe,onImageDialogClose:()=>Hi({open:!1}),onApplyImage:c=>Ie.applyImage(c),onImageDialogCustomPick:()=>{Hi({open:!1}),Y==null||Y.onPick(El)},audioDialogOpen:vb.open,onAudioDialogClose:()=>zi({open:!1}),onApplyAudio:c=>Ie.applyAudio(c),onAudioDialogCustomPick:()=>{zi({open:!1}),E==null||E.onPick(Ml)},youtubeDialogOpen:kb.open,onYoutubeDialogClose:()=>Lo({open:!1}),onApplyYoutube:c=>Ie.applyYoutube(c),onYoutubeDialogCustomPick:()=>{Lo({open:!1}),pe==null||pe.onPick(_l)},imageProperties:Sb,onImagePropertiesTabChange:c=>Oi(m=>({...m,tab:c})),onImagePropertiesClose:()=>Oi(c=>({...c,open:!1})),onApplyImageProperties:c=>Ie.applyImageProperties(c),tableDialogOpen:nl.open,onTableDialogClose:()=>rl({open:!1}),onApplyTable:c=>Ie.applyTable(c),tableProperties:ol,onTablePropertiesClose:()=>il(c=>({...c,open:!1})),onApplyTableProperties:c=>Ie.applyTableProperties(c),cellProperties:al,onCellPropertiesClose:()=>sl(c=>({...c,open:!1})),onApplyCellProperties:c=>Ie.applyCellProperties(c),rowProperties:ll,onRowPropertiesClose:()=>cl(c=>({...c,open:!1})),onApplyRowProperties:c=>Ie.applyRowProperties(c)}),i.jsx(nM,{toolbarVisible:M,toolbarPos:zr,captureChromeSelection:nm,toolbarShellProps:ey,children:i.jsx(KM,{propsRef:Yu,pageStore:ut,mode:st,enableMultiPages:ae,contentLocked:ye,activePageIndex:Lr,hasSelectedPage:vo,pageZoomScale:ml,rulerVisible:xo,rulerUnit:Ut,optimizeEmbeddedImages:q,placeholder:y,value:e,pagesProp:ge,controlledHtml:Cn,initialHtml:Me,initialStorageHtml:Ts,defaultPages:J.current??[zn()],ingestedPagesProp:qu,onChange:n,fontFaces:Kr,enableComments:Pe,commentsVisible:jn,disabled:b,locale:v,commentAuthor:xn,activeThreadId:En,contextMenu:Rb,commentThreads:Co,commands:Gr,htmlFileDropDragging:qd.dragging,selectedImage:dt})}),Pt?i.jsx(WM,{onClick:()=>tn(!1)}):null]})})})})}function VM({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 WM({onClick:e}){const t=X();return i.jsx("button",{type:"button",className:Ce.exitFullscreen,"aria-label":t("exitFullscreenAria"),onClick:e,children:i.jsx(Je,{className:Ce.exitFullscreenIcon})})}function GM(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)===lt?!0:t.length===2&&t.some(r=>r.name===lt)&&t.some(r=>r.name==="class"&&r.value.includes("wysiwyg-comment-anchor"))?!e.hasAttribute("style"):!1}function ZM(e){for(const t of[...e.querySelectorAll(`[${lt}]`)])t.removeAttribute(lt),t instanceof HTMLElement&&t.classList.remove("wysiwyg-comment-anchor");for(const t of[...e.querySelectorAll("span")]){if(!GM(t))continue;const n=t.parentNode;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}}function qM(e){const t=e.trim();if(!t)return e;const n=new DOMParser().parseFromString(t,"text/html");return ZM(n.body),n.body.innerHTML}exports.Editor=UM;exports.PAGE_SEPARATOR=Ua;exports.joinPagesToHtml=jt;exports.sanitizeDocumentHtml=Xr;exports.sanitizePageHtml=Oc;exports.splitPagesFromHtml=Un;exports.stripCommentAnchors=qM;
|