@eigenpal/docx-js-editor 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -0
- package/dist/{ClipboardManager-EZ0C6Onq.d.cts → ClipboardManager-B1jZrC6h.d.cts} +1 -1
- package/dist/{ClipboardManager-D6dkOFg6.d.ts → ClipboardManager-jqJVxB6g.d.ts} +1 -1
- package/dist/{DocumentAgent-BcCDg7i2.d.ts → DocumentAgent-CnJ9AEl_.d.cts} +31 -3
- package/dist/{DocumentAgent-B0EC8lPC.d.cts → DocumentAgent-CrbsDniO.d.ts} +31 -3
- package/dist/{FindReplaceDialog-AWQXKEUQ.js → FindReplaceDialog-AQFR4OCT.js} +1 -2
- package/dist/FindReplaceDialog-J3DI3U5I.cjs +1 -0
- package/dist/{FootnotePropertiesDialog-73VT2ZVZ.cjs → FootnotePropertiesDialog-DO5DCAW6.cjs} +1 -2
- package/dist/{FootnotePropertiesDialog-ZM3EF3EF.js → FootnotePropertiesDialog-YYIZU5U6.js} +1 -2
- package/dist/{HyperlinkDialog-BA25XUT5.js → HyperlinkDialog-HGZ2S37Z.js} +1 -2
- package/dist/HyperlinkDialog-PEPS3C2G.cjs +1 -0
- package/dist/{ImagePositionDialog-AIAMKPFK.js → ImagePositionDialog-DQ4JWS4F.js} +1 -2
- package/dist/{ImagePositionDialog-KMK7ROV2.cjs → ImagePositionDialog-UYXYHSP4.cjs} +1 -2
- package/dist/{ImagePropertiesDialog-ERFCUVCW.js → ImagePropertiesDialog-GJMGLM6G.js} +1 -2
- package/dist/{ImagePropertiesDialog-USMMRK6X.cjs → ImagePropertiesDialog-V6SVKINO.cjs} +1 -2
- package/dist/{TablePropertiesDialog-72CIUAZT.cjs → TablePropertiesDialog-A36OXG3A.cjs} +1 -2
- package/dist/{TablePropertiesDialog-EMUEVYB3.js → TablePropertiesDialog-STZOGHJB.js} +1 -2
- package/dist/{agentApi-BFVyKagE.d.cts → agentApi-DfsWRyrP.d.cts} +1 -1
- package/dist/{agentApi-BFVyKagE.d.ts → agentApi-DfsWRyrP.d.ts} +1 -1
- package/dist/{chunk-FDANI5P4.cjs → chunk-2VHQ7YOQ.cjs} +1 -2
- package/dist/chunk-2Y6FLZ5Q.js +3 -0
- package/dist/chunk-32HMU2UV.js +111 -0
- package/dist/chunk-4CUGBNL2.cjs +1 -0
- package/dist/chunk-5GFXHUMP.js +1 -0
- package/dist/chunk-6NDMKJIE.js +9 -0
- package/dist/chunk-6NYA53QC.cjs +258 -0
- package/dist/chunk-7KJ3YVDQ.js +10 -0
- package/dist/{chunk-JOYPFQW2.js → chunk-AARNCPWR.js} +1 -2
- package/dist/{chunk-4QT5LPBA.cjs → chunk-B7TICMXD.cjs} +16 -17
- package/dist/{chunk-2QOEHCBX.js → chunk-BUEMG4NW.js} +1 -2
- package/dist/{chunk-CV5WFE7K.js → chunk-CLDB6TL7.js} +2 -3
- package/dist/{chunk-M2T6XKT5.js → chunk-CTYOM6BE.js} +1 -2
- package/dist/chunk-EH3NY2DQ.cjs +26 -0
- package/dist/{chunk-FGVGZLBL.js → chunk-FVUGBRDD.js} +1 -2
- package/dist/chunk-FXJAIFPR.js +59 -0
- package/dist/chunk-GICVJSFJ.cjs +9 -0
- package/dist/{chunk-Y6VCTLCJ.js → chunk-H5NTJZO4.js} +1 -2
- package/dist/chunk-HT2Z33YM.cjs +111 -0
- package/dist/chunk-JRRTZZ72.cjs +1 -0
- package/dist/{chunk-T2HQYRA7.cjs → chunk-NVAQQYBJ.cjs} +1 -2
- package/dist/chunk-P3AEZKQO.cjs +3 -0
- package/dist/{chunk-GWBTKVFD.cjs → chunk-P7ZF45KZ.cjs} +1 -2
- package/dist/{chunk-QEBO3EQP.cjs → chunk-PCJ5ACUV.cjs} +1 -2
- package/dist/{chunk-Q6HUGWO6.js → chunk-PJVI53AH.js} +1 -2
- package/dist/chunk-Q7YYC75E.js +258 -0
- package/dist/{chunk-7JSPKVOW.js → chunk-QVPR2W5S.js} +1 -2
- package/dist/{chunk-XZNOV52K.cjs → chunk-TAF6KYDM.cjs} +4 -5
- package/dist/chunk-USRMBYI6.js +3 -0
- package/dist/chunk-UTWPV2I4.js +26 -0
- package/dist/{chunk-DJAEBZ33.cjs → chunk-VTAS7VZ6.cjs} +1 -2
- package/dist/chunk-XQNCLN4T.cjs +3 -0
- package/dist/{chunk-S26DZVRQ.cjs → chunk-XS2AQFMF.cjs} +1 -2
- package/dist/chunk-Y6QBJGMO.cjs +59 -0
- package/dist/{chunk-WD2HTKRR.cjs → chunk-YS7FDEZ4.cjs} +1 -2
- package/dist/chunk-ZTVQA46Q.js +1 -0
- package/dist/{clipboard-beGtyabO.d.ts → clipboard-BE8E-szx.d.ts} +1 -1
- package/dist/{clipboard-CqE-UZ2d.d.cts → clipboard-DkfAv07F.d.cts} +1 -1
- package/dist/{colorResolver-B5YbO_a4.d.ts → colorResolver-CYttioMe.d.ts} +46 -3
- package/dist/{colorResolver-Cu46bSKr.d.cts → colorResolver-Dr8kQZAQ.d.cts} +46 -3
- package/dist/core-plugins-reexport.cjs +1 -2
- package/dist/core-plugins-reexport.d.cts +4 -4
- package/dist/core-plugins-reexport.d.ts +4 -4
- package/dist/core-plugins-reexport.js +1 -2
- package/dist/core-reexport.cjs +1 -2
- package/dist/core-reexport.d.cts +10 -10
- package/dist/core-reexport.d.ts +10 -10
- package/dist/core-reexport.js +1 -2
- package/dist/executor-JGWZ7S6Z.cjs +1 -0
- package/dist/executor-L2MVKMXO.js +1 -0
- package/dist/{fontLoader-CFKpg0Ri.d.ts → fontLoader-BsqQnB4v.d.ts} +1 -1
- package/dist/{fontLoader-HZYfILUm.d.cts → fontLoader-DECXIoMr.d.cts} +1 -1
- package/dist/headless-reexport.cjs +4 -5
- package/dist/headless-reexport.d.cts +7 -7
- package/dist/headless-reexport.d.ts +7 -7
- package/dist/headless-reexport.js +4 -5
- package/dist/index.cjs +6 -7
- package/dist/index.css +0 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +6 -7
- package/dist/lib-GD2QD2JK.js +1 -0
- package/dist/lib-HOLGQI5K.cjs +1 -0
- package/dist/mcp-reexport.cjs +9 -10
- package/dist/mcp-reexport.d.cts +2 -2
- package/dist/mcp-reexport.d.ts +2 -2
- package/dist/mcp-reexport.js +4 -5
- package/dist/{processTemplate-G37IM66O.js → processTemplate-3HN7Q3KT.js} +1 -2
- package/dist/processTemplate-BXZKWRQD.cjs +1 -0
- package/dist/{react-BjOCdeTs.d.ts → react-C6bgHDFl.d.ts} +8 -6
- package/dist/{react-UzAn4o7l.d.cts → react-CAlVCYa4.d.cts} +8 -6
- package/dist/react.cjs +1 -2
- package/dist/react.css +0 -1
- package/dist/react.d.cts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +1 -2
- package/dist/{registry-DjacfR6Q.d.cts → registry-BU-FbHh-.d.cts} +1 -1
- package/dist/{registry-CV6nYWqP.d.ts → registry-gRbkCooh.d.ts} +1 -1
- package/dist/selectionRects-7QU337P5.cjs +1 -0
- package/dist/selectionRects-V5RC2BYX.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/{types-DwZ3xysp.d.ts → types-7wjInVMW.d.ts} +1 -1
- package/dist/{types-Bnp8rvJn.d.cts → types-DEEpBL9H.d.cts} +1 -1
- package/dist/ui.cjs +1 -2
- package/dist/ui.d.cts +32 -85
- package/dist/ui.d.ts +32 -85
- package/dist/ui.js +1 -2
- package/dist/{variableDetector-CMhJtM96.d.cts → variableDetector-B4oQJa2e.d.cts} +33 -2
- package/dist/{variableDetector-BaDeXz7D.d.ts → variableDetector-BXJaTkiB.d.ts} +33 -2
- package/package.json +2 -1
- package/dist/FindReplaceDialog-AWQXKEUQ.js.map +0 -1
- package/dist/FindReplaceDialog-I4SZDSVP.cjs +0 -2
- package/dist/FindReplaceDialog-I4SZDSVP.cjs.map +0 -1
- package/dist/FootnotePropertiesDialog-73VT2ZVZ.cjs.map +0 -1
- package/dist/FootnotePropertiesDialog-ZM3EF3EF.js.map +0 -1
- package/dist/HyperlinkDialog-BA25XUT5.js.map +0 -1
- package/dist/HyperlinkDialog-V63LPOT2.cjs +0 -2
- package/dist/HyperlinkDialog-V63LPOT2.cjs.map +0 -1
- package/dist/ImagePositionDialog-AIAMKPFK.js.map +0 -1
- package/dist/ImagePositionDialog-KMK7ROV2.cjs.map +0 -1
- package/dist/ImagePropertiesDialog-ERFCUVCW.js.map +0 -1
- package/dist/ImagePropertiesDialog-USMMRK6X.cjs.map +0 -1
- package/dist/TablePropertiesDialog-72CIUAZT.cjs.map +0 -1
- package/dist/TablePropertiesDialog-EMUEVYB3.js.map +0 -1
- package/dist/chunk-2CHPKB5A.cjs +0 -112
- package/dist/chunk-2CHPKB5A.cjs.map +0 -1
- package/dist/chunk-2QOEHCBX.js.map +0 -1
- package/dist/chunk-4QT5LPBA.cjs.map +0 -1
- package/dist/chunk-5DYSI4O4.cjs +0 -60
- package/dist/chunk-5DYSI4O4.cjs.map +0 -1
- package/dist/chunk-5FJXHXFV.cjs +0 -2
- package/dist/chunk-5FJXHXFV.cjs.map +0 -1
- package/dist/chunk-6FEWNF6B.js +0 -4
- package/dist/chunk-6FEWNF6B.js.map +0 -1
- package/dist/chunk-6LF5HZCV.js +0 -10
- package/dist/chunk-6LF5HZCV.js.map +0 -1
- package/dist/chunk-7JSPKVOW.js.map +0 -1
- package/dist/chunk-C33XDRDJ.cjs +0 -28
- package/dist/chunk-C33XDRDJ.cjs.map +0 -1
- package/dist/chunk-CV5WFE7K.js.map +0 -1
- package/dist/chunk-CXJRNISO.js +0 -2
- package/dist/chunk-CXJRNISO.js.map +0 -1
- package/dist/chunk-DJAEBZ33.cjs.map +0 -1
- package/dist/chunk-DP6Q75ZD.js +0 -28
- package/dist/chunk-DP6Q75ZD.js.map +0 -1
- package/dist/chunk-FDANI5P4.cjs.map +0 -1
- package/dist/chunk-FGVGZLBL.js.map +0 -1
- package/dist/chunk-GJ4GKSDU.cjs +0 -2
- package/dist/chunk-GJ4GKSDU.cjs.map +0 -1
- package/dist/chunk-GWBTKVFD.cjs.map +0 -1
- package/dist/chunk-JOYPFQW2.js.map +0 -1
- package/dist/chunk-L54YNLSE.js +0 -2
- package/dist/chunk-L54YNLSE.js.map +0 -1
- package/dist/chunk-LPGMLJMO.js +0 -259
- package/dist/chunk-LPGMLJMO.js.map +0 -1
- package/dist/chunk-M2T6XKT5.js.map +0 -1
- package/dist/chunk-OHG7ROFC.js +0 -11
- package/dist/chunk-OHG7ROFC.js.map +0 -1
- package/dist/chunk-PANKMCFX.cjs +0 -4
- package/dist/chunk-PANKMCFX.cjs.map +0 -1
- package/dist/chunk-Q6HUGWO6.js.map +0 -1
- package/dist/chunk-QDV75OJ4.js +0 -112
- package/dist/chunk-QDV75OJ4.js.map +0 -1
- package/dist/chunk-QEBO3EQP.cjs.map +0 -1
- package/dist/chunk-QVIZ775M.cjs +0 -259
- package/dist/chunk-QVIZ775M.cjs.map +0 -1
- package/dist/chunk-RMUMR42R.cjs +0 -10
- package/dist/chunk-RMUMR42R.cjs.map +0 -1
- package/dist/chunk-S26DZVRQ.cjs.map +0 -1
- package/dist/chunk-T2HQYRA7.cjs.map +0 -1
- package/dist/chunk-ULXNEG66.js +0 -60
- package/dist/chunk-ULXNEG66.js.map +0 -1
- package/dist/chunk-WD2HTKRR.cjs.map +0 -1
- package/dist/chunk-XZNOV52K.cjs.map +0 -1
- package/dist/chunk-Y6VCTLCJ.js.map +0 -1
- package/dist/core-plugins-reexport.cjs.map +0 -1
- package/dist/core-plugins-reexport.js.map +0 -1
- package/dist/core-reexport.cjs.map +0 -1
- package/dist/core-reexport.js.map +0 -1
- package/dist/executor-K5RXUTTR.js +0 -2
- package/dist/executor-K5RXUTTR.js.map +0 -1
- package/dist/executor-XIPIU3H4.cjs +0 -2
- package/dist/executor-XIPIU3H4.cjs.map +0 -1
- package/dist/headless-reexport.cjs.map +0 -1
- package/dist/headless-reexport.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-reexport.cjs.map +0 -1
- package/dist/mcp-reexport.js.map +0 -1
- package/dist/processTemplate-G37IM66O.js.map +0 -1
- package/dist/processTemplate-RFBGVH7T.cjs +0 -2
- package/dist/processTemplate-RFBGVH7T.cjs.map +0 -1
- package/dist/react.cjs.map +0 -1
- package/dist/react.css.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/selectionRects-6DU7HN7E.js +0 -2
- package/dist/selectionRects-6DU7HN7E.js.map +0 -1
- package/dist/selectionRects-YZSC24ZP.cjs +0 -2
- package/dist/selectionRects-YZSC24ZP.cjs.map +0 -1
- package/dist/ui.cjs.map +0 -1
- package/dist/ui.js.map +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
'use strict';var chunk4CUGBNL2_cjs=require('./chunk-4CUGBNL2.cjs'),chunkP3AEZKQO_cjs=require('./chunk-P3AEZKQO.cjs'),chunkVTAS7VZ6_cjs=require('./chunk-VTAS7VZ6.cjs'),chunkXS2AQFMF_cjs=require('./chunk-XS2AQFMF.cjs'),chunk2VHQ7YOQ_cjs=require('./chunk-2VHQ7YOQ.cjs'),chunkGICVJSFJ_cjs=require('./chunk-GICVJSFJ.cjs'),chunkJRRTZZ72_cjs=require('./chunk-JRRTZZ72.cjs'),chunkP7ZF45KZ_cjs=require('./chunk-P7ZF45KZ.cjs'),chunkEH3NY2DQ_cjs=require('./chunk-EH3NY2DQ.cjs'),chunkPCJ5ACUV_cjs=require('./chunk-PCJ5ACUV.cjs'),Nu=require('react'),jsxRuntime=require('react/jsx-runtime'),prosemirrorState=require('prosemirror-state'),prosemirrorView=require('prosemirror-view'),prosemirrorHistory=require('prosemirror-history'),prosemirrorModel=require('prosemirror-model'),prosemirrorCommands=require('prosemirror-commands'),prosemirrorTables=require('prosemirror-tables'),prosemirrorDropcursor=require('prosemirror-dropcursor'),prosemirrorKeymap=require('prosemirror-keymap');require('prosemirror-view/style/prosemirror.css');var client=require('react-dom/client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Nu__default=/*#__PURE__*/_interopDefault(Nu);var fl=Nu.createContext(null);function cy(){let e=Nu.useContext(fl);if(!e)throw new Error("useErrorNotifications must be used within an ErrorProvider");return e}function ml({children:e}){let t=Nu.useMemo(()=>new chunk2VHQ7YOQ_cjs.H,[]),n=Nu.useSyncExternalStore(t.subscribe,t.getSnapshot),o=Nu.useCallback((u,d)=>{t.showError(u,d);},[t]),r=Nu.useCallback((u,d)=>{t.showWarning(u,d);},[t]),i=Nu.useCallback((u,d)=>{t.showInfo(u,d);},[t]),a=Nu.useCallback(u=>{t.dismiss(u);},[t]),s=Nu.useCallback(()=>{t.clearAll();},[t]),l=Nu.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:s}),[n.notifications,o,r,i,a,s]);return jsxRuntime.jsxs(fl.Provider,{value:l,children:[e,jsxRuntime.jsx(Sp,{notifications:n.notifications,onDismiss:a})]})}function Sp({notifications:e,onDismiss:t}){let n=e.filter(r=>!r.dismissed);return n.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:n.map(r=>jsxRuntime.jsx(kp,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function kp({notification:e,onDismiss:t}){let[n,o]=Nu.useState(false),i=(m=>{switch(m){case "error":return {bg:"var(--doc-error-bg)",border:"#f5c6cb",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"#ffeeba",text:"#856404",icon:"var(--doc-warning)"};case "info":return {bg:"#e8f4fd",border:"#b8daff",text:"#0c5460",icon:"var(--doc-primary)"}}})(e.severity),a={background:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",animation:"slideIn 0.3s ease-out"},s={display:"flex",alignItems:"flex-start",gap:"8px"},l={color:i.icon,flexShrink:0},u={flex:1,minWidth:0},d={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},c={marginTop:"8px",padding:"8px",background:"rgba(0, 0, 0, 0.05)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},p={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},f=m=>{switch(m){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:a,children:[jsxRuntime.jsx("style",{children:`
|
|
2
|
+
@keyframes slideIn {
|
|
3
|
+
from {
|
|
4
|
+
opacity: 0;
|
|
5
|
+
transform: translateX(100%);
|
|
6
|
+
}
|
|
7
|
+
to {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
transform: translateX(0);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`}),jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("span",{style:l,children:f(e.severity)}),jsxRuntime.jsxs("div",{style:u,children:[jsxRuntime.jsx("div",{style:d,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>o(!n),style:{...p,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n?"Hide details":"Show details"}),n&&jsxRuntime.jsx("div",{style:c,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:p,title:"Dismiss",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})}var cr=class extends Nu.Component{constructor(n){super(n);chunkPCJ5ACUV_cjs.d(this,"resetError",()=>{this.setState({hasError:false,error:null,errorInfo:null});});this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(n){return {hasError:true,error:n}}componentDidCatch(n,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",n,o),this.props.onError&&this.props.onError(n,o);}render(){if(this.state.hasError){let{fallback:n,showDetails:o=true}=this.props,{error:r,errorInfo:i}=this.state;return n?typeof n=="function"?n(r,this.resetError):n:jsxRuntime.jsx(Cp,{error:r,errorInfo:i,showDetails:o,onReset:this.resetError})}return this.props.children}};function Cp({error:e,errorInfo:t,showDetails:n,onReset:o}){let r={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},i={color:"var(--doc-error)",marginBottom:"16px"},a={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},u={padding:"10px 20px",background:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:r,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:a,children:"Something went wrong"}),jsxRuntime.jsx("p",{style:s,children:"An error occurred while rendering this component. Please try again or contact support if the problem persists."}),n&&jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("strong",{children:"Error:"})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
|
|
13
|
+
|
|
14
|
+
`,jsxRuntime.jsx("strong",{children:"Component Stack:"}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:u,children:"Try Again"})]})}function dy({message:e,details:t,onRetry:n,className:o=""}){let r={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border-light)"},i={color:"var(--doc-error)",marginBottom:"16px"},a={fontSize:"16px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={marginBottom:"16px",padding:"12px",background:"var(--doc-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",maxWidth:"100%",overflow:"auto",textAlign:"left"},u={padding:"8px 16px",background:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",fontSize:"13px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:`docx-parse-error ${o}`,style:r,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 10h20v20H10z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M25 10l-10 20M15 10l10 20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h3",{style:a,children:"Unable to Parse Document"}),jsxRuntime.jsx("p",{style:s,children:e}),t&&jsxRuntime.jsx("div",{style:l,children:t}),n&&jsxRuntime.jsx("button",{type:"button",onClick:n,style:u,children:"Try Again"})]})}function uy({feature:e,description:t,className:n=""}){let o={display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:"var(--doc-warning-bg)",border:"1px solid #ffeeba",borderRadius:"4px",fontSize:"12px",color:"#856404"},r={flexShrink:0,color:"var(--doc-warning)"};return jsxRuntime.jsxs("div",{className:`docx-unsupported-warning ${n}`,style:o,children:[jsxRuntime.jsx("span",{style:r,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 2l7 12H1L8 2z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M8 6v4M8 12v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("strong",{children:e}),t&&`: ${t}`]})]})}function py(e){return e.message.includes("parse")||e.message.includes("Parse")||e.message.includes("XML")||e.message.includes("DOCX")||e.message.includes("Invalid")}function fy(e){let t=e.message.toLowerCase();return t.includes("network")||t.includes("fetch")?"Network error. Please check your internet connection and try again.":t.includes("parse")||t.includes("xml")||t.includes("invalid")?"The document could not be parsed. It may be corrupted or in an unsupported format.":t.includes("permission")||t.includes("access")?"Access denied. You may not have permission to access this file.":t.includes("not found")||t.includes("404")?"The requested file was not found.":t.includes("timeout")?"The operation timed out. Please try again.":"An unexpected error occurred. Please try again."}function hl({document:e,onChange:t,onSelectionChange:n}){let o=Nu.useMemo(()=>new chunk2VHQ7YOQ_cjs.C,[]),[r,i]=Nu.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),a=Nu.useCallback((d,c,p)=>{if(!e)return;let f=chunk2VHQ7YOQ_cjs.z(e,d);if(!f){o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}o.selectCell({tableIndex:d,rowIndex:c,columnIndex:p});let b=chunkP3AEZKQO_cjs.U(f,{tableIndex:d,rowIndex:c,columnIndex:p});i({context:b,table:f,tableIndex:d,rowIndex:c,columnIndex:p}),n?.(b);},[e,o,n]),s=Nu.useCallback(()=>{o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),n?.(null);},[o,n]),l=Nu.useCallback(d=>{if(!e||!r.context||r.tableIndex===null||r.rowIndex===null||r.columnIndex===null)return;let c=r.table;if(!c)return;let p=null,f=null,m=r.rowIndex,b=r.columnIndex;switch(d){case "addRowAbove":p=chunkP3AEZKQO_cjs.X(c,r.rowIndex,"before"),m=r.rowIndex+1;break;case "addRowBelow":p=chunkP3AEZKQO_cjs.X(c,r.rowIndex,"after");break;case "addColumnLeft":p=chunkP3AEZKQO_cjs.Z(c,r.columnIndex,"before"),b=r.columnIndex+1;break;case "addColumnRight":p=chunkP3AEZKQO_cjs.Z(c,r.columnIndex,"after");break;case "deleteRow":c.rows.length>1&&(p=chunkP3AEZKQO_cjs.Y(c,r.rowIndex),m>=p.rows.length&&(m=p.rows.length-1));break;case "deleteColumn":{if(chunkP3AEZKQO_cjs.V(c)>1){p=chunkP3AEZKQO_cjs._(c,r.columnIndex);let S=chunkP3AEZKQO_cjs.V(p);b>=S&&(b=S-1);}break}case "mergeCells":r.context.selection.selectedCells&&(p=chunkP3AEZKQO_cjs.$(c,r.context.selection));break;case "splitCell":r.context.canSplitCell&&(p=chunkP3AEZKQO_cjs.aa(c,r.rowIndex,r.columnIndex));break;case "deleteTable":f=chunk2VHQ7YOQ_cjs.B(e,r.tableIndex),s(),t?.(f);return}p&&(f=chunk2VHQ7YOQ_cjs.A(e,r.tableIndex,p),t?.(f),f&&a(r.tableIndex,m,b));},[e,r,t,s,a]),u=Nu.useCallback((d,c,p)=>o.isCellSelected(d,c,p),[o,r]);return {state:r,handleCellClick:a,handleAction:l,clearSelection:s,isCellSelected:u,tableContext:r.context}}var yl=({headings:e,onHeadingClick:t,onClose:n,topOffset:o=0})=>{let[r,i]=Nu.useState(false);return Nu.useEffect(()=>{requestAnimationFrame(()=>i(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":"Document outline",style:{position:"absolute",top:o,left:30,bottom:0,width:240,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:r?"translateX(0)":"translateX(-270px)",transition:"transform 0.15s ease-out"},onMouseDown:a=>a.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":"Close outline",style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"#444746"},title:"Close outline",children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"#1f1f1f",letterSpacing:"0.01em"},children:"Outline"})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:20},children:e.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"#80868b",fontSize:13,lineHeight:"20px"},children:"No headings found. Add headings to your document to see them here."}):e.map((a,s)=>jsxRuntime.jsx("div",{style:{marginLeft:a.level*12},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>t(a.pmPos),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 12px",fontSize:13,fontWeight:400,color:"#1f1f1f",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:a.text,children:a.text})},`${a.pmPos}-${s}`))})]})};function Sl(e){return e?.length?e.flatMap(t=>t.content.filter(n=>n.type==="run").flatMap(n=>"content"in n?n.content:[]).filter(n=>n.type==="text").map(n=>"text"in n?n.text:"")).join(""):""}function Ra(e){return e?new Date(e).toLocaleString(void 0,{hour:"numeric",minute:"2-digit",month:"short",day:"numeric"}):""}function Pa(e){return e.split(/\s+/).map(t=>t[0]).join("").toUpperCase().slice(0,2)}var kl=["#6DCCB1","#79AAD9","#EE789D","#A987D1","#E6A85F","#F2CC8F","#68B3A2","#B07AA1","#59A14F","#FF9DA7","#E15759","#76B7B2"];function Mp(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return kl[Math.abs(t)%kl.length]}var Ep=340,Ip=8,pr={background:"none",border:"none",cursor:"pointer",padding:4,color:"#5f6368",display:"flex",borderRadius:"50%"},Cl={padding:"6px 16px",fontSize:14,border:"none",background:"none",color:"#1a73e8",cursor:"pointer",fontWeight:500,fontFamily:"inherit"},wl=({comments:e,trackedChanges:t,onCommentClick:n,onCommentReply:o,onCommentResolve:r,onCommentDelete:i,onAddComment:a,onCancelAddComment:s,onAcceptChange:l,onRejectChange:u,onTrackedChangeReply:d,topOffset:c=0,showResolved:p=false,isAddingComment:f=false,addCommentYPosition:m=null,pageWidth:b=816,editorContainerRef:g})=>{let[S,C]=Nu.useState(null),[k,E]=Nu.useState(""),[R,_]=Nu.useState(""),[V,$]=Nu.useState(null),[L,W]=Nu.useState(null),[O,K]=Nu.useState(new Map),[w,B]=Nu.useState(false),te=Nu.useRef(new Set),he=Nu.useRef(null),me=Nu.useRef(new Map),Ie=Nu.useMemo(()=>e.filter(v=>!(v.parentId!=null||v.done&&!p)),[e,p]),Te=Nu.useMemo(()=>{let v=new Map;for(let z of e)if(z.parentId!=null){let D=v.get(z.parentId);D?D.push(z):v.set(z.parentId,[z]);}return v},[e]),Re=v=>Te.get(v)??[],P=Nu.useCallback(()=>{let v=g?.current;if(!v)return;let z=v.querySelector(".paged-editor__pages");if(!z)return;let D=v.getBoundingClientRect(),se=v.scrollTop,ue=[];for(let ge of Ie){let Se=z.querySelector(`[data-comment-id="${ge.id}"]`);if(Se){let fe=Se.getBoundingClientRect();ue.push({id:`comment-${ge.id}`,targetY:fe.top-D.top+se,height:me.current.get(`comment-${ge.id}`)?.offsetHeight||80});}}t.forEach((ge,Se)=>{let fe=`tc-${ge.revisionId}-${Se}`,$e=z.querySelector(`[data-revision-id="${ge.revisionId}"]`);if($e){let Qe=$e.getBoundingClientRect();ue.push({id:fe,targetY:Qe.top-D.top+se,height:me.current.get(fe)?.offsetHeight||80});}}),f&&m!=null&&ue.push({id:"new-comment-input",targetY:m,height:me.current.get("new-comment-input")?.offsetHeight||120}),ue.sort((ge,Se)=>ge.targetY-Se.targetY);let pe=new Map,Ee=0;for(let ge of ue){let Se=Math.max(ge.targetY,Ee+Ip);pe.set(ge.id,Se),Ee=Se+ge.height;}K(pe);},[Ie,t,g,f,m]);Nu.useEffect(()=>{let v=g?.current;if(!v)return;let z=v.querySelector(".paged-editor__pages");if(!z)return;let D=se=>{let ue=se.target;if(!he.current?.contains(ue)){if(z.contains(ue)){let pe=ue.closest("[data-comment-id]");if(pe?.dataset.commentId){$(`comment-${pe.dataset.commentId}`),n?.(Number(pe.dataset.commentId));return}let Ee=ue.closest(".docx-insertion")||ue.closest(".docx-deletion");if(Ee?.dataset.revisionId){let ge=Number(Ee.dataset.revisionId),Se=t.findIndex(fe=>fe.revisionId===ge);if(Se>=0){$(`tc-${t[Se].revisionId}-${Se}`);return}}}$(null),W(null);}};return v.addEventListener("click",D),()=>v.removeEventListener("click",D)},[g,t,n]),Nu.useEffect(()=>{let v=g?.current;if(!v)return;let z=setTimeout(P,50),D=setTimeout(()=>{P(),B(true);},400),se=new ResizeObserver(()=>{requestAnimationFrame(P);});return se.observe(v),()=>{clearTimeout(z),clearTimeout(D),se.disconnect();}},[P,g]),Nu.useEffect(()=>{let v=requestAnimationFrame(P);return ()=>cancelAnimationFrame(v)},[V,f,P]),Nu.useEffect(()=>{let v=[];if(V){let ue=me.current.get(V);ue&&v.push(ue);}let z=me.current.get("new-comment-input");if(z&&v.push(z),v.length===0)return;let D,se=new ResizeObserver(()=>{cancelAnimationFrame(D),D=requestAnimationFrame(P);});for(let ue of v)se.observe(ue);return ()=>{cancelAnimationFrame(D),se.disconnect();}},[V,P]);let I=()=>{R.trim()&&(a?.(R.trim()),_(""));},y=(v,z)=>{$(V===v?null:v),W(null),z!==void 0&&n?.(z);},M=O.size>0,F=(v,z=32)=>({width:z,height:z,borderRadius:"50%",backgroundColor:Mp(v),color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:z===32?13:11,fontWeight:500,flexShrink:0}),A=v=>({padding:"6px 16px",fontSize:14,border:"none",borderRadius:20,background:v?"#1a73e8":"#f1f3f4",color:v?"#fff":"#80868b",cursor:v?"pointer":"default",fontWeight:500,fontFamily:"inherit"}),U=(v,z,D)=>{let se=te.current.has(v);return D!==void 0&&te.current.add(v),{...M?D!==void 0?{position:"absolute",top:D,left:0,right:0,opacity:1}:{position:"absolute",top:0,left:0,right:0,opacity:0,visibility:"hidden"}:{marginBottom:6},padding:z?"10px 12px":"8px 10px",borderRadius:8,backgroundColor:z?"#fff":"#f8fbff",cursor:"pointer",boxShadow:z?"0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15)":"0 1px 3px rgba(60,64,67,0.2), 0 2px 6px rgba(60,64,67,0.08)",transition:M&&D===void 0?"none":!se&&D!==void 0?"opacity 0.2s ease, box-shadow 0.2s ease":w?"opacity 0.2s ease, box-shadow 0.2s ease, top 0.15s ease":"none"}},Q=(v,z)=>v.length===0?null:jsxRuntime.jsxs("div",{style:{marginTop:8},children:[(z?v:v.slice(-1)).map(D=>jsxRuntime.jsxs("div",{style:{marginBottom:z?8:0,paddingTop:8,borderTop:"1px solid #e8eaed"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:F(D.author||"U",28),children:Pa(D.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:D.author||"Unknown"}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Ra(D.date)})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:4,...z?{}:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},children:Sl(D.content)})]},D.id)),!z&&v.length>1&&jsxRuntime.jsxs("div",{style:{fontSize:12,color:"#5f6368",marginTop:4},children:[v.length-1," more ",v.length-1===1?"reply":"replies"]})]}),N=(v,z)=>jsxRuntime.jsx("div",{onClick:D=>D.stopPropagation(),style:{marginTop:12},children:S===v?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{ref:D=>D?.focus({preventScroll:true}),type:"text",value:k,onChange:D=>E(D.target.value),onMouseDown:D=>D.stopPropagation(),onKeyDown:D=>{D.stopPropagation(),D.key==="Enter"&&(D.preventDefault(),k.trim()&&z&&z(v,k.trim()),E(""),C(null)),D.key==="Escape"&&(C(null),E(""));},placeholder:"Reply or add others with @",style:{width:"100%",border:"1px solid #1a73e8",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",boxSizing:"border-box",color:"#202124"}}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[jsxRuntime.jsx("button",{onClick:D=>{D.stopPropagation(),C(null),E("");},style:Cl,children:"Cancel"}),jsxRuntime.jsx("button",{onClick:D=>{D.stopPropagation(),k.trim()&&z&&z(v,k.trim()),E(""),C(null);},disabled:!k.trim(),style:A(!!k.trim()),children:"Reply"})]})]}):jsxRuntime.jsx("input",{readOnly:true,onMouseDown:D=>D.stopPropagation(),onClick:D=>{D.stopPropagation(),C(v);},placeholder:"Reply or add others with @",style:{width:"100%",border:"1px solid #dadce0",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",color:"#80868b",cursor:"text",backgroundColor:"#fff",boxSizing:"border-box"}})}),j=v=>{let z=Re(v.id),D=`comment-${v.id}`,se=V===D,ue=O.get(D);return jsxRuntime.jsxs("div",{ref:pe=>{pe?me.current.set(D,pe):me.current.delete(D);},"data-comment-id":v.id,className:"docx-comment-card",onClick:()=>y(D,v.id),onMouseDown:pe=>pe.stopPropagation(),style:{...U(D,se,ue),opacity:M&&ue===void 0?0:v.done?.6:1},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:F(v.author||"U"),children:Pa(v.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:v.author||"Unknown"}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Ra(v.date)})]}),se&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2,position:"relative"},children:[jsxRuntime.jsx("button",{onClick:pe=>{pe.stopPropagation(),r?.(v.id);},title:"Resolve",style:pr,children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"check",size:20})}),jsxRuntime.jsx("button",{onClick:pe=>{pe.stopPropagation(),W(L===D?null:D);},title:"More options",style:pr,children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"more_vert",size:20})}),L===D&&jsxRuntime.jsx("div",{onClick:pe=>pe.stopPropagation(),onMouseDown:pe=>pe.stopPropagation(),style:{position:"absolute",top:32,right:0,background:"#fff",borderRadius:8,boxShadow:"0 2px 6px rgba(60,64,67,0.3), 0 1px 2px rgba(60,64,67,0.15)",zIndex:100,minWidth:120,padding:"4px 0"},children:jsxRuntime.jsx("button",{onClick:()=>{W(null),i?.(v.id);},style:{display:"block",width:"100%",padding:"8px 16px",border:"none",background:"none",textAlign:"left",fontSize:14,color:"#202124",cursor:"pointer",fontFamily:"inherit"},onMouseOver:pe=>{pe.target.style.backgroundColor="#f1f3f4";},onMouseOut:pe=>{pe.target.style.backgroundColor="transparent";},children:"Delete"})})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:6},children:Sl(v.content)}),Q(z,se),se&&!v.done&&N(v.id,o)]},v.id)},G=v=>Te.get(v)??[],xe=(v,z)=>{let D=v.author||"Unknown",se=`tc-${v.revisionId}-${z}`,ue=V===se,pe=O.get(se),Ee=G(v.revisionId);return jsxRuntime.jsxs("div",{ref:ge=>{ge?me.current.set(se,ge):me.current.delete(se);},className:"docx-tracked-change-card",onClick:()=>y(se),onMouseDown:ge=>ge.stopPropagation(),style:U(se,ue,pe),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:F(D),children:Pa(D)}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:D}),v.date&&jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Ra(v.date)})]}),ue&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2},children:[jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),l?.(v.from,v.to);},title:"Accept",style:pr,children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"check",size:20})}),jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),u?.(v.from,v.to);},title:"Reject",style:pr,children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"close",size:20})})]})]}),jsxRuntime.jsxs("div",{style:{fontSize:13,lineHeight:"20px",color:"#202124",marginTop:6},children:[v.type==="insertion"?"Added":"Deleted"," ",jsxRuntime.jsxs("span",{style:{color:v.type==="insertion"?"#137333":"#c5221f",fontWeight:500},children:['"',v.text.length>50?v.text.slice(0,50)+"...":v.text,'"']})]}),Q(Ee,ue),ue&&N(v.revisionId,d)]},se)};return jsxRuntime.jsx("aside",{ref:he,className:"docx-comments-sidebar",role:"complementary","aria-label":"Comments and changes",style:{position:"absolute",top:c,left:`calc(50% - 120px + ${b/2+12}px)`,bottom:0,width:Ep,fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,backgroundColor:"transparent",overflowY:M?"visible":"auto",overflowX:"visible",opacity:M?1:0,transition:"opacity 0.15s ease"},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsxs("div",{style:{position:"relative"},children:[f&&jsxRuntime.jsxs("div",{ref:v=>{v?me.current.set("new-comment-input",v):me.current.delete("new-comment-input");},style:{...M?O.get("new-comment-input")!==void 0?{position:"absolute",top:O.get("new-comment-input"),left:0,right:0}:{position:"absolute",top:0,left:0,right:0,visibility:"hidden"}:{marginBottom:8},padding:12,borderRadius:8,backgroundColor:"#fff",boxShadow:"0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15)",zIndex:50},children:[jsxRuntime.jsx("textarea",{ref:v=>v?.focus({preventScroll:true}),value:R,onChange:v=>_(v.target.value),onMouseDown:v=>v.stopPropagation(),onKeyDown:v=>{v.stopPropagation(),v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),I()),v.key==="Escape"&&(s?.(),_(""));},placeholder:"Add a comment...",style:{width:"100%",border:"1px solid #1a73e8",borderRadius:20,outline:"none",resize:"none",fontSize:14,lineHeight:"20px",padding:"8px 16px",fontFamily:"inherit",minHeight:40,boxSizing:"border-box",color:"#202124"}}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[jsxRuntime.jsx("button",{onClick:()=>{s?.(),_("");},style:Cl,children:"Cancel"}),jsxRuntime.jsx("button",{onClick:I,disabled:!R.trim(),style:A(!!R.trim()),children:"Comment"})]})]}),Ie.map(v=>j(v)),t.map((v,z)=>xe(v,z)),Ie.length===0&&t.length===0&&!f&&jsxRuntime.jsx("div",{style:{padding:"24px 16px",textAlign:"center",color:"#80868b",fontSize:13},children:"No comments or changes yet."})]})})};var Bp=15840,vl=1440,Ap=1440,Dp=567,Pl=20,Hp="var(--doc-text-muted)",Np="var(--doc-text-subtle)",zp="var(--doc-primary)",Op="var(--doc-primary)",$p="var(--doc-primary-hover)";function Ml({sectionProps:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,unit:i="inch",className:a="",style:s}){let[l,u]=Nu.useState(null),[d,c]=Nu.useState(null),p=Nu.useRef(null),f=e?.pageHeight??Bp,m=e?.marginTop??vl,b=e?.marginBottom??vl,g=chunkJRRTZZ72_cjs.r(f)*t,S=chunkJRRTZZ72_cjs.r(m)*t,C=chunkJRRTZZ72_cjs.r(b)*t,k=Nu.useCallback(($,L)=>{n&&($.preventDefault(),u(L));},[n]),E=Nu.useCallback($=>{if(!l||!p.current)return;let L=p.current.getBoundingClientRect(),W=$.clientY-L.top,O=chunkJRRTZZ72_cjs.s(W/t);if(l==="topMargin"){let K=f-b-720,w=Math.max(0,Math.min(O,K));o?.(Math.round(w));}else if(l==="bottomMargin"){let K=f-O,w=f-m-720,B=Math.max(0,Math.min(K,w));r?.(Math.round(B));}},[l,t,f,m,b,o,r]),R=Nu.useCallback(()=>{u(null);},[]);Nu.useEffect(()=>{if(l)return document.addEventListener("mousemove",E),document.addEventListener("mouseup",R),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",R);}},[l,E,R]);let _=_p(f,t,i),V={position:"relative",width:Pl,height:chunkJRRTZZ72_cjs.B(g),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:l?"ns-resize":"default",...s};return jsxRuntime.jsxs("div",{ref:p,className:`docx-vertical-ruler ${a}`,style:V,role:"slider","aria-label":"Vertical ruler","aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:_.map(($,L)=>jsxRuntime.jsx(Wp,{tick:$},L))}),jsxRuntime.jsx(Rl,{type:"topMargin",position:S,editable:n,isDragging:l==="topMargin",isHovered:d==="topMargin",onMouseEnter:()=>c("topMargin"),onMouseLeave:()=>c(null),onMouseDown:$=>k($,"topMargin")}),jsxRuntime.jsx(Rl,{type:"bottomMargin",position:g-C,editable:n,isDragging:l==="bottomMargin",isHovered:d==="bottomMargin",onMouseEnter:()=>c("bottomMargin"),onMouseLeave:()=>c(null),onMouseDown:$=>k($,"bottomMargin")})]})}function Wp({tick:e}){let t={position:"absolute",top:chunkJRRTZZ72_cjs.B(e.position),right:0,height:1,width:e.width,backgroundColor:Np},n={position:"absolute",top:chunkJRRTZZ72_cjs.B(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Hp,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Rl({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let l=o?$p:r?Op:zp,u={position:"absolute",top:chunkJRRTZZ72_cjs.B(t-5),right:0,width:Pl,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},d={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${l}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:u,onMouseEnter:i,onMouseLeave:a,onMouseDown:s,role:"slider","aria-label":e==="topMargin"?"Top margin":"Bottom margin","aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:d})})}function _p(e,t,n){let o=[];if(n==="inch"){let r=Ap/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkJRRTZZ72_cjs.r(s)*t;if(a%8===0){let u=a/8;o.push({position:l,width:10,label:u>0?String(u):void 0});}else a%4===0?o.push({position:l,width:6}):a%2===0?o.push({position:l,width:4}):o.push({position:l,width:2});}}else {let r=Dp/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkJRRTZZ72_cjs.r(s)*t;if(a%10===0){let u=a/10;o.push({position:l,width:10,label:u>0?String(u):void 0});}else a%5===0?o.push({position:l,width:6}):o.push({position:l,width:3});}}return o}var xn={High:50,Default:100,Low:150};function Ct(e){return t=>{let n={...e.defaultOptions,...t};return {type:"extension",config:{name:e.name,priority:e.priority??xn.Default,options:n},onSchemaReady(o){return e.onSchemaReady(o,n)}}}}function je(e){return t=>{let n={...e.defaultOptions,...t},o=typeof e.nodeSpec=="function"?e.nodeSpec(n):e.nodeSpec;return {type:"node",config:{name:e.name,priority:e.priority??xn.Default,options:n,schemaNodeName:e.schemaNodeName,nodeSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}function Be(e){return t=>{let n={...e.defaultOptions,...t},o=typeof e.markSpec=="function"?e.markSpec(n):e.markSpec;return {type:"mark",config:{name:e.name,priority:e.priority??xn.Default,options:n,schemaMarkName:e.schemaMarkName,markSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}var Il=je({name:"doc",schemaNodeName:"doc",nodeSpec:{content:"(paragraph | horizontalRule | pageBreak | table)+"}});var Fl=je({name:"text",schemaNodeName:"text",nodeSpec:{group:"inline"}});function Ll(e,t){if(!e)return {};let n={};if(e.fontFamily){let a=null;if(e.fontFamily.asciiTheme&&t?.fontScheme,a||(a=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),a){let s=chunk4CUGBNL2_cjs.a(a);n.fontFamily=s.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${chunkJRRTZZ72_cjs.z(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=chunkJRRTZZ72_cjs.a(e.color,t)),e.highlight&&e.highlight!=="none"&&(n.backgroundColor=chunkJRRTZZ72_cjs.n(e.highlight)),e.shading){let a=Al(e.shading,t);a&&!n.backgroundColor&&(n.backgroundColor=a);}let o=[],r=[],i=[];if(e.underline&&e.underline.style!=="none"){o.push("underline");let a=jp(e.underline.style);a!=="solid"&&r.push(a),e.underline.color&&i.push(chunkJRRTZZ72_cjs.a(e.underline.color,t));}if(e.strike&&o.push("line-through"),e.doubleStrike&&o.push("line-through"),o.length>0&&(n.textDecoration=o.join(" "),r.length>0&&(n.textDecorationStyle=r[0]),i.length>0&&(n.textDecorationColor=i[0])),e.vertAlign)switch(e.vertAlign){case "superscript":n.verticalAlign="super",n.fontSize||(n.fontSize="0.83em");break;case "subscript":n.verticalAlign="sub",n.fontSize||(n.fontSize="0.83em");break}if(e.position&&e.position!==0){let a=chunkJRRTZZ72_cjs.y(e.position);n.position="relative",n.top=chunkJRRTZZ72_cjs.B(-a);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(e.spacing))),e.scale!==void 0&&e.scale!==100&&(n.transform=`scaleX(${e.scale/100})`,n.display="inline-block"),e.hidden&&(n.display="none"),e.emboss&&(n.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(n.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(n.WebkitTextStroke="1px currentColor",n.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(n.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(n.direction="rtl"),n}function Bl(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=Up(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let o=chunkJRRTZZ72_cjs.r(e.lineSpacing);o>0&&(n.lineHeight=chunkJRRTZZ72_cjs.B(o));break}case "atLeast":{let o=chunkJRRTZZ72_cjs.r(e.lineSpacing);o>0&&(n.minHeight=chunkJRRTZZ72_cjs.B(o),n.lineHeight=chunkJRRTZZ72_cjs.B(o));break}default:{let o=e.lineSpacing/240;o>0&&(n.lineHeight=o.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(e.indentFirstLine)):n.textIndent=chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,to(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,to(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,to(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,to(e.borders.right,"Right",t))),e.shading){let o=Al(e.shading,t);o&&(n.backgroundColor=o);}return e.bidi&&(n.direction="rtl"),e.pageBreakBefore&&(n.pageBreakBefore="always"),e.keepNext&&(n.pageBreakAfter="avoid"),e.keepLines&&(n.pageBreakInside="avoid"),n}function to(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let o={},r=e.size?chunkJRRTZZ72_cjs.A(e.size):1,i=e.color?chunkJRRTZZ72_cjs.a(e.color,n):"#000000",a=Gp(e.style),s=`border${t}Width`,l=`border${t}Style`,u=`border${t}Color`;return o[s]=chunkJRRTZZ72_cjs.B(Math.max(1,r)),o[l]=a,o[u]=i,o}function Al(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":chunkJRRTZZ72_cjs.c(e.fill,t):e.pattern==="solid"&&e.color?chunkJRRTZZ72_cjs.c(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?chunkJRRTZZ72_cjs.c(e.color,t):""}function jp(e){switch(e){case "double":return "double";case "dotted":case "dottedHeavy":return "dotted";case "dash":case "dashedHeavy":case "dashLong":case "dashLongHeavy":case "dotDash":case "dashDotHeavy":case "dotDotDash":case "dashDotDotHeavy":return "dashed";case "wave":case "wavyHeavy":case "wavyDouble":return "wavy";default:return "solid"}}function Up(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function Gp(e){switch(e){case "none":case "nil":return "none";case "double":case "triple":return "double";case "dotted":return "dotted";case "dashed":case "dashSmallGap":return "dashed";case "threeDEmboss":return "ridge";case "threeDEngrave":return "groove";case "outset":return "outset";case "inset":return "inset";default:return "solid"}}function no(e){let t=[];return e.descendants((n,o)=>{if(n.type.name==="paragraph"){let r=n.attrs.outlineLevel,i=n.attrs.styleId,a=r;if(a==null&&i){let s=i.match(/^[Hh]eading(\d)$/);s&&(a=parseInt(s[1],10)-1);}if(a!=null&&a>=0&&a<=8){let s="";n.forEach(l=>{l.isText&&(s+=l.text||"");}),s.trim()&&t.push({text:s.trim(),level:a,pmPos:o});}}}),t}function Yp(e){let t=e.indentLeft;e.numPr?.numId&&t==null&&(t=((e.numPr.ilvl??0)+1)*720);let n={alignment:e.alignment,spaceBefore:e.spaceBefore,spaceAfter:e.spaceAfter,lineSpacing:e.lineSpacing,lineSpacingRule:e.lineSpacingRule,indentLeft:t,indentRight:e.indentRight,indentFirstLine:e.indentFirstLine,hangingIndent:e.hangingIndent,borders:e.borders,shading:e.shading},o=Bl(n);return Object.entries(o).map(([r,i])=>`${r.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${i}`).join("; ")}function qp(e){switch(e){case "upperRoman":return "docx-list-upper-roman";case "lowerRoman":return "docx-list-lower-roman";case "upperLetter":return "docx-list-upper-alpha";case "lowerLetter":return "docx-list-lower-alpha";default:return "docx-list-decimal"}}function Xp(e,t,n){if(!e?.numId)return "";let o=e.ilvl??0;return t?`docx-list-bullet docx-list-level-${o}`:`docx-list-numbered ${qp(n)} docx-list-level-${o}`}var Zp={content:"inline*",group:"block",attrs:{paraId:{default:null},textId:{default:null},alignment:{default:null},spaceBefore:{default:null},spaceAfter:{default:null},lineSpacing:{default:null},lineSpacingRule:{default:null},indentLeft:{default:null},indentRight:{default:null},indentFirstLine:{default:null},hangingIndent:{default:false},numPr:{default:null},listNumFmt:{default:null},listIsBullet:{default:null},listMarker:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},contextualSpacing:{default:null},defaultTextFormatting:{default:null},sectionBreakType:{default:null},outlineLevel:{default:null},bookmarks:{default:null},_originalFormatting:{default:null}},parseDOM:[{tag:"p",getAttrs(e){let t=e;return {paraId:t.dataset.paraId||void 0,alignment:t.dataset.alignment,styleId:t.dataset.styleId||void 0,sectionBreakType:t.dataset.sectionBreak||void 0}}}],toDOM(e){let t=e.attrs,n=Yp(t),o=Xp(t.numPr,t.listIsBullet,t.listNumFmt),r={};return n&&(r.style=n),o&&(r.class=o),t.paraId&&(r["data-para-id"]=t.paraId),t.alignment&&(r["data-alignment"]=t.alignment),t.styleId&&(r["data-style-id"]=t.styleId),t.listMarker&&(r["data-list-marker"]=t.listMarker),t.sectionBreakType&&(r["data-section-break"]=t.sectionBreakType,r.class=(r.class?r.class+" ":"")+"docx-section-break"),["p",r,0]}};function jt(e,t){return (n,o)=>{let{$from:r,$to:i}=n.selection;if(!o)return true;let a=n.tr,s=new Set;return n.doc.nodesBetween(r.pos,i.pos,(l,u)=>{l.type.name==="paragraph"&&!s.has(u)&&(s.add(u),a=a.setNodeMarkup(u,void 0,{...l.attrs,[e]:t}));}),o(a.scrollIntoView()),true}}function Dl(e){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,l)=>{s.type.name==="paragraph"&&!a.has(l)&&(a.add(l),i=i.setNodeMarkup(l,void 0,{...s.attrs,...e}));}),n(i.scrollIntoView()),true}}function Mo(e){return (t,n)=>jt("alignment",e)(t,n)}function fr(e,t="auto"){return (n,o)=>Dl({lineSpacing:e,lineSpacingRule:t})(n,o)}function Jp(e=720){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,l)=>{if(s.type.name==="paragraph"&&!a.has(l)){a.add(l);let u=s.attrs.indentLeft||0;i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:u+e});}}),n(i.scrollIntoView()),true}}function Qp(e=720){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,l)=>{if(s.type.name==="paragraph"&&!a.has(l)){a.add(l);let u=s.attrs.indentLeft||0,d=Math.max(0,u-e);i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:d>0?d:null});}}),n(i.scrollIntoView()),true}}function ef(e){return (t,n)=>(o,r)=>{let{$from:i,$to:a}=o.selection;if(!r)return true;let s=o.tr,l=new Set,u=[];if(n?.runFormatting){let c=n.runFormatting;c.bold&&u.push(e.marks.bold.create()),c.italic&&u.push(e.marks.italic.create()),c.fontSize&&u.push(e.marks.fontSize.create({size:c.fontSize})),c.fontFamily&&u.push(e.marks.fontFamily.create({ascii:c.fontFamily.ascii,hAnsi:c.fontFamily.hAnsi,asciiTheme:c.fontFamily.asciiTheme})),c.color&&!c.color.auto&&u.push(e.marks.textColor.create({rgb:c.color.rgb,themeColor:c.color.themeColor,themeTint:c.color.themeTint,themeShade:c.color.themeShade})),c.underline&&c.underline.style!=="none"&&u.push(e.marks.underline.create({style:c.underline.style,color:c.underline.color})),(c.strike||c.doubleStrike)&&u.push(e.marks.strike.create({double:c.doubleStrike||false}));}let d=[e.marks.bold,e.marks.italic,e.marks.fontSize,e.marks.fontFamily,e.marks.textColor,e.marks.underline,e.marks.strike].filter(Boolean);return o.doc.nodesBetween(i.pos,a.pos,(c,p)=>{if(c.type.name==="paragraph"&&!l.has(p)){l.add(p);let f={...c.attrs,styleId:t};if(n?.paragraphFormatting){let m=n.paragraphFormatting;m.alignment!==void 0&&(f.alignment=m.alignment),m.spaceBefore!==void 0&&(f.spaceBefore=m.spaceBefore),m.spaceAfter!==void 0&&(f.spaceAfter=m.spaceAfter),m.lineSpacing!==void 0&&(f.lineSpacing=m.lineSpacing),m.lineSpacingRule!==void 0&&(f.lineSpacingRule=m.lineSpacingRule),m.indentLeft!==void 0&&(f.indentLeft=m.indentLeft),m.indentRight!==void 0&&(f.indentRight=m.indentRight),m.indentFirstLine!==void 0&&(f.indentFirstLine=m.indentFirstLine);}if(s=s.setNodeMarkup(p,void 0,f),n){let m=p+1,b=p+c.nodeSize-1;if(b>m){for(let g of d)s=s.removeMark(m,b,g);for(let g of u)s=s.addMark(m,b,g);}}}}),u.length>0&&(s=s.setStoredMarks(u)),r(s.scrollIntoView()),true}}var Hl=je({name:"paragraph",schemaNodeName:"paragraph",nodeSpec:Zp,onSchemaReady(e){let t=ef(e.schema);return {commands:{setAlignment:n=>Mo(n),alignLeft:()=>Mo("left"),alignCenter:()=>Mo("center"),alignRight:()=>Mo("right"),alignJustify:()=>Mo("both"),setLineSpacing:(n,o)=>fr(n,o),singleSpacing:()=>fr(240),oneAndHalfSpacing:()=>fr(360),doubleSpacing:()=>fr(480),setSpaceBefore:n=>jt("spaceBefore",n),setSpaceAfter:n=>jt("spaceAfter",n),increaseIndent:n=>Jp(n),decreaseIndent:n=>Qp(n),setIndentLeft:n=>jt("indentLeft",n>0?n:null),setIndentRight:n=>jt("indentRight",n>0?n:null),setIndentFirstLine:(n,o)=>Dl({indentFirstLine:n>0?n:null,hangingIndent:o??false}),applyStyle:(n,o)=>t(n,o),clearStyle:()=>jt("styleId",null),insertSectionBreak:n=>jt("sectionBreakType",n),removeSectionBreak:()=>jt("sectionBreakType",null),generateTOC:()=>(n,o)=>{let r=no(n.doc);if(r.length===0)return false;if(!o)return true;let{schema:i}=n,a=n.tr,s=[];for(let d of r){let c=`_Toc${Math.floor(1e8+Math.random()*9e8)}`;s.push({name:c,level:d.level,text:d.text});let p=a.mapping.map(d.pmPos),m=a.doc.resolve(p).nodeAfter;if(m&&m.type.name==="paragraph"){let S=[...(m.attrs.bookmarks||[]).filter(C=>!C.name.startsWith("_Toc")),{id:Math.floor(Math.random()*2147483647),name:c}];a.setNodeMarkup(p,void 0,{...m.attrs,bookmarks:S});}}let l=[];l.push(i.node("paragraph",{styleId:"TOCHeading",alignment:"center"},[i.text("Table of Contents",[i.marks.bold.create()])]));for(let d of s){let c=d.level*720,p=`TOC${d.level+1}`,f=i.marks.hyperlink.create({href:`#${d.name}`});l.push(i.node("paragraph",{styleId:p,indentLeft:c>0?c:null},[i.text(d.text,[f])]));}let u=a.mapping.map(n.selection.from);return a.insert(u,prosemirrorModel.Fragment.from(l)),o(a.scrollIntoView()),true},setTabs:n=>jt("tabs",n.length>0?n:null),addTabStop:(n,o="left",r="none")=>(i,a)=>{let{$from:s}=i.selection,l=s.parent;if(l.type.name!=="paragraph")return false;let c=[...(l.attrs.tabs||[]).filter(p=>p.position!==n),{position:n,alignment:o,leader:r}].sort((p,f)=>p.position-f.position);return jt("tabs",c)(i,a)},removeTabStop:n=>(o,r)=>{let{$from:i}=o.selection,a=i.parent;if(a.type.name!=="paragraph")return false;let l=(a.attrs.tabs||[]).filter(u=>u.position!==n);return jt("tabs",l.length>0?l:null)(o,r)}}}}});var zl=Ct({name:"history",defaultOptions:{depth:100,newGroupDelay:500},onSchemaReady(e,t){return {plugins:[prosemirrorHistory.history({depth:t.depth,newGroupDelay:t.newGroupDelay})],commands:{undo:()=>prosemirrorHistory.undo,redo:()=>prosemirrorHistory.redo},keyboardShortcuts:{"Mod-z":prosemirrorHistory.undo,"Mod-y":prosemirrorHistory.redo,"Mod-Shift-z":prosemirrorHistory.redo}}}});var $l=Be({name:"bold",schemaMarkName:"bold",markSpec:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2})$/.test(e)?null:false}],toDOM(){return ["strong",0]}},onSchemaReady(e){return {commands:{toggleBold:()=>prosemirrorCommands.toggleMark(e.schema.marks.bold)},keyboardShortcuts:{"Mod-b":prosemirrorCommands.toggleMark(e.schema.marks.bold)}}}});var _l=Be({name:"italic",schemaMarkName:"italic",markSpec:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"?null:false}],toDOM(){return ["em",0]}},onSchemaReady(e){return {commands:{toggleItalic:()=>prosemirrorCommands.toggleMark(e.schema.marks.italic)},keyboardShortcuts:{"Mod-i":prosemirrorCommands.toggleMark(e.schema.marks.italic)}}}});function nf(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true;break;case "italic":t.italic=true;break;case "underline":t.underline={style:n.attrs.style||"single"};break;case "strike":t.strike=true;break;case "textColor":t.color=n.attrs;break;case "highlight":t.highlight=n.attrs.color;break;case "fontSize":t.fontSize=n.attrs.size;break;case "fontFamily":t.fontFamily={ascii:n.attrs.ascii,hAnsi:n.attrs.hAnsi};break;case "superscript":t.vertAlign="superscript";break;case "subscript":t.vertAlign="subscript";break}return t}function Vl(e,t){let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||o.textContent.length>0)return t;let r=t.storedMarks||e.storedMarks||[];if(r.length===0)return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:null});let i=nf(r);return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:i})}function en(e,t){return (n,o)=>{let{from:r,to:i,empty:a}=n.selection,s=e.create(t);if(a){if(o){let l=e.isInSet(n.storedMarks||n.selection.$from.marks())?(n.storedMarks||n.selection.$from.marks()).filter(d=>d.type!==e):n.storedMarks||n.selection.$from.marks(),u=n.tr.setStoredMarks([...l,s]);u=Vl(n,u),o(u);}return true}return o&&o(n.tr.addMark(r,i,s).scrollIntoView()),true}}function tn(e){return (t,n)=>{let{from:o,to:r,empty:i}=t.selection;if(i){if(n){let a=(t.storedMarks||t.selection.$from.marks()).filter(l=>l.type!==e),s=t.tr.setStoredMarks(a);s=Vl(t,s),n(s);}return true}return n&&n(t.tr.removeMark(o,r,e).scrollIntoView()),true}}function Ia(e,t){let n=[];return e.bold&&n.push(t.marks.bold.create()),e.italic&&n.push(t.marks.italic.create()),e.underline&&n.push(t.marks.underline.create({style:e.underline.style||"single",color:e.underline.color})),e.strike&&n.push(t.marks.strike.create()),e.doubleStrike&&n.push(t.marks.strike.create({double:true})),e.color&&n.push(t.marks.textColor.create({rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&n.push(t.marks.highlight.create({color:e.highlight})),e.fontSize&&n.push(t.marks.fontSize.create({size:e.fontSize})),e.fontFamily&&n.push(t.marks.fontFamily.create({ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),e.vertAlign==="superscript"&&n.push(t.marks.superscript.create()),e.vertAlign==="subscript"&&n.push(t.marks.subscript.create()),n}var Eo=(e,t)=>{let{from:n,to:o,empty:r}=e.selection;if(r)return t&&t(e.tr.setStoredMarks([])),true;if(t){let i=e.tr;e.doc.nodesBetween(n,o,(a,s)=>{if(a.isText&&a.marks.length>0){let l=Math.max(n,s),u=Math.min(o,s+a.nodeSize);for(let d of a.marks)i=i.removeMark(l,u,d.type);}}),t(i.scrollIntoView());}return true};var Ul=Be({name:"underline",schemaMarkName:"underline",markSpec:{attrs:{style:{default:"single"},color:{default:null}},parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:e=>e.includes("underline")?{}:false}],toDOM(e){let t=e.attrs,n=["text-decoration: underline"];if(t.style&&t.style!=="single"){let r={double:"double",dotted:"dotted",dash:"dashed",wave:"wavy"}[t.style];r&&n.push(`text-decoration-style: ${r}`);}return t.color?.rgb&&n.push(`text-decoration-color: #${t.color.rgb}`),["span",{style:n.join("; ")},0]}},onSchemaReady(e){return {commands:{toggleUnderline:()=>prosemirrorCommands.toggleMark(e.schema.marks.underline),setUnderlineStyle:(t,n)=>en(e.schema.marks.underline,{style:t,color:n})},keyboardShortcuts:{"Mod-u":prosemirrorCommands.toggleMark(e.schema.marks.underline)}}}});var Gl=Be({name:"strike",schemaMarkName:"strike",markSpec:{attrs:{double:{default:false}},parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:e=>e.includes("line-through")?{}:false}],toDOM(){return ["s",0]}},onSchemaReady(e){return {commands:{toggleStrike:()=>prosemirrorCommands.toggleMark(e.schema.marks.strike)}}}});var Kl=Be({name:"textColor",schemaMarkName:"textColor",markSpec:{attrs:{rgb:{default:null},themeColor:{default:null},themeTint:{default:null},themeShade:{default:null}},parseDOM:[{style:"color",getAttrs:e=>{let n=e.match(/#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})/);return n?{rgb:n[1].toUpperCase()}:false}}],toDOM(e){let t=e.attrs,n=Ll({color:t});return ["span",{style:n.color?`color: ${n.color}`:""},0]}},onSchemaReady(e){return {commands:{setTextColor:t=>!t.rgb&&!t.themeColor?tn(e.schema.marks.textColor):en(e.schema.marks.textColor,t),clearTextColor:()=>tn(e.schema.marks.textColor)}}}});var Yl=Be({name:"highlight",schemaMarkName:"highlight",markSpec:{attrs:{color:{default:"yellow"}},parseDOM:[{tag:"mark"},{style:"background-color",getAttrs:e=>e&&e!=="transparent"&&e!=="inherit"?{color:e}:false}],toDOM(e){let t=e.attrs.color;return ["mark",{style:`background-color: ${chunkJRRTZZ72_cjs.n(t)}`},0]}},onSchemaReady(e){return {commands:{setHighlight:t=>!t||t==="none"?tn(e.schema.marks.highlight):en(e.schema.marks.highlight,{color:t}),clearHighlight:()=>tn(e.schema.marks.highlight)}}}});var ql=Be({name:"fontSize",schemaMarkName:"fontSize",markSpec:{attrs:{size:{default:24}},parseDOM:[{style:"font-size",getAttrs:e=>{let t=e,n=t.match(/^([\d.]+)px$/);if(n){let i=parseFloat(n[1])*.75;return {size:Math.round(i*2)}}let o=t.match(/^([\d.]+)pt$/);return o?{size:Math.round(parseFloat(o[1])*2)}:false}}],toDOM(e){let n=e.attrs.size/2,o=(n*1.15).toFixed(2);return ["span",{style:`font-size: ${n}pt; line-height: ${o}pt`},0]}},onSchemaReady(e){return {commands:{setFontSize:t=>en(e.schema.marks.fontSize,{size:t}),clearFontSize:()=>tn(e.schema.marks.fontSize)}}}});var Xl=Be({name:"fontFamily",schemaMarkName:"fontFamily",markSpec:{attrs:{ascii:{default:null},hAnsi:{default:null},asciiTheme:{default:null}},parseDOM:[{style:"font-family",getAttrs:e=>{let n=e.split(",")[0].trim().replace(/['"]/g,"");return n?{ascii:n}:false}}],toDOM(e){let t=e.attrs,n=t.ascii||t.hAnsi;return n?["span",{style:`font-family: ${n.includes(" ")?`"${n}"`:n}, sans-serif`},0]:["span",0]}},onSchemaReady(e){return {commands:{setFontFamily:t=>en(e.schema.marks.fontFamily,{ascii:t,hAnsi:t}),clearFontFamily:()=>tn(e.schema.marks.fontFamily)}}}});var Zl=Be({name:"superscript",schemaMarkName:"superscript",markSpec:{excludes:"subscript",parseDOM:[{tag:"sup"}],toDOM(){return ["sup",0]}},onSchemaReady(e){return {commands:{toggleSuperscript:()=>prosemirrorCommands.toggleMark(e.schema.marks.superscript)}}}});var Jl=Be({name:"subscript",schemaMarkName:"subscript",markSpec:{excludes:"superscript",parseDOM:[{tag:"sub"}],toDOM(){return ["sub",0]}},onSchemaReady(e){return {commands:{toggleSubscript:()=>prosemirrorCommands.toggleMark(e.schema.marks.subscript)}}}});function oo(e){let t=e.schema.marks.hyperlink;if(!t)return null;let{empty:n,$from:o,from:r,to:i}=e.selection;if(n){let s=e.storedMarks||o.marks();for(let l of s)if(l.type===t)return {href:l.attrs.href,tooltip:l.attrs.tooltip};return null}let a=null;return e.doc.nodesBetween(r,i,s=>{if(s.isText&&a===null){let l=t.isInSet(s.marks);if(l)return a={href:l.attrs.href,tooltip:l.attrs.tooltip},false}return true}),a}function ro(e){let{from:t,to:n,empty:o}=e.selection;return o?"":e.doc.textBetween(t,n,"")}var Ql=Be({name:"hyperlink",schemaMarkName:"hyperlink",markSpec:{attrs:{href:{},tooltip:{default:null},rId:{default:null}},inclusive:false,parseDOM:[{tag:"a[href]",getAttrs:e=>{let t=e;return {href:t.getAttribute("href")||"",tooltip:t.getAttribute("title")||void 0}}}],toDOM(e){let t=e.attrs,n={href:t.href,target:"_blank",rel:"noopener noreferrer"};return t.tooltip&&(n.title=t.tooltip),["a",n,0]}},onSchemaReady(e){let t=e.schema.marks.hyperlink,n=(i,a)=>(s,l)=>{let{from:u,to:d,empty:c}=s.selection;if(c)return false;if(l){let p=t.create({href:i,tooltip:a||null});l(s.tr.addMark(u,d,p).scrollIntoView());}return true},o=(i,a)=>{let{from:s,to:l,empty:u}=i.selection;if(u){let d=i.selection.$from;if(!d.marks().find(g=>g.type===t))return false;let f=d.pos,m=d.pos;return d.parent.forEach((g,S)=>{if(g.isText){let C=d.start()+S,k=C+g.nodeSize;C<=d.pos&&d.pos<=k&&g.marks.some(R=>R.type===t)&&(f=Math.min(f,C),m=Math.max(m,k));}}),a&&a(i.tr.removeMark(f,m,t).scrollIntoView()),true}return a&&a(i.tr.removeMark(s,l,t).scrollIntoView()),true};return {commands:{setHyperlink:n,removeHyperlink:()=>o,insertHyperlink:(i,a,s)=>(l,u)=>{if(u){let d=t.create({href:a,tooltip:s||null}),c=l.schema.text(i,[d]);u(l.tr.replaceSelectionWith(c,false).scrollIntoView());}return true}}}}});var ec=Be({name:"allCaps",schemaMarkName:"allCaps",markSpec:{parseDOM:[{style:"text-transform",getAttrs:e=>e==="uppercase"?{}:false}],toDOM(){return ["span",{style:"text-transform: uppercase"},0]}}});var tc=Be({name:"smallCaps",schemaMarkName:"smallCaps",markSpec:{parseDOM:[{style:"font-variant",getAttrs:e=>e==="small-caps"?{}:false}],toDOM(){return ["span",{style:"font-variant: small-caps"},0]}}});var nc=Be({name:"footnoteRef",schemaMarkName:"footnoteRef",markSpec:{attrs:{id:{},noteType:{default:"footnote"}},parseDOM:[{tag:"sup.docx-footnote-ref",getAttrs:e=>{let t=e;return {id:t.dataset.id||"",noteType:t.dataset.noteType||"footnote"}}}],toDOM(e){let t=e.attrs;return ["sup",{class:`docx-${t.noteType}-ref`,"data-id":t.id,"data-note-type":t.noteType},0]}},onSchemaReady(e){let{schema:t}=e;function n(r){return i=>(a,s)=>{if(!s)return true;let l=t.marks.footnoteRef.create({id:String(i),noteType:r}),u=t.text(String(i),[l]),d=a.tr.replaceSelectionWith(u,false);return s(d.scrollIntoView()),true}}let o=(r,i)=>{let{$from:a,$to:s}=r.selection;if(!i)return true;let l=r.tr,u=t.marks.footnoteRef;return l=l.removeMark(a.pos,s.pos,u),i(l.scrollIntoView()),true};return {commands:{insertFootnote:n("footnote"),insertEndnote:n("endnote"),deleteNoteRef:()=>o}}}});function sf(e){return e/2*(96/72)}var oc=Be({name:"characterSpacing",schemaMarkName:"characterSpacing",markSpec:{attrs:{spacing:{default:null},position:{default:null},scale:{default:null},kerning:{default:null}},parseDOM:[{tag:"span.docx-char-spacing",getAttrs:e=>{let t=e;return {spacing:t.dataset.spacing?Number(t.dataset.spacing):null,position:t.dataset.position?Number(t.dataset.position):null,scale:t.dataset.scale?Number(t.dataset.scale):null,kerning:t.dataset.kerning?Number(t.dataset.kerning):null}}}],toDOM(e){let t=e.attrs,n=[],o={class:"docx-char-spacing"};if(t.spacing!=null&&t.spacing!==0&&(n.push(`letter-spacing: ${chunkJRRTZZ72_cjs.B(chunkJRRTZZ72_cjs.r(t.spacing))}`),o["data-spacing"]=String(t.spacing)),t.position!=null&&t.position!==0){let r=sf(t.position);n.push(`vertical-align: ${chunkJRRTZZ72_cjs.B(r)}`),o["data-position"]=String(t.position);}return t.scale!=null&&t.scale!==100&&(n.push(`transform: scaleX(${t.scale/100})`),n.push("display: inline-block"),o["data-scale"]=String(t.scale)),t.kerning!=null&&(o["data-kerning"]=String(t.kerning)),n.length>0&&(o.style=n.join("; ")),["span",o,0]}}});var rc=Be({name:"comment",schemaMarkName:"comment",markSpec:{attrs:{commentId:{default:0}},inclusive:false,parseDOM:[{tag:"span.docx-comment",getAttrs(e){return {commentId:parseInt(e.dataset.commentId||"0",10)}}}],toDOM(e){return ["span",{class:"docx-comment","data-comment-id":String(e.attrs.commentId),style:"background-color: rgba(255, 212, 0, 0.25); border-bottom: 2px solid rgba(255, 212, 0, 0.6);"},0]}}});var ic=Be({name:"insertion",schemaMarkName:"insertion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:false,parseDOM:[{tag:"span.docx-insertion",getAttrs(e){let t=e;return {revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return ["span",{class:"docx-insertion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #2e7d32; text-decoration: underline; text-decoration-color: #2e7d32;"},0]}}}),ac=Be({name:"deletion",schemaMarkName:"deletion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:false,parseDOM:[{tag:"span.docx-deletion",getAttrs(e){let t=e;return {revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return ["span",{class:"docx-deletion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #c62828; text-decoration: line-through; text-decoration-color: #c62828;"},0]}}});var sc=Be({name:"emboss",schemaMarkName:"emboss",markSpec:{parseDOM:[{tag:"span.docx-emboss"}],toDOM(){return ["span",{class:"docx-emboss",style:"text-shadow: 1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"},0]}}}),lc=Be({name:"imprint",schemaMarkName:"imprint",markSpec:{parseDOM:[{tag:"span.docx-imprint"}],toDOM(){return ["span",{class:"docx-imprint",style:"-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"},0]}}}),cc=Be({name:"textShadow",schemaMarkName:"textShadow",markSpec:{parseDOM:[{tag:"span.docx-text-shadow"}],toDOM(){return ["span",{class:"docx-text-shadow",style:"text-shadow: 1px 1px 2px rgba(0,0,0,0.3)"},0]}}}),dc=Be({name:"emphasisMark",schemaMarkName:"emphasisMark",markSpec:{attrs:{type:{default:"dot"}},parseDOM:[{tag:"span.docx-emphasis-mark",getAttrs:e=>({type:e.dataset.emType||"dot"})}],toDOM(e){let t=e.attrs.type,n="filled dot";switch(t){case "dot":n="filled dot";break;case "comma":n="filled sesame";break;case "circle":n="filled circle";break;case "underDot":n="filled dot";break}let o=t==="underDot"?"under right":"over right";return ["span",{class:"docx-emphasis-mark","data-em-type":t,style:`text-emphasis: ${n}; text-emphasis-position: ${o}; -webkit-text-emphasis: ${n}; -webkit-text-emphasis-position: ${o}`},0]}}}),uc=Be({name:"textOutline",schemaMarkName:"textOutline",markSpec:{parseDOM:[{tag:"span.docx-text-outline"}],toDOM(){return ["span",{class:"docx-text-outline",style:"-webkit-text-stroke: 1px currentColor; -webkit-text-fill-color: transparent"},0]}}});var pc=je({name:"hardBreak",schemaNodeName:"hardBreak",nodeSpec:{inline:true,group:"inline",selectable:false,parseDOM:[{tag:"br"}],toDOM(){return ["br"]}},onSchemaReady(e){let t=e.schema.nodes.hardBreak;return {keyboardShortcuts:{"Shift-Enter":(n,o)=>(o&&o(n.tr.replaceSelectionWith(t.create()).scrollIntoView()),true)}}}});var fc=je({name:"tab",schemaNodeName:"tab",nodeSpec:{inline:true,group:"inline",selectable:false,parseDOM:[{tag:"span.docx-tab"}],toDOM(){return ["span",{class:"docx-tab",style:"display: inline-block; min-width: 16px; white-space: pre;"}," "]}}});var mc=je({name:"image",schemaNodeName:"image",nodeSpec:{inline:true,group:"inline",draggable:true,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},rId:{default:null},wrapType:{default:"inline"},displayMode:{default:"inline"},cssFloat:{default:null},transform:{default:null},distTop:{default:null},distBottom:{default:null},distLeft:{default:null},distRight:{default:null},position:{default:null},borderWidth:{default:null},borderColor:{default:null},borderStyle:{default:null},wrapText:{default:null}},parseDOM:[{tag:"img[src]",getAttrs(e){let t=e;return {src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||void 0,title:t.getAttribute("title")||void 0,width:t.width||void 0,height:t.height||void 0,rId:t.dataset.rid||void 0,wrapType:t.dataset.wrapType||"inline",displayMode:t.dataset.displayMode||"inline",cssFloat:t.dataset.cssFloat||void 0,transform:t.dataset.transform||void 0,borderWidth:t.dataset.borderWidth?Number(t.dataset.borderWidth):void 0,borderColor:t.dataset.borderColor||void 0,borderStyle:t.dataset.borderStyle||void 0}}}],toDOM(e){let t=e.attrs,n={src:t.src,class:"docx-image"};t.alt&&(n.alt=t.alt),t.title&&(n.title=t.title),t.rId&&(n["data-rid"]=t.rId),t.wrapType&&(n["data-wrap-type"]=t.wrapType),t.displayMode&&(n["data-display-mode"]=t.displayMode),t.cssFloat&&(n["data-css-float"]=t.cssFloat),t.transform&&(n["data-transform"]=t.transform),t.borderWidth&&(n["data-border-width"]=String(t.borderWidth)),t.borderColor&&(n["data-border-color"]=t.borderColor),t.borderStyle&&(n["data-border-style"]=t.borderStyle);let o=[];if(t.width&&(n.width=String(t.width),o.push(`width: ${t.width}px`)),t.height&&(n.height=String(t.height),o.push(`height: ${t.height}px`)),o.push("max-width: 100%"),t.width&&t.height?o.push("object-fit: contain"):o.push("height: auto"),t.displayMode==="float"&&t.cssFloat&&t.cssFloat!=="none"){o.push(`float: ${t.cssFloat}`),n.class+=` docx-image-float docx-image-float-${t.cssFloat}`;let r=t.distTop??0,i=t.distBottom??0,a=t.distLeft??0,s=t.distRight??0;t.cssFloat==="left"?o.push(`margin: ${r}px ${s||12}px ${i}px ${a}px`):o.push(`margin: ${r}px ${s}px ${i}px ${a||12}px`);}else if(t.displayMode==="block"){o.push("display: block"),o.push("margin-left: auto"),o.push("margin-right: auto"),n.class+=" docx-image-block";let r=t.distTop??0,i=t.distBottom??0;r>0&&o.push(`margin-top: ${r}px`),i>0&&o.push(`margin-bottom: ${i}px`);}if(t.transform&&o.push(`transform: ${t.transform}`),t.borderWidth&&t.borderWidth>0){let r=t.borderStyle||"solid",i=t.borderColor||"#000000";o.push(`border: ${t.borderWidth}px ${r} ${i}`);}return n.style=o.join("; "),["img",n]}}});var gc=je({name:"textBox",schemaNodeName:"textBox",nodeSpec:{group:"block",content:"(paragraph | table)+",isolating:true,draggable:true,attrs:{width:{default:200},height:{default:null},textBoxId:{default:null},fillColor:{default:null},outlineWidth:{default:null},outlineColor:{default:null},outlineStyle:{default:null},marginTop:{default:4},marginBottom:{default:4},marginLeft:{default:7},marginRight:{default:7},verticalAlign:{default:null},displayMode:{default:"inline"},cssFloat:{default:null},wrapType:{default:"inline"}},parseDOM:[{tag:"div.docx-textbox",getAttrs(e){let t=e;return {width:t.dataset.width?Number(t.dataset.width):void 0,height:t.dataset.height?Number(t.dataset.height):void 0,textBoxId:t.dataset.textboxId||void 0,fillColor:t.dataset.fillColor||void 0,outlineWidth:t.dataset.outlineWidth?Number(t.dataset.outlineWidth):void 0,outlineColor:t.dataset.outlineColor||void 0,outlineStyle:t.dataset.outlineStyle||void 0,marginTop:t.dataset.marginTop?Number(t.dataset.marginTop):void 0,marginBottom:t.dataset.marginBottom?Number(t.dataset.marginBottom):void 0,marginLeft:t.dataset.marginLeft?Number(t.dataset.marginLeft):void 0,marginRight:t.dataset.marginRight?Number(t.dataset.marginRight):void 0,verticalAlign:t.dataset.verticalAlign||void 0,displayMode:t.dataset.displayMode||void 0,cssFloat:t.dataset.cssFloat||void 0,wrapType:t.dataset.wrapType||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-textbox"};t.width&&(n["data-width"]=String(t.width)),t.height&&(n["data-height"]=String(t.height)),t.textBoxId&&(n["data-textbox-id"]=t.textBoxId),t.fillColor&&(n["data-fill-color"]=t.fillColor),t.outlineWidth&&(n["data-outline-width"]=String(t.outlineWidth)),t.outlineColor&&(n["data-outline-color"]=t.outlineColor),t.outlineStyle&&(n["data-outline-style"]=t.outlineStyle),t.marginTop!=null&&(n["data-margin-top"]=String(t.marginTop)),t.marginBottom!=null&&(n["data-margin-bottom"]=String(t.marginBottom)),t.marginLeft!=null&&(n["data-margin-left"]=String(t.marginLeft)),t.marginRight!=null&&(n["data-margin-right"]=String(t.marginRight)),t.verticalAlign&&(n["data-vertical-align"]=t.verticalAlign),t.displayMode&&(n["data-display-mode"]=t.displayMode),t.cssFloat&&(n["data-css-float"]=t.cssFloat),t.wrapType&&(n["data-wrap-type"]=t.wrapType);let o=[];if(t.width&&o.push(`width: ${t.width}px`),t.height&&o.push(`min-height: ${t.height}px`),t.fillColor&&o.push(`background-color: ${t.fillColor}`),t.outlineWidth&&t.outlineWidth>0){let l=t.outlineStyle||"solid",u=t.outlineColor||"#000000";o.push(`border: ${t.outlineWidth}px ${l} ${u}`);}else o.push("border: 1px solid var(--doc-border, #d1d5db)");let r=t.marginTop??4,i=t.marginBottom??4,a=t.marginLeft??7,s=t.marginRight??7;return o.push(`padding: ${r}px ${s}px ${i}px ${a}px`),t.verticalAlign==="middle"||t.verticalAlign==="center"?(o.push("display: flex"),o.push("flex-direction: column"),o.push("justify-content: center")):t.verticalAlign==="bottom"&&(o.push("display: flex"),o.push("flex-direction: column"),o.push("justify-content: flex-end")),t.displayMode==="float"&&t.cssFloat&&t.cssFloat!=="none"?(o.push(`float: ${t.cssFloat}`),o.push("margin: 4px 8px")):t.displayMode==="block"&&(o.push("margin-left: auto"),o.push("margin-right: auto")),o.push("box-sizing: border-box"),o.push("overflow: hidden"),o.push("position: relative"),n.style=o.join("; "),["div",n,0]}}});function lf(e,t,n){switch(e){case "ellipse":case "oval":return `<ellipse cx="${t/2}" cy="${n/2}" rx="${t/2}" ry="${n/2}" />`;case "roundRect":return `<rect x="0" y="0" width="${t}" height="${n}" rx="${Math.min(t,n)*.1}" />`;case "triangle":case "isosTriangle":return `<polygon points="${t/2},0 ${t},${n} 0,${n}" />`;case "diamond":return `<polygon points="${t/2},0 ${t},${n/2} ${t/2},${n} 0,${n/2}" />`;case "line":case "straightConnector1":return `<line x1="0" y1="${n/2}" x2="${t}" y2="${n/2}" />`;default:return `<rect x="0" y="0" width="${t}" height="${n}" />`}}function cf(e,t){let n="";try{n=JSON.parse(t.gradientStops||"[]").map(c=>`<stop offset="${Math.round(c.position/1e3)}%" stop-color="${c.color}" />`).join("");}catch{return ""}let o=t.gradientType||"linear";if(o==="radial"||o==="rectangular"||o==="path")return `<radialGradient id="${e}" cx="50%" cy="50%" r="50%">${n}</radialGradient>`;let i=((t.gradientAngle||0)-90)*Math.PI/180,a=Math.round(50+50*Math.cos(i+Math.PI)),s=Math.round(50+50*Math.sin(i+Math.PI)),l=Math.round(50+50*Math.cos(i)),u=Math.round(50+50*Math.sin(i));return `<linearGradient id="${e}" x1="${a}%" y1="${s}%" x2="${l}%" y2="${u}%">${n}</linearGradient>`}var hc=je({name:"shape",schemaNodeName:"shape",nodeSpec:{inline:true,group:"inline",draggable:true,atom:true,attrs:{shapeType:{default:"rect"},shapeId:{default:null},width:{default:100},height:{default:80},fillColor:{default:null},fillType:{default:"solid"},gradientType:{default:null},gradientAngle:{default:null},gradientStops:{default:null},outlineWidth:{default:1},outlineColor:{default:"#000000"},outlineStyle:{default:"solid"},transform:{default:null},displayMode:{default:"inline"},cssFloat:{default:null},wrapType:{default:"inline"},shadowColor:{default:null},shadowBlur:{default:null},shadowOffsetX:{default:null},shadowOffsetY:{default:null},glowColor:{default:null},glowRadius:{default:null}},parseDOM:[{tag:"span.docx-shape",getAttrs(e){let t=e;return {shapeType:t.dataset.shapeType||"rect",shapeId:t.dataset.shapeId||void 0,width:t.dataset.width?Number(t.dataset.width):void 0,height:t.dataset.height?Number(t.dataset.height):void 0,fillColor:t.dataset.fillColor||void 0,fillType:t.dataset.fillType||"solid",gradientType:t.dataset.gradientType||void 0,gradientAngle:t.dataset.gradientAngle?Number(t.dataset.gradientAngle):void 0,gradientStops:t.dataset.gradientStops||void 0,outlineWidth:t.dataset.outlineWidth?Number(t.dataset.outlineWidth):void 0,outlineColor:t.dataset.outlineColor||void 0,outlineStyle:t.dataset.outlineStyle||void 0,transform:t.dataset.transform||void 0,displayMode:t.dataset.displayMode||void 0,cssFloat:t.dataset.cssFloat||void 0,wrapType:t.dataset.wrapType||void 0,shadowColor:t.dataset.shadowColor||void 0,shadowBlur:t.dataset.shadowBlur?Number(t.dataset.shadowBlur):void 0,shadowOffsetX:t.dataset.shadowOffsetX?Number(t.dataset.shadowOffsetX):void 0,shadowOffsetY:t.dataset.shadowOffsetY?Number(t.dataset.shadowOffsetY):void 0,glowColor:t.dataset.glowColor||void 0,glowRadius:t.dataset.glowRadius?Number(t.dataset.glowRadius):void 0}}}],toDOM(e){let t=e.attrs,n=t.width||100,o=t.height||80,r={class:"docx-shape","data-shape-type":t.shapeType||"rect"};t.shapeId&&(r["data-shape-id"]=t.shapeId),r["data-width"]=String(n),r["data-height"]=String(o),t.fillColor&&(r["data-fill-color"]=t.fillColor),t.fillType&&(r["data-fill-type"]=t.fillType),t.gradientType&&(r["data-gradient-type"]=t.gradientType),t.gradientAngle!=null&&(r["data-gradient-angle"]=String(t.gradientAngle)),t.gradientStops&&(r["data-gradient-stops"]=t.gradientStops),t.outlineWidth&&(r["data-outline-width"]=String(t.outlineWidth)),t.outlineColor&&(r["data-outline-color"]=t.outlineColor),t.outlineStyle&&(r["data-outline-style"]=t.outlineStyle),t.transform&&(r["data-transform"]=t.transform),t.displayMode&&(r["data-display-mode"]=t.displayMode),t.cssFloat&&(r["data-css-float"]=t.cssFloat),t.wrapType&&(r["data-wrap-type"]=t.wrapType),t.shadowColor&&(r["data-shadow-color"]=t.shadowColor),t.shadowBlur!=null&&(r["data-shadow-blur"]=String(t.shadowBlur)),t.shadowOffsetX!=null&&(r["data-shadow-offset-x"]=String(t.shadowOffsetX)),t.shadowOffsetY!=null&&(r["data-shadow-offset-y"]=String(t.shadowOffsetY)),t.glowColor&&(r["data-glow-color"]=t.glowColor),t.glowRadius!=null&&(r["data-glow-radius"]=String(t.glowRadius));let i=["display: inline-block",`width: ${n}px`,`height: ${o}px`,"vertical-align: middle","line-height: 0"];if(t.transform&&i.push(`transform: ${t.transform}`),t.displayMode==="float"&&t.cssFloat&&t.cssFloat!=="none"?(i.push(`float: ${t.cssFloat}`),i.push("margin: 4px 8px")):t.displayMode==="block"&&(i.push("display: block"),i.push("margin: 4px auto")),t.shadowColor){let m=t.shadowOffsetX||2,b=t.shadowOffsetY||2,g=t.shadowBlur||4;i.push(`filter: drop-shadow(${m}px ${b}px ${g}px ${t.shadowColor})`);}if(t.glowColor&&t.glowRadius){let m=i.find(g=>g.startsWith("filter:")),b=`drop-shadow(0 0 ${t.glowRadius}px ${t.glowColor})`;if(m){let g=i.indexOf(m);i[g]=m+" "+b;}else i.push(`filter: ${b}`);}r.style=i.join("; ");let a="",s;if(t.fillType==="gradient"&&t.gradientStops){let m=`grad-${t.shapeId||Math.random().toString(36).slice(2,8)}`;s=`url(#${m})`,a=cf(m,t);}else s=t.fillType==="none"?"none":t.fillColor||"#ffffff";let l=t.outlineWidth||1,u=t.outlineColor||"#000000",d=t.outlineStyle==="dashed"?' stroke-dasharray="8 4"':t.outlineStyle==="dotted"?' stroke-dasharray="2 2"':"",c=lf(t.shapeType||"rect",n,o),p=`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${o}" viewBox="0 0 ${n} ${o}" style="fill:${s};stroke:${u};stroke-width:${l}${d}">`+(a?`<defs>${a}</defs>`:"")+c+"</svg>",f=document.createElement("span");return Object.entries(r).forEach(([m,b])=>{f.setAttribute(m,b);}),f.innerHTML=p,{dom:f}}}});var bc=je({name:"horizontalRule",schemaNodeName:"horizontalRule",nodeSpec:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return ["hr"]}}});var yc=je({name:"pageBreak",schemaNodeName:"pageBreak",nodeSpec:{group:"block",atom:true,selectable:true,parseDOM:[{tag:"div.docx-page-break"}],toDOM(){return ["div",{class:"docx-page-break"}]}}});var xc=je({name:"field",schemaNodeName:"field",nodeSpec:{inline:true,group:"inline",atom:true,selectable:true,attrs:{fieldType:{default:"UNKNOWN"},instruction:{default:""},displayText:{default:""},fieldKind:{default:"simple"},fldLock:{default:false},dirty:{default:false}},parseDOM:[{tag:"span.docx-field",getAttrs(e){let t=e;return {fieldType:t.dataset.fieldType||"UNKNOWN",instruction:t.dataset.instruction||"",displayText:t.textContent||"",fieldKind:t.dataset.fieldKind||"simple",fldLock:t.dataset.fldLock==="true",dirty:t.dataset.dirty==="true"}}}],toDOM(e){let{fieldType:t,instruction:n,displayText:o,fieldKind:r,fldLock:i,dirty:a}=e.attrs,s=o||"";if(!s)switch(t){case "PAGE":s="{page}";break;case "NUMPAGES":s="{pages}";break;case "DATE":case "TIME":case "CREATEDATE":case "SAVEDATE":s=new Date().toLocaleDateString();break;case "MERGEFIELD":s=`\xAB${n.replace(/^MERGEFIELD\s+/i,"").replace(/\s*\\.*$/,"")}\xBB`;break;default:s=`{${t}}`;}return ["span",{class:`docx-field docx-field-${t.toLowerCase()}`,"data-field-type":t,"data-instruction":n,"data-field-kind":r,...i?{"data-fld-lock":"true"}:{},...a?{"data-dirty":"true"}:{},style:"outline: 1px solid rgba(200,200,200,0.4); padding: 0 1px; border-radius: 2px;"},s]}}});var Sc=je({name:"sdt",schemaNodeName:"sdt",nodeSpec:{inline:true,group:"inline",content:"inline*",attrs:{sdtType:{default:"richText"},alias:{default:null},tag:{default:null},lock:{default:null},placeholder:{default:null},showingPlaceholder:{default:false},dateFormat:{default:null},listItems:{default:null},checked:{default:null}},parseDOM:[{tag:"span.docx-sdt",getAttrs(e){let t=e;return {sdtType:t.dataset.sdtType||"richText",alias:t.dataset.alias||null,tag:t.dataset.tag||null,lock:t.dataset.lock||null,placeholder:t.dataset.placeholder||null,showingPlaceholder:t.dataset.showingPlaceholder==="true",dateFormat:t.dataset.dateFormat||null,listItems:t.dataset.listItems||null,checked:t.dataset.checked==="true"?true:t.dataset.checked==="false"?false:null}}}],toDOM(e){let t=e.attrs,n={class:`docx-sdt docx-sdt-${t.sdtType}`,"data-sdt-type":String(t.sdtType)};return t.alias&&(n["data-alias"]=String(t.alias)),t.tag&&(n["data-tag"]=String(t.tag)),t.lock&&(n["data-lock"]=String(t.lock)),t.placeholder&&(n["data-placeholder"]=String(t.placeholder)),t.showingPlaceholder&&(n["data-showing-placeholder"]="true"),t.dateFormat&&(n["data-date-format"]=String(t.dateFormat)),t.listItems&&(n["data-list-items"]=String(t.listItems)),t.checked!=null&&(n["data-checked"]=String(t.checked)),t.sdtType==="checkbox"?n.style="border: 1px solid #ccc; border-radius: 3px; padding: 0 2px; display: inline;":n.style="border-bottom: 1px dashed #999; padding: 0 1px; display: inline;",["span",n,0]}}});var kc=je({name:"math",schemaNodeName:"math",nodeSpec:{inline:true,group:"inline",atom:true,selectable:true,attrs:{display:{default:"inline"},ommlXml:{default:""},plainText:{default:""}},parseDOM:[{tag:"span.docx-math",getAttrs(e){let t=e;return {display:t.dataset.display||"inline",ommlXml:t.dataset.ommlXml||"",plainText:t.textContent||""}}}],toDOM(e){let{display:t,ommlXml:n,plainText:o}=e.attrs,r=o||"[equation]";return ["span",{class:`docx-math docx-math-${t}`,"data-display":t,"data-omml-xml":n,style:'font-style: italic; font-family: "Cambria Math", "Latin Modern Math", serif; background: rgba(200,200,255,0.1); padding: 0 2px; border-radius: 2px;'},r]}}});var yf={content:"tableRow+",group:"block",tableRole:"table",isolating:true,attrs:{styleId:{default:null},width:{default:null},widthType:{default:null},justification:{default:null},columnWidths:{default:null},floating:{default:null},cellMargins:{default:null},look:{default:null},_originalFormatting:{default:null}},parseDOM:[{tag:"table",getAttrs(e){let t=e;return {styleId:t.dataset.styleId||void 0,justification:t.dataset.justification}}}],toDOM(e){let t=e.attrs,n={class:"docx-table"};t.styleId&&(n["data-style-id"]=t.styleId);let o=["border-collapse: collapse"];if(t.width&&t.widthType==="pct")o.push(`width: ${t.width/50}%`),o.push("table-layout: fixed");else if(t.width&&t.widthType==="dxa"){let r=Math.round(t.width/20*1.333);o.push(`width: ${r}px`),o.push("table-layout: fixed");}else o.push("width: 100%"),o.push("table-layout: fixed");return t.justification==="center"?o.push("margin-left: auto","margin-right: auto"):t.justification==="right"&&o.push("margin-left: auto"),n.style=o.join("; "),["table",n,["tbody",0]]}},xf={content:"(tableCell | tableHeader)+",tableRole:"row",attrs:{height:{default:null},heightRule:{default:null},isHeader:{default:false},_originalFormatting:{default:null}},parseDOM:[{tag:"tr"}],toDOM(e){let t=e.attrs,n={};if(t.height){let o=Math.round(t.height/20*1.333);n.style=`height: ${o}px`;}return ["tr",n,0]}},Sf={single:"solid",double:"double",dotted:"dotted",dashed:"dashed",thick:"solid",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dotted",triple:"double",thinThickSmallGap:"double",thickThinSmallGap:"double",thinThickThinSmallGap:"double",thinThickMediumGap:"double",thickThinMediumGap:"double",thinThickThinMediumGap:"double",thinThickLargeGap:"double",thickThinLargeGap:"double",thinThickThinLargeGap:"double",wave:"solid",doubleWave:"double",dashDotStroked:"dashed",threeDEmboss:"ridge",threeDEngrave:"groove",outset:"outset",inset:"inset"};function Cc(e){let t=[],n=e.borders;if(!n)return t;let o=r=>{if(!r||!r.style||r.style==="none"||r.style==="nil")return "none";let i=r.size?Math.max(1,Math.round(r.size/8*1.333)):1,a=Sf[r.style]||"solid",s=r.color?.rgb?`#${r.color.rgb}`:"#000000";return `${i}px ${a} ${s}`};return t.push(`border-top: ${o(n.top)}`),t.push(`border-bottom: ${o(n.bottom)}`),t.push(`border-left: ${o(n.left)}`),t.push(`border-right: ${o(n.right)}`),t}function wc(e){let t=e.margins;if(!t){let s=Math.round(7.1982);return [`padding: ${s}px ${s}px`]}let n=s=>s?Math.round(s/20*1.333):0,o=n(t.top),r=n(t.right),i=n(t.bottom),a=n(t.left);return [`padding: ${o}px ${r}px ${i}px ${a}px`]}function Tc(e){if(!e)return [];let t=[];switch(e){case "tbRl":case "tbRlV":t.push("writing-mode: vertical-rl");break;case "btLr":t.push("writing-mode: vertical-lr","transform: rotate(180deg)");break;case "rl":case "rlV":t.push("direction: rtl");break;case "tb":case "tbV":t.push("writing-mode: vertical-lr");break}return t}function vc(e){let t=[];if(e.colwidth&&e.colwidth.length>0){let n=e.colwidth.reduce((o,r)=>o+r,0);t.push(`width: ${n}px`);}else if(e.width&&e.widthType==="pct")t.push(`width: ${e.width}%`);else if(e.width){let n=Math.round(e.width/20*1.333);t.push(`width: ${n}px`);}return t}var kf={content:"(paragraph | table)+",tableRole:"cell",isolating:true,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},margins:{default:null},textDirection:{default:null},noWrap:{default:false},_originalFormatting:{default:null}},parseDOM:[{tag:"td",getAttrs(e){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-cell"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=[];return o.push(...wc(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...vc(t)),o.push(...Cc(t)),o.push(...Tc(t.textDirection)),t.verticalAlign&&(n["data-valign"]=t.verticalAlign,o.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,o.push(`background-color: #${t.backgroundColor}`)),n.style=o.join("; "),["td",n,0]}},Cf={content:"(paragraph | table)+",tableRole:"header_cell",isolating:true,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},margins:{default:null},textDirection:{default:null},noWrap:{default:false},_originalFormatting:{default:null}},parseDOM:[{tag:"th",getAttrs(e){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-header"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=["font-weight: bold"];return o.push(...wc(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...vc(t)),o.push(...Cc(t)),o.push(...Tc(t.textDirection)),t.verticalAlign&&(n["data-valign"]=t.verticalAlign,o.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,o.push(`background-color: #${t.backgroundColor}`)),n.style=o.join("; "),["th",n,0]}};function _e(e){let{selection:t}=e,{$from:n}=t,o=t instanceof prosemirrorTables.CellSelection,r,i,a,s,l;for(let m=n.depth;m>0;m--){let b=n.node(m);if(b.type.name==="tableCell"||b.type.name==="tableHeader"){l=b;let g=n.node(m-1);if(g&&g.type.name==="tableRow"){let S=0,C=false;g.forEach((k,E,R)=>{C||(R===n.index(m-1)?(s=S,C=true):S+=k.attrs.colspan||1);});}}else if(b.type.name==="tableRow"){let g=n.node(m-1);g&&g.type.name==="table"&&(a=n.index(m-1));}else if(b.type.name==="table"){r=b,i=n.before(m);break}}if(!r)return {isInTable:false};let u=0,d=0;r.forEach(m=>{if(m.type.name==="tableRow"){u++;let b=0;m.forEach(g=>{b+=g.attrs.colspan||1;}),d=Math.max(d,b);}});let c=l&&((l.attrs.colspan||1)>1||(l.attrs.rowspan||1)>1),p,f;if(l){let m=l.attrs;m.backgroundColor&&typeof m.backgroundColor=="string"&&(f=m.backgroundColor);let b=m.borders;if(b)for(let g of ["top","right","bottom","left"]){let S=b[g];if(S?.color&&S.style&&S.style!=="none"&&S.style!=="nil"){p=S.color;break}}}return {isInTable:true,table:r,tablePos:i,rowIndex:a,columnIndex:s,rowCount:u,columnCount:d,hasMultiCellSelection:o,canSplitCell:!!c,cellBorderColor:p,cellBackgroundColor:f}}function Io(e){let{$from:t}=e.selection;for(let n=t.depth;n>0;n--){let o=t.node(n);if(o.type.name==="tableCell"||o.type.name==="tableHeader")return true}return false}function Rc(e){let{$from:t}=e.selection,n=-1,o=-1,r=-1;for(let i=t.depth;i>0;i--){let a=t.node(i);if(a.type.name==="tableCell"||a.type.name==="tableHeader")n=i;else if(a.type.name==="tableRow")o=i;else if(a.type.name==="table"){r=i;break}}return n===-1||o===-1||r===-1?null:{cellDepth:n,cellPos:t.before(n),rowDepth:o,tableDepth:r}}function Pc(){return (e,t)=>{if(!Io(e))return false;let n=Rc(e);if(!n)return false;let{$from:o}=e.selection,r=o.node(n.tableDepth),i=o.node(n.rowDepth),a=o.index(n.rowDepth),s=o.index(n.tableDepth);if(a<i.childCount-1){let l=n.cellPos+o.node(n.cellDepth).nodeSize;if(t){let u=l+1+1,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(u)));t(d.scrollIntoView());}return true}if(s<r.childCount-1){let u=o.before(n.rowDepth)+i.nodeSize;if(t){let d=u+1+1+1,c=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d)));t(c.scrollIntoView());}return true}return false}}function Mc(){return (e,t)=>{if(!Io(e))return false;let n=Rc(e);if(!n)return false;let{$from:o}=e.selection,r=o.node(n.tableDepth),i=o.index(n.rowDepth),a=o.index(n.tableDepth);if(i>0){let l=o.node(n.rowDepth).child(i-1),u=n.cellPos-l.nodeSize;if(t){let d=u+l.nodeSize-2,c=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d),-1));t(c.scrollIntoView());}return true}if(a>0){let s=r.child(a-1),u=o.before(n.rowDepth)-s.nodeSize;if(t){let c=u+s.nodeSize-1-1,p=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(c),-1));t(p.scrollIntoView());}return true}return false}}var wf=je({name:"table",schemaNodeName:"table",nodeSpec:yf}),Tf=je({name:"tableRow",schemaNodeName:"tableRow",nodeSpec:xf}),vf=je({name:"tableCell",schemaNodeName:"tableCell",nodeSpec:kf}),Rf=je({name:"tableHeader",schemaNodeName:"tableHeader",nodeSpec:Cf}),Pf=Ct({name:"tablePlugin",onSchemaReady(e){let{schema:t}=e;function n(...P){return (I,y,M)=>{for(let F of P)if(F(I,y,M))return true;return false}}function o(P,I={}){let y=P?.attrs??{};return {colspan:y.colspan||1,rowspan:1,colwidth:y.colwidth,width:y.width,widthType:y.widthType,verticalAlign:y.verticalAlign,backgroundColor:y.backgroundColor,borders:y.borders,margins:y.margins,textDirection:y.textDirection,noWrap:y.noWrap,...I}}function r(P,I,y="000000",M=9360){let F=[],A=Math.floor(M/I),U=360,Q="atLeast",N={style:"single",size:4,color:{rgb:y}},j={top:N,bottom:N,left:N,right:N};for(let xe=0;xe<P;xe++){let v=[];for(let z=0;z<I;z++){let D=t.nodes.paragraph.create(),se={colspan:1,rowspan:1,borders:j,width:A,widthType:"dxa"};v.push(t.nodes.tableCell.create(se,D));}F.push(t.nodes.tableRow.create({height:U,heightRule:Q},v));}let G=Array(I).fill(A);return t.nodes.table.create({columnWidths:G,width:M,widthType:"dxa"},F)}function i(P,I){return (y,M)=>{let{$from:F}=y.selection,A="000000",U=y.storedMarks||F.marks();for(let N of U)if(N.type.name==="textColor"&&N.attrs.rgb){A=N.attrs.rgb;break}let Q=F.pos;for(let N=F.depth;N>0;N--){let j=F.node(N);if(j.type.name==="paragraph"||j.type.name==="table"){Q=F.after(N);break}}if(M){let N=9360;for(let Ee=F.depth;Ee>0;Ee--){let ge=F.node(Ee);if(ge.type.name==="tableCell"||ge.type.name==="tableHeader"){let Se=ge.attrs.width;Se&&Se>0&&(N=Math.max(Se-216,360));break}}let j=r(P,I,A,N),G=t.nodes.paragraph.create(),v=y.doc.resolve(Q).nodeBefore?.type.name==="table",z=v?[G,j,G]:[j,G],D=y.tr.insert(Q,z),se=Q+1;v&&(se+=G.nodeSize);let pe=se+1+1;D.setSelection(prosemirrorState.TextSelection.create(D.doc,pe)),M(D.scrollIntoView());}return true}}function a(P,I){let y=_e(P);if(!y.isInTable||y.rowIndex===void 0||!y.table||y.tablePos===void 0)return false;if(I){let M=P.tr,F=y.table.child(y.rowIndex),A=[];F.forEach(N=>{let j=t.nodes.paragraph.create(),G=o(N);A.push(t.nodes.tableCell.create(G,j));});let U=t.nodes.tableRow.create({height:F.attrs.height??360,heightRule:F.attrs.heightRule??"atLeast"},A),Q=y.tablePos+1;for(let N=0;N<y.rowIndex;N++)Q+=y.table.child(N).nodeSize;M.insert(Q,U),I(M.scrollIntoView());}return true}function s(P,I){let y=_e(P);if(!y.isInTable||y.rowIndex===void 0||!y.table||y.tablePos===void 0)return false;if(I){let M=P.tr,F=y.table.child(y.rowIndex),A=[];F.forEach(N=>{let j=t.nodes.paragraph.create(),G=o(N);A.push(t.nodes.tableCell.create(G,j));});let U=t.nodes.tableRow.create({height:F.attrs.height??360,heightRule:F.attrs.heightRule??"atLeast"},A),Q=y.tablePos+1;for(let N=0;N<=y.rowIndex;N++)Q+=y.table.child(N).nodeSize;M.insert(Q,U),I(M.scrollIntoView());}return true}function l(P,I){let y=_e(P);if(!y.isInTable||y.rowIndex===void 0||!y.table||y.tablePos===void 0||(y.rowCount||0)<=1)return false;if(I){let M=P.tr,F=y.tablePos+1;for(let U=0;U<y.rowIndex;U++)F+=y.table.child(U).nodeSize;let A=F+y.table.child(y.rowIndex).nodeSize;M.delete(F,A),I(M.scrollIntoView());}return true}function u(P,I){let y=_e(P);if(!y.isInTable||y.columnIndex===void 0||!y.table||y.tablePos===void 0)return false;if(I){let M=P.tr,F=(y.columnCount||1)+1,A=Math.floor(100/F),U=y.tablePos+1,Q=0;y.table.forEach(j=>{if(j.type.name==="tableRow"){let G=U+1,xe=0;if(j.forEach(v=>{if(xe===y.columnIndex){let z=t.nodes.paragraph.create(),D=o(v,{colspan:1,rowspan:1});Q===0&&(D.width=A,D.widthType="pct");let se=t.nodes.tableCell.create(D,z);M=M.insert(G,se);}G+=v.nodeSize,xe+=v.attrs.colspan||1;}),xe<=y.columnIndex){let v=t.nodes.paragraph.create(),z=o(j.child(j.childCount-1)??null,{colspan:1,rowspan:1});Q===0&&(z.width=A,z.widthType="pct");let D=t.nodes.tableCell.create(z,v);M=M.insert(G,D);}Q++;}U+=j.nodeSize;});let N=M.doc.nodeAt(y.tablePos);if(N&&N.type.name==="table"){let j=N.child(0);if(j&&j.type.name==="tableRow"){let z=y.tablePos+2;j.forEach(D=>{(D.type.name==="tableCell"||D.type.name==="tableHeader")&&(M=M.setNodeMarkup(z,void 0,{...D.attrs,width:A,widthType:"pct"})),z+=D.nodeSize;});}let G=j?.childCount??F,xe=N.attrs.width||9360,v=Math.floor(xe/Math.max(1,G));M=M.setNodeMarkup(y.tablePos,void 0,{...N.attrs,columnWidths:Array(G).fill(v)});}I(M.scrollIntoView());}return true}function d(P,I){let y=_e(P);if(!y.isInTable||y.columnIndex===void 0||!y.table||y.tablePos===void 0)return false;if(I){let M=P.tr,F=(y.columnCount||1)+1,A=Math.floor(100/F),U=y.tablePos+1,Q=0;y.table.forEach(j=>{if(j.type.name==="tableRow"){let G=U+1,xe=0,v=false;if(j.forEach(z=>{if(G+=z.nodeSize,xe+=z.attrs.colspan||1,!v&&xe>y.columnIndex){let D=t.nodes.paragraph.create(),se=o(z,{colspan:1,rowspan:1});Q===0&&(se.width=A,se.widthType="pct");let ue=t.nodes.tableCell.create(se,D);M=M.insert(G,ue),v=true;}}),!v){let z=t.nodes.paragraph.create(),D=o(j.child(j.childCount-1)??null,{colspan:1,rowspan:1});Q===0&&(D.width=A,D.widthType="pct");let se=t.nodes.tableCell.create(D,z);M=M.insert(G,se);}Q++;}U+=j.nodeSize;});let N=M.doc.nodeAt(y.tablePos);if(N&&N.type.name==="table"){let j=N.child(0);if(j&&j.type.name==="tableRow"){let z=y.tablePos+2;j.forEach(D=>{(D.type.name==="tableCell"||D.type.name==="tableHeader")&&(M=M.setNodeMarkup(z,void 0,{...D.attrs,width:A,widthType:"pct"})),z+=D.nodeSize;});}let G=j?.childCount??F,xe=N.attrs.width||9360,v=Math.floor(xe/Math.max(1,G));M=M.setNodeMarkup(y.tablePos,void 0,{...N.attrs,columnWidths:Array(G).fill(v)});}I(M.scrollIntoView());}return true}function c(P,I){let y=_e(P);if(!y.isInTable||y.columnIndex===void 0||!y.table||y.tablePos===void 0||(y.columnCount||0)<=1)return false;if(I){let M=P.tr,F=(y.columnCount||2)-1,A=Math.floor(100/F),U=[],Q=y.tablePos+1;y.table.forEach(j=>{if(j.type.name==="tableRow"){let G=Q+1,xe=0;j.forEach(v=>{let z=G,D=G+v.nodeSize,se=v.attrs.colspan||1;xe<=y.columnIndex&&y.columnIndex<xe+se&&U.push({start:z,end:D}),G=D,xe+=se;});}Q+=j.nodeSize;}),U.reverse().forEach(({start:j,end:G})=>{M=M.delete(j,G);});let N=M.doc.nodeAt(y.tablePos);if(N&&N.type.name==="table"){let j=N.child(0);if(j&&j.type.name==="tableRow"){let z=y.tablePos+2;j.forEach(D=>{(D.type.name==="tableCell"||D.type.name==="tableHeader")&&(M=M.setNodeMarkup(z,void 0,{...D.attrs,width:A,widthType:"pct"})),z+=D.nodeSize;});}let G=j?.childCount??F,xe=N.attrs.width||9360,v=Math.floor(xe/Math.max(1,G));M=M.setNodeMarkup(y.tablePos,void 0,{...N.attrs,columnWidths:Array(G).fill(v)});}I(M.scrollIntoView());}return true}function p(P,I){let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table)return false;if(I){let M=P.tr;M.delete(y.tablePos,y.tablePos+y.table.nodeSize),I(M.scrollIntoView());}return true}function f(P,I){let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table)return false;if(I){let M=y.tablePos+1,F=P.doc.resolve(M),A=P.doc.resolve(y.tablePos+y.table.nodeSize-2),U=prosemirrorTables.CellSelection.create(P.doc,F.pos,A.pos);I(P.tr.setSelection(U));}return true}function m(P,I){let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table||y.rowIndex===void 0)return false;if(I){let F=y.tablePos+1;for(let j=0;j<y.rowIndex;j++){let G=y.table.child(j);F+=G.nodeSize;}let A=y.table.child(y.rowIndex),U=F+1,Q=F+A.nodeSize-2,N=prosemirrorTables.CellSelection.create(P.doc,U,Q);I(P.tr.setSelection(N));}return true}function b(P,I){let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table||y.columnIndex===void 0)return false;if(I){let M=y.tablePos+1,F=y.table.child(0),A=y.table.child(y.table.childCount-1),U=M+1;for(let G=0;G<y.columnIndex&&G<F.childCount;G++)U+=F.child(G).nodeSize;let Q=M;for(let G=0;G<y.table.childCount-1;G++)Q+=y.table.child(G).nodeSize;let N=Q+1;for(let G=0;G<y.columnIndex&&G<A.childCount;G++)N+=A.child(G).nodeSize;let j=prosemirrorTables.CellSelection.create(P.doc,U,N);I(P.tr.setSelection(j));}return true}function g(P){let I=P.selection,y=[];if(I instanceof prosemirrorTables.CellSelection)return I.forEachCell((F,A)=>{y.push({pos:A,node:F});}),y;let{$from:M}=I;for(let F=M.depth;F>0;F--){let A=M.node(F);if(A.type.name==="tableCell"||A.type.name==="tableHeader"){y.push({pos:M.before(F),node:A});break}}return y}function S(P,I){let y=new Map,M=new Map,F=P.childCount,A=0;return P.forEach((U,Q,N)=>{if(U.type.name!=="tableRow")return;let j=0;U.forEach((G,xe)=>{let v=I+Q+xe+2,z=G.attrs.colspan||1;y.set(v,{rowIdx:N,colIdx:j,colspan:z,pos:v,node:G}),M.set(`${N},${j}`,v),j+=z;}),A=Math.max(A,j);}),{cellByPos:y,cellByRC:M,totalRows:F,totalCols:A}}function C(P,I){return (y,M)=>{let F=_e(y);if(!F.isInTable||F.tablePos===void 0||!F.table)return false;if(M){let A=y.tr,U=F.table,Q=F.tablePos,N=I??{style:"single",size:4,color:{rgb:"000000"}},j={style:"none"},{cellByPos:G,cellByRC:xe}=S(U,Q),v=g(y),z=1/0,D=-1,se=1/0,ue=-1;for(let{pos:Se}of v){let fe=G.get(Se);fe&&(z=Math.min(z,fe.rowIdx),D=Math.max(D,fe.rowIdx),se=Math.min(se,fe.colIdx),ue=Math.max(ue,fe.colIdx+fe.colspan-1));}let pe=new Map,Ee=(Se,fe)=>pe.get(Se)??{...fe.attrs},ge=(Se,fe)=>{pe.set(Se,fe);};for(let{pos:Se}of v){let fe=G.get(Se);if(!fe)continue;let $e=fe.rowIdx===z,Qe=fe.rowIdx===D,Ge=fe.colIdx===se,tt=fe.colIdx+fe.colspan-1===ue,We;switch(P){case "all":We={top:N,bottom:N,left:N,right:N};break;case "outside":We={top:$e?N:j,bottom:Qe?N:j,left:Ge?N:j,right:tt?N:j};break;case "inside":We={top:$e?j:N,bottom:Qe?j:N,left:Ge?j:N,right:tt?j:N};break;case "none":We={top:j,bottom:j,left:j,right:j};break}let Je=Ee(Se,fe.node),it=Je.borders||{};if(ge(Se,{...Je,borders:{...it,...We}}),We.top){let Oe=xe.get(`${fe.rowIdx-1},${fe.colIdx}`);if(Oe!==void 0){let ct=G.get(Oe),De=Ee(Oe,ct.node),Pt=De.borders||{};ge(Oe,{...De,borders:{...Pt,bottom:We.top}});}}if(We.bottom){let Oe=xe.get(`${fe.rowIdx+1},${fe.colIdx}`);if(Oe!==void 0){let ct=G.get(Oe),De=Ee(Oe,ct.node),Pt=De.borders||{};ge(Oe,{...De,borders:{...Pt,top:We.bottom}});}}if(We.left){let Oe=xe.get(`${fe.rowIdx},${fe.colIdx-1}`);if(Oe!==void 0){let ct=G.get(Oe),De=Ee(Oe,ct.node),Pt=De.borders||{};ge(Oe,{...De,borders:{...Pt,right:We.left}});}}if(We.right){let Oe=xe.get(`${fe.rowIdx},${fe.colIdx+fe.colspan}`);if(Oe!==void 0){let ct=G.get(Oe),De=Ee(Oe,ct.node),Pt=De.borders||{};ge(Oe,{...De,borders:{...Pt,left:We.right}});}}}for(let[Se,fe]of pe)A.setNodeMarkup(A.mapping.map(Se),void 0,fe);M(A.scrollIntoView());}return true}}function k(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A=g(I),U=P?P.replace(/^#/,""):null;for(let{pos:Q,node:N}of A)F.setNodeMarkup(F.mapping.map(Q),void 0,{...N.attrs,backgroundColor:U});y(F.scrollIntoView());}return true}}function E(P,I,y){return (M,F)=>{let A=_e(M);if(!A.isInTable||A.tablePos===void 0||!A.table)return false;if(F){let U=M.tr,Q=g(M),N=I||{style:"none"},j={style:"none"},G=["top","bottom","left","right"],{cellByPos:xe,cellByRC:v}=S(A.table,A.tablePos),z=new Map,D=(pe,Ee)=>z.get(pe)??{...Ee.attrs},se=(pe,Ee)=>z.set(pe,Ee),ue={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:pe,node:Ee}of Q){let ge=xe.get(pe),Se=D(pe,Ee),fe=Se.borders||{},$e=P==="all"?G:[P],Qe=y?{top:j,bottom:j,left:j,right:j}:{...fe};for(let Ge of $e)Qe[Ge]=N;if(ge){let Ge=y?G:$e;for(let tt of Ge){let We=Qe[tt],Je=ue[tt],it=tt==="right"?ge.colIdx+ge.colspan:ge.colIdx+Je.dCol,Oe=v.get(`${ge.rowIdx+Je.dRow},${it}`);if(Oe!==void 0){let ct=xe.get(Oe),De=D(Oe,ct.node),Pt=De.borders||{};se(Oe,{...De,borders:{...Pt,[Je.adjSide]:We}});}}}se(pe,{...Se,borders:Qe});}for(let[pe,Ee]of z)U.setNodeMarkup(U.mapping.map(pe),void 0,Ee);F(U.scrollIntoView());}return true}}function R(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A=g(I);for(let{pos:U,node:Q}of A)F.setNodeMarkup(F.mapping.map(U),void 0,{...Q.attrs,verticalAlign:P});y(F.scrollIntoView());}return true}}function _(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A=g(I);for(let{pos:U,node:Q}of A){let j={...Q.attrs.margins||{},...P};F.setNodeMarkup(F.mapping.map(U),void 0,{...Q.attrs,margins:j});}y(F.scrollIntoView());}return true}}function V(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A=g(I);for(let{pos:U,node:Q}of A)F.setNodeMarkup(F.mapping.map(U),void 0,{...Q.attrs,textDirection:P});y(F.scrollIntoView());}return true}}function $(){return (P,I)=>{let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table)return false;if(I){let M=P.tr,F=g(P);for(let{pos:A,node:U}of F)M.setNodeMarkup(M.mapping.map(A),void 0,{...U.attrs,noWrap:!U.attrs.noWrap});I(M.scrollIntoView());}return true}}function L(P,I){return (y,M)=>{let F=_e(y);if(!F.isInTable||F.tablePos===void 0||!F.table)return false;if(M){let A=y.tr,{$from:U}=y.selection;for(let Q=U.depth;Q>0;Q--){let N=U.node(Q);if(N.type.name==="tableRow"){let j=U.before(Q),G={...N.attrs,height:P,heightRule:P?I||"atLeast":null};return A.setNodeMarkup(j,void 0,G),M(A.scrollIntoView()),true}}}return true}}function W(){return (P,I)=>{let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table||!y.columnCount)return false;if(I){let M=P.tr,F=y.table,A=y.columnCount,U=F.attrs.columnWidths,Q=U?U.reduce((xe,v)=>xe+v,0):9360,N=Math.floor(Q/A),j=y.tablePos+1;F.forEach(xe=>{if(xe.type.name==="tableRow"){let v=j+1;xe.forEach(z=>{(z.type.name==="tableCell"||z.type.name==="tableHeader")&&(M=M.setNodeMarkup(v,void 0,{...z.attrs,width:N,widthType:"dxa",colwidth:null})),v+=z.nodeSize;});}j+=xe.nodeSize;});let G=Array(A).fill(N);M=M.setNodeMarkup(y.tablePos,void 0,{...F.attrs,columnWidths:G}),I(M.scrollIntoView());}return true}}function O(){return (P,I)=>{let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table)return false;if(I){let M=P.tr,F=y.table,A=y.tablePos+1;F.forEach(U=>{if(U.type.name==="tableRow"){let Q=A+1;U.forEach(N=>{(N.type.name==="tableCell"||N.type.name==="tableHeader")&&(M=M.setNodeMarkup(Q,void 0,{...N.attrs,width:null,widthType:null,colwidth:null})),Q+=N.nodeSize;});}A+=U.nodeSize;}),M=M.setNodeMarkup(y.tablePos,void 0,{...F.attrs,columnWidths:null,width:null,widthType:"auto"}),I(M.scrollIntoView());}return true}}function K(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A=M.table,U=M.tablePos,Q=A.childCount,N=P.look??{firstRow:true,lastRow:false,noHBand:false},j=P.conditionals??{},G=P.tableBorders;F=F.setNodeMarkup(U,void 0,{...A.attrs,styleId:P.styleId});let xe=0,v=U+1;for(let z=0;z<Q;z++){let D=A.child(z),se=z===0&&!!N.firstRow,ue=z===Q-1&&!!N.lastRow,pe=N.noHBand!==true,Ee=D.childCount,ge;se?ge="firstRow":ue?ge="lastRow":(pe&&(ge=xe%2===0?"band1Horz":"band2Horz"),xe++);let Se=v+1;for(let fe=0;fe<Ee;fe++){let $e=D.child(fe),Qe=F.mapping.map(Se),Ge=ge,tt=fe===0&&!!N.firstCol,We=fe===Ee-1&&!!N.lastCol;se&&tt&&j.nwCell?Ge="nwCell":se&&We&&j.neCell?Ge="neCell":ue&&tt&&j.swCell?Ge="swCell":ue&&We&&j.seCell?Ge="seCell":tt?Ge="firstCol":We&&(Ge="lastCol");let Je=Ge?j[Ge]:void 0,it={...$e.attrs};Je?.backgroundColor?it.backgroundColor=Je.backgroundColor:it.backgroundColor=null;let Oe={},ct=["top","bottom","left","right"];for(let De of ct)Je?.borders&&Je.borders[De]!==void 0?Oe[De]=Je.borders[De]:G&&(De==="top"&&z>0||De==="bottom"&&z<Q-1?Oe[De]=G.insideH??G[De]:De==="left"&&fe>0||De==="right"&&fe<Ee-1?Oe[De]=G.insideV??G[De]:Oe[De]=G[De]);Object.keys(Oe).length>0?it.borders=Oe:it.borders=null,F=F.setNodeMarkup(Qe,void 0,it),Se+=$e.nodeSize;}v+=D.nodeSize;}y(F.scrollIntoView());}return true}}function w(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A={...M.table.attrs};"width"in P&&(A.width=P.width),"widthType"in P&&(A.widthType=P.widthType),"justification"in P&&(A.justification=P.justification),F.setNodeMarkup(M.tablePos,void 0,A),y(F.scrollIntoView());}return true}}function B(){return (P,I)=>{let y=_e(P);if(!y.isInTable||y.tablePos===void 0||!y.table)return false;if(I){let M=P.tr,{$from:F}=P.selection;for(let A=F.depth;A>0;A--){let U=F.node(A);if(U.type.name==="tableRow"){let Q=F.before(A),N={...U.attrs,isHeader:!U.attrs.isHeader};return M.setNodeMarkup(Q,void 0,N),I(M.scrollIntoView()),true}}}return true}}function te(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A=g(I),U=P.replace(/^#/,""),Q={style:"single",size:4},{cellByPos:N,cellByRC:j}=S(M.table,M.tablePos),G=new Map,xe=(D,se)=>G.get(D)??{...se.attrs},v=(D,se)=>G.set(D,se),z={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:D,node:se}of A){let ue=N.get(D),pe=xe(D,se),Ee=pe.borders||{},ge={};for(let Se of ["top","bottom","left","right"]){let fe={...Q,...Ee[Se],color:{rgb:U}};if(ge[Se]=fe,ue){let $e=z[Se],Qe=Se==="right"?ue.colIdx+ue.colspan:ue.colIdx+$e.dCol,Ge=j.get(`${ue.rowIdx+$e.dRow},${Qe}`);if(Ge!==void 0){let tt=N.get(Ge),We=xe(Ge,tt.node),Je=We.borders||{};v(Ge,{...We,borders:{...Je,[$e.adjSide]:fe}});}}}v(D,{...pe,borders:{...Ee,...ge}});}for(let[D,se]of G)F.setNodeMarkup(F.mapping.map(D),void 0,se);y(F.scrollIntoView());}return true}}function he(P){return (I,y)=>{let M=_e(I);if(!M.isInTable||M.tablePos===void 0||!M.table)return false;if(y){let F=I.tr,A=g(I),U={style:"single",color:{rgb:"000000"}},{cellByPos:Q,cellByRC:N}=S(M.table,M.tablePos),j=new Map,G=(z,D)=>j.get(z)??{...D.attrs},xe=(z,D)=>j.set(z,D),v={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:z,node:D}of A){let se=Q.get(z),ue=G(z,D),pe=ue.borders||{},Ee={};for(let ge of ["top","bottom","left","right"]){let Se={...U,...pe[ge],size:P};if(Ee[ge]=Se,se){let fe=v[ge],$e=ge==="right"?se.colIdx+se.colspan:se.colIdx+fe.dCol,Qe=N.get(`${se.rowIdx+fe.dRow},${$e}`);if(Qe!==void 0){let Ge=Q.get(Qe),tt=G(Qe,Ge.node),We=tt.borders||{};xe(Qe,{...tt,borders:{...We,[fe.adjSide]:Se}});}}}xe(z,{...ue,borders:{...pe,...Ee}});}for(let[z,D]of j)F.setNodeMarkup(F.mapping.map(z),void 0,D);y(F.scrollIntoView());}return true}}function me(){return (P,I)=>{let y=P.selection;if(!("$anchorCell"in y&&typeof y.forEachCell=="function"))return false;let F=_e(P);if(!F.isInTable||F.tablePos===void 0||!F.table)return false;let A=0;F.table.descendants(N=>{(N.type.name==="tableCell"||N.type.name==="tableHeader")&&(A+=1);});let U=0;if(y.forEachCell(()=>{U+=1;}),!(A>0&&U>=A))return false;if(I){let N=P.tr.delete(F.tablePos,F.tablePos+F.table.nodeSize);I(N.scrollIntoView());}return true}}function Ie(){return P=>{let{$from:I,empty:y}=P.selection;if(!y)return false;let M=I.parent;if(M.type.name!=="paragraph"||M.textContent.length>0)return false;let F=I.depth;if(F<1)return false;let A=I.node(F-1),U=I.index(F-1),Q=U>0?A.child(U-1):null,N=U+1<A.childCount?A.child(U+1):null,j=Q?.type.name==="table",G=N?.type.name==="table";return !!(j||G)}}let Te=new prosemirrorState.PluginKey("activeCell"),Re=new prosemirrorState.Plugin({key:Te,props:{decorations(P){let{selection:I}=P;if(I instanceof prosemirrorTables.CellSelection)return prosemirrorView.DecorationSet.empty;let{$from:y}=I;for(let M=y.depth;M>0;M--){let F=y.node(M);if(F.type.name==="tableCell"||F.type.name==="tableHeader"){let A=y.before(M);return prosemirrorView.DecorationSet.create(P.doc,[prosemirrorView.Decoration.node(A,A+F.nodeSize,{class:"activeCell"})])}}return prosemirrorView.DecorationSet.empty}}});return {plugins:[prosemirrorTables.columnResizing({handleWidth:5,cellMinWidth:25,lastColumnResizable:true}),prosemirrorTables.tableEditing(),Re],keyboardShortcuts:{Backspace:n(me(),Ie()),Delete:n(me(),Ie())},commands:{insertTable:(P,I)=>i(P,I),addRowAbove:()=>a,addRowBelow:()=>s,deleteRow:()=>l,addColumnLeft:()=>u,addColumnRight:()=>d,deleteColumn:()=>c,deleteTable:()=>p,selectTable:()=>f,selectRow:()=>m,selectColumn:()=>b,mergeCells:()=>prosemirrorTables.mergeCells,splitCell:()=>prosemirrorTables.splitCell,setCellBorder:(P,I,y)=>E(P,I,y),setTableBorders:(P,I)=>C(P,I),setCellVerticalAlign:P=>R(P),setCellMargins:P=>_(P),setCellTextDirection:P=>V(P),toggleNoWrap:()=>$(),setRowHeight:(P,I)=>L(P,I),toggleHeaderRow:()=>B(),distributeColumns:()=>W(),autoFitContents:()=>O(),setTableProperties:P=>w(P),applyTableStyle:P=>K(P),setCellFillColor:P=>k(P),setTableBorderColor:P=>te(P),setTableBorderWidth:P=>he(P),removeTableBorders:()=>C("none"),setAllTableBorders:P=>C("all",P),setOutsideTableBorders:P=>C("outside",P),setInsideTableBorders:P=>C("inside",P)}}}});function Ec(){return [wf(),Tf(),vf(),Rf(),Pf()]}function Ba(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}function Ic(e){return (t,n)=>{let{$from:o,$to:r}=t.selection,i=o.parent;if(i.type.name!=="paragraph")return false;let s=i.attrs.numPr?.numId===e;if(!n)return true;let l=t.tr,u=new Set;return t.doc.nodesBetween(o.pos,r.pos,(d,c)=>{if(d.type.name==="paragraph"&&!u.has(c))if(u.add(c),s)l=l.setNodeMarkup(c,void 0,{...d.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});else {let p=e===1;l=l.setNodeMarkup(c,void 0,{...d.attrs,numPr:{numId:e,ilvl:d.attrs.numPr?.ilvl||0},listIsBullet:p,listNumFmt:p?null:"decimal",listMarker:null});}}),n(l.scrollIntoView()),true}}var Mf=(e,t)=>Ic(1)(e,t),Ef=(e,t)=>Ic(2)(e,t),If=(e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return false;let r=o.attrs.numPr.ilvl||0;if(r>=8)return false;if(!t)return true;let i=n.before(n.depth);return t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r+1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),true},Ff=(e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return false;let r=o.attrs.numPr.ilvl||0;if(!t)return true;let i=n.before(n.depth);return r<=0?t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()):t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r-1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),true},Lf=(e,t)=>{let{$from:n,$to:o}=e.selection;if(!t)return true;let r=e.tr,i=new Set;return e.doc.nodesBetween(n.pos,o.pos,(a,s)=>{a.type.name==="paragraph"&&a.attrs.numPr&&!i.has(s)&&(i.add(s),r=r.setNodeMarkup(s,void 0,{...a.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null}));}),t(r.scrollIntoView()),true};function Bf(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr||r.textContent.length>0)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...r.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});t(a);}return true}}function Af(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return false;if(t){let{tr:a}=e,s=n.pos;a.split(s,1,[{type:e.schema.nodes.paragraph,attrs:{...r.attrs}}]),t(a.scrollIntoView());}return true}}function Df(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o||n.parentOffset!==0)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...r.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});t(a);}return true}}function Hf(){return (e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph")return false;let r=o.attrs.numPr;if(!r)return false;let i=r.ilvl??0;if(i>=8)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:{...r,ilvl:i+1},indentLeft:null,indentFirstLine:null,hangingIndent:null});t(a);}return true}}function Nf(){return (e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph")return false;let r=o.attrs.numPr;if(!r)return false;let i=r.ilvl??0;if(i<=0){if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null});t(a);}return true}if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:{...r,ilvl:i-1},indentLeft:null,indentFirstLine:null,hangingIndent:null});t(a);}return true}}function zf(){return (e,t)=>{let{schema:n}=e,o=n.nodes.tab;if(!o)return false;if(t){let r=e.tr.replaceSelectionWith(o.create());t(r.scrollIntoView());}return true}}var Fc=Ct({name:"list",priority:xn.High,onSchemaReady(){return {commands:{toggleBulletList:()=>Mf,toggleNumberedList:()=>Ef,increaseListLevel:()=>If,decreaseListLevel:()=>Ff,removeList:()=>Lf},keyboardShortcuts:{Tab:Ba(Pc(),Hf(),zf()),"Shift-Tab":Ba(Mc(),Nf()),"Shift-Enter":()=>false,Enter:Ba(Bf(),Af()),Backspace:Df()}}}});function Bc(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}var Uf=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parentOffset!==0||n.parent.type.name!=="paragraph")return false;let o=n.parent.attrs,r=o.indentFirstLine!=null&&o.indentFirstLine>0,i=!!o.hangingIndent,a=o.indentLeft!=null&&o.indentLeft>0;if(!r&&!i&&!a)return false;if(t){let s=n.before(),l=e.tr.setNodeMarkup(s,void 0,{...o,indentFirstLine:null,hangingIndent:null,indentLeft:null});t(l.scrollIntoView());}return true},Gf=["defaultTextFormatting","styleId","lineSpacing","lineSpacingRule","spaceAfter","spaceBefore","contextualSpacing"],Ac=new Set(["fontFamily","fontSize","textColor"]),Kf=(e,t,n)=>{let{$from:o}=e.selection,r=o.parent.type.name==="paragraph"?o.parent:null,a=(e.storedMarks||o.marks()).filter(u=>Ac.has(u.type.name)),s=null;if(!prosemirrorCommands.splitBlock(e,t?u=>{s=u;}:void 0,n))return false;if(t&&s!==null){let u=s,{$from:d}=u.selection,c=d.parent;if(c.type.name==="paragraph"){let p={...c.attrs},f=false;if(r)for(let m of Gf){let b=r.attrs[m];b!=null&&p[m]==null&&(p[m]=b,f=true);}if(p.borders&&(p.borders=null,f=true),f&&u.setNodeMarkup(d.before(),void 0,p),c.textContent.length===0){let m=a;if(m.length===0&&r){let b=r.attrs.defaultTextFormatting;b&&(m=Ia(b,e.schema).filter(S=>Ac.has(S.type.name)));}if(m.length>0){let b={...p.defaultTextFormatting??{}},g=false;for(let S of m)if(S.type.name==="fontSize"&&S.attrs.size!==b.fontSize&&(b.fontSize=S.attrs.size,g=true),S.type.name==="fontFamily"){let C=S.attrs.ascii;C&&(!b.fontFamily||b.fontFamily.ascii!==C)&&(b.fontFamily={...b.fontFamily,ascii:C,hAnsi:S.attrs.hAnsi},g=true);}g&&u.setNodeMarkup(d.before(),void 0,{...p,defaultTextFormatting:b}),u.setStoredMarks(m);}}}t(u.scrollIntoView());}return true},Dc=Ct({name:"baseKeymap",priority:xn.Low,onSchemaReady(e){return {keyboardShortcuts:{...prosemirrorCommands.baseKeymap,Enter:Kf,Backspace:Bc(prosemirrorCommands.deleteSelection,Uf,prosemirrorCommands.joinBackward),Delete:Bc(prosemirrorCommands.deleteSelection,prosemirrorCommands.joinForward),"Mod-a":prosemirrorCommands.selectAll,Escape:prosemirrorCommands.selectParentNode}}}});var gr=new prosemirrorState.PluginKey("selectionTracker");function ao(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((E,R,_)=>{if(R>r)return false;R<=o&&(s=_),R<=r&&(l=_);});let u=Xf(e),d=a.parent,c={};d.type.name==="paragraph"&&(d.attrs.alignment&&(c.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(c.lineSpacing=d.attrs.lineSpacing,c.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.indentLeft&&(c.indentLeft=d.attrs.indentLeft),d.attrs.indentRight&&(c.indentRight=d.attrs.indentRight),d.attrs.indentFirstLine&&(c.indentFirstLine=d.attrs.indentFirstLine),d.attrs.hangingIndent&&(c.hangingIndent=d.attrs.hangingIndent),d.attrs.tabs&&(c.tabs=d.attrs.tabs),d.attrs.numPr&&(c.numPr=d.attrs.numPr));let p=d.attrs?.numPr,f=!!p?.numId,m=p?.numId===1?"bullet":p?.numId?"numbered":void 0,b=p?.ilvl,g=e.storedMarks||(i?a.marks():[]),S=[],C=false,k=false;for(let E of g)E.type.name==="comment"&&E.attrs.commentId&&S.push(E.attrs.commentId),E.type.name==="insertion"&&(C=true),E.type.name==="deletion"&&(k=true);return {hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:c,startParagraphIndex:s,endParagraphIndex:l,inList:f,listType:m,listLevel:b,activeCommentIds:S,inInsertion:C,inDeletion:k}}function Xf(e){let{selection:t}=e,{empty:n,$from:o}=t,r=e.storedMarks||(n?o.marks():[]),i={};for(let a of r)switch(a.type.name){case "bold":i.bold=true;break;case "italic":i.italic=true;break;case "underline":i.underline={style:a.attrs.style||"single",color:a.attrs.color};break;case "strike":a.attrs.double?i.doubleStrike=true:i.strike=true;break;case "textColor":i.color={rgb:a.attrs.rgb,themeColor:a.attrs.themeColor,themeTint:a.attrs.themeTint,themeShade:a.attrs.themeShade};break;case "highlight":i.highlight=a.attrs.color;break;case "fontSize":i.fontSize=a.attrs.size;break;case "fontFamily":i.fontFamily={ascii:a.attrs.ascii,hAnsi:a.attrs.hAnsi,asciiTheme:a.attrs.asciiTheme};break;case "superscript":i.vertAlign="superscript";break;case "subscript":i.vertAlign="subscript";break}return i}function hr(e){return new prosemirrorState.Plugin({key:gr,state:{init(t,n){return ao(n)},apply(t,n,o,r){if(!t.selectionSet&&!t.docChanged)return n;let i=ao(r);return e&&!Jf(n,i)&&setTimeout(()=>e(i),0),i}},view(){return {update(t,n){if(!e||t.state.selection.eq(n.selection)&&t.state.doc.eq(n.doc))return;let o=gr.getState(t.state);o&&e(o);}}}})}function Zf(e,t){if(e===t)return true;if(!e||!t||e.length!==t.length)return false;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return false;return true}function Jf(e,t){return e.hasSelection===t.hasSelection&&e.isMultiParagraph===t.isMultiParagraph&&e.startParagraphIndex===t.startParagraphIndex&&e.endParagraphIndex===t.endParagraphIndex&&e.inList===t.inList&&e.listType===t.listType&&e.listLevel===t.listLevel&&e.inInsertion===t.inInsertion&&e.inDeletion===t.inDeletion&&Zf(e.activeCommentIds,t.activeCommentIds)&&JSON.stringify(e.textFormatting)===JSON.stringify(t.textFormatting)&&JSON.stringify(e.paragraphFormatting)===JSON.stringify(t.paragraphFormatting)}var Hc=Ct({name:"selectionTracker",defaultOptions:{},onSchemaReady(e,t){return {plugins:[hr(t.onSelectionChange)],commands:{extractSelectionContext:()=>(n,o)=>(ao(n),true)}}}});var tm=new prosemirrorState.PluginKey("imageDrag"),zc=Ct({name:"imageDrag",onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({key:tm,props:{handleDOMEvents:{dragstart(n,o){let{selection:r}=n.state;if(r instanceof prosemirrorState.NodeSelection&&r.node.type.name==="image"){n.dom.classList.add("pm-image-dragging");let i=o;if(i.dataTransfer){i.dataTransfer.effectAllowed="move";let a=document.createElement("div");a.style.cssText="position: fixed; left: -9999px; top: -9999px; opacity: 0.6; pointer-events: none; border: 2px dashed var(--doc-primary, #2563eb); border-radius: 4px; background: rgba(37, 99, 235, 0.08);",a.style.width=`${r.node.attrs.width||100}px`,a.style.height=`${r.node.attrs.height||100}px`,document.body.appendChild(a),i.dataTransfer.setDragImage(a,0,0),requestAnimationFrame(()=>{document.body.removeChild(a);});}}return false},dragend(n){return n.dom.classList.remove("pm-image-dragging"),n.dom.querySelectorAll(".pm-drop-indicator").forEach(r=>r.remove()),false},dragover(n,o){let{selection:r}=n.state;if(r instanceof prosemirrorState.NodeSelection&&r.node.type.name==="image"){let i=o;i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="move");}return false},drop(n){return n.dom.classList.remove("pm-image-dragging"),n.dom.querySelectorAll(".pm-drop-indicator").forEach(r=>r.remove()),false}}}})]}}});var Oc=Ct({name:"dropCursor",onSchemaReady(){return {plugins:[prosemirrorDropcursor.dropCursor({color:"var(--doc-primary, #4285f4)",width:2})]}}});var br=new prosemirrorState.PluginKey("paragraphChangeTracker");function $c(e){let t=0;return e.descendants(n=>{n.type.name==="paragraph"&&t++;}),t}function im(e,t,n){let o=new Set,r=false;return e.nodesBetween(t,n,i=>{if(i.type.name==="paragraph"){let a=i.attrs.paraId;a?o.add(a):r=true;}}),{ids:o,hasUntracked:r}}function am(){return new prosemirrorState.Plugin({key:br,state:{init(e,t){return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:$c(t.doc)}},apply(e,t){if(e.getMeta(br)==="clear")return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:t.paragraphCount};if(!e.docChanged)return t;let n=$c(e.doc),o={changedParaIds:new Set(t.changedParaIds),structuralChange:t.structuralChange,hasUntrackedChanges:t.hasUntrackedChanges,paragraphCount:n};t.paragraphCount!==n&&(o.structuralChange=true);for(let r of e.steps)r.getMap().forEach((a,s,l,u)=>{let{ids:d,hasUntracked:c}=im(e.doc,l,u);for(let p of d)o.changedParaIds.add(p);c&&(o.hasUntrackedChanges=true);});return o}}})}function Aa(e){return br.getState(e)}function Wc(e){return Aa(e)?.changedParaIds??new Set}function _c(e){return Aa(e)?.structuralChange??false}function Vc(e){return Aa(e)?.hasUntrackedChanges??false}function jc(e){return e.tr.setMeta(br,"clear")}var Uc=Ct({name:"paragraphChangeTracker",defaultOptions:{},onSchemaReady(){return {plugins:[am()]}}});function so(e={}){let t=new Set(e.disable||[]),n=[];function o(r,i){t.has(r)||n.push(i);}return o("doc",Il()),o("text",Fl()),o("paragraph",Hl()),o("history",zl({depth:e.historyDepth,newGroupDelay:e.historyNewGroupDelay})),o("bold",$l()),o("italic",_l()),o("underline",Ul()),o("strike",Gl()),o("textColor",Kl()),o("highlight",Yl()),o("fontSize",ql()),o("fontFamily",Xl()),o("superscript",Zl()),o("subscript",Jl()),o("hyperlink",Ql()),o("allCaps",ec()),o("smallCaps",tc()),o("footnoteRef",nc()),o("characterSpacing",oc()),o("emboss",sc()),o("imprint",lc()),o("textShadow",cc()),o("emphasisMark",dc()),o("textOutline",uc()),o("comment",rc()),o("insertion",ic()),o("deletion",ac()),o("hardBreak",pc()),o("tab",fc()),o("image",mc()),o("textBox",gc()),o("shape",hc()),o("imageDrag",zc()),o("dropCursor",Oc()),o("horizontalRule",bc()),o("pageBreak",yc()),o("field",xc()),o("sdt",Sc()),o("math",kc()),t.has("table")||n.push(...Ec()),o("list",Fc()),o("baseKeymap",Dc()),o("selectionTracker",Hc({onSelectionChange:e.onSelectionChange})),o("paragraphChangeTracker",Uc()),n}var Sn=class{constructor(t){chunkPCJ5ACUV_cjs.d(this,"extensions");chunkPCJ5ACUV_cjs.d(this,"schema",null);chunkPCJ5ACUV_cjs.d(this,"plugins",[]);chunkPCJ5ACUV_cjs.d(this,"commands",{});this.extensions=[...t].sort((n,o)=>n.config.priority-o.config.priority);}buildSchema(){let t={},n={};for(let o of this.extensions)o.type==="node"?t[o.config.schemaNodeName]=o.config.nodeSpec:o.type==="mark"&&(n[o.config.schemaMarkName]=o.config.markSpec);this.schema=new prosemirrorModel.Schema({nodes:t,marks:n});}initializeRuntime(){if(!this.schema)throw new Error("ExtensionManager: buildSchema() must be called before initializeRuntime()");let t={schema:this.schema},n=[],o=[],r={};for(let i of this.extensions){let a=i.onSchemaReady(t);a.commands&&Object.assign(r,a.commands),a.keyboardShortcuts&&n.push(a.keyboardShortcuts),a.plugins&&o.push(...a.plugins);}this.plugins=[...o,...n.map(i=>prosemirrorKeymap.keymap(i))],this.commands=r;}getSchema(){if(!this.schema)throw new Error("ExtensionManager: buildSchema() must be called first");return this.schema}getPlugins(){return this.plugins}getCommands(){return this.commands}getCommand(t){return this.commands[t]}destroy(){this.plugins=[],this.commands={};}};var yr=new Sn(so());yr.buildSchema();yr.initializeRuntime();var _n=yr,ye=yr.getSchema();var Fo=class{constructor(t){chunkPCJ5ACUV_cjs.d(this,"stylesById");chunkPCJ5ACUV_cjs.d(this,"docDefaults");chunkPCJ5ACUV_cjs.d(this,"defaultParagraphStyle");if(this.stylesById=new Map,this.docDefaults=t?.docDefaults,t?.styles)for(let n of t.styles)n.styleId&&this.stylesById.set(n.styleId,n);this.defaultParagraphStyle=this.findDefaultStyle("paragraph");}getStyle(t){return this.stylesById.get(t)}getParagraphStyles(){let t=[];for(let n of this.stylesById.values())n.type==="paragraph"&&!n.hidden&&!n.semiHidden&&t.push(n);return t.sort((n,o)=>{let r=n.uiPriority??99,i=o.uiPriority??99;return r!==i?r-i:(n.name??n.styleId).localeCompare(o.name??o.styleId)})}resolveParagraphStyle(t){let n={};if(this.docDefaults?.pPr&&(n.paragraphFormatting={...this.docDefaults.pPr}),this.docDefaults?.rPr&&(n.runFormatting={...this.docDefaults.rPr}),!t)return this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n;let o=this.stylesById.get(t);return o?(this.mergeStyleIntoResult(n,o),n):(this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n)}getTableStyles(){let t=[];for(let n of this.stylesById.values())n.type==="table"&&!n.hidden&&!n.semiHidden&&t.push(n);return t.sort((n,o)=>{let r=n.uiPriority??99,i=o.uiPriority??99;return r!==i?r-i:(n.name??n.styleId).localeCompare(o.name??o.styleId)})}resolveRunStyle(t){let n={};if(this.docDefaults?.rPr&&(n={...this.docDefaults.rPr}),!t)return Object.keys(n).length>0?n:void 0;let o=this.stylesById.get(t);if(!o?.rPr)return Object.keys(n).length>0?n:void 0;let r=this.mergeTextFormatting(n,o.rPr);return r&&Object.keys(r).length>0?r:void 0}getRunStyleOwnProperties(t){if(!t)return;let n=this.stylesById.get(t);if(n?.rPr)return Object.keys(n.rPr).length>0?{...n.rPr}:void 0}getDocDefaults(){return this.docDefaults}getDefaultParagraphStyle(){return this.defaultParagraphStyle}hasStyle(t){return this.stylesById.has(t)}findDefaultStyle(t){for(let n of this.stylesById.values())if(n.type===t&&n.default)return n;if(t==="paragraph")return this.stylesById.get("Normal")}mergeStyleIntoResult(t,n){n.pPr&&(t.paragraphFormatting=this.mergeParagraphFormatting(t.paragraphFormatting,n.pPr)),n.rPr&&(t.runFormatting=this.mergeTextFormatting(t.runFormatting,n.rPr));}mergeParagraphFormatting(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let o={...t};for(let r of Object.keys(n)){let i=n[r];if(i!==void 0)if(r==="runProperties")o.runProperties=this.mergeTextFormatting(o.runProperties,n.runProperties);else if(r==="borders"||r==="numPr"||r==="frame"){let a=o[r],s=i;o[r]={...a||{},...s||{}};}else r==="tabs"&&Array.isArray(i)?o.tabs=[...i]:o[r]=i;}return o}mergeTextFormatting(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let o={...t};for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(typeof i=="object"&&i!==null?o[r]={...o[r]||{},...i}:o[r]=i);}return o}};function kn(e){return new Fo(e)}function kr(e,t){let n=e.package.document.content,o=[],r=t?.styles?kn(t.styles):null;for(let i of n)if(i.type==="paragraph"){let a=Gc(i),s=Cr(i,r);o.push(s);for(let l of a)o.push(Kc(l,r));Sm(i)&&o.push(ye.node("pageBreak"));}else if(i.type==="table"){let a=Da(i,r);o.push(a);}return o.length===0&&o.push(ye.node("paragraph",{},[])),ye.node("doc",null,o)}function Cr(e,t,n,o){let r=dm(e,t),i=[],a,s=new Set,l;t&&(l=t.resolveParagraphStyle(e.formatting?.styleId).runFormatting);let u=on(l,o);for(let d of e.content){if(d.type==="commentRangeStart")s.add(d.id);else if(d.type==="commentRangeEnd")s.delete(d.id);else if(d.type==="run"){let c=Ha(d,u,t);s.size>0&&(c=cm(c,s)),i.push(...c);}else if(d.type==="hyperlink"){let c=Na(d,u,t);i.push(...c);}else if(d.type==="simpleField"||d.type==="complexField"){let c=mm(d,u);c&&i.push(c);}else if(d.type==="inlineSdt"){let c=hm(d,u,t);c&&i.push(c);}else if(d.type==="insertion"){let c=xr(d,"insertion",u,t);i.push(...c);}else if(d.type==="deletion"){let c=xr(d,"deletion",u,t);i.push(...c);}else if(d.type==="moveFrom"){let c=xr(d,"deletion",u,t);i.push(...c);}else if(d.type==="moveTo"){let c=xr(d,"insertion",u,t);i.push(...c);}else if(d.type==="mathEquation"){let c=gm(d);c&&i.push(c);}d.type==="bookmarkStart"&&(a||(a=[]),a.push({id:d.id,name:d.name}));}return a&&(r.bookmarks=a),ye.node("paragraph",r,i)}function cm(e,t){if(t.size===0)return e;let n=[...t][0],o=ye.marks.comment.create({commentId:n});return e.map(r=>r.isText?r.mark(o.addToSet(r.marks)):r)}function xr(e,t,n,o){let r=[];for(let a of e.content)a.type==="run"?r.push(...Ha(a,n,o)):a.type==="hyperlink"&&r.push(...Na(a,n,o));let i=ye.marks[t].create({revisionId:e.info.id,author:e.info.author,date:e.info.date??null});return r.map(a=>a.isText?a.mark(i.addToSet(a.marks)):a)}function dm(e,t){let n=e.formatting,o=n?.styleId,r={paraId:e.paraId??void 0,textId:e.textId??void 0,styleId:o,numPr:n?.numPr,listNumFmt:e.listRendering?.numFmt,listIsBullet:e.listRendering?.isBullet,listMarker:e.listRendering?.marker,_originalFormatting:n||void 0};if(t){let i=t.resolveParagraphStyle(o),a=i.paragraphFormatting,s=i.runFormatting;r.alignment=n?.alignment??a?.alignment,r.spaceBefore=n?.spaceBefore??a?.spaceBefore,r.spaceAfter=n?.spaceAfter??a?.spaceAfter,r.lineSpacing=n?.lineSpacing??a?.lineSpacing,r.lineSpacingRule=n?.lineSpacingRule??a?.lineSpacingRule,r.indentLeft=n?.indentLeft??a?.indentLeft,r.indentRight=n?.indentRight??a?.indentRight,r.indentFirstLine=n?.indentFirstLine??a?.indentFirstLine,r.hangingIndent=n?.hangingIndent??a?.hangingIndent,r.borders=n?.borders??a?.borders,r.shading=n?.shading??a?.shading,r.tabs=n?.tabs??a?.tabs,r.pageBreakBefore=n?.pageBreakBefore??a?.pageBreakBefore,r.keepNext=n?.keepNext??a?.keepNext,r.keepLines=n?.keepLines??a?.keepLines,r.contextualSpacing=n?.contextualSpacing??a?.contextualSpacing,r.outlineLevel=n?.outlineLevel??a?.outlineLevel;let l=Sr(n?.runProperties,t);if(r.defaultTextFormatting=on(s,l),e.sectionProperties?.sectionStart){let u=e.sectionProperties.sectionStart;(u==="nextPage"||u==="continuous"||u==="oddPage"||u==="evenPage")&&(r.sectionBreakType=u);}!n?.numPr&&a?.numPr&&a.numPr.numId!==0&&(r.numPr=a.numPr);}else r.alignment=n?.alignment,r.spaceBefore=n?.spaceBefore,r.spaceAfter=n?.spaceAfter,r.lineSpacing=n?.lineSpacing,r.lineSpacingRule=n?.lineSpacingRule,r.indentLeft=n?.indentLeft,r.indentRight=n?.indentRight,r.indentFirstLine=n?.indentFirstLine,r.hangingIndent=n?.hangingIndent,r.borders=n?.borders,r.shading=n?.shading,r.tabs=n?.tabs,r.pageBreakBefore=n?.pageBreakBefore,r.keepNext=n?.keepNext,r.keepLines=n?.keepLines,r.outlineLevel=n?.outlineLevel,r.defaultTextFormatting=Sr(n?.runProperties,t);if(e.sectionProperties?.sectionStart){let i=e.sectionProperties.sectionStart;(i==="nextPage"||i==="continuous"||i==="oddPage"||i==="evenPage")&&(r.sectionBreakType=i);}return r}function Ht(e,t,n){if(!e||!t)return;let o=e.getStyle(t);if(!o?.tblStylePr)return;let r=o.tblStylePr.find(l=>l.type===n);if(!r)return;let i=Sr(r.pPr?.runProperties,e),a=Sr(r.rPr,e),s=on(i,a);return {tcPr:r.tcPr,rPr:s}}function nn(e,t){if(!e&&!t)return;if(!e)return t;if(!t)return e;let n={},o=e.tcPr,r=t.tcPr;if(o||r){let i={...o??{},...r??{}};(o?.borders||r?.borders)&&(i.borders={...o?.borders??{},...r?.borders??{}}),(o?.shading||r?.shading)&&(i.shading={...o?.shading??{},...r?.shading??{}}),(o?.margins||r?.margins)&&(i.margins={...o?.margins??{},...r?.margins??{}}),n.tcPr=i;}return n.rPr=on(e.rPr,t.rPr),n}function Sr(e,t){if(!e)return;if(!e.styleId||!t)return e;let n=t.resolveRunStyle(e.styleId);return on(n,e)}function um(e){let t=new Map,n=e.rows.length,o=new Map;for(let r=0;r<n;r++){let i=e.rows[r],a=0;for(let s=0;s<i.cells.length;s++){let l=i.cells[s],u=l.formatting?.gridSpan??1,d=l.formatting?.vMerge,c=`${r}-${a}`;if(d==="restart")o.set(a,r),t.set(c,{rowSpan:1,skip:false});else if(d==="continue"){let p=o.get(a);if(p!==void 0){let f=`${p}-${a}`,m=t.get(f);m&&m.rowSpan++;}t.set(c,{rowSpan:1,skip:true});}else o.delete(a),t.set(c,{rowSpan:1,skip:false});a+=u;}}return t}function Da(e,t){let n=um(e),o=e.columnWidths,r=o?.reduce((k,E)=>k+E,0)??0,i=e.formatting?.styleId,a=e.formatting?.look,s=i?t?.getStyle(i):void 0,l=e.formatting?.borders??s?.tblPr?.borders,u=e.formatting?.cellMargins??s?.tblPr?.cellMargins??void 0,d=u?{top:u.top?.value,bottom:u.bottom?.value,left:u.left?.value,right:u.right?.value}:void 0,c={styleId:e.formatting?.styleId,width:e.formatting?.width?.value,widthType:e.formatting?.width?.type,justification:e.formatting?.justification,columnWidths:o,floating:e.formatting?.floating,cellMargins:d,look:e.formatting?.look,_originalFormatting:e.formatting||void 0},p={wholeTable:Ht(t,i,"wholeTable"),firstRow:Ht(t,i,"firstRow"),lastRow:Ht(t,i,"lastRow"),firstCol:Ht(t,i,"firstCol"),lastCol:Ht(t,i,"lastCol"),band1Horz:Ht(t,i,"band1Horz"),band2Horz:Ht(t,i,"band2Horz"),band1Vert:Ht(t,i,"band1Vert"),band2Vert:Ht(t,i,"band2Vert"),nwCell:Ht(t,i,"nwCell"),neCell:Ht(t,i,"neCell"),swCell:Ht(t,i,"swCell"),seCell:Ht(t,i,"seCell")},f=a?.noHBand!==true,m=a?.noVBand!==true,b=0,g=e.rows.length,S=o?.length??e.rows[0]?.cells.reduce((k,E)=>k+(E.formatting?.gridSpan??1),0)??0,C=e.rows.map((k,E)=>{let R=E===0&&!!a?.firstRow,_=E===g-1&&!!a?.lastRow,V=f&&!R&&!_?b%2===0?p.band1Horz:p.band2Horz:void 0;return f&&!R&&!_&&b++,pm(k,t,R,o,r,p,V,m,a,l,E,g,S,n,d)});return ye.node("table",c,C)}function pm(e,t,n,o,r,i,a,s,l,u,d,c,p,f,m){let b={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:n||e.formatting?.header,_originalFormatting:e.formatting||void 0},g=e.cells.length,S=d===0,C=d===(c??1)-1,k=e.formatting?.conditionalFormat,E=k?.firstRow??S,R=k?.lastRow??C,_=p??g,V=0,$=[];for(let L=0;L<e.cells.length;L++){let W=e.cells[L],O=W.formatting?.gridSpan??1,K=`${d??0}-${V}`,w=f?.get(K),B=w?.skip??false,te=w?.rowSpan??1,he;if(o&&r&&r>0){let U=0;for(let Q=0;Q<O&&V+Q<o.length;Q++)U+=o[V+Q];he=Math.round(U/r*100);}if(V+=O,B)continue;let me=V-O===0,Ie=V===_,Te=W.formatting?.conditionalFormat,Re=Te?.firstRow??E,P=Te?.lastRow??R,I=Te?.firstColumn??me,y=Te?.lastColumn??Ie,M;if(s){let U=l?.firstColumn?1:0,Q=V-O-U;Q>=0&&!(l?.lastColumn&&y)&&!(l?.firstColumn&&I)&&(M=Q%2===0?i?.band1Vert:i?.band2Vert);}Te?.oddVBand?M=i?.band1Vert:Te?.evenVBand&&(M=i?.band2Vert);let F=a;k?.oddHBand?F=i?.band1Horz:k?.evenHBand&&(F=i?.band2Horz),Te?.oddHBand?F=i?.band1Horz:Te?.evenHBand&&(F=i?.band2Horz);let A=i?.wholeTable;A=nn(A,F),A=nn(A,M),Re&&(l?.firstRow||k?.firstRow||Te?.firstRow)&&(A=nn(A,i?.firstRow)),P&&(l?.lastRow||k?.lastRow||Te?.lastRow)&&(A=nn(A,i?.lastRow)),I&&(l?.firstColumn||k?.firstColumn||Te?.firstColumn)&&(A=nn(A,i?.firstCol)),y&&(l?.lastColumn||k?.lastColumn||Te?.lastColumn)&&(A=nn(A,i?.lastCol)),Re&&I&&(l?.firstRow||k?.firstRow||Te?.firstRow)&&(l?.firstColumn||k?.firstColumn||Te?.firstColumn)&&(A=nn(A,i?.nwCell)),Re&&y&&(l?.firstRow||k?.firstRow||Te?.firstRow)&&(l?.lastColumn||k?.lastColumn||Te?.lastColumn)&&(A=nn(A,i?.neCell)),P&&I&&(l?.lastRow||k?.lastRow||Te?.lastRow)&&(l?.firstColumn||k?.firstColumn||Te?.firstColumn)&&(A=nn(A,i?.swCell)),P&&y&&(l?.lastRow||k?.lastRow||Te?.lastRow)&&(l?.lastColumn||k?.lastColumn||Te?.lastColumn)&&(A=nn(A,i?.seCell)),$.push(fm(W,t,n,he,A,u,S,C,me,Ie,te,m));}return ye.node("tableRow",b,$)}function fm(e,t,n,o,r,i,a,s,l,u,d,c){let p=e.formatting,f=d??1,m=p?.width?.value,b=p?.width?.type;m===void 0&&o!==void 0&&(m=o,b="pct");let g=p?.shading?.fill?.rgb??r?.tcPr?.shading?.fill?.rgb,S=i?{top:a?i.top:i.insideH,bottom:s?i.bottom:i.insideH,left:l?i.left:i.insideV,right:u?i.right:i.insideV}:void 0,C=r?.tcPr?.borders,k=p?.borders,E=S||C||k?{...S??{},...C??{},...k??{}}:void 0,R={colspan:p?.gridSpan??1,rowspan:f,width:m,widthType:b,verticalAlign:p?.verticalAlign,backgroundColor:g,textDirection:p?.textDirection,noWrap:p?.noWrap,borders:E,margins:p?.margins?{top:p.margins.top?.value,bottom:p.margins.bottom?.value,left:p.margins.left?.value,right:p.margins.right?.value}:r?.tcPr?.margins?{top:r.tcPr.margins.top?.value,bottom:r.tcPr.margins.bottom?.value,left:r.tcPr.margins.left?.value,right:r.tcPr.margins.right?.value}:c,_originalFormatting:p||void 0},_=[];for(let $ of e.content)$.type==="paragraph"?_.push(Cr($,t,void 0,r?.rPr)):$.type==="table"&&_.push(Da($,t));_.length===0&&_.push(ye.node("paragraph",{},[]));let V=n?"tableHeader":"tableCell";return ye.node(V,R,_)}function mm(e,t){let n="",o,r=e.type==="simpleField"?e.content:e.fieldResult;if(r){for(let s of r)if(s.type==="run"){for(let l of s.content)l.type==="text"&&(n+=l.text);!o&&s.formatting&&(o=s.formatting);}}let i=on(t,o),a=za(i);return ye.node("field",{fieldType:e.fieldType,instruction:e.instruction,displayText:n,fieldKind:e.type==="simpleField"?"simple":"complex",fldLock:e.fldLock??false,dirty:e.dirty??false},void 0,a)}function gm(e){return ye.node("math",{display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""})}function hm(e,t,n){let o=e.properties,r=[];for(let i of e.content)if(i.type==="run"){let a=Ha(i,t,n);r.push(...a);}else if(i.type==="hyperlink"){let a=Na(i,t,n);r.push(...a);}return ye.node("sdt",{sdtType:o.sdtType,alias:o.alias??null,tag:o.tag??null,lock:o.lock??null,placeholder:o.placeholder??null,showingPlaceholder:o.showingPlaceholder??false,dateFormat:o.dateFormat??null,listItems:o.listItems?JSON.stringify(o.listItems):null,checked:o.checked??null},r.length>0?r:void 0)}function Ha(e,t,n){let o=[],r=e.formatting?.styleId?n?.getRunStyleOwnProperties(e.formatting.styleId):void 0,i=on(on(t,r),e.formatting),a=za(i);for(let s of e.content){let l=bm(s,a);o.push(...l);}return o}function on(e,t){if(!t&&!e)return;if(!t)return e;if(!e)return t;let n={...e};if(t.bold!==void 0&&(n.bold=t.bold),t.italic!==void 0&&(n.italic=t.italic),t.underline!==void 0&&(n.underline=t.underline),t.strike!==void 0&&(n.strike=t.strike),t.doubleStrike!==void 0&&(n.doubleStrike=t.doubleStrike),t.color!==void 0){let o=t.color.rgb||t.color.themeColor||t.color.themeTint||t.color.themeShade;(!t.color.auto||o)&&(n.color=t.color);}return t.highlight!==void 0&&(n.highlight=t.highlight),t.fontSize!==void 0&&(n.fontSize=t.fontSize),t.fontFamily!==void 0&&(n.fontFamily=t.fontFamily),t.vertAlign!==void 0&&(n.vertAlign=t.vertAlign),t.allCaps!==void 0&&(n.allCaps=t.allCaps),t.smallCaps!==void 0&&(n.smallCaps=t.smallCaps),n}function bm(e,t){switch(e.type){case "text":return e.text?[ye.text(e.text,t)]:[];case "break":return e.breakType==="textWrapping"||!e.breakType?[ye.node("hardBreak")]:[];case "tab":return [ye.node("tab")];case "drawing":return e.image?[ym(e.image)]:[];case "shape":{let r=e.shape;return r.textBody&&r.textBody.content.length>0?[]:[xm(r)]}case "footnoteRef":let n=ye.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return [ye.text(e.id.toString(),[...t,n])];case "endnoteRef":let o=ye.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return [ye.text(e.id.toString(),[...t,o])];default:return []}}function ym(e){let t=e.size?.width?chunkEH3NY2DQ_cjs.b(e.size.width):void 0,n=e.size?.height?chunkEH3NY2DQ_cjs.b(e.size.height):void 0,o=e.wrap.type,r=e.wrap.wrapText,i=e.position?.horizontal?.alignment,a;o==="inline"||o==="topAndBottom"?a="none":o==="square"||o==="tight"||o==="through"?r==="left"?a="right":r==="right"||i==="left"?a="left":i==="right"?a="right":a="none":a="none";let s="inline";o==="inline"?s="inline":a&&a!=="none"?s="float":s="block";let l;if(e.transform){let S=[];e.transform.rotation&&S.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&S.push("scaleX(-1)"),e.transform.flipV&&S.push("scaleY(-1)"),S.length>0&&(l=S.join(" "));}let u=e.wrap.distT?chunkEH3NY2DQ_cjs.b(e.wrap.distT):void 0,d=e.wrap.distB?chunkEH3NY2DQ_cjs.b(e.wrap.distB):void 0,c=e.wrap.distL?chunkEH3NY2DQ_cjs.b(e.wrap.distL):void 0,p=e.wrap.distR?chunkEH3NY2DQ_cjs.b(e.wrap.distR):void 0,f;e.position&&(f={horizontal:e.position.horizontal?{relativeTo:e.position.horizontal.relativeTo,posOffset:e.position.horizontal.posOffset,align:e.position.horizontal.alignment}:void 0,vertical:e.position.vertical?{relativeTo:e.position.vertical.relativeTo,posOffset:e.position.vertical.posOffset,align:e.position.vertical.alignment}:void 0});let m,b,g;if(e.outline&&e.outline.width){m=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(b=`#${e.outline.color.rgb}`);let S={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};g=e.outline.style&&S[e.outline.style]||"solid";}return ye.node("image",{src:e.src||"",alt:e.alt,title:e.title,width:t,height:n,rId:e.rId,wrapType:o,displayMode:s,cssFloat:a,transform:l,distTop:u,distBottom:d,distLeft:c,distRight:p,position:f,borderWidth:m,borderColor:b,borderStyle:g,wrapText:r})}function Na(e,t,n){let o=[],r=e.href||(e.anchor?`#${e.anchor}`:""),i=ye.mark("hyperlink",{href:r,tooltip:e.tooltip,rId:e.rId});for(let a of e.children)if(a.type==="run"){let s=a.formatting?.styleId?n?.resolveRunStyle(a.formatting.styleId):void 0,l=on(on(t,s),a.formatting),d=[...za(l),i];for(let c of a.content)c.type==="text"&&c.text&&o.push(ye.text(c.text,d));}return o}function za(e){if(!e)return [];let t=[];return e.bold&&t.push(ye.mark("bold")),e.italic&&t.push(ye.mark("italic")),e.underline&&e.underline.style!=="none"&&t.push(ye.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&t.push(ye.mark("strike",{double:e.doubleStrike||false})),e.color&&!e.color.auto&&t.push(ye.mark("textColor",{rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&e.highlight!=="none"&&t.push(ye.mark("highlight",{color:e.highlight})),e.fontSize&&t.push(ye.mark("fontSize",{size:e.fontSize})),e.fontFamily&&t.push(ye.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),e.vertAlign==="superscript"?t.push(ye.mark("superscript")):e.vertAlign==="subscript"&&t.push(ye.mark("subscript")),e.allCaps&&t.push(ye.mark("allCaps")),e.smallCaps&&t.push(ye.mark("smallCaps")),(e.spacing!=null||e.position!=null||e.scale!=null||e.kerning!=null)&&t.push(ye.mark("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null})),e.emboss&&t.push(ye.mark("emboss")),e.imprint&&t.push(ye.mark("imprint")),e.shadow&&t.push(ye.mark("textShadow")),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(ye.mark("emphasisMark",{type:e.emphasisMark})),e.outline&&t.push(ye.mark("textOutline")),t}function xm(e){let t=e.size?.width?chunkEH3NY2DQ_cjs.b(e.size.width):100,n=e.size?.height?chunkEH3NY2DQ_cjs.b(e.size.height):80,o,r="solid",i,a,s;if(e.fill&&(r=e.fill.type,e.fill.color?.rgb&&(o=`#${e.fill.color.rgb}`),e.fill.type==="gradient"&&e.fill.gradient)){let p=e.fill.gradient;i=p.type,a=p.angle,s=JSON.stringify(p.stops.map(f=>({position:f.position,color:f.color.rgb?`#${f.color.rgb}`:"#000000"})));}let l,u,d;e.outline&&(e.outline.width&&(l=Math.round(e.outline.width/914400*96*100)/100),e.outline.color?.rgb&&(u=`#${e.outline.color.rgb}`),d=e.outline.style||"solid");let c;if(e.transform){let p=[];e.transform.rotation&&p.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&p.push("scaleX(-1)"),e.transform.flipV&&p.push("scaleY(-1)"),p.length>0&&(c=p.join(" "));}return ye.node("shape",{shapeType:e.shapeType||"rect",shapeId:e.id,width:t,height:n,fillColor:o,fillType:r,gradientType:i,gradientAngle:a,gradientStops:s,outlineWidth:l,outlineColor:u,outlineStyle:d,transform:c})}function Gc(e){let t=[];for(let n of e.content)if(n.type==="run"){for(let o of n.content)if(o.type==="shape"&&"shape"in o){let r=o.shape;r.textBody&&r.textBody.content.length>0&&t.push({type:"textBox",id:r.id,size:r.size,position:r.position,wrap:r.wrap,fill:r.fill,outline:r.outline,content:r.textBody.content,margins:r.textBody.margins});}}return t}function Kc(e,t){let n=e.size?.width?chunkEH3NY2DQ_cjs.b(e.size.width):200,o=e.size?.height?chunkEH3NY2DQ_cjs.b(e.size.height):void 0,r;e.fill?.color?.rgb&&(r=`#${e.fill.color.rgb}`);let i,a,s;e.outline&&e.outline.width&&(i=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(a=`#${e.outline.color.rgb}`),s=e.outline.style||"solid");let l=e.margins?.top!=null?chunkEH3NY2DQ_cjs.b(e.margins.top):4,u=e.margins?.bottom!=null?chunkEH3NY2DQ_cjs.b(e.margins.bottom):4,d=e.margins?.left!=null?chunkEH3NY2DQ_cjs.b(e.margins.left):7,c=e.margins?.right!=null?chunkEH3NY2DQ_cjs.b(e.margins.right):7,p=[];for(let f of e.content)p.push(Cr(f,t));return p.length===0&&p.push(ye.node("paragraph",{},[])),ye.node("textBox",{width:n,height:o,textBoxId:e.id,fillColor:r,outlineWidth:i,outlineColor:a,outlineStyle:s,marginTop:l,marginBottom:u,marginLeft:d,marginRight:c},p)}function Oa(e,t){let n=[],o=t?.styles?kn(t.styles):null;for(let r of e)if(r.type==="paragraph"){let i=Gc(r);n.push(Cr(r,o));for(let a of i)n.push(Kc(a,o));}else r.type==="table"&&n.push(Da(r,o));return n.length===0&&n.push(ye.node("paragraph",{},[])),ye.node("doc",null,n)}function Sm(e){for(let t of e.content)if(t.type==="run"){for(let n of t.content)if(n.type==="break"&&n.breakType==="page")return true}return false}function wr(){return ye.node("doc",null,[ye.node("paragraph",{},[])])}function Tr(e,t){let o={content:qc(e),finalSectionProperties:t?.package.document.finalSectionProperties,sections:t?.package.document.sections,comments:t?.package.document.comments};return t?{...t,package:{...t.package,document:o}}:{package:{document:o}}}function qc(e){let t=[],n=Zc(e);return e.forEach(o=>{o.type.name==="paragraph"?t.push($a(o,n)):o.type.name==="table"?t.push(Qc(o,n)):o.type.name==="textBox"?t.push(Wm(o)):o.type.name==="pageBreak"&&t.push(km());}),t}function km(){return {type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function $a(e,t){let n=e.attrs,o=Cm(Xc(e,t),e),r=n.bookmarks;if(r&&r.length>0){let a=r.map(l=>({type:"bookmarkStart",id:l.id,name:l.name})),s=r.map(l=>({type:"bookmarkEnd",id:l.id}));o=[...a,...o,...s];}let i={type:"paragraph",paraId:n.paraId||void 0,textId:n.textId||void 0,formatting:wm(n),content:o};return n.sectionBreakType&&(i.sectionProperties={sectionStart:n.sectionBreakType}),i}function Cm(e,t){let n=new Set;if(t.forEach(a=>{for(let s of a.marks)s.type.name==="comment"&&n.add(s.attrs.commentId);}),n.size===0)return e;let o=[],r=new Set,i=0;t.forEach(a=>{let s=new Set;for(let l of a.marks)l.type.name==="comment"&&s.add(l.attrs.commentId);for(let l of [...r])s.has(l)||(o.push({type:"commentRangeEnd",id:l}),r.delete(l));for(let l of s)r.has(l)||(o.push({type:"commentRangeStart",id:l}),r.add(l));i<e.length&&o.push(e[i]),i++;});for(let a of r)o.push({type:"commentRangeEnd",id:a});return o}function wm(e){if(e._originalFormatting){let n=e._originalFormatting,o={...n};return e.alignment!==(n.alignment||void 0)&&(o.alignment=e.alignment||void 0),e.numPr!==n.numPr&&JSON.stringify(e.numPr)!==JSON.stringify(n.numPr)&&(o.numPr=e.numPr||void 0),e.styleId!==(n.styleId||void 0)&&(o.styleId=e.styleId||void 0),e.pageBreakBefore!==(n.pageBreakBefore||void 0)&&(o.pageBreakBefore=e.pageBreakBefore||void 0),o}if(e.alignment||e.spaceBefore||e.spaceAfter||e.lineSpacing||e.indentLeft||e.indentRight||e.indentFirstLine||e.numPr||e.styleId||e.borders||e.shading||e.tabs||e.outlineLevel!=null||e.contextualSpacing)return {alignment:e.alignment||void 0,spaceBefore:e.spaceBefore||void 0,spaceAfter:e.spaceAfter||void 0,lineSpacing:e.lineSpacing||void 0,lineSpacingRule:e.lineSpacingRule||void 0,indentLeft:e.indentLeft||void 0,indentRight:e.indentRight||void 0,indentFirstLine:e.indentFirstLine||void 0,hangingIndent:e.hangingIndent||void 0,numPr:e.numPr||void 0,styleId:e.styleId||void 0,borders:e.borders||void 0,shading:e.shading||void 0,tabs:e.tabs||void 0,outlineLevel:e.outlineLevel??void 0,contextualSpacing:e.contextualSpacing||void 0}}function Xc(e,t){let n=[],o=t??Zc(e),r=null,i=null,a=null;return e.forEach(s=>{let l=s.marks.find(p=>p.type.name==="footnoteRef");if(l){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let f={type:l.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(l.attrs.id,10)||0};n.push({type:"run",content:[f]});return}let u=s.marks.find(p=>p.type.name==="insertion"),d=s.marks.find(p=>p.type.name==="deletion");if(u||d){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let p=u||d,f=s.marks.filter(R=>R.type.name!=="insertion"&&R.type.name!=="deletion"),m=Wa(f),b={type:"run",content:s.isText&&s.text?[{type:"text",text:s.text}]:[],...Object.keys(m).length>0?{formatting:m}:{}},g={id:p.attrs.revisionId,author:p.attrs.author||"Unknown",date:p.attrs.date||void 0},S=g.id,C=(o.insertionById.get(S)??0)>0,k=(o.deletionById.get(S)??0)>0,E=C&&k;u?E?n.push({type:"moveTo",info:g,content:[b]}):n.push({type:"insertion",info:g,content:[b]}):E?n.push({type:"moveFrom",info:g,content:[b]}):n.push({type:"deletion",info:g,content:[b]});return}let c=s.marks.find(p=>p.type.name==="hyperlink");if(c){let p=Tm(c),f=a?.href||(a?.anchor?`#${a.anchor}`:"");a&&f===p||(r&&(n.push(r),r=null,i=null),a&&n.push(a),a=Rm(c)),Yc(a,s);return}if(a&&(n.push(a),a=null),s.isText){let p=vm(s.marks);r&&i===p?Pm(r,s.text||""):(r&&n.push(r),r=Jc(s.text||"",s.marks),i=p);}else s.type.name==="hardBreak"?(r&&(n.push(r),r=null,i=null),n.push(Mm())):s.type.name==="image"?(r&&(n.push(r),r=null,i=null),n.push(Bm(s))):s.type.name==="shape"?(r&&(n.push(r),r=null,i=null),n.push(Am(s))):s.type.name==="tab"?(r&&(n.push(r),r=null,i=null),n.push(Em())):s.type.name==="field"?(r&&(n.push(r),r=null,i=null),n.push(Im(s,s.marks))):s.type.name==="sdt"?(r&&(n.push(r),r=null,i=null),n.push(Lm(s))):s.type.name==="math"&&(r&&(n.push(r),r=null,i=null),n.push(Fm(s)));}),r&&n.push(r),a&&n.push(a),n}function Zc(e){let t=new Map,n=new Map;return e.descendants(o=>{let r=o.marks.find(a=>a.type.name==="insertion"),i=o.marks.find(a=>a.type.name==="deletion");if(r){let a=Number(r.attrs.revisionId);Number.isFinite(a)&&t.set(a,(t.get(a)??0)+1);}if(i){let a=Number(i.attrs.revisionId);Number.isFinite(a)&&n.set(a,(n.get(a)??0)+1);}}),{insertionById:t,deletionById:n}}function Tm(e){return e.attrs.href||""}function vm(e){let t=e.filter(n=>n.type.name!=="hyperlink");return t.length===0?"":t.map(n=>`${n.type.name}:${JSON.stringify(n.attrs)}`).sort().join("|")}function Rm(e){let t=e.attrs.href;return t?.startsWith("#")?{type:"hyperlink",anchor:t.substring(1),tooltip:e.attrs.tooltip||void 0,children:[]}:{type:"hyperlink",href:t,tooltip:e.attrs.tooltip||void 0,rId:e.attrs.rId||void 0,children:[]}}function Yc(e,t){if(t.isText&&t.text){let n=t.marks.filter(r=>r.type.name!=="hyperlink"),o=Jc(t.text,n);e.children.push(o);}}function Jc(e,t){let n=Wa(t),o={type:"text",text:e};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[o]}}function Pm(e,t){let n=e.content[e.content.length-1];n&&n.type==="text"?n.text+=t:e.content.push({type:"text",text:t});}function Mm(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function Em(){return {type:"run",content:[{type:"tab"}]}}function Im(e,t){let n=e.attrs,o=t&&t.length>0?Wa(t):void 0,r=n.displayText||"";if(!r)switch(n.fieldType){case "PAGE":r="1";break;case "NUMPAGES":r="1";break;default:r=" ";break}let i={type:"run",content:[{type:"text",text:r}],...o&&Object.keys(o).length>0?{formatting:o}:{}};return n.fieldKind==="complex"?{type:"complexField",instruction:n.instruction,fieldType:n.fieldType,fieldCode:[],fieldResult:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}:{type:"simpleField",instruction:n.instruction,fieldType:n.fieldType,content:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}}function Fm(e){let t=e.attrs;return {type:"mathEquation",display:t.display||"inline",ommlXml:t.ommlXml,plainText:t.plainText||void 0}}function Lm(e){let t=e.attrs,n={sdtType:t.sdtType??"richText",alias:t.alias??void 0,tag:t.tag??void 0,lock:t.lock??void 0,placeholder:t.placeholder??void 0,showingPlaceholder:t.showingPlaceholder??void 0,dateFormat:t.dateFormat??void 0,listItems:t.listItems?JSON.parse(t.listItems):void 0,checked:t.checked!=null?t.checked:void 0},r=Xc(e).filter(i=>i.type==="run"||i.type==="hyperlink");return {type:"inlineSdt",properties:n,content:r}}function Bm(e){let t=e.attrs,n=t.wrapType||"inline",o=914400/96,r={type:n};t.distTop!==void 0&&(r.distT=Math.round(t.distTop*o)),t.distBottom!==void 0&&(r.distB=Math.round(t.distBottom*o)),t.distLeft!==void 0&&(r.distL=Math.round(t.distLeft*o)),t.distRight!==void 0&&(r.distR=Math.round(t.distRight*o)),t.wrapText&&(r.wrapText=t.wrapText);let i={type:"image",rId:t.rId||"",src:t.src,alt:t.alt||void 0,title:t.title||void 0,size:{width:chunkEH3NY2DQ_cjs.c(t.width||0),height:chunkEH3NY2DQ_cjs.c(t.height||0)},wrap:r};if(t.transform){let s=t.transform,l={},u=s.match(/rotate\(([-\d.]+)deg\)/);u&&(l.rotation=parseFloat(u[1])),s.includes("scaleX(-1)")&&(l.flipH=true),s.includes("scaleY(-1)")&&(l.flipV=true),(l.rotation||l.flipH||l.flipV)&&(i.transform=l);}if(t.position?.horizontal&&t.position?.vertical){let s=t.position;i.position={horizontal:{relativeTo:s.horizontal.relativeTo||"column",alignment:s.horizontal.align,posOffset:s.horizontal.posOffset},vertical:{relativeTo:s.vertical.relativeTo||"paragraph",alignment:s.vertical.align,posOffset:s.vertical.posOffset}};}if(t.borderWidth&&t.borderWidth>0){let s={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};i.outline={width:Math.round(t.borderWidth*(914400/96)),color:t.borderColor?{rgb:t.borderColor.replace("#","")}:void 0,style:t.borderStyle&&s[t.borderStyle]||"solid"};}return {type:"run",content:[{type:"drawing",image:i}]}}function Am(e){let t=e.attrs,n={type:"shape",shapeType:t.shapeType||"rect",id:t.shapeId||void 0,size:{width:t.width?Math.round(t.width*(914400/96)):0,height:t.height?Math.round(t.height*(914400/96)):0}};if(t.fillType==="gradient"&&t.gradientStops)try{let r=JSON.parse(t.gradientStops);n.fill={type:"gradient",gradient:{type:t.gradientType||"linear",angle:t.gradientAngle||void 0,stops:r.map(i=>({position:i.position,color:{rgb:i.color.replace("#","")}}))}};}catch{n.fill={type:"solid",color:{rgb:(t.fillColor||"000000").replace("#","")}};}else t.fillColor?n.fill={type:t.fillType||"solid",color:{rgb:t.fillColor.replace("#","")}}:t.fillType==="none"&&(n.fill={type:"none"});if(t.outlineWidth&&t.outlineWidth>0){let r={solid:"solid",dotted:"dot",dashed:"dash"};n.outline={width:Math.round(t.outlineWidth*(914400/96)),color:t.outlineColor?{rgb:t.outlineColor.replace("#","")}:void 0,style:t.outlineStyle&&r[t.outlineStyle]||"solid"};}return {type:"run",content:[{type:"shape",shape:n}]}}function Wa(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true,t.boldCs=true;break;case "italic":t.italic=true,t.italicCs=true;break;case "underline":{let o=n.attrs;t.underline={style:o.style||"single",color:o.color};break}case "strike":n.attrs.double?t.doubleStrike=true:t.strike=true;break;case "textColor":{let o=n.attrs;t.color={rgb:o.rgb,themeColor:o.themeColor,themeTint:o.themeTint,themeShade:o.themeShade};break}case "highlight":t.highlight=n.attrs.color;break;case "fontSize":t.fontSize=n.attrs.size,t.fontSizeCs=n.attrs.size;break;case "fontFamily":{let o=n.attrs;t.fontFamily={ascii:o.ascii,hAnsi:o.hAnsi,cs:o.ascii||void 0,asciiTheme:o.asciiTheme};break}case "superscript":t.vertAlign="superscript";break;case "subscript":t.vertAlign="subscript";break;case "allCaps":t.allCaps=true;break;case "smallCaps":t.smallCaps=true;break;case "characterSpacing":{n.attrs.spacing!=null&&(t.spacing=n.attrs.spacing),n.attrs.position!=null&&(t.position=n.attrs.position),n.attrs.scale!=null&&(t.scale=n.attrs.scale),n.attrs.kerning!=null&&(t.kerning=n.attrs.kerning);break}case "emboss":t.emboss=true;break;case "imprint":t.imprint=true;break;case "textShadow":t.shadow=true;break;case "emphasisMark":t.emphasisMark=n.attrs.type||"dot";break;case "textOutline":t.outline=true;break}return t}function Dm(e){for(let t of e)for(let n of t.cells){let o=n.formatting?.borders;if(o){let r=o.top||o.left||o.right||o.bottom||o.insideH||o.insideV;return r?{top:o.top??r,bottom:o.bottom??r,left:o.left??r,right:o.right??r,insideH:o.insideH??o.bottom??r,insideV:o.insideV??o.right??r}:void 0}}}function Qc(e,t){let n=e.attrs,o=[];e.forEach(i=>{i.type.name==="tableRow"&&o.push(Nm(i,t));});let r=Hm(n)||void 0;if(!r?.borders){let i=Dm(o);if(i)if(r)r.borders=i;else return {type:"table",columnWidths:n.columnWidths||void 0,formatting:{borders:i},rows:o}}return {type:"table",columnWidths:n.columnWidths||void 0,formatting:r,rows:o}}function Hm(e){if(e._originalFormatting){let r=e._originalFormatting,i={...r};e.styleId!==(r.styleId||void 0)&&(i.styleId=e.styleId||void 0),e.justification!==(r.justification||void 0)&&(i.justification=e.justification||void 0),e.floating!==(r.floating||void 0)&&(i.floating=e.floating||void 0),e.look!==(r.look||void 0)&&(i.look=e.look||void 0);let a=r.width?.value,s=r.width?.type;return (e.width!==a||e.widthType!==s)&&(e.width!=null||e.widthType?i.width={value:e.width??0,type:e.widthType||"dxa"}:i.width=void 0),e.cellMargins&&(i.cellMargins={top:e.cellMargins.top!=null?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:e.cellMargins.bottom!=null?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:e.cellMargins.left!=null?{value:e.cellMargins.left,type:"dxa"}:void 0,right:e.cellMargins.right!=null?{value:e.cellMargins.right,type:"dxa"}:void 0}),i}if(!(e.styleId||e.width!=null||e.widthType||e.justification||e.floating||e.cellMargins||e.look))return;let n=e.cellMargins?{top:e.cellMargins.top!=null?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:e.cellMargins.bottom!=null?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:e.cellMargins.left!=null?{value:e.cellMargins.left,type:"dxa"}:void 0,right:e.cellMargins.right!=null?{value:e.cellMargins.right,type:"dxa"}:void 0}:void 0,o;return (e.width!=null||e.widthType)&&(o={value:e.width??0,type:e.widthType||"dxa"}),{styleId:e.styleId||void 0,width:o,justification:e.justification||void 0,floating:e.floating||void 0,cellMargins:n,look:e.look||void 0}}function Nm(e,t){let n=e.attrs,o=[];return e.forEach(r=>{(r.type.name==="tableCell"||r.type.name==="tableHeader")&&o.push(Om(r,t));}),{type:"tableRow",formatting:zm(n),cells:o}}function zm(e){if(e._originalFormatting){let n=e._originalFormatting,o={...n};return e.height!==(n.height?.value||void 0)&&(o.height=e.height?{value:e.height,type:"dxa"}:void 0),e.heightRule!==(n.heightRule||void 0)&&(o.heightRule=e.heightRule||void 0),e.isHeader!==(n.header||void 0)&&(o.header=e.isHeader||void 0),o}if(e.height||e.isHeader)return {height:e.height?{value:e.height,type:"dxa"}:void 0,heightRule:e.heightRule||void 0,header:e.isHeader||void 0}}function Om(e,t){let n=e.attrs,o=[];return e.forEach(r=>{r.type.name==="paragraph"?o.push($a(r,t)):r.type.name==="table"&&o.push(Qc(r,t));}),{type:"tableCell",formatting:$m(n),content:o}}function $m(e){if(e._originalFormatting){let o=e._originalFormatting,r={...o};if(e.colspan>1&&(r.gridSpan=e.colspan),e.width!=null&&(r.width={value:e.width,type:e.widthType||"dxa"}),e.verticalAlign!==(o.verticalAlign||void 0)&&(r.verticalAlign=e.verticalAlign||void 0),e.backgroundColor?r.shading={fill:{rgb:e.backgroundColor}}:!e.backgroundColor&&o.shading&&(r.shading=void 0),e.borders&&(r.borders=e.borders),e.margins){let i=e.margins,a={};i.top!=null&&(a.top={value:i.top,type:"dxa"}),i.bottom!=null&&(a.bottom={value:i.bottom,type:"dxa"}),i.left!=null&&(a.left={value:i.left,type:"dxa"}),i.right!=null&&(a.right={value:i.right,type:"dxa"}),r.margins=a;}return e.textDirection!==(o.textDirection||void 0)&&(r.textDirection=e.textDirection||void 0),r}if(!(e.colspan>1||e.rowspan>1||e.width!=null||e.verticalAlign||e.backgroundColor||e.borders||e.margins||e.textDirection))return;let n;if(e.margins){let o=e.margins;n={},o.top!=null&&(n.top={value:o.top,type:"dxa"}),o.bottom!=null&&(n.bottom={value:o.bottom,type:"dxa"}),o.left!=null&&(n.left={value:o.left,type:"dxa"}),o.right!=null&&(n.right={value:o.right,type:"dxa"});}return {gridSpan:e.colspan>1?e.colspan:void 0,width:e.width!=null?{value:e.width,type:e.widthType||"dxa"}:void 0,verticalAlign:e.verticalAlign||void 0,textDirection:e.textDirection||void 0,shading:e.backgroundColor?{fill:{rgb:e.backgroundColor}}:void 0,borders:e.borders,margins:n}}function Wm(e){let t=e.attrs,n=[];e.forEach(a=>{a.type.name==="paragraph"&&n.push($a(a));});let o={type:"shape",shapeType:"rect",id:t.textBoxId||void 0,size:{width:t.width?Math.round(t.width*(914400/96)):0,height:t.height?Math.round(t.height*(914400/96)):0},textBody:{content:n.length>0?n:[{type:"paragraph",content:[]}],margins:{top:t.marginTop!=null?Math.round(t.marginTop*(914400/96)):void 0,bottom:t.marginBottom!=null?Math.round(t.marginBottom*(914400/96)):void 0,left:t.marginLeft!=null?Math.round(t.marginLeft*(914400/96)):void 0,right:t.marginRight!=null?Math.round(t.marginRight*(914400/96)):void 0}}};if(t.fillColor&&(o.fill={type:"solid",color:{rgb:t.fillColor.replace("#","")}}),t.outlineWidth&&t.outlineWidth>0){let a={solid:"solid",dotted:"dot",dashed:"dash"};o.outline={width:Math.round(t.outlineWidth*(914400/96)),color:t.outlineColor?{rgb:t.outlineColor.replace("#","")}:void 0,style:t.outlineStyle&&a[t.outlineStyle]||"solid"};}return {type:"paragraph",content:[{type:"run",content:[{type:"shape",shape:o}]}]}}function Lo(e){return qc(e)}function lo(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((g,S,C)=>{S<=o&&(s=C),S<=r&&(l=C);});let u={},d=a.parent,c=d.type.name==="paragraph"&&d.textContent.length===0,p=d.attrs?.defaultTextFormatting,f=e.storedMarks||t.$from.marks();c&&f.length===0&&p&&(u={...p});for(let g of f)switch(g.type.name){case "bold":u.bold=true;break;case "italic":u.italic=true;break;case "underline":u.underline={style:g.attrs.style||"single",color:g.attrs.color};break;case "strike":g.attrs.double?u.doubleStrike=true:u.strike=true;break;case "textColor":u.color={rgb:g.attrs.rgb,themeColor:g.attrs.themeColor};break;case "highlight":u.highlight=g.attrs.color;break;case "fontSize":u.fontSize=g.attrs.size;break;case "fontFamily":u.fontFamily={ascii:g.attrs.ascii,hAnsi:g.attrs.hAnsi};break;case "superscript":u.vertAlign="superscript";break;case "subscript":u.vertAlign="subscript";break}let m={},b=null;return d.type.name==="paragraph"&&(d.attrs.alignment&&(m.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(m.lineSpacing=d.attrs.lineSpacing,m.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.numPr&&(m.numPr=d.attrs.numPr),d.attrs.indentLeft&&(m.indentLeft=d.attrs.indentLeft),d.attrs.indentRight&&(m.indentRight=d.attrs.indentRight),d.attrs.indentFirstLine&&(m.indentFirstLine=d.attrs.indentFirstLine),d.attrs.hangingIndent&&(m.hangingIndent=d.attrs.hangingIndent),d.attrs.tabs&&(m.tabs=d.attrs.tabs),d.attrs.styleId&&(b=d.attrs.styleId)),{hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:m,styleId:b,startParagraphIndex:s,endParagraphIndex:l}}var kt=_n.getCommands(),vr=kt.toggleBold(),Rr=kt.toggleItalic(),Pr=kt.toggleUnderline(),Mr=kt.toggleStrike(),Er=kt.toggleSuperscript(),Ir=kt.toggleSubscript();function Bo(e){return kt.setTextColor(e)}var Fr=kt.clearTextColor();function Lr(e){return kt.setHighlight(e)}kt.clearHighlight();function Br(e){return kt.setFontSize(e)}kt.clearFontSize();function Ar(e){return kt.setFontFamily(e)}kt.clearFontFamily();function Dr(e,t){return kt.setHyperlink(e,t)}var Hr=kt.removeHyperlink();function Ao(e,t,n){return kt.insertHyperlink(e,t,n)}var et=_n.getCommands();function Nr(e){return et.setAlignment(e)}et.alignLeft();et.alignCenter();et.alignRight();et.alignJustify();function zr(e,t="auto"){return et.setLineSpacing(e,t)}et.singleSpacing();et.oneAndHalfSpacing();et.doubleSpacing();function Or(e=720){return et.increaseIndent(e)}function $r(e=720){return et.decreaseIndent(e)}function Wr(e){return et.setIndentLeft(e)}function _r(e){return et.setIndentRight(e)}function Do(e,t){return et.setIndentFirstLine(e,t)}var Vr=et.toggleBulletList(),jr=et.toggleNumberedList(),Ur=et.increaseListLevel(),Gr=et.decreaseListLevel();et.removeList();function Ho(e,t){return et.applyStyle(e,t)}et.clearStyle();et.removeSectionBreak();function Kr(e){return et.removeTabStop(e)}var Yr=et.generateTOC();var Ue=_n.getCommands();function qr(e,t){return Ue.insertTable(e,t)}function Xr(e,t){return Ue.addRowAbove()(e,t)}function Zr(e,t){return Ue.addRowBelow()(e,t)}function Jr(e,t){return Ue.deleteRow()(e,t)}function Qr(e,t){return Ue.addColumnLeft()(e,t)}function ei(e,t){return Ue.addColumnRight()(e,t)}function ti(e,t){return Ue.deleteColumn()(e,t)}function No(e,t){return Ue.deleteTable()(e,t)}function ni(e,t){return Ue.selectTable()(e,t)}function oi(e,t){return Ue.selectRow()(e,t)}function ri(e,t){return Ue.selectColumn()(e,t)}function ii(e,t){return Ue.mergeCells()(e,t)}function ai(e,t){return Ue.splitCell()(e,t)}function Cn(e,t,n){return Ue.setCellBorder(e,t,n)}function si(e,t){return Ue.removeTableBorders()(e,t)}function li(e,t,n){return Ue.setAllTableBorders(n)(e,t)}function ci(e,t,n){return Ue.setOutsideTableBorders(n)(e,t)}function di(e,t,n){return Ue.setInsideTableBorders(n)(e,t)}function ui(e){return Ue.setCellVerticalAlign(e)}function pi(e){return Ue.setCellMargins(e)}function fi(e){return Ue.setCellTextDirection(e)}function mi(){return Ue.toggleNoWrap()}function gi(e,t){return Ue.setRowHeight(e,t)}function hi(){return Ue.toggleHeaderRow()}function bi(){return Ue.distributeColumns()}function yi(){return Ue.autoFitContents()}function zo(e){return Ue.setTableProperties(e)}function xi(e){return Ue.applyTableStyle(e)}function Si(e){return Ue.setCellFillColor(e)}function ki(e){return Ue.setTableBorderColor(e)}function Ci(e){return Ue.setTableBorderWidth(e)}var wi=(e,t)=>{let{schema:n}=e,o=n.nodes.pageBreak,r=n.nodes.paragraph;if(!o||!r)return false;if(t){let{$from:i}=e.selection,a=e.tr,s=o.create(),l=s.nodeSize,u;if(i.parent.isTextblock)if(i.parentOffset>0&&i.parentOffset<i.parent.content.size){a.split(i.pos);let d=a.mapping.map(i.pos);a.insert(d,prosemirrorModel.Fragment.from([s,r.create()])),u=d+l+1;}else if(i.parentOffset===i.parent.content.size){let d=i.after();a.insert(d,prosemirrorModel.Fragment.from([s,r.create()])),u=d+l+1;}else {let d=i.before();a.insert(d,s),u=d+l+1;}else {let d=i.pos;a.insert(d,prosemirrorModel.Fragment.from([s,r.create()])),u=d+l+1;}a.setSelection(prosemirrorState.TextSelection.create(a.doc,u)),t(a.scrollIntoView());}return true};function gd(e,t,n){return (o,r)=>{let i=o.schema.marks.insertion,a=o.schema.marks.deletion;if(!i&&!a)return false;let s=n==="accept"?i:a,l=n==="accept"?a:i;if(r){let u=o.tr,d=[];o.doc.nodesBetween(e,t,(c,p)=>{if(!c.isText)return;let f=p+c.nodeSize,m=Math.max(e,p),b=Math.min(t,f);l&&c.marks.some(g=>g.type===l)&&d.push({from:m,to:b}),s&&c.marks.some(g=>g.type===s)&&u.removeMark(m,b,s);});for(let c of d.reverse())u.delete(c.from,c.to);u.steps.length>0&&r(u);}return true}}function Va(e,t){return gd(e,t,"accept")}function ja(e,t){return gd(e,t,"reject")}var bd={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 0",fontSize:11,color:"#4285f4",userSelect:"none"},yd={fontWeight:500,letterSpacing:.3},ig={background:"none",border:"none",color:"#4285f4",cursor:"pointer",fontSize:11,padding:"2px 6px",borderRadius:3},ag={position:"absolute",right:0,top:"100%",background:"white",border:"1px solid #dadce0",borderRadius:4,boxShadow:"0 2px 6px rgba(0,0,0,0.15)",zIndex:100,minWidth:160,padding:"4px 0"},Ti={display:"block",width:"100%",padding:"6px 12px",border:"none",background:"none",textAlign:"left",cursor:"pointer",fontSize:12,color:"#3c4043"},Sd=Nu.forwardRef(function({headerFooter:t,position:n,styles:o,targetElement:r,parentElement:i,onSave:a,onClose:s,onSelectionChange:l,onRemove:u},d){let c=Nu.useRef(null),p=Nu.useRef(null),[f,m]=Nu.useState(false),[b,g]=Nu.useState(false),S=Nu.useRef(null),[C,k]=Nu.useState(null);Nu.useLayoutEffect(()=>{let $=()=>{let W=i.getBoundingClientRect(),O=r.getBoundingClientRect();k({top:O.top-W.top+i.scrollTop,left:O.left-W.left+i.scrollLeft,width:O.width});};$();let L=i.closest('[style*="overflow"]')||i;return L.addEventListener("scroll",$),window.addEventListener("resize",$),()=>{L.removeEventListener("scroll",$),window.removeEventListener("resize",$);}},[r,i]),Nu.useEffect(()=>{if(!c.current||p.current)return;let $=Oa(t.content,{styles:o||void 0}),L=new Sn(so());L.buildSchema(),L.initializeRuntime();let W=L.getPlugins(),O=prosemirrorState.EditorState.create({doc:$,schema:ye,plugins:W}),K=new prosemirrorView.EditorView(c.current,{state:O,dispatchTransaction(w){let B=K.state.apply(w);if(K.updateState(B),w.docChanged&&m(true),w.selectionSet||w.docChanged){let te=lo(B);l?.(te);}}});return p.current=K,requestAnimationFrame(()=>{K.focus();let w=lo(K.state);l?.(w);}),()=>{K.destroy(),p.current=null;}},[C]);let E=Nu.useCallback(()=>{if(!p.current)return;let $=Lo(p.current.state.doc);a($);},[a]),R=Nu.useCallback(()=>{f?E():s();},[f,E,s]);Nu.useEffect(()=>{function $(L){L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),R());}return document.addEventListener("keydown",$,true),()=>document.removeEventListener("keydown",$,true)},[R]),Nu.useEffect(()=>{if(!b)return;function $(L){S.current&&!S.current.contains(L.target)&&g(false);}return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[b]),Nu.useImperativeHandle(d,()=>({getView:()=>p.current,focus:()=>p.current?.focus(),undo:()=>{let $=p.current;return $?prosemirrorHistory.undo($.state,$.dispatch):false},redo:()=>{let $=p.current;return $?prosemirrorHistory.redo($.state,$.dispatch):false}}));let _=n==="header"?"Header":"Footer";if(!C)return null;let V={position:"absolute",top:C.top,left:C.left,width:C.width,zIndex:10};return jsxRuntime.jsxs("div",{className:"hf-inline-editor",style:V,onMouseDown:$=>{$.stopPropagation();},children:[n==="footer"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:bd,children:[jsxRuntime.jsx("span",{style:yd,children:_}),jsxRuntime.jsx(xd,{label:_,showOptions:b,setShowOptions:g,optionsRef:S,onRemove:u,onClose:R,viewRef:p})]}),jsxRuntime.jsx("div",{ref:c,className:"hf-editor-pm",style:{minHeight:40,outline:"none"}}),n==="header"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:bd,children:[jsxRuntime.jsx("span",{style:yd,children:_}),jsxRuntime.jsx(xd,{label:_,showOptions:b,setShowOptions:g,optionsRef:S,onRemove:u,onClose:R,viewRef:p})]})]})});function xd({label:e,showOptions:t,setShowOptions:n,optionsRef:o,onRemove:r,onClose:i,viewRef:a}){let s=l=>{let u=a.current;if(!u)return;let{$from:d,from:c}=u.state.selection,p=u.state.storedMarks||d.marks(),f=ye.nodes.field.create({fieldType:l,instruction:` ${l} \\* MERGEFORMAT `,fieldKind:"simple",dirty:true}),m=u.state.tr.insert(c,f.mark(p));u.dispatch(m),u.focus();};return jsxRuntime.jsxs("div",{style:{position:"relative"},ref:o,children:[jsxRuntime.jsx("button",{type:"button",style:ig,onClick:l=>{l.stopPropagation(),n(u=>!u);},onMouseDown:l=>l.stopPropagation(),children:"Options \u25BE"}),t&&jsxRuntime.jsxs("div",{style:ag,children:[jsxRuntime.jsx("button",{type:"button",style:Ti,onClick:()=>{n(false),s("PAGE");},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:"Insert current page number"}),jsxRuntime.jsx("button",{type:"button",style:Ti,onClick:()=>{n(false),s("NUMPAGES");},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:"Insert total page count"}),jsxRuntime.jsx("div",{style:{borderTop:"1px solid #e8eaed",margin:"4px 0"}}),r&&jsxRuntime.jsxs("button",{type:"button",style:Ti,onClick:()=>{n(false),r();},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:["Remove ",e.toLowerCase()]}),jsxRuntime.jsxs("button",{type:"button",style:Ti,onClick:()=>{n(false),i();},onMouseOver:l=>{l.target.style.backgroundColor="#f1f3f4";},onMouseOut:l=>{l.target.style.backgroundColor="transparent";},children:["Close ",e.toLowerCase()," editing"]})]})]})}var ke=e=>({style:"single",size:4,color:{rgb:e}}),sg=[{id:"TableNormal",name:"Normal Table",look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGrid",name:"Table Grid",tableBorders:{top:ke("000000"),bottom:ke("000000"),left:ke("000000"),right:ke("000000"),insideH:ke("000000"),insideV:ke("000000")},look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGridLight",name:"Grid Table Light",tableBorders:{top:ke("BFBFBF"),bottom:ke("BFBFBF"),left:ke("BFBFBF"),right:ke("BFBFBF"),insideH:ke("BFBFBF"),insideV:ke("BFBFBF")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ke("000000")}}}},{id:"PlainTable1",name:"Plain Table 1",tableBorders:{top:ke("BFBFBF"),bottom:ke("BFBFBF"),insideH:ke("BFBFBF")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true}}},{id:"PlainTable2",name:"Plain Table 2",look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ke("7F7F7F")}},band1Horz:{backgroundColor:"#F2F2F2"}}},{id:"PlainTable3",name:"Plain Table 3",look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#A5A5A5"},band1Horz:{backgroundColor:"#E7E7E7"}}},{id:"PlainTable4",name:"Plain Table 4",look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#000000"},band1Horz:{backgroundColor:"#F2F2F2"}}},{id:"GridTable1Light-Accent1",name:"Grid Table 1 Light",tableBorders:{top:ke("B4C6E7"),bottom:ke("B4C6E7"),left:ke("B4C6E7"),right:ke("B4C6E7"),insideH:ke("B4C6E7"),insideV:ke("B4C6E7")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ke("4472C4")}}}},{id:"GridTable4-Accent1",name:"Grid Table 4 Accent 1",tableBorders:{top:ke("4472C4"),bottom:ke("4472C4"),left:ke("4472C4"),right:ke("4472C4"),insideH:ke("4472C4"),insideV:ke("4472C4")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#4472C4"},band1Horz:{backgroundColor:"#D6E4F0"}}},{id:"GridTable5Dark-Accent1",name:"Grid Table 5 Dark",tableBorders:{top:ke("FFFFFF"),bottom:ke("FFFFFF"),left:ke("FFFFFF"),right:ke("FFFFFF"),insideH:ke("FFFFFF"),insideV:ke("FFFFFF")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#4472C4"},band1Horz:{backgroundColor:"#D6E4F0"},band2Horz:{backgroundColor:"#B4C6E7"}}},{id:"ListTable3-Accent2",name:"List Table 3 Accent 2",tableBorders:{top:ke("ED7D31"),bottom:ke("ED7D31")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#ED7D31"},band1Horz:{backgroundColor:"#FBE4D5"}}},{id:"ListTable4-Accent3",name:"List Table 4 Accent 3",tableBorders:{top:ke("A5A5A5"),bottom:ke("A5A5A5"),insideH:ke("A5A5A5")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#A5A5A5"},band1Horz:{backgroundColor:"#EDEDED"}}},{id:"GridTable4-Accent5",name:"Grid Table 4 Accent 5",tableBorders:{top:ke("5B9BD5"),bottom:ke("5B9BD5"),left:ke("5B9BD5"),right:ke("5B9BD5"),insideH:ke("5B9BD5"),insideV:ke("5B9BD5")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#5B9BD5"},band1Horz:{backgroundColor:"#DEEAF6"}}},{id:"GridTable4-Accent6",name:"Grid Table 4 Accent 6",tableBorders:{top:ke("70AD47"),bottom:ke("70AD47"),left:ke("70AD47"),right:ke("70AD47"),insideH:ke("70AD47"),insideV:ke("70AD47")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#70AD47"},band1Horz:{backgroundColor:"#E2EFDA"}}}];function kd(e){return sg.find(t=>t.id===e)}function Cd(){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:"20px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx("div",{style:{width:"36px",height:"36px",border:"3px solid var(--doc-border)",borderTopColor:"var(--doc-primary)",borderRadius:"50%",animation:"docx-spin 0.8s linear infinite"}}),jsxRuntime.jsx("style",{children:`
|
|
15
|
+
@keyframes docx-spin {
|
|
16
|
+
to { transform: rotate(360deg); }
|
|
17
|
+
}
|
|
18
|
+
`}),jsxRuntime.jsx("div",{style:{fontSize:"14px"},children:"Loading document..."})]})}function wd(){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-placeholder)"},children:[jsxRuntime.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"})]}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"No document loaded"})]})}function Td({message:e}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",textAlign:"center"},children:[jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",marginBottom:"16px"},children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 8v4M12 16v.01"})]})}),jsxRuntime.jsx("h3",{style:{color:"var(--doc-error)",marginBottom:"8px"},children:"Failed to Load Document"}),jsxRuntime.jsx("p",{style:{color:"var(--doc-text-muted)",maxWidth:"400px"},children:e})]})}function cg(e,t){return JSON.stringify(e)===JSON.stringify(t)}function dg(e,t={}){let{maxEntries:n=100,groupingInterval:o=500,enableKeyboardShortcuts:r=true,isEqual:i=cg,onUndo:a,onRedo:s,containerRef:l}=t,[u,d]=Nu.useState(e),[c,p]=Nu.useState([]),[f,m]=Nu.useState([]),b=Nu.useRef(0),g=Nu.useRef(false),S=Nu.useCallback((L,W)=>{if(i(u,L))return;if(g.current){d(L);return}let O=Date.now();O-b.current<o&&c.length>0?p(w=>{let B=[...w];return B[B.length-1]={state:u,timestamp:O,description:W||B[B.length-1].description},B}):p(w=>{let B={state:u,timestamp:O,description:W},te=[...w,B];return te.length>n?te.slice(te.length-n):te}),m([]),d(L),b.current=O;},[u,i,o,n,c.length]),C=Nu.useCallback(()=>{if(c.length===0)return;g.current=true;let L=c[c.length-1];return p(W=>W.slice(0,-1)),m(W=>[...W,{state:u,timestamp:Date.now()}]),d(L.state),setTimeout(()=>{g.current=false;},0),a?.(L.state),L.state},[c,u,a]),k=Nu.useCallback(()=>{if(f.length===0)return;g.current=true;let L=f[f.length-1];return m(W=>W.slice(0,-1)),p(W=>[...W,{state:u,timestamp:Date.now()}]),d(L.state),setTimeout(()=>{g.current=false;},0),s?.(L.state),L.state},[f,u,s]),E=Nu.useCallback(()=>{p([]),m([]);},[]),R=Nu.useCallback(L=>{d(L??e),p([]),m([]),b.current=0;},[e]),_=Nu.useCallback(()=>[...c],[c]),V=Nu.useCallback(()=>[...f],[f]),$=Nu.useCallback(L=>{d(W=>L(W)),p(W=>W.map(O=>({...O,state:L(O.state)}))),m(W=>W.map(O=>({...O,state:L(O.state)})));},[]);return Nu.useEffect(()=>{if(!r)return;let L=O=>{if((O.ctrlKey||O.metaKey)&&O.key==="z"&&!O.shiftKey){O.preventDefault(),C();return}if((O.ctrlKey||O.metaKey)&&O.key==="y"||(O.ctrlKey||O.metaKey)&&O.key==="z"&&O.shiftKey){O.preventDefault(),k();return}},W=l?.current||document;return W.addEventListener("keydown",L),()=>{W.removeEventListener("keydown",L);}},[r,C,k,l]),{state:u,canUndo:c.length>0,canRedo:f.length>0,undoCount:c.length,redoCount:f.length,push:S,undo:C,redo:k,clear:E,reset:R,getUndoStack:_,getRedoStack:V,transformAll:$}}function Rd(e,t={}){let n=Nu.useCallback((o,r)=>!(o?.package?.document!==r?.package?.document&&JSON.stringify(o?.package?.document)!==JSON.stringify(r?.package?.document)||o?.package?.headers!==r?.package?.headers||o?.package?.footers!==r?.package?.footers),[]);return dg(e,{...t,isEqual:n})}var wn=new prosemirrorState.PluginKey("suggestionMode"),vi="suggestionModeApplied",fg=Date.now();function Ri(e){return {revisionId:fg++,author:e.author,date:new Date().toISOString()}}function Za(e,t,n,o){try{let r=e.resolve(t);for(let i of [r.nodeBefore,r.nodeAfter])if(i?.isText){let a=i.marks.find(s=>s.type.name===n&&s.attrs.author===o);if(a)return a.attrs}}catch{}return null}function Ed(e,t,n,o,r,i,a){let s=[];if(t.nodesBetween(n,o,(u,d)=>{if(!u.isText)return;let c=Math.max(d,n),p=Math.min(d+u.nodeSize,o);if(c>=p)return;let f=u.marks.some(m=>m.type===r&&m.attrs.author===a.author);s.push({from:c,to:p,isOwnInsert:f});}),s.length===0)return;let l=Za(t,n,"deletion",a.author)||Ri(a);for(let u=s.length-1;u>=0;u--){let d=s[u];d.isOwnInsert?e.delete(d.from,d.to):e.addMark(d.from,d.to,i.create(l));}}function Pd(e,t,n,o,r){let i=e.state.schema.marks.insertion;if(!i)return false;let a=e.state.tr;a.setMeta(vi,true);let s=Za(e.state.doc,t,"insertion",r.author)||Ri(r);if(t!==n){let u=e.state.schema.marks.deletion;u&&Ed(a,e.state.doc,t,n,i,u,r);}let l=a.mapping.map(n);return a.insertText(o,l,l),a.addMark(l,l+o.length,i.create(s)),e.dispatch(a.scrollIntoView()),true}function Md(e,t,n){let o=wn.getState(e);if(!o?.active)return false;let{$from:r,$to:i,empty:a}=e.selection,s=e.schema.marks.insertion,l=e.schema.marks.deletion;if(!s||!l)return false;if(!t)return true;let u=e.tr;if(u.setMeta(vi,true),!a){Ed(u,e.doc,r.pos,i.pos,s,l,o);let S=u.mapping.map(i.pos);return u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(S))),t(u.scrollIntoView()),true}let d=n==="backward",c=d?r.pos-1:r.pos,p=d?r.pos:r.pos+1;if(c<0||p>e.doc.content.size)return true;let m=e.doc.resolve(c).nodeAfter;if(!m?.isText)return false;let b=m.marks.some(S=>S.type===s&&S.attrs.author===o.author);if(m.marks.some(S=>S.type===l)){let S=d?c:p;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(S)));}else if(b)u.delete(c,p);else {let S=Za(e.doc,c,"deletion",o.author)||Ri(o);u.addMark(c,p,l.create(S));let C=d?c:p;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(C)));}return t(u.scrollIntoView()),true}function Id(e=false,t="User"){return new prosemirrorState.Plugin({key:wn,state:{init(){return {active:e,author:t}},apply(n,o){let r=n.getMeta(wn);return r?{...o,...r}:o}},props:{handleDOMEvents:{beforeinput(n,o){let r=wn.getState(n.state);if(!r?.active)return false;if(o.inputType==="insertText"&&o.data){o.preventDefault();let{from:i,to:a}=n.state.selection;return Pd(n,i,a,o.data,r)}return false}},handleKeyDown(n,o){return wn.getState(n.state)?.active?o.key==="Backspace"?Md(n.state,n.dispatch,"backward"):o.key==="Delete"?Md(n.state,n.dispatch,"forward"):false:false},handleTextInput(n,o,r,i){let a=wn.getState(n.state);return a?.active?Pd(n,o,r,i,a):false}},appendTransaction(n,o,r){let i=wn.getState(r);if(!i?.active)return null;let a=n.find(c=>c.docChanged&&!c.getMeta(vi));if(!a)return null;let s=r.schema.marks.insertion;if(!s)return null;let l=Ri(i),u=r.tr;u.setMeta(vi,true);let d=r.schema.marks.deletion;return a.steps.forEach(c=>{c.getMap().forEach((f,m,b,g)=>{g>b&&r.doc.nodesBetween(b,g,(S,C)=>{if(!S.isText)return;if(!S.marks.some(E=>E.type===s||d&&E.type===d)){let E=Math.max(C,b),R=Math.min(C+S.nodeSize,g);u.addMark(E,R,s.create(l));}});});}),u.steps.length>0?u:null}})}function Fd(e,t,n,o){if(n){let r={active:e};o!==void 0&&(r.author=o);let i=t.tr.setMeta(wn,r);n(i);}return true}var Cg={position:"fixed",left:"-9999px",top:"0",opacity:0,zIndex:-1,pointerEvents:"none",userSelect:"none",overflowAnchor:"none"};function Dd(e,t,n,o=[]){let r=n?.getSchema()??ye,i=e?kr(e,{styles:t??void 0}):wr(),a=[...o,...n?.getPlugins()??[]];return prosemirrorState.EditorState.create({doc:i,schema:r,plugins:a})}function wg(e,t){return t?Tr(e.doc,t):null}var Tg=Nu.forwardRef(function(t,n){let{document:o,styles:r,theme:i,widthPx:a=612,readOnly:s=false,onTransaction:l,onSelectionChange:u,externalPlugins:d=[],extensionManager:c,onEditorViewReady:p,onEditorViewDestroy:f,onKeyDown:m}=t,b=Nu.useRef(null),g=Nu.useRef(null),S=Nu.useRef(o),C=Nu.useRef(false),k=Nu.useRef(null),E=Nu.useRef(false),R=Nu.useRef(l),_=Nu.useRef(u),V=Nu.useRef(p),$=Nu.useRef(f),L=Nu.useRef(m);R.current=l,_.current=u,V.current=p,$.current=f,L.current=m,S.current=o;let W=Nu.useCallback(()=>{if(!b.current||C.current)return;let w={state:Dd(o,r,c,d),editable:()=>!s,dispatchTransaction:B=>{if(!g.current||C.current)return;let te=g.current.state.apply(B);g.current.updateState(te),R.current?.(B,te),(B.selectionSet||B.docChanged)&&_.current?.(te);},handleKeyDown:(B,te)=>L.current?.(B,te)??false,handleDOMEvents:{focus:()=>false,blur:()=>false}};g.current=new prosemirrorView.EditorView(b.current,w),V.current?.(g.current);},[o,r,d,c,s]),O=Nu.useCallback(()=>{g.current&&!C.current&&(C.current=true,$.current?.(),g.current.destroy(),g.current=null,C.current=false);},[]);return Nu.useEffect(()=>(W(),()=>O()),[]),Nu.useEffect(()=>{if(!g.current||C.current)return;let w=(te=>{if(!te)return "empty";let he=te.package?.properties;return `${he?.created||""}-${he?.modified||""}-${he?.title||""}`})(o);if(E.current&&w===k.current)return;E.current=true,k.current=w;let B=Dd(o,r,c,d);g.current.updateState(B),_.current?.(B);},[o,r,c,d]),Nu.useEffect(()=>{g.current;},[s]),Nu.useImperativeHandle(n,()=>({getState(){return g.current?.state??null},getView(){return g.current??null},getDocument(){return g.current?wg(g.current.state,S.current):null},focus(){g.current?.focus();},blur(){g.current?.hasFocus()&&g.current.dom.blur();},isFocused(){return g.current?.hasFocus()??false},dispatch(K){g.current&&!C.current&&g.current.dispatch(K);},executeCommand(K){return g.current?K(g.current.state,g.current.dispatch,g.current):false},undo(){return g.current?prosemirrorHistory.undo(g.current.state,g.current.dispatch):false},redo(){return g.current?prosemirrorHistory.redo(g.current.state,g.current.dispatch):false},canUndo(){return g.current?prosemirrorHistory.undo(g.current.state):false},canRedo(){return g.current?prosemirrorHistory.redo(g.current.state):false},setSelection(K,w){if(!g.current)return;let{state:B,dispatch:te}=g.current,he=B.doc.resolve(K),me=w!==void 0?B.doc.resolve(w):he,Ie=prosemirrorState.TextSelection.between(he,me);te(B.tr.setSelection(Ie));},setNodeSelection(K){if(!g.current)return;let{state:w,dispatch:B}=g.current;try{let te=prosemirrorState.NodeSelection.create(w.doc,K);B(w.tr.setSelection(te));}catch{this.setSelection(K);}},setCellSelection(K,w){if(!g.current)return;let{state:B,dispatch:te}=g.current;try{let he=prosemirrorTables.CellSelection.create(B.doc,K,w);te(B.tr.setSelection(he));}catch{this.setSelection(K,w);}},scrollToSelection(){}}),[]),jsxRuntime.jsx("div",{ref:b,className:"paged-editor__hidden-pm",style:{...Cg,width:a>0?`${a}px`:void 0}})}),Hd=Nu.memo(Tg);var Mg="#000",Eg="rgba(66, 133, 244, 0.3)",Ig=2,Fg=530,Lg={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10,overflow:"hidden"},Bg=(e,t,n,o)=>({position:"absolute",left:e.x,top:e.y,width:n,height:e.height,backgroundColor:t,opacity:o?1:0,transition:"opacity 0.05s ease-out",pointerEvents:"none"}),Ag=(e,t)=>({position:"absolute",left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:t,pointerEvents:"none"}),Dg=({position:e,color:t,width:n,blinkInterval:o,isFocused:r})=>{let[i,a]=Nu.useState(r),s=Nu.useRef(null);return Nu.useEffect(()=>(s.current&&(window.clearInterval(s.current),s.current=null),r&&o>0?(a(true),s.current=window.setInterval(()=>{a(l=>!l);},o)):a(false),()=>{s.current&&window.clearInterval(s.current);}),[r,o]),Nu.useEffect(()=>{if(r)return a(true),s.current&&window.clearInterval(s.current),o>0&&(s.current=window.setInterval(()=>{a(l=>!l);},o)),()=>{s.current&&window.clearInterval(s.current);}},[e.x,e.y,r,o]),jsxRuntime.jsx("div",{style:Bg(e,t,n,i),"data-testid":"caret"})},Hg=({rect:e,color:t,index:n})=>jsxRuntime.jsx("div",{style:Ag(e,t),"data-testid":`selection-rect-${n}`,"data-page-index":e.pageIndex}),zd=({selectionRects:e,caretPosition:t,isFocused:n,readOnly:o=false,caretColor:r=Mg,selectionColor:i=Eg,caretWidth:a=Ig,blinkInterval:s=Fg})=>{if(o)return null;let l=e.length>0,u=t!==null&&!l;return jsxRuntime.jsxs("div",{style:Lg,"data-testid":"selection-overlay",children:[l&&e.map((d,c)=>jsxRuntime.jsx(Hg,{rect:d,color:i,index:c},`sel-${d.pageIndex}-${d.x}-${d.y}-${c}`)),u&&t&&jsxRuntime.jsx(Dg,{position:t,color:r,width:a,blinkInterval:s,isFocused:n})]})};var es=10,Tn=es/2,Wo=2,_d="#2563eb",$d={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:15,overflow:"visible"},zg={position:"absolute",border:`${Wo}px solid ${_d}`,pointerEvents:"none",boxSizing:"border-box"},Og={position:"absolute",width:`${es}px`,height:`${es}px`,backgroundColor:_d,border:"1px solid white",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.3)",boxSizing:"border-box",pointerEvents:"auto",zIndex:16},$g={position:"absolute",backgroundColor:"rgba(0, 0, 0, 0.75)",color:"white",fontSize:"11px",fontFamily:"system-ui, sans-serif",padding:"2px 8px",borderRadius:"3px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:20,transform:"translateX(-50%)"},Wg={nw:"nw-resize",ne:"ne-resize",se:"se-resize",sw:"sw-resize"};function _g(e,t,n,o,r,i){let a=e.includes("w")?-1:1,s=e.includes("n")?-1:1,l=o+t*a,u=r+n*s;if(i){let d=Math.max(l/o,u/r);l=o*d,u=r*d;}return {width:Math.max(20,Math.min(2e3,l)),height:Math.max(20,Math.min(2e3,u))}}function Vd({imageInfo:e,zoom:t,isFocused:n,onResize:o,onResizeStart:r,onResizeEnd:i,onDragMove:a,onDragStart:s,onDragEnd:l}){let[u,d]=Nu.useState(false),[c,p]=Nu.useState(false),[f,m]=Nu.useState(0),[b,g]=Nu.useState(0),[S,C]=Nu.useState(null),k=Nu.useRef(null),E=Nu.useRef(null),R=Nu.useRef(o),_=Nu.useRef(r),V=Nu.useRef(i),$=Nu.useRef(a),L=Nu.useRef(s),W=Nu.useRef(l);R.current=o,_.current=r,V.current=i,$.current=a,L.current=s,W.current=l;let O=Nu.useRef(e),K=Nu.useRef(t);O.current=e,K.current=t;let w=Nu.useCallback(()=>{if(!e||!E.current){C(null);return}let P=E.current.offsetParent;if(!P){C(null);return}let I=P.getBoundingClientRect(),y=e.element.getBoundingClientRect();C({left:(y.left-I.left)/t,top:(y.top-I.top)/t,width:y.width/t,height:y.height/t});},[e,t]);Nu.useEffect(()=>{w();},[w]),Nu.useEffect(()=>{if(!e)return;let P=E.current?.closest('[style*="overflow"]')??E.current?.closest(".paged-editor__container");if(!P)return;let I=()=>{k.current&&cancelAnimationFrame(k.current),k.current=requestAnimationFrame(w);};return P.addEventListener("scroll",I,{passive:true}),window.addEventListener("resize",I,{passive:true}),()=>{P.removeEventListener("scroll",I),window.removeEventListener("resize",I),k.current&&cancelAnimationFrame(k.current);}},[e,w]);let B=Nu.useCallback((P,I)=>{if(!e||!S)return;I.preventDefault(),I.stopPropagation();let y=S.width,M=S.height,F=I.clientX,A=I.clientY,U=Math.round(y),Q=Math.round(M);d(true),m(U),g(Q),_.current?.();let N=G=>{let xe=K.current,v=(G.clientX-F)/xe,z=(G.clientY-A)/xe,D=!G.shiftKey,se=_g(P,v,z,y,M,D);U=Math.round(se.width),Q=Math.round(se.height),m(U),g(Q),C(ue=>{if(!ue)return ue;let pe={...ue};return P.includes("w")&&(pe.left=ue.left+(ue.width-se.width)),P.includes("n")&&(pe.top=ue.top+(ue.height-se.height)),pe.width=se.width,pe.height=se.height,pe});},j=()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",j),d(false);let G=O.current;G&&R.current?.(G.pmPos,U,Q),V.current?.();};window.addEventListener("mousemove",N),window.addEventListener("mouseup",j);},[e,S]),te=Nu.useCallback(P=>{if(!e||!S)return;P.preventDefault(),P.stopPropagation();let I=4,y=P.clientX,M=P.clientY,F=false,A=null,U=N=>{let j=N.clientX-y,G=N.clientY-M;!F&&Math.sqrt(j*j+G*G)<I||(F||(F=true,p(true),L.current?.(),A=document.createElement("div"),A.style.cssText="position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);",A.style.width=`${S.width}px`,A.style.height=`${S.height}px`,document.body.appendChild(A)),A&&(A.style.left=`${N.clientX-S.width/2}px`,A.style.top=`${N.clientY-S.height/2}px`));},Q=N=>{if(window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",Q),A&&(A.remove(),A=null),p(false),F){let j=O.current;j&&$.current?.(j.pmPos,N.clientX,N.clientY),W.current?.();}};window.addEventListener("mousemove",U),window.addEventListener("mouseup",Q);},[e,S]);if(!!!(e&&S&&n))return jsxRuntime.jsx("div",{ref:E,style:{...$d,visibility:"hidden"},className:"image-selection-overlay"});let{left:me,top:Ie,width:Te,height:Re}=S;return jsxRuntime.jsxs("div",{ref:E,style:$d,className:"image-selection-overlay",children:[jsxRuntime.jsx("div",{style:{...zg,left:me-Wo,top:Ie-Wo,width:Te+Wo*2,height:Re+Wo*2}}),jsxRuntime.jsx("div",{style:{position:"absolute",left:me,top:Ie,width:Te,height:Re,cursor:c?"grabbing":"grab",pointerEvents:"auto",zIndex:15},onMouseDown:te}),jsxRuntime.jsx(Mi,{handle:"nw",style:{left:me-Tn,top:Ie-Tn},onMouseDown:B}),jsxRuntime.jsx(Mi,{handle:"ne",style:{left:me+Te-Tn,top:Ie-Tn},onMouseDown:B}),jsxRuntime.jsx(Mi,{handle:"se",style:{left:me+Te-Tn,top:Ie+Re-Tn},onMouseDown:B}),jsxRuntime.jsx(Mi,{handle:"sw",style:{left:me-Tn,top:Ie+Re-Tn},onMouseDown:B}),u&&jsxRuntime.jsxs("div",{style:{...$g,left:me+Te/2,top:Ie+Re+12},children:[f," \xD7 ",b]})]})}function Mi({handle:e,style:t,onMouseDown:n}){return jsxRuntime.jsx("div",{style:{...Og,...t,cursor:Wg[e]},onMouseDown:o=>n(e,o),"data-handle":e})}function Vg(e,t,n,o){let r=e-t-n,i=(o.count-1)*o.gap;return (r-i)/o.count}function ts(e){let{pageSize:t,margins:n,columns:o={count:1,gap:0}}=e,r=[],i=[],a=n.top,s=t.h-n.bottom;if(s-a<=0)throw new Error("Paginator: page size and margins yield no content area");let u=Vg(t.w,n.left,n.right,o);function d(E){return n.left+E*(u+o.gap)}function c(){let E=r.length+1,R=e.footnoteReservedHeights?.get(E)??0,_=s-R,V={number:E,fragments:[],margins:{...n},size:{...t},footnoteReservedHeight:R>0?R:void 0},$={page:V,cursorY:a,columnIndex:0,topMargin:a,contentBottom:_,trailingSpacing:0};return r.push(V),i.push($),e.onNewPage&&e.onNewPage($),$}function p(){return i.length===0?c():i[i.length-1]}function f(E){return E.contentBottom-E.cursorY}function m(E,R){let _=R||p();return f(_)>=E}function b(E){return E.columnIndex<o.count-1?(E.columnIndex+=1,E.cursorY=E.topMargin,E.trailingSpacing=0,E):c()}function g(E){let R=p(),_=Number.isFinite(E)&&E>0?E:0,V=R.contentBottom-R.topMargin;if(_>V)return R.cursorY!==R.topMargin&&(R=b(R)),R;for(;!m(_,R);)R=b(R);return R}function S(E,R,_=0,V=0){let $=Math.max(_,p().trailingSpacing),L=$+R,W=g(L),K=W.cursorY===W.topMargin?0:$,w=d(W.columnIndex),B=W.cursorY+K;return E.x=w,E.y=B,W.page.fragments.push(E),W.cursorY=B+R,W.trailingSpacing=V,{state:W,x:w,y:B}}function C(){return c()}function k(){let E=p();return b(E)}return {pages:r,states:i,columnWidth:u,getCurrentState:p,getAvailableHeight:()=>f(p()),fits:E=>m(E),ensureFits:g,addFragment:S,forcePageBreak:C,forceColumnBreak:k,getColumnX:d}}function ns(e){let t=new Map,n=new Set;for(let o=0;o<e.length;o++){if(n.has(o))continue;let r=e[o];if(r.kind!=="paragraph"||!r.attrs?.keepNext)continue;let a=[o],s=o;for(let d=o+1;d<e.length;d++){let c=e[d];if(c.kind==="sectionBreak"||c.kind==="pageBreak"||c.kind==="columnBreak"||c.kind!=="paragraph")break;if(c.attrs?.keepNext)a.push(d),s=d,n.add(d);else break}let l=s+1,u=-1;if(l<e.length){let d=e[l];d.kind!=="sectionBreak"&&d.kind!=="pageBreak"&&d.kind!=="columnBreak"&&(u=l);}t.set(o,{startIndex:o,endIndex:s,memberIndices:a,anchorIndex:u});}return t}function os(e,t,n){let o=0;for(let r of e.memberIndices){let i=t[r],a=n[r];if(i.kind!=="paragraph"||a.kind!=="paragraph")continue;let s=i,l=a,u=s.attrs?.spacing?.before??0;o+=u,o+=l.totalHeight;let d=s.attrs?.spacing?.after??0;o+=d;}if(e.anchorIndex!==-1){let r=n[e.anchorIndex];if(r?.kind==="paragraph"){let i=r;i.lines.length>0&&(o+=i.lines[0].lineHeight);}}return o}function rs(e){let t=new Set;for(let n of e.values())for(let o=1;o<n.memberIndices.length;o++)t.add(n.memberIndices[o]);return t}function is(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var jg={w:816,h:1056},co={top:96,right:96,bottom:96,left:96};function jd(e){return e.attrs?.spacing?.before??0}function Ud(e){return e.attrs?.spacing?.after??0}function Ug(e){for(let t=0;t<e.length-1;t++){let n=e[t],o=e[t+1];if(n.kind!=="paragraph"||o.kind!=="paragraph")continue;let r=n.attrs,i=o.attrs;r?.contextualSpacing&&i?.contextualSpacing&&r.styleId&&r.styleId===i.styleId&&(r.spacing&&(r.spacing={...r.spacing,after:0}),i.spacing&&(i.spacing={...i.spacing,before:0}));}}function Ei(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let o=n.pageSize??jg,r={top:n.margins?.top??co.top,right:n.margins?.right??co.right,bottom:n.margins?.bottom??co.bottom,left:n.margins?.left??co.left,header:n.margins?.header??n.margins?.top??co.top,footer:n.margins?.footer??n.margins?.bottom??co.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let i={...r},a=o.w-i.left-i.right;if(a<=0)throw new Error("layoutDocument: page size and margins yield no content area");let s=ts({pageSize:o,margins:i,columns:n.columns,footnoteReservedHeights:n.footnoteReservedHeights});Ug(e);let l=ns(e),u=rs(l);for(let d=0;d<e.length;d++){let c=e[d],p=t[d];is(c)&&s.forcePageBreak();let f=l.get(d);if(f&&!u.has(d)){let m=os(f,e,t),b=s.getCurrentState(),g=s.getAvailableHeight(),S=b.contentBottom-b.topMargin;m<=S&&m>g&&b.page.fragments.length>0&&s.forcePageBreak();}switch(c.kind){case "paragraph":Gg(c,p,s,a);break;case "table":c.floating?Yg(c,p,s,a):Kg(c,p,s);break;case "image":qg(c,p,s);break;case "pageBreak":s.forcePageBreak();break;case "columnBreak":s.forceColumnBreak();break;case "sectionBreak":Zg(c,s);break}}return s.pages.length===0&&s.getCurrentState(),{pageSize:o,pages:s.pages,columns:n.columns,pageGap:n.pageGap}}function Gg(e,t,n,o){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let r=t.lines;if(r.length===0){let l=jd(e),u=Ud(e),d=n.getCurrentState(),c={kind:"paragraph",blockId:e.id,x:n.getColumnX(d.columnIndex),y:d.cursorY+l,width:o,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};n.addFragment(c,0,l,u);return}let i=jd(e),a=Ud(e),s=0;for(;s<r.length;){let l=n.getCurrentState(),u=n.getAvailableHeight(),d=0,c=0;for(let C=s;C<r.length;C++){let k=r[C].lineHeight,E=d+k;if((s===0&&C===s?E+i:E)<=u||c===0)d=E,c++;else break}let p=s===0,f=s+c>=r.length,m=p?i:0,b=f?a:0,g={kind:"paragraph",blockId:e.id,x:n.getColumnX(l.columnIndex),y:0,width:o,height:d,fromLine:s,toLine:s+c,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!p,continuesOnNext:!f},S=n.addFragment(g,d,m,b);g.y=S.y,s+=c,s<r.length&&n.ensureFits(r[s].lineHeight);}}function Kg(e,t,n){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let o=t.rows;if(o.length===0)return;let r=0;for(;r<o.length;){let i=n.getCurrentState(),a=n.getAvailableHeight(),s=0,l=0;for(let m=r;m<o.length;m++){let b=o[m].height,g=s+b;if(g<=a||l===0)s=g,l++;else break}let u=r===0,d=r+l>=o.length,c=n.getColumnX(i.columnIndex);e.justification==="center"?c=c+(n.columnWidth-t.totalWidth)/2:e.justification==="right"&&(c=c+n.columnWidth-t.totalWidth);let p={kind:"table",blockId:e.id,x:c,y:0,width:t.totalWidth,height:s,fromRow:r,toRow:r+l,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!u,continuesOnNext:!d},f=n.addFragment(p,s,0,0);p.y=f.y,p.x=c,r+=l,r<o.length&&n.ensureFits(o[r].height);}}function Yg(e,t,n,o){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let r=n.getCurrentState(),i=e.floating,a=r.page,s=a.margins,l=t.totalWidth,u=t.totalHeight,d=a.size.h-s.top-s.bottom,c=s.left,p=s.top;i?.horzAnchor==="page"&&(c=0),i?.vertAnchor==="page"&&(p=0);let f=n.getColumnX(r.columnIndex);if(i?.tblpX!==void 0)f=c+i.tblpX;else if(i?.tblpXSpec){let k=i.tblpXSpec;k==="left"||k==="inside"?f=c:k==="right"||k==="outside"?f=c+o-l:k==="center"&&(f=c+(o-l)/2);}else e.justification==="center"?f=c+(o-l)/2:e.justification==="right"&&(f=c+o-l);let m=r.cursorY,b=false;if(i?.tblpY!==void 0)m=p+i.tblpY,b=true;else if(i?.tblpYSpec){b=true;let k=i.tblpYSpec;k==="top"?m=p:k==="bottom"?m=p+d-u:k==="center"&&(m=p+(d-u)/2);}b||(m=n.ensureFits(u).cursorY);let g=s.left,S=s.left+o-l;Number.isFinite(S)&&(f=Math.max(g,Math.min(f,S)));let C={kind:"table",blockId:e.id,x:f,y:m,width:l,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};r.page.fragments.push(C);}function qg(e,t,n){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Xg(e,t,n);return}let o=n.ensureFits(t.height),r={kind:"image",blockId:e.id,x:n.getColumnX(o.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},i=n.addFragment(r,t.height,0,0);r.y=i.y;}function Xg(e,t,n){let o=n.getCurrentState(),r=e.anchor,i=r.offsetH??n.getColumnX(o.columnIndex),a=r.offsetV??o.cursorY,s={kind:"image",blockId:e.id,x:i,y:a,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:r.behindDoc?-1:1};o.page.fragments.push(s);}function Zg(e,t){switch(e.type??"continuous"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}}var Jg="Calibri";function as(e,t,n){if(!n||t<=n)return {width:e,height:t};let o=n/t;return {width:Math.round(e*o),height:n}}var Qg=11;function pt(e){return e/1440*96}var eh=0;function uo(){return `block-${++eh}`}function th(e,t){let n=[];for(let o=0;o<=t;o+=1){let r=e[o]??0;if(r<=0)break;n.push(r);}return n.length===0?"1.":`${n.join(".")}.`}function Ii(e,t){let n={};for(let o of e)switch(o.type.name){case "bold":n.bold=true;break;case "italic":n.italic=true;break;case "underline":{let r=o.attrs;if(r.style||r.color){let i=r.color?chunkJRRTZZ72_cjs.a(r.color,t):void 0;n.underline={style:r.style,color:i};}else n.underline=true;break}case "strike":n.strike=true;break;case "textColor":{let r=o.attrs;(r.themeColor||r.rgb)&&(n.color=chunkJRRTZZ72_cjs.a({rgb:r.rgb,themeColor:r.themeColor,themeTint:r.themeTint,themeShade:r.themeShade},t));break}case "highlight":n.highlight=chunkJRRTZZ72_cjs.n(o.attrs.color);break;case "fontSize":{let r=o.attrs;n.fontSize=r.size/2;break}case "fontFamily":{let r=o.attrs;n.fontFamily=r.ascii||r.hAnsi;break}case "superscript":n.superscript=true;break;case "subscript":n.subscript=true;break;case "hyperlink":{let r=o.attrs;n.hyperlink={href:r.href,tooltip:r.tooltip};break}case "footnoteRef":{let r=o.attrs,i=typeof r.id=="string"?parseInt(r.id,10):r.id;r.noteType==="endnote"?n.endnoteRefId=i:n.footnoteRefId=i;break}case "comment":{let r=o.attrs.commentId;r&&(n.commentIds||(n.commentIds=[]),n.commentIds.push(r));break}case "insertion":n.isInsertion=true,n.changeAuthor=o.attrs.author,n.changeDate=o.attrs.date,n.changeRevisionId=o.attrs.revisionId;break;case "deletion":n.isDeletion=true,n.changeAuthor=o.attrs.author,n.changeDate=o.attrs.date,n.changeRevisionId=o.attrs.revisionId;break}return n}function nh(e,t,n){let o=[],r=t+1,i=n.theme;return e.forEach((a,s)=>{let l=r+s;if(a.isText&&a.text){let u=Ii(a.marks,i),d={kind:"text",text:a.text,...u,pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="hardBreak"){let u={kind:"lineBreak",pmStart:l,pmEnd:l+a.nodeSize};o.push(u);}else if(a.type.name==="tab"){let d={kind:"tab",...Ii(a.marks,i),pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="image"){let u=a.attrs,d=as(u.width||100,u.height||100,n.pageContentHeight),c={kind:"image",src:u.src,width:d.width,height:d.height,alt:u.alt,transform:u.transform,wrapType:u.wrapType,displayMode:u.displayMode,cssFloat:u.cssFloat,distTop:u.distTop,distBottom:u.distBottom,distLeft:u.distLeft,distRight:u.distRight,position:u.position,pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="field"){let u=a.attrs.fieldType,c={kind:"field",fieldType:u==="PAGE"?"PAGE":u==="NUMPAGES"?"NUMPAGES":u==="DATE"?"DATE":u==="TIME"?"TIME":"OTHER",fallback:a.attrs.displayText||"",pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="math"){let d={kind:"text",text:a.attrs.plainText||"[equation]",italic:true,fontFamily:"Cambria Math",pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="sdt"){let u=l+1;a.forEach((d,c)=>{let p=u+c;if(d.isText&&d.text){let f=Ii(d.marks,i),m={kind:"text",text:d.text,...f,pmStart:p,pmEnd:p+d.nodeSize};o.push(m);}else if(d.type.name==="hardBreak"){let f={kind:"lineBreak",pmStart:p,pmEnd:p+d.nodeSize};o.push(f);}else if(d.type.name==="tab"){let m={kind:"tab",...Ii(d.marks,i),pmStart:p,pmEnd:p+d.nodeSize};o.push(m);}else if(d.type.name==="image"){let f=d.attrs,m=as(f.width||100,f.height||100,n.pageContentHeight),b={kind:"image",src:f.src,width:m.width,height:m.height,alt:f.alt,transform:f.transform,wrapType:f.wrapType,displayMode:f.displayMode,cssFloat:f.cssFloat,distTop:f.distTop,distBottom:f.distBottom,distLeft:f.distLeft,distRight:f.distRight,position:f.position,pmStart:p,pmEnd:p+d.nodeSize};o.push(b);}});}}),o}function oh(e){let t={};if(e.alignment){let a=e.alignment;a==="both"||a==="distribute"?t.alignment="justify":a==="left"?t.alignment="left":a==="center"?t.alignment="center":a==="right"&&(t.alignment="right");}(e.spaceBefore!=null||e.spaceAfter!=null||e.lineSpacing!=null)&&(t.spacing={},e.spaceBefore!=null&&(t.spacing.before=pt(e.spaceBefore)),e.spaceAfter!=null&&(t.spacing.after=pt(e.spaceAfter)),e.lineSpacing!=null&&(e.lineSpacingRule==="exact"||e.lineSpacingRule==="atLeast"?(t.spacing.line=pt(e.lineSpacing),t.spacing.lineUnit="px",t.spacing.lineRule=e.lineSpacingRule):(t.spacing.line=e.lineSpacing/240,t.spacing.lineUnit="multiplier",t.spacing.lineRule="auto")));let n=e.indentLeft,o=e.indentFirstLine,r=e.hangingIndent;if(e.numPr?.numId&&n==null&&(n=((e.numPr.ilvl??0)+1)*720,o==null&&(o=-360,r=true)),(n!=null||e.indentRight!=null||o!=null)&&(t.indent={},n!=null&&(t.indent.left=pt(n)),e.indentRight!=null&&(t.indent.right=pt(e.indentRight)),o!=null&&(r?t.indent.hanging=Math.abs(pt(o)):t.indent.firstLine=pt(o))),e.styleId&&(t.styleId=e.styleId),e.borders){let a=e.borders;t.borders={};let s=l=>{if(!l||l.style==="none"||l.style==="nil")return;let u=l.size?Math.max(1,Math.round(l.size/8*1.333)):1,d="#000000";return l.color?.rgb&&(d=`#${l.color.rgb}`),{style:l.style||"single",width:u,color:d}};a.top&&(t.borders.top=s(a.top)),a.bottom&&(t.borders.bottom=s(a.bottom)),a.left&&(t.borders.left=s(a.left)),a.right&&(t.borders.right=s(a.right)),a.between&&(t.borders.between=s(a.between)),!t.borders.top&&!t.borders.bottom&&!t.borders.left&&!t.borders.right&&!t.borders.between&&delete t.borders;}e.shading?.fill?.rgb&&(t.shading=`#${e.shading.fill.rgb}`),e.tabs&&e.tabs.length>0&&(t.tabs=e.tabs.map(a=>({val:rh(a.alignment),pos:a.position,leader:a.leader}))),e.pageBreakBefore&&(t.pageBreakBefore=true),e.keepNext&&(t.keepNext=true),e.keepLines&&(t.keepLines=true),e.contextualSpacing&&(t.contextualSpacing=true),e.styleId&&(t.styleId=e.styleId),e.numPr&&(t.numPr={numId:e.numPr.numId,ilvl:e.numPr.ilvl}),e.listMarker&&(t.listMarker=e.listMarker),e.listIsBullet!=null&&(t.listIsBullet=e.listIsBullet);let i=e.defaultTextFormatting;return i&&(i.fontSize!=null&&(t.defaultFontSize=i.fontSize/2),i.fontFamily&&(t.defaultFontFamily=i.fontFamily.ascii||i.fontFamily.hAnsi)),t}function rh(e){switch(e){case "left":return "start";case "right":return "end";case "center":return "center";case "decimal":return "decimal";case "bar":return "bar";case "clear":return "clear";case "num":return "start";default:return "start"}}function Gd(e,t,n){let o=e.attrs,r=nh(e,t,n),i=oh(o);return {kind:"paragraph",id:uo(),runs:r,attrs:i,pmStart:t,pmEnd:t+e.nodeSize}}function ih(e){return Math.max(1,Math.round(e/8*1.333))}var ah={single:"solid",double:"double",dotted:"dotted",dashed:"dashed",thick:"solid",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dotted",triple:"double",wave:"solid",doubleWave:"double",threeDEmboss:"ridge",threeDEngrave:"groove",outset:"outset",inset:"inset"};function sh(e){let t=e.borders;if(!t)return;let n={},o=["top","bottom","left","right"];for(let r of o){let i=t[r];if(!i||!i.style||i.style==="none"||i.style==="nil"){n[r]={width:0,style:"none"};continue}let a={style:ah[i.style]||"solid"};i.color?.rgb&&(a.color=`#${i.color.rgb}`),i.size&&(a.width=ih(i.size)),n[r]=a;}return Object.keys(n).length>0?n:void 0}function lh(e,t,n){let o=[],r=t+1;e.forEach(l=>{l.type.name==="paragraph"?o.push(Gd(l,r,n)):l.type.name==="table"&&o.push(Kd(l,r,n)),r+=l.nodeSize;});let i=e.attrs,a=i.margins,s={top:a?.top!=null?pt(a.top):1,right:a?.right!=null?pt(a.right):7,bottom:a?.bottom!=null?pt(a.bottom):1,left:a?.left!=null?pt(a.left):7};return {id:uo(),blocks:o,colSpan:i.colspan,rowSpan:i.rowspan,width:i.width?pt(i.width):void 0,verticalAlign:i.verticalAlign,background:i.backgroundColor?`#${i.backgroundColor}`:void 0,borders:sh(i),padding:s}}function ch(e,t,n){let o=[],r=t+1;e.forEach(a=>{(a.type.name==="tableCell"||a.type.name==="tableHeader")&&o.push(lh(a,r,n)),r+=a.nodeSize;});let i=e.attrs;return {id:uo(),cells:o,height:i.height?pt(i.height):void 0,heightRule:i.heightRule??void 0,isHeader:i.isHeader}}function Kd(e,t,n){let o=[],r=t+1;e.forEach(p=>{p.type.name==="tableRow"&&o.push(ch(p,r,n)),r+=p.nodeSize;});let a=e.attrs.columnWidths?.map(pt),s=e.attrs.width,l=e.attrs.widthType;if(!a&&o.length>0){let f=o[0].cells.map(m=>m.width);f.every(m=>m!==void 0&&m>0)&&(a=f);}let u=e.attrs.justification,d=e.attrs.floating,c=d?{horzAnchor:d.horzAnchor,vertAnchor:d.vertAnchor,tblpX:d.tblpX!==void 0?pt(d.tblpX):void 0,tblpXSpec:d.tblpXSpec,tblpY:d.tblpY!==void 0?pt(d.tblpY):void 0,tblpYSpec:d.tblpYSpec,topFromText:d.topFromText!==void 0?pt(d.topFromText):void 0,bottomFromText:d.bottomFromText!==void 0?pt(d.bottomFromText):void 0,leftFromText:d.leftFromText!==void 0?pt(d.leftFromText):void 0,rightFromText:d.rightFromText!==void 0?pt(d.rightFromText):void 0}:void 0;return {kind:"table",id:uo(),rows:o,columnWidths:a,width:s,widthType:l,justification:u,floating:c,pmStart:t,pmEnd:t+e.nodeSize}}function dh(e,t,n){let o=e.attrs,r=o.wrapType,i=r==="behind"||r==="inFront",a=as(o.width||100,o.height||100,n);return {kind:"image",id:uo(),src:o.src,width:a.width,height:a.height,alt:o.alt,transform:o.transform,anchor:i?{isAnchored:true,offsetH:o.distLeft,offsetV:o.distTop,behindDoc:r==="behind"}:void 0,pmStart:t,pmEnd:t+e.nodeSize}}function Yd(e,t={}){let n={...t,defaultFont:t.defaultFont??Jg,defaultSize:t.defaultSize??Qg},o=[],r=0,i=new Map;return e.forEach((a,s)=>{let l=r+s;switch(a.type.name){case "paragraph":{let u=Gd(a,l,n),d=a.attrs;if(d.numPr&&!d.listMarker){let c=d.numPr.numId;if(c==null||c===0)break;let p=d.numPr.ilvl??0,f=i.get(c)??new Array(9).fill(0);f[p]=(f[p]??0)+1;for(let b=p+1;b<f.length;b+=1)f[b]=0;i.set(c,f);let m=d.listIsBullet?"\u2022":th(f,p);u.attrs={...u.attrs,listMarker:m};}o.push(u);}break;case "table":o.push(Kd(a,l,n));break;case "image":o.push(dh(a,l,n.pageContentHeight));break;case "horizontalRule":case "pageBreak":{let u={kind:"pageBreak",id:uo(),pmStart:l,pmEnd:l+a.nodeSize};o.push(u);break}}}),o}var pn=11,_o="Calibri",Fi=1,po=.5;function qd(e){return {fontFamily:e.fontFamily??_o,fontSize:e.fontSize??pn,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Qd(e,t,n){let o=chunk4CUGBNL2_cjs.h(e),r=n?.ascent??o*.8,i=n?.descent??o*.2,a=n?.singleLineRatio??1.15,s=o*a,l;if(t?.lineRule==="exact"&&t.line!==void 0)l=t.line;else if(t?.lineRule==="atLeast"&&t.line!==void 0){let u=s*Fi;l=Math.max(t.line,u);}else t?.line!==void 0&&t?.lineUnit==="multiplier"?l=s*t.line:t?.line!==void 0&&t?.lineUnit==="px"?l=t.line:l=s*Fi;return {ascent:r,descent:i,lineHeight:l}}function Xd(e,t,n){let o=chunk4CUGBNL2_cjs.d({fontSize:e,fontFamily:n??_o});return Qd(e,t,o)}function Zd(e){return e.kind==="text"}function ph(e){return e.kind==="tab"}function fh(e){return e.kind==="image"}function mh(e){return e.kind==="lineBreak"}function gh(e){return e.kind==="field"}function hh(e){return !e.text||e.text.length===0}function bh(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n];(o===" "||o==="-"||o===" ")&&t.push(n+1);}return t}var yh=48;function Jd(e,t,n,o){if(!n||n.length===0)return {leftMargin:0,rightMargin:0};let r=0,i=0,a=o+e,s=a+t;for(let l of n)s>l.topY&&a<l.bottomY&&(r=Math.max(r,l.leftMargin),i=Math.max(i,l.rightMargin));return {leftMargin:r,rightMargin:i}}function Vo(e,t,n){let o=e.runs,r=e.attrs,i=r?.spacing,a=n?.floatingZones,s=n?.paragraphYOffset??0,l=r?.indent,u=l?.left??0,d=l?.right??0,c=(l?.firstLine??0)-(l?.hanging??0),p=Math.max(1,t-u-d),f=Math.max(1,p-c),m=0,b=chunk4CUGBNL2_cjs.h(pn)*Fi,g=Jd(0,b,a,s),S=Math.max(1,f-g.leftMargin-g.rightMargin),C=[];if(o.length===0){let L=r?.defaultFontSize??pn,W=r?.defaultFontFamily??_o,O=Xd(L,i,W);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...O}),{kind:"paragraph",lines:C,totalHeight:O.lineHeight}}if(o.length===1&&Zd(o[0])&&hh(o[0])){let L=o[0],W=L.fontSize??r?.defaultFontSize??pn,O=L.fontFamily??r?.defaultFontFamily??_o,K=Xd(W,i,O);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...K}),{kind:"paragraph",lines:C,totalHeight:K.lineHeight}}let k={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:pn,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:S,leftOffset:g.leftMargin,rightOffset:g.rightMargin},E=()=>{let L=Qd(k.maxFontSize,i,k.maxFontMetrics),W={...L};k.maxImageHeightPx>W.lineHeight&&(W.lineHeight=k.maxImageHeightPx,W.ascent=k.maxImageHeightPx*.8,W.descent=k.maxImageHeightPx*.2);let O={fromRun:k.fromRun,fromChar:k.fromChar,toRun:k.toRun,toChar:k.toChar,width:k.width,...W};k.leftOffset>0&&(O.leftOffset=k.leftOffset),k.rightOffset>0&&(O.rightOffset=k.rightOffset),C.push(O),m+=L.lineHeight;},R=(L,W)=>{E();let O=chunk4CUGBNL2_cjs.h(pn)*Fi,K=Jd(m,O,a,s),w=Math.max(1,p-K.leftMargin-K.rightMargin);k={fromRun:L,fromChar:W,toRun:L,toChar:W,width:0,maxFontSize:pn,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:w,leftOffset:K.leftMargin,rightOffset:K.rightMargin};},_=L=>{let W=L.fontSize??pn;(!k.maxFontMetrics||W>k.maxFontSize)&&(k.maxFontSize=W,k.maxFontMetrics=chunk4CUGBNL2_cjs.d(L));};for(let L=0;L<o.length;L++){let W=o[L];if(mh(W)){k.toRun=L,k.toChar=0,R(L+1,0);continue}if(ph(W)){let O=qd(W);_(O);let K=W.width??yh;k.width+K>k.availableWidth+po&&(R(L,0),_(O)),k.width+=K,k.toRun=L,k.toChar=1;continue}if(fh(W)){let O=W.wrapType,K=W.displayMode==="float"||O&&["square","tight","through"].includes(O);if(W.position&&K){k.toRun=L,k.toChar=1;continue}if(O==="topAndBottom"||W.displayMode==="block"){k.width>0&&R(L,0);let te=W.height,he=W.distTop??6,me=W.distBottom??6;k.toRun=L,k.toChar=1,k.maxImageHeightPx=te+he+me,R(L+1,0);continue}let w=W.width,B=W.height;B>k.maxImageHeightPx&&(k.maxImageHeightPx=B),k.width+w>k.availableWidth+po&&R(L,0),k.width+=w,k.toRun=L,k.toChar=1;continue}if(gh(W)){let O=W.fallback||"1",K={fontFamily:W.fontFamily??_o,fontSize:W.fontSize??pn,bold:W.bold,italic:W.italic};_(K);let w=chunk4CUGBNL2_cjs.e(O,K);k.width>0&&k.width+w>k.availableWidth+po&&(R(L,0),_(K)),k.width+=w,k.toRun=L,k.toChar=1;continue}if(Zd(W)){let O=W,K=O.text,w=qd(O);if(_(w),!K||K.length===0){k.toRun=L,k.toChar=0;continue}let B=bh(K),te=0;for(;te<K.length;){let he=K.length;for(let Te of B)if(Te>te){he=Te;break}let me=K.slice(te,he),Ie=chunk4CUGBNL2_cjs.e(me,w);if(Ie>k.availableWidth+po){k.width>0&&(R(L,te),_(w));let{charWidths:Te}=chunk4CUGBNL2_cjs.f(me,w),Re=0;for(;Re<me.length;){let P=0,I=Re;for(;I<me.length;){let y=Te[I]??0;if(P+y>k.availableWidth+po)break;P+=y,I+=1;}I===Re&&(I=Math.min(me.length,Re+1),P=Te[Re]??0),k.width+=P,k.toRun=L,k.toChar=te+I,Re=I,Re<me.length&&(R(L,te+Re),_(w));}te=he;continue}k.width>0&&k.width+Ie>k.availableWidth+po&&(R(L,te),_(w)),k.width+=Ie,k.toRun=L,k.toChar=he,te=he;}}}E();let $=C.reduce((L,W)=>L+W.lineHeight,0);return i?.before&&($+=i.before),i?.after&&($+=i.after),{kind:"paragraph",lines:C,totalHeight:$}}var xh=new Map;function eu(){xh.clear();}var Sh=new Map;function tu(){Sh.clear();}var kh=5e3,Ch=kh,Rn=new Map;function ss(e){let t=[];for(let o of e.runs)o.kind==="text"?t.push(`t:${o.text}|${o.fontFamily}|${o.fontSize}|${o.bold}|${o.italic}`):o.kind==="tab"?t.push(`tab:${o.width}`):o.kind==="image"?t.push(`img:${o.width}x${o.height}`):o.kind==="lineBreak"&&t.push("br");let n=e.attrs;return n&&(n.alignment&&t.push(`align:${n.alignment}`),n.indent&&t.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&t.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`)),t.join("||")}function wh(){for(;Rn.size>Ch;){let e=Rn.keys().next().value;if(e===void 0)break;Rn.delete(e);}}function ls(e,t){let n=ss(e),o=Rn.get(n);if(o!==void 0&&o.maxWidth===t)return Rn.delete(n),Rn.set(n,o),o.measure}function cs(e,t,n){let o=ss(e);Rn.set(o,{measure:n,maxWidth:t}),wh();}function nu(){Rn.clear();}function ds(){eu(),tu(),nu();}function Th(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function vh(e,t){let n=[];for(let o=t.fromRun;o<=t.toRun&&o<e.runs.length;o++){let r=e.runs[o];if(r){if(r.kind==="tab"||r.kind==="image"||r.kind==="lineBreak"){n.push(r);continue}if(r.kind==="text"){let i=r.text??"",a=o===t.fromRun,s=o===t.toRun;if(a||s){let l=a?t.fromChar:0,u=s?t.toChar:i.length,d=i.slice(l,u);d.length>0&&n.push({...r,text:d});}else n.push(r);}}}return n}function Rh(e,t){let n,o,r=e.pmStart??0,i=0;for(let a=0;a<e.runs.length&&a<=t.toRun;a++){let s=e.runs[a];s&&(a<t.fromRun?s.kind==="text"?i+=(s.text??"").length:(s.kind==="tab"||s.kind==="lineBreak"||s.kind==="image")&&(i+=1):a===t.fromRun&&(i+=t.fromChar,n=r+i,s.kind==="text"&&(i=t.fromChar)));}if(n!==void 0){let a=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let l=e.runs[s];if(l)if(l.kind==="text"){let u=l.text??"",d=s===t.fromRun?t.fromChar:0,c=s===t.toRun?t.toChar:u.length;a+=c-d;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(a+=1);}o=n+a;}return {pmStart:n,pmEnd:o}}function Ph(e,t,n,o){let r=0;for(let i=n;i<o&&i<e.lines.length;i++){let s=e.lines[i].lineHeight;if(t>=r&&t<r+s)return i;r+=s;}return o>n?Math.min(o-1,e.lines.length-1):null}function Mh(e,t,n,o){let{pmStart:r,pmEnd:i}=Rh(e,t);if(r===void 0||i===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let a=e.attrs?.alignment??"left",s=0;a==="center"?s=Math.max(0,(o-t.width)/2):a==="right"&&(s=Math.max(0,o-t.width));let l=Math.max(0,n-s);if(l<=0)return {charOffset:0,pmPosition:r};let u=vh(e,t);if(u.length===0)return {charOffset:0,pmPosition:r};let d=0,c=0;for(let f of u){if(f.kind==="tab"){let m=f.width??48,b=d+m;if(l<=b){let g=d+m/2;return l<g?{charOffset:c,pmPosition:r+c}:{charOffset:c+1,pmPosition:r+c+1}}d=b,c+=1;continue}if(f.kind==="image"){let m=f.width,b=d+m;if(l<=b){let g=d+m/2;return l<g?{charOffset:c,pmPosition:r+c}:{charOffset:c+1,pmPosition:r+c+1}}d=b,c+=1;continue}if(f.kind==="lineBreak"){if(l>=d)return {charOffset:c,pmPosition:r+c};c+=1;continue}if(f.kind==="text"){let m=f.text??"";if(m.length===0)continue;let b=Th(f),g=chunk4CUGBNL2_cjs.f(m,b),S=d+g.width;if(l<=S){let C=l-d,k=chunk4CUGBNL2_cjs.g(C,g.charWidths),E=c+k;return {charOffset:E,pmPosition:r+E}}d=S,c+=m.length;}}return {charOffset:i-r,pmPosition:i}}function ou(e){let{fragment:t,block:n,measure:o,localX:r,localY:i}=e;if(t.kind!=="paragraph"||n.kind!=="paragraph"||o.kind!=="paragraph")return null;let a=t,s=n,l=o,u=Ph(l,i,a.fromLine,a.toLine);if(u===null)return null;let d=l.lines[u];if(!d)return null;let c=0;for(let k=a.fromLine;k<u;k++)c+=l.lines[k]?.lineHeight??0;let p=s.attrs?.indent,f=p?.left??0,m=p?.right??0,b=Math.max(0,t.width-f-m),g=r-f,{charOffset:S,pmPosition:C}=Mh(s,d,g,b);return {pmPosition:C,charOffset:S,lineIndex:u}}function Eh(e){let{cellBlock:t,cellMeasure:n,cellLocalX:o,cellLocalY:r}=e;if(!t||!n)return null;let i={fragment:{kind:"paragraph",blockId:t.id,x:0,y:0,width:n.lines.reduce((s,l)=>Math.max(s,l.width),100),fromLine:0,toLine:n.lines.length,height:n.totalHeight},block:t,measure:n,pageIndex:e.pageIndex,localX:o,localY:r};return ou(i)?.pmPosition??null}function us(e,t){if(t)return Eh(t);if(!e)return null;let{fragment:n}=e;return n.kind==="paragraph"?ou(e)?.pmPosition??null:n.kind==="image"?n.pmStart??null:null}function iu(e,t,n,o=1){let r=document.elementsFromPoint(t,n),i=r.find(d=>d.classList.contains("layout-page"));if(!i)return null;let a=r.find(d=>d.tagName==="SPAN"&&d.dataset.pmStart!==void 0&&d.dataset.pmEnd!==void 0);if(a)return ps(a,t);let s=r.find(d=>d.classList.contains("layout-empty-run"));if(s){let d=s.closest(".layout-paragraph");if(d&&d.dataset.pmStart)return Number(d.dataset.pmStart)}let l=r.find(d=>d.classList.contains("layout-paragraph")&&d.dataset.pmStart!==void 0);if(l&&l.dataset.pmStart){let d=ru(l,t,n);return d!==null?d:Number(l.dataset.pmStart)}let u=r.find(d=>d.classList.contains("layout-table-cell"));return u?ru(u,t,n):Ih(e,i,t,n)}function ps(e,t,n){let o=Number(e.dataset.pmStart),r=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){let c=e.getBoundingClientRect(),p=(c.left+c.right)/2;return t<p?o:r}let i=e.firstChild;if(!i||i.nodeType!==Node.TEXT_NODE)return o;let a=i,s=a.length;if(s===0)return o;let l=e.ownerDocument;if(!l)return o;let u=0,d=s;for(;u<d;){let c=Math.floor((u+d)/2),p=l.createRange();p.setStart(a,c),p.setEnd(a,c);let m=p.getBoundingClientRect().left;t<m?d=c:u=c+1;}if(u>0&&u<=s){let c=l.createRange();c.setStart(a,u-1),c.setEnd(a,u-1);let p=c.getBoundingClientRect();c.setStart(a,Math.min(u,s)),c.setEnd(a,Math.min(u,s));let f=c.getBoundingClientRect(),m=Math.abs(t-p.left),b=Math.abs(t-f.left);if(m<b)return o+(u-1)}return o+Math.min(u,r-o)}function ru(e,t,n){let o=e.querySelector(".layout-empty-run");if(o){let c=o.closest(".layout-paragraph");if(c&&c.dataset.pmStart)return Number(c.dataset.pmStart)}let r=e.querySelectorAll(".layout-line"),i=null,a=1/0;for(let c of Array.from(r)){let p=c,f=p.getBoundingClientRect(),m=(f.top+f.bottom)/2,b=Math.abs(n-m);b<a&&(a=b,i=p);}if(!i){let c=e.querySelector(".layout-paragraph[data-pm-start]");return c?.dataset.pmStart?Number(c.dataset.pmStart):e.dataset.pmStart?Number(e.dataset.pmStart):null}let s=i.querySelectorAll("span[data-pm-start][data-pm-end]");if(s.length===0){let c=i.closest(".layout-paragraph");return c?.dataset.pmStart?Number(c.dataset.pmStart):null}let l=null,u=1/0;for(let c of Array.from(s)){let p=c,f=p.getBoundingClientRect();if(t>=f.left&&t<=f.right)return ps(p,t);let m=t<f.left?f.left-t:t-f.right;m<u&&(u=m,l=p);}if(!l)return null;let d=l.getBoundingClientRect();return t<d.left?Number(l.dataset.pmStart):Number(l.dataset.pmEnd)}function Ih(e,t,n,o,r){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let f=t.querySelectorAll(".layout-paragraph");if(f.length>0){let m=f[0];return Number(m.dataset.pmStart)||0}return null}let a=t.querySelectorAll(".layout-line"),s=null,l=1/0;for(let f of Array.from(a)){let m=f,b=m.getBoundingClientRect(),g=(b.top+b.bottom)/2,S=Math.abs(o-g);S<l&&(l=S,s=m);}if(!s)return null;let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let f=s.closest(".layout-paragraph");return f?.dataset.pmStart?Number(f.dataset.pmStart):null}let d=null,c=1/0;for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect();if(n>=b.left&&n<=b.right)return ps(m,n);let g=n<b.left?b.left-n:n-b.right;g<c&&(c=g,d=m);}if(!d)return null;let p=d.getBoundingClientRect();return n<p.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)}var Pn={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image"};function Fh(e){return e.kind==="paragraph"}function Lh(e){return e.kind==="table"}function Bh(e){return e.kind==="image"}function Li(e){e.style.position="absolute",e.style.overflow="hidden";}function Ah(e,t,n){let o=n.createElement("div");return o.className=`${Pn.fragment} ${Pn.paragraph}`,Li(o),o.dataset.blockId=String(e.blockId),o.dataset.fromLine=String(e.fromLine),o.dataset.toLine=String(e.toLine),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(o.dataset.continuesFromPrev="true"),e.continuesOnNext&&(o.dataset.continuesOnNext="true"),o}function Dh(e,t,n){let o=n.createElement("div");return o.className=`${Pn.fragment} ${Pn.table}`,Li(o),o.dataset.blockId=String(e.blockId),o.dataset.fromRow=String(e.fromRow),o.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),o}function Hh(e,t,n){let o=n.createElement("div");return o.className=`${Pn.fragment} ${Pn.image}`,Li(o),o.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(o.dataset.anchored="true"),e.zIndex!==void 0&&(o.style.zIndex=String(e.zIndex)),o}function jo(e,t,n={}){let o=n.document??document;if(Fh(e))return Ah(e,t,o);if(Lh(e))return Dh(e,t,o);if(Bh(e))return Hh(e,t,o);let r=o.createElement("div");r.className=Pn.fragment,Li(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}function fs(e){return e/1440*96}function Nh(e){return e/96*1440}function zh(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:o=0}=e,r=t.filter(c=>c.val!=="clear").filter(c=>c.pos>=o),i=t.filter(c=>c.val==="clear").map(c=>c.pos),a=r.reduce((c,p)=>Math.max(c,p.pos),0),s=[...r];o>0&&!r.some(c=>c.pos<=o)&&(i.some(p=>Math.abs(p-o)<20)||s.push({val:"start",pos:o,leader:"none"}));let u=a>0?Math.max(a,o):o,d=o+14400;for(;u<d;){u+=n;let c=r.some(m=>Math.abs(m.pos-u)<20),p=i.some(m=>Math.abs(m-u)<20),f=o>0&&Math.abs(u-o)<20;!c&&!p&&!f&&s.push({val:"start",pos:u,leader:"none"});}return s.sort((c,p)=>c.pos-p.pos)}function au(e,t,n="",o,r="."){let{defaultTabInterval:i=720}=t,a=Nh(e),l=zh(t).find(c=>c.pos>a);if(!l){let c=fs(i),p=c-e%c;return p<=0&&(p=c),{width:p,alignment:"default"}}let d=fs(l.pos)-e;if(l.val==="center"||l.val==="end"){let c=o?o(n):0;l.val==="center"?d-=c/2:d-=c;}else if(l.val==="decimal"){let c=n.indexOf(r);if(c>=0&&o){let p=n.slice(0,c),f=o(p);d-=f;}}else if(l.val==="bar")return {width:0,leader:l.leader,alignment:"bar"};if(d<1){let c=fs(i),p=c-e%c;return p<=0&&(p=c),{width:p,alignment:"default"}}return {width:d,leader:l.leader,alignment:l.val}}var Ot={fragment:"layout-paragraph",line:"layout-line",run:"layout-run",text:"layout-run-text",tab:"layout-run-tab",image:"layout-run-image",lineBreak:"layout-run-linebreak"};function Go(e){return e.kind==="text"}function Bi(e){return e.kind==="tab"}function ms(e){return e.kind==="image"}function gs(e){return e.kind==="lineBreak"}function hs(e){return e.kind==="field"}function Oh(e,t){if(t.fontFamily&&(e.style.fontFamily=chunk4CUGBNL2_cjs.a(t.fontFamily).cssFallback),t.fontSize){let o=t.fontSize*96/72;e.style.fontSize=`${o}px`;}t.bold&&(e.style.fontWeight="bold"),t.italic&&(e.style.fontStyle="italic"),t.color&&(e.style.color=t.color),t.letterSpacing&&(e.style.letterSpacing=`${t.letterSpacing}px`),t.highlight&&(e.style.backgroundColor=t.highlight);let n=[];t.underline&&(n.push("underline"),typeof t.underline=="object"&&(t.underline.style&&(e.style.textDecorationStyle=t.underline.style),t.underline.color&&(e.style.textDecorationColor=t.underline.color))),t.strike&&n.push("line-through"),t.commentIds&&t.commentIds.length>0&&(e.style.backgroundColor="rgba(255, 212, 0, 0.25)",e.style.borderBottom="2px solid rgba(255, 212, 0, 0.6)",e.dataset.commentId=String(t.commentIds[0])),t.isInsertion&&(e.style.backgroundColor="rgba(52, 168, 83, 0.08)",e.style.borderBottom="2px dashed #2e7d32",e.style.paddingBottom="1px",e.classList.add("docx-insertion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),t.isDeletion&&(e.style.backgroundColor="rgba(211, 47, 47, 0.08)",e.style.color="#c62828",n.includes("line-through")||n.push("line-through"),e.style.textDecorationColor="#c62828",e.classList.add("docx-deletion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),n.length>0&&(e.style.textDecorationLine=n.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em");}function fo(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function bs(e,t){let n=t.createElement("span");if(n.className=`${Ot.run} ${Ot.text}`,Oh(n,e),fo(n,e.pmStart,e.pmEnd),e.hyperlink){let o=t.createElement("a");o.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(o.target="_blank",o.rel="noopener noreferrer"),e.hyperlink.tooltip&&(o.title=e.hyperlink.tooltip),o.textContent=e.text,o.style.color=e.color||"#0563c1",o.style.textDecoration="underline",n.appendChild(o);}else n.textContent=e.text;return n}function cu(e,t,n,o){let r=t.createElement("span");if(r.className=`${Ot.run} ${Ot.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,fo(r,e.pmStart,e.pmEnd),o&&o!=="none"){let i=$h(o);i&&(r.style.backgroundImage=`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='4' height='16'><text x='0' y='12' font-size='12' fill='%23000'>${i}</text></svg>`)}")`,r.style.backgroundRepeat="repeat-x",r.style.backgroundPosition="bottom");}return r.textContent="\xA0",r}function $h(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";default:return null}}function Wh(e,t){let n=t.createElement("img");return n.className=`${Ot.run} ${Ot.image}`,n.src=e.src,n.width=e.width,n.height=e.height,e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform),n.style.display="inline",n.style.verticalAlign="middle",fo(n,e.pmStart,e.pmEnd),n}function su(e,t){let n=t.createElement("div");n.className="layout-block-image",n.style.display="block",n.style.textAlign="center",n.style.marginTop=`${e.distTop??6}px`,n.style.marginBottom=`${e.distBottom??6}px`;let o=t.createElement("img");return o.src=e.src,o.width=e.width,o.height=e.height,o.style.marginLeft="auto",o.style.marginRight="auto",e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform),fo(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function du(e,t){let n=e.displayMode,o=e.wrapType;return n==="float"||o&&["square","tight","through"].includes(o)||n==="block"||o==="topAndBottom"?su(e,t):Wh(e,t)}function uu(e,t){let n=t.createElement("br");return n.className=`${Ot.run} ${Ot.lineBreak}`,fo(n,e.pmStart,e.pmEnd),n}function pu(e,t,n){let o=e.fallback??"";switch(e.fieldType){case "PAGE":o=String(n.pageNumber);break;case "NUMPAGES":o=String(n.totalPages);break;case "DATE":o=new Date().toLocaleDateString();break;case "TIME":o=new Date().toLocaleTimeString();break}let r={text:o,bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike,color:e.color,highlight:e.highlight,fontFamily:e.fontFamily,fontSize:e.fontSize,pmStart:e.pmStart,pmEnd:e.pmEnd};return bs(r,t)}function _h(e,t,n){if(Go(e))return bs(e,t);if(Bi(e))return cu(e,t,48,void 0);if(ms(e))return du(e,t);if(gs(e))return uu(e,t);if(hs(e)&&n)return pu(e,t,n);let o=t.createElement("span");return o.className=Ot.run,o}function fu(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=o[r];if(i)if(Go(i)){let a=r===t.fromRun?t.fromChar:0,s=r===t.toRun?t.toChar:i.text.length;if(a>0||s<i.text.length){let l=i.text.slice(a,s);n.push({...i,text:l,pmStart:i.pmStart!==void 0?i.pmStart+a:void 0,pmEnd:i.pmStart!==void 0?i.pmStart+s:void 0});}else n.push(i);}else n.push(i);}return n}function Vh(e){return {val:e.val,pos:e.pos,leader:e.leader}}function jh(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let i=e[r];if(Go(i))o+=i.text;else if(hs(i))i.fieldType==="PAGE"&&n?o+=String(n.pageNumber):i.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=i.fallback??"";else if(Bi(i)||gs(i))break}return o}function Uh(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,i="Calibri")=>{if(!n)return o.length*7;let a=chunk4CUGBNL2_cjs.a(i).cssFallback,s=r*96/72;return n.font=`${s}px ${a}`,n.measureText(o).width}}function mu(e,t,n,o,r){let i=o.createElement("div");i.className=Ot.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=fu(e,t);if(a.length===0){let b=o.createElement("span");return b.className=`${Ot.run} layout-empty-run`,b.innerHTML=" ",i.appendChild(b),i}let s=n==="justify",l=false;s&&r&&(l=!r.isLastLine||r.paragraphEndsWithLineBreak,l&&(i.style.textAlign="justify",i.style.textAlignLast="justify",i.style.width=`${r.availableWidth}px`)),i.style.whiteSpace="pre";let u=a.some(b=>Go(b)&&b.highlight);i.style.overflow=u?"hidden":"visible";let d=a.some(Bi),c,p=Uh(o);if(d){let b=r?.tabStops?.map(Vh),g=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;c={explicitStops:b,leftIndent:g};}let f=0,m=r?.leftIndentPx??0;if(r?.isFirstLine){let b=r?.firstLineIndentPx??0;f=m+b;}else f=m;for(let b=0;b<a.length;b++){let g=a[b];if(Bi(g)&&c){let S=jh(a,b,r?.context),C=au(f,c,S,p),k=cu(g,o,C.width,C.leader);i.appendChild(k),f+=C.width;}else if(Go(g)){let S=bs(g,o);if(g.highlight){let R=(g.fontSize?g.fontSize*96/72:14.67)*1.2,_=Math.max(0,t.lineHeight-R);if(_>0){let V=_/2;S.style.paddingTop=`${V}px`,S.style.paddingBottom=`${V}px`;}}i.appendChild(S);let C=g.fontSize||11,k=g.fontFamily||"Calibri";f+=p(g.text,C,k);}else if(ms(g)){if(g.displayMode==="float"||g.wrapType&&["square","tight","through"].includes(g.wrapType))continue;let C=du(g,o);i.appendChild(C),g.displayMode!=="block"&&g.wrapType!=="topAndBottom"&&(f+=g.width);}else if(gs(g)){let S=uu(g,o);i.appendChild(S);}else if(hs(g)&&r?.context){let S=pu(g,o,r.context);i.appendChild(S);let C=g.fallback??"";g.fieldType==="PAGE"?C=String(r.context.pageNumber):g.fieldType==="NUMPAGES"&&(C=String(r.context.totalPages));let k=g.fontSize||11,E=g.fontFamily||"Calibri";f+=p(C,k,E);}else {let S=_h(g,o,r?.context);i.appendChild(S);}}return i}function Uo(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function lu(e,t){return !e&&!t||!e||!t?false:Uo(e.top,t.top)&&Uo(e.bottom,t.bottom)&&Uo(e.left,t.left)&&Uo(e.right,t.right)&&Uo(e.between,t.between)}function jn(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=Ot.fragment,a.style.position="relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),fo(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");for(let k of t.runs)ms(k)&&(k.displayMode==="float"||k.wrapType&&["square","tight","through"].includes(k.wrapType));let s=n.lines.slice(e.fromLine,e.toLine),l=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId),l&&(l==="center"?a.style.textAlign="center":l==="right"?a.style.textAlign="right":a.style.textAlign="left");let u=t.attrs?.indent,d=0,c=0;u&&(u.left&&u.left>0&&(d=u.left),u.right&&u.right>0&&(c=u.right));let p=t.attrs?.borders;if(p){let k=$=>{switch($){case "single":return "solid";case "double":return "double";case "dotted":return "dotted";case "dashed":return "dashed";case "thick":return "solid";case "wave":return "wavy";case "dashSmallGap":return "dashed";case "nil":case "none":return "none";default:return "solid"}};a.style.boxSizing="border-box";let E=$=>`${$.width}px ${k($.style)} ${$.color}`,R=lu(r.prevBorders,p),_=lu(p,r.nextBorders);R&&p.between?a.style.borderTop=E(p.between):p.top&&!R&&(a.style.borderTop=E(p.top)),p.bottom&&!_&&(a.style.borderBottom=E(p.bottom)),p.left&&(a.style.borderLeft=E(p.left)),p.right&&(a.style.borderRight=E(p.right)),(p.top||p.bottom||p.left||p.right||p.between)&&(a.style.paddingLeft=p.left?"4px":"0",a.style.paddingRight=p.right?"4px":"0",a.style.paddingTop=p.top||p.between?"2px":"0",a.style.paddingBottom=p.bottom?"6px":"0");}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let f=e.width-d-c,b=t.runs[t.runs.length-1]?.kind==="lineBreak",g=n.lines.length,S=0;u?.hanging&&u.hanging>0?S=-u.hanging:u?.firstLine&&u.firstLine>0&&(S=u.firstLine);let C=0;for(let k=0;k<s.length;k++){let E=s[k],R=e.fromLine+k,_=R===g-1,V=R===0&&!e.continuesFromPrev,$=E.leftOffset??0,L=E.rightOffset??0,W=f;if(V){let B=u?.hanging&&u.hanging>0,te=u?.firstLine&&u.firstLine>0;B&&u?.hanging?W=f+u.hanging:te&&u?.firstLine&&(W=f-u.firstLine);}let O=mu(t,E,l,i,{availableWidth:W-$-L,isLastLine:_,isFirstLine:V,paragraphEndsWithLineBreak:b,tabStops:t.attrs?.tabs,leftIndentPx:d,firstLineIndentPx:V?S:0,context:o});$>0&&(O.style.marginLeft=`${$}px`),L>0&&(O.style.marginRight=`${L}px`),C+=E.lineHeight;let K=u?.hanging&&u.hanging>0,w=u?.firstLine&&u.firstLine>0;if(V?d>0&&K?(O.style.paddingLeft=`${d}px`,O.style.textIndent=`-${u.hanging}px`):d>0&&w?(O.style.paddingLeft=`${d}px`,O.style.textIndent=`${u.firstLine}px`):d>0?O.style.paddingLeft=`${d}px`:w&&(O.style.textIndent=`${u.firstLine}px`):d>0?O.style.paddingLeft=`${d}px`:K&&(O.style.paddingLeft=`${u.hanging}px`),c>0&&(O.style.paddingRight=`${c}px`),V&&t.attrs?.listMarker){let B=Math.max(0,d-(u?.hanging??0));O.style.paddingLeft=`${B}px`,O.style.textIndent="0";let te=Gh(t.attrs.listMarker,u,i);O.insertBefore(te,O.firstChild);}a.appendChild(O);}return a}function Gh(e,t,n){let o=n.createElement("span");o.className="layout-list-marker",o.style.display="inline-block",o.textContent=e;let r=t?.hanging??24;return o.style.minWidth=`${r}px`,o.style.textAlign="left",o.style.boxSizing="border-box",o}var an={table:"layout-table",row:"layout-table-row",cell:"layout-table-cell",cellContent:"layout-table-cell-content",resizeHandle:"layout-table-resize-handle",rowResizeHandle:"layout-table-row-resize-handle",tableEdgeHandleBottom:"layout-table-edge-handle-bottom",tableEdgeHandleRight:"layout-table-edge-handle-right"};function Kh(e,t,n,o){let r=o.createElement("div");r.className=an.cellContent,r.style.position="relative";let i=e.padding?.left??7,a=e.padding?.right??7,s=Math.max(0,t.width-i-a);r.style.width=`${s}px`;for(let l=0;l<e.blocks.length;l++){let u=e.blocks[l],d=t.blocks[l];if(u?.kind==="paragraph"&&d?.kind==="paragraph"){let c=u,p=d,f={blockId:c.id,width:s,height:p.totalHeight,fromLine:0,toLine:p.lines.length,pmStart:c.pmStart,pmEnd:c.pmEnd},m=jn(f,c,p,n,{document:o});m.style.position="relative",r.appendChild(m);}else if(u?.kind==="table"&&d?.kind==="table"){let f=Yh(u,d,n,o);f.style.position="relative",r.appendChild(f);}}return r}function Yh(e,t,n,o){let r=o.createElement("div");r.className=`${an.table} layout-nested-table`,r.style.position="relative",r.style.width=`${t.totalWidth}px`,r.style.display="block",e.justification==="center"?(r.style.marginLeft="auto",r.style.marginRight="auto"):e.justification==="right"&&(r.style.marginLeft="auto"),r.dataset.blockId=String(e.id),e.pmStart!==void 0&&(r.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(r.dataset.pmEnd=String(e.pmEnd));let i=[],a=0;for(let u=0;u<t.rows.length;u++)i.push(a),a+=t.rows[u]?.height??0;i.push(a);let s=new Map,l=0;for(let u=0;u<e.rows.length;u++){let d=e.rows[u],c=t.rows[u];if(!d||!c)continue;let p=gu(d,c,u,l,t.columnWidths,e.rows.length,n,o,s,i);r.appendChild(p),l+=c.height;}return r.style.height=`${l}px`,r}function Ai(e,t,n){let o=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!n||n.style==="none"||n.style==="nil"||n.width===0)e.style[o]="none";else {let r=n.width??1,i=n.color??"#000000",a=n.style??"solid";e.style[o]=`${r}px ${a} ${i}`;}}function qh(e,t,n,o,r,i,a){let s=a.createElement("div");s.className=an.cell,s.style.position="absolute",s.style.left=`${n}px`,s.style.top="0",s.style.width=`${t.width}px`,s.style.height=`${o}px`,s.style.overflow="hidden",s.style.boxSizing="border-box";let l=e.padding?.top??1,u=e.padding?.right??7,d=e.padding?.bottom??1,c=e.padding?.left??7;if(s.style.padding=`${l}px ${u}px ${d}px ${c}px`,e.borders&&(r.isFirstRow&&Ai(s,"top",e.borders.top),Ai(s,"right",e.borders.right),Ai(s,"bottom",e.borders.bottom),r.isFirstCol&&Ai(s,"left",e.borders.left)),e.background&&(s.style.backgroundColor=e.background),e.verticalAlign)switch(s.style.display="flex",s.style.flexDirection="column",e.verticalAlign){case "top":s.style.justifyContent="flex-start";break;case "center":s.style.justifyContent="center";break;case "bottom":s.style.justifyContent="flex-end";break}let p=Kh(e,t,i,a);if(s.appendChild(p),e.blocks.length>0){let f=e.blocks[0],m=e.blocks[e.blocks.length-1];f&&"pmStart"in f&&f.pmStart!==void 0&&(s.dataset.pmStart=String(f.pmStart)),m&&"pmEnd"in m&&m.pmEnd!==void 0&&(s.dataset.pmEnd=String(m.pmEnd));}return s}function gu(e,t,n,o,r,i,a,s,l,u){let d=s.createElement("div");d.className=an.row,d.style.position="absolute",d.style.left="0",d.style.top=`${o}px`,d.style.width="100%",d.style.height=`${t.height}px`,d.dataset.rowIndex=String(n);let c=new Set;if(l){for(let[,m]of l)if(m.startRow<n&&m.startRow+m.rowSpan>n)for(let b=0;b<m.colSpan;b++)c.add(m.columnIndex+b);}let p=0,f=0;for(;c.has(f);)p+=r[f]??0,f++;for(let m=0;m<e.cells.length;m++){let b=e.cells[m],g=t.cells[m];if(!b||!g)continue;let S=b.colSpan??1,C=b.rowSpan??1,k=t.height;if(C>1&&u){k=0;for(let L=n;L<n+C&&L<u.length-1;L++)k+=(u[L+1]??0)-(u[L]??0);k===0&&(k=t.height*C);}let E=n===0,_=f===0;f+S>=r.length;let $=qh(b,g,p,k,{isFirstRow:E,isFirstCol:_},a,s);if($.dataset.cellIndex=String(m),$.dataset.columnIndex=String(f),C>1&&($.dataset.rowSpan=String(C)),d.appendChild($),C>1&&l){let L=`${n}-${f}`;l.set(L,{cell:b,cellMeasure:g,columnIndex:f,startRow:n,rowSpan:C,colSpan:S,x:p,totalHeight:k});}for(let L=0;L<S&&f+L<r.length;L++)p+=r[f+L]??0;for(f+=S;c.has(f);)p+=r[f]??0,f++;}return d}function Di(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=an.table,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.dataset.blockId=String(e.blockId),a.dataset.fromRow=String(e.fromRow),a.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let s=0;for(let f=0;f<n.columnWidths.length-1;f++){s+=n.columnWidths[f]??0;let m=i.createElement("div");m.className=an.resizeHandle,m.style.position="absolute",m.style.left=`${s-3}px`,m.style.top="0",m.style.width="6px",m.style.height="100%",m.style.cursor="col-resize",m.style.zIndex="10",m.dataset.columnIndex=String(f),m.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}let l=[],u=0;for(let f=0;f<n.rows.length;f++)l.push(u),u+=n.rows[f]?.height??0;l.push(u);let d=new Map,c=0;for(let f=e.fromRow;f<e.toRow;f++){let m=t.rows[f],b=n.rows[f];if(!m||!b)continue;let g=gu(m,b,f,c,n.columnWidths,t.rows.length,o,i,d,l);a.appendChild(g),c+=b.height;}let p=0;for(let f=e.fromRow;f<e.toRow;f++)if(p+=n.rows[f]?.height??0,f<e.toRow-1){let m=i.createElement("div");m.className=an.rowResizeHandle,m.style.position="absolute",m.style.left="0",m.style.top=`${p-3}px`,m.style.width="100%",m.style.height="6px",m.style.cursor="row-resize",m.style.zIndex="10",m.dataset.rowIndex=String(f),m.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}if(e.toRow===t.rows.length){let f=i.createElement("div");f.className=an.tableEdgeHandleBottom,f.style.position="absolute",f.style.left="0",f.style.top=`${p-3}px`,f.style.width="100%",f.style.height="6px",f.style.cursor="row-resize",f.style.zIndex="10",f.dataset.rowIndex=String(t.rows.length-1),f.dataset.tableBlockId=String(e.blockId),f.dataset.isEdge="bottom",e.pmStart!==void 0&&(f.dataset.tablePmStart=String(e.pmStart)),a.appendChild(f);}if(e.toRow===t.rows.length){let f=n.columnWidths.reduce((b,g)=>b+g,0),m=i.createElement("div");m.className=an.tableEdgeHandleRight,m.style.position="absolute",m.style.left=`${f-3}px`,m.style.top="0",m.style.width="6px",m.style.height="100%",m.style.cursor="col-resize",m.style.zIndex="10",m.dataset.columnIndex=String(n.columnWidths.length-1),m.dataset.tableBlockId=String(e.blockId),m.dataset.isEdge="right",e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}return a}var ys={image:"layout-image",imageAnchored:"layout-image-anchored"};function Hi(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=ys.image,e.isAnchored&&a.classList.add(ys.imageAnchored),a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",e.zIndex!==void 0&&(a.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(a.style.zIndex="-1"),a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let s=i.createElement("img");return s.src=t.src,s.alt=t.alt??"",s.style.width="100%",s.style.height="100%",s.style.objectFit="contain",s.style.display="block",t.transform&&(s.style.transform=t.transform),s.draggable=false,a.appendChild(s),a}var Mn={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function zi(e,t,n,o){if(e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${n}px`,e.style.backgroundColor=o.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily='Calibri, "Segoe UI", Arial, sans-serif',e.style.fontSize=`${1056/72}px`,e.style.color="#000000",o.showBorders&&(e.style.border="1px solid #ccc"),o.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)"),o.pageBorders){let r=o.pageBorders,i=["top","bottom","left","right"],a=["Top","Bottom","Left","Right"];for(let s=0;s<i.length;s++){let l=r[i[s]];if(l&&l.style!=="none"&&l.style!=="nil"){let u=to(l,a[s],o.theme);for(let[d,c]of Object.entries(u))e.style[d]=String(c);}}}}function Xh(e,t){let n=t.margins;e.style.position="absolute",e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,e.style.right=`${n.right}px`,e.style.bottom=`${n.bottom}px`,e.style.overflow="visible";}function Zh(e,t,n){e.style.position="absolute",e.style.left=`${t.x-n.left}px`,e.style.top=`${t.y-n.top}px`,e.style.width=`${t.width}px`,"height"in t&&(e.style.height=`${t.height}px`);}function $i(e){return e===void 0?0:Math.round(e*96/914400)}function Jh(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function Qh(e,t,n){let o=[];for(let r of e.runs){if(r.kind!=="image")continue;let i=r;if(!Jh(i))continue;let a=i.position,s=i.distTop??0,l=i.distBottom??0,u=i.distLeft??12,d=i.distRight??12,c="left",p=0;if(a?.horizontal){let m=a.horizontal;m.align==="right"?(c="right",p=n-i.width):m.align==="left"?(c="left",p=0):m.align==="center"?(c="left",p=(n-i.width)/2):m.posOffset!==void 0&&(p=$i(m.posOffset),c=p>n/2?"right":"left");}else i.cssFloat==="right"&&(c="right",p=n-i.width);let f=0;if(a?.vertical){let m=a.vertical;m.align==="top"?f=0:m.align==="bottom"?f=t:m.posOffset!==void 0?f=$i(m.posOffset):f=t,m.relativeTo==="margin"&&(m.align==="top"||m.posOffset!==void 0)||m.relativeTo==="paragraph"&&(f=t+f);}else f=t;o.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:c,x:p,y:f,distTop:s,distBottom:l,distLeft:u,distRight:d,pmStart:i.pmStart,pmEnd:i.pmEnd});}return o}function eb(e,t){let n=[],o=0,r=0,i=1/0,a=0;for(let s of e){let l=s.x-s.distLeft,u=s.x+s.width+s.distRight,d=s.y-s.distTop,c=s.y+s.height+s.distBottom;s.side==="left"?o=Math.max(o,u):r=Math.max(r,t-l),i=Math.min(i,d),a=Math.max(a,c);}return (o>0||r>0)&&n.push({leftMargin:o,rightMargin:r,topY:i===1/0?0:i,bottomY:a}),n}function tb(e,t){let n=t.createElement("div");n.className="layout-floating-images-layer",n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.right="0",n.style.bottom="0",n.style.pointerEvents="none",n.style.zIndex="10";for(let o of e){let r=t.createElement("div");r.className="layout-page-floating-image",r.style.position="absolute",r.style.pointerEvents="auto",r.style.top=`${o.y}px`,r.style.left=`${o.x}px`,o.pmStart!==void 0&&(r.dataset.pmStart=String(o.pmStart)),o.pmEnd!==void 0&&(r.dataset.pmEnd=String(o.pmEnd));let i=t.createElement("img");i.src=o.src,i.width=o.width,i.height=o.height,o.alt&&(i.alt=o.alt),o.transform&&(i.style.transform=o.transform),r.appendChild(i),n.appendChild(r);}return n}function hu(e,t,n){let o=n.document??document,r=o.createElement("div");r.style.position="relative";let i=t.contentWidth??600,a=[],s=0;for(let l=0;l<e.blocks.length;l++){let u=e.blocks[l],d=e.measures[l];if(u?.kind==="paragraph"&&d?.kind==="paragraph"){let c=u,p=d,f=s,m=[];for(let C of c.runs)if(C.kind==="image"&&"position"in C&&C.position){let k=C;a.push({src:k.src,width:k.width,height:k.height,alt:k.alt,paragraphY:f,position:k.position});}else m.push(C);let b={...c,runs:m},g={blockId:c.id,width:i,height:p.totalHeight,fromLine:0,toLine:p.lines.length},S=jn(g,b,p,t,{document:o});S.style.position="relative",S.style.marginBottom="0",r.appendChild(S),s+=p.totalHeight;}}for(let l of a){let u=o.createElement("img");u.src=l.src,u.width=l.width,u.height=l.height,l.alt&&(u.alt=l.alt),u.style.position="absolute";let d=l.position.horizontal;d&&(d.align==="right"?u.style.right="0":d.align==="center"?(u.style.left="50%",u.style.transform="translateX(-50%)"):d.posOffset!==void 0?u.style.left=`${$i(d.posOffset)}px`:u.style.left="0");let c=l.position.vertical;if(c){let p=l.paragraphY;c.align==="bottom"?u.style.bottom="0":c.align==="center"?(u.style.top="50%",u.style.transform=(u.style.transform||"")+" translateY(-50%)"):c.posOffset!==void 0?u.style.top=`${p+$i(c.posOffset)}px`:u.style.top=`${p}px`;}else u.style.top=`${l.paragraphY}px`;r.appendChild(u);}return r}function nb(e,t,n){let o=n.createElement("div");o.className="layout-footnote-area",o.style.width=`${t}px`;let r=n.createElement("div");r.style.width="33%",r.style.height="0.5px",r.style.backgroundColor="#000",r.style.marginBottom="6px",r.style.marginTop="6px",o.appendChild(r);for(let i of e){let a=n.createElement("div");a.style.fontSize="10px",a.style.lineHeight="1.3",a.style.marginBottom="4px",a.style.color="#000";let s=n.createElement("sup");s.textContent=i.displayNumber,s.style.fontSize="7px",s.style.marginRight="2px",a.appendChild(s);let l=n.createTextNode(" "+i.text);a.appendChild(l),o.appendChild(a);}return o}function Wi(e,t,n={}){let o=n.document??document,r=o.createElement("div");r.className=n.pageClassName??Mn.page,r.dataset.pageNumber=String(e.number),zi(r,e.size.w,e.size.h,n);let i=o.createElement("div");i.className=Mn.content,Xh(i,e);let a=e.size.w-e.margins.left-e.margins.right,s=[],l=[];for(let p of e.fragments)if(p.kind==="paragraph"&&n.blockLookup){let f=n.blockLookup.get(String(p.blockId));if(f?.block.kind==="paragraph"){let m=f.block,b=p.y-e.margins.top,g=Qh(m,b,a);s.push(...g);}}for(let p of s)l.push({side:p.side,x:p.x,y:p.y,width:p.width,height:p.height,distTop:p.distTop,distBottom:p.distBottom,distLeft:p.distLeft,distRight:p.distRight});if(n.blockLookup)for(let p of e.fragments){if(p.kind!=="table")continue;let f=n.blockLookup.get(String(p.blockId));if(f?.block.kind!=="table")continue;let b=f.block.floating;if(!b)continue;let g=p.x-e.margins.left,S=p.y-e.margins.top,C=b.topFromText??0,k=b.bottomFromText??0,E=b.leftFromText??12,R=b.rightFromText??12,_=g<a/2?"left":"right";l.push({side:_,x:g,y:S,width:p.width,height:p.height,distTop:C,distBottom:k,distLeft:E,distRight:R});}eb(l,a);if(s.length>0){let p=tb(s,o);i.appendChild(p);}let d=p=>{if(p.kind!=="paragraph"||!n.blockLookup||!p.blockId)return;let f=n.blockLookup.get(String(p.blockId));if(f?.block.kind==="paragraph")return f.block.attrs?.borders},c;for(let p=0;p<e.fragments.length;p++){let f=e.fragments[p],m,b={...t,section:"body",contentWidth:a};f.y-e.margins.top;if(n.blockLookup&&f.blockId){let S=n.blockLookup.get(String(f.blockId));if(f.kind==="paragraph"&&S?.block.kind==="paragraph"&&S?.measure.kind==="paragraph"){let C=S.block,k=p+1<e.fragments.length?d(e.fragments[p+1]):void 0;m=jn(f,C,S.measure,b,{document:o,prevBorders:c,nextBorders:k}),c=C.attrs?.borders;}else f.kind==="table"&&S?.block.kind==="table"&&S?.measure.kind==="table"?(m=Di(f,S.block,S.measure,b,{document:o}),c=void 0):f.kind==="image"&&S?.block.kind==="image"&&S?.measure.kind==="image"?(m=Hi(f,S.block,S.measure,b,{document:o}),c=void 0):(m=jo(f,b,{document:o}),c=void 0);}else m=jo(f,b,{document:o}),c=void 0;Zh(m,f,{left:e.margins.left,top:e.margins.top}),i.appendChild(m);}if(n.footnoteArea&&n.footnoteArea.length>0){let p=nb(n.footnoteArea,a,o);p.style.position="absolute";let f=e.footnoteReservedHeight??0,m=e.size.h-e.margins.bottom-e.margins.top;p.style.top=`${m-f}px`,p.style.left="0",p.style.right="0",i.appendChild(p);}r.appendChild(i);{let f=n.headerDistance??e.margins.header??48,m=e.size.w-e.margins.left-e.margins.right,b=Math.max(e.margins.top-f,48),S=(n.headerContent?.height??0)>b,C=o.createElement("div");if(C.className=Mn.header,C.style.position="absolute",C.style.top=`${f}px`,C.style.left=`${e.margins.left}px`,C.style.right=`${e.margins.right}px`,C.style.width=`${m}px`,S||(C.style.maxHeight=`${b}px`,C.style.overflow="hidden"),C.style.minHeight="24px",n.headerContent&&n.headerContent.blocks.length>0){let k=hu(n.headerContent,{...t,section:"header",contentWidth:m},n);C.appendChild(k);}r.appendChild(C);}{let f=n.footerDistance??e.margins.footer??48,m=e.size.w-e.margins.left-e.margins.right,b=Math.max(e.margins.bottom-f,48),S=(n.footerContent?.height??0)>b,C=o.createElement("div");if(C.className=Mn.footer,C.style.position="absolute",C.style.bottom=`${f}px`,C.style.left=`${e.margins.left}px`,C.style.right=`${e.margins.right}px`,C.style.width=`${m}px`,S||(C.style.maxHeight=`${b}px`,C.style.overflow="hidden"),C.style.minHeight="24px",n.footerContent&&n.footerContent.blocks.length>0){let k=hu(n.footerContent,{...t,section:"footer",contentWidth:m},n);C.appendChild(k);}r.appendChild(C);}return r}function xs(e,t,n){let o={pageNumber:e.number,totalPages:t,section:"body"},r={...n};if(n.footnotesByPage){let i=n.footnotesByPage.get(e.number);i&&i.length>0&&(r.footnoteArea=i);}return {context:o,pageOptions:r}}function bu(e){let t=[];t.push(`s:${e.size.w},${e.size.h}`),t.push(`m:${e.margins.top},${e.margins.right},${e.margins.bottom},${e.margins.left}`),t.push(`n:${e.number}`),e.footnoteReservedHeight&&t.push(`fn:${e.footnoteReservedHeight}`);for(let n of e.fragments){let o=`${n.kind}:${n.blockId},${n.x},${n.y},${n.width},${n.height}`;n.pmStart!==void 0&&(o+=`,ps:${n.pmStart}`),n.pmEnd!==void 0&&(o+=`,pe:${n.pmEnd}`),n.kind==="paragraph"?o+=`,fl:${n.fromLine},tl:${n.toLine}`:n.kind==="table"&&(o+=`,fr:${n.fromRow},tr:${n.toRow}`),t.push(o);}return t.join("|")}function ob(e){let t=[];return e.headerContent&&t.push(`hdr:${e.headerContent.blocks.length},${e.headerContent.height}`),e.footerContent&&t.push(`ftr:${e.footerContent.blocks.length},${e.footerContent.height}`),e.theme&&t.push(`thm:${e.theme.name??"default"}`),e.pageBorders&&t.push(`pb:${JSON.stringify(e.pageBorders)}`),e.headerDistance!==void 0&&t.push(`hd:${e.headerDistance}`),e.footerDistance!==void 0&&t.push(`fd:${e.footerDistance}`),t.join("|")}function rb(e,t){e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.gap=`${t}px`,e.style.padding=`${t}px`,e.style.backgroundColor="var(--doc-bg, #f8f9fa)";}var Ni=2,ib=8;function Ss(e,t,n={}){let o=e.length,r=n.pageGap??24,i=t,a=i.__pageRenderState,s=ob(n),l=o>=ib;if(a&&a.optionsHash===s&&l){let g=a.pageStates,S=a.pageDataMap,C=i.__pageObserver,k=[];for(let _ of e)k.push(bu(_));let E=a.totalPages!==o,R=Math.min(g.length,e.length);for(let _=0;_<R;_++){let V=g[_],$=k[_];if(V.fingerprint===$&&!E){let O=S.get(V.element);O&&(O.page=e[_]);continue}let L=V.element,W=S.get(L);W&&(W.page=e[_],W.rendered&&ab(L,S,o,n)),V.fingerprint=$,zi(L,e[_].size.w,e[_].size.h,n),L.dataset.pageNumber=String(e[_].number);}if(e.length>g.length){let _=n.document??document;for(let V=g.length;V<e.length;V++){let $=e[V],L=_.createElement("div");L.className=n.pageClassName??Mn.page,L.dataset.pageNumber=String($.number),L.dataset.pageIndex=String(V),zi(L,$.size.w,$.size.h,n),t.appendChild(L),g.push({element:L,fingerprint:k[V]}),S.set(L,{page:$,index:V,rendered:false}),C&&C.observe(L);}}if(e.length<g.length){for(let _=g.length-1;_>=e.length;_--){let V=g[_].element;C&&C.unobserve(V),S.delete(V),t.removeChild(V);}g.length=e.length;}for(let _=0;_<g.length;_++){let V=S.get(g[_].element);V&&(V.index=_);}a.totalPages=o,a.currentOptions=n;return}let d=i.__pageObserver;d&&(d.disconnect(),i.__pageObserver=void 0),t.innerHTML="",i.__pageRenderState=void 0,rb(t,r);let c=[],p=[];for(let g=0;g<e.length;g++){let S=e[g];if(p.push(bu(S)),l){let k=(n.document??document).createElement("div");k.className=n.pageClassName??Mn.page,k.dataset.pageNumber=String(S.number),k.dataset.pageIndex=String(g),zi(k,S.size.w,S.size.h,n),t.appendChild(k),c.push(k);}else {let{context:C,pageOptions:k}=xs(S,o,n),E=Wi(S,C,k);t.appendChild(E),c.push(E);}}if(!l)return;let f=new Map;for(let g=0;g<e.length;g++)f.set(c[g],{page:e[g],index:g,rendered:false});let m=new IntersectionObserver(g=>{let S=i.__pageRenderState;if(!S)return;let{currentOptions:C,totalPages:k,pageDataMap:E}=S;for(let $ of g){let L=$.target,W=E.get(L);if(W&&$.isIntersecting){Oi(L,E,k,C);for(let O=-Ni;O<=Ni;O++){let K=W.index+O;K>=0&&K<S.pageStates.length&&K!==W.index&&Oi(S.pageStates[K].element,E,k,C);}}}let R=window.innerHeight,_=R*3,V=new Set;for(let[$,L]of E){if(!L.rendered)continue;let W=$.getBoundingClientRect();W.bottom>-_&&W.top<R+_&&V.add(L.index);}for(let[$,L]of E){if(!L.rendered)continue;let W=false;for(let O of V)if(Math.abs(L.index-O)<=Ni+1){W=true;break}!W&&V.size>0&&sb($,E);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let g of c)m.observe(g);i.__pageObserver=m,i.__pageRenderState={pageStates:c.map((g,S)=>({element:g,fingerprint:p[S]})),totalPages:o,optionsHash:s,pageDataMap:f,currentOptions:n};let b=Math.min(e.length,Ni+3);for(let g=0;g<b;g++)Oi(c[g],f,o,n);}function Oi(e,t,n,o){let r=t.get(e);if(!r||r.rendered)return;let{context:i,pageOptions:a}=xs(r.page,n,o),s=Wi(r.page,i,a);for(;s.firstChild;)e.appendChild(s.firstChild);r.rendered=true;}function ab(e,t,n,o){let r=t.get(e);if(!r)return;let{context:i,pageOptions:a}=xs(r.page,n,o),l=Wi(r.page,i,a).querySelector(`.${Mn.content}`),u=e.querySelector(`.${Mn.content}`);l&&u?e.replaceChild(l,u):(e.innerHTML="",r.rendered=false,Oi(e,t,n,o));}function sb(e,t){let n=t.get(e);!n||!n.rendered||(e.innerHTML="",n.rendered=false);}var _i=class{constructor(t={}){chunkPCJ5ACUV_cjs.d(this,"container",null);chunkPCJ5ACUV_cjs.d(this,"blockLookup",new Map);chunkPCJ5ACUV_cjs.d(this,"pageStates",[]);chunkPCJ5ACUV_cjs.d(this,"totalPages",0);chunkPCJ5ACUV_cjs.d(this,"options");chunkPCJ5ACUV_cjs.d(this,"doc");this.options=t,this.doc=t.document??document;}setBlockLookup(t){this.blockLookup=t;}mount(t){this.container=t,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let t=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${t}px`,this.container.style.padding=`${t}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(t){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:n}=t;this.totalPages=n.length,this.container.innerHTML="",this.pageStates=[];for(let o=0;o<n.length;o++){let r=n[o],i={pageNumber:r.number,totalPages:this.totalPages,section:"body"},a=this.renderPageWithLookup(r,i);this.container.appendChild(a),this.pageStates.push({element:a,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(t,n){let o=this.doc.createElement("div");o.className="layout-page",o.dataset.pageNumber=String(t.number),o.style.position="relative",o.style.width=`${t.size.w}px`,o.style.height=`${t.size.h}px`,o.style.backgroundColor=this.options.pageBackground??"#ffffff",o.style.overflow="hidden",this.options.showShadow&&(o.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${t.margins.top}px`,r.style.left=`${t.margins.left}px`,r.style.right=`${t.margins.right}px`,r.style.bottom=`${t.margins.bottom}px`,r.style.overflow="visible";for(let i of t.fragments){let a=this.renderFragmentWithLookup(i,n);this.applyFragmentPosition(a,i),r.appendChild(a);}return o.appendChild(r),o}renderFragmentWithLookup(t,n){let o=this.blockLookup.get(String(t.blockId));if(t.kind==="paragraph"&&o){let r=o.block,i=o.measure;return jn(t,r,i,n,{document:this.doc})}if(t.kind==="table"&&o){let r=o.block,i=o.measure;return Di(t,r,i,n,{document:this.doc})}if(t.kind==="image"&&o){let r=o.block,i=o.measure;return Hi(t,r,i,n,{document:this.doc})}return jo(t,n,{document:this.doc})}applyFragmentPosition(t,n){t.style.position="absolute",t.style.left=`${n.x}px`,t.style.top=`${n.y}px`,t.style.width=`${n.width}px`,"height"in n&&(t.style.height=`${n.height}px`);}getPageCount(){return this.totalPages}getPageElement(t){return this.pageStates[t]?.element??null}scrollToPage(t){let n=this.pageStates.find(o=>o.pageNumber===t);n?.element&&n.element.scrollIntoView({behavior:"smooth",block:"start"});}};var fn,En,In,mn,mo,Un,yu,ks,Vi=class{constructor(){chunkPCJ5ACUV_cjs.f(this,Un);chunkPCJ5ACUV_cjs.f(this,fn,0);chunkPCJ5ACUV_cjs.f(this,En,0);chunkPCJ5ACUV_cjs.f(this,In,false);chunkPCJ5ACUV_cjs.f(this,mn,null);chunkPCJ5ACUV_cjs.f(this,mo,new Set);}setStateSeq(t){chunkPCJ5ACUV_cjs.g(this,fn,t);}incrementStateSeq(){return ++chunkPCJ5ACUV_cjs.i(this,fn)._}getStateSeq(){return chunkPCJ5ACUV_cjs.e(this,fn)}getRenderSeq(){return chunkPCJ5ACUV_cjs.e(this,En)}onLayoutStart(){chunkPCJ5ACUV_cjs.g(this,In,true);}onLayoutComplete(t){chunkPCJ5ACUV_cjs.g(this,En,t),chunkPCJ5ACUV_cjs.g(this,In,false),chunkPCJ5ACUV_cjs.h(this,Un,yu).call(this);}isSafeToRender(){return !chunkPCJ5ACUV_cjs.e(this,In)&&chunkPCJ5ACUV_cjs.e(this,En)>=chunkPCJ5ACUV_cjs.e(this,fn)}requestRender(){this.isSafeToRender()?chunkPCJ5ACUV_cjs.h(this,Un,ks).call(this):chunkPCJ5ACUV_cjs.g(this,mn,()=>chunkPCJ5ACUV_cjs.h(this,Un,ks).call(this));}onRender(t){return chunkPCJ5ACUV_cjs.e(this,mo).add(t),()=>{chunkPCJ5ACUV_cjs.e(this,mo).delete(t);}}reset(){chunkPCJ5ACUV_cjs.g(this,fn,0),chunkPCJ5ACUV_cjs.g(this,En,0),chunkPCJ5ACUV_cjs.g(this,In,false),chunkPCJ5ACUV_cjs.g(this,mn,null);}getDebugInfo(){return {stateSeq:chunkPCJ5ACUV_cjs.e(this,fn),renderSeq:chunkPCJ5ACUV_cjs.e(this,En),layoutUpdating:chunkPCJ5ACUV_cjs.e(this,In),hasPendingRender:chunkPCJ5ACUV_cjs.e(this,mn)!==null,isSafe:this.isSafeToRender()}}};fn=new WeakMap,En=new WeakMap,In=new WeakMap,mn=new WeakMap,mo=new WeakMap,Un=new WeakSet,yu=function(){if(chunkPCJ5ACUV_cjs.e(this,mn)&&this.isSafeToRender()){let t=chunkPCJ5ACUV_cjs.e(this,mn);chunkPCJ5ACUV_cjs.g(this,mn,null),t();}},ks=function(){for(let t of chunkPCJ5ACUV_cjs.e(this,mo))try{t();}catch(n){console.error("LayoutSelectionGate: render callback error",n);}};var Su=".layout-page-content .layout-line";function lb(e){let t=e.parentElement;for(;t&&t!==document.documentElement;){let{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement;}return null}function cb(e){let t=lb(e);if(!t)return;let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=40;n.bottom>o.bottom-r?t.scrollTop+=n.bottom-o.bottom+r:n.top<o.top+r&&(t.scrollTop-=o.top-n.top+r);}function ku({pagesContainerRef:e}){let t=Nu.useRef(null),n=Nu.useRef(-1),o=Nu.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let d of Array.from(l)){let c=d,p=Number(c.dataset.pmStart),f=Number(c.dataset.pmEnd);if(c.classList.contains("layout-run-tab")){if(s>=p&&s<f)return c.getBoundingClientRect().left;continue}if(s>=p&&s<=f&&d.firstChild?.nodeType===Node.TEXT_NODE){let m=d.firstChild,b=Math.min(s-p,m.length),g=c.ownerDocument;if(!g)continue;let S=g.createRange();return S.setStart(m,b),S.setEnd(m,b),S.getBoundingClientRect().left}}let u=e.current.querySelectorAll(".layout-empty-run");for(let d of Array.from(u)){let c=d.closest(".layout-paragraph");if(!c)continue;let p=Number(c.dataset.pmStart),f=Number(c.dataset.pmEnd);if(s>=p&&s<=f)return d.getBoundingClientRect().left}return null},[e]),r=Nu.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll(Su);for(let u of Array.from(l)){let d=u,c=d.querySelectorAll("span[data-pm-start][data-pm-end]");for(let p of Array.from(c)){let f=p,m=Number(f.dataset.pmStart),b=Number(f.dataset.pmEnd);if(s>=m&&s<=b)return d}}for(let u of Array.from(l)){let d=u,c=d.closest(".layout-paragraph");if(!c)continue;let p=Number(c.dataset.pmStart),f=Number(c.dataset.pmEnd);if(s>=p&&s<=f&&c.querySelector(".layout-line")===d)return d}return null},[e]),i=Nu.useCallback((s,l)=>{let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let f=s.closest(".layout-paragraph");return f?.dataset.pmStart?Number(f.dataset.pmStart)+1:null}for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect(),g=Number(m.dataset.pmStart),S=Number(m.dataset.pmEnd);if(m.classList.contains("layout-run-tab")){if(l>=b.left&&l<=b.right){let C=(b.left+b.right)/2;return l<C?g:S}continue}if(l>=b.left&&l<=b.right){let C=m.firstChild;if(!C||C.nodeType!==Node.TEXT_NODE)return g;let k=C,E=m.ownerDocument;if(!E)return g;let R=0,_=k.length;for(;R<_;){let V=Math.floor((R+_)/2),$=E.createRange();$.setStart(k,V),$.setEnd(k,V),l<$.getBoundingClientRect().left?_=V:R=V+1;}if(R>0&&R<=k.length){let V=E.createRange();V.setStart(k,R-1),V.setEnd(k,R-1);let $=V.getBoundingClientRect().left;V.setStart(k,Math.min(R,k.length)),V.setEnd(k,Math.min(R,k.length));let L=V.getBoundingClientRect().left;if(Math.abs(l-$)<Math.abs(l-L))return g+(R-1)}return g+Math.min(R,S-g)}}let d=null,c=1/0;for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect(),g=l<b.left?b.left-l:l-b.right;g<c&&(c=g,d=m);}if(!d)return null;let p=d.getBoundingClientRect();return l<p.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)},[]),a=Nu.useCallback((s,l)=>{if(l.key!=="ArrowUp"&&l.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(l.key)||l.key.length===1&&!l.ctrlKey&&!l.metaKey)&&(t.current=null,n.current=-1),false;if(l.ctrlKey||l.metaKey)return t.current=null,n.current=-1,false;if(!e.current)return false;let u=Array.from(e.current.querySelectorAll(Su));if(u.length===0)return false;let{from:d,anchor:c}=s.state.selection;if(t.current===null){let k=o(d);if(k===null)return false;t.current=k;}let p;if(n.current>=0&&n.current<u.length)p=n.current;else {let k=r(d);if(!k||(p=u.indexOf(k),p===-1))return false}let f=l.key==="ArrowUp"?p-1:p+1;if(f<0||f>=u.length)return n.current=-1,false;let m=u[f],b=i(m,t.current);if(b===null)return false;n.current=f;let{state:g,dispatch:S}=s,C=Math.max(0,Math.min(b,g.doc.content.size));try{let k=l.shiftKey?prosemirrorState.TextSelection.create(g.doc,c,C):prosemirrorState.TextSelection.create(g.doc,C);S(g.tr.setSelection(k));}catch{let k=g.doc.resolve(C),E=l.shiftKey?prosemirrorState.TextSelection.between(g.doc.resolve(c),k):prosemirrorState.TextSelection.near(k);S(g.tr.setSelection(E));}return cb(m),true},[e,o,r,i]);return {stickyXRef:t,lastVisualLineIndexRef:n,getCaretClientX:o,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}var db=12,Gi=8;function Cu(e){let t=[];for(let n of e)if(n.kind==="paragraph")for(let o of n.runs)o.kind==="text"&&o.footnoteRefId!=null&&t.push({footnoteId:o.footnoteRefId,pmPos:o.pmStart??0});return t}function Cs(e,t){let n=new Map;if(t.length===0)return n;for(let o of t)for(let r of e){let i=false;for(let a of r.fragments){let s=a.pmStart??-1,l=a.pmEnd??-1;if(s>=0&&l>=0&&o.pmPos>=s&&o.pmPos<l){let u=n.get(r.number)??[];u.includes(o.footnoteId)||u.push(o.footnoteId),n.set(r.number,u),i=true;break}}if(i)break}return n}function ub(e,t,n){let o=[];for(let a=0;a<e.content.length;a++){let s=e.content[a],l=[];if(a===0){let d={kind:"text",text:`${t} `,fontSize:Gi,superscript:true};l.push(d);}for(let d of s.content){let c=d;if(c.type==="run"&&Array.isArray(c.content)){let p=c.formatting,f={};if(p){if(p.bold&&(f.bold=true),p.italic&&(f.italic=true),p.underline&&(f.underline=true),p.strike&&(f.strike=true),p.color){let m=p.color;m.val?f.color=`#${m.val}`:m.rgb&&(f.color=`#${m.rgb}`);}if(p.fontSize&&(f.fontSize=p.fontSize/2),p.fontFamily){let m=p.fontFamily;f.fontFamily=m.ascii||m.hAnsi;}}f.fontSize||(f.fontSize=Gi);for(let m of c.content){let b=m;b.type==="text"&&typeof b.text=="string"?l.push({kind:"text",text:b.text,...f}):b.type==="tab"?l.push({kind:"tab",...f}):b.type==="break"?l.push({kind:"lineBreak"}):b.type;}}}l.length===0&&l.push({kind:"text",text:"",fontSize:Gi});let u={kind:"paragraph",id:`fn-${e.id}-p${a}`,runs:l};o.push(u);}o.length===0&&o.push({kind:"paragraph",id:`fn-${e.id}-empty`,runs:[{kind:"text",text:"",fontSize:Gi}]});let r=[];for(let a of o)if(a.kind==="paragraph"){let s=Vo(a,n);r.push(s);}let i=r.reduce((a,s)=>s.kind==="paragraph"?a+s.totalHeight:a,0);return {id:e.id,displayNumber:t,blocks:o,measures:r,height:i}}function wu(e,t,n){let o=new Map,r=new Map;for(let s of e)(s.noteType==="normal"||s.noteType==null)&&r.set(s.id,s);let i=1,a=new Set;for(let s of t){if(a.has(s.footnoteId))continue;a.add(s.footnoteId);let l=r.get(s.footnoteId);if(!l)continue;let u=ub(l,i,n);o.set(s.footnoteId,u),i++;}return o}function Tu(e,t){let n=new Map;for(let[o,r]of e){let i=0;for(let a of r){let s=t.get(a);s&&(i+=s.height);}i>0&&(i+=db,n.set(o,i));}return n}var ws=class{constructor(t,n=1){chunkPCJ5ACUV_cjs.d(this,"pagesContainer");chunkPCJ5ACUV_cjs.d(this,"zoom");this.pagesContainer=t,this.zoom=n;}getCoordinatesForPosition(t){let n=this.pagesContainer.getBoundingClientRect(),o=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(o)){let a=i,s=Number(a.dataset.pmStart),l=Number(a.dataset.pmEnd);if(a.classList.contains("layout-run-tab")){if(t>=s&&t<l){let u=a.getBoundingClientRect(),d=a.closest(".layout-line"),c=d?d.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.top-n.top)/this.zoom,height:c/this.zoom}}continue}if(t>=s&&t<=l&&i.firstChild?.nodeType===Node.TEXT_NODE){let u=i.firstChild,d=Math.min(t-s,u.length),c=a.ownerDocument;if(!c)continue;let p=c.createRange();p.setStart(u,d),p.setEnd(u,d);let f=p.getBoundingClientRect(),m=a.closest(".layout-line"),b=m?m.offsetHeight:16;return {x:(f.left-n.left)/this.zoom,y:(f.top-n.top)/this.zoom,height:b/this.zoom}}}let r=this.pagesContainer.querySelectorAll(".layout-empty-run");for(let i of Array.from(r)){let a=i.closest(".layout-paragraph");if(!a)continue;let s=Number(a.dataset.pmStart),l=Number(a.dataset.pmEnd);if(t>=s&&t<=l){let u=i.getBoundingClientRect(),d=i.closest(".layout-line"),c=d?d.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.top-n.top)/this.zoom,height:c/this.zoom}}}return null}findElementsForRange(t,n){let o=[],r=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(r)){let a=i,s=Number(a.dataset.pmStart);Number(a.dataset.pmEnd)>t&&s<n&&o.push(a);}return o}getRectsForRange(t,n){let o=this.pagesContainer.getBoundingClientRect(),r=[],i=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let a of Array.from(i)){let s=a,l=Number(s.dataset.pmStart);if(Number(s.dataset.pmEnd)>t&&l<n){if(s.classList.contains("layout-run-tab")){let m=s.getBoundingClientRect();r.push({x:(m.left-o.left)/this.zoom,y:(m.top-o.top)/this.zoom,width:m.width/this.zoom,height:m.height/this.zoom});continue}if(a.firstChild?.nodeType!==Node.TEXT_NODE)continue;let d=a.firstChild,c=s.ownerDocument;if(!c)continue;let p=Math.max(0,t-l),f=Math.min(d.length,n-l);if(p<f){let m=c.createRange();m.setStart(d,p),m.setEnd(d,f);let b=m.getClientRects();for(let g of Array.from(b))r.push({x:(g.left-o.left)/this.zoom,y:(g.top-o.top)/this.zoom,width:g.width/this.zoom,height:g.height/this.zoom});}}}return r}getContainerOffset(){let t=this.pagesContainer.parentElement;if(!t)return {x:0,y:0};let n=this.pagesContainer.getBoundingClientRect(),o=t.getBoundingClientRect();return {x:(n.left-o.left)/this.zoom,y:(n.top-o.top)/this.zoom}}};function vu(e,t=1){return new ws(e,t)}var gb=816,Iu=1056,Ki={top:96,right:96,bottom:96,left:96},hb=24,bb=[],yb={position:"relative",width:"100%",height:"100%",overflow:"auto",backgroundColor:"var(--doc-bg, #f8f9fa)"},xb={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:24,paddingBottom:24},Sb={position:"relative",display:"flex",flexDirection:"column",alignItems:"center"},kb={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"visible",zIndex:8};function sn(e){return Math.round(e/1440*96)}function Cb(e){return {w:e?.pageWidth?sn(e.pageWidth):gb,h:e?.pageHeight?sn(e.pageHeight):Iu}}function wb(e){let t=e?.marginTop?sn(e.marginTop):Ki.top,n=e?.marginBottom?sn(e.marginBottom):Ki.bottom;return {top:t,right:e?.marginRight?sn(e.marginRight):Ki.right,bottom:n,left:e?.marginLeft?sn(e.marginLeft):Ki.left,header:e?.headerDistance?sn(e.headerDistance):48,footer:e?.footerDistance?sn(e.footerDistance):48}}function Tb(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function Pu(e){return e===void 0?0:Math.round(e*96/914400)}function vb(e,t,n){if(e){if(t==="pct")return n*e/5e3;if(t==="dxa"||!t||t==="auto")return Math.round(e/20*1.333)}}function Fu(e,t){let i=e.columnWidths??[],a=vb(e.width,e.widthType,t);if(i.length===0&&e.rows.length>0){let c=e.rows[0].cells.reduce((m,b)=>m+(b.colSpan??1),0),f=(a??t)/Math.max(1,c);i=Array(c).fill(f);}else if(i.length>0&&a){let c=i.reduce((p,f)=>p+f,0);if(c>0&&Math.abs(c-a)>1){let p=a/c;i=i.map(f=>f*p);}}let s=new Map;for(let c=0;c<e.rows.length;c++){let p=e.rows[c];if(!p)continue;let f=0,m=s.get(c)??new Set;for(;m.has(f);)f++;for(let b of p.cells){let g=b.colSpan??1,S=b.rowSpan??1;if(S>1)for(let C=c+1;C<c+S;C++){s.has(C)||s.set(C,new Set);let k=s.get(C);for(let E=0;E<g;E++)k.add(f+E);}for(f+=g;m.has(f);)f++;}}let l=e.rows.map((c,p)=>{let f=0,m=s.get(p)??new Set;for(;m.has(f);)f++;return {cells:c.cells.map(b=>{let g=b.colSpan??1,S=0;for(let R=0;R<g&&f+R<i.length;R++)S+=i[f+R]??0;for(S===0&&(S=b.width??100),f+=g;m.has(f);)f++;let C=b.padding?.left??7,k=b.padding?.right??7,E=Math.max(1,S-C-k);return {blocks:b.blocks.map(R=>Lu(R,E)),width:S,height:0,colSpan:b.colSpan,rowSpan:b.rowSpan}}),height:0}});for(let c=0;c<l.length;c++){let p=l[c],f=e.rows[c]?.cells,m=0;for(let C=0;C<p.cells.length;C++){let k=p.cells[C],E=f?.[C];k.height=k.blocks.reduce((V,$)=>"totalHeight"in $?V+$.totalHeight:V,0);let R=E?.padding?.top??1,_=E?.padding?.bottom??1;k.height+=R+_,m=Math.max(m,k.height);}let b=e.rows[c],g=b?.height,S=b?.heightRule;g&&S==="exact"?p.height=g:g&&S==="atLeast"?p.height=Math.max(m,g):p.height=Math.max(m,24);}let u=l.reduce((c,p)=>c+p.height,0),d=i.reduce((c,p)=>c+p,0)||a||t;return {kind:"table",rows:l,columnWidths:i,totalWidth:d,totalHeight:u}}function Rb(e,t){let n=[];for(let o=0;o<e.length;o++){let r=e[o];if(r.kind!=="paragraph")continue;let i=r;for(let a of i.runs){if(a.kind!=="image")continue;let s=a;if(!Tb(s))continue;let l=0,u=s.position,d=s.distTop??0,c=s.distBottom??0,p=s.distLeft??12,f=s.distRight??12;if(u?.vertical){let S=u.vertical;S.align==="top"&&S.relativeTo==="margin"?l=0:S.posOffset!==void 0&&(l=Pu(S.posOffset));}let m=l+s.height,b=0,g=0;if(u?.horizontal){let S=u.horizontal;if(S.align==="left")b=s.width+f;else if(S.align==="right")g=s.width+p;else if(S.posOffset!==void 0){let C=Pu(S.posOffset);C<t/2?b=C+s.width+f:g=t-C+p;}}else s.cssFloat==="left"?b=s.width+f:s.cssFloat==="right"&&(g=s.width+p);if(b>0||g>0){let S=u?.vertical?.relativeTo==="margin"||u?.vertical?.relativeTo==="page";n.push({leftMargin:b,rightMargin:g,topY:l-d,bottomY:m+c,anchorBlockIndex:o,isMarginRelative:S});}}}for(let o=0;o<e.length;o++){let r=e[o];if(r.kind!=="table")continue;let i=r,a=i.floating;if(!a)continue;let s=Fu(i,t),l=s.totalWidth,u=s.totalHeight,d=a.leftFromText??12,c=a.rightFromText??12,p=a.topFromText??0,f=a.bottomFromText??0,m=0,b=0,g=0;a.tblpX!==void 0?g=a.tblpX:a.tblpXSpec?a.tblpXSpec==="left"||a.tblpXSpec==="inside"?g=0:a.tblpXSpec==="right"||a.tblpXSpec==="outside"?g=t-l:a.tblpXSpec==="center"&&(g=(t-l)/2):i.justification==="center"?g=(t-l)/2:i.justification==="right"&&(g=t-l),g<t/2?m=g+l+c:b=t-g+d;let S=a.tblpY??0,C=S+u;n.push({leftMargin:m,rightMargin:b,topY:S-p,bottomY:C+f,anchorBlockIndex:o});}return n}function Lu(e,t,n,o){switch(e.kind){case "paragraph":{let r=e;if(!n||n.length===0){let a=ls(r,t);if(a)return a}let i=Vo(r,t,{floatingZones:n,paragraphYOffset:o??0});return (!n||n.length===0)&&cs(r,t,i),i}case "table":return Fu(e,t);case "image":{let r=e;return {kind:"image",width:r.width??100,height:r.height??100}}case "pageBreak":return {kind:"pageBreak"};case "columnBreak":return {kind:"columnBreak"};case "sectionBreak":return {kind:"sectionBreak"};default:return {kind:"paragraph",lines:[],totalHeight:0}}}function Bu(e,t){let n=Rb(e,t),o=n.filter(c=>c.isMarginRelative),r=n.filter(c=>!c.isMarginRelative),i=new Map;for(let c of o){let p=i.get(c.topY)??[];p.push(c),i.set(c.topY,p);}let a=[...r];for(let c of i.values()){let p=Math.min(...c.map(f=>f.anchorBlockIndex));for(let f of c)a.push({...f,anchorBlockIndex:p});}let s=new Map;for(let c of a){let p=s.get(c.anchorBlockIndex)??[];p.push({leftMargin:c.leftMargin,rightMargin:c.rightMargin,topY:c.topY,bottomY:c.bottomY}),s.set(c.anchorBlockIndex,p);}let l=new Set(a.map(c=>c.anchorBlockIndex)),u=0,d=[];return e.map((c,p)=>{l.has(p)&&(u=0,d=s.get(p)??[]);let f=d.length>0?d:void 0;try{let m=performance.now(),b=Lu(c,t,f,u),g=performance.now()-m;return g>500&&console.warn(`[measureBlocks] Block ${p} (${c.kind}) took ${Math.round(g)}ms`),"totalHeight"in b&&(c.kind==="table"&&c.floating||(u+=b.totalHeight)),b}catch(m){return console.error(`[measureBlocks] Error measuring block ${p} (${c.kind}):`,m),{totalHeight:20}}})}function Yi(e){let t=[];for(let n of e){let o=n;if(o.type==="run"&&Array.isArray(o.content)){let r=o.formatting,i={};if(r){if(r.bold&&(i.bold=true),r.italic&&(i.italic=true),r.underline&&(i.underline=true),r.strike&&(i.strike=true),r.color){let a=r.color;a.val?i.color=`#${a.val}`:a.rgb&&(i.color=`#${a.rgb}`);}if(r.fontSize&&(i.fontSize=r.fontSize/2),r.fontFamily){let a=r.fontFamily;i.fontFamily=a.ascii||a.hAnsi;}}for(let a of o.content){let s=a;if(s.type==="text"&&typeof s.text=="string")t.push({kind:"text",text:s.text,...i});else if(s.type==="tab")t.push({kind:"tab",...i});else if(s.type==="break")t.push({kind:"lineBreak"});else if(s.type==="drawing"&&s.image){let l=s.image,u=l.size,d=m=>Math.round(m/914400*96),c=u?.width?d(u.width):100,p=u?.height?d(u.height):100,f=l.position;t.push({kind:"image",src:l.src||"",width:c,height:p,alt:l.alt||void 0,position:f?{horizontal:f.horizontal,vertical:f.vertical}:void 0});}}}if(o.type==="simpleField"){let r=o.fieldType,i={};if(Array.isArray(o.content)&&o.content.length>0){let a=o.content[0];if(a?.type==="run"&&a.formatting){let s=a.formatting;if(s.fontSize&&(i.fontSize=s.fontSize/2),s.fontFamily){let l=s.fontFamily;i.fontFamily=l.ascii||l.hAnsi;}if(s.bold&&(i.bold=true),s.italic&&(i.italic=true),s.color){let l=s.color,u=l.rgb||l.val;u&&(i.color=u.startsWith("#")?u:`#${u}`);}}}if(r==="PAGE")t.push({kind:"field",fieldType:"PAGE",fallback:"1",...i});else if(r==="NUMPAGES")t.push({kind:"field",fieldType:"NUMPAGES",fallback:"1",...i});else if(Array.isArray(o.content)){let a=Yi(o.content);t.push(...a);}continue}if(o.type==="complexField"){let r=o.fieldType,i={};if(Array.isArray(o.fieldResult)&&o.fieldResult.length>0){let a=o.fieldResult[0];if(a?.type==="run"&&a.formatting){let s=a.formatting;if(s.fontSize&&(i.fontSize=s.fontSize/2),s.fontFamily){let l=s.fontFamily;i.fontFamily=l.ascii||l.hAnsi;}if(s.bold&&(i.bold=true),s.italic&&(i.italic=true),s.color){let l=s.color,u=l.rgb||l.val;u&&(i.color=u.startsWith("#")?u:`#${u}`);}}}if(r==="PAGE")t.push({kind:"field",fieldType:"PAGE",fallback:"1",...i});else if(r==="NUMPAGES")t.push({kind:"field",fieldType:"NUMPAGES",fallback:"1",...i});else if(Array.isArray(o.fieldResult)){let a=Yi(o.fieldResult);t.push(...a);}}if(o.type==="hyperlink"&&Array.isArray(o.children)){let r=Yi(o.children);t.push(...r);}}return t}function Mu(e,t){if(!e||!e.content||e.content.length===0)return;let n=[];for(let a of e.content){let s=a;if(s.type==="paragraph"&&Array.isArray(s.content)){let l=s.formatting,u={};if(l&&l.alignment){let c=l.alignment;c==="both"?u.alignment="justify":["left","center","right","justify"].includes(c)&&(u.alignment=c);}let d=Yi(s.content);if(d.length>0){let c={kind:"paragraph",id:String(n.length),runs:d,attrs:Object.keys(u).length>0?u:void 0};n.push(c);}}}if(n.length===0)return;let o=n.map(a=>{if(a.kind!=="paragraph")return a;let s=a;if(!s.runs.some(d=>d.kind==="image"&&"position"in d&&d.position))return a;let u=s.runs.filter(d=>!(d.kind==="image"&&"position"in d&&d.position));return u.length===0&&u.push({kind:"text",text:""}),{...s,runs:u}}),r=Bu(o,t),i=r.reduce((a,s)=>s.kind==="paragraph"?a+s.totalHeight:a,0);return {blocks:n,measures:r,height:i}}function Pb(e,t,n){let o=new Map;if(!n?.package?.footnotes)return o;let r=new Map;for(let i of n.package.footnotes)i.noteType&&i.noteType!=="normal"||r.set(i.id,i);for(let[i,a]of e){let s=[];for(let l of a){let u=r.get(l);if(!u)continue;let c=t.get(l)?.displayNumber??0,p=chunkEH3NY2DQ_cjs.d(u);s.push({displayNumber:String(c),text:p});}s.length>0&&o.set(i,s);}return o}var Mb=Nu.forwardRef(function(t,n){let{document:o,styles:r,theme:i,sectionProperties:a,headerContent:s,footerContent:l,readOnly:u=false,pageGap:d=hb,zoom:c=1,onDocumentChange:p,onSelectionChange:f,externalPlugins:m=bb,extensionManager:b,onReady:g,onRenderedDomContextReady:S,pluginOverlays:C,onHeaderFooterDoubleClick:k,hfEditMode:E,onBodyClick:R,className:_,style:V,commentsSidebarOpen:$=false,sidebarOverlay:L,scrollContainerRef:W}=t,O=Nu.useRef(null),K=Nu.useRef(null),w=Nu.useRef(null),B=Nu.useRef(null),{handlePMKeyDown:te}=ku({pagesContainerRef:K}),he=Nu.useRef(f),me=Nu.useRef(p),Ie=Nu.useRef(g),Te=Nu.useRef(S);he.current=f,me.current=p,Ie.current=g,Te.current=S;let[Re,P]=Nu.useState(null),[I,y]=Nu.useState([]),[M,F]=Nu.useState([]),[A,U]=Nu.useState(false),[Q,N]=Nu.useState([]),[j,G]=Nu.useState(null),[xe,v]=Nu.useState(null),z=Nu.useRef(false),D=Nu.useCallback((T,re)=>{let q=T.tagName==="IMG"?T:T.querySelector("img"),X=(q??T).getBoundingClientRect();return {element:q??T,pmPos:re,width:Math.round(X.width/c),height:Math.round(X.height/c)}},[c]),se=Nu.useRef(false),ue=Nu.useRef(null),pe=Nu.useRef(false),Ee=Nu.useRef(0),ge=Nu.useRef(0),Se=Nu.useRef(0),fe=Nu.useRef({left:0,right:0}),$e=Nu.useRef(null),Qe=Nu.useRef(false),Ge=Nu.useRef(0),tt=Nu.useRef(0),We=Nu.useRef(0),Je=Nu.useRef(0),it=Nu.useRef(null),Oe=Nu.useRef(false),ct=Nu.useRef(false),De=Nu.useRef(0),Pt=Nu.useRef(0),gn=Nu.useRef(0),ln=Nu.useRef(0),It=Nu.useRef(null),Ft=Nu.useRef(false),le=Nu.useRef(null),hn=Nu.useRef(null),Xt=Nu.useRef(null),Qo=5,$t=Nu.useMemo(()=>new Vi,[]),He=Nu.useMemo(()=>Cb(a),[a]),ot=Nu.useMemo(()=>wb(a),[a]),Lt=He.w-ot.left-ot.right,Wt=Nu.useMemo(()=>new _i({pageGap:d,showShadow:true,pageBackground:"#fff"}),[d]);B.current=Wt;let Mt=Nu.useCallback(T=>{let re=performance.now(),q=$t.getStateSeq();$t.onLayoutStart();try{let X=performance.now(),ne=He.h-ot.top-ot.bottom,Y=Yd(T.doc,{theme:i,pageContentHeight:ne}),Z=performance.now()-X;Z>500&&console.warn(`[PagedEditor] toFlowBlocks took ${Math.round(Z)}ms (${Y.length} blocks)`),y(Y),X=performance.now();let J=Bu(Y,Lt);Z=performance.now()-X,Z>1e3&&console.warn(`[PagedEditor] measureBlocks took ${Math.round(Z)}ms (${Y.length} blocks)`),F(J);let ce=Cu(Y),Ce=ce.length>0&&o?.package?.footnotes,be=Mu(s,Lt),we=Mu(l,Lt),Fe=ot.header??48,Le=ot.footer??48,Ye=ot.top-Fe,Xe=ot.bottom-Le,xt=be?.height??0,dt=we?.height??0,Dt=ot;(xt>Ye||dt>Xe)&&(Dt={...ot},xt>Ye&&(Dt.top=Fe+xt),dt>Xe&&(Dt.bottom=Le+dt)),X=performance.now();let zt,Hn=new Map,xo=new Map;if(Ce){let bn=Ei(Y,J,{pageSize:He,margins:Dt});Hn=Cs(bn.pages,ce),xo=wu(o.package.footnotes,ce,Lt);let Qt=Tu(Hn,xo);if(Qt.size>0){zt=Ei(Y,J,{pageSize:He,margins:Dt,footnoteReservedHeights:Qt}),Hn=Cs(zt.pages,ce);for(let[nt,Nn]of Hn){let zn=zt.pages.find(ra=>ra.number===nt);zn&&(zn.footnoteIds=Nn);}}else zt=bn;}else zt=Ei(Y,J,{pageSize:He,margins:Dt});if(Z=performance.now()-X,Z>500&&console.warn(`[PagedEditor] layoutDocument took ${Math.round(Z)}ms (${zt.pages.length} pages)`),P(zt),K.current&&B.current){X=performance.now();let bn=new Map;for(let nt=0;nt<Y.length;nt++){let Nn=Y[nt],zn=J[nt];Nn&&zn&&bn.set(String(Nn.id),{block:Nn,measure:zn});}B.current.setBlockLookup(bn);let Qt=Ce?Pb(Hn,xo,o):void 0;if(Ss(zt.pages,K.current,{pageGap:d,showShadow:!0,pageBackground:"#fff",blockLookup:bn,headerContent:be,footerContent:we,headerDistance:a?.headerDistance?sn(a.headerDistance):void 0,footerDistance:a?.footerDistance?sn(a.footerDistance):void 0,pageBorders:a?.pageBorders,theme:i,footnotesByPage:Qt?.size?Qt:void 0}),Z=performance.now()-X,Z>500&&console.warn(`[PagedEditor] renderPages took ${Math.round(Z)}ms`),S){let nt=vu(K.current,c);S(nt);}}let So=performance.now()-re;So>2e3&&console.warn(`[PagedEditor] Layout pipeline took ${Math.round(So)}ms total (${Y.length} blocks, ${J.length} measures)`);}catch(X){console.error("[PagedEditor] Layout pipeline error:",X);}$t.onLayoutComplete(q);},[Lt,He,ot,d,c,$t,s,l,a,S,o]),_t=Nu.useRef(null),Zn=Nu.useCallback(T=>{if(_t.current){_t.current.state=T;return}let re=requestAnimationFrame(()=>{let q=_t.current;_t.current=null,q&&Mt(q.state);});_t.current={rafId:re,state:T};},[Mt]);Nu.useEffect(()=>()=>{_t.current&&(cancelAnimationFrame(_t.current.rafId),_t.current=null);},[]);let Jn=Nu.useCallback((T,re=1)=>{if(!K.current)return null;let q=K.current.parentElement?.querySelector('[data-testid="selection-overlay"]');if(!q)return null;let X=q.getBoundingClientRect(),ne=K.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Z of Array.from(ne)){let J=Z,ce=Number(J.dataset.pmStart),Ce=Number(J.dataset.pmEnd);if(J.classList.contains("layout-run-tab")){if(T>=ce&&T<Ce){let be=J.getBoundingClientRect(),we=J.closest(".layout-page"),Fe=we?Number(we.dataset.pageNumber)-1:0,Le=J.closest(".layout-line"),Ye=Le?Le.offsetHeight:16;return {x:(be.left-X.left)/re,y:(be.top-X.top)/re,height:Ye,pageIndex:Fe}}continue}if(T>=ce&&T<=Ce&&Z.firstChild?.nodeType===Node.TEXT_NODE){let be=Z.firstChild,we=Math.min(T-ce,be.length),Fe=J.ownerDocument;if(!Fe)continue;let Le=Fe.createRange();Le.setStart(be,we),Le.setEnd(be,we);let Ye=Le.getBoundingClientRect(),Xe=J.closest(".layout-page"),xt=Xe?Number(Xe.dataset.pageNumber)-1:0,dt=J.closest(".layout-line"),Dt=dt?dt.offsetHeight:16;return {x:(Ye.left-X.left)/re,y:(Ye.top-X.top)/re,height:Dt,pageIndex:xt}}}let Y=K.current.querySelectorAll(".layout-empty-run");for(let Z of Array.from(Y)){let J=Z.closest(".layout-paragraph");if(!J)continue;let ce=Number(J.dataset.pmStart),Ce=Number(J.dataset.pmEnd);if(T>=ce&&T<=Ce){let be=Z.getBoundingClientRect(),we=J.closest(".layout-page"),Fe=we?Number(we.dataset.pageNumber)-1:0,Le=Z.closest(".layout-line"),Ye=Le?Le.offsetHeight:16;return {x:(be.left-X.left)/re,y:(be.top-X.top)/re,height:Ye,pageIndex:Fe}}}return null},[]),Bt=Nu.useCallback(T=>{let{from:re,to:q}=T.selection;if(he.current?.(re,q),K.current){let X=K.current.querySelectorAll(".layout-table-cell-selected");for(let Z of Array.from(X))Z.classList.remove("layout-table-cell-selected");let ne=T.selection;if("$anchorCell"in ne&&typeof ne.forEachCell=="function"){let Z=[];ne.forEachCell((ce,Ce)=>{Z.push([Ce,Ce+ce.nodeSize]);});let J=K.current.querySelectorAll(".layout-table-cell");for(let ce of Array.from(J)){let Ce=ce,be=Ce.dataset.pmStart;if(be!==void 0){let we=Number(be);for(let[Fe,Le]of Z)if(we>=Fe&&we<Le){Ce.classList.add("layout-table-cell-selected");break}}}}}if(!(!Re||I.length===0))if(re===q){let X=Jn(re,c);if(X)G(X);else {let ne=K.current?.parentElement?.querySelector('[data-testid="selection-overlay"]'),Y=K.current?.querySelector(".layout-page");if(ne&&Y){let Z=ne.getBoundingClientRect(),J=Y.getBoundingClientRect(),ce=chunk4CUGBNL2_cjs.l(Re,I,M,re);G(ce?{...ce,x:ce.x+(J.left-Z.left)/c,y:ce.y+(J.top-Z.top)/c}:null);}else G(null);}N([]);}else {let X=K.current?.parentElement?.querySelector('[data-testid="selection-overlay"]');if(X&&K.current){let ne=X.getBoundingClientRect(),Y=[],Z=K.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let J of Array.from(Z)){let ce=J,Ce=Number(ce.dataset.pmStart);if(Number(ce.dataset.pmEnd)>re&&Ce<q){if(ce.classList.contains("layout-run-tab")){let Xe=ce.getBoundingClientRect(),xt=ce.closest(".layout-page"),dt=xt?Number(xt.dataset.pageNumber)-1:0;Y.push({x:(Xe.left-ne.left)/c,y:(Xe.top-ne.top)/c,width:Xe.width/c,height:Xe.height/c,pageIndex:dt});continue}if(J.firstChild?.nodeType!==Node.TEXT_NODE)continue;let we=J.firstChild,Fe=ce.ownerDocument;if(!Fe)continue;let Le=Math.max(0,re-Ce),Ye=Math.min(we.length,q-Ce);if(Le<Ye){let Xe=Fe.createRange();Xe.setStart(we,Le),Xe.setEnd(we,Ye);let xt=Xe.getClientRects();for(let dt of Array.from(xt)){let Dt=ce.closest(".layout-page"),zt=Dt?Number(Dt.dataset.pageNumber)-1:0;Y.push({x:(dt.left-ne.left)/c,y:(dt.top-ne.top)/c,width:dt.width/c,height:dt.height/c,pageIndex:zt});}}}}if(Y.length>0)N(Y);else {let J=K.current.querySelector(".layout-page");if(J){let ce=J.getBoundingClientRect(),Ce=(ce.left-ne.left)/c,be=(ce.top-ne.top)/c,Fe=chunk4CUGBNL2_cjs.k(Re,I,M,re,q).map(Le=>({...Le,x:Le.x+Ce,y:Le.y+be}));N(Fe);}else N([]);}}else N([]);G(null);}},[Re,I,M,Jn,c]),An=Nu.useCallback((T,re)=>{if(T.docChanged){$t.incrementStateSeq(),Zn(re);let q=w.current?.getDocument();q&&me.current?.(q);}$t.requestRender(),T.docChanged||Bt(re);},[Zn,Bt,$t]),er=Nu.useCallback(T=>{let{selection:re}=T;re instanceof prosemirrorState.NodeSelection&&re.node.type.name==="image"?(N([]),G(null)):$t.isSafeToRender()&&Bt(T),requestAnimationFrame(()=>{let q=w.current?.getView();if(!q){v(null);return}let{selection:X}=q.state;if(X instanceof prosemirrorState.NodeSelection&&X.node.type.name==="image"){let ne=X.from,Y=K.current?.querySelector(`[data-pm-start="${ne}"]`);if(Y){v(D(Y,ne));return}}z.current||v(null);});},[Bt,c,D,$t]),At=Nu.useCallback((T,re)=>{if(!K.current||!Re)return null;let q=iu(K.current,T,re,c);if(q!==null)return q;let X=K.current.querySelectorAll(".layout-page"),ne=-1,Y=null;for(let we=0;we<X.length;we++){let Le=X[we].getBoundingClientRect();if(T>=Le.left&&T<=Le.right&&re>=Le.top&&re<=Le.bottom){ne=we,Y=Le;break}}if(ne<0||!Y)return null;let Z=(T-Y.left)/c,J=(re-Y.top)/c,ce=Re.pages[ne];if(!ce)return null;let Ce={pageIndex:ne,page:ce,pageY:J},be=chunk4CUGBNL2_cjs.i(Ce,I,M,{x:Z,y:J});if(!be)return null;if(be.fragment.kind==="table"){let we=chunk4CUGBNL2_cjs.j(Ce,I,M,{x:Z,y:J});return us(be,we)}return us(be)},[Re,I,M,c]),Zt=Nu.useCallback(T=>{let re=w.current?.getView();if(!re)return null;try{let q=re.state.doc.resolve(T);for(let X=q.depth;X>0;X--){let ne=q.node(X);if(ne.type.name==="tableCell"||ne.type.name==="tableHeader")return q.before(X)}}catch{}return null},[]),wt=Nu.useCallback(T=>{let re=["layout-block-image","layout-image","layout-page-floating-image"],q=X=>!!X.dataset.pmStart&&re.some(ne=>X.classList.contains(ne));return T.tagName==="IMG"&&T.classList.contains("layout-run-image")?T:T.tagName==="IMG"&&T.parentElement&&q(T.parentElement)?T.parentElement:q(T)?T:null},[]),Qn=Nu.useCallback(T=>{let re=K.current;if(!re)return;let q=re.querySelector(`[data-pm-start="${T}"]`);q&&q.scrollIntoView({behavior:"smooth",block:"center"});},[]),Ne=Nu.useCallback(T=>{if(!w.current||T.button!==0)return;if(T.target.closest('a[href^="#"]')){T.preventDefault(),T.stopPropagation();return}if(u)return;if(E&&R){let Y=T.target;if(!(Y.closest(".layout-page-header")||Y.closest(".layout-page-footer")||Y.closest(".hf-inline-editor"))){T.preventDefault(),T.stopPropagation(),R();return}}if(!E){let Y=T.target;if(Y.closest(".layout-page-header")||Y.closest(".layout-page-footer")){T.preventDefault(),w.current&&(w.current.setSelection(0),w.current.focus(),U(true));return}}let q=T.target;if(q.classList.contains("layout-table-resize-handle")){T.preventDefault(),T.stopPropagation(),pe.current=true,Ee.current=T.clientX,$e.current=q,q.classList.add("dragging");let Y=parseInt(q.dataset.columnIndex??"0",10);ge.current=Y,Se.current=parseInt(q.dataset.tablePmStart??"0",10);let Z=w.current.getView();if(Z){let J=Z.state.doc.resolve(Se.current+1);for(let ce=J.depth;ce>=0;ce--){let Ce=J.node(ce);if(Ce.type.name==="table"){let be=Ce.attrs.columnWidths;be&&be[Y]!==void 0&&be[Y+1]!==void 0&&(fe.current={left:be[Y],right:be[Y+1]});break}}}return}if(q.classList.contains("layout-table-row-resize-handle")||q.classList.contains("layout-table-edge-handle-bottom")){T.preventDefault(),T.stopPropagation(),Qe.current=true,Ge.current=T.clientY,it.current=q,Oe.current=q.dataset.isEdge==="bottom",q.classList.add("dragging");let Y=parseInt(q.dataset.rowIndex??"0",10);tt.current=Y,We.current=parseInt(q.dataset.tablePmStart??"0",10);let Z=w.current.getView();if(Z){let J=Z.state.doc.resolve(We.current+1);for(let ce=J.depth;ce>=0;ce--){let Ce=J.node(ce);if(Ce.type.name==="table"){let be=null,we=0;if(Ce.forEach(Fe=>{we===Y&&(be=Fe),we++;}),be){let Fe=be.attrs.height;if(Fe)Je.current=Fe;else {let Ye=q.closest(".layout-table")?.querySelector(`[data-row-index="${Y}"]`),Xe=Ye?Ye.getBoundingClientRect().height:30;Je.current=Math.round(Xe*15);}}break}}}return}if(q.classList.contains("layout-table-edge-handle-right")){T.preventDefault(),T.stopPropagation(),ct.current=true,De.current=T.clientX,It.current=q,q.classList.add("dragging");let Y=parseInt(q.dataset.columnIndex??"0",10);Pt.current=Y,gn.current=parseInt(q.dataset.tablePmStart??"0",10);let Z=w.current.getView();if(Z){let J=Z.state.doc.resolve(gn.current+1);for(let ce=J.depth;ce>=0;ce--){let Ce=J.node(ce);if(Ce.type.name==="table"){let be=Ce.attrs.columnWidths;be&&be[Y]!==void 0&&(ln.current=be[Y]);break}}}return}let X=wt(q);if(X){T.preventDefault(),T.stopPropagation();let Y=X.dataset.pmStart;if(Y!==void 0){let Z=parseInt(Y,10);w.current.setNodeSelection(Z),v(D(X,Z)),N([]),G(null);}w.current.focus(),U(true);return}v(null),T.preventDefault();let ne=At(T.clientX,T.clientY);if(ne!==null){let Y=Zt(ne);le.current=Y,Ft.current=false,hn.current=null,Xt.current=null,se.current=true,ue.current=ne,w.current.setSelection(ne);}else {le.current=null,Ft.current=false;let Y=w.current.getView();if(Y){let Z=Math.max(0,Y.state.doc.content.size-1);w.current.setSelection(Z),ue.current=Z,se.current=true;}}w.current.focus(),U(true);},[At,Zt,u,E,R,c]),qe=Nu.useCallback(T=>{if(pe.current){T.preventDefault();let X=T.clientX-Ee.current;if($e.current){let ne=parseFloat($e.current.style.left);$e.current.style.left=`${ne+X}px`,Ee.current=T.clientX;let Y=Math.round(X*15),Z=300,J=fe.current.left+Y,ce=fe.current.right-Y;J>=Z&&ce>=Z&&(fe.current={left:J,right:ce});}return}if(Qe.current){T.preventDefault();let X=T.clientY-Ge.current;if(it.current){let ne=parseFloat(it.current.style.top);it.current.style.top=`${ne+X}px`,Ge.current=T.clientY;let Y=Math.round(X*15),Z=200,J=Je.current+Y;J>=Z&&(Je.current=J);}return}if(ct.current){T.preventDefault();let X=T.clientX-De.current;if(It.current){let ne=parseFloat(It.current.style.left);It.current.style.left=`${ne+X}px`,De.current=T.clientX;let Y=Math.round(X*15),Z=300,J=ln.current+Y;J>=Z&&(ln.current=J);}return}if(!se.current||ue.current===null||!w.current||!K.current)return;let re=At(T.clientX,T.clientY);if(re===null)return;if(le.current!==null){if(Ft.current){let ne=Zt(re);if(ne!==null){w.current.setCellSelection(le.current,ne);return}}let X=Zt(re);if(X!==null&&X!==le.current){Ft.current=true,w.current.setCellSelection(le.current,X),Xt.current=null;return}if(hn.current!==null&&re===hn.current){if(Xt.current===null)Xt.current=T.clientX;else if(Math.abs(T.clientX-Xt.current)>=Qo){Ft.current=true,w.current.setCellSelection(le.current,le.current),Xt.current=null;return}}else Xt.current=null,hn.current=re;}let q=ue.current;w.current.setSelection(q,re);},[At,Zt]),bo=Nu.useCallback(()=>{if(pe.current){pe.current=false,$e.current&&($e.current.classList.remove("dragging"),$e.current=null);let T=w.current?.getView();if(T){let re=Se.current,q=ge.current,{left:X,right:ne}=fe.current,Y=T.state.doc.resolve(re+1);for(let Z=Y.depth;Z>=0;Z--){let J=Y.node(Z);if(J.type.name==="table"){let ce=Y.before(Z),Ce=T.state.tr,be=[...J.attrs.columnWidths];be[q]=X,be[q+1]=ne,Ce.setNodeMarkup(ce,void 0,{...J.attrs,columnWidths:be});let we=ce+1;J.forEach(Fe=>{let Le=we+1,Ye=0;Fe.forEach(Xe=>{let xt=Xe.attrs.colspan||1;if(Ye===q||Ye===q+1){let dt=Ye===q?X:ne;Ce.setNodeMarkup(Ce.mapping.map(Le),void 0,{...Xe.attrs,width:dt,widthType:"dxa",colwidth:null});}Le+=Xe.nodeSize,Ye+=xt;}),we+=Fe.nodeSize;}),T.dispatch(Ce);break}}}return}if(Qe.current){Qe.current=false,it.current&&(it.current.classList.remove("dragging"),it.current=null);let T=w.current?.getView();if(T){let re=We.current,q=tt.current,X=Je.current,ne=T.state.doc.resolve(re+1);for(let Y=ne.depth;Y>=0;Y--){let Z=ne.node(Y);if(Z.type.name==="table"){let J=ne.before(Y),ce=T.state.tr,Ce=J+1,be=0;Z.forEach(we=>{be===q&&ce.setNodeMarkup(ce.mapping.map(Ce),void 0,{...we.attrs,height:X,heightRule:"atLeast"}),Ce+=we.nodeSize,be++;}),T.dispatch(ce);break}}}return}if(ct.current){ct.current=false,It.current&&(It.current.classList.remove("dragging"),It.current=null);let T=w.current?.getView();if(T){let re=gn.current,q=Pt.current,X=ln.current,ne=T.state.doc.resolve(re+1);for(let Y=ne.depth;Y>=0;Y--){let Z=ne.node(Y);if(Z.type.name==="table"){let J=ne.before(Y),ce=T.state.tr,Ce=[...Z.attrs.columnWidths];Ce[q]=X,ce.setNodeMarkup(J,void 0,{...Z.attrs,columnWidths:Ce});let be=J+1;Z.forEach(we=>{let Fe=be+1,Le=0;we.forEach(Ye=>{let Xe=Ye.attrs.colspan||1;Le===q&&ce.setNodeMarkup(ce.mapping.map(Fe),void 0,{...Ye.attrs,width:X,widthType:"dxa",colwidth:null}),Fe+=Ye.nodeSize,Le+=Xe;}),be+=we.nodeSize;}),T.dispatch(ce);break}}}return}se.current=false,Ft.current=false,hn.current=null,Xt.current=null;},[]);Nu.useEffect(()=>(window.addEventListener("mousemove",qe),window.addEventListener("mouseup",bo),()=>{window.removeEventListener("mousemove",qe),window.removeEventListener("mouseup",bo);}),[qe,bo]);let Ji=Nu.useCallback(T=>{let re=T.target.closest('a[href^="#"]');if(re){T.preventDefault(),T.stopPropagation();let q=re.getAttribute("href")?.substring(1);if(q&&w.current){let X=w.current.getView();if(X){let ne=null;X.state.doc.descendants((Y,Z)=>{if(ne!==null)return false;if(Y.type.name==="paragraph"&&Y.attrs.bookmarks?.some(ce=>ce.name===q))return ne=Z,false}),ne!==null&&(Qn(ne),w.current.setSelection(ne+1));}}return}if(T.detail===2&&k){let q=T.target,X=q.closest(".layout-page-header"),ne=q.closest(".layout-page-footer");if(X){T.preventDefault(),T.stopPropagation(),k("header");return}if(ne){T.preventDefault(),T.stopPropagation(),k("footer");return}}if(T.detail===2&&w.current){let q=At(T.clientX,T.clientY);if(q!==null){let X=Zt(q);if(X!==null){T.preventDefault(),T.stopPropagation(),w.current.setCellSelection(X,X);return}let ne=w.current.getView();if(ne){let{doc:Y}=ne.state,Z=Y.resolve(q),J=Z.parent;if(J.isTextblock){let ce=J.textContent,Ce=Z.parentOffset,be=Ce;for(;be>0&&/\w/.test(ce[be-1]);)be--;let we=Ce;for(;we<ce.length&&/\w/.test(ce[we]);)we++;let Fe=Z.start()+be,Le=Z.start()+we;Fe<Le&&w.current.setSelection(Fe,Le);}}}}if(T.detail===3&&w.current){let q=At(T.clientX,T.clientY);if(q!==null){let X=w.current.getView();if(X){let{doc:ne}=X.state,Y=ne.resolve(q),Z=Y.start(Y.depth),J=Y.end(Y.depth);w.current.setSelection(Z,J);}}}},[At,k]),gt=Nu.useCallback(T=>{u||T.target.closest(".docx-comments-sidebar")||(w.current?.focus(),U(true));},[u]),ht=Nu.useCallback(T=>{let re=T.relatedTarget;re&&O.current?.contains(re)||U(false);},[]),tr=Nu.useCallback((T,re,q)=>{let X=w.current?.getView();if(X)try{let ne=X.state.doc.nodeAt(T);if(!ne||ne.type.name!=="image")return;let Y=X.state.tr.setNodeMarkup(T,void 0,{...ne.attrs,width:re,height:q});X.dispatch(Y),w.current?.setNodeSelection(T);}catch{}},[]),Nt=Nu.useCallback(()=>{z.current=true;},[]),Jt=Nu.useCallback(()=>{z.current=false;},[]),yo=Nu.useCallback((T,re,q)=>{let X=w.current?.getView();if(X)try{let ne=X.state.doc.nodeAt(T);if(!ne||ne.type.name!=="image")return;if(ne.attrs.displayMode==="float"||ne.attrs.wrapType&&["square","tight","through"].includes(ne.attrs.wrapType)){let Z=K.current?.querySelectorAll(".layout-page");if(!Z||Z.length===0)return;let J=null;for(let xt of Z){let dt=xt.getBoundingClientRect();if(q>=dt.top&&q<=dt.bottom){J=xt.querySelector(".layout-page-content");break}}if(J||(J=Z[Z.length-1].querySelector(".layout-page-content")),!J)return;let ce=J.getBoundingClientRect(),Ce=(re-ce.left)/c,be=(q-ce.top)/c,we=914400/96,Fe=Math.round(Ce*we),Le=Math.round(be*we),Ye={horizontal:{posOffset:Fe,relativeTo:"margin"},vertical:{posOffset:Le,relativeTo:"margin"}},Xe=X.state.tr.setNodeMarkup(T,void 0,{...ne.attrs,position:Ye});X.dispatch(Xe),w.current?.setNodeSelection(T);}else {let Z=At(re,q);if(Z===null||Z===T||Z===T+1)return;let J=X.state.tr;if(Z<=T)J=J.delete(T,T+ne.nodeSize),J=J.insert(Z,ne),w.current?.setNodeSelection(Z);else {J=J.delete(T,T+ne.nodeSize);let ce=Z-ne.nodeSize;J=J.insert(Math.min(ce,J.doc.content.size),ne),w.current?.setNodeSelection(Math.min(ce,J.doc.content.size-1));}X.dispatch(J);}}catch{}},[At,c]),Dn=Nu.useCallback(()=>{z.current=true;},[]),Qi=Nu.useCallback(()=>{z.current=false;},[]),ea=Nu.useCallback(T=>{if(!u){if(w.current?.isFocused()||(w.current?.focus(),U(true)),T.key===" "&&!T.ctrlKey&&!T.metaKey){T.preventDefault();let re=w.current?.getView();if(re){let{from:q,to:X}=re.state.selection;re.someProp("handleTextInput",Y=>Y(re,q,X," "))||re.dispatch(re.state.tr.insertText(" "));}return}["PageUp","PageDown"].includes(T.key)&&!T.metaKey&&T.ctrlKey,T.key==="Home"&&(T.metaKey||T.ctrlKey)&&O.current&&(O.current.scrollTop=0),T.key==="End"&&(T.metaKey||T.ctrlKey)&&O.current&&(O.current.scrollTop=O.current.scrollHeight);}},[u]),ta=Nu.useCallback(T=>{u||T.target.closest(".docx-comments-sidebar")||w.current?.isFocused()||(w.current?.focus(),U(true));},[u]),na=Nu.useCallback(T=>{Mt(T.state),Bt(T.state),u||requestAnimationFrame(()=>{T.focus(),U(true);});},[Mt,Bt,u]);Nu.useEffect(()=>{let T=()=>{let re=w.current?.getView();re&&(chunk4CUGBNL2_cjs.c(),ds(),Mt(re.state),Bt(re.state));};return window.document.fonts.addEventListener("loadingdone",T),()=>{window.document.fonts.removeEventListener("loadingdone",T);}},[]);let nr=Nu.useRef(0);Nu.useEffect(()=>{if(nr.current===0){nr.current=1;return}let T=w.current?.getView();T&&Mt(T.state);},[s,l,Mt]),Nu.useEffect(()=>{let T=O.current;if(!T)return;let re=new ResizeObserver(()=>{let q=w.current?.getState();q&&Bt(q);});return re.observe(T),()=>re.disconnect()},[Bt]),Nu.useImperativeHandle(n,()=>({getDocument(){return w.current?.getDocument()??null},getState(){return w.current?.getState()??null},getView(){return w.current?.getView()??null},focus(){w.current?.focus(),U(true);},blur(){w.current?.blur(),U(false);},isFocused(){return w.current?.isFocused()??false},dispatch(T){w.current?.dispatch(T);},undo(){return w.current?.undo()??false},redo(){return w.current?.redo()??false},setSelection(T,re){w.current?.setSelection(T,re);},getLayout(){return Re},relayout(){let T=w.current?.getState();T&&Mt(T);},scrollToPosition:Qn}),[Re,Mt,Qn]),Nu.useEffect(()=>{let T=w.current?.getState();Re&&T&&Bt(T);},[Re,Bt]),Nu.useEffect(()=>{Ie.current&&w.current&&Ie.current({getDocument:()=>w.current?.getDocument()??null,getState:()=>w.current?.getState()??null,getView:()=>w.current?.getView()??null,focus:()=>{w.current?.focus(),U(true);},blur:()=>{w.current?.blur(),U(false);},isFocused:()=>w.current?.isFocused()??false,dispatch:T=>w.current?.dispatch(T),undo:()=>w.current?.undo()??false,redo:()=>w.current?.redo()??false,setSelection:(T,re)=>w.current?.setSelection(T,re),getLayout:()=>Re,relayout:()=>{let T=w.current?.getState();T&&Mt(T);},scrollToPosition:Qn});},[Re,Mt]);let oa=Nu.useMemo(()=>{if(!Re)return Iu+48;let T=Re.pages.length;return T*He.h+(T-1)*d+48},[Re,He.h,d]);return jsxRuntime.jsxs("div",{ref:T=>{O.current=T,typeof W=="function"?W(T):W&&typeof W=="object"&&(W.current=T);},className:`ep-root paged-editor ${_??""}`,style:{...yb,...V},tabIndex:0,onFocus:gt,onBlur:ht,onKeyDown:ea,onMouseDown:ta,children:[jsxRuntime.jsx(Hd,{ref:w,document:o,styles:r,widthPx:Lt,readOnly:u,onTransaction:An,onSelectionChange:er,externalPlugins:m,extensionManager:b,onEditorViewReady:na,onKeyDown:te}),jsxRuntime.jsxs("div",{style:{...xb,minHeight:oa,transform:(()=>{let T=[];return $&&T.push("translateX(-120px)"),c!==1&&T.push(`scale(${c})`),T.length>0?T.join(" "):void 0})(),transformOrigin:"top center",transition:"transform 0.2s ease"},children:[jsxRuntime.jsx("div",{ref:K,className:`paged-editor__pages${u?" paged-editor--readonly":""}${E?` paged-editor--hf-editing paged-editor--editing-${E}`:""}`,style:Sb,onMouseDown:Ne,onClick:Ji,"aria-hidden":"true"}),jsxRuntime.jsx(zd,{selectionRects:Q,caretPosition:j,isFocused:A,pageGap:d,readOnly:u}),jsxRuntime.jsx(Vd,{imageInfo:xe,zoom:c,isFocused:A,onResize:tr,onResizeStart:Nt,onResizeEnd:Jt,onDragMove:yo,onDragStart:Dn,onDragEnd:Qi}),C&&jsxRuntime.jsx("div",{className:"paged-editor__plugin-overlays",style:kb,children:C})]}),L]})}),Au=Nu.memo(Mb);var Lb=Nu.lazy(()=>import('./FindReplaceDialog-J3DI3U5I.cjs')),Bb=Nu.lazy(()=>import('./HyperlinkDialog-PEPS3C2G.cjs')),Ab=Nu.lazy(()=>import('./TablePropertiesDialog-A36OXG3A.cjs').then(e=>({default:e.TablePropertiesDialog}))),Db=Nu.lazy(()=>import('./ImagePositionDialog-UYXYHSP4.cjs').then(e=>({default:e.ImagePositionDialog}))),Hb=Nu.lazy(()=>import('./ImagePropertiesDialog-V6SVKINO.cjs').then(e=>({default:e.ImagePropertiesDialog}))),Nb=Nu.lazy(()=>import('./FootnotePropertiesDialog-DO5DCAW6.cjs').then(e=>({default:e.FootnotePropertiesDialog}))),Du=[{value:"editing",label:"Editing",icon:"edit_note",desc:"Edit document directly"},{value:"suggesting",label:"Suggesting",icon:"edit_note",desc:"Edits become suggestions"}];function zb({mode:e,onModeChange:t}){let[n,o]=Nu.useState(false),[r,i]=Nu.useState(false),a=Nu.useRef(null),s=Nu.useRef(null),[l,u]=Nu.useState({top:0,left:0}),d=Du.find(c=>c.value===e);return Nu.useEffect(()=>{let c=window.matchMedia("(max-width: 1400px)");i(c.matches);let p=f=>i(f.matches);return c.addEventListener("change",p),()=>c.removeEventListener("change",p)},[]),Nu.useEffect(()=>{if(!n||!a.current)return;let c=a.current.getBoundingClientRect();u({top:c.bottom+2,left:c.right-220});},[n]),Nu.useEffect(()=>{if(!n)return;let c=f=>{!a.current?.contains(f.target)&&!s.current?.contains(f.target)&&o(false);},p=f=>{f.key==="Escape"&&o(false);};return document.addEventListener("mousedown",c),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",p);}},[n]),jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:a,type:"button",onMouseDown:c=>c.preventDefault(),onClick:()=>o(!n),title:`${d.label} (Ctrl+Shift+E)`,style:{display:"flex",alignItems:"center",gap:r?0:4,padding:r?"2px 4px":"2px 6px 2px 4px",border:"none",background:n?"var(--doc-hover, #f3f4f6)":"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text, #374151)",whiteSpace:"nowrap",height:28},children:[jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:d.icon,size:18}),!r&&jsxRuntime.jsx("span",{children:d.label}),jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:s,onMouseDown:c=>c.preventDefault(),style:{position:"fixed",top:l.top,left:l.left,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e4,minWidth:220},children:Du.map(c=>jsxRuntime.jsxs("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>{t(c.value),o(false);},onMouseOver:p=>{p.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)";},onMouseOut:p=>{p.currentTarget.style.backgroundColor="transparent";},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text, #374151)",width:"100%",textAlign:"left"},children:[jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:c.icon,size:20}),jsxRuntime.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[jsxRuntime.jsx("span",{style:{fontWeight:500},children:c.label}),jsxRuntime.jsx("span",{style:{fontSize:11,color:"var(--doc-text-muted, #9ca3af)"},children:c.desc})]}),c.value===e&&jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"check",size:18,style:{marginLeft:"auto",color:"#1a73e8"}})]},c.value))})]})}var Ob=Date.now(),Ts=-1;function vs(e,t,n){return {id:Ob++,author:t,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:e}]}]}],...n!==void 0&&{parentId:n}}}var Hu=Nu.forwardRef(function({documentBuffer:t,document:n,onSave:o,author:r="User",onChange:i,onSelectionChange:a,onError:s,onFontsLoaded:l,theme:u,showToolbar:d=true,showZoomControl:c=true,showPageNumbers:p=true,enablePageNavigation:f=true,pageNumberPosition:m="bottom-center",pageNumberVariant:b="default",showMarginGuides:g=false,marginGuideColor:S,showRuler:C=false,rulerUnit:k="inch",initialZoom:E=1,readOnly:R=false,toolbarExtra:_,className:V="",style:$,placeholder:L,loadingIndicator:W,showOutline:O=false,showPrintButton:K=true,printOptions:w,onPrint:B,onCopy:te,onCut:he,onPaste:me,externalPlugins:Ie,onEditorViewReady:Te,onRenderedDomContextReady:Re,pluginOverlays:P},I){let[y,M]=Nu.useState({isLoading:!!t,parseError:null,zoom:E,selectionFormatting:{},currentPage:1,totalPages:1,paragraphIndentLeft:0,paragraphIndentRight:0,paragraphFirstLineIndent:0,paragraphHangingIndent:false,paragraphTabs:null,pmTableContext:null,pmImageContext:null}),[F,A]=Nu.useState(false),[U,Q]=Nu.useState(false),[N,j]=Nu.useState(false),[G,xe]=Nu.useState(false),[v,z]=Nu.useState(null),[D,se]=Nu.useState(O),ue=Nu.useRef(false);ue.current=D;let[pe,Ee]=Nu.useState([]),[ge,Se]=Nu.useState(false),[fe,$e]=Nu.useState([]),[Qe,Ge]=Nu.useState([]),[tt,We]=Nu.useState(false),[Je,it]=Nu.useState(null),[Oe,ct]=Nu.useState(null),[De,Pt]=Nu.useState("editing"),[gn,ln]=Nu.useState(null),It=Nu.useRef(null),Ft=Nu.useCallback(()=>{let x=He.current?.getView();if(!x)return;let{doc:h,schema:H}=x.state,ie=H.marks.insertion,ee=H.marks.deletion;if(!ie&&!ee)return;let ae=[];h.descendants((de,Pe)=>{if(de.isText)for(let Ke of de.marks)(Ke.type===ie||Ke.type===ee)&&ae.push({type:Ke.type===ie?"insertion":"deletion",text:de.text||"",author:Ke.attrs.author||"",date:Ke.attrs.date,from:Pe,to:Pe+de.nodeSize,revisionId:Ke.attrs.revisionId});});let oe=[];for(let de of ae){let Pe=oe[oe.length-1];Pe&&Pe.revisionId===de.revisionId&&Pe.type===de.type&&Pe.to===de.from?(Pe.text+=de.text,Pe.to=de.to):oe.push({...de});}Ge(oe);},[]);Nu.useEffect(()=>()=>{It.current&&clearTimeout(It.current);},[]),Nu.useEffect(()=>{if(se(O),O){let x=He.current?.getView();x&&Ee(no(x.state.doc));}},[O]);let le=Rd(n||null,{maxEntries:100,groupingInterval:500,enableKeyboardShortcuts:true}),hn=Nu.useRef(false);Nu.useEffect(()=>{if(hn.current)return;let x=le.state;if(!x)return;let h=x.package?.document?.comments;h&&h.length>0&&($e(h),Se(true),hn.current=true);},[le.state]);let Xt=Nu.useMemo(()=>{let x=new Sn(so());return x.buildSchema(),x.initializeRuntime(),x},[]),Qo=Nu.useMemo(()=>Id(false,r),[]),$t=Nu.useMemo(()=>[Qo,...Ie??[]],[Qo,Ie]),He=Nu.useRef(null),ot=Nu.useRef(null),Lt=Nu.useRef(null),Wt=Nu.useRef(null),Mt=Nu.useRef(null),_t=Nu.useRef(null),Zn=Nu.useRef(null),Jn=Nu.useRef(null),Bt=Nu.useRef(null),An=Nu.useRef(null),[er,At]=Nu.useState(0),Zt=Nu.useRef(le.state);Zt.current=le.state;let wt=Nu.useRef({style:"single",size:4,color:{rgb:"000000"}}),Qn=Nu.useCallback(x=>{if(Bt.current=x,An.current&&(An.current.disconnect(),An.current=null),!x){At(0);return}At(x.offsetHeight);let h=new ResizeObserver(()=>{At(x.offsetHeight);});h.observe(x),An.current=h;},[]);Nu.useEffect(()=>()=>{An.current?.disconnect();},[]);let Ne=Nu.useCallback(()=>v&&ot.current?ot.current.getView():He.current?.getView(),[v]),qe=Nu.useCallback(()=>{v&&ot.current?ot.current.focus():He.current?.focus();},[v]),bo=Nu.useCallback(()=>{v&&ot.current?ot.current.undo():He.current?.undo();},[v]),Ji=Nu.useCallback(()=>{v&&ot.current?ot.current.redo():He.current?.redo();},[v]),gt=chunkVTAS7VZ6_cjs.m(),ht=chunkXS2AQFMF_cjs.m();Nu.useEffect(()=>{if(!t){n&&(le.reset(n),M(h=>({...h,isLoading:false})),chunkEH3NY2DQ_cjs.n(n).catch(h=>{console.warn("Failed to load document fonts:",h);}));return}M(h=>({...h,isLoading:true,parseError:null})),(async()=>{try{let h=await chunkEH3NY2DQ_cjs.p(t);le.reset(h),M(H=>({...H,isLoading:!1,parseError:null})),chunkEH3NY2DQ_cjs.n(h).catch(H=>{console.warn("Failed to load document fonts:",H);});}catch(h){let H=h instanceof Error?h.message:"Failed to parse document";M(ie=>({...ie,isLoading:false,parseError:H})),s?.(h instanceof Error?h:new Error(H));}})();},[t,n,s]),Nu.useEffect(()=>{n&&!t&&le.reset(n);},[n,t]),Nu.useEffect(()=>{le.state?Lt.current=new chunkGICVJSFJ_cjs.f(le.state):Lt.current=null;},[le.state]);let tr=Nu.useRef(false);Nu.useEffect(()=>{if(!y.isLoading&&le.state){let x=setTimeout(()=>{Ft(),tr.current||(tr.current=true,Ge(h=>(h.length>0&&Se(true),h)));},200);return ()=>clearTimeout(x)}},[y.isLoading,le.state,Ft]),Nu.useEffect(()=>chunkEH3NY2DQ_cjs.j(()=>{l?.();}),[l]),Nu.useEffect(()=>{let x=He.current?.getView();x&&Fd(De==="suggesting",x.state,x.dispatch,r);},[De,r]);let Nt=Nu.useCallback(x=>(le.push(x),x),[le]),Jt=Nu.useCallback(x=>{if(Nt(x),i?.(x),ue.current){let h=He.current?.getView();h&&Ee(no(h.state.doc));}It.current&&clearTimeout(It.current),It.current=setTimeout(Ft,300);},[i,Nt,Ft]),yo=Nu.useCallback(x=>{let h=Ne();if(h){let{from:at,to:st}=h.state.selection;Mt.current={from:at,to:st};}let H=null;if(h&&(H=_e(h.state),H.isInTable||(H=null)),H?.cellBorderColor){let at=H.cellBorderColor,st=at.rgb;(!st||st==="auto")&&(st=chunkJRRTZZ72_cjs.a(at,u).replace(/^#/,"")),wt.current={...wt.current,color:{rgb:st}};}let ie=null;if(h){let at=h.state.selection,st=at.node;st?.type.name==="image"&&(ie={pos:at.from,wrapType:st.attrs.wrapType??"inline",displayMode:st.attrs.displayMode??"inline",cssFloat:st.attrs.cssFloat??null,transform:st.attrs.transform??null,alt:st.attrs.alt??null,borderWidth:st.attrs.borderWidth??null,borderColor:st.attrs.borderColor??null,borderStyle:st.attrs.borderStyle??null});}if(!x){ln(null),M(at=>({...at,selectionFormatting:{},pmTableContext:H,pmImageContext:ie}));return}let{textFormatting:ee,paragraphFormatting:ae}=x,oe=ee.fontFamily?.ascii||ee.fontFamily?.hAnsi,de=ee.color?.rgb?`#${ee.color.rgb}`:void 0,Pe=ae.numPr,Ke=Pe?{type:Pe.numId===1?"bullet":"numbered",level:Pe.ilvl??0,isInList:true,numId:Pe.numId}:void 0,bt={bold:ee.bold,italic:ee.italic,underline:!!ee.underline,strike:ee.strike,superscript:ee.vertAlign==="superscript",subscript:ee.vertAlign==="subscript",fontFamily:oe,fontSize:ee.fontSize,color:de,highlight:ee.highlight,alignment:ae.alignment,lineSpacing:ae.lineSpacing,listState:Ke,styleId:x.styleId??void 0,indentLeft:ae.indentLeft};if(M(at=>({...at,selectionFormatting:bt,paragraphIndentLeft:ae.indentLeft??0,paragraphIndentRight:ae.indentRight??0,paragraphFirstLineIndent:ae.indentFirstLine??0,paragraphHangingIndent:ae.hangingIndent??false,paragraphTabs:ae.tabs??null,pmTableContext:H,pmImageContext:ie})),h&&x.hasSelection&&!tt&&!R){let at=Jn.current,st=Zn.current;if(at&&st){let{from:wo}=h.state.selection,aa=at.querySelector(".paged-editor__pages");if(aa){let Es=aa.querySelector(".layout-page"),lp=aa.querySelectorAll("span[data-pm-start]");for(let cp of lp){let sa=cp,dp=Number(sa.dataset.pmStart),up=Number(sa.dataset.pmEnd);if(wo>=dp&&wo<=up){let pp=sa.getBoundingClientRect(),la=st.getBoundingClientRect(),fp=pp.top-la.top+at.scrollTop,mp=Es?Es.getBoundingClientRect().right-la.left:la.width/2+408;ln({top:fp,left:mp});break}}}}}else ln(null);a?.(x);},[a,tt,R]),Dn=hl({document:le.state,onChange:Jt,onSelectionChange:x=>{}});Nu.useEffect(()=>{let x=h=>{let ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?h.metaKey:h.ctrlKey;if(!ie&&!h.shiftKey&&!h.altKey&&(h.key==="Delete"||h.key==="Backspace")){let ee=He.current?.getView();if(ee){let ae=ee.state.selection;if("$anchorCell"in ae&&typeof ae.forEachCell=="function"){let de=_e(ee.state);if(de.isInTable&&de.table){let Pe=0;de.table.descendants(bt=>{(bt.type.name==="tableCell"||bt.type.name==="tableHeader")&&(Pe+=1);});let Ke=0;if(ae.forEachCell(()=>{Ke+=1;}),Pe>0&&Ke>=Pe){h.preventDefault(),No(ee.state,ee.dispatch);return}}}}if(Dn.state.tableIndex!==null){h.preventDefault(),Dn.handleAction("deleteTable");return}}if(ie&&!h.shiftKey&&!h.altKey){if(h.key.toLowerCase()==="f"){h.preventDefault();let ee=window.getSelection(),ae=ee&&!ee.isCollapsed?ee.toString():"";gt.openFind(ae);}else if(h.key.toLowerCase()==="h"){h.preventDefault();let ee=window.getSelection(),ae=ee&&!ee.isCollapsed?ee.toString():"";gt.openReplace(ae);}else if(h.key.toLowerCase()==="k"){h.preventDefault();let ee=He.current?.getView();if(ee){let ae=ro(ee.state),oe=oo(ee.state);oe?ht.openEdit({url:oe.href,displayText:ae,tooltip:oe.tooltip}):ht.openInsert(ae);}}}};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x);}},[gt,ht,Dn]);let Qi=Nu.useCallback((x,h)=>{let H=Ne();H&&(qr(x,h)(H.state,H.dispatch),qe());},[Ne,qe]),ea=Nu.useCallback(()=>{let x=Ne();x&&(wi(x.state,x.dispatch),qe());},[Ne,qe]),ta=Nu.useCallback(()=>{let x=Ne();x&&(Yr(x.state,x.dispatch),qe());},[Ne,qe]),na=Nu.useCallback(()=>{se(x=>{if(!x){let h=He.current?.getView();h&&Ee(no(h.state.doc));}return !x});},[]),nr=Nu.useCallback(x=>{He.current?.scrollToPosition(x),He.current?.setSelection(x+1),He.current?.focus();},[]),oa=Nu.useCallback(()=>{_t.current?.click();},[]),T=Nu.useCallback(x=>{let h=x.target.files?.[0];if(!h)return;let H=Ne();if(!H)return;let ie=new FileReader;ie.onload=()=>{let ee=ie.result,ae=new Image;ae.onload=()=>{let oe=ae.naturalWidth,de=ae.naturalHeight,Pe=612;if(oe>Pe){let wo=Pe/oe;oe=Pe,de=Math.round(de*wo);}let Ke=`rId_img_${Date.now()}`,bt=H.state.schema.nodes.image.create({src:ee,alt:h.name,width:oe,height:de,rId:Ke,wrapType:"inline",displayMode:"inline"}),{from:at}=H.state.selection,st=H.state.tr.insert(at,bt);H.dispatch(st.scrollIntoView()),qe();},ae.src=ee;},ie.readAsDataURL(h),x.target.value="";},[Ne,qe]),re=Nu.useCallback(x=>{let h=Ne();if(!h||!y.pmImageContext)return;let H=y.pmImageContext.pos,ie=h.state.doc.nodeAt(H);if(!ie||ie.type.name!=="image")return;let ee="inline",ae=null;switch(x){case "inline":ee="inline",ae=null;break;case "square":case "tight":case "through":ee="float",ae="left";break;case "topAndBottom":ee="block",ae=null;break;case "behind":case "inFront":ee="float",ae="none";break;case "wrapLeft":ee="float",ae="right",x="square";break;case "wrapRight":ee="float",ae="left",x="square";break}let oe=h.state.tr.setNodeMarkup(H,void 0,{...ie.attrs,wrapType:x,displayMode:ee,cssFloat:ae});h.dispatch(oe.scrollIntoView()),qe();},[Ne,qe,y.pmImageContext]),q=Nu.useCallback(x=>{let h=Ne();if(!h||!y.pmImageContext)return;let H=y.pmImageContext.pos,ie=h.state.doc.nodeAt(H);if(!ie||ie.type.name!=="image")return;let ee=ie.attrs.transform||"",ae=ee.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/),oe=ae?parseFloat(ae[1]):0,de=/scaleX\(-1\)/.test(ee),Pe=/scaleY\(-1\)/.test(ee);switch(x){case "rotateCW":oe=(oe+90)%360;break;case "rotateCCW":oe=(oe-90+360)%360;break;case "flipH":de=!de;break;case "flipV":Pe=!Pe;break}let Ke=[];oe!==0&&Ke.push(`rotate(${oe}deg)`),de&&Ke.push("scaleX(-1)"),Pe&&Ke.push("scaleY(-1)");let bt=Ke.length>0?Ke.join(" "):null,at=h.state.tr.setNodeMarkup(H,void 0,{...ie.attrs,transform:bt});h.dispatch(at.scrollIntoView()),qe();},[Ne,qe,y.pmImageContext]),X=Nu.useCallback(x=>{let h=Ne();if(!h||!y.pmImageContext)return;let H=y.pmImageContext.pos,ie=h.state.doc.nodeAt(H);if(!ie||ie.type.name!=="image")return;let ee=h.state.tr.setNodeMarkup(H,void 0,{...ie.attrs,position:{horizontal:x.horizontal,vertical:x.vertical},distTop:x.distTop??ie.attrs.distTop,distBottom:x.distBottom??ie.attrs.distBottom,distLeft:x.distLeft??ie.attrs.distLeft,distRight:x.distRight??ie.attrs.distRight});h.dispatch(ee.scrollIntoView()),qe();},[Ne,qe,y.pmImageContext]),ne=Nu.useCallback(()=>{j(true);},[]),Y=Nu.useCallback(x=>{let h=Ne();if(!h||!y.pmImageContext)return;let H=y.pmImageContext.pos,ie=h.state.doc.nodeAt(H);if(!ie||ie.type.name!=="image")return;let ee=h.state.tr.setNodeMarkup(H,void 0,{...ie.attrs,alt:x.alt??null,borderWidth:x.borderWidth??null,borderColor:x.borderColor??null,borderStyle:x.borderStyle??null});h.dispatch(ee.scrollIntoView()),qe();},[Ne,qe,y.pmImageContext]),Z=Nu.useCallback((x,h)=>{if(!le.state?.package)return;let H={...le.state.package.document,finalSectionProperties:{...le.state.package.document.finalSectionProperties,footnotePr:x,endnotePr:h}};Nt({...le.state,package:{...le.state.package,document:H}});},[le,Nt]),J=Nu.useCallback(x=>{let h=Ne();if(h){switch(x){case "addRowAbove":Xr(h.state,h.dispatch);break;case "addRowBelow":Zr(h.state,h.dispatch);break;case "addColumnLeft":Qr(h.state,h.dispatch);break;case "addColumnRight":ei(h.state,h.dispatch);break;case "deleteRow":Jr(h.state,h.dispatch);break;case "deleteColumn":ti(h.state,h.dispatch);break;case "deleteTable":No(h.state,h.dispatch);break;case "selectTable":ni(h.state,h.dispatch);break;case "selectRow":oi(h.state,h.dispatch);break;case "selectColumn":ri(h.state,h.dispatch);break;case "mergeCells":ii(h.state,h.dispatch);break;case "splitCell":ai(h.state,h.dispatch);break;case "borderAll":li(h.state,h.dispatch,wt.current);break;case "borderOutside":ci(h.state,h.dispatch,wt.current);break;case "borderInside":di(h.state,h.dispatch,wt.current);break;case "borderNone":si(h.state,h.dispatch);break;case "borderTop":Cn("top",wt.current,true)(h.state,h.dispatch);break;case "borderBottom":Cn("bottom",wt.current,true)(h.state,h.dispatch);break;case "borderLeft":Cn("left",wt.current,true)(h.state,h.dispatch);break;case "borderRight":Cn("right",wt.current,true)(h.state,h.dispatch);break;default:if(typeof x=="object"){if(x.type==="cellFillColor")Si(x.color)(h.state,h.dispatch);else if(x.type==="borderColor"){let H=x.color.replace(/^#/,"");wt.current={...wt.current,color:{rgb:H}},ki(x.color)(h.state,h.dispatch);}else if(x.type==="borderWidth")wt.current={...wt.current,size:x.size},Ci(x.size)(h.state,h.dispatch);else if(x.type==="cellBorder")Cn(x.side,{style:x.style,size:x.size,color:{rgb:x.color.replace(/^#/,"")}})(h.state,h.dispatch);else if(x.type==="cellVerticalAlign")ui(x.align)(h.state,h.dispatch);else if(x.type==="cellMargins")pi(x.margins)(h.state,h.dispatch);else if(x.type==="cellTextDirection")fi(x.direction)(h.state,h.dispatch);else if(x.type==="toggleNoWrap")mi()(h.state,h.dispatch);else if(x.type==="rowHeight")gi(x.height,x.rule)(h.state,h.dispatch);else if(x.type==="toggleHeaderRow")hi()(h.state,h.dispatch);else if(x.type==="distributeColumns")bi()(h.state,h.dispatch);else if(x.type==="autoFitContents")yi()(h.state,h.dispatch);else if(x.type==="openTableProperties")A(true);else if(x.type==="tableProperties")zo(x.props)(h.state,h.dispatch);else if(x.type==="applyTableStyle"){let H=kd(x.styleId),ie=Zt.current;if(!H&&ie?.package.styles){let ae=kn(ie.package.styles).getStyle(x.styleId);if(ae){if(H={id:ae.styleId,name:ae.name??ae.styleId},ae.tblPr?.borders){let oe=ae.tblPr.borders;H.tableBorders={};for(let de of ["top","bottom","left","right","insideH","insideV"]){let Pe=oe[de];Pe&&(H.tableBorders[de]={style:Pe.style,size:Pe.size,color:Pe.color?.rgb?{rgb:Pe.color.rgb}:void 0});}}if(ae.tblStylePr){H.conditionals={};for(let oe of ae.tblStylePr){let de={};if(oe.tcPr?.shading?.fill&&(de.backgroundColor=`#${oe.tcPr.shading.fill}`),oe.tcPr?.borders){let Pe={};for(let Ke of ["top","bottom","left","right"]){let bt=oe.tcPr.borders[Ke];bt&&(Pe[Ke]={style:bt.style,size:bt.size,color:bt.color?.rgb?{rgb:bt.color.rgb}:void 0});}de.borders=Pe;}oe.rPr?.bold&&(de.bold=true),oe.rPr?.color?.rgb&&(de.color=`#${oe.rPr.color.rgb}`),H.conditionals[oe.type]=de;}}H.look={firstRow:true,lastRow:false,noHBand:false,noVBand:true};}}H&&xi({styleId:H.id,tableBorders:H.tableBorders,conditionals:H.conditionals,look:H.look})(h.state,h.dispatch);}}else Dn.handleAction(x);}qe();}},[Dn,Ne,qe]),ce=Nu.useCallback(x=>{let h=Ne();if(!h)return;h.focus();let H=h===He.current?.getView(),{from:ie,to:ee}=h.state.selection,ae=Mt.current;if(H&&ae&&(ie!==ae.from||ee!==ae.to))try{let oe=h.state.tr.setSelection(prosemirrorState.TextSelection.create(h.state.doc,ae.from,ae.to));h.dispatch(oe);}catch(oe){console.warn("Could not restore selection:",oe);}if(x==="bold"){vr(h.state,h.dispatch);return}if(x==="italic"){Rr(h.state,h.dispatch);return}if(x==="underline"){Pr(h.state,h.dispatch);return}if(x==="strikethrough"){Mr(h.state,h.dispatch);return}if(x==="superscript"){Er(h.state,h.dispatch);return}if(x==="subscript"){Ir(h.state,h.dispatch);return}if(x==="bulletList"){Vr(h.state,h.dispatch);return}if(x==="numberedList"){jr(h.state,h.dispatch);return}if(x==="indent"){Ur(h.state,h.dispatch)||Or()(h.state,h.dispatch);return}if(x==="outdent"){Gr(h.state,h.dispatch)||$r()(h.state,h.dispatch);return}if(x==="clearFormatting"){Eo(h.state,h.dispatch);return}if(x==="insertLink"){let oe=ro(h.state),de=oo(h.state);de?ht.openEdit({url:de.href,displayText:oe,tooltip:de.tooltip}):ht.openInsert(oe);return}if(typeof x=="object")switch(x.type){case "alignment":Nr(x.value)(h.state,h.dispatch);break;case "textColor":{let oe=x.value;typeof oe=="string"?Bo({rgb:oe.replace("#","")})(h.state,h.dispatch):oe.auto?Fr(h.state,h.dispatch):Bo(oe)(h.state,h.dispatch);break}case "highlightColor":{let oe=x.value?chunkP3AEZKQO_cjs.u(x.value):"";Lr(oe||x.value)(h.state,h.dispatch);break}case "fontSize":Br(chunkP3AEZKQO_cjs.f(x.value))(h.state,h.dispatch);break;case "fontFamily":Ar(x.value)(h.state,h.dispatch);break;case "lineSpacing":zr(x.value)(h.state,h.dispatch);break;case "applyStyle":{let oe=Zt.current,de=oe?.package.styles?kn(oe.package.styles):null;if(de){let Pe=de.resolveParagraphStyle(x.value);Ho(x.value,{paragraphFormatting:Pe.paragraphFormatting,runFormatting:Pe.runFormatting})(h.state,h.dispatch);}else Ho(x.value)(h.state,h.dispatch);break}}},[Ne]),Ce=Nu.useCallback(x=>{M(h=>({...h,zoom:x}));},[]),be=Nu.useCallback(x=>{let h=Ne();if(!h)return;let H=x.url||"",ie=x.tooltip,{empty:ee}=h.state.selection;ee&&x.displayText?Ao(x.displayText,H,ie)(h.state,h.dispatch):ee?x.displayText&&Ao(x.displayText,H,ie)(h.state,h.dispatch):Dr(H,ie)(h.state,h.dispatch),ht.close(),qe();},[ht,Ne,qe]),we=Nu.useCallback(()=>{let x=Ne();x&&(Hr(x.state,x.dispatch),ht.close(),qe());},[ht,Ne,qe]),Fe=Nu.useCallback(x=>h=>{if(!le.state||R)return;let H={...le.state,package:{...le.state.package,document:{...le.state.package.document,finalSectionProperties:{...le.state.package.document.finalSectionProperties,[x]:h}}}};Jt(H);},[le.state,R,Jt]),Le=Nu.useMemo(()=>Fe("marginLeft"),[Fe]),Ye=Nu.useMemo(()=>Fe("marginRight"),[Fe]),Xe=Nu.useMemo(()=>Fe("marginTop"),[Fe]),xt=Nu.useMemo(()=>Fe("marginBottom"),[Fe]),dt=Nu.useCallback(x=>{let h=Ne();h&&Wr(x)(h.state,h.dispatch);},[Ne]),Dt=Nu.useCallback(x=>{let h=Ne();h&&_r(x)(h.state,h.dispatch);},[Ne]),zt=Nu.useCallback(x=>{let h=Ne();h&&(x<0?Do(-x,true)(h.state,h.dispatch):Do(x,false)(h.state,h.dispatch));},[Ne]),Hn=Nu.useCallback(x=>{let h=Ne();h&&Kr(x)(h.state,h.dispatch);},[Ne]),xo=Nu.useCallback(x=>{},[]),So=Nu.useCallback(async x=>{if(!Lt.current)return null;try{let h=Lt.current.getDocument(),H=He.current?.getDocument();H?.package?.document&&(h.package.document.content=H.package.document.content),h.package.document.comments=fe;let ie=x?.selective!==!1,ee=He.current?.getView(),ae;if(ie&&ee){let de=ee.state;ae={selective:{changedParaIds:Wc(de),structuralChange:_c(de),hasUntrackedChanges:Vc(de)}};}let oe=await Lt.current.toBuffer(ae);return ee&&ee.dispatch(jc(ee.state)),o?.(oe),oe}catch(h){return s?.(h instanceof Error?h:new Error("Failed to save document")),null}},[o,s,fe]),bn=Nu.useCallback(x=>{s?.(x);},[s]),Qt=Nu.useCallback(()=>{let x=Wt.current?.querySelector(".paged-editor__pages");if(!x){window.print(),B?.();return}let h=window.open("","_blank");if(!h){window.print(),B?.();return}let H=[];for(let ee of Array.from(document.styleSheets))try{for(let ae of Array.from(ee.cssRules))ae instanceof CSSFontFaceRule&&H.push(ae.cssText);}catch{}let ie=x.cloneNode(true);ie.style.cssText="display: block; margin: 0; padding: 0;";for(let ee of Array.from(ie.querySelectorAll(".layout-page"))){let ae=ee;ae.style.boxShadow="none",ae.style.margin="0";}h.document.write(`<!DOCTYPE html>
|
|
19
|
+
<html><head><title>Print</title>
|
|
20
|
+
<style>
|
|
21
|
+
${H.join(`
|
|
22
|
+
`)}
|
|
23
|
+
* { margin: 0; padding: 0; }
|
|
24
|
+
body { background: white; }
|
|
25
|
+
.layout-page { break-after: page; }
|
|
26
|
+
.layout-page:last-child { break-after: auto; }
|
|
27
|
+
@page { margin: 0; size: auto; }
|
|
28
|
+
</style>
|
|
29
|
+
</head><body>${ie.outerHTML}</body></html>`),h.document.close(),h.onload=()=>{h.print(),h.close();},setTimeout(()=>{h.closed||(h.print(),h.close());},1e3),B?.();},[B]),nt=Nu.useRef(null),Nn=Nu.useCallback((x,h)=>{if(!le.state||!x.trim())return nt.current=null,null;let H=chunkVTAS7VZ6_cjs.j(le.state,x,h),ie={matches:H,totalCount:H.length,currentIndex:0};return nt.current=ie,gt.setMatches(H,0),H.length>0&&Wt.current&&chunkVTAS7VZ6_cjs.l(Wt.current,H[0]),ie},[le.state,gt]),zn=Nu.useCallback(()=>{if(!nt.current||nt.current.matches.length===0)return null;let x=gt.goToNextMatch(),h=nt.current.matches[x];return h&&Wt.current&&chunkVTAS7VZ6_cjs.l(Wt.current,h),h||null},[gt]),ra=Nu.useCallback(()=>{if(!nt.current||nt.current.matches.length===0)return null;let x=gt.goToPreviousMatch(),h=nt.current.matches[x];return h&&Wt.current&&chunkVTAS7VZ6_cjs.l(Wt.current,h),h||null},[gt]),ep=Nu.useCallback(x=>{if(!le.state||!nt.current||nt.current.matches.length===0)return false;let h=nt.current.matches[nt.current.currentIndex];if(!h)return false;try{let H=chunkP7ZF45KZ_cjs.a(le.state,{type:"replaceText",range:{start:{paragraphIndex:h.paragraphIndex,offset:h.startOffset},end:{paragraphIndex:h.paragraphIndex,offset:h.endOffset}},text:x});return Jt(H),!0}catch(H){return console.error("Replace failed:",H),false}},[le.state,Jt]),tp=Nu.useCallback((x,h,H)=>{if(!le.state||!x.trim())return 0;let ie=chunkVTAS7VZ6_cjs.j(le.state,x,H);if(ie.length===0)return 0;let ee=le.state,ae=[...ie].sort((oe,de)=>oe.paragraphIndex!==de.paragraphIndex?de.paragraphIndex-oe.paragraphIndex:de.startOffset-oe.startOffset);for(let oe of ae)try{ee=chunkP7ZF45KZ_cjs.a(ee,{type:"replaceText",range:{start:{paragraphIndex:oe.paragraphIndex,offset:oe.startOffset},end:{paragraphIndex:oe.paragraphIndex,offset:oe.endOffset}},text:h});}catch(de){console.error("Replace failed for match:",oe,de);}return Jt(ee),nt.current=null,gt.setMatches([],0),ie.length},[le.state,Jt,gt]);Nu.useImperativeHandle(I,()=>({getAgent:()=>Lt.current,getDocument:()=>le.state,getEditorRef:()=>He.current,save:So,setZoom:x=>M(h=>({...h,zoom:x})),getZoom:()=>y.zoom,focus:()=>{He.current?.focus();},getCurrentPage:()=>y.currentPage,getTotalPages:()=>y.totalPages,scrollToPage:x=>{},openPrintPreview:Qt,print:Qt}),[le.state,y.zoom,y.currentPage,y.totalPages,So,Qt]);let{headerContent:ko,footerContent:Co}=Nu.useMemo(()=>{if(!le.state?.package)return {headerContent:null,footerContent:null};let x=le.state.package,h=x.document?.finalSectionProperties,H=x.headers,ie=x.footers,ee=null,ae=null;if(H&&h?.headerReferences){let oe=h.headerReferences.find(de=>de.type==="default");oe?.rId&&(ee=H.get(oe.rId)??null);}if(ie&&h?.footerReferences){let oe=h.footerReferences.find(de=>de.type==="default");oe?.rId&&(ae=ie.get(oe.rId)??null);}return {headerContent:ee,footerContent:ae}},[le.state]),np=Nu.useCallback(x=>{if(x==="header"?ko:Co){z(x);return}if(!le.state?.package)return;let H=le.state.package,ie=H.document?.finalSectionProperties;if(!ie)return;let ee=`rId_new_${x}`,ae={type:x==="header"?"header":"footer",hdrFtrType:"default",content:[{type:"paragraph",content:[]}]},oe=x==="header"?"headers":"footers",de=new Map(H[oe]??[]);de.set(ee,ae);let Pe=x==="header"?"headerReferences":"footerReferences",Ke=ie[Pe]??[],bt={type:"default",rId:ee},at={...le.state,package:{...H,[oe]:de,document:H.document?{...H.document,finalSectionProperties:{...ie,[Pe]:[...Ke,bt]}}:H.document}};Nt(at),z(x);},[ko,Co,le,Nt]),ia=Nu.useCallback(x=>{if(!v||!le.state?.package){z(null);return}let h=le.state.package,H=h.document?.finalSectionProperties,ee=(v==="header"?H?.headerReferences:H?.footerReferences)?.find(de=>de.type==="default"),ae=v==="header"?"headers":"footers",oe=h[ae];if(ee?.rId&&oe){let de=oe.get(ee.rId),Pe={type:v,hdrFtrType:"default",...de,content:x},Ke=new Map(oe);Ke.set(ee.rId,Pe);let bt={...le.state,package:{...h,[ae]:Ke}};Nt(bt);}z(null);},[v,le,Nt]),op=Nu.useCallback(()=>{if(!v)return;let x=ot.current?.getView();if(x){let h=Lo(x.state.doc);ia(h);}else z(null);},[v,ia]),rp=Nu.useCallback(()=>{if(!v||!le.state?.package){z(null);return}let x=le.state.package,h=x.document?.finalSectionProperties,H=v==="header"?"headerReferences":"footerReferences",ie=v==="header"?"headers":"footers",ee=h?.[H],ae=ee?.find(oe=>oe.type==="default");if(ae?.rId){let oe=new Map(x[ie]??[]);oe.delete(ae.rId);let de=(ee??[]).filter(Ke=>Ke.rId!==ae.rId),Pe={...le.state,package:{...x,[ie]:oe,document:x.document?{...x.document,finalSectionProperties:{...h,[H]:de}}:x.document}};Nt(Pe);}z(null);},[v,le,Nt]),ip=Nu.useCallback(x=>{let h=Wt.current?.querySelector(".paged-editor__pages");if(!h)return null;let H=x==="header"?".layout-page-header":".layout-page-footer";return h.querySelector(H)},[]),or={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg-subtle)",...$},ap={display:"flex",flex:1,minHeight:0,minWidth:0,flexDirection:"row"},sp={flex:1,minHeight:0,minWidth:0,overflow:"auto",position:"relative"};return y.isLoading?jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-loading ${V}`,style:or,"data-testid":"docx-editor",children:W||jsxRuntime.jsx(Cd,{})}):y.parseError?jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-error ${V}`,style:or,"data-testid":"docx-editor",children:jsxRuntime.jsx(Td,{message:y.parseError})}):le.state?jsxRuntime.jsx(ml,{children:jsxRuntime.jsx(cr,{onError:bn,children:jsxRuntime.jsxs("div",{ref:Wt,className:`ep-root docx-editor ${V}`,style:or,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:ap,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[jsxRuntime.jsxs("div",{style:sp,children:[d&&!R&&jsxRuntime.jsxs("div",{ref:Qn,className:"sticky top-0 z-50 flex flex-col gap-0 bg-white shadow-sm",children:[jsxRuntime.jsxs(chunkP3AEZKQO_cjs.y,{currentFormatting:y.selectionFormatting,onFormat:ce,onUndo:bo,onRedo:Ji,canUndo:true,canRedo:true,disabled:R,documentStyles:le.state?.package.styles?.styles,theme:le.state?.package.theme||u,showPrintButton:K,onPrint:Qt,showZoomControl:c,zoom:y.zoom,onZoomChange:Ce,onRefocusEditor:qe,onInsertTable:Qi,showTableInsert:true,onInsertImage:oa,onInsertPageBreak:ea,onInsertTOC:ta,imageContext:y.pmImageContext,onImageWrapType:re,onImageTransform:q,onOpenImageProperties:ne,tableContext:y.pmTableContext,onTableAction:J,children:[jsxRuntime.jsx(chunkP3AEZKQO_cjs.x,{}),jsxRuntime.jsx(chunkP3AEZKQO_cjs.v,{onClick:()=>Se(!ge),active:ge,title:"Toggle comments sidebar",ariaLabel:"Toggle comments sidebar",children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"comment",size:20})}),jsxRuntime.jsx(chunkP3AEZKQO_cjs.x,{}),jsxRuntime.jsx(zb,{mode:De,onModeChange:x=>{Pt(x),x==="suggesting"&&Se(true);}}),_]}),C&&jsxRuntime.jsx("div",{className:"flex justify-center px-5 py-1 overflow-x-auto flex-shrink-0 bg-doc-bg",style:{paddingRight:ge?"calc(20px + 240px)":void 0,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.O,{sectionProps:le.state?.package.document?.finalSectionProperties,zoom:y.zoom,unit:k,editable:!R,onLeftMarginChange:Le,onRightMarginChange:Ye,indentLeft:y.paragraphIndentLeft,indentRight:y.paragraphIndentRight,onIndentLeftChange:dt,onIndentRightChange:Dt,showFirstLineIndent:true,firstLineIndent:y.paragraphFirstLineIndent,hangingIndent:y.paragraphHangingIndent,onFirstLineIndentChange:zt,tabStops:y.paragraphTabs,onTabStopRemove:Hn})})]}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative"},children:jsxRuntime.jsxs("div",{ref:Zn,style:{position:"relative",flex:1,minWidth:0},onMouseDown:x=>{x.target===x.currentTarget&&(x.preventDefault(),He.current?.focus());},children:[C&&!R&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:10,paddingTop:48},children:jsxRuntime.jsx(Ml,{sectionProps:le.state?.package.document?.finalSectionProperties,zoom:y.zoom,unit:k,editable:!R,onTopMarginChange:Xe,onBottomMarginChange:xt})}),jsxRuntime.jsx(Au,{ref:He,document:le.state,styles:le.state?.package.styles,theme:le.state?.package.theme||u,sectionProperties:le.state?.package.document?.finalSectionProperties,headerContent:ko,footerContent:Co,onHeaderFooterDoubleClick:np,hfEditMode:v,onBodyClick:op,zoom:y.zoom,readOnly:R,extensionManager:Xt,onDocumentChange:Jt,onSelectionChange:(x,h)=>{let H=He.current?.getView();if(H){let ie=lo(H.state);yo(ie);}else yo(null);},externalPlugins:$t,onReady:x=>{Te?.(x.getView());},onRenderedDomContextReady:Re,pluginOverlays:P,commentsSidebarOpen:ge,scrollContainerRef:Jn,sidebarOverlay:ge?jsxRuntime.jsx(wl,{comments:fe,trackedChanges:Qe,pageWidth:(()=>{let x=le.state?.package?.document?.finalSectionProperties;return x?.pageWidth?Math.round(x.pageWidth/15):816})(),editorContainerRef:Jn,onCommentResolve:x=>{$e(h=>h.map(H=>H.id===x?{...H,done:true}:H));},onCommentDelete:x=>{$e(h=>h.filter(H=>H.id!==x&&H.parentId!==x));},onCommentReply:(x,h)=>{$e(H=>[...H,vs(h,r,x)]);},onAddComment:x=>{let h=vs(x,r),H=He.current?.getView();if(H&&Je){let{from:ie,to:ee}=Je,ae=H.state.schema.marks.comment.create({commentId:Ts}),oe=H.state.schema.marks.comment.create({commentId:h.id}),de=H.state.tr.removeMark(ie,ee,ae).addMark(ie,ee,oe);H.dispatch(de);}$e(ie=>[...ie,h]),We(false),it(null),ct(null);},onTrackedChangeReply:(x,h)=>{$e(H=>[...H,vs(h,r,x)]);},onCancelAddComment:()=>{let x=He.current?.getView();if(x&&Je){let{from:h,to:H}=Je,ie=x.state.schema.marks.comment.create({commentId:Ts});x.dispatch(x.state.tr.removeMark(h,H,ie));}We(false),it(null),ct(null);},onAcceptChange:(x,h)=>{let H=He.current?.getView();H&&(Va(x,h)(H.state,H.dispatch),Ft());},onRejectChange:(x,h)=>{let H=He.current?.getView();H&&(ja(x,h)(H.state,H.dispatch),Ft());},isAddingComment:tt,addCommentYPosition:Oe,topOffset:0}):void 0}),gn!=null&&!tt&&!R&&jsxRuntime.jsx(chunkP3AEZKQO_cjs.i,{content:"Add comment",side:"bottom",delayMs:300,children:jsxRuntime.jsx("button",{type:"button",onMouseDown:x=>{x.preventDefault(),x.stopPropagation();let h=He.current?.getView();if(h){let{from:H,to:ie}=h.state.selection;if(H!==ie){it({from:H,to:ie});let ee=h.state.schema.marks.comment.create({commentId:Ts}),ae=h.state.tr.addMark(H,ie,ee);ae.setSelection(prosemirrorState.TextSelection.create(ae.doc,ie)),h.dispatch(ae);}}ct(gn.top),ge||Se(true),We(true),ln(null);},style:{position:"absolute",top:gn.top,left:gn.left,transform:"translate(-50%, -50%)",zIndex:50,width:28,height:28,borderRadius:6,border:"1px solid rgba(26, 115, 232, 0.3)",backgroundColor:"#fff",color:"#1a73e8",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(60,64,67,0.2)",transition:"background-color 0.15s ease, box-shadow 0.15s ease"},onMouseOver:x=>{x.currentTarget.style.backgroundColor="rgba(26, 115, 232, 0.08)",x.currentTarget.style.boxShadow="0 1px 4px rgba(26, 115, 232, 0.3)";},onMouseOut:x=>{x.currentTarget.style.backgroundColor="#fff",x.currentTarget.style.boxShadow="0 1px 3px rgba(60,64,67,0.2)";},children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"add_comment",size:16})})}),p&&y.totalPages>0&&(f?jsxRuntime.jsx(chunkP3AEZKQO_cjs.H,{currentPage:y.currentPage,totalPages:y.totalPages,onNavigate:xo,position:m,variant:b,floating:true}):jsxRuntime.jsx(chunkP3AEZKQO_cjs.z,{currentPage:y.currentPage,totalPages:y.totalPages,position:m,variant:b,floating:true})),v&&(v==="header"?ko:Co)&&(()=>{let x=ip(v),h=Zn.current;return !x||!h?null:jsxRuntime.jsx(Sd,{ref:ot,headerFooter:v==="header"?ko:Co,position:v,styles:le.state?.package.styles,targetElement:x,parentElement:h,onSave:ia,onClose:()=>z(null),onSelectionChange:yo,onRemove:rp})})()]})})]}),D&&jsxRuntime.jsx(yl,{headings:pe,onHeadingClick:nr,onClose:()=>se(false),topOffset:er}),!D&&jsxRuntime.jsx("button",{className:"docx-outline-nav",onClick:na,onMouseDown:x=>x.stopPropagation(),title:"Show document outline",style:{position:"absolute",left:48,top:er+12,zIndex:20,background:"transparent",border:"none",borderRadius:"50%",padding:6,cursor:"pointer",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(chunkP3AEZKQO_cjs.d,{name:"format_list_bulleted",size:20,style:{color:"#444746"}})})]})}),jsxRuntime.jsxs(Nu.Suspense,{fallback:null,children:[gt.state.isOpen&&jsxRuntime.jsx(Lb,{isOpen:gt.state.isOpen,onClose:gt.close,onFind:Nn,onFindNext:zn,onFindPrevious:ra,onReplace:ep,onReplaceAll:tp,initialSearchText:gt.state.searchText,replaceMode:gt.state.replaceMode,currentResult:nt.current}),ht.state.isOpen&&jsxRuntime.jsx(Bb,{isOpen:ht.state.isOpen,onClose:ht.close,onSubmit:be,onRemove:ht.state.isEditing?we:void 0,initialData:ht.state.initialData,selectedText:ht.state.selectedText,isEditing:ht.state.isEditing}),F&&jsxRuntime.jsx(Ab,{isOpen:F,onClose:()=>A(false),onApply:x=>{let h=Ne();h&&zo(x)(h.state,h.dispatch);},currentProps:y.pmTableContext?.table?.attrs}),U&&jsxRuntime.jsx(Db,{isOpen:U,onClose:()=>Q(false),onApply:X}),N&&jsxRuntime.jsx(Hb,{isOpen:N,onClose:()=>j(false),onApply:Y,currentData:y.pmImageContext?{alt:y.pmImageContext.alt??void 0,borderWidth:y.pmImageContext.borderWidth??void 0,borderColor:y.pmImageContext.borderColor??void 0,borderStyle:y.pmImageContext.borderStyle??void 0}:void 0}),G&&jsxRuntime.jsx(Nb,{isOpen:G,onClose:()=>xe(false),onApply:Z,footnotePr:le.state?.package.document?.finalSectionProperties?.footnotePr,endnotePr:le.state?.package.document?.finalSectionProperties?.endnotePr})]}),jsxRuntime.jsx("input",{ref:_t,type:"file",accept:"image/*",style:{display:"none"},onChange:T})]})})}):jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-empty ${V}`,style:or,"data-testid":"docx-editor",children:L||jsxRuntime.jsx(wd,{})})});function F0(e,t,n={}){return new Promise((o,r)=>{let i=Nu__default.default.createRef(),a=null;try{a=client.createRoot(t);}catch(d){r(d);return}let s={save:async()=>{let d=await(i.current?.save()??Promise.resolve(null));return d?new Blob([d],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}):null},getDocument:()=>i.current?.getDocument()??null,focus:()=>i.current?.focus(),setZoom:d=>i.current?.setZoom(d),destroy:()=>{a?.unmount(),a=null;}},l=false,u=Nu__default.default.createElement(Hu,{...n,documentBuffer:e,onError:d=>{n.onError?.(d),l||(l=true,r(d));},onChange:d=>{n.onChange?.(d),l||(l=true,o(s));},ref:i});a.render(u);})}function $0(e,t={}){let{storageKey:n,interval:o,enabled:r=true,maxAge:i,onSave:a,onError:s,onRecoveryAvailable:l,saveOnChange:u,debounceDelay:d}=t,c=Nu.useMemo(()=>new chunk2VHQ7YOQ_cjs.r({storageKey:n,interval:o,maxAge:i,saveOnChange:u,debounceDelay:d,onSave:a,onError:s,onRecoveryAvailable:l}),[n]);Nu.useEffect(()=>{r?(c.enable(),c.startInterval()):c.disable();},[c,r]),Nu.useEffect(()=>{c.onDocumentChanged(e??null);},[c,e]),Nu.useEffect(()=>()=>{c.destroy();},[c]);let p=Nu.useSyncExternalStore(c.subscribe,c.getSnapshot),f=Nu.useCallback(()=>c.save(),[c]),m=Nu.useCallback(()=>c.clear(),[c]),b=Nu.useCallback(()=>c.getRecoveryData(),[c]),g=Nu.useCallback(()=>c.acceptRecovery(),[c]),S=Nu.useCallback(()=>c.dismissRecovery(),[c]),C=Nu.useCallback(()=>c.enable(),[c]),k=Nu.useCallback(()=>c.disable(),[c]);return {status:p.status,lastSaveTime:p.lastSaveTime,save:f,clearAutoSave:m,hasRecoveryData:p.hasRecoveryData,getRecoveryData:b,acceptRecovery:g,dismissRecovery:S,isEnabled:p.isEnabled,enable:C,disable:k}}var Ub=1,zu=.25,Ou=4,Gb=.1,Yt=[.25,.5,.75,1,1.25,1.5,2,3,4];function $u(e,t,n){return Math.max(t,Math.min(n,e))}function Wu(e){return Math.round(e*100)/100}function Kb(e){let t=Yt[0],n=Math.abs(e-t);for(let o of Yt){let r=Math.abs(e-o);r<n&&(n=r,t=o);}return t}function Yb(e){for(let t of Yt)if(t>e+.01)return t;return Yt[Yt.length-1]}function qb(e){for(let t=Yt.length-1;t>=0;t--)if(Yt[t]<e-.01)return Yt[t];return Yt[0]}function V0(e={}){let{initialZoom:t=Ub,minZoom:n=zu,maxZoom:o=Ou,zoomStep:r=Gb,enabled:i=true,containerRef:a,onZoomChange:s,enableKeyboardShortcuts:l=true,preventDefault:u=true}=e,[d,c]=Nu.useState(t),p=Nu.useRef(d);Nu.useEffect(()=>{p.current=d;},[d]);let f=Nu.useCallback(R=>{let _=Wu($u(R,n,o));_!==p.current&&(c(_),s?.(_));},[n,o,s]),m=Nu.useCallback(()=>{f(p.current+r);},[r,f]),b=Nu.useCallback(()=>{f(p.current-r);},[r,f]),g=Nu.useCallback(()=>{f(t);},[t,f]),S=Nu.useCallback(()=>{f(1);},[f]),C=Nu.useCallback((R,_)=>{if(_>0){let V=R/_;f(V);}},[f]),k=Nu.useCallback(R=>{if(!i||!(R.ctrlKey||R.metaKey))return;u&&R.preventDefault();let V=R.deltaY;V<0?f(p.current+r):V>0&&f(p.current-r);},[i,u,r,f]),E=Nu.useCallback(R=>{if(!(!i||!l||!(R.ctrlKey||R.metaKey))){if(R.key==="0"){R.preventDefault(),S();return}if(R.key==="+"||R.key==="="){R.preventDefault(),m();return}if(R.key==="-"){R.preventDefault(),b();return}}},[i,l,m,b,S]);return Nu.useEffect(()=>{if(!i)return;let R=a?.current;if(R)return R.addEventListener("wheel",k,{passive:false}),()=>{R.removeEventListener("wheel",k);}},[i,a,k]),Nu.useEffect(()=>{if(!(!i||!l))return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E);}},[i,l,E]),{zoom:d,setZoom:f,zoomIn:m,zoomOut:b,resetZoom:g,zoomTo100:S,zoomToFit:C,isMinZoom:d<=n,isMaxZoom:d>=o,zoomPercent:Math.round(d*100),handleWheel:k,handleKeyDown:E}}function j0(){return [...Yt]}function U0(e){return Kb(e)}function G0(e){return Yb(e)}function K0(e){return qb(e)}function Y0(e){return `${Math.round(e*100)}%`}function q0(e){let t=e.match(/(\d+(\.\d+)?)/);if(t){let n=parseFloat(t[1]);if(!isNaN(n))return n/100}return null}function X0(e){return Yt.some(t=>Math.abs(t-e)<.01)}function Z0(e,t=zu,n=Ou){return Wu($u(e,t,n))}var ho={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},Q0={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},eR={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function _u(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return [];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return [];let o=n.getClientRects(),r=[],i=0,a=0;if(e){let s=e.getBoundingClientRect();i=s.left+e.scrollLeft,a=s.top+e.scrollTop;}for(let s=0;s<o.length;s++){let l=o[s];l.width===0&&l.height===0||r.push({left:l.left-i,top:l.top-a,width:l.width,height:l.height});}return r}function Xb(e,t=2){if(e.length<=1)return e;let n=[...e].sort((i,a)=>Math.abs(i.top-a.top)<t?i.left-a.left:i.top-a.top),o=[],r={...n[0]};for(let i=1;i<n.length;i++){let a=n[i],s=Math.abs(a.top-r.top)<t,l=a.left<=r.left+r.width+t;if(s&&l){let u=Math.max(r.left+r.width,a.left+a.width);r.width=u-r.left,r.height=Math.max(r.height,a.height);}else o.push(r),r={...a};}return o.push(r),o}function Ms(e){let t=_u(e);return Xb(t)}function tR(e,t=ho){return {position:"absolute",left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}function nR(e,t=ho){let n=t.backgroundColor;return `
|
|
30
|
+
${e}::selection,
|
|
31
|
+
${e} *::selection {
|
|
32
|
+
background-color: ${n} !important;
|
|
33
|
+
color: inherit !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${e}::-moz-selection,
|
|
37
|
+
${e} *::-moz-selection {
|
|
38
|
+
background-color: ${n} !important;
|
|
39
|
+
color: inherit !important;
|
|
40
|
+
}
|
|
41
|
+
`}function Vu(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function ju(){let e=window.getSelection();return e?e.toString():""}function Uu(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)}function oR(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function rR(e,t,n,o,r){try{let i=document.createRange();return i.setStart(t,n),i.setEnd(o,r),i}catch{return null}}function iR(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function aR(){let e=window.getSelection();e&&e.removeAllRanges();}function Zb(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.anchorNode,n=e.focusNode;return !t||!n?false:t===n?e.focusOffset<e.anchorOffset:(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING)!==0}function sR(){let e=window.getSelection();if(!e||e.rangeCount===0||!Zb())return;let t=e.getRangeAt(0),n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset),e.removeAllRanges(),e.addRange(n);}var Bn=null;function Gu(e=ho){Jb();let t=`
|
|
42
|
+
/* DOCX Editor Selection Highlighting */
|
|
43
|
+
|
|
44
|
+
/* Base selection style for all editable content */
|
|
45
|
+
.docx-editor [contenteditable="true"]::selection,
|
|
46
|
+
.docx-editor [contenteditable="true"] *::selection,
|
|
47
|
+
.docx-run-editable::selection,
|
|
48
|
+
.docx-run-editable *::selection {
|
|
49
|
+
background-color: ${e.backgroundColor} !important;
|
|
50
|
+
color: inherit !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Firefox selection */
|
|
54
|
+
.docx-editor [contenteditable="true"]::-moz-selection,
|
|
55
|
+
.docx-editor [contenteditable="true"] *::-moz-selection,
|
|
56
|
+
.docx-run-editable::-moz-selection,
|
|
57
|
+
.docx-run-editable *::-moz-selection {
|
|
58
|
+
background-color: ${e.backgroundColor} !important;
|
|
59
|
+
color: inherit !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Ensure selection is visible against all backgrounds */
|
|
63
|
+
.docx-run-highlighted::selection,
|
|
64
|
+
.docx-run-highlighted *::selection {
|
|
65
|
+
/* For highlighted (yellow background) text, use darker selection */
|
|
66
|
+
background-color: rgba(26, 115, 232, 0.5) !important;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.docx-run-highlighted::-moz-selection,
|
|
70
|
+
.docx-run-highlighted *::-moz-selection {
|
|
71
|
+
background-color: rgba(26, 115, 232, 0.5) !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Selection in dark text */
|
|
75
|
+
.docx-run-dark-bg::selection,
|
|
76
|
+
.docx-run-dark-bg *::selection {
|
|
77
|
+
/* Use lighter selection for dark backgrounds */
|
|
78
|
+
background-color: rgba(100, 181, 246, 0.5) !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.docx-run-dark-bg::-moz-selection,
|
|
82
|
+
.docx-run-dark-bg *::-moz-selection {
|
|
83
|
+
background-color: rgba(100, 181, 246, 0.5) !important;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Programmatic highlight class */
|
|
87
|
+
.docx-selection-highlight {
|
|
88
|
+
background-color: ${e.backgroundColor};
|
|
89
|
+
${e.borderRadius?`border-radius: ${e.borderRadius}px;`:""}
|
|
90
|
+
${e.mixBlendMode?`mix-blend-mode: ${e.mixBlendMode};`:""}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Find/replace highlight */
|
|
94
|
+
.docx-find-highlight {
|
|
95
|
+
background-color: rgba(255, 235, 59, 0.5);
|
|
96
|
+
border-radius: 2px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.docx-find-highlight-current {
|
|
100
|
+
background-color: rgba(255, 152, 0, 0.6);
|
|
101
|
+
border-radius: 2px;
|
|
102
|
+
outline: 2px solid rgba(255, 152, 0, 0.8);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* AI action selection preview */
|
|
106
|
+
.docx-ai-selection-preview {
|
|
107
|
+
background-color: rgba(156, 39, 176, 0.2);
|
|
108
|
+
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
109
|
+
}
|
|
110
|
+
`;Bn=document.createElement("style"),Bn.id="docx-selection-styles",Bn.textContent=t,document.head.appendChild(Bn);}function Jb(){Bn&&(Bn.remove(),Bn=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function Ku(){return Bn!==null||document.getElementById("docx-selection-styles")!==null}function lR(e,t,n=true){return ()=>{if(!e){t([]);return}let o=n?Ms(e):_u(e);t(o);}}function mR(e){let{containerRef:t,enabled:n=true,config:o=ho,useOverlay:r=false,debounceMs:i=16,onSelectionChange:a}=e,[s,l]=Nu.useState(false),[u,d]=Nu.useState(""),[c,p]=Nu.useState([]),[f,m]=Nu.useState(false),b=Nu.useRef(null),g=Nu.useRef(0),S=Nu.useCallback(()=>{let R=t.current,_=Vu(),V=ju(),$=R?Uu(R):false;if(l(_),d(V),m($),r&&$){let L=Ms(R);p(L);}else p([]);a&&a(_&&$,V);},[t,r,a]),C=Nu.useCallback(()=>{let R=performance.now();if(R-g.current<i){b.current!==null&&clearTimeout(b.current),b.current=window.setTimeout(()=>{g.current=performance.now(),S(),b.current=null;},i);return}g.current=R,S();},[i,S]),k=Nu.useCallback(()=>{S();},[S]),E=Nu.useCallback(R=>({position:"absolute",left:`${R.left}px`,top:`${R.top}px`,width:`${R.width}px`,height:`${R.height}px`,backgroundColor:o.backgroundColor,borderRadius:o.borderRadius?`${o.borderRadius}px`:void 0,border:o.borderColor?`1px solid ${o.borderColor}`:void 0,zIndex:o.zIndex??0,opacity:o.opacity??1,mixBlendMode:o.mixBlendMode,pointerEvents:"none",userSelect:"none"}),[o]);return Nu.useEffect(()=>(n&&!Ku()&&Gu(o),()=>{}),[n,o]),Nu.useEffect(()=>{if(!n)return;let R=()=>{C();};return document.addEventListener("selectionchange",R),document.addEventListener("mouseup",R),S(),()=>{document.removeEventListener("selectionchange",R),document.removeEventListener("mouseup",R),b.current!==null&&clearTimeout(b.current);}},[n,C,S]),{hasSelection:s,selectedText:u,highlightRects:c,isSelectionInContainer:f,refresh:k,getOverlayStyle:E}}function gR(e,t=ho){return e.map((n,o)=>Nu__default.default.createElement("div",{key:`selection-overlay-${o}`,style:{position:"absolute",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}))}function kR(e={}){let{onCopy:t,onCut:n,onPaste:o,cleanWordFormatting:r=true,editable:i=true,onError:a}=e,s=Nu.useRef(false),l=Nu.useRef(null),u=Nu.useCallback(async g=>{if(s.current)return false;s.current=true;try{let S=await chunkP3AEZKQO_cjs.da(g.runs,{onError:a});return S&&t?.(g),S}finally{s.current=false;}},[t,a]),d=Nu.useCallback(async g=>{if(s.current||!i)return false;s.current=true;try{let S=await chunkP3AEZKQO_cjs.da(g.runs,{onError:a});return S&&n?.(g),S}finally{s.current=false;}},[n,i,a]),c=Nu.useCallback(async(g=false)=>{if(s.current||!i)return null;s.current=true;try{if(navigator.clipboard&&navigator.clipboard.read){let S=await navigator.clipboard.read(),C="",k="";for(let R of S)R.types.includes("text/html")&&(C=await(await R.getType("text/html")).text()),R.types.includes("text/plain")&&(k=await(await R.getType("text/plain")).text());g&&(C="");let E=chunkP3AEZKQO_cjs.ka(C,k,r);return l.current=E,o?.(E,g),E}return null}catch(S){return a?.(S),null}finally{s.current=false;}},[i,r,o,a]),p=Nu.useCallback(g=>{let S=chunk2VHQ7YOQ_cjs.F();if(!S)return;g.preventDefault();let C=chunkP3AEZKQO_cjs.fa(S.runs);g.clipboardData&&(g.clipboardData.setData("text/plain",C.plainText),g.clipboardData.setData("text/html",C.html),C.internal&&g.clipboardData.setData("application/x-docx-editor",C.internal)),t?.(S);},[t]),f=Nu.useCallback(g=>{if(!i)return;let S=chunk2VHQ7YOQ_cjs.F();if(!S)return;g.preventDefault();let C=chunkP3AEZKQO_cjs.fa(S.runs);g.clipboardData&&(g.clipboardData.setData("text/plain",C.plainText),g.clipboardData.setData("text/html",C.html),C.internal&&g.clipboardData.setData("application/x-docx-editor",C.internal)),n?.(S);},[i,n]),m=Nu.useCallback(g=>{if(!i)return;g.preventDefault();let S=chunkP3AEZKQO_cjs.ja(g,{cleanWordFormatting:r});if(S){l.current=S;let C=g.shiftKey??false;o?.(S,C);}},[i,r,o]),b=Nu.useCallback(g=>{},[]);return {copy:u,cut:d,paste:c,handleCopy:p,handleCut:f,handlePaste:m,handleKeyDown:b,isProcessing:s.current,lastPastedContent:l.current}}var Zi={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false},Ju=chunk2VHQ7YOQ_cjs.I,Qu=`
|
|
111
|
+
.plugin-host {
|
|
112
|
+
display: flex;
|
|
113
|
+
width: 100%;
|
|
114
|
+
height: 100%;
|
|
115
|
+
overflow: visible;
|
|
116
|
+
position: relative;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.plugin-host-editor {
|
|
120
|
+
flex: 1;
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
min-width: 0;
|
|
124
|
+
overflow: visible;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
.plugin-panels-left,
|
|
129
|
+
.plugin-panels-right {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
flex-shrink: 0;
|
|
133
|
+
background: #f8f9fa;
|
|
134
|
+
border-color: #e9ecef;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.plugin-panels-left {
|
|
138
|
+
border-right: 1px solid #e9ecef;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.plugin-panels-right {
|
|
142
|
+
border-left: 1px solid #e9ecef;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.plugin-panels-bottom {
|
|
146
|
+
border-top: 1px solid #e9ecef;
|
|
147
|
+
background: #f8f9fa;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.plugin-panel {
|
|
151
|
+
position: relative;
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-direction: column;
|
|
154
|
+
overflow: hidden;
|
|
155
|
+
transition: width 0.2s ease, height 0.2s ease;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.plugin-panel.collapsed {
|
|
159
|
+
overflow: visible;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.plugin-panel-toggle {
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
gap: 4px;
|
|
166
|
+
padding: 6px 8px;
|
|
167
|
+
background: transparent;
|
|
168
|
+
border: none;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
font-size: 12px;
|
|
171
|
+
color: #6c757d;
|
|
172
|
+
white-space: nowrap;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.plugin-panel.collapsed .plugin-panel-toggle {
|
|
176
|
+
writing-mode: vertical-rl;
|
|
177
|
+
text-orientation: mixed;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
height: 100%;
|
|
180
|
+
padding: 8px 6px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.plugin-panel-toggle:hover {
|
|
184
|
+
background: #e9ecef;
|
|
185
|
+
color: #495057;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.plugin-panel-toggle-icon {
|
|
189
|
+
font-weight: bold;
|
|
190
|
+
font-size: 14px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.plugin-panel.collapsed .plugin-panel-toggle-icon {
|
|
194
|
+
transform: rotate(90deg);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.plugin-panel-toggle-label {
|
|
198
|
+
font-weight: 500;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.plugin-panel-content {
|
|
202
|
+
flex: 1;
|
|
203
|
+
overflow: auto;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* Right panel rendered inside viewport - scrolls with content */
|
|
207
|
+
.plugin-panel-in-viewport {
|
|
208
|
+
position: absolute;
|
|
209
|
+
top: 0;
|
|
210
|
+
/* Position is set dynamically via inline styles based on page edge */
|
|
211
|
+
width: 220px;
|
|
212
|
+
pointer-events: auto;
|
|
213
|
+
z-index: 10;
|
|
214
|
+
overflow: visible;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.plugin-panel-in-viewport.collapsed {
|
|
218
|
+
width: 32px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.plugin-panel-in-viewport .plugin-panel-toggle {
|
|
222
|
+
position: sticky;
|
|
223
|
+
top: 0;
|
|
224
|
+
background: rgba(255, 255, 255, 0.95);
|
|
225
|
+
border-radius: 4px;
|
|
226
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.plugin-panel-in-viewport-content {
|
|
230
|
+
overflow: visible;
|
|
231
|
+
position: relative;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* Plugin overlay container for rendering highlights/decorations */
|
|
235
|
+
.plugin-overlays-container {
|
|
236
|
+
position: absolute;
|
|
237
|
+
top: 0;
|
|
238
|
+
left: 0;
|
|
239
|
+
right: 0;
|
|
240
|
+
bottom: 0;
|
|
241
|
+
pointer-events: none;
|
|
242
|
+
overflow: visible;
|
|
243
|
+
z-index: 5;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.plugin-overlay {
|
|
247
|
+
position: absolute;
|
|
248
|
+
top: 0;
|
|
249
|
+
left: 0;
|
|
250
|
+
right: 0;
|
|
251
|
+
bottom: 0;
|
|
252
|
+
pointer-events: none;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.plugin-overlay > * {
|
|
256
|
+
pointer-events: auto;
|
|
257
|
+
}
|
|
258
|
+
`,iy=Nu.forwardRef(function({plugins:t,children:n,className:o=""},r){let[i,a]=Nu.useState(null),s=Nu.useRef(n.props);s.current=n.props;let[l,u]=Nu.useState(null),d=Nu.useMemo(()=>new chunk2VHQ7YOQ_cjs.J,[]),c=Nu.useSyncExternalStore(d.subscribe,d.getSnapshot),[p,f]=Nu.useState(()=>{let w=new Set;for(let B of t)({...Zi,...B.panelConfig}).defaultCollapsed&&w.add(B.id);return w}),[m]=Nu.useState(()=>{let w=new Map;for(let B of t){let te={...Zi,...B.panelConfig};w.set(B.id,te.defaultSize);}return w});Nu.useEffect(()=>{if(!i)return;let w=t.map(B=>({id:B.id,styles:B.styles,initialize:B.initialize,onStateChange:B.onStateChange,destroy:B.destroy}));return d.initialize(w,i),()=>{d.destroy();}},[d,i,t]),Nu.useEffect(()=>{let w=t.filter(B=>B.styles).map(B=>Ju(B.id,B.styles));return ()=>w.forEach(B=>B())},[t]),Nu.useEffect(()=>{if(!i?.dom)return;let w=()=>{d.updateStates(i);},B=null,te=()=>{B&&cancelAnimationFrame(B),B=requestAnimationFrame(w);};w();let he=i.dom;he.addEventListener("input",te),he.addEventListener("focus",w),he.addEventListener("click",w);let me=i.dispatch.bind(i);return i.dispatch=Ie=>{me(Ie),te();},()=>{he.removeEventListener("input",te),he.removeEventListener("focus",w),he.removeEventListener("click",w),B&&cancelAnimationFrame(B),i.dispatch=me;}},[i,d]),Nu.useEffect(()=>Ju("plugin-host-base",Qu),[]);let b=Nu.useCallback(w=>{if(!i)return;if(i.coordsAtPos(w)){i.dom.scrollIntoView({block:"center",inline:"nearest"});let{state:te}=i,he=te.doc.resolve(Math.min(w,te.doc.content.size)),me=te.tr.setSelection(prosemirrorState.TextSelection.near(he));i.dispatch(me),i.focus();}},[i]),g=Nu.useCallback((w,B)=>{if(!i)return;let{state:te}=i,he=te.doc.content.size,me=Math.max(0,Math.min(w,he)),Ie=Math.max(0,Math.min(B,he)),Te=te.tr.setSelection(prosemirrorState.TextSelection.create(te.doc,me,Ie));i.dispatch(Te),i.focus();},[i]),S=Nu.useCallback(w=>d.getPluginState(w),[d]),C=Nu.useCallback((w,B)=>{d.setPluginState(w,B);},[d]),k=Nu.useCallback(()=>{i&&d.updateStates(i);},[i,d]);Nu.useImperativeHandle(r,()=>({getPluginState:S,setPluginState:C,getEditorView:()=>i,refreshPluginStates:k}),[S,C,i,k]);let E=Nu.useMemo(()=>{let w=[];for(let B of t)B.proseMirrorPlugins&&w.push(...B.proseMirrorPlugins);return w},[t]),R=Nu.useCallback(w=>{f(B=>{let te=new Set(B);return te.has(w)?te.delete(w):te.add(w),te});},[]),[_,V]=Nu.useState(null);Nu.useEffect(()=>{if(!l){V(null);return}let w=()=>{let he=l.pagesContainer,me=he.querySelector(".layout-page");if(!me){V(null);return}let Ie=l.getContainerOffset(),Te=me.getBoundingClientRect(),Re=he.getBoundingClientRect(),P=(Te.right-Re.left)/l.zoom,I=Ie.x+P+5;V(I);};w();let B=()=>{requestAnimationFrame(w);};window.addEventListener("resize",B);let te=new ResizeObserver(()=>{requestAnimationFrame(w);});return te.observe(l.pagesContainer),()=>{window.removeEventListener("resize",B),te.disconnect();}},[l]);let $=Nu.useMemo(()=>{let w=[];if(l){for(let B of t)if(B.renderOverlay){let te=c.states.get(B.id);w.push(jsxRuntime.jsx("div",{className:"plugin-overlay","data-plugin-id":B.id,children:B.renderOverlay(l,te,i)},`overlay-${B.id}`));}}for(let B of t){if(!B.Panel||(B.panelConfig?.position??"right")!=="right")continue;let he={...Zi,...B.panelConfig},me=p.has(B.id),Ie=m.get(B.id)??he.defaultSize,Te=B.Panel,Re=c.states.get(B.id),P=_!==null?`${_}px`:"calc(50% + 428px)";w.push(jsxRuntime.jsxs("div",{className:`plugin-panel-in-viewport ${me?"collapsed":""}`,style:{width:me?"32px":`${Ie}px`,left:P},"data-plugin-id":B.id,children:[he.collapsible&&jsxRuntime.jsx("button",{className:"plugin-panel-toggle",onClick:()=>R(B.id),title:me?`Show ${B.name}`:`Hide ${B.name}`,"aria-label":me?`Show ${B.name}`:`Hide ${B.name}`,children:jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:me?"\u2039":"\u203A"})}),!me&&l&&jsxRuntime.jsx("div",{className:"plugin-panel-in-viewport-content",children:jsxRuntime.jsx(Te,{editorView:i,doc:i?.state.doc??null,scrollToPosition:b,selectRange:g,pluginState:Re,panelWidth:Ie,renderedDomContext:l})})]},`panel-overlay-${B.id}`));}return w.length>0?w:null},[l,t,c.version,i,p,m,b,g,R,_]),L=Nu.useCallback(w=>{u(w);let B=s.current?.onRenderedDomContextReady;typeof B=="function"&&B(w);},[]),W=Nu.useMemo(()=>Nu.cloneElement(n,{externalPlugins:E,pluginOverlays:$,onRenderedDomContextReady:L,onEditorViewReady:w=>{a(w);let B=s.current?.onEditorViewReady;typeof B=="function"&&B(w);}}),[n,E,$,L]),O=Nu.useMemo(()=>{let w=[],B=[],te=[];for(let he of t){if(!he.Panel)continue;let me=he.panelConfig?.position??"right";me==="left"?w.push(he):me==="bottom"?te.push(he):B.push(he);}return {left:w,right:B,bottom:te}},[t]),K=w=>{if(!w.Panel)return null;let B={...Zi,...w.panelConfig},te=p.has(w.id),he=m.get(w.id)??B.defaultSize,me=w.Panel,Ie=c.states.get(w.id);return jsxRuntime.jsxs("div",{className:`plugin-panel plugin-panel-${B.position} ${te?"collapsed":""}`,style:{[B.position==="bottom"?"height":"width"]:te?"32px":`${he}px`,minWidth:B.position!=="bottom"?te?"32px":`${B.minSize}px`:void 0,maxWidth:B.position!=="bottom"?`${B.maxSize}px`:void 0,minHeight:B.position==="bottom"?te?"32px":`${B.minSize}px`:void 0,maxHeight:B.position==="bottom"?`${B.maxSize}px`:void 0},"data-plugin-id":w.id,children:[B.collapsible&&jsxRuntime.jsxs("button",{className:"plugin-panel-toggle",onClick:()=>R(w.id),title:te?`Show ${w.name}`:`Hide ${w.name}`,"aria-label":te?`Show ${w.name}`:`Hide ${w.name}`,children:[jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:te?"\u203A":"\u2039"}),te&&jsxRuntime.jsx("span",{className:"plugin-panel-toggle-label",children:w.name})]}),!te&&jsxRuntime.jsx("div",{className:"plugin-panel-content",children:jsxRuntime.jsx(me,{editorView:i,doc:i?.state.doc??null,scrollToPosition:b,selectRange:g,pluginState:Ie,panelWidth:he,renderedDomContext:l??null})})]},w.id)};return jsxRuntime.jsxs("div",{className:`plugin-host ${o}`,children:[O.left.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-left",children:O.left.map(K)}),jsxRuntime.jsxs("div",{className:"plugin-host-editor",children:[W,O.bottom.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-bottom",children:O.bottom.map(K)})]})]})});exports.A=Ms;exports.B=tR;exports.C=nR;exports.D=Vu;exports.E=ju;exports.F=Uu;exports.G=oR;exports.H=rR;exports.I=iR;exports.J=aR;exports.K=Zb;exports.L=sR;exports.M=Gu;exports.N=Jb;exports.O=Ku;exports.P=lR;exports.Q=mR;exports.R=gR;exports.S=kR;exports.T=Qu;exports.U=iy;exports.a=cy;exports.b=ml;exports.c=cr;exports.d=dy;exports.e=uy;exports.f=py;exports.g=fy;exports.h=hl;exports.i=Hu;exports.j=F0;exports.k=$0;exports.l=Yt;exports.m=V0;exports.n=j0;exports.o=U0;exports.p=G0;exports.q=K0;exports.r=Y0;exports.s=q0;exports.t=X0;exports.u=Z0;exports.v=ho;exports.w=Q0;exports.x=eR;exports.y=_u;exports.z=Xb;
|